Monotone-Parent: 75ec663b4b26859e635b90a350146642970dc3c2

Monotone-Revision: a5a4c03e7f73726c0698328f9ab3e90d3a4a2432

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-04-19T16:35:35
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2010-04-19 16:35:35 +00:00
parent a693ebedf4
commit 545e6693fa
17 changed files with 75 additions and 27 deletions

View File

@ -1,5 +1,17 @@
2010-04-19 Wolfgang Sourdeau <wsourdeau@inverse.ca> 2010-04-19 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/Contacts/UIxContactFolderActions.m (-exportAction): improved
method by providing the encoded filename of the address book
following rfc2047. Make the "uids" parameter optional: when
omitted, the address book is exported completely.
* UI/WebServerResources/ContactsUI.js (getMenus): added entry for
exporting the address books, slightly reorganized the entries.
(onAddressBooksMenuPrepareVisibility): grey out the "export" entry
for LDAP address books.
(onAddressBookExport): new callback for exporting addressbooks
from the contextual menu.
* UI/WebServerResources/generic.js (URLForFolderID): avoid double * UI/WebServerResources/generic.js (URLForFolderID): avoid double
slashes in the URL returned for personal folders. slashes in the URL returned for personal folders.

View File

@ -179,6 +179,7 @@
"Add" = "Add"; "Add" = "Add";
"Lists can't be moved or copied." = "Lists can't be moved or copied."; "Lists can't be moved or copied." = "Lists can't be moved or copied.";
"Export" = "Export"; "Export" = "Export";
"Export Address Book..." = "Export Address Book...";
"Import Cards" = "Import Cards"; "Import Cards" = "Import Cards";
"Select a vCard or LDIF file." = "Select a vCard or LDIF file."; "Select a vCard or LDIF file." = "Select a vCard or LDIF file.";
"Upload" = "Upload"; "Upload" = "Upload";

View File

@ -179,6 +179,7 @@
"Add" = "Přidat"; "Add" = "Přidat";
"Lists can't be moved or copied." = "Skupinu nelze přesunout nebo kopírovat."; "Lists can't be moved or copied." = "Skupinu nelze přesunout nebo kopírovat.";
"Export" = "Exportovat"; "Export" = "Exportovat";
"Export Address Book..." = "Export Address Book...";
"Import Cards" = "Importovat kontakty"; "Import Cards" = "Importovat kontakty";
"Select a vCard or LDIF file." = "Zvolte LDIF nebo vCard soubor."; "Select a vCard or LDIF file." = "Zvolte LDIF nebo vCard soubor.";
"Upload" = "Upload"; "Upload" = "Upload";

View File

@ -179,6 +179,7 @@
"Add" = "Add"; "Add" = "Add";
"Lists can't be moved or copied." = "Lists can't be moved or copied."; "Lists can't be moved or copied." = "Lists can't be moved or copied.";
"Export" = "Export"; "Export" = "Export";
"Export Address Book..." = "Export Address Book...";
"Import Cards" = "Import Cards"; "Import Cards" = "Import Cards";
"Select a vCard or LDIF file." = "Select LDIF or vCard file."; "Select a vCard or LDIF file." = "Select LDIF or vCard file.";
"Upload" = "Upload"; "Upload" = "Upload";

View File

@ -179,6 +179,7 @@
"Add" = "Add"; "Add" = "Add";
"Lists can't be moved or copied." = "Lists can't be moved or copied."; "Lists can't be moved or copied." = "Lists can't be moved or copied.";
"Export" = "Export"; "Export" = "Export";
"Export Address Book..." = "Export Address Book...";
"Import Cards" = "Import Cards"; "Import Cards" = "Import Cards";
"Select a vCard or LDIF file." = "Select a vCard or LDIF file."; "Select a vCard or LDIF file." = "Select a vCard or LDIF file.";
"Upload" = "Upload"; "Upload" = "Upload";

View File

