Allow any number of last days in TodayWorktime
parent
7683087937
commit
3f66ba7490
|
@ -30,7 +30,7 @@
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<form name="lastdaysform" action="fill-day-worktime.cgi" method="get">
|
<form name="lastdaysform" action="fill-day-worktime.cgi" method="get">
|
||||||
<input value="Select last days" type="submit" />
|
<input value="Select last days" type="submit" />
|
||||||
<select name="lastdays">
|
<select [% lastdays <= 7 ? 'name="lastdays"' : 'style="display: none"' %] id="_lastdays" onchange="check_other(this)">
|
||||||
<option value="1" [% " selected=\"selected\"" IF (!lastdays)||(lastdays==1) %]>1</option>
|
<option value="1" [% " selected=\"selected\"" IF (!lastdays)||(lastdays==1) %]>1</option>
|
||||||
<option value="2" [% " selected=\"selected\"" IF (lastdays==2) %]>2</option>
|
<option value="2" [% " selected=\"selected\"" IF (lastdays==2) %]>2</option>
|
||||||
<option value="3" [% " selected=\"selected\"" IF (lastdays==3) %]>3</option>
|
<option value="3" [% " selected=\"selected\"" IF (lastdays==3) %]>3</option>
|
||||||
|
@ -38,7 +38,9 @@
|
||||||
<option value="5" [% " selected=\"selected\"" IF (lastdays==5) %]>5</option>
|
<option value="5" [% " selected=\"selected\"" IF (lastdays==5) %]>5</option>
|
||||||
<option value="6" [% " selected=\"selected\"" IF (lastdays==6) %]>6</option>
|
<option value="6" [% " selected=\"selected\"" IF (lastdays==6) %]>6</option>
|
||||||
<option value="7" [% " selected=\"selected\"" IF (lastdays==7) %]>7</option>
|
<option value="7" [% " selected=\"selected\"" IF (lastdays==7) %]>7</option>
|
||||||
|
<option value="other">other...</option>
|
||||||
</select>
|
</select>
|
||||||
|
<input [% lastdays > 7 ? 'name="lastdays" style="width: 80px"' : 'style="display: none; width: 80px"' %] value="[% lastdays || 1 %]" />
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -124,12 +126,29 @@
|
||||||
</td></tr></table>
|
</td></tr></table>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function check_other(sel)
|
||||||
|
{
|
||||||
|
if (sel.style.display != 'none' && sel.value == 'other')
|
||||||
|
{
|
||||||
|
var txt = sel.nextSibling;
|
||||||
|
while (txt && txt.nodeName != 'INPUT')
|
||||||
|
txt = txt.nextSibling;
|
||||||
|
txt.setAttribute('name', sel.name);
|
||||||
|
txt.style.display = '';
|
||||||
|
sel.setAttribute('name', '');
|
||||||
|
sel.style.display = 'none';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
check_other(document.getElementById('_lastdays'));
|
||||||
|
</script>
|
||||||
|
|
||||||
[% PROCESS global/footer.html.tmpl %]
|
[% PROCESS global/footer.html.tmpl %]
|
||||||
|
|
||||||
[% BLOCK today_or_lastdays %]
|
[% BLOCK today_or_lastdays %]
|
||||||
[% IF lastdays>1 %]
|
[% IF lastdays>1 %]
|
||||||
Last [% lastdays %] Days
|
Last [% lastdays %] Days
|
||||||
[% ELSE %]
|
[% ELSE %]
|
||||||
Today
|
Today
|
||||||
[% END %]
|
[% END %]
|
||||||
[% END %]
|
[% END %]
|
||||||
|
|
Loading…
Reference in New Issue