From c0f56fa7d299a4261fc77ba16b9d8f5a027b499f Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Mon, 26 Nov 2018 16:35:25 +0000 Subject: [PATCH] Usability improvements - conditional display of controls. --- WEB-INF/templates/footer.tpl | 2 +- WEB-INF/templates/project_add.tpl | 5 +++-- WEB-INF/templates/project_edit.tpl | 4 +++- WEB-INF/templates/task_add.tpl | 3 +++ WEB-INF/templates/task_edit.tpl | 1 + project_add.php | 6 ++++-- project_edit.php | 6 ++++-- task_add.php | 1 + 8 files changed, 20 insertions(+), 8 deletions(-) diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 443e5868..fe920a00 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- +{if $show_users} - -{if ($smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)} +{/if} +{if $smarty.const.MODE_PROJECTS_AND_TASKS == $user->getTrackingMode() && $show_tasks} diff --git a/WEB-INF/templates/project_edit.tpl b/WEB-INF/templates/project_edit.tpl index 8faf675c..bcabc37a 100644 --- a/WEB-INF/templates/project_edit.tpl +++ b/WEB-INF/templates/project_edit.tpl @@ -15,12 +15,14 @@ +{if $show_users} -{if ($smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)} +{/if} +{if $smarty.const.MODE_PROJECTS_AND_TASKS == $user->getTrackingMode() && $show_tasks} diff --git a/WEB-INF/templates/task_add.tpl b/WEB-INF/templates/task_add.tpl index 53ce483d..8e7f7882 100644 --- a/WEB-INF/templates/task_add.tpl +++ b/WEB-INF/templates/task_add.tpl @@ -11,10 +11,13 @@ +{if $show_projects} + +{/if} diff --git a/WEB-INF/templates/task_edit.tpl b/WEB-INF/templates/task_edit.tpl index f8b45a39..0bf189bb 100644 --- a/WEB-INF/templates/task_edit.tpl +++ b/WEB-INF/templates/task_edit.tpl @@ -16,6 +16,7 @@ {if $show_projects} + diff --git a/project_add.php b/project_add.php index 6b41c15c..9800b721 100644 --- a/project_add.php +++ b/project_add.php @@ -36,7 +36,7 @@ if (!ttAccessAllowed('manage_projects')) { header('Location: access_denied.php'); exit(); } -if (MODE_PROJECTS != $user->tracking_mode && MODE_PROJECTS_AND_TASKS != $user->tracking_mode) { +if (MODE_PROJECTS != $user->getTrackingMode() && MODE_PROJECTS_AND_TASKS != $user->getTrackingMode()) { header('Location: feature_disabled.php'); exit(); } @@ -66,7 +66,7 @@ $form = new Form('projectForm'); $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'project_name','style'=>'width: 250px;','value'=>$cl_name)); $form->addInput(array('type'=>'textarea','name'=>'description','style'=>'width: 250px; height: 40px;','value'=>$cl_description)); $form->addInput(array('type'=>'checkboxgroup','name'=>'users','data'=>$all_users,'layout'=>'H','value'=>$cl_users)); -if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode) +if (MODE_PROJECTS_AND_TASKS == $user->getTrackingMode()) $form->addInput(array('type'=>'checkboxgroup','name'=>'tasks','data'=>$all_tasks,'layout'=>'H','value'=>$cl_tasks)); $form->addInput(array('type'=>'submit','name'=>'btn_add','value'=>$i18n->get('button.add'))); @@ -95,6 +95,8 @@ if ($request->isPost()) { } // isPost $smarty->assign('forms', array($form->getName()=>$form->toArray())); +$smarty->assign('show_users', count($users) > 0); +$smarty->assign('show_tasks', count($tasks) > 0); $smarty->assign('onload', 'onLoad="document.projectForm.project_name.focus()"'); $smarty->assign('title', $i18n->get('title.add_project')); $smarty->assign('content_page_name', 'project_add.tpl'); diff --git a/project_edit.php b/project_edit.php index 29c0d51b..542fb464 100644 --- a/project_edit.php +++ b/project_edit.php @@ -36,7 +36,7 @@ if (!ttAccessAllowed('manage_projects')) { header('Location: access_denied.php'); exit(); } -if (MODE_PROJECTS != $user->tracking_mode && MODE_PROJECTS_AND_TASKS != $user->tracking_mode) { +if (MODE_PROJECTS != $user->getTrackingMode() && MODE_PROJECTS_AND_TASKS != $user->getTrackingMode()) { header('Location: feature_disabled.php'); exit(); } @@ -85,7 +85,7 @@ $form->addInput(array('type'=>'textarea','name'=>'description','style'=>'width: $form->addInput(array('type'=>'combobox','name'=>'status','value'=>$cl_status, 'data'=>array(ACTIVE=>$i18n->get('dropdown.status_active'),INACTIVE=>$i18n->get('dropdown.status_inactive')))); $form->addInput(array('type'=>'checkboxgroup','name'=>'users','data'=>$all_users,'layout'=>'H','value'=>$cl_users)); -if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode) +if (MODE_PROJECTS_AND_TASKS == $user->getTrackingMode()) $form->addInput(array('type'=>'checkboxgroup','name'=>'tasks','data'=>$all_tasks,'layout'=>'H','value'=>$cl_tasks)); $form->addInput(array('type'=>'submit','name'=>'btn_save','value'=>$i18n->get('button.save'))); $form->addInput(array('type'=>'submit','name'=>'btn_copy','value'=>$i18n->get('button.copy'))); @@ -136,6 +136,8 @@ if ($request->isPost()) { } // isPost $smarty->assign('forms', array($form->getName()=>$form->toArray())); +$smarty->assign('show_users', count($users) > 0); +$smarty->assign('show_tasks', count($tasks) > 0); $smarty->assign('onload', 'onLoad="document.projectForm.name.focus()"'); $smarty->assign('title', $i18n->get('title.edit_project')); $smarty->assign('content_page_name', 'project_edit.tpl'); diff --git a/task_add.php b/task_add.php index b1ad08a0..91f0e4fc 100644 --- a/task_add.php +++ b/task_add.php @@ -84,6 +84,7 @@ if ($request->isPost()) { } // isPost $smarty->assign('forms', array($form->getName()=>$form->toArray())); +$smarty->assign('show_projects', count($projects) > 0); $smarty->assign('onload', 'onLoad="document.taskForm.name.focus()"'); $smarty->assign('title', $i18n->get('title.add_task')); $smarty->assign('content_page_name', 'task_add.tpl'); -- 2.20.1
 Anuko Time Tracker 1.18.28.4523 | Copyright © Anuko | +  Anuko Time Tracker 1.18.28.4524 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/project_add.tpl b/WEB-INF/templates/project_add.tpl index 3aad22c2..2f2fb996 100644 --- a/WEB-INF/templates/project_add.tpl +++ b/WEB-INF/templates/project_add.tpl @@ -11,13 +11,14 @@ {$i18n.label.description}: {$forms.projectForm.description.control}
 
{$i18n.label.users}: {$forms.projectForm.users.control}
 
{$i18n.label.tasks}:{$i18n.label.status}: {$forms.projectForm.status.control}
 
{$i18n.label.users}: {$forms.projectForm.users.control}
 
{$i18n.label.tasks}:{$i18n.label.description}: {$forms.taskForm.description.control}
 
{$i18n.label.projects}: {$forms.taskForm.projects.control}
{$i18n.label.required_fields}{$forms.taskForm.status.control}
 
{$i18n.label.projects}: {$forms.taskForm.projects.control}