@ -179,6 +179,7 @@
"Add" = "Ajouter"; "Add" = "Ajouter";
"Lists can't be moved or copied." = "Les listes ne peuvent pas être déplacées ou copiées."; "Lists can't be moved or copied." = "Les listes ne peuvent pas être déplacées ou copiées.";
"Export" = "Exporter"; "Export" = "Exporter";
"Export Address Book..." = "Exporter le carnet d'adresses...";
"Import Cards" = "Importer des contacts"; "Import Cards" = "Importer des contacts";
"Select a vCard or LDIF file." = "Sélectionner un fichier. LDIF ou vCard."; "Select a vCard or LDIF file." = "Sélectionner un fichier. LDIF ou vCard.";
"Upload" = "Ajouter"; "Upload" = "Ajouter";

View File

@ -179,6 +179,7 @@
"Add" = "Add"; "Add" = "Add";
"Lists can't be moved or copied." = "Lists can't be moved or copied."; "Lists can't be moved or copied." = "Lists can't be moved or copied.";
"Export" = "Export"; "Export" = "Export";
"Export Address Book..." = "Export Address Book...";
"Import Cards" = "Import Cards"; "Import Cards" = "Import Cards";
"Select a vCard or LDIF file." = "Select a vCard or LDIF file."; "Select a vCard or LDIF file." = "Select a vCard or LDIF file.";
"Upload" = "Upload"; "Upload" = "Upload";

View File

@ -179,6 +179,7 @@
"Add" = "Add"; "Add" = "Add";
"Lists can't be moved or copied." = "Lists can't be moved or copied."; "Lists can't be moved or copied." = "Lists can't be moved or copied.";
"Export" = "Export"; "Export" = "Export";
"Export Address Book..." = "Export Address Book...";
"Import Cards" = "Import Cards"; "Import Cards" = "Import Cards";
"Select a vCard or LDIF file." = "Select LDIF or vCard file."; "Select a vCard or LDIF file." = "Select LDIF or vCard file.";
"Upload" = "Upload"; "Upload" = "Upload";

View File

@ -179,6 +179,7 @@
"Add" = "Add"; "Add" = "Add";
"Lists can't be moved or copied." = "Lists can't be moved or copied."; "Lists can't be moved or copied." = "Lists can't be moved or copied.";
"Export" = "Export"; "Export" = "Export";
"Export Address Book..." = "Export Address Book...";
"Import Cards" = "Import Cards"; "Import Cards" = "Import Cards";
"Select a vCard or LDIF file." = "Select a vCard or LDIF file."; "Select a vCard or LDIF file." = "Select a vCard or LDIF file.";
"Upload" = "Upload"; "Upload" = "Upload";

View File

@ -165,6 +165,7 @@
"Lists can't be moved or copied." = "Lists can't be moved or copied."; "Lists can't be moved or copied." = "Lists can't be moved or copied.";
"Export" = "Export"; "Export" = "Export";
"Export Address Book..." = "Export Address Book...";
"Import Cards" = "Import Cards"; "Import Cards" = "Import Cards";
"Select a vCard or LDIF file." = "Select a vCard or LDIF file."; "Select a vCard or LDIF file." = "Select a vCard or LDIF file.";
"Upload" = "Upload"; "Upload" = "Upload";

View File

@ -179,6 +179,7 @@
"Add" = "Add"; "Add" = "Add";
"Lists can't be moved or copied." = "Lists can't be moved or copied."; "Lists can't be moved or copied." = "Lists can't be moved or copied.";
"Export" = "Export"; "Export" = "Export";
"Export Address Book..." = "Export Address Book...";
"Import Cards" = "Import Cards"; "Import Cards" = "Import Cards";
"Select a vCard or LDIF file." = "Select a vCard or LDIF file."; "Select a vCard or LDIF file." = "Select a vCard or LDIF file.";
"Upload" = "Upload"; "Upload" = "Upload";

View File

