#2151: Adding javascript calender to custom field
-------------------------------+--------------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: jonas
Type: enhancement | Status: new
Priority: low | Milestone: 1.0
Component: ticket system | Version:
Severity: major | Resolution:
Keywords: |
-------------------------------+--------------------------------------------
Comment (by [EMAIL PROTECTED]):
Thanks for the example ticket.cs
I have changed it a bit so it uses a hidden field and display area, so
users cannot change it directly (to avoid invalid dates entered) and
disabled weekend days. Here is the relevant part of the ticket.cs file:
{{{
<?cs if:field.type == 'text' ?>
<?cs if:name(field) == 'completeby' ?>
<input type="hidden" id="<?cs var:name(field) ?>" name="<?cs
var:name(field) ?>" />
<span style="background-color: rgb(255, 255, 255); cursor: default;"
onmouseover="this.style.backgroundColor='#ff0';"
onmouseout="this.style.backgroundColor='#fff';"
id="<?cs var:name(field)?>_f">
<?cs if:string.length(ticket[name(field)]) == 0 ?>
Click to enter date
<?cs else ?>
<?cs var:ticket[name(field)] ?>
<?cs /if?>
</span>
<script type="text/javascript">
Calendar.setup({
inputField : "<?cs var:name(field)?>", // id of the input
field
ifFormat : "%Y-%m-%d", // format of the input field
showsTime : false, // will display a time
selector
displayArea : "<?cs var:name(field)?>_f", // id of display
span
daFormat : "KW%W %d.%m.%Y", // format to display
singleClick : true, // double-click mode
step : 1, // show all years in drop-
down boxes
dateStatusFunc : function (date) { // disable weekend days
return (date.getDay() == 6 || date.getDay()
== 0)
? true :
false;
}
});
</script>
<?cs elif:name(field) == 'nextactiondue' ?>
...same as above...
<?cs else ?>
<input type="text" id="<?cs var:name(field) ?>" name="<?cs
var:name(field) ?>"
value="<?cs var:ticket[name(field)] ?>" />
<?cs /if ?>
<?cs elif:field.type == 'select' ?>
...
}}}
--
Ticket URL: <http://projects.edgewall.com/trac/ticket/2151>
The Trac Project <http://trac.edgewall.com/>
_______________________________________________
Trac-Tickets mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac-tickets