Cosmetic.
[timetracker.git] / WEB-INF / templates / header.tpl
index 2d3bb20..0fa5d70 100644 (file)
 
 {assign var="tab_width" value="700"}
 
-<!--  101% height here is a workaround for Firefox shifting content horizontally when scrollbar appears / disappears.
-See https://bugzilla.mozilla.org/show_bug.cgi?id=279425.
-With 101% height we essentially force the scrollbar to always appear. -->
-<table height="101%" cellspacing="0" cellpadding="0" width="100%" border="0">
+<table height="100%" cellspacing="0" cellpadding="0" width="100%" border="0">
   <tr>
     <td valign="top" align="center"> <!-- This is to centrally align all our content. -->
 
-      <!-- Top image -->
+      <!-- top image -->
       <table cellspacing="0" cellpadding="0" width="100%" border="0">
         <tr>
 {if $user->custom_logo}
@@ -38,11 +35,11 @@ With 101% height we essentially force the scrollbar to always appear. -->
             <table cellspacing="0" cellpadding="0" width="{$tab_width}" border="0">
               <tr>
                 <td valign="top">
-                  <table cellspacing="0" cellpadding="0" width="100%" border="0">
+                  <table id="page_logo" cellspacing="0" cellpadding="0" width="100%" border="0">
                     <tr><td height="6" colspan="2"><img width="1" height="6" src="images/1x1.gif" border="0"></td></tr>
                     <tr valign="top">
 {if $user->custom_logo}
-                      <td height="55" align="center"><img alt="Time Tracker" width="300" height="43" src="{$custom_logo}" border="0"></a></td>
+                      <td height="55" align="center"><img alt="Time Tracker" width="300" height="43" src="{$custom_logo}" border="0"></td>
 {else}
                       <td height="55" align="center"><a href="https://www.anuko.com/lp/tt_1.htm" target="_blank"><img alt="Anuko Time Tracker" width="300" height="43" src="images/tt_logo.png" border="0"></a></td>
 {/if}
@@ -54,12 +51,12 @@ With 101% height we essentially force the scrollbar to always appear. -->
           </td>
         </tr>
       </table>
-      <!-- End of top image -->
-      
+      <!-- end of top image -->
+
 {if $authenticated}
-  {if $user->isAdmin()}
-      <!-- Top menu for admin -->
-      <table cellspacing="0" cellpadding="3" width="100%" border="0">
+  {if $user->can('administer_site')}
+      <!-- top menu for admin -->
+      <table id="top_menu_admin" cellspacing="0" cellpadding="3" width="100%" border="0">
         <tr>
           <td class="systemMenu" height="17" align="center">&nbsp;
             <a class="systemMenu" href="logout.php">{$i18n.menu.logout}</a> &middot;
@@ -68,79 +65,98 @@ With 101% height we essentially force the scrollbar to always appear. -->
           </td>
         </tr>
       </table>
-      <!-- End of top menu for admin -->
+      <!-- end of top menu for admin -->
 
-      <!-- Sub menu for admin -->
-      <table cellspacing="0" cellpadding="3" width="100%" border="0">
+      <!-- sub menu for admin -->
+      <table id="sub_menu_admin" cellspacing="0" cellpadding="3" width="100%" border="0">
         <tr>
           <td align="center" bgcolor="#d9d9d9" nowrap height="17" background="images/subm_bg.gif">&nbsp;
-            <a class="mainMenu" href="admin_teams.php">{$i18n.menu.teams}</a> &middot;
+            <a class="mainMenu" href="admin_groups.php">{$i18n.menu.groups}</a> &middot;
             <a class="mainMenu" href="admin_options.php">{$i18n.menu.options}</a>
           </td>
         </tr>
       </table>
-      <!-- End of sub menu for admin -->
+      <!-- end of sub menu for admin -->
   {else}
-      <!-- Top menu for authorized user -->
-      <table cellspacing="0" cellpadding="3" width="100%" border="0">
+      <!-- top menu for authorized user -->
+      <table id="top_menu_authorized_user" cellspacing="0" cellpadding="3" width="100%" border="0">
         <tr>
           <td class="systemMenu" height="17" align="center">&nbsp;
             <a class="systemMenu" href="logout.php">{$i18n.menu.logout}</a> &middot;
+    {if $user->exists() && $user->can('manage_own_settings')}
             <a class="systemMenu" href="profile_edit.php">{$i18n.menu.profile}</a> &middot;