@ -179,6 +179,7 @@
"Add" = "Lägg till"; "Add" = "Lägg till";
"Lists can't be moved or copied." = "Utskickslistor kan inte flyttas eller kopieras."; "Lists can't be moved or copied." = "Utskickslistor kan inte flyttas eller kopieras.";
"Export" = "Exportera"; "Export" = "Exportera";
"Export Address Book..." = "Export Address Book...";
"Import Cards" = "Importera adresskort"; "Import Cards" = "Importera adresskort";
"Select a vCard or LDIF file." = "Välj ett vCard eller LDIF fil."; "Select a vCard or LDIF file." = "Välj ett vCard eller LDIF fil.";
"Upload" = "Ladda upp"; "Upload" = "Ladda upp";

View File

@ -56,39 +56,40 @@
WOResponse *response; WOResponse *response;
NSArray *contactsId; NSArray *contactsId;
NSEnumerator *uids; NSEnumerator *uids;
NSString *uid, *filename; NSString *uid, *filename, *disposition;
id currentChild; id currentChild;
SOGoContactGCSFolder *sourceFolder; SOGoContactGCSFolder *sourceFolder;
NSMutableString *content; NSMutableString *content;
content = [NSMutableString string]; content = [NSMutableString string];
request = [context request]; request = [context request];
sourceFolder = [self clientObject];
contactsId = [request formValuesForKey: @"uid"]; contactsId = [request formValuesForKey: @"uid"];
if (contactsId) if (!contactsId)
contactsId = [sourceFolder toOneRelationshipKeys];
uids = [contactsId objectEnumerator];
while ((uid = [uids nextObject]))
{ {
sourceFolder = [self clientObject]; currentChild = [sourceFolder lookupName: uid
uids = [contactsId objectEnumerator]; inContext: [self context]
while ((uid = [uids nextObject])) acquire: NO];
{ if ([currentChild respondsToSelector: @selector (vCard)])
currentChild = [sourceFolder lookupName: uid [content appendFormat: [[currentChild vCard] ldifString]];
inContext: [self context] else if ([currentChild respondsToSelector: @selector (vList)])
acquire: NO]; [content appendFormat: [[currentChild vList] ldifString]];
if ([currentChild respondsToSelector: @selector (vCard)])
[content appendFormat: [[currentChild vCard] ldifString]];
else if ([currentChild respondsToSelector: @selector (vList)])
[content appendFormat: [[currentChild vList] ldifString]];
}
} }
filename = [NSString stringWithFormat: @"attachment;filename=\"%@.ldif\"",
[sourceFolder displayName]];
response = [context response]; response = [context response];
[response setHeader: @"application/octet-stream; charset=utf-8" [response setHeader: @"application/octet-stream; charset=utf-8"
forKey: @"content-type"]; forKey: @"content-type"];
[response setHeader: filename filename = [NSString stringWithFormat: @"%@.ldif",
forKey: @"Content-Disposition"]; [sourceFolder displayName]];
disposition = [NSString stringWithFormat: @"attachment; filename=\"%@\"",
[filename asQPSubjectString: @"utf-8"]];
[response setHeader: disposition forKey: @"Content-Disposition"];
[response setContent: [content dataUsingEncoding: NSUTF8StringEncoding]]; [response setContent: [content dataUsingEncoding: NSUTF8StringEncoding]];
return response; return response;
} }

View File

@ -164,6 +164,7 @@
"Lists can't be moved or copied." = "Lists can't be moved or copied."; "Lists can't be moved or copied." = "Lists can't be moved or copied.";
"Export" = "Export"; "Export" = "Export";
"Export Address Book..." = "Export Address Book...";
"Import Cards" = "Import Cards"; "Import Cards" = "Import Cards";
"Select a vCard or LDIF file." = "Select a vCard or LDIF file."; "Select a vCard or LDIF file." = "Select a vCard or LDIF file.";
"Upload" = "Upload"; "Upload" = "Upload";

View File

