Added some comments clarifying the design approach.
authorNik Okuntseff <support@anuko.com>
Mon, 26 Nov 2018 00:04:18 +0000 (00:04 +0000)
committerNik Okuntseff <support@anuko.com>
Mon, 26 Nov 2018 00:04:18 +0000 (00:04 +0000)
WEB-INF/lib/ttUser.class.php
WEB-INF/templates/footer.tpl
projects.php

index 5f97ae2..8e907c8 100644 (file)
@@ -388,6 +388,21 @@ class ttUser {
   //   - The entire stack of groups all the way down to current on behalf group.
   //   - All immediate children of the current on behalf group.
   // This allows user to navigate easily to home group, anything in between, and 1 level below.
+  //
+  // Note 1: group dropdown is, by design, to be placed on all pages where "relevant",
+  // such as users.php, projects.php, tasks.php, etc. But some features may be disabled
+  // in some groups. We should check for feature availability on group change
+  // in post and redirect to feature_disabled.php when this happens.
+  // This will allow us to keep dropdown content consistent on all pages.
+  // Filtering content of the dropdown does not seem right.
+  //
+  // Note 2: Menu should display according to $user home group settings.
+  //         Pages, should look according to $user->behalfGroup settings (if set).
+  //         For example, if home group allows tasks, menu should display Tasks,
+  //         even when we are on behalf of a subgroup without tasks.
+  //
+  // Note 3: Language of all pages should be as in $user home group even when
+  //         subgroups have a different language.
   function getGroupsForDropdown() {
     $mdb2 = getConnection();
 
index 8b16282..d037aa8 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.28.4519 | 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.28.4520 | 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 3845db6..d149d84 100644 (file)
@@ -35,7 +35,7 @@ if (!(ttAccessAllowed('view_own_projects') || 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();
 }
@@ -48,6 +48,11 @@ if ($request->isPost() && !$user->isGroupValid($request->getParameter('group')))
 if ($request->isPost()) {
   $group_id = $request->getParameter('group');
   $user->setOnBehalfGroup($group_id);
+  // Projects feature may not be available in new group, check and redirect.
+  if (MODE_PROJECTS != $user->getTrackingMode() && MODE_PROJECTS_AND_TASKS != $user->getTrackingMode()) {
+    header('Location: feature_disabled.php');
+    exit();
+  }
 } else {
   $group_id = $user->getActiveGroup();
 }