Cleaned up several places regarding redirect and rendering during development for debug purposes. Also, added a link to the intended redirect target when we've rendered instead. These changes haven't been tested, hopefully they are benign.

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@563 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-08-14 21:49:42 +00:00
parent ac6a830d27
commit d40f43c617
8 changed files with 24 additions and 40 deletions

View File

@@ -99,6 +99,12 @@ class AppController extends Controller {
}
function redirect($url, $status = null, $exit = true) {
// OK, since the controller will not be able to
// utilize our overriden url function in AppHelper,
// we'll have to do it manually here.
App::import('Helper', 'Html');
$url = HtmlHelper::url($url, true);
if (headers_sent()) {
// If we've already sent the headers, it's because
// we're debugging, and our debug output has gotten
@@ -108,17 +114,15 @@ class AppController extends Controller {
// the debug output. So, since we can't redirect
// anyway, we may as well go with the flow and just
// render this page instead, using an empty template
$this->set('message',
("Intended redirect:<P><BR>" .
'<A HREF="'.$url.'">'.$url.'</A>'));
echo $this->render('/empty');
if ($exit)
$this->_stop();
}
// OK, since the controller will not be able to
// utilize our overriden url function in AppHelper,
// we'll have to do it manually here.
App::import('Helper', 'Html');
$url = HtmlHelper::url($url, true);
return parent::redirect($url, $status, $exit);
}

View File

@@ -126,8 +126,6 @@ class ContactsController extends AppController {
// Now that the work is done, let the user view the updated contact
$this->redirect(array('action'=>'view', $this->data['Contact']['id']));
//$this->render('/empty');
return;
}
if ($id) {

View File

@@ -287,23 +287,20 @@ class CustomersController extends AppController {
if (isset($this->params['form']['cancel'])) {
if (isset($this->data['Customer']['id']))
$this->redirect(array('action'=>'view', $this->data['Customer']['id']));
else
$this->redirect(array('action'=>'index'));
return;
}
// Make sure we have at least one contact
if (!isset($this->data['Contact']) || count($this->data['Contact']) == 0) {
$this->Session->setFlash("MUST SPECIFY AT LEAST ONE CONTACT", true);
$this->redirect(array('action'=>'view', $this->data['Customer']['id']));
return;
}
// Make sure there is a primary contact
if (!isset($this->data['Customer']['primary_contact_entry'])) {
$this->Session->setFlash("MUST SPECIFY A PRIMARY CONTACT", true);
$this->redirect(array('action'=>'view', $this->data['Customer']['id']));
return;
}
// Go through each customer and strip the bogus ID if new
@@ -320,17 +317,12 @@ class CustomersController extends AppController {
pr("CUSTOMER SAVE FAILED");
}
// If existing customer, then view it. Otherwise, since
// this is a new customer, go to the move in screen.
// If existing customer, then view it.
if ($this->data['Customer']['id'])
$this->redirect(array('action'=>'view', $this->Customer->id));
else
$this->redirect(array('action'=>'move_in', $this->Customer->id));
// For debugging, only if the redirects above have been
// commented out, otherwise this section isn't reached.
$this->render('/empty');
return;
// Since this is a new customer, go to the move in screen.
$this->redirect(array('action'=>'move_in', $this->Customer->id));
}
if ($id) {
@@ -499,7 +491,8 @@ class CustomersController extends AppController {
/* pr(compact('unreconciled')); */
/* echo htmlspecialchars($xml->serialize($unreconciled)); */
/* $this->render('/fake'); */
/* $this->render('/empty'); */
/* return; */
$opts = array();
//$opts['format'] = 'tags';

View File

@@ -158,10 +158,6 @@ class LeasesController extends AppController {
// Since this is a new lease, go to the invoice
// screen so we can start assessing charges.
$this->redirect(array('action'=>'invoice', $lid, 'move-in'));
// For debugging, only if the redirect above have been
// commented out, otherwise this section isn't reached.
$this->render('/empty');
}
/**************************************************************************
@@ -231,8 +227,6 @@ class LeasesController extends AppController {
/* function promote_surplus($id) { */
/* $this->Lease->promoteSurplus($id); */
/* pr("PREVENTING REDIRECT"); */
/* $this->render('fake'); */
/* $this->redirect(array('controller' => 'leases', */
/* 'action' => 'view', */
/* $id)); */

View File

@@ -109,7 +109,7 @@ class MapsController extends AppController {
));
/* pr(compact('map', 'units')); */
/* $this->render('/fake'); */
/* $this->render('/empty'); */
/* return; */
/*****
@@ -171,7 +171,7 @@ class MapsController extends AppController {
}
/* pr($info); */
/* $this->render('/fake'); */
/* $this->render('/empty'); */
return $info;
}

View File

@@ -233,11 +233,6 @@ class TendersController extends AppController {
}
$this->redirect(array('action'=>'view', $this->Tender->id));
// For debugging, only if the redirects above have been
// commented out, otherwise this section isn't reached.
$this->render('/fake');
return;
}
if ($id) {

View File

@@ -308,11 +308,6 @@ class UnitsController extends AppController {
}
$this->redirect(array('action'=>'view', $this->Unit->id));
// For debugging, only if the redirects above have been
// commented out, otherwise this section isn't reached.
$this->render('/fake');
return;
}
if ($id) {

View File

@@ -0,0 +1,5 @@
<?php /* -*- mode:PHP -*- */
if (!empty($message))
echo $message;