From c8c7aaa45975ac18d4e6139df7300d3956c5b998 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Fri, 25 Sep 2015 15:21:06 -0400 Subject: [PATCH] (feat) GUI code to set or now sync flag on address book. Also thrashed entirely the sync tag concept. Funambol is dead, thank god for that. --- NEWS | 9 ++++ UI/Contacts/UIxContactFolderProperties.m | 35 ++++++++++++ UI/Contacts/product.plist | 5 ++ UI/Scheduler/UIxCalendarProperties.h | 4 -- UI/Scheduler/UIxCalendarProperties.m | 54 +------------------ .../ContactsUI/UIxContactFolderProperties.wox | 17 ++++++ .../SchedulerUI/UIxCalendarProperties.wox | 20 +------ .../UIxCalendarProperties.js | 32 ----------- .../UIxContactFolderProperties.js | 17 ++---- 9 files changed, 72 insertions(+), 121 deletions(-) diff --git a/NEWS b/NEWS index 2518a8347..25ac09c6f 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,12 @@ +2.3.3 (2015-mm-dd) +------------------ + +New features + +Enhancements + +Bug fixes + 2.3.2 (2015-09-16) ------------------ diff --git a/UI/Contacts/UIxContactFolderProperties.m b/UI/Contacts/UIxContactFolderProperties.m index 391d82f3d..1f5a92a01 100644 --- a/UI/Contacts/UIxContactFolderProperties.m +++ b/UI/Contacts/UIxContactFolderProperties.m @@ -48,6 +48,41 @@ return [addressBook displayName]; } +- (NSString *) setAddressBookName: (NSString *) newName +{ + [addressBook renameTo: newName]; +} + +- (BOOL) synchronizeAddressBook +{ + return [self mustSynchronize] || [addressBook synchronize]; +} + +- (void) setSynchronizeAddressBook: (BOOL) new +{ + [addressBook setSynchronize: new]; +} + +- (BOOL) mustSynchronize +{ + return [[addressBook nameInContainer] isEqualToString: @"personal"]; +} + +- (BOOL) shouldTakeValuesFromRequest: (WORequest *) request + inContext: (WOContext*) context +{ + NSString *method; + + method = [[request uri] lastPathComponent]; + + return [method isEqualToString: @"saveProperties"]; +} + +- (id ) savePropertiesAction +{ + return [self jsCloseWithRefreshMethod: nil]; +} + - (NSString *) _baseCardDAVURL { NSString *davURL; diff --git a/UI/Contacts/product.plist b/UI/Contacts/product.plist index 7ed3b6314..28103ebd0 100644 --- a/UI/Contacts/product.plist +++ b/UI/Contacts/product.plist @@ -122,6 +122,11 @@ protectedBy = "View"; pageName = "UIxContactFolderProperties"; }; + saveProperties = { + protectedBy = "Access Contents Information"; + pageName = "UIxContactFolderProperties"; + actionName = "saveProperties"; + }; }; }; diff --git a/UI/Scheduler/UIxCalendarProperties.h b/UI/Scheduler/UIxCalendarProperties.h index de17b6117..f46e2cfa3 100644 --- a/UI/Scheduler/UIxCalendarProperties.h +++ b/UI/Scheduler/UIxCalendarProperties.h @@ -43,11 +43,7 @@ - (BOOL) synchronizeCalendar; - (void) setSynchronizeCalendar: (BOOL) new; -- (NSString *) originalCalendarSyncTag; -- (NSString *) allCalendarSyncTags; - (BOOL) mustSynchronize; -- (NSString *) calendarSyncTag; -- (void) setCalendarSyncTag: (NSString *) newTag; /* notifications */ - (BOOL) notifyOnPersonalModifications; diff --git a/UI/Scheduler/UIxCalendarProperties.m b/UI/Scheduler/UIxCalendarProperties.m index 8f0ec4e81..46c2c8048 100644 --- a/UI/Scheduler/UIxCalendarProperties.m +++ b/UI/Scheduler/UIxCalendarProperties.m @@ -91,52 +91,12 @@ - (BOOL) synchronizeCalendar { - return [self mustSynchronize] || [calendar synchronizeCalendar]; + return [self mustSynchronize] || [calendar synchronize]; } - (void) setSynchronizeCalendar: (BOOL) new { - [calendar setSynchronizeCalendar: new]; -} - -- (NSString *) originalCalendarSyncTag -{ - return [calendar syncTag]; -} - -- (NSString *) allCalendarSyncTags -{ - SOGoUserSettings *settings; - NSMutableDictionary *calendarSettings; - NSMutableDictionary *syncTags; - NSEnumerator *keysList; - NSMutableArray *tags; - NSString *key, *result; - - settings = [[context activeUser] userSettings]; - calendarSettings = [settings objectForKey: @"Calendar"]; - tags = nil; - - if (calendarSettings) - { - syncTags = [calendarSettings objectForKey: @"FolderSyncTags"]; - if (syncTags) - { - tags = [NSMutableArray arrayWithCapacity: [syncTags count]]; - keysList = [syncTags keyEnumerator]; - while ((key = (NSString*)[keysList nextObject])) { - if (![key isEqualToString: [calendar folderReference]]) - [tags addObject: [syncTags objectForKey: key]]; - } - } - } - - if (!tags) - result = @""; - else - result = [tags componentsJoinedByString: @","]; - - return result; + [calendar setSynchronize: new]; } - (BOOL) mustSynchronize @@ -144,16 +104,6 @@ return [[calendar nameInContainer] isEqualToString: @"personal"]; } -- (NSString *) calendarSyncTag -{ - return [calendar syncTag]; -} - -- (void) setCalendarSyncTag: (NSString *) newTag -{ - [calendar setSyncTag: newTag]; -} - - (BOOL) showCalendarAlarms { return [calendar showCalendarAlarms]; diff --git a/UI/Templates/ContactsUI/UIxContactFolderProperties.wox b/UI/Templates/ContactsUI/UIxContactFolderProperties.wox index bcecf8ba8..cea9954ef 100644 --- a/UI/Templates/ContactsUI/UIxContactFolderProperties.wox +++ b/UI/Templates/ContactsUI/UIxContactFolderProperties.wox @@ -11,6 +11,8 @@ const:popup="YES" title="title"> +
  • @@ -29,6 +31,20 @@
+ +
+ + +
+ +
@@ -60,4 +76,5 @@ +
diff --git a/UI/Templates/SchedulerUI/UIxCalendarProperties.wox b/UI/Templates/SchedulerUI/UIxCalendarProperties.wox index 20772c200..0e57deb7e 100644 --- a/UI/Templates/SchedulerUI/UIxCalendarProperties.wox +++ b/UI/Templates/SchedulerUI/UIxCalendarProperties.wox @@ -133,25 +133,7 @@ var:disabled="mustSynchronize" /> - -
+
diff --git a/UI/WebServerResources/UIxCalendarProperties.js b/UI/WebServerResources/UIxCalendarProperties.js index a44eb9c7a..df9c3f8f4 100644 --- a/UI/WebServerResources/UIxCalendarProperties.js +++ b/UI/WebServerResources/UIxCalendarProperties.js @@ -43,43 +43,11 @@ function onOKClick(event) { var calendarColor = $("calendarColor"); var calendarID = $("calendarID"); var save = true; - var tag = $("calendarSyncTag"); - var originalTag = $("originalCalendarSyncTag"); - var allTags = $("allCalendarSyncTags"); if (calendarName.value.blank()) { alert(_("Please specify a calendar name.")); save = false; } - - if (save - && allTags) - allTags = allTags.value.split(","); - - if (save - && tag - && $("synchronizeCalendar").checked) { - if (tag.value.blank()) { - alert(_("tagNotDefined")); - save = false; - } - else if (allTags - && allTags.indexOf(tag.value) > -1) { - alert(_("tagAlreadyExists")); - save = false; - } - else if (originalTag - && !originalTag.value.blank()) { - if (tag.value != originalTag.value) - save = confirm(_("tagHasChanged")); - } - else - save = confirm(_("tagWasAdded")); - } - else if (save - && originalTag - && !originalTag.value.blank()) - save = confirm(_("tagWasRemoved")); if (save) { window.opener.updateCalendarProperties(calendarID.value, diff --git a/UI/WebServerResources/UIxContactFolderProperties.js b/UI/WebServerResources/UIxContactFolderProperties.js index b8c364366..4fdd3128a 100644 --- a/UI/WebServerResources/UIxContactFolderProperties.js +++ b/UI/WebServerResources/UIxContactFolderProperties.js @@ -20,20 +20,9 @@ function onOKClick(event) { var selected = folders.getSelectedNodes()[0]; if (!AddressBookName.value.blank()) { - var newName = AddressBookName.value; - var currentName = AddressBookName.defaultValue; - if (newName && newName.length > 0 && newName != currentName) { - if (selected.getAttribute("owner") != "nobody") { - var url = (URLForFolderID(selected.getAttribute("id")) + "/renameFolder?name=" + escape(newName.utf8encode())); - triggerAjaxRequest(url, folderRenameCallback, {node: selected, name: newName}); - - } - else { - alert_("You do not own this address book"); - } - } - else - window.close(); + var displayNameNode = selected.childNodesWithTag("span")[0]; + displayNameNode.innerHTML = AddressBookName.value.escapeHTML(); + $("propertiesform").submit(); } else alert(_("Please specify an address book name."));