Releasing templates plugin for testing.
[timetracker.git] / WEB-INF / templates / time.tpl
index bf28c50..fe9c294 100644 (file)
@@ -1,5 +1,22 @@
 {include file="time_script.tpl"}
 
+{if $template_dropdown}
+<script>
+var templates = new Array();
+{foreach $templates as $template}
+  templates[{$template.id}] = "{$template.content|escape:'javascript'}";
+{/foreach}
+
+// The fillNote function populates the Note field with a selected template body.
+function fillNote(id) {
+  if (!id) return; // Do nothing.
+  var template_body = templates[id];
+  var note = document.getElementById("note");
+  note.value = template_body;
+}
+</script>
+{/if}
+
 <style>
 .not_billable td {
   color: #ff6666;
           <td align="right">{$i18n.label.duration}:</td>
           <td>{$forms.timeRecordForm.duration.control}&nbsp;{if $user->getDecimalMark() == ','}{str_replace('.', ',', $i18n.form.time.duration_format)}{else}{$i18n.form.time.duration_format}{/if}</td>
         </tr>
+{/if}
+{if $template_dropdown}
+        <tr>
+          <td align="right">{$i18n.label.template}:</td>
+          <td>{$forms.timeRecordForm.template.control}</td>
+        </tr>
 {/if}
       </table>
     </td>
         <td align="right" valign="top">{if ($record.duration == '0:00' && $record.start <> '')}<font color="#ff0000">{$i18n.form.time.uncompleted}</font>{else}{$record.duration}{/if}</td>
         <td valign="top">{if $record.comment}{$record.comment|escape}{else}&nbsp;{/if}</td>
         <td valign="top" align="center">
-    {if $record.invoice_id}
+    {if $record.approved || $record.timesheet_id || $record.invoice_id}
           &nbsp;
     {else}
           <a href="time_edit.php?id={$record.id}">{$i18n.label.edit}</a>