"," ",""].join(""),locals:{addressbookId:vm.selectedFolder.id},controller:ComponentDialogController}),ComponentDialogController.$inject=["scope","$mdDialog","$state","addressbookId"]}function notSelectedComponent(currentCard,type){return currentCard&¤tCard.c_component==type&&!currentCard.selected}function unselectCards(){_.each(vm.selectedFolder.cards,function(card){card.selected=!1})}function confirmDeleteSelectedCards(){Dialog.confirm(l("Warning"),l("Are you sure you want to delete the selected contacts?")).then(function(){var selectedCards=_.filter(vm.selectedFolder.cards,function(card){return card.selected});vm.selectedFolder.$deleteCards(selectedCards),delete vm.selectedFolder.selectedCard},function(data,status){})}function saveSelectedCards(){var selectedCards=_.filter(vm.selectedFolder.cards,function(card){return card.selected}),selectedUIDs=_.pluck(selectedCards,"id");window.location.href=ApplicationBaseURL+"/"+vm.selectedFolder.id+"/export?uid="+selectedUIDs.join("&uid=")}function copySelectedCards(folder){var selectedCards=_.filter(vm.selectedFolder.cards,function(card){return card.selected});vm.selectedFolder.$copyCards(selectedCards,folder).then(function(){},function(error){Dialog.alert(l("Error"),error)})}function selectAll(){_.each(vm.selectedFolder.cards,function(card){card.selected=!0})}function sort(field){vm.selectedFolder.$filter("",{sort:field})}function sortedBy(field){return AddressBook.$query.sort==field}function cancelSearch(){vm.mode.search=!1,vm.selectedFolder.$filter("")}var vm=this;AddressBook.selectedFolder=stateAddressbook,vm.selectedFolder=stateAddressbook,vm.selectCard=selectCard,vm.newComponent=newComponent,vm.notSelectedComponent=notSelectedComponent,vm.unselectCards=unselectCards,vm.confirmDeleteSelectedCards=confirmDeleteSelectedCards,vm.saveSelectedCards=saveSelectedCards,vm.copySelectedCards=copySelectedCards,vm.selectAll=selectAll,vm.sort=sort,vm.sortedBy=sortedBy,vm.cancelSearch=cancelSearch,vm.mode={search:!1}}AddressBookController.$inject=["$scope","$state","$timeout","$mdDialog","sgFocus","Card","AddressBook","Dialog","sgSettings","stateAddressbooks","stateAddressbook"],angular.module("SOGo.ContactsUI").controller("AddressBookController",AddressBookController)}(),function(){"use strict";function AddressBooksController($state,$scope,$rootScope,$stateParams,$timeout,$mdDialog,$mdToast,FileUploader,focus,Card,AddressBook,Dialog,Settings,User,stateAddressbooks){function select(folder){vm.editMode=!1,AddressBook.$query.value="",$state.go("app.addressbook",{addressbookId:folder.id})}function newAddressbook(){Dialog.prompt(l("New addressbook"),l("Name of new addressbook")).then(function(name){var addressbook=new AddressBook({name:name,isEditable:!0,isRemote:!1,owner:UserLogin});AddressBook.$add(addressbook)})}function edit(folder){folder.isRemote||(vm.editMode=folder.id,vm.originalAddressbook=angular.extend({},folder.$omit()),focus("addressBookName_"+folder.id))}function revertEditing(folder){folder.name=vm.originalAddressbook.name,vm.editMode=!1}function save(folder){var name=folder.name;name&&name.length>0&&name!=vm.originalAddressbook.name&&folder.$rename(name).then(function(data){vm.editMode=!1},function(data,status){Dialog.alert(l("Warning"),data)})}function confirmDelete(){vm.service.selectedFolder.isSubscription?vm.service.selectedFolder.$delete().then(function(){vm.service.selectedFolder=null,$state.go("app.addressbook",{addressbookId:"personal"})},function(data,status){Dialog.alert(l('An error occured while deleting the addressbook "%{0}".',vm.service.selectedFolder.name),l(data.error))}):Dialog.confirm(l("Warning"),l("Are you sure you want to delete the addressbook %{0}?",vm.service.selectedFolder.name)).then(function(){return vm.service.selectedFolder.$delete()}).then(function(){return vm.service.selectedFolder=null,!0})["catch"](function(data,status){Dialog.alert(l('An error occured while deleting the addressbook "%{0}".',vm.service.selectedFolder.name),l(data.error))})}function importCards($event,folder){function CardsImportDialogController(scope,$mdDialog,folder){scope.uploader=new FileUploader({url:ApplicationBaseURL+"/"+folder.id+"/import",onProgressItem:function(item,progress){console.debug(item),console.debug(progress)},onSuccessItem:function(item,response,status,headers){console.debug(item),console.debug("success = "+JSON.stringify(response,void 0,2)),$mdDialog.hide(),$mdToast.show($mdToast.simple().content(l("A total of %{0} cards were imported in the addressbook.",response.imported)).position("top right").hideDelay(3e3)),AddressBook.selectedFolder.$reload()},onCancelItem:function(item,response,status,headers){console.debug(item),console.debug("cancel = "+JSON.stringify(response,void 0,2))},onErrorItem:function(item,response,status,headers){console.debug(item),console.debug("error = "+JSON.stringify(response,void 0,2))}}),scope.close=function(){$mdDialog.hide()},scope.upload=function(){scope.uploader.uploadAll()}}$mdDialog.show({parent:angular.element(document.body),targetEvent:$event,clickOutsideToClose:!0,escapeToClose:!0,template:['',' ','
',' import_export','
','
'+l("Import Cards")+"
","
",' ',' close'," ","
"," "," ",'
','
'," "+l("Select a vCard or LDIF file.")+"",' ",' ',"