]> wagnertech.de Git - timetracker.git/commitdiff
A bit more work in progress on roles.
authorNik Okuntseff <support@anuko.com>
Thu, 22 Feb 2018 19:23:07 +0000 (19:23 +0000)
committerNik Okuntseff <support@anuko.com>
Thu, 22 Feb 2018 19:23:07 +0000 (19:23 +0000)
33 files changed:
WEB-INF/lib/ttTeamHelper.class.php
WEB-INF/resources/ca.lang.php
WEB-INF/resources/cs.lang.php
WEB-INF/resources/da.lang.php
WEB-INF/resources/de.lang.php
WEB-INF/resources/en.lang.php
WEB-INF/resources/es.lang.php
WEB-INF/resources/et.lang.php
WEB-INF/resources/fa.lang.php
WEB-INF/resources/fi.lang.php
WEB-INF/resources/fr.lang.php
WEB-INF/resources/he.lang.php
WEB-INF/resources/hu.lang.php
WEB-INF/resources/it.lang.php
WEB-INF/resources/ja.lang.php
WEB-INF/resources/ko.lang.php
WEB-INF/resources/nl.lang.php
WEB-INF/resources/no.lang.php
WEB-INF/resources/pl.lang.php
WEB-INF/resources/pt-br.lang.php
WEB-INF/resources/pt.lang.php
WEB-INF/resources/ro.lang.php
WEB-INF/resources/ru.lang.php
WEB-INF/resources/sk.lang.php
WEB-INF/resources/sl.lang.php
WEB-INF/resources/sr.lang.php
WEB-INF/resources/sv.lang.php
WEB-INF/resources/tr.lang.php
WEB-INF/resources/zh-cn.lang.php
WEB-INF/resources/zh-tw.lang.php
WEB-INF/templates/footer.tpl
WEB-INF/templates/roles.tpl [new file with mode: 0644]
roles.php [new file with mode: 0644]

index 3b01415ecd8740a00513723a47303ba325d3ee4f..2ae75923fd4be432a368f2efefb7379b3f9031de 100644 (file)
@@ -263,6 +263,41 @@ class ttTeamHelper {
     return false;
   }
 