@ -103,6 +103,11 @@
actionClass = "UIxContactFolderActions"; actionClass = "UIxContactFolderActions";
actionName = "export"; actionName = "export";
}; };
exportFolder = {
protectedBy = "View";
actionClass = "UIxContactFolderActions";
actionName = "export";
};
import = { import = {
protectedBy = "View"; protectedBy = "View";
actionClass = "UIxContactFolderActions"; actionClass = "UIxContactFolderActions";

View File

@ -60,9 +60,11 @@
<li><var:string label:value="New Card" /></li> <li><var:string label:value="New Card" /></li>
<li><var:string label:value="New List" /></li> <li><var:string label:value="New List" /></li>
<li><!-- separator --></li> <li><!-- separator --></li>
<li><var:string label:value="Import Cards" /></li>
<li><var:string label:value="Delete" /></li> <li><var:string label:value="Delete" /></li>
<li><!-- separator --></li> <li><!-- separator --></li>
<li><var:string label:value="Export Address Book..."/></li>
<li><var:string label:value="Import Cards" /></li>
<li><!-- separator --></li>
<li><var:string label:value="Sharing..." /></li> <li><var:string label:value="Sharing..." /></li>
</ul> </ul>
</div> </div>

View File

@ -689,6 +689,15 @@ function onFolderUnsubscribeCB(folderId) {
onFolderSelectionChange(); onFolderSelectionChange();
} }
function onAddressBookExport(event) {
var node = $("contactFolders").getSelectedNodes().first();
var folderID = node.getAttribute("id");
var url = URLForFolderID(folderID) + "/exportFolder";
window.location.href = url;
event.stop();
}
function onAddressBookImport(event) { function onAddressBookImport(event) {
var node = $("contactFolders").getSelectedNodes().first(); var node = $("contactFolders").getSelectedNodes().first();
var folderId = node.getAttribute("id"); var folderId = node.getAttribute("id");
@ -1000,9 +1009,10 @@ function onAddressBooksMenuPrepareVisibility() {
var menu = $("contactFoldersMenu").down("ul");; var menu = $("contactFoldersMenu").down("ul");;
var listElements = menu.childNodesWithTag("li"); var listElements = menu.childNodesWithTag("li");
var modifyOption = $(listElements[0]); var modifyOption = listElements[0];
var removeOption = $(listElements[5]); var removeOption = listElements[5];
var sharingOption = $(listElements[listElements.length - 1]); var exportOption = listElements[7];
var sharingOption = listElements[listElements.length - 1];
// Disable the "Sharing" and "Modify" options when address book // Disable the "Sharing" and "Modify" options when address book
// is not owned by user // is not owned by user
@ -1015,11 +1025,16 @@ function onAddressBooksMenuPrepareVisibility() {
sharingOption.addClassName("disabled"); sharingOption.addClassName("disabled");
} }
// Disable the "remove" option when address book is public /* Disable the "remove" and "export ab" options when address book is
if (folderOwner == "nobody") public */
if (folderOwner == "nobody") {
exportOption.addClassName("disabled");
removeOption.addClassName("disabled"); removeOption.addClassName("disabled");
else }
else {
exportOption.removeClassName("disabled");
removeOption.removeClassName("disabled"); removeOption.removeClassName("disabled");
}
return true; return true;
} }
@ -1072,8 +1087,9 @@ function onContactMenuPrepareVisibility() {
function getMenus() { function getMenus() {
var menus = {}; var menus = {};
menus["contactFoldersMenu"] = new Array(onAddressBookModify, "-", newContact, menus["contactFoldersMenu"] = new Array(onAddressBookModify, "-", newContact,
newList, "-", onAddressBookImport, newList, "-",
onAddressBookRemove, "-", onAddressBookRemove, "-",
onAddressBookExport, onAddressBookImport, "-",
onMenuSharing); onMenuSharing);
menus["contactMenu"] = new Array(onMenuEditContact, "-", menus["contactMenu"] = new Array(onMenuEditContact, "-",
onMenuWriteToContact, onMenuAIMContact, onMenuWriteToContact, onMenuAIMContact,