+    {/if}
+    {if $user->can('manage_basic_settings')}
+            <a class="systemMenu" href="group_edit.php">{$i18n.menu.group}</a> &middot;
+    {/if}
+    {if $user->can('manage_subgroups')}
+            <a class="systemMenu" href="groups.php">{$i18n.menu.subgroups}</a> &middot;
+    {/if}
+    {if $user->can('manage_features')}
+            <a class="systemMenu" href="plugins.php">{$i18n.menu.plugins}</a> &middot;
+    {/if}
             <a class="systemMenu" href="{$smarty.const.FORUM_LINK}" target="_blank">{$i18n.menu.forum}</a> &middot;
             <a class="systemMenu" href="{$smarty.const.HELP_LINK}" target="_blank">{$i18n.menu.help}</a>
           </td>
         </tr>
       </table>
-      <!-- End of top menu for authorized user -->
+      <!-- end of top menu for authorized user -->
 
-      <!-- Sub menu for authorized user -->
-      <table cellspacing="0" cellpadding="3" width="100%" border="0">
+      <!-- sub menu for authorized user -->
+      <table id="sub_menu_authorized_user" cellspacing="0" cellpadding="3" width="100%" border="0">
         <tr>
           <td align="center" bgcolor="#d9d9d9" nowrap height="17" background="images/subm_bg.gif">&nbsp;
-    {if !$user->isClient()}
+    {if $user->exists() && ($user->can('track_own_time') || $user->can('track_time'))}
            <a class="mainMenu" href="time.php">{$i18n.menu.time}</a>
     {/if}
-    {if in_array('ex', explode(',', $user->plugins)) && !$user->isClient()}
+    {if $user->exists() && $user->isPluginEnabled('ex') && ($user->can('track_own_expenses') || $user->can('track_expenses'))}
             &middot; <a class="mainMenu" href="expenses.php">{$i18n.menu.expenses}</a>
     {/if}
-            {if !$user->isClient()}&middot; {/if}<a class="mainMenu" href="reports.php">{$i18n.menu.reports}</a>
-    {if ($user->canManageTeam() || $user->isClient()) && in_array('iv', explode(',', $user->plugins))}
+    {if $user->exists() && ($user->can('view_own_reports') || $user->can('view_reports') || $user->can('view_all_reports') || $user->can('view_client_reports'))}
+      {if !$user->isClient()}&middot;{/if} <a class="mainMenu" href="reports.php">{$i18n.menu.reports}</a>
+    {/if}
+    {if $user->exists() && $user->isPluginEnabled('ts') && ($user->can('track_own_time') || $user->can('track_time'))}
+            &middot; <a class="mainMenu" href="timesheets.php">{$i18n.menu.timesheets}</a>
+    {/if}
+    {if $user->exists() && $user->isPluginEnabled('iv') && ($user->can('manage_invoices') || $user->can('view_client_invoices'))}
             &middot; <a class="mainMenu" href="invoices.php">{$i18n.title.invoices}</a>
     {/if}
-    {if (in_array('ch', explode(',', $user->plugins)) && !$user->isClient()) && ($smarty.const.MODE_PROJECTS == $user->tracking_mode
-      || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode
-      || in_array('cl', explode(',', $user->plugins)))}
+    {if ($user->exists() && $user->isPluginEnabled('ch') && ($user->can('view_own_charts') || $user->can('view_charts'))) &&
+        ($smarty.const.MODE_PROJECTS == $user->getTrackingMode() || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->getTrackingMode() ||
+        $user->isPluginEnabled('cl'))}
             &middot; <a class="mainMenu" href="charts.php">{$i18n.menu.charts}</a>
     {/if}
