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:
@@ -99,6 +99,12 @@ class AppController extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function redirect($url, $status = null, $exit = true) {
|
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 (headers_sent()) {
|
||||||
// If we've already sent the headers, it's because
|
// If we've already sent the headers, it's because
|
||||||
// we're debugging, and our debug output has gotten
|
// 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
|
// the debug output. So, since we can't redirect
|
||||||
// anyway, we may as well go with the flow and just
|
// anyway, we may as well go with the flow and just
|
||||||
// render this page instead, using an empty template
|
// render this page instead, using an empty template
|
||||||
|
$this->set('message',
|
||||||
|
("Intended redirect:<P><BR>" .
|
||||||
|
'<A HREF="'.$url.'">'.$url.'</A>'));
|
||||||
|
|
||||||
echo $this->render('/empty');
|
echo $this->render('/empty');
|
||||||
if ($exit)
|
if ($exit)
|
||||||
$this->_stop();
|
$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);
|
return parent::redirect($url, $status, $exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -126,8 +126,6 @@ class ContactsController extends AppController {
|
|||||||
|
|
||||||
// Now that the work is done, let the user view the updated contact
|
// Now that the work is done, let the user view the updated contact
|
||||||
$this->redirect(array('action'=>'view', $this->data['Contact']['id']));
|
$this->redirect(array('action'=>'view', $this->data['Contact']['id']));
|
||||||
//$this->render('/empty');
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id) {
|
if ($id) {
|
||||||
|
|||||||
@@ -287,23 +287,20 @@ class CustomersController extends AppController {
|
|||||||
if (isset($this->params['form']['cancel'])) {
|
if (isset($this->params['form']['cancel'])) {
|
||||||
if (isset($this->data['Customer']['id']))
|
if (isset($this->data['Customer']['id']))
|
||||||
$this->redirect(array('action'=>'view', $this->data['Customer']['id']));
|
$this->redirect(array('action'=>'view', $this->data['Customer']['id']));
|
||||||
else
|
|
||||||
$this->redirect(array('action'=>'index'));
|
$this->redirect(array('action'=>'index'));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure we have at least one contact
|
// Make sure we have at least one contact
|
||||||
if (!isset($this->data['Contact']) || count($this->data['Contact']) == 0) {
|
if (!isset($this->data['Contact']) || count($this->data['Contact']) == 0) {
|
||||||
$this->Session->setFlash("MUST SPECIFY AT LEAST ONE CONTACT", true);
|
$this->Session->setFlash("MUST SPECIFY AT LEAST ONE CONTACT", true);
|
||||||
$this->redirect(array('action'=>'view', $this->data['Customer']['id']));
|
$this->redirect(array('action'=>'view', $this->data['Customer']['id']));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure there is a primary contact
|
// Make sure there is a primary contact
|
||||||
if (!isset($this->data['Customer']['primary_contact_entry'])) {
|
if (!isset($this->data['Customer']['primary_contact_entry'])) {
|
||||||
$this->Session->setFlash("MUST SPECIFY A PRIMARY CONTACT", true);
|
$this->Session->setFlash("MUST SPECIFY A PRIMARY CONTACT", true);
|
||||||
$this->redirect(array('action'=>'view', $this->data['Customer']['id']));
|
$this->redirect(array('action'=>'view', $this->data['Customer']['id']));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Go through each customer and strip the bogus ID if new
|
// Go through each customer and strip the bogus ID if new
|
||||||
@@ -320,17 +317,12 @@ class CustomersController extends AppController {
|
|||||||
pr("CUSTOMER SAVE FAILED");
|
pr("CUSTOMER SAVE FAILED");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If existing customer, then view it. Otherwise, since
|
// If existing customer, then view it.
|
||||||
// this is a new customer, go to the move in screen.
|
|
||||||
if ($this->data['Customer']['id'])
|
if ($this->data['Customer']['id'])
|
||||||
$this->redirect(array('action'=>'view', $this->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
|
// Since this is a new customer, go to the move in screen.
|
||||||
// commented out, otherwise this section isn't reached.
|
$this->redirect(array('action'=>'move_in', $this->Customer->id));
|
||||||
$this->render('/empty');
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id) {
|
if ($id) {
|
||||||
@@ -499,7 +491,8 @@ class CustomersController extends AppController {
|
|||||||
|
|
||||||
/* pr(compact('unreconciled')); */
|
/* pr(compact('unreconciled')); */
|
||||||
/* echo htmlspecialchars($xml->serialize($unreconciled)); */
|
/* echo htmlspecialchars($xml->serialize($unreconciled)); */
|
||||||
/* $this->render('/fake'); */
|
/* $this->render('/empty'); */
|
||||||
|
/* return; */
|
||||||
|
|
||||||
$opts = array();
|
$opts = array();
|
||||||
//$opts['format'] = 'tags';
|
//$opts['format'] = 'tags';
|
||||||
|
|||||||
@@ -158,10 +158,6 @@ class LeasesController extends AppController {
|
|||||||
// Since this is a new lease, go to the invoice
|
// Since this is a new lease, go to the invoice
|
||||||
// screen so we can start assessing charges.
|
// screen so we can start assessing charges.
|
||||||
$this->redirect(array('action'=>'invoice', $lid, 'move-in'));
|
$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) { */
|
/* function promote_surplus($id) { */
|
||||||
/* $this->Lease->promoteSurplus($id); */
|
/* $this->Lease->promoteSurplus($id); */
|
||||||
/* pr("PREVENTING REDIRECT"); */
|
|
||||||
/* $this->render('fake'); */
|
|
||||||
/* $this->redirect(array('controller' => 'leases', */
|
/* $this->redirect(array('controller' => 'leases', */
|
||||||
/* 'action' => 'view', */
|
/* 'action' => 'view', */
|
||||||
/* $id)); */
|
/* $id)); */
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ class MapsController extends AppController {
|
|||||||
));
|
));
|
||||||
|
|
||||||
/* pr(compact('map', 'units')); */
|
/* pr(compact('map', 'units')); */
|
||||||
/* $this->render('/fake'); */
|
/* $this->render('/empty'); */
|
||||||
/* return; */
|
/* return; */
|
||||||
|
|
||||||
/*****
|
/*****
|
||||||
@@ -171,7 +171,7 @@ class MapsController extends AppController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* pr($info); */
|
/* pr($info); */
|
||||||
/* $this->render('/fake'); */
|
/* $this->render('/empty'); */
|
||||||
return $info;
|
return $info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -233,11 +233,6 @@ class TendersController extends AppController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->redirect(array('action'=>'view', $this->Tender->id));
|
$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) {
|
if ($id) {
|
||||||
|
|||||||
@@ -308,11 +308,6 @@ class UnitsController extends AppController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->redirect(array('action'=>'view', $this->Unit->id));
|
$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) {
|
if ($id) {
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?php /* -*- mode:PHP -*- */
|
||||||
|
if (!empty($message))
|
||||||
|
echo $message;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user