Wrote ttUser::getUserPartForHeader and included on behalf group in output.
authorNik Okuntseff <support@anuko.com>
Fri, 23 Nov 2018 16:58:23 +0000 (16:58 +0000)
committerNik Okuntseff <support@anuko.com>
Fri, 23 Nov 2018 16:58:23 +0000 (16:58 +0000)
WEB-INF/lib/ttUser.class.php
WEB-INF/templates/footer.tpl
WEB-INF/templates/header.tpl
default.css

index ab5bdbf..f89bba6 100644 (file)
@@ -652,4 +652,23 @@ class ttUser {
 
     return $max_rank;
   }
+
+  // getUserPartForHeader constructs a string for user to display on pages header.
+  // It changes with "on behalf" attributes for both user and group.
+  function getUserPartForHeader() {
+    global $i18n;
+
+    $user_part = htmlspecialchars($this->name);
+    $user_part .= ' - '.htmlspecialchars($this->role_name);
+    if ($this->behalf_id) {
+      $user_part .= ' <span class="onBehalf">'.$i18n->get('label.on_behalf').' '.htmlspecialchars($this->behalf_name).'</span>';
+    }
+    if ($this->behalf_group_id) {
+      $user_part .= ',  <span class="onBehalf">'.$i18n->get('label.on_behalf').' '.htmlspecialchars($this->behalf_group_name).'</span>';
+    } else {
+      if ($this->group_name) // Note: we did not require group names in the past.
+        $user_part .= ', '.$this->group_name;
+    }
+    return $user_part;
+  }
 }
index a59278e..0240ecf 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.27.4500 | 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.27.4501 | 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 23dfdc1..de25c06 100644 (file)
 {if $title}
       <table cellspacing="0" cellpadding="5" width="{$tab_width+20}" border="0">
         <tr><td class="sectionHeader"><div class="pageTitle">{$title}{if $timestring}: {$timestring}{/if}</div></td></tr>
-  {if $user->name}
-        <tr><td>{$user->name|escape} - {$user->role_name|escape}{if $user->behalf_id > 0} <b>{$i18n.label.on_behalf} {$user->behalf_name|escape}</b>{/if}{if $user->group_name}, {$user->group_name|escape}{/if}</td></tr>
-  {else}
-        <tr><td>&nbsp;</td></tr>
-  {/if}
+        <tr><td>{$user->getUserPartForHeader()}</td></tr> {* No need to escape as it is done in the class. *}
       </table>
 {/if}
       <!-- end of page title and user details -->
index ee6a5b1..47dc81e 100644 (file)
@@ -74,6 +74,10 @@ input[type=checkbox], label {
   color: #444444;
 }
 
+.onBehalf {
+  font-weight: bold;
+}
+
 .tableHeader {
   font-weight: bold;
   text-align: left;