From 319df8f534520c8c926d0cdaa1f5577c7bd8a909 Mon Sep 17 00:00:00 2001 From: wei <> Date: Mon, 17 Jul 2006 23:19:39 +0000 Subject: Update time-tracker application --- .../pages/TimeTracker/ProjectDetails.page | 4 ++ .../protected/pages/TimeTracker/ProjectList.page | 4 ++ .../protected/pages/TimeTracker/ReportProject.page | 4 ++ .../pages/TimeTracker/ReportResource.page | 4 ++ .../protected/pages/TimeTracker/SiteMap.php | 51 +++++++++++++++++++++- .../protected/pages/TimeTracker/SiteMap.tpl | 14 ++++-- .../protected/pages/TimeTracker/TimeEntry.page | 4 ++ .../protected/pages/TimeTracker/UserCreate.page | 12 ++++- .../protected/pages/TimeTracker/UserCreate.php | 18 +++++--- .../protected/pages/TimeTracker/config.xml | 2 + 10 files changed, 106 insertions(+), 11 deletions(-) create mode 100644 demos/time-tracker/protected/pages/TimeTracker/ProjectDetails.page create mode 100644 demos/time-tracker/protected/pages/TimeTracker/ProjectList.page create mode 100644 demos/time-tracker/protected/pages/TimeTracker/ReportProject.page create mode 100644 demos/time-tracker/protected/pages/TimeTracker/ReportResource.page create mode 100644 demos/time-tracker/protected/pages/TimeTracker/TimeEntry.page (limited to 'demos/time-tracker/protected/pages') diff --git a/demos/time-tracker/protected/pages/TimeTracker/ProjectDetails.page b/demos/time-tracker/protected/pages/TimeTracker/ProjectDetails.page new file mode 100644 index 00000000..a8a7d1d3 --- /dev/null +++ b/demos/time-tracker/protected/pages/TimeTracker/ProjectDetails.page @@ -0,0 +1,4 @@ + +

Project Details

+ +
\ No newline at end of file diff --git a/demos/time-tracker/protected/pages/TimeTracker/ProjectList.page b/demos/time-tracker/protected/pages/TimeTracker/ProjectList.page new file mode 100644 index 00000000..1bc50a4b --- /dev/null +++ b/demos/time-tracker/protected/pages/TimeTracker/ProjectList.page @@ -0,0 +1,4 @@ + +

Projects

+ +
\ No newline at end of file diff --git a/demos/time-tracker/protected/pages/TimeTracker/ReportProject.page b/demos/time-tracker/protected/pages/TimeTracker/ReportProject.page new file mode 100644 index 00000000..699c2544 --- /dev/null +++ b/demos/time-tracker/protected/pages/TimeTracker/ReportProject.page @@ -0,0 +1,4 @@ + +

Project Reports

+ +
\ No newline at end of file diff --git a/demos/time-tracker/protected/pages/TimeTracker/ReportResource.page b/demos/time-tracker/protected/pages/TimeTracker/ReportResource.page new file mode 100644 index 00000000..4d8b7b17 --- /dev/null +++ b/demos/time-tracker/protected/pages/TimeTracker/ReportResource.page @@ -0,0 +1,4 @@ + +

Resource Report

