Refactored project add for subgroups.
authorNik Okuntseff <support@anuko.com>
Mon, 10 Dec 2018 13:30:57 +0000 (13:30 +0000)
committerNik Okuntseff <support@anuko.com>
Mon, 10 Dec 2018 13:30:57 +0000 (13:30 +0000)
WEB-INF/templates/footer.tpl
WEB-INF/templates/mobile/project_add.tpl
WEB-INF/templates/project_add.tpl
mobile/project_add.php
project_add.php

index 9e1ca14..1903310 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.18.29.4627 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.18.29.4628 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
index 3aad22c..d49b9a3 100644 (file)
           <td align = "right">{$i18n.label.description}:</td>
           <td>{$forms.projectForm.description.control}</td>
         </tr>
+{if $show_users}
         <tr><td>&nbsp;</td></tr>
         <tr>
           <td align="right">{$i18n.label.users}:</td>
           <td>{$forms.projectForm.users.control}</td>
         </tr>
-{if ($smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
+{/if}
+{if $show_tasks}
         <tr><td>&nbsp;</td></tr>
         <tr>
           <td align="right">{$i18n.label.tasks}:</td>
index 2f2fb99..d49b9a3 100644 (file)
@@ -18,7 +18,7 @@
           <td>{$forms.projectForm.users.control}</td>
         </tr>
 {/if}
-{if $smarty.const.MODE_PROJECTS_AND_TASKS == $user->getTrackingMode() && $show_tasks}
+{if $show_tasks}
         <tr><td>&nbsp;</td></tr>
         <tr>
           <td align="right">{$i18n.label.tasks}:</td>
index 6f6f452..c8c661e 100644 (file)
@@ -49,6 +49,7 @@ foreach ($users as $user_item)
 $tasks = ttGroupHelper::getActiveTasks();
 foreach ($tasks as $task_item)
   $all_tasks[$task_item['id']] = $task_item['name'];
+$show_tasks = MODE_PROJECTS_AND_TASKS == $user->getTrackingMode() && count($tasks) > 0;
 
 if ($request->isPost()) {
   $cl_name = trim($request->getParameter('project_name'));
@@ -66,7 +67,7 @@ $form = new Form('projectForm');
 $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'project_name','value'=>$cl_name));
 $form->addInput(array('type'=>'textarea','name'=>'description','class'=>'mobile-textarea','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 ($show_tasks)
   $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 +96,8 @@ if ($request->isPost()) {
 
 $smarty->assign('forms', array($form->getName()=>$form->toArray()));
 $smarty->assign('onload', 'onLoad="document.projectForm.project_name.focus()"');
+$smarty->assign('show_users', count($users) > 0);
+$smarty->assign('show_tasks', $show_tasks);
 $smarty->assign('title', $i18n->get('title.add_project'));
 $smarty->assign('content_page_name', 'mobile/project_add.tpl');
 $smarty->display('mobile/index.tpl');
index 70327eb..0041680 100644 (file)
@@ -49,6 +49,7 @@ foreach ($users as $user_item)
 $tasks = ttGroupHelper::getActiveTasks();
 foreach ($tasks as $task_item)
   $all_tasks[$task_item['id']] = $task_item['name'];
+$show_tasks = MODE_PROJECTS_AND_TASKS == $user->getTrackingMode() && count($tasks) > 0;
 
 if ($request->isPost()) {
   $cl_name = trim($request->getParameter('project_name'));
@@ -66,7 +67,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->getTrackingMode())
+if ($show_tasks)
   $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')));
 
@@ -94,9 +95,9 @@ 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('show_users', count($users) > 0);
+$smarty->assign('show_tasks', $show_tasks);
 $smarty->assign('title', $i18n->get('title.add_project'));
 $smarty->assign('content_page_name', 'project_add.tpl');
 $smarty->display('index.tpl');