X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Ftemplates%2Ftime_script.tpl;h=3e8a0202420151cc6aedb66654a77f1174f74a33;hb=cdd2e058776a3d0dc9b6f32a2d5d33e4f9388491;hp=275f74c6bc153ac42637880265c1f140ca9f531c;hpb=2b33db994ef8ee17de49df35afac00e4b1a6d45b;p=timetracker.git diff --git a/WEB-INF/templates/time_script.tpl b/WEB-INF/templates/time_script.tpl index 275f74c6..3e8a0202 100644 --- a/WEB-INF/templates/time_script.tpl +++ b/WEB-INF/templates/time_script.tpl @@ -43,6 +43,21 @@ var task_names = new Array(); task_names[{$task.id}] = "{$task.name|escape:'javascript'}"; {/foreach} +{if $template_dropdown} +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; +} +{/if} + // Mandatory top options for project and task dropdowns. var empty_label_project = "{$i18n.dropdown.select|escape:'javascript'}"; var empty_label_task = "{$i18n.dropdown.select|escape:'javascript'}"; @@ -143,6 +158,11 @@ function fillTaskDropdown(id) { } } } + + // Select a task if user is required to do so and there is only one task available. + if ({$user->task_required} && dropdown.options.length == 2) { // 2 because of mandatory top option. + dropdown.options[1].selected = true; + } } }