Fixed a couple URL problems, including redirect, which was previously entirely unable to utilize our AppHelper for the url generation. Added a couple menu items into the Admin section. Changed debug to be OFF for any route other than the 'dev' one.
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@551 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -66,6 +66,9 @@ class AppController extends Controller {
|
|||||||
$menu[] = array('name' => 'Accounts', 'url' => array('controller' => 'accounts', 'action' => 'index'));
|
$menu[] = array('name' => 'Accounts', 'url' => array('controller' => 'accounts', 'action' => 'index'));
|
||||||
$menu[] = array('name' => 'Contacts', 'url' => array('controller' => 'contacts', 'action' => 'index'));
|
$menu[] = array('name' => 'Contacts', 'url' => array('controller' => 'contacts', 'action' => 'index'));
|
||||||
$menu[] = array('name' => 'Ledgers', 'url' => array('controller' => 'ledgers', 'action' => 'index'));
|
$menu[] = array('name' => 'Ledgers', 'url' => array('controller' => 'ledgers', 'action' => 'index'));
|
||||||
|
$menu[] = array('name' => 'Transactions', 'url' => array('controller' => 'transactions', 'action' => 'index'));
|
||||||
|
$menu[] = array('name' => 'Ldgr Entries', 'url' => array('controller' => 'ledger_entries', 'action' => 'index'));
|
||||||
|
$menu[] = array('name' => 'Stmt Entries', 'url' => array('controller' => 'statement_entries', 'action' => 'index'));
|
||||||
$menu[] = array('name' => 'New Ledgers', 'url' => array('controller' => 'accounts', 'action' => 'newledger'));
|
$menu[] = array('name' => 'New Ledgers', 'url' => array('controller' => 'accounts', 'action' => 'newledger'));
|
||||||
$menu[] = array('name' => 'Assess Charges', 'url' => array('controller' => 'leases', 'action' => 'assess_all'));
|
$menu[] = array('name' => 'Assess Charges', 'url' => array('controller' => 'leases', 'action' => 'assess_all'));
|
||||||
}
|
}
|
||||||
@@ -86,12 +89,39 @@ class AppController extends Controller {
|
|||||||
(!empty($this->params['dev_route']));
|
(!empty($this->params['dev_route']));
|
||||||
$this->params['admin'] =
|
$this->params['admin'] =
|
||||||
(!empty($this->params['admin_route']) || !empty($this->params['dev_route']));
|
(!empty($this->params['admin_route']) || !empty($this->params['dev_route']));
|
||||||
|
|
||||||
|
if (!$this->params['dev'])
|
||||||
|
Configure::write('debug', '0');
|
||||||
}
|
}
|
||||||
|
|
||||||
function beforeRender() {
|
function beforeRender() {
|
||||||
$this->set('sidemenu', $this->sideMenuLinks());
|
$this->set('sidemenu', $this->sideMenuLinks());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function redirect($url, $status = null, $exit = true) {
|
||||||
|
if (headers_sent()) {
|
||||||
|
// If we've already sent the headers, it's because
|
||||||
|
// we're debugging, and our debug output has gotten
|
||||||
|
// out before the redirect. That's probably a good
|
||||||
|
// thing, as we don't typically want pages to be
|
||||||
|
// jerked out from under us while trying to read
|
||||||
|
// 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->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);
|
||||||
|
}
|
||||||
|
|
||||||
function reset_data() {
|
function reset_data() {
|
||||||
$this->layout = null;
|
$this->layout = null;
|
||||||
$this->autoLayout = false;
|
$this->autoLayout = false;
|
||||||
@@ -720,6 +750,8 @@ class AppController extends Controller {
|
|||||||
if (isset($params['post']['nolinks']))
|
if (isset($params['post']['nolinks']))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
App::import('Helper', 'Html');
|
||||||
|
|
||||||
foreach ($links AS $table => $fields) {
|
foreach ($links AS $table => $fields) {
|
||||||
$special = array('controller', 'action', 'id');
|
$special = array('controller', 'action', 'id');
|
||||||
$controller = Inflector::pluralize(Inflector::underscore($table));
|
$controller = Inflector::pluralize(Inflector::underscore($table));
|
||||||
@@ -738,9 +770,9 @@ class AppController extends Controller {
|
|||||||
//$params['linkrecord'][] = compact('table', 'field', 'id', 'controller', 'record');
|
//$params['linkrecord'][] = compact('table', 'field', 'id', 'controller', 'record');
|
||||||
$record[$table][$field] =
|
$record[$table][$field] =
|
||||||
'<A HREF="' .
|
'<A HREF="' .
|
||||||
Router::url(array('controller' => $controller,
|
HtmlHelper::url(array('controller' => $controller,
|
||||||
'action' => $action,
|
'action' => $action,
|
||||||
$record[$table][$id])) .
|
$record[$table][$id])) .
|
||||||
'">' .
|
'">' .
|
||||||
$record[$table][$field] .
|
$record[$table][$field] .
|
||||||
'</A>';
|
'</A>';
|
||||||
|
|||||||
Reference in New Issue
Block a user