Added admin page to link to backend functionality like Currencies and Countries. Closes #34

This commit is contained in:
Karl Cordes 2011-10-24 18:14:07 +11:00
parent aa7a25e5c2
commit a36d7db4d8
8 changed files with 139 additions and 109 deletions

View file

@ -46,5 +46,8 @@ Router::connect('/', array('controller' => 'enquiries', 'action' => 'index'));
Router::connect('/tests', array('controller' => 'tests', 'action' => 'index')); Router::connect('/tests', array('controller' => 'tests', 'action' => 'index'));
Router::connect('/admin', array('controller'=>'pages','action'=>'display','admin')); //Display the admin page
?> ?>

View file

@ -4,11 +4,15 @@ class CountriesController extends AppController {
var $name = 'Countries'; var $name = 'Countries';
var $helpers = array('Html', 'Form'); var $helpers = array('Html', 'Form');
var $paginate = array('Enquiry' => array('order' => array('Enquiry.id' => 'asc'))); var $paginate = array(
'limit' => 400,
'Enquiry' => array('order' => array('Enquiry.id' => 'asc'))
);
function index() { function index() {
$this->Country->recursive = 0; $this->Country->recursive = 0;
$this->set('countries', $this->paginate()); $this->set('countries', $this->paginate());
//$this->set('countries', $this->Country->find('all'));
} }
function view($id = null) { function view($id = null) {

View file

@ -1,27 +1,27 @@
<?php <?php
class Costing extends AppModel { class Costing extends AppModel {
var $name = 'Costing'; var $name = 'Costing';
//The Associations below have been created with all possible keys, those that are not needed can be removed //The Associations below have been created with all possible keys, those that are not needed can be removed
var $belongsTo = array( var $belongsTo = array(
'Product' => array('className' => 'Product', 'Product' => array('className' => 'Product',
'foreignKey' => 'product_id', 'foreignKey' => 'product_id',
'conditions' => '', 'conditions' => '',
'fields' => '', 'fields' => '',
'order' => '' 'order' => ''
), ),
'LineItem' => array('className'=>'LineItem','foreignKey' => 'line_item_id' 'LineItem' => array('className'=>'LineItem','foreignKey' => 'line_item_id'
), ),
'PurchaseCurrency' => array('className' => 'Currency', 'foreignKey' => 'purchase_currency_id'), 'PurchaseCurrency' => array('className' => 'Currency', 'foreignKey' => 'purchase_currency_id'),
'SaleCurrency' => array('className' => 'Currency', 'foreignKey' => 'sale_currency_id') 'SaleCurrency' => array('className' => 'Currency', 'foreignKey' => 'sale_currency_id')
); );
} }
?> ?>

View file

@ -50,11 +50,5 @@ foreach ($countries as $country):
<li><?php echo $html->link(__('New Country', true), array('action'=>'add')); ?></li> <li><?php echo $html->link(__('New Country', true), array('action'=>'add')); ?></li>
<li><?php echo $html->link(__('List Currencies', true), array('controller'=> 'currencies', 'action'=>'index')); ?> </li> <li><?php echo $html->link(__('List Currencies', true), array('controller'=> 'currencies', 'action'=>'index')); ?> </li>
<li><?php echo $html->link(__('New Currency', true), array('controller'=> 'currencies', 'action'=>'add')); ?> </li> <li><?php echo $html->link(__('New Currency', true), array('controller'=> 'currencies', 'action'=>'add')); ?> </li>
<li><?php echo $html->link(__('List Addresses', true), array('controller'=> 'addresses', 'action'=>'index')); ?> </li>
<li><?php echo $html->link(__('New Address', true), array('controller'=> 'addresses', 'action'=>'add')); ?> </li>
<li><?php echo $html->link(__('List Enquiries', true), array('controller'=> 'enquiries', 'action'=>'index')); ?> </li>
<li><?php echo $html->link(__('New Enquiry', true), array('controller'=> 'enquiries', 'action'=>'add')); ?> </li>
<li><?php echo $html->link(__('List Principles', true), array('controller'=> 'principles', 'action'=>'index')); ?> </li>
<li><?php echo $html->link(__('New Principle', true), array('controller'=> 'principles', 'action'=>'add')); ?> </li>
</ul> </ul>
</div> </div>

View file

@ -52,11 +52,5 @@ foreach ($currencies as $currency):
<div class="actions"> <div class="actions">
<ul> <ul>
<li><?php echo $html->link(__('New Currency', true), array('action'=>'add')); ?></li> <li><?php echo $html->link(__('New Currency', true), array('action'=>'add')); ?></li>
<li><?php echo $html->link(__('List Countries', true), array('controller'=> 'countries', 'action'=>'index')); ?> </li>
<li><?php echo $html->link(__('New Country', true), array('controller'=> 'countries', 'action'=>'add')); ?> </li>
<li><?php echo $html->link(__('List Principles', true), array('controller'=> 'principles', 'action'=>'index')); ?> </li>
<li><?php echo $html->link(__('New Principle', true), array('controller'=> 'principles', 'action'=>'add')); ?> </li>
<li><?php echo $html->link(__('List Quoted Products', true), array('controller'=> 'quoted_products', 'action'=>'index')); ?> </li>
<li><?php echo $html->link(__('New Quoted Product', true), array('controller'=> 'quoted_products', 'action'=>'add')); ?> </li>
</ul> </ul>
</div> </div>

View file

@ -1,5 +1,5 @@
<?php /* Quotenik 1.2 - Default Layout. Some Markup retained from CakePHP Default <?php /* Quotenik 1.2 - Default Layout. Some Markup retained from CakePHP Default
*/ ?> */ ?>
<!DOCTYPE html> <!DOCTYPE html>
@ -7,36 +7,36 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title> <title>
<?php __('CMC'); ?> <?php __('CMC'); ?>
<?php echo $title_for_layout; ?> <?php echo $title_for_layout; ?>
</title> </title>
<?php <?php
$debugLevel = Configure::read('debug'); $debugLevel = Configure::read('debug');
if ($debugLevel > 0) { if ($debugLevel > 0) {
echo $html->meta('favicon.ico', '/img/core.png', array('type' => 'icon')); echo $html->meta('favicon.ico', '/img/core.png', array('type' => 'icon'));
} else { } else {
echo $html->meta('icon'); echo $html->meta('icon');
} }
echo $html->css('quotenik'); echo $html->css('quotenik');
echo $html->css('jquery-ui.custom.css'); echo $html->css('jquery-ui.custom.css');
//echo $javascript->link('ckeditor/ckeditor'); //echo $javascript->link('ckeditor/ckeditor');
echo $javascript->link('jquery'); echo $javascript->link('jquery');
echo $javascript->link('jquery-ui'); echo $javascript->link('jquery-ui');
echo $javascript->link('jquery.form'); echo $javascript->link('jquery.form');
echo $javascript->link('menu'); echo $javascript->link('menu');
echo $javascript->link('global'); echo $javascript->link('global');
echo $javascript->link('search'); echo $javascript->link('search');
echo $javascript->link('jquery.jeditable.mini'); echo $javascript->link('jquery.jeditable.mini');
echo $javascript->link('jquery.validate'); echo $javascript->link('jquery.validate');
echo $scripts_for_layout; echo $scripts_for_layout;
?> ?>
</head> </head>
@ -48,14 +48,14 @@
<div id="username"> <div id="username">
<?php <?php
if (isset($currentuser) == FALSE) { if (isset($currentuser) == FALSE) {
echo $html->link('Login', '/users/login'); echo $html->link('Login', '/users/login');
} else { } else {
$logoutlink = $html->link('Logout', '/users/logout'); $logoutlink = $html->link('Logout', '/users/logout');
echo $html->link($currentuser['User']['username'], '/users/view/' . $currentuser['User']['id']) . ' (' . $logoutlink . ')'; echo $html->link($currentuser['User']['username'], '/users/view/' . $currentuser['User']['id']) . ' (' . $logoutlink . ')';
} }
?> ?>
</div> </div>
<div id="navdiv"> <div id="navdiv">
@ -67,7 +67,7 @@ if (isset($currentuser) == FALSE) {
</ul> </ul>
</li> </li>
<li><?php echo $html->link('Documents', '/documents/index'); ?> <li><?php echo $html->link('Documents', '/documents/index'); ?>
<ul> <ul>
<li class="last"><?php echo $html->link('Documents Index', '/documents/index'); ?></li> <li class="last"><?php echo $html->link('Documents Index', '/documents/index'); ?></li>
</ul> </ul>
@ -76,12 +76,12 @@ if (isset($currentuser) == FALSE) {
<li><?php echo $html->link('Jobs', '/jobs/index'); ?> <li><?php echo $html->link('Jobs', '/jobs/index'); ?>
<ul> <ul>
<? <?
if ($currentuser['User']['access_level'] == 'manager' || $currentuser['User']['access_level'] == 'admin'): if ($currentuser['User']['access_level'] == 'manager' || $currentuser['User']['access_level'] == 'admin'):
?> ?>
<li><?= $html->link('Reports', '/jobs/reports'); ?></li> <li><?= $html->link('Reports', '/jobs/reports'); ?></li>
<? endif; ?> <? endif; ?>
<li class="last"><?php echo $html->link('Job List', '/jobs/index'); ?></li> <li class="last"><?php echo $html->link('Job List', '/jobs/index'); ?></li>
</ul> </ul>
@ -137,7 +137,7 @@ if ($currentuser['User']['access_level'] == 'manager' || $currentuser['User']['a
</ul> </ul>
</li> </li>
<?php /* <li> echo $html->link('Users', '/users/index'); ?> <?php /* <li> echo $html->link('Users', '/users/index'); ?>
<ul> <ul>
<li> echo $html->link('Users Index', '/users/index'); </li> <li> echo $html->link('Users Index', '/users/index'); </li>
<li class="last"><?php echo $html->link('Add User', '/users/add'); </li> <li class="last"><?php echo $html->link('Add User', '/users/add'); </li>
@ -152,6 +152,13 @@ if ($currentuser['User']['access_level'] == 'manager' || $currentuser['User']['a
</ul> </ul>
</li> </li>
<?
if ($currentuser['User']['access_level'] == 'manager' || $currentuser['User']['access_level'] == 'admin'):
?>
<li class="extra"><?=$html->link('Admin', '/admin'); ?>
</li>
<? endif; ?>
</ul> </ul>
@ -159,24 +166,24 @@ if ($currentuser['User']['access_level'] == 'manager' || $currentuser['User']['a
</div> </div>
<div id="content"> <div id="content">
<?php <?php
if ($session->check('Message.flash')): if ($session->check('Message.flash')):
$session->flash(); $session->flash();
endif; endif;
?> ?>
<div id="globalAjaxLoading"> <div id="globalAjaxLoading">
<h3>Loading, please wait</h3> <h3>Loading, please wait</h3>
<?php echo $html->image('ajax-loader.gif'); ?> <?php echo $html->image('ajax-loader.gif'); ?>
</div> </div>
<?php echo $content_for_layout; ?> <?php echo $content_for_layout; ?>
</div> </div>
<div id="footer"> <div id="footer">
<?php <?php
echo $html->link( echo $html->link(
$html->image('cake.power.gif', array('alt' => __("CakePHP: the rapid development php framework", true), 'border' => "0")), 'http://www.cakephp.org/', array('target' => '_new'), null, false $html->image('cake.power.gif', array('alt' => __("CakePHP: the rapid development php framework", true), 'border' => "0")), 'http://www.cakephp.org/', array('target' => '_new'), null, false
); );
?> ?>
</div> </div>
</div> </div>
@ -184,28 +191,28 @@ endif;
<?php <?php
echo $form->create('Enquiry', array('default' => false, 'id' => 'searchForm', 'default' => 'false')); echo $form->create('Enquiry', array('default' => false, 'id' => 'searchForm', 'default' => 'false'));
echo '<h2>Search'; echo '<h2>Search';
echo $html->image('system-search.png'); echo $html->image('system-search.png');
echo '</h2>'; echo '</h2>';
echo "<p>Search for: Enquiry Number, Job Number, Customer, Contact or Customer Order Number</p>"; echo "<p>Search for: Enquiry Number, Job Number, Customer, Contact or Customer Order Number</p>";
echo $form->input('Enquiry.search_string', array('label' => false, 'id' => 'searchString')); echo $form->input('Enquiry.search_string', array('label' => false, 'id' => 'searchString'));
?> ?>
<div class ="ui-widget"> <div class ="ui-widget">
<button id="searchButton">Search</button> <button id="searchButton">Search</button>
</div> </div>
<? <?
echo $form->end(); echo $form->end();
?> ?>
<div id="ajaxLoading"> <div id="ajaxLoading">
<h2>Loading, please wait..</h2> <h2>Loading, please wait..</h2>
<?php echo $html->image('ajax-loader.gif'); ?> <?php echo $html->image('ajax-loader.gif'); ?>
</div> </div>
@ -213,22 +220,22 @@ endif;
</div> </div>
<?php <?php
$mem_usage = memory_get_usage(true); $mem_usage = memory_get_usage(true);
if ($mem_usage < 1024) if ($mem_usage < 1024)
echo $mem_usage . " bytes"; echo $mem_usage . " bytes";
elseif ($mem_usage < 1048576) elseif ($mem_usage < 1048576)
echo round($mem_usage / 1024, 2) . " kilobytes"; echo round($mem_usage / 1024, 2) . " kilobytes";
else else
echo round($mem_usage / 1048576, 2) . " megabytes"; echo round($mem_usage / 1048576, 2) . " megabytes";
echo "<br/>"; echo "<br/>";
?> ?>
<?php // debug($currentuser); ?> <?php // debug($currentuser); ?>
<?php echo $cakeDebug; ?> <?php echo $cakeDebug; ?>
</body> </body>
</html> </html>

11
views/pages/admin.ctp Normal file
View file

@ -0,0 +1,11 @@
<div class="warning">
<p>WARNING: Deleting any records from these tables can have serious implications for data integrity.</p>
<p>ie.Records in other tables could potentially end up referencing non-existing records. if currency id 2 were deleted, all records referencing AUD will be break.</p>
<p>Tread carefully.</p>
</div>
<ul id="extraModels">
<li><?=$html->link('Countries', '/countries/index');?></li>
<li><?=$html->link('Currencies', '/currencies/index');?></li>
</ul>

View file

@ -143,7 +143,7 @@ ul.principle-emails {
/* background: #E9E9E9 url(../img/top-gradient2.png) repeat-x bottom; */ /* background: #E9E9E9 url(../img/top-gradient2.png) repeat-x bottom; */
/* background: #4686c3 url(../img/gradient-blue4.png) repeat-x bottom; */ /* background: #4686c3 url(../img/gradient-blue4.png) repeat-x bottom; */
background: #4686c3; background: #4686c3;
height: 30px; height: 3em;
/* background: #6BBA70; */ /* background: #6BBA70; */
padding-bottom: 2%; padding-bottom: 2%;
@ -204,7 +204,7 @@ ul.principle-emails {
#nav li { #nav li {
float:left; float:left;
display:block; display:block;
width:80px; width:85px;
/*width: 6em; */ /*width: 6em; */
padding-right: 1em; padding-right: 1em;
position:relative; position:relative;
@ -213,10 +213,14 @@ ul.principle-emails {
background: #4686c3; background: #4686c3;
} }
#nav li.extra {
margin-left: 2em;
}
/* this is the parent menu */ /* this is the parent menu */
#nav li a { #nav li a {
display:block; display:block;
width:80px; width:85px;
/* padding:8px 5px 0 5px; */ /* padding:8px 5px 0 5px; */
text-decoration:none; text-decoration:none;
@ -1625,4 +1629,17 @@ div.documentDetails {
div.docOperations { div.docOperations {
float: right; float: right;
}
div.warning {
font-size: 2em;
padding-bottom: 1em;
}
#extraModels {
list-style: none;
}
#extraModels li {
font-size: 1.5em;
} }