From 5a4386114d6a9cbe346d89da74b414ed5f650411 Mon Sep 17 00:00:00 2001 From: C Robert Date: Tue, 25 Aug 2009 13:12:14 +0000 Subject: [PATCH] Monotone-Parent: 305e5198a69984fa19ae3d615ff25e6f48bed1bd Monotone-Revision: 0985637e09049cecd9007ee944d3e752881b83ca Monotone-Author: crobert@inverse.ca Monotone-Date: 2009-08-25T13:12:14 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 5 ++ SoObjects/Contacts/SOGoContactGCSList.m | 19 ++++++++ .../Localizable.strings | 1 + UI/Contacts/Czech.lproj/Localizable.strings | 1 + UI/Contacts/Dutch.lproj/Localizable.strings | 1 + UI/Contacts/English.lproj/Localizable.strings | 1 + UI/Contacts/French.lproj/Localizable.strings | 1 + UI/Contacts/German.lproj/Localizable.strings | 1 + .../Hungarian.lproj/Localizable.strings | 1 + UI/Contacts/Italian.lproj/Localizable.strings | 1 + UI/Contacts/Russian.lproj/Localizable.strings | 1 + UI/Contacts/Spanish.lproj/Localizable.strings | 1 + UI/Contacts/Welsh.lproj/Localizable.strings | 1 + UI/Contacts/product.plist | 5 -- UI/WebServerResources/ContactsUI.js | 48 +++++++++---------- 15 files changed, 59 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0174cf8f8..e165269a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-08-25 Cyril Robert + + * SoObjects/Contacts/SOGoContactGCSList.m (copyToFolder): Implementation to + support copying lists. + 2009-08-24 Cyril Robert * UI/MailerUI/UIxMailMainFrame.m: Refactoring + added vLists support. diff --git a/SoObjects/Contacts/SOGoContactGCSList.m b/SoObjects/Contacts/SOGoContactGCSList.m index 576121b8a..89d3aee4d 100644 --- a/SoObjects/Contacts/SOGoContactGCSList.m +++ b/SoObjects/Contacts/SOGoContactGCSList.m @@ -61,6 +61,25 @@ return list; } +- (NSException *) copyToFolder: (SOGoGCSFolder *) newFolder +{ + NGVList *newList; + NSString *newUID; + SOGoContactGCSList *newGList; + + // Change the contact UID + newUID = [self globallyUniqueObjectId]; + newList = [self vList]; + + [newList setUid: newUID]; + + newGList = [[self class] objectWithName: + [NSString stringWithFormat: @"%@.vlf", newUID] + inContainer: newFolder]; + + return [newGList saveContentString: [newList versitString]]; +} + /* DAV */ - (NSString *) davContentType diff --git a/UI/Contacts/BrazilianPortuguese.lproj/Localizable.strings b/UI/Contacts/BrazilianPortuguese.lproj/Localizable.strings index 2b8097500..9ce46f887 100644 --- a/UI/Contacts/BrazilianPortuguese.lproj/Localizable.strings +++ b/UI/Contacts/BrazilianPortuguese.lproj/Localizable.strings @@ -177,3 +177,4 @@ "Members" = "Members"; "Contacts" = "Contacts"; "Add" = "Add"; +"Lists can't be moved or copied." = "Lists can't be moved or copied."; diff --git a/UI/Contacts/Czech.lproj/Localizable.strings b/UI/Contacts/Czech.lproj/Localizable.strings index c4d276c2f..fda9adcb8 100644 --- a/UI/Contacts/Czech.lproj/Localizable.strings +++ b/UI/Contacts/Czech.lproj/Localizable.strings @@ -177,3 +177,4 @@ "Members" = "Members"; "Contacts" = "Contacts"; "Add" = "Add"; +"Lists can't be moved or copied." = "Lists can't be moved or copied."; diff --git a/UI/Contacts/Dutch.lproj/Localizable.strings b/UI/Contacts/Dutch.lproj/Localizable.strings index f7524a16c..ba776a83c 100644 --- a/UI/Contacts/Dutch.lproj/Localizable.strings +++ b/UI/Contacts/Dutch.lproj/Localizable.strings @@ -177,3 +177,4 @@ "Members" = "Members"; "Contacts" = "Contacts"; "Add" = "Add"; +"Lists can't be moved or copied." = "Lists can't be moved or copied."; diff --git a/UI/Contacts/English.lproj/Localizable.strings b/UI/Contacts/English.lproj/Localizable.strings index 5220f9b5e..c36ba3caa 100644 --- a/UI/Contacts/English.lproj/Localizable.strings +++ b/UI/Contacts/English.lproj/Localizable.strings @@ -177,3 +177,4 @@ "Members" = "Members"; "Contacts" = "Contacts"; "Add" = "Add"; +"Lists can't be moved or copied." = "Lists can't be moved or copied."; diff --git a/UI/Contacts/French.lproj/Localizable.strings b/UI/Contacts/French.lproj/Localizable.strings index 916522242..454b118e2 100644 --- a/UI/Contacts/French.lproj/Localizable.strings +++ b/UI/Contacts/French.lproj/Localizable.strings @@ -177,3 +177,4 @@ "Members" = "Membres"; "Contacts" = "Contacts"; "Add" = "Ajouter"; +"Lists can't be moved or copied." = "Les listes ne peuvent pas être déplacées ou copiées."; diff --git a/UI/Contacts/German.lproj/Localizable.strings b/UI/Contacts/German.lproj/Localizable.strings index 7b4b4431f..9f2fb4c10 100644 --- a/UI/Contacts/German.lproj/Localizable.strings +++ b/UI/Contacts/German.lproj/Localizable.strings @@ -177,3 +177,4 @@ "Members" = "Members"; "Contacts" = "Contacts"; "Add" = "Add"; +"Lists can't be moved or copied." = "Lists can't be moved or copied."; diff --git a/UI/Contacts/Hungarian.lproj/Localizable.strings b/UI/Contacts/Hungarian.lproj/Localizable.strings index 4386ea88e..dc2bec8f1 100644 --- a/UI/Contacts/Hungarian.lproj/Localizable.strings +++ b/UI/Contacts/Hungarian.lproj/Localizable.strings @@ -177,3 +177,4 @@ "Members" = "Members"; "Contacts" = "Contacts"; "Add" = "Add"; +"Lists can't be moved or copied." = "Lists can't be moved or copied."; diff --git a/UI/Contacts/Italian.lproj/Localizable.strings b/UI/Contacts/Italian.lproj/Localizable.strings index 40213f802..4f05d37ae 100644 --- a/UI/Contacts/Italian.lproj/Localizable.strings +++ b/UI/Contacts/Italian.lproj/Localizable.strings @@ -177,3 +177,4 @@ "Members" = "Members"; "Contacts" = "Contacts"; "Add" = "Add"; +"Lists can't be moved or copied." = "Lists can't be moved or copied."; diff --git a/UI/Contacts/Russian.lproj/Localizable.strings b/UI/Contacts/Russian.lproj/Localizable.strings index d68b6350e..de17f0da2 100644 --- a/UI/Contacts/Russian.lproj/Localizable.strings +++ b/UI/Contacts/Russian.lproj/Localizable.strings @@ -162,3 +162,4 @@ "Members" = "Members"; "Contacts" = "Contacts"; "Add" = "Add"; +"Lists can't be moved or copied." = "Lists can't be moved or copied."; diff --git a/UI/Contacts/Spanish.lproj/Localizable.strings b/UI/Contacts/Spanish.lproj/Localizable.strings index b97a7b61b..3c42c092e 100644 --- a/UI/Contacts/Spanish.lproj/Localizable.strings +++ b/UI/Contacts/Spanish.lproj/Localizable.strings @@ -177,3 +177,4 @@ "Members" = "Members"; "Contacts" = "Contacts"; "Add" = "Add"; +"Lists can't be moved or copied." = "Lists can't be moved or copied."; diff --git a/UI/Contacts/Welsh.lproj/Localizable.strings b/UI/Contacts/Welsh.lproj/Localizable.strings index 0f4cdd56b..49b92aeb4 100644 --- a/UI/Contacts/Welsh.lproj/Localizable.strings +++ b/UI/Contacts/Welsh.lproj/Localizable.strings @@ -161,3 +161,4 @@ "Members" = "Members"; "Contacts" = "Contacts"; "Add" = "Add"; +"Lists can't be moved or copied." = "Lists can't be moved or copied."; diff --git a/UI/Contacts/product.plist b/UI/Contacts/product.plist index 9c8b0c75d..496f7252e 100644 --- a/UI/Contacts/product.plist +++ b/UI/Contacts/product.plist @@ -183,11 +183,6 @@ protectedBy = "Access Contents Information"; pageName = "UIxListView"; }; - delete = { - protectedBy = "Delete Objects"; - pageName = "UIxListView"; - actionName = "delete"; - }; edit = { protectedBy = "Access Contents Information"; pageName = "UIxListEditor"; diff --git a/UI/WebServerResources/ContactsUI.js b/UI/WebServerResources/ContactsUI.js index c9dcd2288..2e38d7c9b 100644 --- a/UI/WebServerResources/ContactsUI.js +++ b/UI/WebServerResources/ContactsUI.js @@ -221,6 +221,14 @@ function _onContactMenuAction(folderItem, action, refresh) { return row.getAttribute("id"); }); + for (var i = 0; i < contactIds.length; i++) { + if (contactIds[i].endsWith ("vlf")) { + alert (labels["Lists can't be moved or copied."]); + return false; + } + } + + var url = ApplicationBaseURL + selectedFolderId + "/" + action + "?folder=" + folderId + "&uid=" + contactIds.join("&uid="); @@ -1123,16 +1131,6 @@ function currentFolderIsRemote () { return rc; } -function containsVLF (ids) { - var rc = false; - - for (var i=0; i < ids.length; i++) - if (ids[i].match ("\.vlf$") == ".vlf") - rc = true; - - return rc; -} - function startDragging (itm, e) { var target = Event.element(e); if (target.up().up().tagName != "TBODY") @@ -1142,12 +1140,10 @@ function startDragging (itm, e) { var contacts = $('contactsList').getSelectedRowsId(); var count = contacts.length; - if (!containsVLF (contacts)) { - handle.show(); - handle.update (count); - if (e.shiftKey || currentFolderIsRemote ()) - handle.addClassName ("copy"); - } + handle.show(); + handle.update (count); + if (e.shiftKey || currentFolderIsRemote ()) + handle.addClassName ("copy"); } function whileDragging (itm, e) { @@ -1178,16 +1174,20 @@ function dropSelectedContacts (action, toId) { var selectedFolders = $("contactFolders").getSelectedNodes(); if (selectedFolders.length > 0) { var contactIds = $('contactsList').getSelectedRowsId(); - if (!containsVLF (contactIds)) { - var fromId = $(selectedFolders[0]).id; - if (!currentFolderIsRemote () || action != "move") { - var url = ApplicationBaseURL + fromId + "/" + action - + "?folder=" + toId + "&uid=" - + contactIds.join("&uid="); - - triggerAjaxRequest(url, actionContactCallback, fromId); + for (var i = 0; i < contactIds.length; i++) { + if (contactIds[i].endsWith ("vlf")) { + alert (labels["Lists can't be moved or copied."]); + return false; } } + var fromId = $(selectedFolders[0]).id; + if (!currentFolderIsRemote () || action != "move") { + var url = ApplicationBaseURL + fromId + "/" + action + + "?folder=" + toId + "&uid=" + + contactIds.join("&uid="); + + triggerAjaxRequest(url, actionContactCallback, fromId); + } } }