From ec840858a64942f369b56936f56076188bab7c13 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Thu, 14 Jul 2011 15:26:49 +0000 Subject: [PATCH] See ChangeLog Monotone-Parent: 07d4e2dd2f55ba5735637b9ccd7e85474c204bca Monotone-Revision: e25c29c65bbc1f6ce6cf68858f20a104b724d36b Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2011-07-14T15:26:49 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 17 ++++++++++ UI/MailerUI/UIxMailListActions.m | 3 +- UI/WebServerResources/SOGoTimePicker.js | 4 +-- UI/WebServerResources/UIxAppointmentEditor.js | 31 ++++++++++--------- UI/WebServerResources/UIxAttendeesEditor.js | 17 +++++----- 5 files changed, 44 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index f5931ed3c..ed45cdaee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2011-07-14 Francis Lachapelle + + * UI/MailerUI/UIxMailListActions.m + (-getUIDsInFolder:withHeaders:): don't add the quota if there's no + quota for the mail account. + + * UI/WebServerResources/UIxAttendeesEditor.js (onContactKeydown): + fixed glitch when pressing the tab key from an empty input field. + (onFreeBusyLoadHandler): removed redundant calls that were causing + errors when retrieving the attendees freebusy information. + + * UI/WebServerResources/SOGoTimePicker.js (onChange): specified + the radix when calling parseInt since a string starting with 0 + would be parsed as an octal number. + + * UI/WebServerResources/UIxAppointmentEditor.js (validateAptEditor): idem. + 2011-07-14 Ludovic Marcotte * SoObjects/SOGo/SOGoGCSFolder.m (davCollectionTag) diff --git a/UI/MailerUI/UIxMailListActions.m b/UI/MailerUI/UIxMailListActions.m index 89e90c38f..e6789405f 100644 --- a/UI/MailerUI/UIxMailListActions.m +++ b/UI/MailerUI/UIxMailListActions.m @@ -669,7 +669,8 @@ // We also return the inbox quota account = [folder mailAccountFolder]; quota = [account getInboxQuota]; - [data setObject: quota forKey: @"quotas"]; + if (quota != nil) + [data setObject: quota forKey: @"quotas"]; return data; } diff --git a/UI/WebServerResources/SOGoTimePicker.js b/UI/WebServerResources/SOGoTimePicker.js index a8ce741e1..68dfaafcb 100644 --- a/UI/WebServerResources/SOGoTimePicker.js +++ b/UI/WebServerResources/SOGoTimePicker.js @@ -160,8 +160,8 @@ var SOGoTimePickerInterface = { if (matches) { this.hours = matches[1]; this.minutes = matches[2] || '0'; - if (parseInt(this.hours) > 23) this.hours = 23; - if (parseInt(this.minutes) > 59) this.minutes = 59; + if (parseInt(this.hours, 10) > 23) this.hours = 23; + if (parseInt(this.minutes, 10) > 59) this.minutes = 59; if (this.minutes % 5 == 0) { if (this.extended) this.toggleExtendedView(); diff --git a/UI/WebServerResources/UIxAppointmentEditor.js b/UI/WebServerResources/UIxAppointmentEditor.js index 5517560d2..f5091275a 100644 --- a/UI/WebServerResources/UIxAppointmentEditor.js +++ b/UI/WebServerResources/UIxAppointmentEditor.js @@ -23,7 +23,8 @@ var contactSelectorAction = 'calendars-contacts'; var AppointmentEditor = { - attendeesMenu: null + attendeesMenu: null, + timeRE: /(\d{1,2}):?(\d{1,2})/ }; function uixEarlierDate(date1, date2) { @@ -76,18 +77,17 @@ function validateAptEditor() { return false; } else if (tmpdate == null /* means: same date */) { - // TODO: check time var startHour, startMinute, endHour, endMinute; var matches; - matches = document.forms[0]['startTime_time'].value.match(/([0-9]+):([0-9]+)/); + matches = AppointmentEditor.timeRE.exec(window.timeWidgets['start']['time'].value); if (matches) { - startHour = parseInt(matches[1]); - startMinute = parseInt(matches[2]); - matches = document.forms[0]['endTime_time'].value.match(/([0-9]+):([0-9]+)/); + startHour = parseInt(matches[1], 10); + startMinute = parseInt(matches[2], 10); + matches = AppointmentEditor.timeRE.exec(window.timeWidgets['end']['time'].value); if (matches) { - endHour = parseInt(matches[1]); - endMinute = parseInt(matches[2]); + endHour = parseInt(matches[1], 10); + endMinute = parseInt(matches[2], 10); if (startHour > endHour) { alert(labels.validate_endbeforestart); @@ -227,7 +227,7 @@ function endDayAsShortString() { function _getDate(which) { var date = window.timeWidgets[which]['date'].inputAsDate(); - var time = window.timeWidgets[which]['time'].value.match(/([0-9]{1,2}):?([0-9]{2})/); + var time = AppointmentEditor.timeRE.exec(window.timeWidgets[which]['time'].value); if (time) { date.setHours(time[1]); date.setMinutes(time[2]); @@ -238,9 +238,11 @@ function _getDate(which) { function _getShadowDate(which) { var date = window.timeWidgets[which]['date'].getAttribute("shadow-value").asDate(); - var time = window.timeWidgets[which]['time'].getAttribute("shadow-value").split(":"); - date.setHours(time[0]); - date.setMinutes(time[1]); + var time = AppointmentEditor.timeRE.exec(window.timeWidgets[which]['time'].getAttribute("shadow-value")); + if (time) { + date.setHours(time[1]); + date.setMinutes(time[2]); + } return date; } @@ -280,8 +282,7 @@ function onAdjustTime(event) { if ($(this).readAttribute("id").startsWith("start")) { // Start date was changed - var delta = window.getShadowStartDate().valueOf() - - startDate.valueOf(); + var delta = window.getShadowStartDate().valueOf() - startDate.valueOf(); var newEndDate = new Date(endDate.valueOf() - delta); window.setEndDate(newEndDate); @@ -293,7 +294,7 @@ function onAdjustTime(event) { } else { // End date was changed - var delta = endDate.valueOf() - startDate.valueOf(); + var delta = endDate.valueOf() - startDate.valueOf(); if (delta < 0) { alert(labels.validate_endbeforestart); var oldEndDate = window.getShadowEndDate(); diff --git a/UI/WebServerResources/UIxAttendeesEditor.js b/UI/WebServerResources/UIxAttendeesEditor.js index e3fc1aecd..e5806ed3b 100644 --- a/UI/WebServerResources/UIxAttendeesEditor.js +++ b/UI/WebServerResources/UIxAttendeesEditor.js @@ -99,18 +99,18 @@ function onContactKeydown(event) { if (this.confirmedValue) this.value = this.confirmedValue; this.hasfreebusy = false; - var row = $(this).up("tr").next(); if (this.isList) { resolveListAttendees(this, true); event.stop(); } else { this.focussed = false; + var row = $(this).up("tr").next(); var input = row.down("input"); if (input) { input.focussed = true; input.activate(); } - else + else if (!this.value.blank()) newAttendee(); } } @@ -173,7 +173,7 @@ function onContactKeydown(event) { function performSearch(input) { // Perform address completion - if (input.value.trim().length > 0) { + if (!input.value.blank()) { var urlstr = (UserFolderURL + "Contacts/allContactSearch?excludeGroups=1&search=" + encodeURIComponent(input.value)); @@ -509,7 +509,7 @@ function newAttendee(previousAttendee) { function checkAttendee(input) { var row = $(input.parentNode.parentNode); var tbody = row.parentNode; - if (tbody && input.value.trim().length == 0) { + if (tbody && input.value.blank()) { var dataTable = $("freeBusyData").tBodies[0]; var dataRow = dataTable.rows[row.sectionRowIndex]; tbody.removeChild(row); @@ -1114,6 +1114,7 @@ function displayFreeBusyForNode(input) { } } }; + var rq = new freeBusyRequest(sd, ed, input.uid, listener); rq.start(); } else { @@ -1413,15 +1414,14 @@ function onTimeDateWidgetChange() { function prepareTableHeaders() { var startTimeDate = $("startTime_date"); var startDate = startTimeDate.inputAsDate(); - //var startDate = $F('startTime_date').asDate(); var endTimeDate = $("endTime_date"); var endDate = endTimeDate.inputAsDate(); - //var endDate = endTimeDate.getValue().asDate(); endDate.setTime(endDate.getTime()); var rows = $("freeBusyHeader").rows; var days = startDate.daysUpTo(endDate); + for (var i = 0; i < days.length; i++) { var header1 = document.createElement("th"); header1.colSpan = ((displayEndHour - displayStartHour) + 1)/2; @@ -1610,9 +1610,6 @@ function onFreeBusyLoadHandler() { initializeTimeSlotWidgets(); initializeWindowButtons(); - prepareTableHeaders(); - prepareTableRows(); - redisplayEventSpans(); prepareAttendees(); onWindowResize(null); Event.observe(window, "resize", onWindowResize); @@ -1722,7 +1719,7 @@ function _setDate(which, newDate) { window.timeWidgets[which]['date'].setInputAsDate(newDate); if (!isAllDay) { window.timeWidgets[which]['time'].value = newDate.getDisplayHoursString(); - window.timeWidgets[which]['time'].onChange(); // method from SOGoTimePicker + if (window.timeWidgets[which]['time'].onChange) window.timeWidgets[which]['time'].onChange(); // method from SOGoTimePicker } }