+2008-05-05 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * 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 <wsourdeau@inverse.ca>
* Main/SOGo.m ([SOGo -davURL], [SOGo -soURL]): copied methods from
- (BOOL) create
{
BOOL rc;
- NSMutableArray *folderSubscription;
NSUserDefaults *userSettings;
NSMutableDictionary *calendarSettings;
SOGoUser *ownerUser;
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];
}
- (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 */
{
NSString *command;
- command = [[document firstChild] nodeName];
+ command = [[document firstChild] localName];
return [NSString stringWithFormat: @"%@:", command];
}
- (NSArray *) _davGetRolesFromRequest: (id <DOMNode>) node
{
NSMutableArray *roles;
- id <DOMNodeList> 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];
}
id <DOMNode> node, userAttr;
id <DOMNamedNodeMap> 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)
{
[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];
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;
if (http.readyState == 4
&& http.status == 200) {
var div = $("eventsListView");
-
document.eventsListAjaxRequest = null;
var table = $("eventsList");
lastClickedRow = -1; // from generic.js
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]));
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);
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();
}
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;
}
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 + '<br />';
- }
- 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 + '<br />';
}
+
+ 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 */
}
function onTextContextMenu(event) {
- log("coucou");
event.returnValue = true;
event.cancelBubble = true;
}
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);