From 9a46f67292972ad95b6e30ba3cac26ee73652e5b Mon Sep 17 00:00:00 2001 From: wolfgang Date: Wed, 24 Oct 2007 17:12:23 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1196 d1b88da0-ebda-0310-925b-ed51d893ca5b --- ChangeLog | 8 +++ SOPE/sope-gdl1/GDLContentStore/ChangeLog | 6 ++ .../GDLContentStore/GCSFolderManager.m | 2 +- SoObjects/SOGo/NSArray+Utilities.m | 8 ++- SoObjects/SOGo/NSDictionary+Utilities.m | 9 ++- SoObjects/SOGo/SOGoUser.m | 3 - .../English.lproj/Localizable.strings | 4 +- UI/Scheduler/French.lproj/Localizable.strings | 4 +- UI/Scheduler/German.lproj/Localizable.strings | 4 +- UI/Scheduler/UIxCalendarSelector.m | 6 ++ UI/Scheduler/UIxComponentEditor.m | 2 +- .../SchedulerUI/UIxCalendarSelector.wox | 6 +- UI/WebServerResources/MailerUI.js | 60 +++++++++--------- UI/WebServerResources/SchedulerUI.css | 1 + UI/WebServerResources/SchedulerUI.js | 63 +++++++++---------- 15 files changed, 107 insertions(+), 79 deletions(-) diff --git a/ChangeLog b/ChangeLog index e0077923..9cc24ef9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2007-10-23 Wolfgang Sourdeau + * SoObjects/SOGo/NSArray+Utilities.m + ([NSArray -stringsWithFormat:format]): replace instances of NSNull + with empty strings. + + * SoObjects/SOGo/NSDictionary+Utilities.m ([NSDictionary + -keysWithFormat:keyFormat]): replace instances of NSNull with + empty strings. + * SoObjects/Contacts/SOGoContactLDAPFolder.m: if "displayName" is empty, use "c_cn" instead. diff --git a/SOPE/sope-gdl1/GDLContentStore/ChangeLog b/SOPE/sope-gdl1/GDLContentStore/ChangeLog index 88819605..dae4f0dc 100644 --- a/SOPE/sope-gdl1/GDLContentStore/ChangeLog +++ b/SOPE/sope-gdl1/GDLContentStore/ChangeLog @@ -1,3 +1,9 @@ +2007-10-24 Wolfgang Sourdeau + + * GCSFolderManager.m ([GCSFolderManager -baseTableNameWithUID:]): + prefix the table names with "sogo" to avoid problems with + digits-only identifiers. + 2007-10-19 Wolfgang Sourdeau * GCSFolderManager.m ([GCSFolderManager -baseTableNameWithUID:]): diff --git a/SOPE/sope-gdl1/GDLContentStore/GCSFolderManager.m b/SOPE/sope-gdl1/GDLContentStore/GCSFolderManager.m index bee84b5d..b664d54e 100644 --- a/SOPE/sope-gdl1/GDLContentStore/GCSFolderManager.m +++ b/SOPE/sope-gdl1/GDLContentStore/GCSFolderManager.m @@ -624,7 +624,7 @@ static NSCharacterSet *asciiAlphaNumericCS = nil; unsigned int count, max, done; NSMutableString *newUID; - newUID = [NSMutableString string]; + newUID = [NSMutableString stringWithString: @"sogo"]; now = [NSDate date]; max = [_uid length]; diff --git a/SoObjects/SOGo/NSArray+Utilities.m b/SoObjects/SOGo/NSArray+Utilities.m index 4845b33d..3f5a78b5 100644 --- a/SoObjects/SOGo/NSArray+Utilities.m +++ b/SoObjects/SOGo/NSArray+Utilities.m @@ -20,6 +20,7 @@ * Boston, MA 02111-1307, USA. */ +#import #import #import "NSArray+Utilities.h" @@ -38,8 +39,11 @@ currentObject = [objects nextObject]; while (currentObject) { - [formattedStrings - addObject: [NSString stringWithFormat: format, currentObject]]; + if ([currentObject isKindOfClass: [NSNull class]]) + [formattedStrings addObject: @""]; + else + [formattedStrings + addObject: [NSString stringWithFormat: format, currentObject]]; currentObject = [objects nextObject]; } diff --git a/SoObjects/SOGo/NSDictionary+Utilities.m b/SoObjects/SOGo/NSDictionary+Utilities.m index 666aef02..485b9dfb 100644 --- a/SoObjects/SOGo/NSDictionary+Utilities.m +++ b/SoObjects/SOGo/NSDictionary+Utilities.m @@ -22,6 +22,7 @@ #import #import +#import #import #import "NSArray+Utilities.h" @@ -89,8 +90,12 @@ for (count = 0; count < max; count++) { value = [self objectForKey: [allKeys objectAtIndex: count]]; - [keysWithFormat replaceString: [keys objectAtIndex: count] - withString: [value description]]; + if ([value isKindOfClass: [NSNull class]]) + [keysWithFormat replaceString: [keys objectAtIndex: count] + withString: @""]; + else + [keysWithFormat replaceString: [keys objectAtIndex: count] + withString: [value description]]; } return keysWithFormat; diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index 2354d868..5ea1146c 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -336,9 +336,6 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek"; - (NSString *) language { - NSArray *bLanguages; - WOContext *context; - if (!language) { language = [[self userDefaults] stringForKey: @"Language"]; diff --git a/UI/Scheduler/English.lproj/Localizable.strings b/UI/Scheduler/English.lproj/Localizable.strings index 69afbd28..0ce7d868 100644 --- a/UI/Scheduler/English.lproj/Localizable.strings +++ b/UI/Scheduler/English.lproj/Localizable.strings @@ -379,8 +379,8 @@ validate_endbeforestart = "Enddate is before startdate!"; "eventDeleteConfirmation" = "Erasing this event will be permanent.\\nWould you like to continue?"; "taskDeleteConfirmation" = "Erasing this task will be permanent.\\nWould you like to continue?"; -"Are you sure you want to delete the selected calendar?" -= "Are you sure you want to delete the selected calendar?"; +"Are you sure you want to delete the calendar \"%{0}\"?" += "Are you sure you want to delete the calendar \"%{0}\"?"; /* Legend */ "Required participant" = "Required participant"; diff --git a/UI/Scheduler/French.lproj/Localizable.strings b/UI/Scheduler/French.lproj/Localizable.strings index 3adda5cf..1c69351f 100644 --- a/UI/Scheduler/French.lproj/Localizable.strings +++ b/UI/Scheduler/French.lproj/Localizable.strings @@ -377,8 +377,8 @@ validate_endbeforestart = "La date de fin est avant la date de début !"; "eventDeleteConfirmation" = "L'effacement de cet événement sera permanent.\\nVoulez-vous continuer?"; "taskDeleteConfirmation" = "L'effacement de cette tâche sera permanent.\\nVoulez-vous continuer?"; -"Are you sure you want to delete the selected calendar?" -= "Voulez-vous vraiment supprimer l'agenda sélectionné ?"; +"Are you sure you want to delete the calendar \"%{0}\"?" += "Voulez-vous vraiment supprimer l'agenda «%{0}»?"; /* Legend */ "Required participant" = "Participant obligatoire"; diff --git a/UI/Scheduler/German.lproj/Localizable.strings b/UI/Scheduler/German.lproj/Localizable.strings index 2093ad21..e3ea85ee 100644 --- a/UI/Scheduler/German.lproj/Localizable.strings +++ b/UI/Scheduler/German.lproj/Localizable.strings @@ -366,8 +366,8 @@ validate_endbeforestart = "Ihr Beginn ist nach dem Ende"; "eventDeleteConfirmation" = "L'effacement de cet événement sera permanent.\\nVoulez-vous continuer?"; "taskDeleteConfirmation" = "L'effacement de cette tâche sera permanent.\\nVoulez-vous continuer?"; -"Are you sure you want to delete the selected calendar?" -= "Are you sure you want to delete the selected calendar?"; +"Are you sure you want to delete the calendar \"%{0}\"?" += "Are you sure you want to delete the calendar \"%{0}\"?"; /* Legend */ "Required participant" = "Participant obligatoire"; diff --git a/UI/Scheduler/UIxCalendarSelector.m b/UI/Scheduler/UIxCalendarSelector.m index 6bee8aad..7fad6b0f 100644 --- a/UI/Scheduler/UIxCalendarSelector.m +++ b/UI/Scheduler/UIxCalendarSelector.m @@ -148,6 +148,12 @@ colorForNumber (unsigned int number) return currentCalendar; } +- (NSString *) currentCalendarClass +{ + return [currentCalendar + keysWithFormat: @"colorBox calendarFolder%{folder}"]; +} + - (NSString *) currentCalendarStyle { return [currentCalendar diff --git a/UI/Scheduler/UIxComponentEditor.m b/UI/Scheduler/UIxComponentEditor.m index a972885d..e62c6412 100644 --- a/UI/Scheduler/UIxComponentEditor.m +++ b/UI/Scheduler/UIxComponentEditor.m @@ -369,7 +369,7 @@ calendar = [[self clientObject] container]; - return calendar; + return [calendar nameInContainer]; } /* priorities */ diff --git a/UI/Templates/SchedulerUI/UIxCalendarSelector.wox b/UI/Templates/SchedulerUI/UIxCalendarSelector.wox index 6340a725..eac42da1 100644 --- a/UI/Templates/SchedulerUI/UIxCalendarSelector.wox +++ b/UI/Templates/SchedulerUI/UIxCalendarSelector.wox @@ -10,6 +10,8 @@ .calendarFolder { background-color: !important; } +div.colorBox.calendarFolder +{ color: !important; }
@@ -34,8 +36,8 @@ -
OO
- OO
diff --git a/UI/WebServerResources/MailerUI.js b/UI/WebServerResources/MailerUI.js index c51a3ecc..a2c35ed5 100644 --- a/UI/WebServerResources/MailerUI.js +++ b/UI/WebServerResources/MailerUI.js @@ -16,6 +16,8 @@ var usersRightsWindowWidth = 400; var pageContent; +var deleteMessageRequestCount = 0; + /* mail list */ function openMessageWindow(msguid, url) { @@ -203,47 +205,45 @@ function ml_lowlight(sender) { /* bulk delete of messages */ -function uixDeleteSelectedMessages(sender) { - var failCount = 0; - +function deleteSelectedMessages(sender) { var messageList = $("messageList"); var rowIds = messageList.getSelectedRowsId(); for (var i = 0; i < rowIds.length; i++) { var url, http; var rowId = rowIds[i].substr(4); - /* send AJAX request (synchronously) */ - var messageId = currentMailbox + "/" + rowId; url = ApplicationBaseURL + messageId + "/trash"; - http = createHTTPClient(); - http.open("POST", url, false /* not async */); - http.url = url; - http.send(""); - if (!isHttpStatus204(http.status)) { /* request failed */ - failCount++; - http = null; - continue; - } else { - deleteCachedMessage(messageId); - if (currentMessages[currentMailbox] == rowId) { + deleteMessageRequestCount++; + var data = { "id": rowId, "mailbox": currentMailbox, "messageId": messageId }; + triggerAjaxRequest(url, deleteSelectedMessagesCallback, data); + } + + return false; +} + +function deleteSelectedMessagesCallback(http) { + if (http.readyState == 4) { + if (isHttpStatus204(http.status)) { + var data = http.callbackData; + deleteCachedMessage(data["messageId"]); + if (currentMailbox == data["mailbox"]) { + var div = $('messageContent'); - div.update(); - currentMessages[currentMailbox] = null; + if (currentMessages[currentMailbox] == data["id"]) { + div.update(); + currentMessages[currentMailbox] = null; + } + + var row = $("row_" + data["id"]); + row.parentNode.removeChild(row); + + deleteMessageRequestCount--; } } - http = null; - - /* remove from page */ - /* line-through would be nicer, but hiding is OK too */ - var row = $(rowIds[i]); - row.parentNode.removeChild(row); } - - if (failCount > 0) - alert("Could not delete " + failCount + " messages!"); - - return false; + else + log ("deleteSelectedMessagesCallback: problem during ajax request " + http.status); } function moveMessages(rowIds, folder) { @@ -285,7 +285,7 @@ function moveMessages(rowIds, folder) { } function onMenuDeleteMessage(event) { - uixDeleteSelectedMessages(); + deleteSelectedMessages(); preventDefault(event); } diff --git a/UI/WebServerResources/SchedulerUI.css b/UI/WebServerResources/SchedulerUI.css index 970062ce..609da77c 100644 --- a/UI/WebServerResources/SchedulerUI.css +++ b/UI/WebServerResources/SchedulerUI.css @@ -48,6 +48,7 @@ DIV.colorBox border: 1px solid #333; font-weight: normal; margin: 0px; + margin-right: 3px; font-size: 80%; width: 1em; height: .75em; } diff --git a/UI/WebServerResources/SchedulerUI.js b/UI/WebServerResources/SchedulerUI.js index 99930c3b..7fd00f8b 100644 --- a/UI/WebServerResources/SchedulerUI.js +++ b/UI/WebServerResources/SchedulerUI.js @@ -1041,7 +1041,7 @@ function onSearchFormSubmit() { function onCalendarSelectEvent() { var list = $("eventsList"); - list.tBodies[0].deselectAll(); + $(list.tBodies[0]).deselectAll(); if (selectedCalendarCell) for (var i = 0; i < selectedCalendarCell.length; i++) @@ -1377,7 +1377,7 @@ function onMenuModify(event) { if (UserLogin == selected.getAttribute("owner")) { var node = selected.childNodes[4]; var currentName = node.nodeValue.trim(); - var newName = window.prompt(labels["Address Book Name"], + var newName = window.prompt(labels["Name of the Calendar"], currentName); if (newName && newName.length > 0 && newName != currentName) { @@ -1436,30 +1436,24 @@ function appendCalendar(folderName, folderPath) { var li = document.createElement("li"); // Add the calendar to the proper place - for (var i = 0; i < lis.length; i++) { + var previousOwner = null; + for (var i = 1; i < lis.length; i++) { var currentFolderName = lis[i].lastChild.nodeValue.strip(); - if (lis[i].readAttribute('owner') != owner) - continue; - if (currentFolderName > folderName) - break; - } - if (i != lis.length) { // User is subscribed to other calendars of the same owner - calendarList.insertBefore(li, lis[i]); - } - else { - for (var i = 0; i < lis.length; i++) { - if (lis[i].readAttribute('owner') == UserLogin) - continue; - if (lis[i].readAttribute('owner') > owner) { - calendarList.insertBefore(li, lis[i]); + var currentOwner = lis[i].readAttribute('owner'); + if (currentOwner == owner) { + previousOwner = currentOwner; + if (currentFolderName > folderName) break; - } - } - if (i == lis.length) { - calendarList.appendChild(li); } + else if (previousOwner || + (currentOwner != UserLogin && currentOwner > owner)) + break; } - + if (i != lis.length) // User is subscribed to other calendars of the same owner + calendarList.insertBefore(li, lis[i]); + else + calendarList.appendChild(li); + li.setAttribute("id", folderPath); li.setAttribute("owner", owner); @@ -1471,13 +1465,11 @@ function appendCalendar(folderName, folderPath) { var colorBox = document.createElement("div"); li.appendChild(colorBox); - li.appendChild(document.createTextNode(" " + folderName)); + li.appendChild(document.createTextNode(folderName)); colorBox.appendChild(document.createTextNode("OO")); $(colorBox).addClassName("colorBox"); - if (color) - $(colorBox).setStyle({color: color, - backgroundColor: color}); + $(colorBox).addClassName('calendarFolder' + folderPath.substr(1)); // Register events (doesn't work with Safari) Event.observe(li, "mousedown", listRowMouseDownHandler); @@ -1498,12 +1490,20 @@ function appendCalendar(folderName, folderPath) { + ' background-color: ' + color + ' !important; }', 0); + lastSheet.insertRule('div.colorBox.calendarFolder' + folderPath.substr(1) + ' {' + + ' color: ' + + color + + ' !important; }', 0); } else { // IE lastSheet.addRule('.calendarFolder' + folderPath.substr(1), ' background-color: ' + color + ' !important; }'); + lastSheet.addRule('div.colorBox.calendarFolder' + folderPath.substr(1), + ' color: ' + + color + + ' !important; }'); } } } @@ -1534,19 +1534,18 @@ function onCalendarRemove(event) { if (folderIdElements.length > 1) { unsubscribeFromFolder(folderId, onFolderUnsubscribeCB, folderId); } - else { - var calId = folderIdElements[0].substr(1); - deletePersonalCalendar(calId); - } + else + deletePersonalCalendar(folderIdElements[0]); } } preventDefault(event); } -function deletePersonalCalendar(folderId) { +function deletePersonalCalendar(folderElement) { + var folderId = folderElement.substr(1); var label - = labels["Are you sure you want to delete the selected calendar?"]; + = labels["Are you sure you want to delete the calendar \"%{0}\"?"].formatted($(folderElement).lastChild.nodeValue.strip()); if (window.confirm(label)) { removeFolderRequestCount++; var url = ApplicationBaseURL + "/" + folderId + "/deleteFolder"; -- 2.39.5