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

@ -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>
@ -48,14 +48,14 @@
<div id="username">
<?php
if (isset($currentuser) == FALSE) {
<?php
if (isset($currentuser) == FALSE) {
echo $html->link('Login', '/users/login');
} else {
} else {
$logoutlink = $html->link('Logout', '/users/logout');
echo $html->link($currentuser['User']['username'], '/users/view/' . $currentuser['User']['id']) . ' (' . $logoutlink . ')';
}
?>
}
?>
</div>
<div id="navdiv">
@ -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; ?>
<? 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,16 +166,16 @@ if ($currentuser['User']['access_level'] == 'manager' || $currentuser['User']['a
</div>
<div id="content">
<?php
if ($session->check('Message.flash')):
<?php
if ($session->check('Message.flash')):
$session->flash();
endif;
?>
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">
@ -213,17 +220,17 @@ endif;
</div>
<?php
$mem_usage = memory_get_usage(true);
<?php
$mem_usage = memory_get_usage(true);
if ($mem_usage < 1024)
if ($mem_usage < 1024)
echo $mem_usage . " bytes";
elseif ($mem_usage < 1048576)
elseif ($mem_usage < 1048576)
echo round($mem_usage / 1024, 2) . " kilobytes";
else
else
echo round($mem_usage / 1048576, 2) . " megabytes";
echo "<br/>";
?>
echo "<br/>";
?>
<?php // debug($currentuser); ?>

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;
}