+  // getActiveRoles - returns an array of active roles for team.
+  static function getActiveRoles($team_id)
+  {
+    $result = array();
+    $mdb2 = getConnection();
+
+    $sql = "select id, name, rights from tt_roles where team_id = $team_id and status = 1 order by upper(name)";
+    $res = $mdb2->query($sql);
+    $result = array();
+    if (!is_a($res, 'PEAR_Error')) {
+      while ($val = $res->fetchRow()) {
+        $result[] = $val;
+      }
+    }
+    return $result;
+  }
+
+  // getInactiveRoles - returns an array of inactive roles for team.
+  static function getInactiveRoles($team_id)
+  {
+    $result = array();
+    $mdb2 = getConnection();
+
+    $sql = "select id, name, rights from tt_roles
+      where team_id = $team_id and status = 0 order by upper(name)";
+    $res = $mdb2->query($sql);
+    $result = array();
+    if (!is_a($res, 'PEAR_Error')) {
+      while ($val = $res->fetchRow()) {
+        $result[] = $val;
+      }
+    }
+    return $result;
+  }
+
   // The getActiveClients returns an array of active clients for team.
   static function getActiveClients($team_id, $all_fields = false)
   {
index 7dcf0e0aed29e3a3927046f0f957fafd375dbc7c..88d59a5612ea4a2f0a47393a55925035268c5daa 100644 (file)
@@ -453,6 +453,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 // TODO: translate the following.
index 4e8d686019136c94862490b78d32816412830ee1..7cd07f5d7ef8c273fc65f0f98db94aa25f37beae 100644 (file)
@@ -466,6 +466,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 // TODO: translate the following.
index 5514900b88903bc1e77cd553edd595a3a2091465..5994d7f922a0c18089a1b5af84cbfc8770f1f4ab 100644 (file)
@@ -403,6 +403,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 'form.clients.active_clients' => 'Aktive Klienter',
index 84d3a53782022e3e8a7aeccf990eae98596990a9..872a543a213cebbcc76799947216639b8817cc0a 100644 (file)
@@ -401,6 +401,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 'form.clients.active_clients' => 'Aktive Kunden',
index 2315da14e38f09ee6daad5e5308cfcffba5c5701..21a3fdf9e95988520d9055359385b54541c6e9df 100644 (file)
@@ -396,6 +396,7 @@ $i18n_key_words = array(
  // Roles form. See example at https://timetracker.anuko.com/roles.php
 'form.roles.active_roles' => 'Active Roles',
 'form.roles.inactive_roles' => 'Inactive Roles',
+'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 'form.clients.active_clients' => 'Active Clients',
index b7085dcf5ded1032080a473b7be66c517289fca3..6c9d5024447f5cd11d7a2192ca66d2fcf01081ba 100644 (file)
@@ -464,6 +464,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 // TODO: translate the following.
index f16823c5514aa4638652a026efc8be9f2cc65e66..2011aae0e5d0166975d9aec47d145b417ed20167 100644 (file)
@@ -463,6 +463,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 // TODO: translate the following.
index b68518e5813e027409bece7e9f4287366160d5dd..40536a4712f565a829f3cf57935f7716d364f63f 100644 (file)
@@ -430,6 +430,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 'form.clients.active_clients' => 'مشتری های فعال',
index c88cd45d853c002b5f6a59e370da3128a5473c94..58a3340576b9ad21b4e325774b1b94faf180bebf 100644 (file)
@@ -410,6 +410,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 'form.clients.active_clients' => 'Aktiiviset asiakkaat',
index 36087481f392c0421ecfed4036ab58461565b243..027fec25ffbd489afc34f179c981261e3e713a5c 100644 (file)
@@ -400,6 +400,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 'form.clients.active_clients' => 'Clients actifs',
index 2cd8b8001c70a9950356198e35de76aedf89a3cc..3341f0303aaa2da5c2e294d252c89909c3e6b82d 100644 (file)
@@ -436,6 +436,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 'form.clients.active_clients' => 'לקוחות פעילים',
index b830ba71f1f960b4995251a849bf6d2c9381d268..f17db397bb6ce925fa0cd898ae5915464b3bc885 100644 (file)
@@ -457,6 +457,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 // TODO: translate the following.
index dcd1b37b657466fd0d3c910657627d449604dcf3..3b04c35c83cc852565e0f14480429e81ddd01ffc 100644 (file)
@@ -403,6 +403,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 'form.clients.active_clients' => 'Clienti attivi',
index aad7ff3032c707d1d010088c9b292f6d756ac789..956fd5618aa14fc6bb852dbcb046b1358f1dbe96 100644 (file)
@@ -454,6 +454,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 // TODO: translate the following.
index cd39cb13868381c73ef4fe85cd8f55f73a746010..bfa326b7dd00668fac6410e6dc497842cdd98bf5 100644 (file)
@@ -456,6 +456,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 // TODO: translate the following.
index b0890545f513d067718afeecf235cf175cc64151..8149366d40005a82e99fe0acbef00a67b4dff7e4 100644 (file)
@@ -399,6 +399,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 'form.clients.active_clients' => 'Actieve klanten',
index 3778d695ecaa6882cfb9a5a6d81020b9e8de25bf..79d24e04cce61882b7b5d3c0bba7e1633308c298 100644 (file)
@@ -452,6 +452,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 // TODO: translate the following.
index 9c9c2974ad327de0184f3d84f53cdec4975db434..39f37e38329a7c0c214dd339ac9f9b132e513b22 100644 (file)
@@ -413,6 +413,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.phpp
 'form.clients.active_clients' => 'Aktywni klienci',
index b8e4a91fc3a75978d5cd767d07ec24ef67e2b3b4..2a17b26d799fa4796c56cef91eb047977b8e6fb8 100644 (file)
@@ -408,6 +408,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 'form.clients.active_clients' => 'Clientes ativos',
index 2aa049f79115476b9fbd7680c8c2c02f675f7e25..cab935db580fb47a2950709e9bc71fc12d17d0b2 100644 (file)
@@ -441,6 +441,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 // TODO: translate the following.
index ee1673c284e65e7c1001b4188acccc45f83dad0f..3a4d70a10838f6d9f22288f03768681e07c9cc4e 100644 (file)
@@ -460,6 +460,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 // TODO: translate the following.
index aee9df750c8b2de42d65b0fcdee801eb3ac18acc..42e0a8b871fb99ed896475d68f43e285cf486b00 100644 (file)
@@ -394,6 +394,7 @@ $i18n_key_words = array(
 // Roles form. See example at https://timetracker.anuko.com/roles.php
 'form.roles.active_roles' => 'Активные роли',
 'form.roles.inactive_roles' => 'Неактивные роли',
+'form.roles.rights' => 'Права',
 
 // Deleting Client form. See example at https://timetracker.anuko.com/client_delete.php
 'form.client.client_to_delete' => 'Клиент для удаления',
index df06ddfccadfceafea70024adc758b27baf27902..67b2bead4833492ce4bbf3bda84d5f1bc7596aaf 100644 (file)
@@ -428,6 +428,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 'form.clients.active_clients' => 'Aktívny klienti',
index ed7281536954456ee6fc901c2a775853aa8f574a..08b3d2967711364d60804702720cbc75176d5851 100644 (file)
@@ -437,6 +437,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 // TODO: translate the following.
index 14df209705dc114a832b828ec36658e3ef0a6f1f..783093e3b5008ec4656df03dc611f2823710fc96 100644 (file)
@@ -411,6 +411,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Forma klijenata. Pogledajte primer na https://timetracker.anuko.com/clients.php
 'form.clients.active_clients' => 'Aktivni klijent',
index 6529f6dc6803dc3167182f1665afb985ee0330d7..7500d44cfb969c39c42f563fd48c4bc63c547587 100644 (file)
@@ -408,6 +408,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 'form.clients.active_clients' => 'Aktiva kunder',
index 37c225404860a3d6063e09bd95b97d8cee32d9bc..ab9251b2ae7d69afc6cb13dfb907dfe12692f964 100644 (file)
@@ -471,6 +471,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 // TODO: translate the following.
index a0ef26b032ced6a770b5af3e9b83bc9c54ccb4e4..639316366c22ea5a935b65d718ed8abc46792dbd 100644 (file)
@@ -441,6 +441,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 // TODO: translate the following.
index 9e3944f488e2f73117667f91eb1693c1be8beb24..2fd2406665a3271cc977ee3a45b40ca6c482a891 100644 (file)
@@ -450,6 +450,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'form.roles.active_roles' => 'Active Roles',
 // 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rights' => 'Rights',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 // TODO: translate the following.
index 069beb904f63e13191013daa48bbae971ae79eca..1acdad98ad12074fdcd985e79df8f3490875ca86 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.17.29.4013 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.17.29.4014 | 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>
diff --git a/WEB-INF/templates/roles.tpl b/WEB-INF/templates/roles.tpl
new file mode 100644 (file)
index 0000000..d703fef
--- /dev/null
@@ -0,0 +1,67 @@
+<script>
+  function chLocation(newLocation) { document.location = newLocation; }
+</script>
+
+<table cellspacing="0" cellpadding="7" border="0" width="720">
+  <tr>
+    <td valign="top">
+      <table cellspacing="1" cellpadding="3" border="0" width="100%">
+  {if $inactive_roles}
+        <tr><td class="sectionHeaderNoBorder">{$i18n.form.roles.active_roles}</td></tr>
+  {/if}
+        <tr>
+          <td width="35%" class="tableHeader">{$i18n.label.thing_name}</td>
+          <td width="35%" class="tableHeader">{$i18n.form.roles.rights}</td>
+          <td class="tableHeader">{$i18n.label.edit}</td>
+          <td class="tableHeader">{$i18n.label.delete}</td>
+        </tr>
+  {if $active_roles}
+    {foreach $active_roles as $role}
+        <tr bgcolor="{cycle values="#f5f5f5,#ffffff"}">
+          <td>{$role.name|escape}</td>
+          <td>{$role.rights|escape}</td>
+          <td><a href="task_edit.php?id={$task.id}">{$i18n.label.edit}</a></td>
+          <td><a href="task_delete.php?id={$task.id}">{$i18n.label.delete}</a></td>
+        </tr>
+    {/foreach}
+  {/if}
+      </table>
+
+      <table width="100%">
+        <tr>
+          <td align="center"><br>
+            <form><input type="button" onclick="chLocation('role_add.php');" value="{$i18n.button.add_role}"></form>
+          </td>
+        </tr>
+      </table>
+
+  {if $inactive_roles}
+      <table cellspacing="1" cellpadding="3" border="0" width="100%">
+        <tr><td class="sectionHeaderNoBorder">{$i18n.form.roles.inactive_roles}</td></tr>
+        <tr>
+          <td width="35%" class="tableHeader">{$i18n.label.thing_name}</td>
+          <td width="35%" class="tableHeader">{$i18n.form.roles.rights}</td>
+          <td class="tableHeader">{$i18n.label.edit}</td>
+          <td class="tableHeader">{$i18n.label.delete}</td>
+        </tr>
+    {foreach $inactive_roles as $role}
+        <tr bgcolor="{cycle values="#f5f5f5,#ffffff"}">
+          <td>{$role.name|escape}</td>
+          <td>{$role.rights|escape}</td>
+          <td><a href="task_edit.php?id={$task.id}">{$i18n.label.edit}</a></td>
+          <td><a href="task_delete.php?id={$task.id}">{$i18n.label.delete}</a></td>
+        </tr>
+    {/foreach}
+      </table>
+
+      <table width="100%">
+        <tr>
+          <td align="center"><br>
+            <form><input type="button" onclick="chLocation('role_add.php');" value="{$i18n.button.add_role}"></form>
+          </td>
+        </tr>
+      </table>
+  {/if}
+    </td>
+  </tr>
+</table>
diff --git a/roles.php b/roles.php
new file mode 100644 (file)
index 0000000..4425581
--- /dev/null
+++ b/roles.php
@@ -0,0 +1,43 @@
+<?php
+// +----------------------------------------------------------------------+
+// | Anuko Time Tracker
+// +----------------------------------------------------------------------+
+// | Copyright (c) Anuko International Ltd. (https://www.anuko.com)
+// +----------------------------------------------------------------------+
+// | LIBERAL FREEWARE LICENSE: This source code document may be used
+// | by anyone for any purpose, and freely redistributed alone or in
+// | combination with other software, provided that the license is obeyed.
+// |
+// | There are only two ways to violate the license:
+// |
+// | 1. To redistribute this code in source form, with the copyright
+// |    notice or license removed or altered. (Distributing in compiled
+// |    forms without embedded copyright notices is permitted).
+// |
+// | 2. To redistribute modified versions of this code in *any* form
+// |    that bears insufficient indications that the modifications are
+// |    not the work of the original author(s).
+// |
+// | This license applies to this document only, not any other software
+// | that it may be combined with.
+// |
+// +----------------------------------------------------------------------+
+// | Contributors:
+// | https://www.anuko.com/time_tracker/credits.htm
+// +----------------------------------------------------------------------+
+
+require_once('initialize.php');
+import('form.Form');
+import('ttTeamHelper');
+
+// Access check.
+if (!ttAccessCheck(right_manage_team)) {
+  header('Location: access_denied.php');
+  exit();
+}
+
+$smarty->assign('active_roles', ttTeamHelper::getActiveRoles($user->team_id));
+$smarty->assign('inactive_roles', ttTeamHelper::getInactiveRoles($user->team_id));
+$smarty->assign('title', $i18n->getKey('label.roles'));
+$smarty->assign('content_page_name', 'roles.tpl');
+$smarty->display('index.tpl');