From 2f8a10e53b60dffad473da7d8f85f5efbb8cba63 Mon Sep 17 00:00:00 2001 From: wolfgang Date: Mon, 5 May 2008 23:48:40 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1407 d1b88da0-ebda-0310-925b-ed51d893ca5b --- ChangeLog | 16 +++ .../Appointments/SOGoAppointmentFolder.m | 18 +--- SoObjects/SOGo/SOGoObject.m | 100 +++++++++--------- UI/Common/UIxFolderActions.m | 8 +- UI/WebServerResources/HTMLElement.js | 10 +- UI/WebServerResources/SchedulerUI.js | 26 +++-- UI/WebServerResources/UIxMailEditor.js | 35 +++--- 7 files changed, 109 insertions(+), 104 deletions(-) diff --git a/ChangeLog b/ChangeLog index e955a197..c9ae036a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2008-05-05 Wolfgang Sourdeau + + * SoObjects/SOGo/SOGoObject.m ([SOGoObject + -davAclQuery:queryContext]): parse the names only of element nodes. + + * UI/Common/UIxFolderActions.m ([UIxFolderActions -activateFolderAction]) + ([UIxFolderActions -deactivateFolderAction]): reversed the logic + and remove or add the folder name from/into the 'InactiveFolders' + settings key. + + * SoObjects/Appointments/SOGoAppointmentFolder.m + ([SOGoAppointmentFolder -create]): no longer write the folder name + in the 'ActiveFolders' settings key. + ([-isActive]): returns whether the folder is NOT listed in the + 'InactiveFolders' settings key. + 2008-05-02 Wolfgang Sourdeau * Main/SOGo.m ([SOGo -davURL], [SOGo -soURL]): copied methods from diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index 889e3390..71c26f1c 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -1573,7 +1573,6 @@ static NSNumber *sharedYes = nil; - (BOOL) create { BOOL rc; - NSMutableArray *folderSubscription; NSUserDefaults *userSettings; NSMutableDictionary *calendarSettings; SOGoUser *ownerUser; @@ -1590,15 +1589,6 @@ static NSNumber *sharedYes = nil; calendarSettings = [NSMutableDictionary dictionary]; [userSettings setObject: calendarSettings forKey: @"Calendar"]; } - folderSubscription - = [calendarSettings objectForKey: @"ActiveFolders"]; - if (!folderSubscription) - { - folderSubscription = [NSMutableArray array]; - [calendarSettings setObject: folderSubscription - forKey: @"ActiveFolders"]; - } - [folderSubscription addObjectUniquely: nameInContainer]; [userSettings synchronize]; } @@ -1953,13 +1943,13 @@ static NSNumber *sharedYes = nil; - (BOOL) isActive { NSUserDefaults *settings; - NSArray *activeFolders; + NSArray *inactiveFolders; settings = [[context activeUser] userSettings]; - activeFolders - = [[settings objectForKey: @"Calendar"] objectForKey: @"ActiveFolders"]; + inactiveFolders + = [[settings objectForKey: @"Calendar"] objectForKey: @"InactiveFolders"]; - return [activeFolders containsObject: nameInContainer]; + return ![inactiveFolders containsObject: nameInContainer]; } @end /* SOGoAppointmentFolder */ diff --git a/SoObjects/SOGo/SOGoObject.m b/SoObjects/SOGo/SOGoObject.m index 9f99e009..b3398a67 100644 --- a/SoObjects/SOGo/SOGoObject.m +++ b/SoObjects/SOGo/SOGoObject.m @@ -786,7 +786,7 @@ static NSDictionary *reportMap = nil; { NSString *command; - command = [[document firstChild] nodeName]; + command = [[document firstChild] localName]; return [NSString stringWithFormat: @"%@:", command]; } @@ -1329,16 +1329,16 @@ static NSDictionary *reportMap = nil; - (NSArray *) _davGetRolesFromRequest: (id ) node { NSMutableArray *roles; - id childNodes; + NSArray *childNodes; NSString *currentRole; unsigned int count, max; roles = [NSMutableArray array]; - childNodes = [node childNodes]; - max = [childNodes length]; + childNodes = [self domNode: node getChildNodesByType: DOM_ELEMENT_NODE]; + max = [childNodes count]; for (count = 0; count < max; count++) { - currentRole = [[childNodes objectAtIndex: count] nodeName]; + currentRole = [[childNodes objectAtIndex: count] localName]; [roles addObject: currentRole]; } @@ -1350,57 +1350,55 @@ static NSDictionary *reportMap = nil; id node, userAttr; id attrs; NSString *nodeName, *result, *response, *user; + NSArray *childNodes; - node = [[document documentElement] firstChild]; - nodeName = [node nodeName]; - if ([nodeName isEqualToString: @"user-list"]) - result = [self _davAclUserListQuery]; - else if ([nodeName isEqualToString: @"roles"]) - { - attrs = [node attributes]; - userAttr = [attrs namedItem: @"user"]; - user = [userAttr nodeValue]; - if ([user length]) - result = [self _davAclUserRoles: user]; - else - result = nil; - } - else if ([nodeName isEqualToString: @"set-roles"]) + result = nil; + + childNodes = [self domNode: [document documentElement] + getChildNodesByType: DOM_ELEMENT_NODE]; + if ([childNodes count]) { - attrs = [node attributes]; - userAttr = [attrs namedItem: @"user"]; - user = [userAttr nodeValue]; - if ([user length]) + node = [childNodes objectAtIndex: 0]; + nodeName = [node localName]; + if ([nodeName isEqualToString: @"user-list"]) + result = [self _davAclUserListQuery]; + else if ([nodeName isEqualToString: @"roles"]) { - [self setRoles: [self _davGetRolesFromRequest: node] - forUser: user]; - result = @""; + attrs = [node attributes]; + userAttr = [attrs namedItem: @"user"]; + user = [userAttr nodeValue]; + if ([user length]) + result = [self _davAclUserRoles: user]; + } + else if ([nodeName isEqualToString: @"set-roles"]) + { + attrs = [node attributes]; + userAttr = [attrs namedItem: @"user"]; + user = [userAttr nodeValue]; + if ([user length]) + { + [self setRoles: [self _davGetRolesFromRequest: node] + forUser: user]; + result = @""; + } + } + else if ([nodeName isEqualToString: @"add-user"]) + { + attrs = [node attributes]; + userAttr = [attrs namedItem: @"user"]; + user = [userAttr nodeValue]; + if ([self addUserInAcls: user]) + result = @""; + } + else if ([nodeName isEqualToString: @"remove-user"]) + { + attrs = [node attributes]; + userAttr = [attrs namedItem: @"user"]; + user = [userAttr nodeValue]; + if ([self removeUserFromAcls: user]) + result = @""; } - else - result = nil; - } - else if ([nodeName isEqualToString: @"add-user"]) - { - attrs = [node attributes]; - userAttr = [attrs namedItem: @"user"]; - user = [userAttr nodeValue]; - if ([self addUserInAcls: user]) - result = @""; - else - result = nil; - } - else if ([nodeName isEqualToString: @"remove-user"]) - { - attrs = [node attributes]; - userAttr = [attrs namedItem: @"user"]; - user = [userAttr nodeValue]; - if ([self removeUserFromAcls: user]) - result = @""; - else - result = nil; } - else - result = nil; if (result) { diff --git a/UI/Common/UIxFolderActions.m b/UI/Common/UIxFolderActions.m index a2d6f64d..9fde4a2f 100644 --- a/UI/Common/UIxFolderActions.m +++ b/UI/Common/UIxFolderActions.m @@ -180,18 +180,18 @@ [self _setupContext]; folderSubscription - = [moduleSettings objectForKey: @"ActiveFolders"]; + = [moduleSettings objectForKey: @"InactiveFolders"]; if (!folderSubscription) { folderSubscription = [NSMutableArray array]; - [moduleSettings setObject: folderSubscription forKey: @"ActiveFolders"]; + [moduleSettings setObject: folderSubscription forKey: @"InactiveFolders"]; } folderName = [clientObject nameInContainer]; if (makeActive) - [folderSubscription addObjectUniquely: folderName]; - else [folderSubscription removeObject: folderName]; + else + [folderSubscription addObjectUniquely: folderName]; [ud synchronize]; diff --git a/UI/WebServerResources/HTMLElement.js b/UI/WebServerResources/HTMLElement.js index e30fcba4..e225fc3c 100644 --- a/UI/WebServerResources/HTMLElement.js +++ b/UI/WebServerResources/HTMLElement.js @@ -10,14 +10,16 @@ Element.addMethods({ childNodesWithTag: function(element, tagName) { element = $(element); + var matchingNodes = new Array(); var tagName = tagName.toUpperCase(); for (var i = 0; i < element.childNodes.length; i++) { - if (typeof(element.childNodes[i]) == "object" - && element.childNodes[i].tagName - && element.childNodes[i].tagName.toUpperCase() == tagName) - matchingNodes.push(element.childNodes[i]); + var childNode = $(element.childNodes[i]); + if (Object.isElement(childNode) + && childNode.tagName + && childNode.tagName.toUpperCase() == tagName) + matchingNodes.push(childNode); } return matchingNodes; diff --git a/UI/WebServerResources/SchedulerUI.js b/UI/WebServerResources/SchedulerUI.js index 513f696b..be36e8c5 100644 --- a/UI/WebServerResources/SchedulerUI.js +++ b/UI/WebServerResources/SchedulerUI.js @@ -333,7 +333,6 @@ function eventsListCallback(http) { if (http.readyState == 4 && http.status == 200) { var div = $("eventsListView"); - document.eventsListAjaxRequest = null; var table = $("eventsList"); lastClickedRow = -1; // from generic.js @@ -357,22 +356,22 @@ function eventsListCallback(http) { row.observe("dblclick", editDoubleClickedEvent); row.observe("contextmenu", onEventContextMenu); - var td = document.createElement("td"); + var td = $(document.createElement("td")); row.appendChild(td); td.observe("mousedown", listRowMouseDownHandler, true); td.appendChild(document.createTextNode(data[i][3])); - td = document.createElement("td"); + td = $(document.createElement("td")); row.appendChild(td); td.observe("mousedown", listRowMouseDownHandler, true); td.appendChild(document.createTextNode(data[i][10])); - td = document.createElement("td"); + td = $(document.createElement("td")); row.appendChild(td); td.observe("mousedown", listRowMouseDownHandler, true); td.appendChild(document.createTextNode(data[i][11])); - td = document.createElement("td"); + td = $(document.createElement("td")); row.appendChild(td); td.observe("mousedown", listRowMouseDownHandler, true); td.appendChild(document.createTextNode(data[i][6])); @@ -413,18 +412,18 @@ function tasksListCallback(http) { var data = http.responseText.evalJSON(true); for (var i = 0; i < data.length; i++) { - var listItem = document.createElement("li"); + var listItem = $(document.createElement("li")); list.appendChild(listItem); listItem.observe("mousedown", listRowMouseDownHandler); listItem.observe("click", onRowClick); listItem.observe("dblclick", editDoubleClickedEvent); listItem.setAttribute("id", data[i][0]); - $(listItem).addClassName(data[i][5]); - $(listItem).addClassName(data[i][6]); + listItem.addClassName(data[i][5]); + listItem.addClassName(data[i][6]); listItem.calendar = data[i][1]; - $(listItem).addClassName("calendarFolder" + data[i][1]); + listItem.addClassName("calendarFolder" + data[i][1]); listItem.cname = escape(data[i][0]); - var input = document.createElement("input"); + var input = $(document.createElement("input")); input.setAttribute("type", "checkbox"); listItem.appendChild(input); input.observe("click", updateTaskStatus, true); @@ -1615,10 +1614,9 @@ function onCalendarModify(event) { var selected = folders.getSelectedNodes()[0]; var calendarID = selected.getAttribute("id"); var url = ApplicationBaseURL + calendarID + "/properties"; - var properties = window.open(url, calendarID + "properties", - "width=300,height=100,resizable=0,scrollbars=0" - + "toolbar=0,location=0,directories=0,status=0," - + "menubar=0,copyhistory=0"); + var windowID = (calendarID + "properties").replace("/", "_", "g"); + var properties = window.open(url, windowID, + "width=300,height=100,resizable=0"); properties.focus(); } diff --git a/UI/WebServerResources/UIxMailEditor.js b/UI/WebServerResources/UIxMailEditor.js index ee6a5676..45a2cdf2 100644 --- a/UI/WebServerResources/UIxMailEditor.js +++ b/UI/WebServerResources/UIxMailEditor.js @@ -97,10 +97,11 @@ function insertContact(inputNode, contactName, contactEmail) { function toggleAttachments() { var div = $("attachmentsArea"); - if (div.style.display) - div.style.display = ""; + var style = "" + div.getStyle("display"); + if (style.length) + div.setStyle({ display: "" }); else - div.style.display = "block;"; + div.setStyle({ display: "block" }); return false; } @@ -111,21 +112,22 @@ function updateInlineAttachmentList(sender, attachments) { var div = $("attachmentsArea"); if (attachments) count = attachments.length; - if (count) - { - var text = ""; - for (var i = 0; i < count; i++) { - text = text + attachments[i]; - text = text + '
'; - } - var e = $('compose_attachments_list'); - e.innerHTML = text; - if (!div.style.display) - div.style.display = "block;"; + if (count) { + var text = ""; + for (var i = 0; i < count; i++) { + text = text + attachments[i]; + text = text + '
'; } + + var e = $('compose_attachments_list'); + e.innerHTML = text; + var style = "" + div.getStyle("display"); + if (!style.length) + div.setStyle({display: "block"}); + } else - div.style.display = ""; + div.setStyle({display: ""}); } /* mail editor */ @@ -272,7 +274,6 @@ function onTextFirstFocus() { } function onTextContextMenu(event) { - log("coucou"); event.returnValue = true; event.cancelBubble = true; } @@ -287,7 +288,7 @@ function onTextMouseDown(event) { function initMailEditor() { var list = $("attachments"); $(list).attachMenu("attachmentsMenu"); - var elements = list.childNodesWithTag("li"); + var elements = $(list).childNodesWithTag("li"); for (var i = 0; i < elements.length; i++) elements[i].observe("click", onRowClick); -- 2.39.5