diff --git a/UI/Scheduler/UIxTaskEditor.h b/UI/Scheduler/UIxTaskEditor.h
index 7509525ee..ea6e93a10 100644
--- a/UI/Scheduler/UIxTaskEditor.h
+++ b/UI/Scheduler/UIxTaskEditor.h
@@ -33,6 +33,8 @@
@interface UIxTaskEditor : UIxComponentEditor
{
NSCalendarDate *dueDate;
+ BOOL hasStartDate;
+ BOOL hasDueDate;
}
- (void) setTaskStartDate: (NSCalendarDate *) _date;
diff --git a/UI/Scheduler/UIxTaskEditor.m b/UI/Scheduler/UIxTaskEditor.m
index 052224a6e..22cafcc4d 100644
--- a/UI/Scheduler/UIxTaskEditor.m
+++ b/UI/Scheduler/UIxTaskEditor.m
@@ -77,8 +77,6 @@
@"STATUS:NEEDS-ACTION\r\n" /* confirmed by default */
@"PERCENT-COMPLETE:0\r\n"
@"DTSTAMP:%@Z\r\n"
- @"DTSTART:%@\r\n"
- @"DUE:%@\r\n"
@"SEQUENCE:1\r\n"
@"PRIORITY:5\r\n"
@"%@" /* organizer */
@@ -86,7 +84,7 @@
@"END:VTODO\r\n"
@"END:VCALENDAR";
- NSCalendarDate *lStartDate, *lDueDate, *stamp;
+ NSCalendarDate *stamp;
NSString *template, *s;
unsigned minutes;
@@ -97,19 +95,13 @@
else {
minutes = 60;
}
- lStartDate = [self selectedDate];
- lDueDate = [lStartDate dateByAddingYears:0 months:0 days:0
- hours:0 minutes:minutes seconds:0];
-
stamp = [NSCalendarDate calendarDate];
[stamp setTimeZone: [NSTimeZone timeZoneWithName: @"GMT"]];
- s = [self iCalParticipantsAndResourcesStringFromQueryParameters];
+ s = [self iCalParticipantsAndResourcesStringFromQueryParameters];
template = [NSString stringWithFormat:iCalStringTemplate,
[[self clientObject] nameInContainer],
[stamp iCalFormattedDateTimeString],
- [lStartDate iCalFormattedDateTimeString],
- [lDueDate iCalFormattedDateTimeString],
[self iCalOrganizerString],
s];
return template;
@@ -182,12 +174,14 @@
uTZ = [[self clientObject] userTimeZone];
dueDate = [_task due];
- if (!dueDate)
- dueDate = [[self startDate] dateByAddingYears: 0 months: 0 days: 0
- hours: 1 minutes: 0 seconds: 0];
-
- [dueDate setTimeZone: uTZ];
- [dueDate retain];
+// if (!dueDate)
+// dueDate = [[self startDate] dateByAddingYears: 0 months: 0 days: 0
+// hours: 1 minutes: 0 seconds: 0];
+ if (dueDate)
+ {
+ [dueDate setTimeZone: uTZ];
+ [dueDate retain];
+ }
}
- (void) saveValuesIntoTask: (iCalToDo *) _task
@@ -195,9 +189,18 @@
/* merge in form values */
NSArray *attendees, *lResources;
iCalRecurrenceRule *rrule;
-
- [_task setStartDate: [self taskStartDate]];
- [_task setDue: [self taskDueDate]];
+ NSCalendarDate *dateTime;
+
+ if (hasStartDate)
+ dateTime = [self taskStartDate];
+ else
+ dateTime = nil;
+ [_task setStartDate: dateTime];
+ if (hasDueDate)
+ dateTime = [self taskDueDate];
+ else
+ dateTime = nil;
+ [_task setDue: dateTime];
[_task setSummary: [self title]];
[_task setLocation: [self location]];
@@ -444,4 +447,42 @@
return [self redirectToLocation: [self completeURIForMethod:@"../view"]];
}
+- (void) setHasStartDate: (BOOL) aBool
+{
+ hasStartDate = aBool;
+}
+
+- (BOOL) hasStartDate
+{
+ return ([self taskStartDate] != nil);
+}
+
+- (BOOL) startDateDisabled
+{
+ return ![self hasStartDate];
+}
+
+- (void) setHasDueDate: (BOOL) aBool
+{
+ hasDueDate = aBool;
+}
+
+- (BOOL) hasDueDate
+{
+ return ([self taskDueDate] != nil);
+}
+
+- (BOOL) dueDateDisabled
+{
+ return ![self hasDueDate];
+}
+
+- (void) setDueDateDisabled: (BOOL) aBool
+{
+}
+
+- (void) setStartDateDisabled: (BOOL) aBool
+{
+}
+
@end /* UIxTaskEditor */
diff --git a/UI/Templates/SchedulerUI/UIxTaskEditor.wox b/UI/Templates/SchedulerUI/UIxTaskEditor.wox
index 9d524a9a1..75c5de370 100644
--- a/UI/Templates/SchedulerUI/UIxTaskEditor.wox
+++ b/UI/Templates/SchedulerUI/UIxTaskEditor.wox
@@ -35,17 +35,26 @@
var:checked="isPrivate"
/>
-
-
-
-
+
+
+
diff --git a/UI/WebServerResources/UIxTaskEditor.js b/UI/WebServerResources/UIxTaskEditor.js
index cdfcdf5b3..0cb69be84 100644
--- a/UI/WebServerResources/UIxTaskEditor.js
+++ b/UI/WebServerResources/UIxTaskEditor.js
@@ -22,148 +22,163 @@
var contactSelectorAction = 'calendars-contacts';
function uixEarlierDate(date1, date2) {
- // can this be done in a sane way?
-// cuicui = 'year';
- if (date1.getYear() < date2.getYear()) return date1;
- if (date1.getYear() > date2.getYear()) return date2;
- // same year
-// cuicui += '/month';
- if (date1.getMonth() < date2.getMonth()) return date1;
- if (date1.getMonth() > date2.getMonth()) return date2;
-// // same month
-// cuicui += '/date';
- if (date1.getDate() < date2.getDate()) return date1;
- if (date1.getDate() > date2.getDate()) return date2;
- // same day
- return null;
+ // can this be done in a sane way?
+ // cuicui = 'year';
+ if (date1.getYear() < date2.getYear()) return date1;
+ if (date1.getYear() > date2.getYear()) return date2;
+ // same year
+ // cuicui += '/month';
+ if (date1.getMonth() < date2.getMonth()) return date1;
+ if (date1.getMonth() > date2.getMonth()) return date2;
+ // // same month
+ // cuicui += '/date';
+ if (date1.getDate() < date2.getDate()) return date1;
+ if (date1.getDate() > date2.getDate()) return date2;
+ // same day
+ return null;
}
function validateAptEditor() {
- var e, startdate, enddate, tmpdate;
+ var e, startdate, enddate, tmpdate;
- e = document.getElementById('summary');
- if (e.value.length == 0) {
- if (!confirm(labels.validate_notitle.decodeEntities()))
- return false;
- }
+ e = document.getElementById('summary');
+ if (e.value.length == 0) {
+ if (!confirm(labels.validate_notitle.decodeEntities()))
+ return false;
+ }
- e = document.getElementById('startTime_date');
- if (e.value.length != 10) {
- alert(labels.validate_invalid_startdate.decodeEntities());
- return false;
- }
- startdate = e.calendar.prs_date(e.value);
- if (startdate == null) {
- alert(labels.validate_invalid_startdate.decodeEntities());
- return false;
- }
-
- e = document.getElementById('endTime_date');
- if (e.value.length != 10) {
- alert(labels.validate_invalid_enddate.decodeEntities());
- return false;
- }
- enddate = e.calendar.prs_date(e.value);
- if (enddate == null) {
- alert(labels.validate_invalid_enddate.decodeEntities());
- return false;
- }
-// cuicui = '';
- tmpdate = uixEarlierDate(startdate, enddate);
- if (tmpdate == enddate) {
-// window.alert(cuicui);
- alert(labels.validate_endbeforestart.decodeEntities());
- return false;
- }
- else if (tmpdate == null /* means: same date */) {
- // TODO: check time
- var start, end;
-
- start = parseInt(document.forms[0]['startTime_time_hour'].value);
- end = parseInt(document.forms[0]['endTime_time_hour'].value);
-
- if (start > end) {
+ e = document.getElementById('startTime_date');
+ if (!e.disabled) {
+ if (e.value.length != 10) {
+ alert(labels.validate_invalid_startdate.decodeEntities());
+ return false;
+ }
+ startdate = e.calendar.prs_date(e.value);
+ if (startdate == null) {
+ alert(labels.validate_invalid_startdate.decodeEntities());
+ return false;
+ }
+ }
+
+ e = document.getElementById('dueTime_date');
+ if (!e.disabled) {
+ if (e.value.length != 10) {
+ alert(labels.validate_invalid_enddate.decodeEntities());
+ return false;
+ }
+ enddate = e.calendar.prs_date(e.value);
+ if (enddate == null) {
+ alert(labels.validate_invalid_enddate.decodeEntities());
+ return false;
+ }
+ }
+ // cuicui = '';
+ tmpdate = uixEarlierDate(startdate, enddate);
+ if (tmpdate == enddate) {
+ // window.alert(cuicui);
alert(labels.validate_endbeforestart.decodeEntities());
return false;
- }
- else if (start == end) {
- start = parseInt(document.forms[0]['startTime_time_minute'].value);
- end = parseInt(document.forms[0]['endTime_time_minute'].value);
- if (start > end) {
- alert(labels.validate_endbeforestart.decodeEntities());
- return false;
- }
- }
- }
+ }
+ else if (tmpdate == null /* means: same date */) {
+ // TODO: check time
+ var start, end;
+
+ start = parseInt(document.forms[0]['startTime_time_hour'].value);
+ end = parseInt(document.forms[0]['dueTime_time_hour'].value);
- return true;
+ if (start > end) {
+ alert(labels.validate_endbeforestart.decodeEntities());
+ return false;
+ }
+ else if (start == end) {
+ start = parseInt(document.forms[0]['startTime_time_minute'].value);
+ end = parseInt(document.forms[0]['dueTime_time_minute'].value);
+ if (start > end) {
+ alert(labels.validate_endbeforestart.decodeEntities());
+ return false;
+ }
+ }
+ }
+
+ return true;
}
function toggleDetails() {
- var div = $("details");
- var buttons = $("buttons");
- var buttonsHeight = buttons.clientHeight * 3;
+ var div = $("details");
+ var buttons = $("buttons");
+ var buttonsHeight = buttons.clientHeight * 3;
- if (div.style.visibility) {
- div.style.visibility = null;
- window.resizeBy(0, -(div.clientHeight + buttonsHeight));
- $("detailsButton").innerHTML = labels["Show Details"];
- } else {
- div.style.visibility = 'visible;';
- window.resizeBy(0, (div.clientHeight + buttonsHeight));
- $("detailsButton").innerHTML = labels["Hide Details"];
- }
+ if (div.style.visibility) {
+ div.style.visibility = null;
+ window.resizeBy(0, -(div.clientHeight + buttonsHeight));
+ $("detailsButton").innerHTML = labels["Show Details"];
+ } else {
+ div.style.visibility = 'visible;';
+ window.resizeBy(0, (div.clientHeight + buttonsHeight));
+ $("detailsButton").innerHTML = labels["Hide Details"];
+ }
- return false;
+ return false;
}
function toggleCycleVisibility(node, nodeName, hiddenValue) {
- var spanNode = $(nodeName);
- var newVisibility = ((node.value == hiddenValue) ? null : 'visible;');
- spanNode.style.visibility = newVisibility;
+ var spanNode = $(nodeName);
+ var newVisibility = ((node.value == hiddenValue) ? null : 'visible;');
+ spanNode.style.visibility = newVisibility;
- if (nodeName == 'cycleSelectionFirstLevel') {
- var otherSpanNode = $('cycleSelectionSecondLevel');
- if (!newVisibility)
+ if (nodeName == 'cycleSelectionFirstLevel') {
+ var otherSpanNode = $('cycleSelectionSecondLevel');
+ if (!newVisibility)
{
- otherSpanNode.superVisibility = otherSpanNode.style.visibility;
- otherSpanNode.style.visibility = null;
+ otherSpanNode.superVisibility = otherSpanNode.style.visibility;
+ otherSpanNode.style.visibility = null;
}
- else
+ else
{
- otherSpanNode.style.visibility = otherSpanNode.superVisibility;
- otherSpanNode.superVisibility = null;
+ otherSpanNode.style.visibility = otherSpanNode.superVisibility;
+ otherSpanNode.superVisibility = null;
}
- }
+ }
}
function addContact(tag, fullContactName, contactId, contactName, contactEmail)
{
- var uids = $('uixselector-participants-uidList');
- log ("contactId: " + contactId);
- if (contactId)
- {
+ var uids = $('uixselector-participants-uidList');
+ log ("contactId: " + contactId);
+ if (contactId)
+ {
var re = new RegExp("(^|,)" + contactId + "($|,)");
log ("uids: " + uids);
if (!re.test(uids.value))
- {
- log ("no match... realling adding");
- if (uids.value.length > 0)
+ {
+ log ("no match... realling adding");
+ if (uids.value.length > 0)
uids.value += ',' + contactId;
- else
+ else
uids.value = contactId;
- log ('values: ' + uids.value);
- var names = $('uixselector-participants-display');
- names.innerHTML += ('
'
- + contactName + '');
- }
+ log ('values: ' + uids.value);
+ var names = $('uixselector-participants-display');
+ names.innerHTML += ('
'
+ + contactName + '');
+ }
else
- log ("match... ignoring contact");
- }
+ log ("match... ignoring contact");
+ }
- return false;
+ return false;
+}
+
+function onTimeControlCheck(checkBox) {
+ var inputs = checkBox.parentNode.getElementsByTagName("input");
+ var selects = checkBox.parentNode.getElementsByTagName("select");
+ for (var i = 0; i < inputs.length; i++)
+ if (inputs[i] != checkBox)
+ inputs[i].disabled = !checkBox.checked;
+ for (var i = 0; i < selects.length; i++)
+ if (selects[i] != checkBox)
+ selects[i].disabled = !checkBox.checked;
}