2007-10-23 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+ * 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.
+2007-10-24 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * GCSFolderManager.m ([GCSFolderManager -baseTableNameWithUID:]):
+ prefix the table names with "sogo" to avoid problems with
+ digits-only identifiers.
+
2007-10-19 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* GCSFolderManager.m ([GCSFolderManager -baseTableNameWithUID:]):
unsigned int count, max, done;
NSMutableString *newUID;
- newUID = [NSMutableString string];
+ newUID = [NSMutableString stringWithString: @"sogo"];
now = [NSDate date];
max = [_uid length];
* Boston, MA 02111-1307, USA.
*/
+#import <Foundation/NSNull.h>
#import <Foundation/NSString.h>
#import "NSArray+Utilities.h"
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];
}
#import <Foundation/NSArray.h>
#import <Foundation/NSData.h>
+#import <Foundation/NSNull.h>
#import <Foundation/NSString.h>
#import "NSArray+Utilities.h"
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;
- (NSString *) language
{
- NSArray *bLanguages;
- WOContext *context;
-
if (!language)
{
language = [[self userDefaults] stringForKey: @"Language"];
"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";
"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";
"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";
return currentCalendar;
}
+- (NSString *) currentCalendarClass
+{
+ return [currentCalendar
+ keysWithFormat: @"colorBox calendarFolder%{folder}"];
+}
+
- (NSString *) currentCalendarStyle
{
return [currentCalendar
calendar = [[self clientObject] container];
- return calendar;
+ return [calendar nameInContainer];
}
/* priorities */
<var:foreach list="calendars" item="currentCalendar">
.calendarFolder<var:string value="currentCalendar.folder" />
{ background-color: <var:string value="currentCalendar.color" /> !important; }
+div.colorBox.calendarFolder<var:string value="currentCalendar.folder" />
+{ color: <var:string value="currentCalendar.color" /> !important; }
</var:foreach>
</style>
<div id="calendarSelector">
<input type="checkbox" class="checkBox"
const:disabled="disabled"
var:checked="currentCalendar.active" />
- <div class="colorBox" var:style="currentCalendarStyle">OO</div>
- <var:string value="currentCalendar.displayName"
+ <div var:class="currentCalendarClass">OO</div
+ ><var:string value="currentCalendar.displayName"
/></li>
</var:foreach>
</ul>
var pageContent;
+var deleteMessageRequestCount = 0;
+
/* mail list */
function openMessageWindow(msguid, url) {
/* 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) {
}
function onMenuDeleteMessage(event) {
- uixDeleteSelectedMessages();
+ deleteSelectedMessages();
preventDefault(event);
}
border: 1px solid #333;
font-weight: normal;
margin: 0px;
+ margin-right: 3px;
font-size: 80%;
width: 1em;
height: .75em; }
function onCalendarSelectEvent() {
var list = $("eventsList");
- list.tBodies[0].deselectAll();
+ $(list.tBodies[0]).deselectAll();
if (selectedCalendarCell)
for (var i = 0; i < selectedCalendarCell.length; i++)
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) {
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);
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);
+ ' 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; }');
}
}
}
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";