wc_strftime(timebuf, 32, "%d/%m/%Y", &tm);
wprintf(timebuf);
wprintf("\">");
- wprintf("<script type=\"text/javascript\">\n");
- wprintf(" var dpck = new DatePicker({\n ");
- wprintf("relative: '");
+ wprintf("<script type=\"text/javascript\">");
+ wprintf("attachDatePicker('");
wprintf(prefix);
- wprintf("',\n language: 'en',\n");
- wprintf("disableFutureDate: false\n});</script>");
+ wprintf("');\n");
+ wprintf("</script>");
wprintf(_("Hour: "));
wprintf("<SELECT NAME=\"%s_hour\" SIZE=\"1\">\n", prefix);
for (i=0; i<=23; ++i) {
if (WC->num_cal) for (i=0; i<(WC->num_cal); ++i) {
wprintf("<tr><td>");
icalproperty_status todoStatus = icalcomponent_get_status(WC->disp_cal[i].cal);
- wprintf("<input style=\"text-align: center;\" type=\"checkbox\" name=\"completed\" value=\"completed\" ");
+ wprintf("<input type=\"checkbox\" name=\"completed\" value=\"completed\" ");
if (todoStatus == ICAL_STATUS_COMPLETED) {
wprintf("checked=\"checked\" ");
}
wprintf("<div id=\"content\" class=\"service\">\n");
- wprintf("<script type=\"text/javascript\">"
- "function grey_all_day() { "
- "if (document.EventForm.alldayevent.checked) {"
- "document.EventForm.dtstart_hour.value='0';"
- "document.EventForm.dtstart_hour.disabled = true;"
- "document.EventForm.dtstart_minute.value='0';"
- "document.EventForm.dtstart_minute.disabled = true;"
- "document.EventForm.dtend_hour.value='0';"
- "document.EventForm.dtend_hour.disabled = true;"
- "document.EventForm.dtend_minute.value='0';"
- "document.EventForm.dtend_minute.disabled = true;"
- "document.EventForm.dtend_month.disabled = true;"
- "document.EventForm.dtend_day.disabled = true;"
- "document.EventForm.dtend_year.disabled = true;"
- "}"
- "else {"
- "document.EventForm.dtstart_hour.disabled = false;"
- "document.EventForm.dtstart_minute.disabled = false;"
- "document.EventForm.dtend_hour.disabled = false;"
- "document.EventForm.dtend_minute.disabled = false;"
- "document.EventForm.dtend_month.disabled = false;"
- "document.EventForm.dtend_day.disabled = false;"
- "document.EventForm.dtend_year.disabled = false;"
- "}"
- "}"
- "</script>\n"
- );
-
-
wprintf("<div class=\"fix_scrollbar_bug\">"
"<table class=\"event_background\"><tr><td>\n");
}
display_icaltimetype_as_webform(&t_start, "dtstart");
- wprintf("<INPUT TYPE=\"checkbox\" NAME=\"alldayevent\" "
- "VALUE=\"yes\" onClick=\"grey_all_day();\""
+ wprintf("<INPUT TYPE=\"checkbox\" id=\"alldayevent\" NAME=\"alldayevent\" "
+ "VALUE=\"yes\" onclick=\"eventEditAllDay();\""
" %s >%s",
- (t_start.is_date ? "CHECKED" : "" ),
+ (t_start.is_date ? "CHECKED=\"CHECKED\"" : "" ),
_("All day event")
);
*/
wprintf("<TR><TD><B>");
wprintf(_("End"));
- wprintf("</B></TD><TD>\n");
+ wprintf("</B></TD><TD id=\"dtendcell\">\n");
if (t_start.is_date) {
t_end = t_start;
}
wprintf("</td></tr></table></div>\n");
wprintf("<script type=\"text/javascript\">"
- "grey_all_day();"
+ "eventEditAllDay();"
"</script>\n"
);
'zh' : '关 闭',
'sv' : 'stäng'
}),
+ _language_reset : $H({ // FILL ME IN
+ 'en' : 'reset'
+ }),
/* date manipulation */
_todayDate : new Date(),
_current_date : null,
getLocaleClose : function () {
return this._language_close.get(this._language);
},
+ getLocaleReset : function() {
+ return this._language_reset.get(this._language);
+ },
_initCurrentDate : function () {
/* Create the DateFormatter */
this._df = new DatePickerFormatter(this._dateFormat[0], this._dateFormat[1]);
this._id_datepicker_next_year = this._id_datepicker_next+'-year';
this._id_datepicker_hdr = this._id_datepicker+'-header';
this._id_datepicker_ftr = this._id_datepicker+'-footer';
+ this._id_datepicker_rst = this._id_datepicker+'-reset';
/* build up calendar skel */
this._div = new Element('div', {
id : this._id_datepicker,
className : 'datepicker',
style : 'display: none; z-index:'+this._zindex });
- this._div.innerHTML = '<table><thead><tr>'+((this._enableYearBrowse) ? '<th width="10px" id="'+this._id_datepicker_prev_year+'" style="cursor: pointer;"> < </th>' : '')+'<th width="10px" id="'+this._id_datepicker_prev+'" style="cursor: pointer;"> << </th><th id="'+this._id_datepicker_hdr+'" colspan="'+((this._enableYearBrowse) ? 3 : 5 )+'"></th><th width="10px" id="'+this._id_datepicker_next+'" style="cursor: pointer;"> >> </th>'+((this._enableYearBrowse) ? '<th width="10px" id="'+this._id_datepicker_next_year+'" style="cursor: pointer;"> > </th>' : '')+'</tr></thead><tbody id="'+this._id_datepicker+'-tbody"></tbody><tfoot><td colspan="7" id="'+this._id_datepicker_ftr+'"></td></tfoot></table>';
+ this._div.innerHTML = '<table><thead><tr>'+((this._enableYearBrowse) ? '<th width="10px" id="'+this._id_datepicker_prev_year+'" style="cursor: pointer;"> < </th>' : '')+'<th width="10px" id="'+this._id_datepicker_prev+'" style="cursor: pointer;"> << </th><th id="'+this._id_datepicker_hdr+'" colspan="'+((this._enableYearBrowse) ? 3 : 5 )+'"></th><th width="10px" id="'+this._id_datepicker_next+'" style="cursor: pointer;"> >> </th>'+((this._enableYearBrowse) ? '<th width="10px" id="'+this._id_datepicker_next_year+'" style="cursor: pointer;"> > </th>' : '')+'</tr></thead><tbody id="'+this._id_datepicker+'-tbody"></tbody><tfoot><tr><td colspan="7" id="'+this._id_datepicker_ftr+'"></td></tr><tr><td colspan="7" id="'+this._id_datepicker_rst+'"></td></tr></tfoot></table>';
/* finally declare the event listener on input field */
Event.observe(this._relative,
this._showEvent, this.click.bindAsEventListener(this), false);
this._initCurrentDate();
/* set the close locale content */
$(this._id_datepicker_ftr).innerHTML = this.getLocaleClose();
+ $(this._id_datepicker_rst).innerHTML = this.getLocaleReset();
/* declare the observers for UI control */
Event.observe($(this._id_datepicker_prev),
'click', this.prevMonth.bindAsEventListener(this), false);
}
Event.observe($(this._id_datepicker_ftr),
'click', this.close.bindAsEventListener(this), false);
+ Event.observe($(this._id_datepicker_rst),
+ 'click', this.reset.bindAsEventListener(this), false);
},
/* hack for buggy form elements layering in IE */
_wrap_in_iframe : function ( content ) {
}
eval(this._afterClose());
},
+ // Reset function
+ reset: function() {
+ $(this._relative).value = "";
+ this._initCurrentDate();
+ },
/**
* setDateFormat
*/
new Ajax.Updater(title_divname, 'handle_rsvp', { method: 'post', parameters: p } );
Effect.Fade(question_divname, { duration: 0.5 });
}
-
+var fakeMouse = document.createEvent("MouseEvents");
+fakeMouse.initMouseEvent("click", true, true, window,
+ 0,0,0,0,0, false, false, false, false, 0, null);
// TODO: Collapse into one function
function toggleTaskDtStart(event) {
var checkBox = $('nodtstart');
+ dtStart = document.getElementById("dtstart");
if (checkBox.checked) {
- $('dtstart').disabled = true;
- $('dtstart').value = "";
+ dtStart.disabled = true;
+ dtStart.style.textDecoration = "line-through";
} else {
- $('dtstart').disabled = false;
+ dtStart.disabled = false;
+ dtStart.style.textDecoration = "";
+ if (dtStart.value.length == 0)
+ dtStart.dpck._initCurrentDate();
}
}
function toggleTaskDue(event) {
var checkBox = $('nodue');
+ dueField = document.getElementById("due");
if (checkBox.checked) {
- $('due').disabled = true;
- $('due').value = "";
+ dueField.disabled = true;
+ dueField.style.textDecoration = "line-through";
} else {
- $('due').disabled = false;
+ dueField.disabled = false;
+ dueField.style.textDecoration = "";
+ if (dueField.value.length == 0)
+ dueField.dpck._initCurrentDate();
}
}
function ToggleTaskDateOrNoDateActivate(event) {
var table = $('taskview');
}
+function attachDatePicker(relative) {
+ var dpck = new DatePicker({
+ relative: relative,
+ language: 'en', // fix please
+ disableFutureDate: false
+ });
+ document.getElementById(relative).dpck = dpck; // attach a ref to it
+}
+function eventEditAllDay() {
+ var allDayCheck = document.getElementById("alldayevent");
+ var dtend= document.getElementById("dtendcell");
+ if(allDayCheck.checked) {
+ //dtend.disabled = true;
+ dtend.style.textDecoration = "line-through";
+ } else {
+ //dtend_day.disabled = false;
+ dtend.style.textDecoration = "";
+ }
+}