Introduced time_script.tpl for shared script used in time.tpl and time_edit.tpl ...
[timetracker.git] / WEB-INF / templates / expenses.tpl
index 3c42c6d..7554004 100644 (file)
@@ -24,10 +24,10 @@ projects = new Array();
 {/foreach}
 
 // Mandatory top option for project dropdown.
-empty_label_project = '{$i18n.dropdown.select|escape:'javascript'}';
+empty_label_project = "{$i18n.dropdown.select|escape:'javascript'}";
 
 // The fillProjectDropdown function populates the project combo box with
-// projects associated with a selected client (client id is passed here as id).    
+// projects associated with a selected client (client id is passed here as id).
 function fillProjectDropdown(id) {
   var str_ids = project_ids[id];
   var dropdown = document.getElementById("project");
@@ -42,7 +42,7 @@ function fillProjectDropdown(id) {
   // Populate project dropdown.
   if (!id) {
     // If we are here, client is not selected.
-       var len = projects.length;
+    var len = projects.length;
     for (var i = 0; i < len; i++) {
       dropdown.options[i+1] = new Option(projects[i][1], projects[i][0]);
       if (dropdown.options[i+1].value == selected_item)
@@ -79,9 +79,9 @@ function get_date() {
           <td>{$forms.expensesForm.onBehalfUser.control}</td>
         </tr>
 {/if}
-{if in_array('cl', explode(',', $user->plugins))}
+{if $user->isPluginEnabled('cl')}
         <tr>
-          <td align="right">{$i18n.label.client}{if in_array('cm', explode(',', $user->plugins))} (*){/if}:</td>
+          <td align="right">{$i18n.label.client}{if $user->isPluginEnabled('cm')} (*){/if}:</td>
           <td>{$forms.expensesForm.client.control}</td>
         </tr>
 {/if}
@@ -97,7 +97,7 @@ function get_date() {
         </tr>
         <tr>
           <td align="right">{$i18n.label.cost} (*):</td>
-          <td>{$forms.expensesForm.cost.control} {$user->currency|escape:'html'}</td>
+          <td>{$forms.expensesForm.cost.control} {$user->currency|escape}</td>
         </tr>
       </table>
     </td>
@@ -118,51 +118,40 @@ function get_date() {
 <table width="720">
 <tr>
   <td valign="top">
-    {if $expense_items}
+{if $expense_items}
       <table border="0" cellpadding="3" cellspacing="1" width="100%">
       <tr>
-{if in_array('cl', explode(',', $user->plugins))}
+  {if $user->isPluginEnabled('cl')}
         <td width="20%" class="tableHeader">{$i18n.label.client}</td>
-{/if}
-{if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
+  {/if}
+  {if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
         <td class="tableHeader">{$i18n.label.project}</td>
-{/if}
+  {/if}
         <td class="tableHeader">{$i18n.label.item}</td>
         <td width="5%" class="tableHeaderCentered">{$i18n.label.cost}</td>
         <td width="5%" class="tableHeader">{$i18n.label.edit}</td>
       </tr>
-      {foreach $expense_items as $item}
+  {foreach $expense_items as $item}
       <tr bgcolor="{cycle values="#f5f5f5,#ccccce"}">
-{if in_array('cl', explode(',', $user->plugins))}
-        <td valign='top'>{$item.client|escape:'html'}</td>
-{/if}
-{if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
-        <td valign='top'>{$item.project|escape:'html'}</td>
-{/if}
-        <td valign='top'>{$item.item|escape:'html'}</td>
-        <td valign='top' align='right'>{$item.cost}</td>
-        <td valign='top' align='center'>
-        {if $item.invoice_id}
-          &nbsp;
-        {else}
-          <a href='expense_edit.php?id={$item.id}'>{$i18n.label.edit}</a>
-        {/if}
-        </td>
-      </tr>
-      {/foreach}
-         </table>
-         {if $expense_items}
-      <table border="0" cellpadding="3" cellspacing="1" width="100%">
-        <tr>
-          <td nowrap align="right">{$i18n.label.day_total}: {$user->currency|escape:'html'} {$day_total}</td>
-        </tr>
-      </table>
-      {/if}
-         
+    {if $user->isPluginEnabled('cl')}
+        <td valign="top">{$item.client|escape}</td>
+    {/if}
+    {if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
+        <td valign="top">{$item.project|escape}</td>
     {/if}
+        <td valign="top">{$item.item|escape}</td>
+        <td valign="top" align="right">{$item.cost}</td>
+        <td valign="top" align="center">{if $item.invoice_id}&nbsp;{else}<a href='expense_edit.php?id={$item.id}'>{$i18n.label.edit}</a>{/if}</td>
+      </tr>
+  {/foreach}
+    </table>
+    <table border="0" cellpadding="3" cellspacing="1" width="100%">
+      <tr>
+        <td nowrap align="right">{$i18n.label.day_total}: {$user->currency|escape} {$day_total}</td>
+      </tr>
+    </table>
+{/if}
   </td>
 </tr>
 </table>
 {$forms.expensesForm.close}
-
-