-    {if !$user->isClient() && ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
+    {if ($user->can('view_own_projects') || $user->can('manage_projects')) && ($smarty.const.MODE_PROJECTS == $user->getTrackingMode() || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->getTrackingMode())}
             &middot; <a class="mainMenu" href="projects.php">{$i18n.menu.projects}</a>
     {/if}
-    {if $user->canManageTeam() && ($smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
+    {if ($smarty.const.MODE_PROJECTS_AND_TASKS == $user->getTrackingMode() && ($user->can('view_own_tasks') || $user->can('manage_tasks')))}
             &middot; <a class="mainMenu" href="tasks.php">{$i18n.menu.tasks}</a>
     {/if}
-    {if !$user->isClient()}
+    {if $user->can('view_users') || $user->can('manage_users')}
             &middot; <a class="mainMenu" href="users.php">{$i18n.menu.users}</a>
     {/if}
-    {if $user->canManageTeam() && in_array('cl', explode(',', $user->plugins))}
+    {if $user->isPluginEnabled('cl') && ($user->can('view_own_clients') || $user->can('manage_clients'))}
             &middot; <a class="mainMenu" href="clients.php">{$i18n.menu.clients}</a>
     {/if}
-    {if $user->isManager()}
+    {if $user->isPluginEnabled('wk') && ($user->can('do_work') || $user->can('bid_on_work') || $user->can('manage_work')) && $user->exists()}
+            &middot; <a class="mainMenu" href="work.php">{$i18n.title.work}</a>
+    {/if}
+    {if $user->can('export_data')}
             &middot; <a class="mainMenu" href="export.php">{$i18n.menu.export}</a>
     {/if}
           </td>
         </tr>
       </table>
-      <!-- End of sub menu for authorized user -->
+      <!-- end of sub menu for authorized user -->
   {/if}
 {else}
-      <!-- Top menu for non authorized user -->
-      <table cellspacing="0" cellpadding="3" width="100%" border="0">
+      <!-- top menu for non authorized user -->
+      <table id="top_menu_non_authorized_user" cellspacing="0" cellpadding="3" width="100%" border="0">
         <tr>
           <td class="systemMenu" height="17" align="center">&nbsp;
             <a class="systemMenu" href="login.php">{$i18n.menu.login}</a> &middot;
-  {if isTrue($smarty.const.MULTITEAM_MODE) && $smarty.const.AUTH_MODULE == 'db'}
-            <a class="systemMenu" href="register.php">{$i18n.menu.create_team}</a> &middot;
+  {if isTrue('MULTITEAM_MODE') && $smarty.const.AUTH_MODULE == 'db'}
+            <a class="systemMenu" href="register.php">{$i18n.menu.create_group}</a> &middot;
   {/if}
             <a class="systemMenu" href="{$smarty.const.FORUM_LINK}" target="_blank">{$i18n.menu.forum}</a> &middot;
             <a class="systemMenu" href="{$smarty.const.HELP_LINK}" target="_blank">{$i18n.menu.help}</a>
@@ -150,39 +166,39 @@ With 101% height we essentially force the scrollbar to always appear. -->
 {/if}
       <br>
 
-      <!-- Page title and user details -->
+      <!-- page title and user details -->
 {if $title}
-      <table cellspacing="0" cellpadding="5" width="{$tab_width+20}" border="0">
+      <table id="page_title" 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>
-        <tr><td>{$user->name|escape:'html'}{if $user->isAdmin()} {$i18n.label.role_admin}{elseif $user->isManager()} {$i18n.label.role_manager}{elseif $user->canManageTeam()} {$i18n.label.role_comanager}{/if}{if $user->behalf_id > 0} <b>{$i18n.label.on_behalf} {$user->behalf_name|escape:'html'}</b>{/if}{if $user->team}, {$user->team|escape:'html'}{/if}</td></tr>
+        <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 -->
+      <!-- end of page title and user details -->
 
-      <!-- Output errors -->
-{if !$errors->isEmpty()}
-      <table cellspacing="4" cellpadding="7" width="{$tab_width}" border="0">
+      <!-- output errors -->
+{if $err->yes()}
+      <table id="page_errors" cellspacing="4" cellpadding="7" width="{$tab_width}" border="0">
         <tr>
           <td class="error">
-  {foreach $errors->getErrors() as $error}
+  {foreach $err->getErrors() as $error}
             {$error.message}<br> {* No need to escape as they are not coming from user and may contain a link. *}
   {/foreach}
           </td>
         </tr>
       </table>
 {/if}
-      <!-- End of output errors -->
+      <!-- end of output errors -->
 
-      <!-- Output messages -->
-{if !$messages->isEmpty()}
-      <table cellspacing="4" cellpadding="7" width="{$tab_width}" border="0">
+      <!-- output messages -->
+{if $msg->yes()}
+      <table id="page_messages" cellspacing="4" cellpadding="7" width="{$tab_width}" border="0">
         <tr>
           <td class="info_message">
-  {foreach $messages->getErrors() as $message}
+  {foreach $msg->getErrors() as $message}
             {$message.message}<br> {* No need to escape. *}
   {/foreach}
           </td>
         </tr>
       </table>
 {/if}
-      <!-- End of output messages -->
\ No newline at end of file
+      <!-- end of output messages -->