+ +
\ No newline at end of file diff --git a/demos/time-tracker/protected/pages/TimeTracker/SiteMap.php b/demos/time-tracker/protected/pages/TimeTracker/SiteMap.php index 0b71eb68..1f452894 100644 --- a/demos/time-tracker/protected/pages/TimeTracker/SiteMap.php +++ b/demos/time-tracker/protected/pages/TimeTracker/SiteMap.php @@ -1,8 +1,57 @@ + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2006 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Revision: $ $17/07/2006: $ + * @package Demos + */ +/** + * SiteMap menu is rendered depending on user roles. + * + * @author Wei Zhuo + * @version $Revision: $ $17/07/2006: $ + * @package Demos + * @since 3.1 + */ class SiteMap extends TTemplateControl { - + /** + * Sets the active menu item using css class. + */ + public function onPreRender($param) + { + parent::onPreRender($param); + + $page = explode('.',$this->Request->ServiceParameter); + $active = null; + switch($page[count($page)-1]) + { + case 'ProjectList': + case 'ProjectDetails': + $active = $this->ProjectMenu; + break; + case 'UserList': + case 'UserCreate': + $active = $this->AdminMenu; + break; + case 'ReportProject': + case 'ReportResource': + $active = $this->ReportMenu; + break; + case 'TimeEntry': + $active = $this->LogMenu; + break; + } + + //add 'active' string to place holder body. + if(!is_null($active)) + $active->Controls[] = 'active'; + } } ?> \ No newline at end of file diff --git a/demos/time-tracker/protected/pages/TimeTracker/SiteMap.tpl b/demos/time-tracker/protected/pages/TimeTracker/SiteMap.tpl index 48187b52..808c233b 100644 --- a/demos/time-tracker/protected/pages/TimeTracker/SiteMap.tpl +++ b/demos/time-tracker/protected/pages/TimeTracker/SiteMap.tpl @@ -1,27 +1,33 @@ Event.OnLoad(function() diff --git a/demos/time-tracker/protected/pages/TimeTracker/TimeEntry.page b/demos/time-tracker/protected/pages/TimeTracker/TimeEntry.page new file mode 100644 index 00000000..f934ca02 --- /dev/null +++ b/demos/time-tracker/protected/pages/TimeTracker/TimeEntry.page @@ -0,0 +1,4 @@ + +

Time Entry

+ +
\ No newline at end of file diff --git a/demos/time-tracker/protected/pages/TimeTracker/UserCreate.page b/demos/time-tracker/protected/pages/TimeTracker/UserCreate.page index fda7ba9b..41d97391 100644 --- a/demos/time-tracker/protected/pages/TimeTracker/UserCreate.page +++ b/demos/time-tracker/protected/pages/TimeTracker/UserCreate.page @@ -56,7 +56,17 @@ ControlToValidate="email" Display="Dynamic" ErrorMessage="E-Mail address does not seem to be valid." - ControlCssClass="required-field" /> + ControlCssClass="required-field" /> + + User->isInRole('admin') %> > + + * + + + + + +
diff --git a/demos/time-tracker/protected/pages/TimeTracker/UserCreate.php b/demos/time-tracker/protected/pages/TimeTracker/UserCreate.php index 49e64458..f163ecd6 100644 --- a/demos/time-tracker/protected/pages/TimeTracker/UserCreate.php +++ b/demos/time-tracker/protected/pages/TimeTracker/UserCreate.php @@ -54,18 +54,26 @@ class UserCreate extends TPage $newUser->EmailAddress = $this->email->Text; $newUser->Name = $this->username->Text; $newUser->IsGuest = false; - $newUser->Roles = $this->Application->Parameters['NewUserRoles']; + if($this->User->isInRole('admin')) + $newUser->Roles = $this->role->SelectedValue; + else + $newUser->Roles = $this->Application->Parameters['NewUserRoles']; //save the user $userDao = $this->Application->Modules['daos']->getDao('UserDao'); $userDao->addNewUser($newUser, $this->password->Text); //update the user - $this->User->Manager->updateCredential($newUser); - - //return to requested page - $this->Response->redirect($auth->getReturnUrl()); + if(!$this->User->isInRole('admin')) + { + $auth = $this->Application->getModule('auth'); + $auth->updateCredential($newUser); + //return to requested page + $this->Response->redirect($auth->getReturnUrl()); + } + else + $this->Response->reload(); //goto default page. //$url = $this->Service->constructUrl($this->Service->DefaultPage); //$this->Response->redirect($url); diff --git a/demos/time-tracker/protected/pages/TimeTracker/config.xml b/demos/time-tracker/protected/pages/TimeTracker/config.xml index 16391c00..4497d9e3 100644 --- a/demos/time-tracker/protected/pages/TimeTracker/config.xml +++ b/demos/time-tracker/protected/pages/TimeTracker/config.xml @@ -12,6 +12,8 @@ + + -- cgit v1.2.3