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('/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 $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() {
$this->Country->recursive = 0;
$this->set('countries', $this->paginate());
//$this->set('countries', $this->Country->find('all'));
}
function view($id = null) {

View file

@ -1,27 +1,27 @@
<?php
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
var $belongsTo = array(
'Product' => array('className' => 'Product',
'foreignKey' => 'product_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
//The Associations below have been created with all possible keys, those that are not needed can be removed
var $belongsTo = array(
'Product' => array('className' => 'Product',
'foreignKey' => 'product_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'LineItem' => array('className'=>'LineItem','foreignKey' => 'line_item_id'
),
'PurchaseCurrency' => array('className' => 'Currency', 'foreignKey' => 'purchase_currency_id'),
'SaleCurrency' => array('className' => 'Currency', 'foreignKey' => 'sale_currency_id')
'LineItem' => array('className'=>'LineItem','foreignKey' => 'line_item_id'
),
'PurchaseCurrency' => array('className' => 'Currency', 'foreignKey' => 'purchase_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(__('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(__('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>
</div>

View file

@ -52,11 +52,5 @@ foreach ($currencies as $currency):
<div class="actions">
<ul>
<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>
</div>

View file

@ -1,5 +1,5 @@
<?php /* Quotenik 1.2 - Default Layout. Some Markup retained from CakePHP Default
*/ ?>
*/ ?>
<!DOCTYPE html>
@ -7,36 +7,36 @@
<head>
<meta charset="utf-8">
<title>
<?php __('CMC'); ?>
<?php echo $title_for_layout; ?>
<?php __('CMC'); ?>
<?php echo $title_for_layout; ?>
</title>
<?php
$debugLevel = Configure::read('debug');
<?php
$debugLevel = Configure::read('debug');
if ($debugLevel > 0) {
echo $html->meta('favicon.ico', '/img/core.png', array('type' => 'icon'));
} else {
echo $html->meta('icon');
}
if ($debugLevel > 0) {
echo $html->meta('favicon.ico', '/img/core.png', array('type' => 'icon'));
} else {
echo $html->meta('icon');
}
echo $html->css('quotenik');
echo $html->css('jquery-ui.custom.css');
echo $html->css('quotenik');
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.form');
echo $javascript->link('menu');
echo $javascript->link('global');
echo $javascript->link('search');
echo $javascript->link('jquery.jeditable.mini');
echo $javascript->link('jquery.validate');
echo $javascript->link('jquery-ui');
echo $javascript->link('jquery.form');
echo $javascript->link('menu');
echo $javascript->link('global');
echo $javascript->link('search');
echo $javascript->link('jquery.jeditable.mini');
echo $javascript->link('jquery.validate');
echo $scripts_for_layout;
?>
echo $scripts_for_layout;
?>
</head>
@ -48,14 +48,14 @@
<div id="username">
<?php
if (isset($currentuser) == FALSE) {
echo $html->link('Login', '/users/login');
} else {
$logoutlink = $html->link('Logout', '/users/logout');
echo $html->link($currentuser['User']['username'], '/users/view/' . $currentuser['User']['id']) . ' (' . $logoutlink . ')';
}
?>
<?php
if (isset($currentuser) == FALSE) {
echo $html->link('Login', '/users/login');
} else {
$logoutlink = $html->link('Logout', '/users/logout');
echo $html->link($currentuser['User']['username'], '/users/view/' . $currentuser['User']['id']) . ' (' . $logoutlink . ')';
}
?>
</div>
<div id="navdiv">
@ -67,7 +67,7 @@ if (isset($currentuser) == FALSE) {
</ul>
</li>
<li><?php echo $html->link('Documents', '/documents/index'); ?>
<li><?php echo $html->link('Documents', '/documents/index'); ?>
<ul>
<li class="last"><?php echo $html->link('Documents Index', '/documents/index'); ?></li>
</ul>
@ -76,12 +76,12 @@ if (isset($currentuser) == FALSE) {
<li><?php echo $html->link('Jobs', '/jobs/index'); ?>
<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>
<? endif; ?>
?>
<li><?= $html->link('Reports', '/jobs/reports'); ?></li>
<? endif; ?>
<li class="last"><?php echo $html->link('Job List', '/jobs/index'); ?></li>
</ul>
@ -137,7 +137,7 @@ if ($currentuser['User']['access_level'] == 'manager' || $currentuser['User']['a
</ul>
</li>
<?php /* <li> echo $html->link('Users', '/users/index'); ?>
<?php /* <li> echo $html->link('Users', '/users/index'); ?>
<ul>
<li> echo $html->link('Users Index', '/users/index'); </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>
</li>
<?
if ($currentuser['User']['access_level'] == 'manager' || $currentuser['User']['access_level'] == 'admin'):
?>
<li class="extra"><?=$html->link('Admin', '/admin'); ?>
</li>
<? endif; ?>
</ul>
@ -159,24 +166,24 @@ if ($currentuser['User']['access_level'] == 'manager' || $currentuser['User']['a
</div>
<div id="content">
<?php
if ($session->check('Message.flash')):
$session->flash();
endif;
?>
<?php
if ($session->check('Message.flash')):
$session->flash();
endif;
?>
<div id="globalAjaxLoading">
<h3>Loading, please wait</h3>
<?php echo $html->image('ajax-loader.gif'); ?>
<?php echo $html->image('ajax-loader.gif'); ?>
</div>
<?php echo $content_for_layout; ?>
<?php echo $content_for_layout; ?>
</div>
<div id="footer">
<?php
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
);
?>
<?php
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
);
?>
</div>
</div>
@ -184,28 +191,28 @@ endif;
<?php
echo $form->create('Enquiry', array('default' => false, 'id' => 'searchForm', 'default' => 'false'));
echo '<h2>Search';
echo $html->image('system-search.png');
echo '</h2>';
echo "<p>Search for: Enquiry Number, Job Number, Customer, Contact or Customer Order Number</p>";
<?php
echo $form->create('Enquiry', array('default' => false, 'id' => 'searchForm', 'default' => 'false'));
echo '<h2>Search';
echo $html->image('system-search.png');
echo '</h2>';
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">
<button id="searchButton">Search</button>
</div>
<?
echo $form->end();
?>
<?
echo $form->end();
?>
<div id="ajaxLoading">
<h2>Loading, please wait..</h2>
<?php echo $html->image('ajax-loader.gif'); ?>
<?php echo $html->image('ajax-loader.gif'); ?>
</div>
@ -213,22 +220,22 @@ endif;
</div>
<?php
$mem_usage = memory_get_usage(true);
<?php
$mem_usage = memory_get_usage(true);
if ($mem_usage < 1024)
echo $mem_usage . " bytes";
elseif ($mem_usage < 1048576)
echo round($mem_usage / 1024, 2) . " kilobytes";
else
echo round($mem_usage / 1048576, 2) . " megabytes";
echo "<br/>";
?>
if ($mem_usage < 1024)
echo $mem_usage . " bytes";
elseif ($mem_usage < 1048576)
echo round($mem_usage / 1024, 2) . " kilobytes";
else
echo round($mem_usage / 1048576, 2) . " megabytes";
echo "<br/>";
?>
<?php // debug($currentuser); ?>
<?php // debug($currentuser); ?>
<?php echo $cakeDebug; ?>
<?php echo $cakeDebug; ?>
</body>
</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: #4686c3 url(../img/gradient-blue4.png) repeat-x bottom; */
background: #4686c3;
height: 30px;
height: 3em;
/* background: #6BBA70; */
padding-bottom: 2%;
@ -204,7 +204,7 @@ ul.principle-emails {
#nav li {
float:left;
display:block;
width:80px;
width:85px;
/*width: 6em; */
padding-right: 1em;
position:relative;
@ -213,10 +213,14 @@ ul.principle-emails {
background: #4686c3;
}
#nav li.extra {
margin-left: 2em;
}
/* this is the parent menu */
#nav li a {
display:block;
width:80px;
width:85px;
/* padding:8px 5px 0 5px; */
text-decoration:none;
@ -1626,3 +1630,16 @@ div.documentDetails {
div.docOperations {
float: right;
}
div.warning {
font-size: 2em;
padding-bottom: 1em;
}
#extraModels {
list-style: none;
}
#extraModels li {
font-size: 1.5em;
}