From f1780be64034d0e84028f6b8d45c578fa80e834f Mon Sep 17 00:00:00 2001 From: Basil Suter Date: Mon, 18 Jun 2018 18:20:15 +0200 Subject: [PATCH] fix file manager folder state #137 --- src/resources/dist/js/main.uglified.js | 63 ++++++++++------------ src/resources/dist/js/main.uglified.js.map | 2 +- src/resources/js/directives.js | 63 ++++++++++------------ src/views/layouts/_angulardirectives.php | 6 +-- 4 files changed, 62 insertions(+), 72 deletions(-) diff --git a/src/resources/dist/js/main.uglified.js b/src/resources/dist/js/main.uglified.js index b7c0dc3cfc..517f1db6a1 100644 --- a/src/resources/dist/js/main.uglified.js +++ b/src/resources/dist/js/main.uglified.js @@ -3879,10 +3879,9 @@ zaa.factory('HtmlStorage', function() { $scope.imageNotFoundError = false; $scope.filterApply = function() { - ServiceFilesData.getFile($scope.fileId).then(function(response) { var images = $filter('filter')(response.images, {filterId: $scope.filterId}, true); - + $scope.imageLoading = true; // unable to find the image for the given filter, create the image for the filter if (images.length == 0) { $http.post('admin/api-admin-storage/image-filter', { fileId : $scope.fileId, filterId : $scope.filterId}).then(function(uploadResponse) { @@ -3943,6 +3942,8 @@ zaa.factory('HtmlStorage', function() { //var filtering = $filter('findidfilter')($scope.imagesData, n, true); ServiceImagesData.getImage(n).then(function(response) { $scope.imageinfo = response; + $scope.fileId = response.file_id; + $scope.filterId = response.filter_id; }); /* if (filtering) { @@ -4027,21 +4028,26 @@ zaa.factory('HtmlStorage', function() { $scope.paginations = []; + $scope.currentPageId = 0; + // load files data for a given folder id $scope.$watch('currentFolderId', function(folderId) { - $scope.getFilesForPageAndFolder(folderId, 0); + console.log(folderId); + if (folderId !== undefined) { + $scope.getFilesForPageAndFolder(folderId, 0); + } }); $scope.getFilesForPageAndFolder = function(folderId, pageId) { $http.get('admin/api-admin-storage/data-files?folderId='+folderId+'&page='+pageId).then(function(response) { - $scope.filesData = response.data.data; + console.log('request filemanager list', folderId, pageId, response); + $scope.filesData = response.data.data; $scope.filesMetaToPagination(response.data.__meta); }); }; $scope.filesMetaToPagination = function(meta) { var pages = []; - console.log(meta); for (i = 0; i < meta.totalPages; i++) { var isActive = meta.currentPage == i; pages.push({isActive: isActive, label: i+1, index: i}); @@ -4050,9 +4056,14 @@ zaa.factory('HtmlStorage', function() { }; $scope.getFilesForPage = function(pageId) { + $scope.currentPageId = pageId; $scope.getFilesForPageAndFolder($scope.currentFolderId, pageId); }; + $scope.getFilesForCurrentPage = function() { + $scope.getFilesForPageAndFolder($scope.currentFolderId, $scope.currentPageId); + } + // ServiceFolderId $scope.currentFolderId = ServiceFoldersDirecotryId.folderId; @@ -4122,10 +4133,9 @@ zaa.factory('HtmlStorage', function() { $scope.$watch('uploadResults', function(n, o) { if ($scope.uploadingfiles != null) { if (n == $scope.uploadingfiles.length && $scope.errorMsg == null) { - //$scope.filesDataReload().then(function() { - AdminToastService.success(i18n['js_dir_manager_upload_image_ok']); - LuyaLoading.stop(); - //}); + AdminToastService.success(i18n['js_dir_manager_upload_image_ok']); + LuyaLoading.stop(); + $scope.getFilesForCurrentPage(); } } }) @@ -4232,9 +4242,7 @@ zaa.factory('HtmlStorage', function() { if (!newFolderName) { return; } - $http.post('admin/api-admin-storage/folder-create', $.param({ folderName : newFolderName , parentFolderId : $scope.currentFolderId }), { - headers : {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'} - }).then(function() { + $http.post('admin/api-admin-storage/folder-create', { folderName : newFolderName , parentFolderId : $scope.currentFolderId }).then(function() { $scope.foldersDataReload().then(function() { $scope.folderFormToggler(); $scope.newFolderName = null; @@ -4258,6 +4266,7 @@ zaa.factory('HtmlStorage', function() { $scope.changeCurrentFolderId = function(folderId, noState) { $scope.currentFolderId = folderId; + $scope.currentPageId = 0; if (noState !== true) { ServiceFoldersDirecotryId.folderId = folderId; $http.post('admin/api-admin-common/save-filemanager-folder-state', {folderId : folderId}, {ignoreLoadingBar: true}); @@ -4280,22 +4289,16 @@ zaa.factory('HtmlStorage', function() { $scope.folderDeleteConfirmForm = false; $scope.updateFolder = function(folder) { - $http.post('admin/api-admin-storage/folder-update?folderId=' + folder.id, $.param({ name : folder.name }), { - headers : {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'} - }); + $http.post('admin/api-admin-storage/folder-update?folderId=' + folder.id, {name : folder.name }); }; $scope.deleteFolder = function(folder) { // check if folder is empty - $http.post('admin/api-admin-storage/is-folder-empty?folderId=' + folder.id, $.param({ name : folder.name }), { - headers : {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'} - }).then(function(transport) { + $http.post('admin/api-admin-storage/is-folder-empty?folderId=' + folder.id, { name : folder.name }).then(function(transport) { if (transport.data == true) { - $http.post('admin/api-admin-storage/folder-delete?folderId=' + folder.id, $.param({ name : folder.name }), { - headers : {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'} - }).then(function(transport) { + $http.post('admin/api-admin-storage/folder-delete?folderId=' + folder.id, { name : folder.name }).then(function(transport) { $scope.foldersDataReload().then(function() { //$scope.filesDataReload().then(function() { $scope.currentFolderId = 0; @@ -4305,9 +4308,7 @@ zaa.factory('HtmlStorage', function() { } else { AdminToastService.confirm(i18nParam('layout_filemanager_remove_dir_not_empty', {folderName: folder.name, count: folder.filesCount}), i18n['js_dir_manager_rm_folder_confirm_title'], ['$timeout', '$toast', function($timeout, $toast) { - $http.post('admin/api-admin-storage/folder-delete?folderId=' + folder.id, $.param({ name : folder.name }), { - headers : {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'} - }).then(function() { + $http.post('admin/api-admin-storage/folder-delete?folderId=' + folder.id, { name : folder.name }).then(function() { $scope.foldersDataReload().then(function() { //$scope.filesDataReload().then(function() { $scope.currentFolderId = 0; @@ -4364,9 +4365,7 @@ zaa.factory('HtmlStorage', function() { }; $scope.moveFilesTo = function(folderId) { - $http.post('admin/api-admin-storage/filemanager-move-files', $.param({'fileIds' : $scope.selectedFiles, 'toFolderId' : folderId}), { - headers : {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'} - }).then(function(transport) { + $http.post('admin/api-admin-storage/filemanager-move-files', {'fileIds' : $scope.selectedFiles, 'toFolderId' : folderId}).then(function(transport) { //$scope.filesDataReload().then(function() { $scope.selectedFiles = []; $scope.showFoldersToMove = false; @@ -4376,9 +4375,7 @@ zaa.factory('HtmlStorage', function() { $scope.removeFiles = function() { AdminToastService.confirm(i18n['js_dir_manager_rm_file_confirm'], i18n['js_dir_manager_rm_file_confirm_title'], ['$timeout', '$toast', function($timeout, $toast) { - $http.post('admin/api-admin-storage/filemanager-remove-files', $.param({'ids' : $scope.selectedFiles}), { - headers : {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'} - }).then(function(transport) { + $http.post('admin/api-admin-storage/filemanager-remove-files', {'ids' : $scope.selectedFiles}).then(function(transport) { //$scope.filesDataReload().then(function() { $toast.close(); AdminToastService.success(i18n['js_dir_manager_rm_file_ok']); @@ -4392,9 +4389,7 @@ zaa.factory('HtmlStorage', function() { // file detail view logic $scope.storeFileCaption = function(fileDetail) { - $http.post('admin/api-admin-storage/filemanager-update-caption', $.param({'id': fileDetail.id, 'captionsText' : fileDetail.captionArray}), { - headers : {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'} - }).then(function(transport) { + $http.post('admin/api-admin-storage/filemanager-update-caption', {'id': fileDetail.id, 'captionsText' : fileDetail.captionArray}).then(function(transport) { AdminToastService.success('Captions has been updated'); }); } @@ -4404,7 +4399,7 @@ zaa.factory('HtmlStorage', function() { $scope.init = function() { if ($scope.$parent.fileinfo) { $scope.selectedFileFromParent = $scope.$parent.fileinfo; - $scope.changeCurrentFolderId($scope.selectedFileFromParent.folderId, true); + $scope.changeCurrentFolderId($scope.selectedFileFromParent.folder_id, true); } } diff --git a/src/resources/dist/js/main.uglified.js.map b/src/resources/dist/js/main.uglified.js.map index 7dfc9affa3..fceca2c839 100644 --- a/src/resources/dist/js/main.uglified.js.map +++ b/src/resources/dist/js/main.uglified.js.map @@ -1 +1 @@ -{"version":3,"sources":["dnd.js","zaa.js","services.js","filters.js","directives.js","controllers.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACxQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACnVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACrHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC5kGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"main.uglified.js","sourcesContent":["angular.module('dnd', [])\n\n.factory('dndFactory', function() {\n\treturn {\n\t\t/**\n\t\t * variables to write\n\t\t */\n\t\tdata : {\n\t\t\tcontent: null, \n\t\t\tpos:null, \n\t\t\telement : null\n\t\t},\n\t\t/**\n\t\t * Element Getter\n\t\t */\n\t\tgetElement : function() {\n\t\t\treturn this.data.element;\n\t\t},\n\t\t/**\n\t\t * Elementer Setter\n\t\t */\n\t\tsetElement : function(e) {\n\t\t\tthis.data.element = e;\n\t\t},\n\t\t/**\n\t\t * Content Setter\n\t\t */\n\t\tsetContent : function(value) {\n\t\t\tthis.data.content = value;\n\t\t},\n\t\t/**\n\t\t * Content Getter\n\t\t */\n\t\tgetContent : function() {\n\t\t\treturn this.data.content;\n\t\t},\n\t\t/**\n\t\t * Pos Setter\n\t\t */\n\t\tsetPos: function(pos) {\n\t\t\tthis.data.pos = pos;\n\t\t},\n\t\t/**\n\t\t * Pos Getter\n\t\t */\n\t\tgetPos : function() {\n\t\t\treturn this.data.pos;\n\t\t}\n\t}\n})\n\n/**\n * Usage:\n * \n * ```js\n * dnd dnd-model=\"data\" dnd-isvalid=\"isValid(hover,dragged)\" dnd-drag-disabled dnd-diable-drag-middle dnd-drop-disabled dnd-ondrop=\"dropItem(dragged,dropped,position,element)\" dnd-css=\"{onDrag: 'drag-start', onHover: 'red', onHoverTop: 'red-top', onHoverMiddle: 'red-middle', onHoverBottom: 'red-bottom'}\"\n * ```\n * \n * + dnd-model: This is the model which will be used as \"dropped\", when drag is disabled this model is not needed\n * + dnd-disable-drag-middle\n * + dnd-drag-disabled\n * + dnd-is-valid\n * \n * Parts of the scripts are inspired by: https://github.com/marceljuenemann/angular-drag-and-drop-lists\n */\n.directive('dnd',['dndFactory', 'AdminClassService', function(dndFactory, AdminClassService) {\n\treturn {\n\t\trestrict : 'A',\n\t\ttransclude: false,\n\t\treplace: false,\n\t\ttemplate: false,\n\t\ttemplateURL: false,\n\t\tscope: {\n\t\t\tdndModel : '=',\n\t\t\tdndCss : '=',\n\t\t\tdndOndrop : '&',\n\t\t\tdndIsvalid : '&',\n\t\t},\n\t\tlink: function(scope, element, attrs) {\n\t\t\t// In standard-compliant browsers we use a custom mime type and also encode the dnd-type in it.\n\t\t\t// However, IE and Edge only support a limited number of mime types. The workarounds are described\n\t\t\t// in https://github.com/marceljuenemann/angular-drag-and-drop-lists/wiki/Data-Transfer-Design\n\t\t\tvar MIME_TYPE = 'application/x-dnd';\n\t\t\t// EDGE MIME TYPE\n\t\t\tvar EDGE_MIME_TYPE = 'application/json';\n\t\t\t// IE MIME TYPE\n\t\t\tvar MSIE_MIME_TYPE = 'Text';\n\t\t\t// if current droping is valid, defaults to true\n\t\t\tvar isValid = true;\n\t\t\t// whether middle dropping is disabled or not\n\t\t\tvar disableMiddleDrop = attrs.hasOwnProperty('dndDisableDragMiddle');\n\t \n\t\t\t/* DRAGABLE */\n\t \n\t\t\t/**\n\t\t\t * Enable dragging if not disabled.\n\t\t\t */\n\t if (!attrs.hasOwnProperty('dndDragDisabled')) {\n\t \telement.attr(\"draggable\", \"true\");\n\t }\n\t \n\t /**\n\t * Add a class to the current element\n\t */\n\t scope.addClass = function(className) {\n\t \telement.addClass(className);\n\t };\n\t \n\t /**\n\t * Remove a class from the current element, including timeout delay.\n\t */\n\t scope.removeClass = function(className, delay) {\n\t \telement.removeClass(className);\n\t };\n\t\n\t /**\n\t * DRAG START\n\t */\n\t element.on('dragstart', function(e) {\n\t \te = e.originalEvent || e;\n\t \t\n\t \te.stopPropagation();\n\t \t\n\t \t// Check whether the element is draggable, since dragstart might be triggered on a child.\n\t if (element.attr('draggable') == 'false') {\n\t \treturn true;\n\t }\n\t \n \tisValid = true;\n \tdndFactory.setContent(scope.dndModel);\n \tdndFactory.setElement(element[0]);\n \tscope.addClass(scope.dndCss.onDrag);\n \n var mimeType = 'text';\n var data = \"1\";\n \n try {\n e.dataTransfer.setData(mimeType, data);\n } catch (e) {\n \ttry {\n \t\te.dataTransfer.setData(EDGE_MIME_TYPE, data);\n\t } catch (e) {\n \t\t\te.dataTransfer.setData(MSIE_MIME_TYPE, data);\n\t }\n }\n });\n\t\n\t /**\n\t * DRAG END\n\t */\n\t element.on('dragend', function(e) {\n\t \te = e.originalEvent || e;\n\t \tscope.removeClass(scope.dndCss.onDrag);\n e.stopPropagation();\n });\n\t \n\t /* DROPABLE */\n\t \n\t /**\n\t * DRAG OVER ELEMENT\n\t */\n \telement.on('dragover', function(e) {\n \t\te = e.originalEvent || e;\n \t\t\n \t\ttry {\n \t\t\te.dataTransfer.dropEffect = 'move';\n \t\t} catch(e) {\n \t\t\t// catch ie exceptions\n \t\t}\n \n \t\te.preventDefault();\n\t \te.stopPropagation();\n \t\t\n\t\t if (!scope.dndIsvalid({hover: scope.dndModel, dragged: dndFactory.getContent()})) {\n\t \t\tisValid = false;\n\t \t\treturn false;\n\t \t}\n\t\t \n var re = element[0].getBoundingClientRect();\n\t\t var height = re.height;\n\t\t var mouseHeight = e.clientY - re.top;\n\t\t var percentage = (100 / height) * mouseHeight;\n\t\t if (disableMiddleDrop) {\n\t\t \tif (percentage <= 50) {\n \t\t \tscope.addClass(scope.dndCss.onHoverTop);\n \t\t \tscope.removeClass(scope.dndCss.onHoverMiddle);\n \t\t \tscope.removeClass(scope.dndCss.onHoverBottom);\n \t\t \tdndFactory.setPos('top');\n \t\t } else {\n \t\t \tscope.removeClass(scope.dndCss.onHoverTop);\n \t\t \tscope.removeClass(scope.dndCss.onHoverMiddle);\n \t\t \tscope.addClass(scope.dndCss.onHoverBottom);\n \t\t \tdndFactory.setPos('bottom');\n \t\t }\n\t\t } else {\n\t\t \tif (percentage <= 25) {\n \t\t \tscope.addClass(scope.dndCss.onHoverTop);\n \t\t \tscope.removeClass(scope.dndCss.onHoverMiddle);\n \t\t \tscope.removeClass(scope.dndCss.onHoverBottom);\n \t\t \tdndFactory.setPos('top');\n \t\t } else if (percentage >= 65) {\n \t\t \tscope.removeClass(scope.dndCss.onHoverTop);\n \t\t \tscope.removeClass(scope.dndCss.onHoverMiddle);\n \t\t \tscope.addClass(scope.dndCss.onHoverBottom);\n \t\t \tdndFactory.setPos('bottom');\n \t\t } else {\n \t\t \tscope.removeClass(scope.dndCss.onHoverTop);\n \t\t \tscope.addClass(scope.dndCss.onHoverMiddle);\n \t\t \tscope.removeClass(scope.dndCss.onHoverBottom);\n \t\t \tdndFactory.setPos('middle');\n \t\t }\n\t\t }\n\t\t \n\t\t scope.addClass(scope.dndCss.onHover);\n\t\t \n\t\t return false;\n\t\t });\n \t\n \t/**\n \t * DRAG ENTER element\n \t */\n \telement.on('dragenter', function(e) {\n \t\te = e.originalEvent || e;\n \t\tscope.addClass(scope.dndCss.onHover);\n \t\te.preventDefault();\n\t\t });\n\n \t/**\n \t * DRAG LEAVE\n \t */\n \t\telement.on('dragleave', function(e) {\n \t\t\tscope.removeClass(scope.dndCss.onHover, true);\n \t\t\tscope.removeClass(scope.dndCss.onHoverTop, true);\n \t\t\tscope.removeClass(scope.dndCss.onHoverMiddle, true);\n \t\t\tscope.removeClass(scope.dndCss.onHoverBottom, true);\n\t\t });\n\n \t\t/**\n \t\t * DROP (if enabled)\n \t\t */\n \t\tif (!attrs.hasOwnProperty('dndDropDisabled')) {\n\t element.on('drop', function(e) {\n\t \te = e.originalEvent || e;\n\t \t// The default behavior in Firefox is to interpret the dropped element as URL and\n\t // forward to it. We want to prevent that even if our drop is aborted.\n\t e.preventDefault();\n\t e.stopPropagation();\n\t \n\t scope.removeClass(scope.dndCss.onHover, true);\n\t \t\t\tscope.removeClass(scope.dndCss.onHoverTop, true);\n\t \t\t\tscope.removeClass(scope.dndCss.onHoverMiddle, true);\n\t \t\t\tscope.removeClass(scope.dndCss.onHoverBottom, true);\n\t \t\t\t\n \t\t if (isValid) {\n\t \tscope.$apply(function() {\n\t \t\tscope.dndOndrop({dragged: dndFactory.getContent(), dropped: scope.dndModel, position: dndFactory.getPos(), element: dndFactory.getElement()});\n\t \t});\n\t \treturn true;\n \t\t }\n \t\t return false;\n });\n \t\t}\n\t\t}\n\t};\n}]);","/**\n * guid creator\n * @returns {String}\n */\nfunction guid() {\n function s4() {\n return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);\n }\n\n return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();\n}\n/**\n * i18n localisation with params.\n *\n * ```js\n * i18nParam('js_i18n_translation_name', {variable: value});\n * ```\n *\n * Translations File:\n *\n * ```php\n * 'js_i18n_translation_name' => 'Hello %variable%',\n * ```\n * @param varName\n * @param params\n * @returns\n */\nfunction i18nParam(varName, params) {\n var varValue = i18n[varName];\n\n angular.forEach(params, function (value, key) {\n varValue = varValue.replace(\"%\" + key + \"%\", value);\n });\n\n return varValue;\n}\n/**\n * Type cast numeric values to integer\n *\n * @param value\n * @returns\n */\nfunction typeCastValue(value) {\n return angular.isNumber(value) ? parseInt(value) : value;\n}\n\n/* DEFINE LUYA ADMIN ANGULAR VAR */\n\nvar zaa = angular.module(\"zaa\", [\"ui.router\", \"dnd\", \"angular-loading-bar\", \"ngFileUpload\", \"ngWig\", \"flow\", \"angular.filter\", \"720kb.datepicker\", \"directive.ngColorwheel\"]);\n \n/* CONFIG */\n\nzaa.config(['$httpProvider', '$stateProvider', '$controllerProvider', '$urlMatcherFactoryProvider', function($httpProvider, $stateProvider, $controllerProvider, $urlMatcherFactoryProvider) {\n \t\n $httpProvider.interceptors.push(\"authInterceptor\");\n\n // used to bootstrap the angularjs controllers in the view \n zaa.bootstrap = $controllerProvider;\n\n $urlMatcherFactoryProvider.strictMode(false)\n\n /**\n * resolvers: https://github.com/angular-ui/ui-router/wiki#resolve\n */\n $stateProvider\n .state(\"default\", {\n url: \"/default/:moduleId\",\n templateUrl: function ($stateParams) {\n return \"admin/template/default\";\n }\n })\n .state(\"default.route\", {\n url: \"/:moduleRouteId/:controllerId/:actionId\",\n templateUrl: function ($stateParams) {\n return $stateParams.moduleRouteId + \"/\" + $stateParams.controllerId + \"/\" + $stateParams.actionId;\n },\n parent: 'default',\n resolve: {\n adminServiceResolver: adminServiceResolver\n }\n })\n .state(\"custom\", {\n url: \"/template/:templateId\",\n templateUrl: function ($stateParams) {\n return $stateParams.templateId;\n },\n resolve: {\n adminServiceResolver: adminServiceResolver,\n resolverProvider: ['resolver', function (resolver) {\n return resolver.then;\n }]\n }\n })\n .state(\"home\", {\n url: \"\",\n templateUrl: \"admin/default/dashboard\"\n })\n // ngrest crud detail view\n .state(\"default.route.detail\", {\n\t\t\t\turl: \"/:id\",\n\t\t\t\tparent: 'default.route',\n\t\t\t\ttemplate: '',\n\t\t\t\tcontroller: ['$scope', '$stateParams', function($scope, $stateParams) {\n\t\n\t\t\t\t\t$scope.crud = $scope.$parent;\n\t\n\t\t\t\t\t$scope.init = function() {\n\t\t\t\t\t\tif (!$scope.crud.config.inline) {\n\t\t\t\t\t\t\tif ($scope.crud.data.updateId != $stateParams.id) {\n\t\t\t\t\t\t\t\t$scope.crud.toggleUpdate($stateParams.id);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\n\t\t\t\t\t$scope.init();\n\t\t\t\t}]\n });\n }]);\n \n/* PROVIDERS */\n\n/**\n * resolver (or resolverProvider).\n * \n * > Warning: The config part is known injected `resolverProvider` even when the provider name is `resolver`.\n * > Info: can not rename this in admin 1.2 release due to usage in cms module old version branch\n * \n * Attach custom callback function to the custom state resolve. Use the resolverProvider in\n * your configuration part:\n *\n * ```js\n * zaa.config(function(resolverProvider) {\n *\t\tresolverProvider.addCallback(function(ServiceMenuData, ServiceBlocksData) {\n *\t\t\tServiceMenuData.load();\n *\t\t\tServiceBlocksData.load();\n *\t\t});\n * });\n * ```\n * \n * @see https://github.com/angular-ui/ui-router/wiki#resolve\n */\nzaa.provider(\"resolver\", [function() {\n var list = [];\n\n this.addCallback = function (callback) {\n list.push(callback);\n };\n\n this.$get = ['$injector', '$q', '$state', function ($injector, $q, $state) {\n return $q(function(resolve, reject) {\n for (var i in list) {\n $injector.invoke(list[i]);\n }\n })\n }];\n \n}]);\n\n/* FACTORIES */\n\n/**\n * LUYA LOADING\n */\nzaa.factory(\"LuyaLoading\", ['$timeout', function($timeout) {\n\n var state = false;\n var stateMessage = null;\n var timeoutPromise = null;\n\n return {\n start: function (myMessage) {\n if (myMessage == undefined) {\n stateMessage = i18n['js_zaa_server_proccess'];\n } else {\n stateMessage = myMessage;\n }\n // rm previous timeouts\n $timeout.cancel(timeoutPromise);\n\n timeoutPromise = $timeout(function () {\n state = true;\n }, 2000);\n },\n stop: function () {\n $timeout.cancel(timeoutPromise);\n state = false;\n },\n getStateMessage: function () {\n return stateMessage;\n },\n getState: function () {\n return state;\n }\n }\n}]);\n\n/**\n * Inside your Directive or Controller:\n * \n * ```js\n * AdminClassService.setClassSpace('modalBody', 'modal-open')\n * ```\n * \n * Inside your HTML layout file:\n * \n * ```html\n *
\n * ```\n * \n * In order to clear the class space afterwards:\n * \n * ```js\n * AdminClassService.clearSpace('modalBody');\n * ```\n */\nzaa.factory(\"AdminClassService\", function () {\n\n var service = [];\n\n service.vars = {};\n\n service.getClassSpace = function (spaceName) {\n if (service.vars.hasOwnProperty(spaceName)) {\n return service.vars[spaceName];\n }\n };\n\n service.hasClassSpace = function(spaceName) {\n \t if (service.vars.hasOwnProperty(spaceName)) {\n \t\t return true;\n \t }\n \t \n \t return false;\n };\n \n service.setClassSpace = function (spaceName, className) {\n service.vars[spaceName] = className;\n };\n \n service.clearSpace = function(spaceName) {\n \tif (service.vars.hasOwnProperty(spaceName)) {\n \t\tservice.vars[spaceName] = null;\n \t}\n };\n \n service.removeSpace = function(spaceName) {\n \tif (service.hasClassSpace(spaceName)) {\n \t\tdelete service.vars[spaceName];\n \t}\n };\n\n service.stack = 0;\n \n service.modalStackPush = function() {\n \tservice.stack += 1;\n };\n \n service.modalStackRemove = function() {\n \tif (service.stack <= 1) {\n \t\tservice.stack = 0; \n \t} else {\n \t\tservice.stack -= 1;\n \t}\n };\n \n service.modalStackRemoveAll = function() {\n \tservice.stack = 0;\n };\n \n service.modalStackIsEmpty = function() {\n \tif (service.stack == 0) {\n \t\treturn true;\n \t}\n \t\n \treturn false;\n };\n \n return service;\n});\n\nzaa.factory('CacheReloadService', ['$http', '$window', function ($http, $window) {\n\n var service = [];\n\n service.reload = function () {\n $http.get(\"admin/api-admin-common/cache\").then(function (response) {\n $window.location.reload();\n });\n }\n \n return service;\n}]);\n\nzaa.factory(\"authInterceptor\", ['$rootScope', '$q', 'AdminToastService', 'AdminDebugBar', function ($rootScope, $q, AdminToastService, AdminDebugBar) {\n return {\n request: function (config) {\n \tif (!config.hasOwnProperty('ignoreLoadingBar')) {\n \t\tconfig.debugId = AdminDebugBar.pushRequest(config);\n \t}\n \t\n \tif (config.hasOwnProperty('authToken')) {\n \t\tvar authToken = config.authToken;\n \t} else {\n \t\tvar authToken = $rootScope.luyacfg.authToken;\n \t}\n \t\n config.headers = config.headers || {};\n config.headers.Authorization = \"Bearer \" + authToken;\n var csrfToken = document.head.querySelector(\"[name=csrf-token]\").content;\n config.headers['X-CSRF-Token'] = csrfToken;\n \n return config || $q.when(config);\n },\n response: function(config) {\n \tif (!config.hasOwnProperty('ignoreLoadingBar')) {\n \t\tAdminDebugBar.pushResponse(config);\n \t}\n \t\n \treturn config || $q.when(config);\n },\n responseError: function (data) {\n if (data.status == 401 || data.status == 403 || data.status == 405) {\n \tif (!data.config.hasOwnProperty('authToken')) {\n \t\twindow.location = \"admin/default/logout\";\n \t}\n } else if (data.status != 422) {\n \tvar message = data.data.hasOwnProperty('message');\n \tif (message) {\n \t\tAdminToastService.error(data.data.message, 10000);\n \t} else {\n \t\tAdminToastService.error(\"Response Error: \" + data.status + \" \" + data.statusText, 10000);\n \t}\n \n }\n \n return $q.reject(data);\n }\n };\n}]);\n","// service resolver\nadminServiceResolver = ['ServiceFoldersData', 'ServiceImagesData', 'ServiceFilesData', 'ServiceFiltersData', 'ServiceLanguagesData', 'ServicePropertiesData', 'AdminLangService', 'ServiceFoldersDirecotryId', function(ServiceFoldersData, ServiceImagesData, ServiceFilesData, ServiceFiltersData, ServiceLanguagesData, ServicePropertiesData, AdminLangService, ServiceFoldersDirecotryId) {\n\tServiceFiltersData.load();\n\tServiceFoldersData.load();\n\t//ServiceImagesData.load();\n\t//ServiceFilesData.load();\n\tServiceLanguagesData.load();\n\tServicePropertiesData.load();\n\tAdminLangService.load();\n\tServiceFoldersDirecotryId.load();\n}];\n\n/**\n * all global admin services\n * \n * controller resolve: https://github.com/johnpapa/angular-styleguide#style-y080\n * \n * Service Inheritance:\n * \n * 1. Service must be prefix with Service\n * 2. Service must contain a forceReload state\n * 3. Service must broadcast an event 'service:FoldersData'\n * 4. Controller integration must look like\n * \n * ```\n * $scope.foldersData = ServiceFoldersData.data;\n *\t\t\t\t\n * $scope.$on('service:FoldersData', function(event, data) {\n * $scope.foldersData = data;\n * });\n *\t\t\t\t\n * $scope.foldersDataReload = function() {\n * return ServiceFoldersData.load(true);\n * }\n * ```\n * \n */\n\t\n/*\n\n$scope.foldersData = ServiceFoldersData.data;\n\t\t\t\t\t\n$scope.$on('service:FoldersData', function(event, data) {\n\t$scope.foldersData = data;\n});\n\n$scope.foldersDataReload = function() {\n\treturn ServiceFoldersData.load(true);\n}\n\n*/\nzaa.factory(\"ServiceFoldersData\", ['$http', '$q', '$rootScope', function($http, $q, $rootScope) {\n\t\n\tvar service = [];\n\t\n\tservice.data = null;\n\t\n\tservice.load = function(forceReload) {\n\t\treturn $q(function(resolve, reject) {\n\t\t\tif (service.data !== null && forceReload !== true) {\n\t\t\t\tresolve(service.data);\n\t\t\t} else {\n\t\t\t\t$http.get(\"admin/api-admin-storage/data-folders\").then(function(response) {\n\t\t\t\t\tservice.data = response.data;\n\t\t\t\t\t$rootScope.$broadcast('service:FoldersData', service.data);\n\t\t\t\t\tresolve(service.data);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t};\n\t\n\treturn service;\n}]);\n\n/*\n\n$scope.folderId = ServiceFoldersDirecotryId.folderId;\n\t\t\t\t\t\n$scope.$on('FoldersDirectoryId', function(event, folderId) {\n\t$scope.folderId = folderId;\n});\n\n$scope.foldersDirecotryIdReload = function() {\n\treturn ServiceFoldersDirecotryId.load(true);\n}\n\n*/\nzaa.factory(\"ServiceFoldersDirecotryId\", ['$http', '$q', '$rootScope', function($http, $q, $rootScope) {\n\t\n\tvar service = [];\n\t\n\tservice.folderId = false;\n\t\n\tservice.load = function(forceReload) {\n\t\treturn $q(function(resolve, reject) {\n\t\t\tif (service.folderId !== false && forceReload !== true) {\n\t\t\t\tresolve(service.folderId);\n\t\t\t} else {\n\t\t\t\t$http.get(\"admin/api-admin-common/get-filemanager-folder-state\").then(function(response) {\n\t\t\t\t\tservice.folderId = response.data;\n\t\t\t\t\t$rootScope.$broadcast('service:FoldersDirectoryId', service.folderId);\n\t\t\t\t\tresolve(service.folderId);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t};\n\t\n\treturn service;\n}]);\n\n/*\n\n$scope.imagesData = ServiceImagesData.data;\n\t\t\t\t\n$scope.$on('service:ImagesData', function(event, data) {\n\t$scope.imagesData = data;\n});\n\n$scope.imagesDataReload = function() {\n\treturn ServiceImagesData.load(true);\n}\n\n*/\nzaa.factory(\"ServiceImagesData\", ['$http', '$q', '$rootScope', '$log', function($http, $q, $rootScope, $log) {\n\tvar service = [];\n\t\n\tservice.data = {};\n\t\n\tservice.load = function(forceReload) {\n\t\t/*\n\t\treturn $q(function(resolve, reject) {\n\t\t\tif (service.data !== null && forceReload !== true) {\n\t\t\t\tresolve(service.data);\n\t\t\t} else {\n\t\t\t\t$http.get(\"admin/api-admin-storage/data-images\").then(function(response) {\n\t\t\t\t\tservice.data = response.data;\n\t\t\t\t\t$rootScope.$broadcast('service:ImagesData', service.data);\n\t\t\t\t\tresolve(service.data);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t\t*/\n\t};\n\t\n\t/**\n\t * Get a given file from the storage system by its id.\n\t * \n\t * ```js\n\t * ServiceImagesData.getImage(1).then(function(response) {\n\t * console.log(response);\n\t * });\n\t */\n\tservice.getImage = function(id, forceAsyncRequest) {\n\t\treturn $q(function(resolve, reject) {\n\t\t\t$log.info('request image id ' + id);\n\t\t\t\n\t\t\tif (service.data.hasOwnProperty(id)) {\n\t\t\t\t$log.info('image exists in data array.');\n\t\t\t\treturn resolve(service.data[id]);\n\t\t\t}\n\t\t\t\n\t\t\t$http.get('admin/api-admin-storage/image-info?id='+id).then(function(response) {\n\t\t\t\tvar data = response.data;\n \t\t\tservice.data[response.id] = data;\n \t\t\treturn resolve(data);\n \t\t});\n\t\t});\n\t};\n\t\n\treturn service;\n}]);\n\n/*\n\n$scope.filesData = ServiceFilesData.data;\n\t\t\t\t\n$scope.$on('service:FilesData', function(event, data) {\n\t$scope.filesData = data;\n});\n\n$scope.filesDataReload = function() {\n\treturn ServiceFilesData.load(true);\n}\n\t\t\t\t\n*/\nzaa.factory(\"ServiceFilesData\", ['$http', '$q', '$rootScope', '$log', function($http, $q, $rootScope, $log) {\n\tvar service = [];\n\t\n\tservice.data = {};\n\t\n\tservice.load = function(forceReload) {\n\t\t/*\n\t\treturn $q(function(resolve, reject) {\n\t\t\tif (service.data !== null && forceReload !== true) {\n\t\t\t\tresolve(service.data);\n\t\t\t} else {\n\t\t\t\t$log.info('load full list of all files from storage data-files api.');\n\t\t\t\t$http.get(\"admin/api-admin-storage/data-files\").then(function(response) {\n\t\t\t\t\tservice.data = response.data;\n\t\t\t\t\t$rootScope.$broadcast('service:FilesData', service.data);\n\t\t\t\t\tresolve(service.data);\n\t\t\t\t\t$log.info('files are loaded from storage api and written to data property.');\n\t\t\t\t\t$log.info(service.data);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t\t*/\n\t};\n\t\n\t/**\n\t * Get a given file from the storage system by its id.\n\t * \n\t * ```js\n\t * ServiceFilesData.getFile(1).then(function(response) {\n\t * console.log(response);\n\t * });\n\t */\n\tservice.getFile = function(id, forceAsyncRequest) {\n\t\treturn $q(function(resolve, reject) {\n\t\t\t$log.info('request file id ' + id);\n\t\t\t\n\t\t\tif (service.data.hasOwnProperty(id)) {\n\t\t\t\t$log.info('file exists in data array.');\n\t\t\t\treturn resolve(service.data[id]);\n\t\t\t}\n\t\t\t\n\t\t\t$http.get('admin/api-admin-storage/file-info?id='+id).then(function(response) {\n\t\t\t\tvar data = response.data;\n \t\t\tservice.data[response.id] = data;\n \t\t\treturn resolve(data);\n \t\t});\n\t\t});\n\t};\n\t\n\treturn service;\n}]);\n\n/*\n\n$scope.filtersData = ServiceFiltersData.data;\n\t\t\t\t\n$scope.$on('service:FiltersData', function(event, data) {\n\t$scope.filtersData = data;\n});\n\n$scope.filtersDataReload = function() {\n\treturn ServiceFiltersData.load(true);\n}\n\t\t\t\t\n*/\nzaa.factory(\"ServiceFiltersData\", ['$http', '$q', '$rootScope', function($http, $q, $rootScope) {\n\tvar service = [];\n\t\n\tservice.data = null;\n\t\n\tservice.load = function(forceReload) {\n\t\treturn $q(function(resolve, reject) {\n\t\t\tif (service.data !== null && forceReload !== true) {\n\t\t\t\tresolve(service.data);\n\t\t\t} else {\n\t\t\t\t$http.get(\"admin/api-admin-storage/data-filters\").then(function(response) {\n\t\t\t\t\tservice.data = response.data;\n\t\t\t\t\t$rootScope.$broadcast('service:FiltersData', service.data);\n\t\t\t\t\tresolve(service.data);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t};\n\t\n\treturn service;\n}]);\n\n/*\n\n$scope.languagesData = ServiceLanguagesData.data;\n\t\t\t\t\n$scope.$on('service:LanguagesData', function(event, data) {\n\t$scope.languagesData = data;\n});\n\n$scope.languagesDataReload = function() {\n\treturn ServiceLanguagesData.load(true);\n}\n\t\t\t\t\n*/\nzaa.factory(\"ServiceLanguagesData\", ['$http', '$q', '$rootScope', function($http, $q, $rootScope) {\n\tvar service = [];\n\t\n\tservice.data = [];\n\t\n\tservice.load = function(forceReload) {\n\t\treturn $q(function(resolve, reject) {\n\t\t\tif (service.data.length > 0 && forceReload !== true) {\n\t\t\t\tresolve(service.data);\n\t\t\t} else {\n\t\t\t\t$http.get(\"admin/api-admin-common/data-languages\").then(function(response) {\n\t\t\t\t\tservice.data = response.data;\n\t\t\t\t\t$rootScope.$broadcast('service:LanguagesData', service.data);\n\t\t\t\t\tresolve(service.data);\n\t\t\t\t})\n\t\t\t}\n\t\t});\n\t};\n\t\n\treturn service;\n}]);\n\n/*\n\n$scope.propertiesData = ServicePropertiesData.data;\n\t\t\t\t\n$scope.$on('service:PropertiesData', function(event, data) {\n\t$scope.propertiesData = data;\n});\n\n$scope.propertiesDataReload = function() {\n\treturn ServicePropertiesData.load(true);\n}\n\t\t\t\t\n*/\nzaa.factory(\"ServicePropertiesData\", ['$http', '$q', '$rootScope', function($http, $q, $rootScope) {\n\tvar service = [];\n\t\n\tservice.data = null;\n\t\n\tservice.load = function(forceReload) {\n\t\treturn $q(function(resolve, reject) {\n\t\t\tif (service.data !== null && forceReload !== true) {\n\t\t\t\tresolve(service.data);\n\t\t\t} else {\n\t\t\t\t$http.get(\"admin/api-admin-common/data-properties\").then(function(response) {\n\t\t\t\t\tservice.data = response.data;\n\t\t\t\t\t$rootScope.$broadcast('service:PropertiesData', service.data);\n\t\t\t\t\tresolve(service.data);\n\t\t\t\t})\n\t\t\t}\n\t\t});\n\t};\n\t\n\treturn service;\n}]);\n\nzaa.factory(\"CrudTabService\", function() {\n\t\n\tvar service = [];\n\t\n\tservice.tabs = [];\n\t\n\tservice.remove = function(index, $scope) {\n\t\tservice.tabs.splice(index, 1);\n\t\t\n\t\tif (service.tabs.length > 0) {\n\t\t\tvar lastTab = service.tabs.slice(-1)[0];\n\t\t\tlastTab.active = true;\n\t\t} else {\n\t\t\t$scope.switchTo(0);\n\t\t}\n\t};\n\t\n\tservice.addTab = function(id, api, arrayIndex, name, modelClass) {\n\t\tvar tab = {id: id, api: api, arrayIndex: arrayIndex, active: true, name: name, modelClass:modelClass};\n\t\t\n\t\tangular.forEach(service.tabs, function(item) {\n\t\t\titem.active = false;\n\t\t});\n\t\t\n\t\tservice.tabs.push(tab);\n\t\t\n\t};\n\t\n\tservice.clear = function() {\n\t\tservice.tabs = [];\n\t};\n\t\n\treturn service;\n});\n\n/*\n \n language service with selections\n \n*/\nzaa.factory(\"AdminLangService\", ['ServiceLanguagesData', '$rootScope', function(ServiceLanguagesData, $rootScope) {\n\t\n\tvar service = [];\n\t\n\tservice.data = [];\n\t\n\tservice.selection = [];\n\t\n\tservice.toggleSelection = function(lang) {\n\t\tvar exists = service.selection.indexOf(lang.short_code);\n\t\t\n\t\tif (exists == -1) {\n\t\t\tservice.selection.push(lang.short_code);\n\t\t\t$rootScope.$broadcast('service:LoadLanguage', lang);\n\t\t} else {\n\t\t\t/* #531: unable to deselect language, as at least 1 langauge must be activated. */\n\t\t\tif (service.selection.length > 1) {\n\t\t\t\tservice.selection.splice(exists, 1);\n\t\t\t}\n\t\t}\n\t};\n\t\n\tservice.isInSelection = function(langShortCode) {\n\t\tvar exists = service.selection.indexOf(langShortCode);\n\t\tif (exists == -1) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t};\n\t\n\tservice.resetDefault = function() {\n\t\tservice.selection = [];\n\t\tangular.forEach(ServiceLanguagesData.data, function(value, key) {\n\t\t\tif (value.is_default == 1) {\n\t\t\t\tif (!service.isInSelection(value.short_code)) {\n\t\t\t\t\tservice.toggleSelection(value);\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t};\n\t\n\tservice.load = function() {\n\t\tServiceLanguagesData.load().then(function(data) {\n\t\t\tservice.data = data;\n\t\t\t\n\t\t\tangular.forEach(data, function(value) {\n\t\t\t\tif (value.is_default == 1) {\n\t\t\t\t\tif (!service.isInSelection(value.short_code)) {\n\t\t\t\t\t\tservice.toggleSelection(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t\t\n\t\t});\n\t};\n\t\n\treturn service;\n}]);\n\n/*\n * Admin Debug Bar provides an array with debug information from the last request in order to find bugs without the developer tools of the browser \n */\nzaa.factory(\"AdminDebugBar\", function() {\n\t\n\tvar service = [];\n\t\n\tservice.data = [];\n\t\n\tservice.clear = function() {\n\t\tservice.data = [];\n\t};\n\t\n\tservice.pushRequest = function(request) {\n\t\treturn service.data.push({'url': request.url, 'requestData': request.data, 'responseData': null, 'responseStatus' : null, start:new Date(), end:null, parseTime: null});\n\t};\n\t\n\tservice.pushResponse = function(response) {\n\t\tvar responseCopy = response;\n\t\t\n\t\tvar serviceData = service.data[responseCopy.config.debugId];\n\t\t\n\t\tif (serviceData) {\n\t\t\tserviceData.responseData = responseCopy.data;\n\t\t\tserviceData.responseStatus = responseCopy.status;\n\t\t\tserviceData.end = new Date();\n\t\t\tserviceData.parseTime = new Date() - serviceData.start;\n\t\t}\n\t\t\n\t\treturn response;\n\t};\n\t\n\treturn service;\n});\n\n/*\n\n$scope.filesData = ServiceFilesData.data;\n\t\t\t\t\n$scope.$on('service:AdminToast', function(event, data) {\n\t$scope.filesData = data;\n});\n\nExamples\n\nAdminToastService.notify('Hello i am Message and will be dismissed in 2 Seconds');\n\nAdminToastService.confirm('Hello i am a callback and wait for your', 'Das löschen?', ['$q', '$http', function($q, $http) {\n\t// do some ajax call\n\t$http.get().then(function() {\n\t\tpromise.resolve();\n\t}).error(function() {\n\t\tpromise.reject();\n\t});\n}]);\n\nyou can also close this dialog by sourself in the callback\n\nAdminToastService.confirm('Are you sure?', 'Dialog Title', function() {\n\t// do something\n\tthis.close();\n});\n\ninstead of this you can also invoke $toast\n\nfunction($toast) {\n\t$toast.close();\n}\n\n*/\nzaa.factory(\"AdminToastService\", ['$q', '$timeout', '$injector', function($q, $timeout, $injector) {\n\tvar service = [];\n\t\n\tservice.notify = function(message, timeout, type) {\n\t\t\n\t\tif (timeout == undefined) {\n\t\t\ttimeout = 6000;\n\t\t}\n\t\t\n\t\tvar uuid = guid();\n\t\t\n\t\tservice.queue[uuid] = {message: message, timeout: timeout, uuid: uuid, type: type, close: function() {\n\t\t\tdelete service.queue[this.uuid];\n\t\t}};\n\t\t\n\t\t$timeout(function() {\n\t\t\tdelete service.queue[uuid];\n\t\t}, timeout);\n\t};\n\t\n\tservice.success = function(message, timeout) {\n\t\tservice.notify(message, timeout, 'success');\n\t};\n\n service.info = function(message, timeout) {\n service.notify(message, timeout, 'info');\n };\n\n service.warning = function(message, timeout) {\n service.notify(message, timeout, 'warning');\n };\n\t\n\tservice.error = function(message, timeout) {\n\t\tservice.notify(message, timeout, 'error');\n\t};\n\t\n\tservice.errorArray = function(array, timeout) {\n\t\tangular.forEach(array, function(value, key) {\n\t\t\tservice.error(value.message, timeout);\n\t\t});\n\t};\n\t\n\tservice.confirm = function(message, title, callback) {\n\t\tvar uuid = guid();\n\t\tservice.queue[uuid] = {message: message, title:title, click: function() {\n\t\t\tvar queue = this;\n\t\t\tvar response = $injector.invoke(this.callback, this, { $toast : this });\n\t\t\tif (response !== undefined) {\n\t\t\t\tresponse.then(function(r) {\n\t\t\t\t\tqueue.close();\n\t\t\t\t}, function(r) {\n\t\t\t\t\tqueue.close();\n\t\t\t\t}, function(r) {\n\t\t\t\t\t/* call or load at later time */\n\t\t\t\t});\n\t\t\t}\n\t\t}, uuid: uuid, callback: callback, type: 'confirm', close: function() {\n\t\t\tdelete service.queue[this.uuid];\n\t\t}}\n\t};\n\t\n\tservice.queue = {};\n\t\n\treturn service;\n}]);\n\n/*\n * \n * Saving data in Html Storage\n * \n *\t$scope.isHover = HtmlStorage.getValue('sidebarToggleState', false); \n *\t\t\n *\t$scope.toggleMainNavSize = function() {\n *\t $scope.isHover = !$scope.isHover;\n *\t HtmlStorage.setValue('sidebarToggleState', $scope.isHover);\n *\t}\n */\nzaa.factory('HtmlStorage', function() {\n\tvar service = {\n\t\t\n\t\tdata: {},\n\t\t\n\t\tisLoaded : false,\n\t\t\n\t\tloadData : function() {\n\t\t\tif (!service.isLoaded) {\n\t\t\t\tif (localStorage.getItem(\"HtmlStorage\")) {\n\t\t\t\t\tvar data = angular.fromJson(localStorage.getItem('HtmlStorage'));\n\t\t\t\t\t\n\t\t\t\t\tservice.data = data;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\n\t\tsaveData : function() {\n\t\t\tlocalStorage.removeItem('HtmlStorage');\n\t\t\tlocalStorage.setItem('HtmlStorage', angular.toJson(service.data));\n\t\t},\n\t\t\n\t\tgetValue : function(key, defaultValue) {\n\t\t\tservice.loadData();\n\t\t\t\n\t\t\tif (service.data.hasOwnProperty(key)) {\n\t\t\t\treturn service.data[key];\n\t\t\t}\n\t\t\t\n\t\t\treturn defaultValue;\n\t\t},\n\t\t\n\t\tsetValue : function(key, value) {\n\t\t\tservice.loadData();\n\t\t\t\n\t\t\tservice.data[key] = value;\n\t\t\t\n\t\t\tservice.saveData();\n\t\t}\n\t};\n\t\n\treturn service;\n});","\n \n zaa.filter(\"filemanagerdirsfilter\", function() {\n return function(input, parentFolderId) {\n var result = [];\n angular.forEach(input, function(value, key) {\n if (value.parentId == parentFolderId) {\n result.push(value);\n }\n });\n\n return result;\n };\n });\n\n zaa.filter(\"findthumbnail\", function() {\n \treturn function(input, fileId, thumbnailFilterId) {\n \t\tvar result = false;\n \t\tangular.forEach(input, function(value, key) {\n \t\t\tif (!result) {\n\t \t\t\tif (value.fileId == fileId && value.filterId == thumbnailFilterId) {\n\t \t\t\t\tresult = value;\n\t \t\t\t}\n \t\t\t}\n \t\t})\n\n \t\treturn result;\n \t}\n });\n\n zaa.filter(\"findidfilter\", function() {\n return function(input, id) {\n\n var result = false;\n\n angular.forEach(input, function(value, key) {\n if (value.id == id) {\n result = value;\n }\n });\n\n return result;\n }\n });\n\n zaa.filter(\"filemanagerfilesfilter\", function() {\n return function(input, folderId, onlyImages) {\n\n var result = [];\n\n angular.forEach(input, function(data) {\n if (onlyImages) {\n if (data.folderId == folderId && data.isImage == true) {\n result.push(data);\n }\n } else {\n if (data.folderId == folderId) {\n result.push(data);\n }\n }\n });\n\n return result;\n };\n });\n \n zaa.filter('trustAsUnsafe', ['$sce', function ($sce) {\n return function (val, enabled) {\n return $sce.trustAsHtml(val);\n };\n }]);\n \n zaa.filter('srcbox', function () {\n return function (input, search) {\n if (!input) return input;\n if (!search) return input;\n var expected = ('' + search).toLowerCase();\n var result = {};\n angular.forEach(input, function (value, key) {\n angular.forEach(value, function (kv, kk) {\n var actual = ('' + kv).toLowerCase();\n if (actual.indexOf(expected) !== -1) {\n result[key] = value;\n }\n });\n });\n return result;\n }\n });\n\n zaa.filter('trustAsResourceUrl', ['$sce', function ($sce) {\n return function (val, enabled) {\n if (!enabled) {\n return null;\n }\n return $sce.trustAsResourceUrl(val);\n };\n }]);\n\n zaa.filter('truncateMiddle', function () {\n return function (val, length, placeholder) {\n if(!length) {\n length = 30;\n }\n if(!placeholder) {\n placeholder = '...';\n }\n\n if(val.length <= length) {\n return val;\n }\n\n var targetLength = length - placeholder.length;\n var partLength = targetLength / 2;\n\n return (val.substring(0, partLength)) + placeholder + val.substring(val.length - partLength, val.length);\n };\n });","\n\n /* GLOBAL DIRECTIVES */\n\n /**\n * Directive to generate e chart diagrams.\n *\n * uses echarts.js component.\n */\n zaa.directive('echarts', function() {\n return {\n scope: {\n id: \"@\",\n legend: \"=\",\n item: \"=\",\n data: \"=\"\n },\n restrict: 'E',\n template: '
',\n replace: true,\n link: function($scope, element, attrs, controller) {\n var myChart = echarts.init(document.getElementById($scope.id),'macarons');\n var option = {\n tooltip: {\n show: true,\n trigger: 'item'\n },\n legend: {\n data: []\n },\n };\n /**\n * init the echart\n */\n myChart.setOption(option);\n $scope.$watch('data', function() {\n var option = $scope.$eval('data');\n if (option!=undefined) {\n myChart.setOption(angular.fromJson(option));\n }\n }, true);\n var w = angular.element(window);\n w.bind('resize', function(){\n /**\n * resize echarts when window zoom\n */\n myChart.resize();\n });\n }\n };\n });\n\n /**\n * Controller: $scope.content = $sce.trustAsHtml(response.data);\n * \n * Usage:\n * \n * ```\n *
\n * ```\n */\n zaa.directive(\"compileHtml\", ['$compile', '$parse', function ($compile, $parse) {\n return {\n restrict: \"A\",\n link: function (scope, element, attr) {\n var parsed = $parse(attr.ngBindHtml);\n scope.$watch(function () {\n return (parsed(scope) || \"\").toString();\n }, function () {\n $compile(element, null, -9999)(scope); //The -9999 makes it skip directives so that we do not recompile ourselves\n });\n }\n };\n }]);\n\n /**\n * Usage:\n *\n * ```\n *
\n * ```\n */\n zaa.directive(\"zaaEsc\", ['$document', function ($document) {\n return function (scope, element, attrs) {\n $document.on(\"keyup\", function (e) {\n if (e.keyCode == 27) {\n scope.$apply(function () {\n scope.$eval(attrs.zaaEsc);\n });\n }\n });\n };\n }]);\n\n /**\n * Returns the link options as value.\n */\n zaa.directive(\"linkObjectToString\", function () {\n return {\n restrict: 'E',\n relace: true,\n scope: {\n 'link': '='\n },\n template: function () {\n return '' +\n \t'' +\n \t'{{link.value}}' +\n '' +\n '{{link.value}}' +\n '';\n }\n }\n });\n\n /**\n * Generate a Tool Tip – usage:\n *\n * The default tooltip is positioned on the right side of the element:\n *\n * ```html\n * ...\n * ```\n *\n *\n * You can provide an Image URL beside or instead of text.\n *\n * ```html\n * ...\n * ```\n *\n * Change the position (`top`, `right`, `bottom` or `left`):\n *\n * ```html\n * ...\n * ```\n *\n *\n * Add an offset to the generated position. The example below adds 5px offset from left and pulls the tooltip 5px up.\n *\n * ```html\n * ...\n * ```\n *\n *\n * In order to trigger an expression call instead of a static text use:\n *\n * ```html\n * Span Text\n * ```\n *\n *\n * Disable tooltip based on variable (two way binding):\n *\n * ```html\n * Span Text\n * ```\n */\n zaa.directive(\"tooltip\", ['$document', function ($document) {\n return {\n restrict: 'A',\n scope: {\n 'tooltipText': '@',\n 'tooltipExpression': '=',\n 'tooltipPosition': '@',\n 'tooltipOffsetTop': '@',\n 'tooltipOffsetLeft': '@',\n 'tooltipImageUrl': '@',\n 'tooltipDisabled': '='\n },\n link: function (scope, element, attr) {\n var defaultPosition = 'right';\n\n var positions = {\n top: function() {\n var bcr = element[0].getBoundingClientRect();\n return {\n top: bcr.top - scope.pop.outerHeight(),\n left: (bcr.left + (bcr.width / 2)) - (scope.pop.outerWidth() / 2),\n }\n },\n bottom: function() {\n var bcr = element[0].getBoundingClientRect();\n return {\n top: bcr.top + bcr.height,\n left: (bcr.left + (bcr.width / 2)) - (scope.pop.outerWidth() / 2),\n }\n },\n right: function() {\n var bcr = element[0].getBoundingClientRect();\n return {\n top: (bcr.top + (bcr.height / 2)) - (scope.pop.outerHeight() / 2),\n left: bcr.left + bcr.width\n }\n },\n left: function() {\n var bcr = element[0].getBoundingClientRect();\n return {\n top: (bcr.top + (bcr.height / 2)) - (scope.pop.outerHeight() / 2),\n left: bcr.left - scope.pop.outerWidth()\n }\n }\n };\n\n var onScroll = function() {\n var offset = {};\n if(typeof positions[scope.tooltipPosition] === 'function') {\n offset = positions[scope.tooltipPosition]();\n } else {\n offset = positions[defaultPosition]();\n }\n\n if (typeof scope.tooltipOffsetTop == 'number') {\n offset.top = offset.top + scope.tooltipOffsetTop;\n }\n\n if (typeof scope.tooltipOffsetLeft == 'number') {\n offset.left = offset.left + scope.tooltipOffsetLeft;\n }\n\n scope.pop.css(offset);\n };\n\n element.on('mouseenter', function () {\n\n // Generate tooltip HTML for the first time\n if(!scope.pop && (typeof scope.tooltipDisabled === 'undefined' || scope.tooltipDisabled === false)) {\n if (scope.tooltipExpression) {\n scope.tooltipText = scope.tooltipExpression;\n }\n\n var html = '
' +\n '
' +\n '
' +\n (scope.tooltipText ? ('' + scope.tooltipText + '') : '') +\n '
' +\n '
';\n\n var $html = $(html);\n\n if(scope.tooltipImageUrl) {\n var image = new Image();\n image.onload = function() {\n onScroll();\n };\n image.src = scope.tooltipImageUrl;\n $html.find('.tooltip-inner').append(image);\n }\n\n scope.pop = $html;\n\n $document.find('body').append(scope.pop);\n scope.pop.hide();\n }\n\n // If tooltip shall be display...\n if(scope.pop && (typeof scope.tooltipDisabled === 'undefined' || scope.tooltipDisabled === false)) {\n\n // ..check position\n onScroll();\n\n // todo: Improve performance ...? x)\n // ..register scroll listener\n element.parents().on('scroll', onScroll);\n\n // ..show popup\n scope.pop.show();\n }\n });\n\n element.on('mouseleave', function () {\n element.parents().off('scroll', onScroll);\n\n if(scope.pop) {\n scope.pop.hide();\n }\n });\n\n scope.$on('$destroy', function() {\n if(scope.pop) {\n scope.pop.remove();\n }\n });\n }\n }\n }]);\n\n /**\n * Convert a string to number value, usefull in selects.\n *\n * ```\n * \n * ```\n */\n zaa.directive('focusMe', ['$timeout', '$parse', function ($timeout, $parse) {\n return {\n link: function (scope, element, attrs) {\n var model = $parse(attrs.focusMe);\n scope.$watch(model, function (value) {\n if (value === true) {\n $timeout(function () {\n element[0].focus();\n });\n }\n });\n }\n };\n }]);\n\n /**\n * ```\n * Test\n * ```\n */\n zaa.directive(\"clickPastePusher\", ['$rootScope', '$compile', function ($rootScope, $compile) {\n return {\n restrict: 'A',\n replace: false,\n link: function (scope, element, attrs) {\n element.bind('click', function () {\n $rootScope.$broadcast('insertPasteListener', attrs['clickPastePusher']);\n })\n }\n }\n }]);\n\n /**\n *\n * ```\n * $rootScope.$broadcast('insertPasteListener', $scope.someInput);\n * ```\n *\n * ```\n * \n * ```\n */\n zaa.directive('insertPasteListener', ['$rootScope', function ($rootScope) {\n return {\n restrict: 'A',\n link: function (scope, element, attrs) {\n element.bind(\"focus\", function () {\n $rootScope.lastElement = element[0];\n var offCallFn = $rootScope.$on('insertPasteListener', function (e, val) {\n var domElement = $rootScope.lastElement;\n\n if (domElement != element[0] || !domElement) {\n return false;\n }\n\n $rootScope.$$listeners.insertPasteListener = [];\n\n if (document.selection) {\n domElement.focus();\n var sel = document.selection.createRange();\n sel.text = val;\n domElement.focus();\n } else if (domElement.selectionStart || domElement.selectionStart === 0) {\n var startPos = domElement.selectionStart;\n var endPos = domElement.selectionEnd;\n var scrollTop = domElement.scrollTop;\n domElement.value = domElement.value.substring(0, startPos) + val + domElement.value.substring(endPos, domElement.value.length);\n domElement.focus();\n domElement.selectionStart = startPos + val.length;\n domElement.selectionEnd = startPos + val.length;\n domElement.scrollTop = scrollTop;\n } else {\n domElement.value += val;\n domElement.focus();\n }\n });\n });\n }\n }\n }]);\n\n\n /**\n * Example usage of luya admin modal:\n *\n * ```js\n * \n * \n *

Modal Container

\n *

Hello world!

\n *
\n * ```\n *\n * If you want to hidden use ng-if with modals, you have to use ng-if inside the modal like:\n *\n * ```js\n * \n *
\n *

This is only linked when modalState is visible

\n *
\n *
\n * ```\n *\n * > Using the ng-if outside of the modal wont work as it does not trigger the modalState due to child scope creation each time\n * > the ng-if is visible.\n *\n */\n zaa.directive(\"modal\", ['$timeout', function($timeout) {\n return {\n restrict: \"E\",\n scope: {\n isModalHidden: \"=\",\n title: '@modalTitle'\n },\n replace: true,\n transclude: true,\n templateUrl: \"modal\",\n controller : ['$scope', 'AdminClassService', function($scope, AdminClassService) {\n \t$scope.$watch('isModalHidden', function(n, o) {\n \t\tif (n !== o) {\n \t\t\tif (n) { // is hidden\n \t\t\t\tAdminClassService.modalStackRemove();\n \t\t} else { // is visible\n \t\t\tAdminClassService.modalStackPush();\n \t\t}\n \t\t}\n \t});\n\n \t/* ESC Key will close ALL modals, therefore we ensure the correct spaces */\n \t$scope.escModal = function() {\n \t\t$scope.isModalHidden = true;\n \t\tAdminClassService.modalStackRemoveAll();\n \t};\n }],\n link: function (scope, element) {\n \tscope.$on('$destroy', function() {\n \t\telement.remove();\n \t});\n \tangular.element(document.body).append(element);\n }\n }\n }]);\n\n /* CRUD, FORMS & FILE MANAGER */\n\n /**\n * If modelSelection and modelSetter is enabled, you can select a given row based in its primary key which will triggered the ngrest of the parent CRUD form.\n *\n * ```\n * \n * ```\n */\n zaa.directive(\"crudLoader\", ['$http', '$sce', function($http, $sce) {\n \treturn {\n \t\trestrict: \"E\",\n \t\treplace: true,\n \t\ttransclude: false,\n \t\tscope: {\n \t\t\t\"api\": \"@\",\n \t\t\t\"alias\" : \"@\",\n \t\t\t\"modelSelection\" : \"@\",\n \t\t\t\"modelSetter\": \"=\"\n \t\t},\n \t\tcontroller: ['$scope', function($scope) {\n\n \t\t\t$scope.input = { showWindow : true};\n\n \t\t\t$scope.content = null;\n\n \t\t\t$scope.toggleWindow = function() {\n \t\t\t\tif ($scope.input.showWindow) {\n \t\t\t\t\tvar url = $scope.api+'/?inline=1';\n \t\t\t\t\tvar modelSelection = parseInt($scope.modelSelection);\n \t\t\t\t\tif (modelSelection) {\n \t\t\t\t\t\turl = url + '&modelSelection=' + $scope.modelSetter;\n \t\t\t\t\t}\n \t\t\t\t\t$http.get(url).then(function(response) {\n \t\t\t\t\t\t$scope.content = $sce.trustAsHtml(response.data);\n \t\t\t\t\t\t$scope.input.showWindow = false;\n \t\t\t\t\t});\n \t\t\t\t} else {\n \t\t\t\t\t$scope.$parent.loadService();\n \t\t\t\t\t$scope.input.showWindow = true;\n \t\t\t\t}\n \t\t\t};\n\n \t\t\t$scope.$watch('input.showWindow', function(n, o) {\n \t\t\t\tif (n !== o && n == 1) {\n \t\t\t\t\t$scope.$parent.loadService();\n \t\t\t\t}\n \t\t\t});\n\n \t\t\t/**\n \t\t\t * @param integer $value contains the primary key\n \t\t\t * @param array $row contains the full row from the crud loader model in order to display data.\n \t\t\t */\n \t\t\t$scope.setModelValue = function(value, row) {\n \t\t\t\t$scope.modelSetter = value;\n \t\t\t\t$scope.toggleWindow();\n \t\t\t};\n \t\t}],\n \t\ttemplate: function() {\n \t\t\treturn '
';\n \t\t}\n \t}\n }]);\n\n /**\n * Directive to load curd relations.\n */\n zaa.directive(\"crudRelationLoader\", ['$http', '$sce', function($http, $sce) {\n \treturn {\n \t\trestrict: \"E\",\n \t\treplace: true,\n \t\ttransclude: false,\n \t\tscope: {\n \t\t\t\"api\": \"@api\",\n \t\t\t\"arrayIndex\": \"@arrayIndex\",\n \t\t\t\"modelClass\" : \"@modelClass\",\n \t\t\t\"id\": \"@id\"\n \t\t},\n \t\tcontroller: ['$scope', function($scope) {\n \t\t\t$scope.content = null;\n \t\t\t$http.get($scope.api+'/?inline=1&relation='+$scope.id+'&arrayIndex='+$scope.arrayIndex+'&modelClass='+$scope.modelClass).then(function(response) {\n\t\t\t\t\t$scope.content = $sce.trustAsHtml(response.data);\n \t\t\t});\n \t\t}],\n \t\ttemplate: function() {\n \t\t\treturn '
';\n \t\t}\n \t}\n }]);\n\n /**\n * Generate form input types based on ZAA Directives.\n *\n * Usage inside another Angular Template:\n *\n * ```php\n * \n * ```\n */\n zaa.directive(\"zaaInjector\", ['$compile', function($compile) {\n return {\n restrict: \"E\",\n replace: true,\n transclude: false,\n scope: {\n \"dir\": \"=\",\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"grid\": \"@grid\",\n \"fieldid\": \"@fieldid\",\n \"placeholder\": \"@placeholder\",\n \"initvalue\": \"@initvalue\"\n },\n link: function($scope, $element) {\n var elmn = $compile(angular.element('<' + $scope.dir + ' options=\"options\" initvalue=\"{{initvalue}}\" fieldid=\"{{fieldid}}\" placeholder=\"{{placeholder}}\" model=\"model\" label=\"{{label}}\" i18n=\"{{grid}}\" />'))($scope);\n $element.replaceWith(elmn);\n },\n }\n }]);\n\n /**\n * @var object $model Contains existing data for the displaying the existing relations\n *\n * ```js\n * [\n * \t{'sortpos': 1, 'value': 1},\n * {'sortpos': 2, 'value': 4},\n * ]\n * ```\n *\n * @var object $options Provides options to build the sort relation array:\n *\n * ```js\n * {\n * \t'sourceData': [\n * \t\t{'value': 1, 'label': 'Source Entry #1'}\n * \t\t{'value': 2, 'label': 'Source Entry #2'}\n * \t\t{'value': 3, 'label': 'Source Entry #3'}\n * \t\t{'value': 4, 'label': 'Source Entry #4'}\n * \t]\n * }\n * ```\n */\n zaa.directive(\"zaaSortRelationArray\", function() {\n \treturn {\n \t\trestrict: \"E\",\n \t\tscope: {\n \t\t\t\"model\": \"=\",\n \t\t\t\"options\": \"=\",\n \t\t\t\"label\": \"@label\",\n \t\t\t\"i18n\": \"@i18n\",\n \"id\": \"@fieldid\"\n \t\t},\n \t\tcontroller: ['$scope', '$filter', function($scope, $filter) {\n\n \t\t\t$scope.searchString;\n\n \t\t\t$scope.sourceData = [];\n\n $scope.dropdownOpen = false;\n\n \t\t\t$scope.$watch(function() { return $scope.model }, function(n, o) {\n \t\t\t\tif (n == undefined) {\n \t\t\t\t\t$scope.model = [];\n \t\t\t\t}\n \t\t\t});\n\n \t\t\t$scope.$watch(function() { return $scope.options }, function(n, o) {\n \t\t\t\tif (n !== undefined && n !== null) {\n \t\t\t\t\t$scope.sourceData = n.sourceData;\n \t\t\t\t}\n \t\t\t})\n\n \t\t\t$scope.getSourceOptions = function() {\n \t\t\t\treturn $scope.sourceData;\n \t\t\t};\n\n \t\t\t$scope.getModelItems = function() {\n \t\t\t\treturn $scope.model;\n \t\t\t}\n\n \t\t\t$scope.addToModel = function(option) {\n\n \t\t\t\tvar match = false;\n\n \t\t\t\tangular.forEach($scope.model, function(value, key) {\n \t\t\t\t\tif (value.value == option.value) {\n \t\t\t\t\t\tmatch = true;\n \t\t\t\t\t}\n \t\t\t\t});\n\n \t\t\t\tif (!match) {\n \t\t\t\t\t$scope.model.push({'value': option.value, 'label': option.label});\n \t\t\t\t}\n \t\t\t};\n\n \t\t\t$scope.removeFromModel = function(key) {\n \t\t\t\t$scope.model.splice(key, 1);\n \t\t\t}\n\n \t\t\t$scope.moveUp = function(index) {\n index = parseInt(index);\n var oldRow = $scope.model[index];\n $scope.model[index] = $scope.model[index-1];\n $scope.model[index-1] = oldRow;\n }\n\n $scope.moveDown = function(index) {\n index = parseInt(index);\n var oldRow = $scope.model[index];\n $scope.model[index] = $scope.model[index+1];\n $scope.model[index+1] = oldRow;\n };\n\n $scope.elementInModel = function(item) {\n \t\tvar match = false;\n\n \t\t\t\tangular.forEach($scope.model, function(value, key) {\n \t\t\t\t\tif (value.value == item.value) {\n \t\t\t\t\t\tmatch = true;\n \t\t\t\t\t}\n \t\t\t\t});\n\n \t\t\t\treturn !match;\n }\n \t\t}],\n \t\ttemplate: function() {\n \t\t\treturn '
' +\n '
' +\n '
' +\n '
' +\n '
' +\n '
' +\n 'play_arrow' +\n 'play_arrow' +\n '
' +\n\n '{{item.label}}' +\n\n '
' +\n 'delete' +\n '
' +\n '
' +\n '
' +\n '' +\n '
    ' +\n '
  • ' +\n 'add_circle{{ option.label }}' +\n '
  • ' +\n '
' +\n '
' +\n 'arrow_drop_up' +\n 'arrow_drop_down' +\n '
' +\n '
' +\n '
' +\n '
';\n \t\t}\n \t}\n });\n\n zaa.directive(\"zaaLink\", function(){\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\"\n },\n controller: ['$scope', function($scope) {\n \t$scope.unset = function() {\n \t\t$scope.model = false;\n \t\t$scope.data.model = null;\n \t};\n\n \t$scope.data = {\n \t\tmodalState: 1,\n \t\tmodel: null\n \t};\n\n \t$scope.$watch('model', function(n, o) {\n \t\tif (n) {\n \t\t\t$scope.data.model = n;\n \t\t}\n \t}, true);\n\n \t$scope.$watch('data.model', function(n, o) {\n \t\tif (n) {\n \t\t\t$scope.model = n;\n \t\t}\n \t}, true);\n }],\n template: function() {\n return '
{{label}}
' +\n '
' +\n '' +\n '
' +\n '
' +\n '' +\n '
' +\n '
'+\n '' +\n '
' +\n '
'+\n '
';\n }\n }\n });\n\n zaa.directive(\"zaaSlug\", function() {\n \treturn {\n \t\trestrict: \"E\",\n \t\tscope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\"\n },\n \t\tcontroller: ['$scope', '$filter', function($scope, $filter) {\n \t\t\t$scope.$watch(function() { return $scope.model; }, function(n, o) {\n \t\t\t\tif (n!=o) {\n \t\t\t\t\t$scope.model = $filter('slugify')(n);\n \t\t\t\t}\n \t\t\t});\n \t\t}],\n \t\ttemplate:function() {\n return '
';\n \t\t}\n \t}\n });\n\n zaa.directive(\"zaaColor\", function() {\n \treturn {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\"\n },\n controller: ['$scope', function($scope) {\n function getTextColor(){\n if(typeof $scope.model === 'undefined') {\n return '#000';\n }\n\n var hex = $scope.model;\n\n if(typeof $scope.model === 'string') {\n hex = hex.substr(1);\n }\n\n if(hex.length === 3) {\n var shorthandRegex = /^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i;\n hex = hex.replace(shorthandRegex, function(m, r, g, b) {\n return r + r + g + g + b + b;\n });\n }\n\n if(hex.length === 6) {\n var r = parseInt(hex.substr(0, 2), 16);\n var g = parseInt(hex.substr(2, 2), 16);\n var b = parseInt(hex.substr(4, 2), 16);\n var yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;\n return (yiq >= 128) ? '#000' : '#fff';\n }\n\n return '#000';\n }\n\n $scope.textColor = getTextColor();\n\n $scope.$watch(function() { return $scope.model; }, function(n, o) {\n $scope.textColor = getTextColor();\n });\n }],\n template: function() {\n return '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
' +\n '
' +\n '
';\n }\n }\n });\n\n zaa.directive(\"zaaWysiwyg\", function() {\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\"\n },\n template: function() {\n return '';\n }\n }\n });\n\n zaa.directive(\"zaaNumber\", function() {\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n \"placeholder\": \"@placeholder\",\n \"initvalue\" : \"@initvalue\"\n }, \n link: function($scope) {\n $scope.$watch(function() { return $scope.model }, function(n, o) {\n \tif (n == undefined) {\n \t\t$scope.model = parseInt($scope.initvalue);\n \t}\n if(angular.isNumber($scope.model)) {\n $scope.isValid = true;\n } else {\n $scope.isValid = false;\n }\n })\n }, template: function() {\n return '
';\n }\n }\n });\n\n zaa.directive(\"zaaDecimal\", function() {\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n \"placeholder\": \"@placeholder\"\n }, \n controller: ['$scope', function($scope) {\n if ($scope.options === null) {\n $scope.steps = 0.01;\n } else {\n $scope.steps = $scope.options['steps'];\n }\n }], \n link: function($scope) {\n $scope.$watch(function() { return $scope.model }, function(n, o) {\n if(angular.isNumber($scope.model)) {\n $scope.isValid = true;\n } else {\n $scope.isValid = false;\n }\n })\n },\n template: function() {\n return '
';\n }\n }\n });\n\n /**\n * \" />\n */\n zaa.directive(\"zaaText\", function(){\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n \"placeholder\": \"@placeholder\"\n },\n template: function() {\n return '
';\n }\n }\n });\n\n /**\n * \n */\n zaa.directive(\"zaaAsyncValue\", function(){\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"api\" : \"@\",\n \"fields\" : \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\"\n },\n controller: ['$scope', '$timeout', '$http', function($scope, $timeout, $http) {\n \t$timeout(function() {\n \t\t$scope.$watch('model', function(n, o) {\n \t\t\tif (n) {\n \t\t$scope.value = '';\n \t\t\t\t$http.get($scope.api + \"/\" + n + \"?fields=\" + $scope.fields.join()).then(function(response) {\n \t\t\t\t\t$scope.value;\n \t\t\t\t\tangular.forEach(response.data, function(value) {\n \t\t\t\t\t\tif (value) {\n \t\t\t\t\t\t\t$scope.value = $scope.value + value + \" \";\n \t\t\t\t\t\t}\n \t\t\t\t\t});\n \t\t\t\t});\n \t\t\t}\n \t\t});\n \t});\n\n \t$scope.resetValue = function() {\n \t\t$scope.model = 0;\n \t\t$scope.value = null;\n \t};\n }],\n template: function() {\n return '
';\n }\n }\n });\n\n zaa.directive(\"zaaTextarea\", function(){\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n \"placeholder\": \"@placeholder\"\n },\n template: function() {\n return '
';\n }\n }\n });\n\n zaa.directive(\"zaaPassword\", function(){\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\"\n },\n template: function() {\n return '
';\n }\n }\n });\n\n /**\n * \n */\n zaa.directive(\"zaaRadio\", function() {\n \treturn {\n\t \trestrict: \"E\",\n\t \tscope: {\n\t \"model\": \"=\",\n\t \"options\": \"=\",\n\t \"label\": \"@label\",\n\t \"i18n\": \"@i18n\",\n\t \"id\": \"@fieldid\",\n\t \"initvalue\": \"@initvalue\"\n\t \t},\n\t \tcontroller: ['$scope', function($scope) {\n\t \t\t$scope.setModelValue = function(value) {\n\t \t\t\t$scope.model = value;\n\t \t\t};\n\t \t}],\n\t \ttemplate: function() {\n\t \t\treturn '
' +\n\t\t\t\t '
' +\n\t\t\t\t \t'' +\n\t\t\t\t '
' +\n\t\t\t\t '
' +\n\t\t\t\t\t \t'
'+\n '' +\n\t\t\t\t\t \t\t''+\n\t\t\t\t\t \t'
'+\n\t\t\t\t\t '
'+\n\t\t\t\t '
';\n\t \t}\n \t};\n });\n\n /**\n *\n * Usage Example:\n *\n * ```js\n * \" options=\"modules\" />\n * ```\n *\n * If an initvalue is provided, you can not reset the model to null.\n *\n * Options value defintion:\n *\n * ```js\n * options=[{\"value\":123,\"label\":123-Label}, {\"value\":abc,\"label\":ABC-Label}]\n * ```\n *\n * In order to change the value and label keys which should be used to take the value and label keys within the given array use:\n *\n * ```js\n * \n * ```\n */\n zaa.directive(\"zaaSelect\", function() {\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"optionsvalue\" : \"@optionsvalue\",\n \"optionslabel\" : \"@optionslabel\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n \"initvalue\": \"@initvalue\"\n },\n controller: ['$scope', '$timeout', '$rootScope', function($scope, $timeout, $rootScope) {\n\n \t/* default scope values */\n\n \t$scope.isOpen = 0;\n\n \tif ($scope.optionsvalue == undefined) {\n \t\t$scope.optionsvalue = 'value';\n \t}\n\n \tif ($scope.optionslabel == undefined) {\n \t\t$scope.optionslabel = 'label';\n \t}\n\n\t\t if (angular.isNumber($scope.model)){\n\t\t $scope.model = typeCastValue($scope.model);\n\t\t }\n\n\t\t /* listeners */\n\n \t$scope.$on('closeAllSelects', function() {\n \t\tif ($scope.isOpen) {\n \t\t\t$scope.closeSelect();\n \t\t}\n \t});\n\n $timeout(function(){\n $scope.$watch(function() { return $scope.model }, function(n, o) {\n if (n == undefined || n == null || n == '') {\n if (angular.isNumber($scope.initvalue)) {\n $scope.initvalue = typeCastValue($scope.initvalue);\n }\n var exists = $scope.valueExistsInOptions(n);\n\n if (!exists) {\n \t$scope.model = $scope.initvalue;\n }\n }\n });\n });\n\n /* methods */\n\n $scope.valueExistsInOptions = function(value) {\n \tvar exists = false;\n \tangular.forEach($scope.options, function(item) {\n \t\tif (value == item.value) {\n \t\t\texists = true;\n \t\t}\n \t});\n \treturn exists;\n };\n\n \t$scope.toggleIsOpen = function() {\n \t\tif (!$scope.isOpen) {\n \t\t\t$rootScope.$broadcast('closeAllSelects');\n \t\t}\n \t\t$scope.isOpen = !$scope.isOpen;\n \t};\n\n \t$scope.closeSelect = function() {\n \t\t$scope.isOpen = 0;\n \t};\n\n $scope.setModelValue = function(option) {\n \t$scope.model = option[$scope.optionsvalue];\n \t$scope.closeSelect();\n };\n\n $scope.getSelectedLabel = function() {\n \tvar defaultLabel = i18n['ngrest_select_no_selection'];\n \tangular.forEach($scope.options, function(item) {\n \t\tif ($scope.model == item[$scope.optionsvalue]) {\n \t\t\tdefaultLabel = item[$scope.optionslabel];\n \t\t}\n \t});\n\n \treturn defaultLabel;\n };\n\n $scope.hasSelectedValue = function() {\n \tvar modelValue = $scope.model;\n\n \tif ($scope.valueExistsInOptions(modelValue) && modelValue != $scope.initvalue) {\n \t\treturn true;\n \t}\n\n \treturn false;\n };\n }],\n template: function() {\n return '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
' +\n '' +\n '
' +\n '{{getSelectedLabel()}}' +\n 'clear' +\n 'keyboard_arrow_down' +\n '
' +\n '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
' +\n '{{opt[optionslabel]}}' +\n '
' +\n '
' +\n '
' +\n '
' +\n '
' +\n '
';\n }\n }\n });\n\n /**\n * options = {'true-value' : 1, 'false-value' : 0};\n */\n zaa.directive(\"zaaCheckbox\", function() {\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n \"label\": \"@label\",\n \"initvalue\": \"@initvalue\"\n },\n controller: ['$scope', '$timeout', function($scope, $timeout) {\n if ($scope.options === null || $scope.options === undefined) {\n $scope.valueTrue = 1;\n $scope.valueFalse = 0;\n } else {\n $scope.valueTrue = $scope.options['true-value'];\n $scope.valueFalse = $scope.options['false-value'];\n }\n\n $scope.init = function() {\n \t\tif ($scope.model == undefined && $scope.model == null) {\n \t\t\t$scope.model = typeCastValue($scope.initvalue);\n \t\t}\n };\n $timeout(function() {\n \t$scope.init();\n \t})\n }],\n template: function() {\n return '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
' +\n '' +\n '' +\n '
' +\n '
' +\n '
';\n }\n }\n });\n\n /**\n * options arg object:\n *\n * options.items[] = [{\"value\" : 1, \"label\" => 'Label for Value 1' }]\n */\n zaa.directive(\"zaaCheckboxArray\", function(){\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n \"label\": \"@label\"\n },\n controller: ['$scope', '$filter', function($scope, $filter) {\n\n if ($scope.model == undefined) {\n $scope.model = [];\n }\n\n $scope.searchString = '';\n\n $scope.$watch('options', function(n, o) {\n \tif (n != undefined && n.hasOwnProperty('items')) {\n \t$scope.optionitems = $filter('orderBy')(n.items, 'label');\n }\n });\n\n $scope.filtering = function() {\n $scope.optionitems = $filter('filter')($scope.options.items, $scope.searchString);\n }\n\n $scope.toggleSelection = function (value) {\n \tif ($scope.model == undefined) {\n \t\t$scope.model = [];\n \t}\n\n for (var i in $scope.model) {\n if ($scope.model[i][\"value\"] == value.value) {\n $scope.model.splice(i, 1);\n return;\n }\n }\n $scope.model.push({'value': value.value});\n }\n\n $scope.isChecked = function(item) {\n for (var i in $scope.model) {\n if ($scope.model[i][\"value\"] == item.value) {\n return true;\n }\n }\n return false;\n }\n }],\n link: function(scope) {\n scope.random = Math.random().toString(36).substring(7);\n },\n template: function() {\n return '
' +\n '
' +\n '' +\n '
' +\n '
' +\n\n '
' +\n '
' +\n 'search' +\n '
' +\n '' +\n\n '{{optionitems.length}} ' + i18n['js_dir_till'] + ' {{options.items.length}}' +\n '
' +\n\n '
' +\n '' +\n '' +\n '
' +\n '
' +\n '
';\n }\n }\n });\n\n /**\n * https://github.com/720kb/angular-datepicker#date-validation - Date Picker\n * http://jsfiddle.net/bateast/Q6py9/1/ - Date Parse\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date - Date Objects\n * https://docs.angularjs.org/api/ng/filter/date - Angular Date Filter\n *\n * resetable: 1/0, This will enable or disable the ability to press the reset (set to null) button. use integer value\n */\n zaa.directive(\"zaaDatetime\", function() {\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"id\": \"@fieldid\",\n \"i18n\": \"@i18n\",\n \"resetable\" : \"@resetable\",\n },\n controller: ['$scope', '$filter', function($scope, $filter) {\n\n \t$scope.isNumeric = function(num) {\n \t return !isNaN(num)\n \t}\n\n \t$scope.$watch(function() { return $scope.model }, function(n, o) {\n \t\tif (n != null && n != undefined) {\n \t\t\tvar datep = new Date(n*1000);\n \t\t\t$scope.pickerPreselect = datep;\n \t\t\t$scope.date = $filter('date')(datep, 'dd.MM.yyyy');\n \t\t\t$scope.hour = $filter('date')(datep, 'H');\n \t\t\t$scope.min = $filter('date')(datep, 'm');\n \t\t} else {\n \t\t\t$scope.date = null;\n \t\t\t$scope.model = null;\n \t\t}\n \t});\n\n \t$scope.refactor = function(n) {\n \t\tif (!$scope.isNumeric($scope.hour) || $scope.hour == '') {\n\t\t\t\t\t\t$scope.hour = \"0\";\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!$scope.isNumeric($scope.min) || $scope.min == '') {\n\t\t\t\t\t\t$scope.min = \"0\";\n\t\t\t\t\t}\n\n \t\tif (n == 'Invalid Date' || n == \"\" || n == 'NaN') {\n \t\t\t\t$scope.date = null;\n \t\t\t\t$scope.model = null;\n \t\t\t} else {\n \t\t\tvar res = n.split(\".\");\n \t\t\tif (res.length == 3) {\n \t\t\t\tif (res[2].length == 4) {\n\n \t\t\t\t\t\tif (parseInt($scope.hour) > 23) {\n \t\t\t\t\t\t\t$scope.hour = 23;\n \t\t\t\t\t\t}\n\n \t\t\t\t\t\tif (parseInt($scope.min) > 59) {\n \t\t\t\t\t\t\t$scope.min = 59;\n \t\t\t\t\t\t}\n\n\t\t \t\t\t\tvar en = res[1] + \"/\" + res[0] + \"/\" + res[2] + \" \" + $scope.hour + \":\" + $scope.min;\n\t\t \t\t\t\t$scope.model = (Date.parse(en)/1000);\n\t\t \t\t\t\t$scope.datePickerToggler = false;\n \t\t\t\t}\n \t\t\t}\n \t\t\t}\n \t}\n\n \t$scope.$watch(function() { return $scope.date }, function(n, o) {\n \t\tif (n != o && n != undefined && n != null) {\n \t\t\t$scope.refactor(n);\n \t\t}\n \t});\n\n \t$scope.autoRefactor = function() {\n \t\t$scope.refactor($scope.date);\n \t};\n\n \t$scope.datePickerToggler = false;\n\n \t$scope.toggleDatePicker = function() {\n \t\t$scope.datePickerToggler = !$scope.datePickerToggler;\n \t};\n\n \t$scope.openDatePicker = function() {\n $scope.datePickerToggler = true;\n };\n\n $scope.closeDatePicker = function() {\n $scope.datePickerToggler = false;\n };\n\n \t$scope.hour = \"0\";\n\n \t$scope.min = \"0\";\n\n \t$scope.reset = function() {\n \t\t$scope.model = null;\n \t};\n\n \t$scope.getIsResetable = function() {\n \t\tif ($scope.resetable) {\n \t\t\treturn parseInt($scope.resetable);\n \t\t}\n\n \t\treturn true;\n \t};\n }],\n template: function() {\n \treturn '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '' +\n '' +\n '
' +\n 'date_range' +\n 'close' +\n '
' +\n '
' +\n \t '
' +\n '
' +\n '
' +\n 'access_time' +\n '
' +\n '' +\n '
' +\n '
' +\n '
:
' +\n '' +\n '
' +\n \t '
' +\n \t '
' +\n '
' +\n '
';\n }\n }\n });\n\n /**\n * resetable: whether rest button is enabled or not.\n */\n zaa.directive(\"zaaDate\", function() {\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"id\": \"@fieldid\",\n \"i18n\": \"@i18n\",\n \"resetable\" : \"@resetable\"\n },\n \tcontroller: ['$scope', '$filter', function($scope, $filter) {\n\n \t$scope.$watch(function() { return $scope.model }, function(n, o) {\n\n \t\tif (n != null && n != undefined) {\n \t\t\tvar datep = new Date(n*1000);\n \t\t\t$scope.pickerPreselect = datep;\n \t\t\t$scope.date = $filter('date')(datep, 'dd.MM.yyyy');\n \t\t} else {\n \t\t\t$scope.date = null;\n \t\t\t$scope.model = null;\n \t\t}\n \t});\n\n \t$scope.refactor = function(n) {\n \t\tif (n == 'Invalid Date' || n == \"\") {\n \t\t\t\t$scope.date = null;\n \t\t\t\t$scope.model = null;\n \t\t\t} else {\n \t\t\tvar res = n.split(\".\");\n \t\t\tif (res.length == 3) {\n \t\t\t\tif (res[2].length == 4) {\n \t\t\t\t\tvar en = res[1] + \"/\" + res[0] + \"/\" + res[2];\n\t\t \t\t\t\t$scope.model = (Date.parse(en)/1000);\n\t\t \t\t\t\t$scope.datePickerToggler = false;\n \t\t\t\t}\n \t\t\t}\n \t\t\t}\n \t}\n\n \t$scope.$watch(function() { return $scope.date }, function(n, o) {\n \t\tif (n != o && n != undefined && n != null) {\n \t\t\t$scope.refactor(n);\n \t\t}\n \t});\n\n \t$scope.autoRefactor = function() {\n \t\t$scope.refactor($scope.date);\n \t};\n\n \t$scope.datePickerToggler = false;\n\n \t$scope.toggleDatePicker = function() {\n \t\t$scope.datePickerToggler = !$scope.datePickerToggler;\n \t};\n\n $scope.openDatePicker = function() {\n $scope.datePickerToggler = true;\n };\n\n $scope.closeDatePicker = function() {\n $scope.datePickerToggler = false;\n };\n\n $scope.reset = function() {\n \t\t$scope.model = null;\n \t};\n\n \t$scope.getIsResetable = function() {\n \t\tif ($scope.resetable) {\n \t\t\treturn parseInt($scope.resetable);\n \t\t}\n\n \t\treturn true;\n \t};\n }],\n template: function() {\n \treturn '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '' +\n '' +\n '
' +\n 'date_range' +\n 'close' +\n '
' +\n '
' +\n '
' +\n '
' +\n '
';\n }\n }\n });\n\n zaa.directive(\"zaaTable\", function() {\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n },\n controller: ['$scope', function($scope) {\n\n if ($scope.model == undefined) {\n $scope.model = [{0:''}];\n }\n\n $scope.addColumn = function() {\n var len = 0;\n for (var o in $scope.model[0]) {\n len++;\n }\n\n for(var i in $scope.model) {\n $scope.model[i][len] = '';\n }\n }\n\n $scope.addRow = function() {\n var elmn = $scope.model[0];\n var ins = {};\n for (var i in elmn) {\n ins[i] = '';\n }\n\n $scope.model.push(ins);\n }\n\n $scope.removeColumn = function(key) {\n for (var i in $scope.model) {\n var item = $scope.model[i];\n if(item instanceof Array) {\n item.splice(key, 1);\n } else {\n delete item[key];\n }\n }\n }\n\n $scope.moveLeft = function(index) {\n index = parseInt(index);\n for (var i in $scope.model) {\n var oldValue = $scope.model[i][index];\n $scope.model[i][index] = $scope.model[i][index-1];\n $scope.model[i][index-1] = oldValue;\n }\n }\n\n $scope.moveRight = function(index) {\n index = parseInt(index);\n for (var i in $scope.model) {\n var oldValue = $scope.model[i][index];\n $scope.model[i][index] = $scope.model[i][index+1];\n $scope.model[i][index+1] = oldValue;\n }\n }\n\n $scope.moveUp = function(index) {\n index = parseInt(index);\n var oldRow = $scope.model[index];\n $scope.model[index] = $scope.model[index-1];\n $scope.model[index-1] = oldRow;\n }\n\n $scope.moveDown = function(index) {\n index = parseInt(index);\n var oldRow = $scope.model[index];\n $scope.model[index] = $scope.model[index+1];\n $scope.model[index+1] = oldRow;\n }\n\n $scope.removeRow = function(key) {\n $scope.model.splice(key, 1);\n }\n\n $scope.showRightButton = function(index) {\n if (parseInt(index) < Object.keys($scope.model[0]).length - 1) {\n return true;\n }\n return false;\n }\n $scope.showDownButton = function(index) {\n if (parseInt(index) < Object.keys($scope.model).length - 1) {\n return true;\n }\n return false;\n }\n }],\n template: function() {\n return '
' +\n '
' +\n '' +\n '' +\n '
' +\n '
' +\n '
' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n ''+\n '' +\n '' +\n '
' +\n '
' +\n '' +\n '' +\n '' +\n '
' +\n '
' +\n '
' +\n '' +\n '' +\n '' +\n '
' +\n '
'+\n ''+\n '
' +\n ''+\n ''+\n '
' +\n '
' +\n '
';\n }\n }\n });\n\n zaa.directive(\"zaaFileUpload\", function(){\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n },\n template: function() {\n return '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '' +\n '
' +\n '
';\n }\n }\n });\n\n zaa.directive(\"zaaImageUpload\", function(){\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n },\n template: function() {\n return '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '' +\n '
' +\n '
';\n }\n }\n });\n\n zaa.directive(\"zaaImageArrayUpload\", function(){\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n },\n link: function(scope, element, attributes){\n scope.$watch('model', function(newValue, oldValue) {\n if(newValue.length >= 1) {\n $(element).removeClass('is-empty').addClass('is-not-empty');\n } else {\n $(element).removeClass('is-not-empty').addClass('is-empty');\n }\n }, true);\n },\n controller: ['$scope', function($scope) {\n if ($scope.model == undefined) {\n $scope.model = [];\n }\n\n $scope.add = function() {\n \tif ($scope.model == null || $scope.model == '' || $scope.model == undefined) {\n \t\t$scope.model = [];\n \t}\n $scope.model.push({ imageId : 0, caption : '' });\n };\n\n $scope.remove = function(key) {\n $scope.model.splice(key, 1);\n };\n\n $scope.moveUp = function(index) {\n index = parseInt(index);\n var oldRow = $scope.model[index];\n $scope.model[index] = $scope.model[index-1];\n $scope.model[index-1] = oldRow;\n };\n\n $scope.moveDown = function(index) {\n index = parseInt(index);\n var oldRow = $scope.model[index];\n $scope.model[index] = $scope.model[index+1];\n $scope.model[index+1] = oldRow;\n };\n\n $scope.showDownButton = function(index) {\n if (parseInt(index) < Object.keys($scope.model).length - 1) {\n return true;\n }\n return false;\n };\n }],\n template: function() {\n return '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
' +\n '

0\">'+i18n['js_dir_no_selection']+'

' +\n '
' +\n '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
' +\n '' +\n '' +\n '
' +\n '
' +\n '
' +\n '
' +\n '
' +\n '' +\n '' +\n '' +\n '
' +\n '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
';\n }\n }\n });\n\n /**\n * Multiple selection of files.\n */\n zaa.directive(\"zaaFileArrayUpload\", function(){\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n },\n controller: ['$scope', '$element', '$timeout', function($scope, $element, $timeout) {\n\n if ($scope.model == undefined) {\n $scope.model = [];\n }\n\n $scope.add = function() {\n \tif ($scope.model == null || $scope.model == '' || $scope.model == undefined) {\n \t\t$scope.model = [];\n \t}\n $scope.model.push({ fileId : 0, caption : '' });\n };\n\n $scope.remove = function(key) {\n $scope.model.splice(key, 1);\n };\n\n $scope.moveUp = function(index) {\n index = parseInt(index);\n var oldRow = $scope.model[index];\n $scope.model[index] = $scope.model[index-1];\n $scope.model[index-1] = oldRow;\n };\n\n $scope.moveDown = function(index) {\n index = parseInt(index);\n var oldRow = $scope.model[index];\n $scope.model[index] = $scope.model[index+1];\n $scope.model[index+1] = oldRow;\n };\n\n $scope.showDownButton = function(index) {\n if (parseInt(index) < Object.keys($scope.model).length - 1) {\n return true;\n }\n return false;\n };\n }],\n template: function() {\n return '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
' +\n '

0\">'+i18n['js_dir_no_selection']+'

' +\n '
' +\n \t'' +\n '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
' +\n '' +\n '' +\n '
' +\n '
' +\n '
' +\n '
' +\n '
' +\n '' +\n '' +\n '' +\n '
' +\n '
' +\n '
' +\n '
' +\n '' +\n '
' +\n '
';\n }\n }\n });\n\n /**\n * Generates an array where each array element can contain another directive from zaa types.\n *\n * @retunr array\n */\n zaa.directive(\"zaaMultipleInputs\", function() {\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n },\n controller: ['$scope', '$timeout', function ($scope, $timeout) {\n $scope.init = function() {\n if ($scope.model == undefined || $scope.model == null) {\n $scope.model = [];\n } else {\n \tangular.forEach($scope.model, function(value, key) {\n \t\tvar len = Object.keys(value).length;\n \t\t/* issue #1519: if there are no keys, ensure the item is an object */\n \t\tif (len == 0) {\n \t\t\t$scope.model[key] = {};\n \t\t}\n \t})\n }\n };\n\n $scope.add = function() {\n if ($scope.model == null || $scope.model == '' || $scope.model == undefined) {\n $scope.model = [];\n }\n\n $scope.model.push({});\n };\n\n $scope.remove = function(key) {\n $scope.model.splice(key, 1);\n };\n\n $scope.moveUp = function(index) {\n index = parseInt(index);\n var oldRow = $scope.model[index];\n $scope.model[index] = $scope.model[index-1];\n $scope.model[index-1] = oldRow;\n };\n\n $scope.moveDown = function(index) {\n index = parseInt(index);\n var oldRow = $scope.model[index];\n $scope.model[index] = $scope.model[index+1];\n $scope.model[index+1] = oldRow;\n };\n\n $scope.showDownButton = function(index) {\n return parseInt(index) < Object.keys($scope.model).length - 1;\n };\n\n $timeout(function() {\n \t$scope.init();\n });\n }],\n template: function() {\n return '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
' +\n '

0\">'+i18n['js_dir_no_selection']+'

' +\n '
' +\n '
' +\n '
' +\n '
' +\n '' +\n '' +\n '' +\n '
' +\n '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
';\n }\n }\n });\n\n zaa.directive(\"zaaListArray\", function() {\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n },\n controller: ['$scope', '$element', '$timeout', function($scope, $element, $timeout) {\n\n $scope.init = function() {\n \tif ($scope.model == undefined || $scope.model == null) {\n $scope.model = [];\n }\n };\n\n $scope.add = function() {\n \tif ($scope.model == null || $scope.model == '' || $scope.model == undefined) {\n \t\t$scope.model = [];\n \t}\n $scope.model.push({ value : '' });\n $scope.setFocus();\n };\n\n $scope.remove = function(key) {\n $scope.model.splice(key, 1);\n };\n\n $scope.refactor = function(key, row) {\n if (key !== ($scope.model.length -1)) {\n if (row['value'] == \"\") {\n $scope.remove(key);\n }\n }\n };\n\n $scope.setFocus = function() {\n $timeout(function() {\n var input = $element.children('.list').children('.list__item:last-of-type').children('.list__left').children('input');\n\n if(input.length == 1) {\n input[0].focus();\n }\n }, 50);\n };\n\n $scope.moveUp = function(index) {\n index = parseInt(index);\n var oldRow = $scope.model[index];\n $scope.model[index] = $scope.model[index-1];\n $scope.model[index-1] = oldRow;\n }\n\n $scope.moveDown = function(index) {\n index = parseInt(index);\n var oldRow = $scope.model[index];\n $scope.model[index] = $scope.model[index+1];\n $scope.model[index+1] = oldRow;\n }\n\n $scope.showDownButton = function(index) {\n if (parseInt(index) < Object.keys($scope.model).length - 1) {\n return true;\n }\n return false;\n }\n\n $scope.init();\n\n }],\n template: function() {\n return '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
' +\n '

0\">'+i18n['js_dir_no_selection']+'

' +\n '
' +\n '' +\n '
' +\n '
' +\n '' +\n '' +\n '' +\n '
' +\n '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
';\n }\n }\n });\n // storage.js\n\n zaa.directive('storageFileUpload', function() {\n return {\n restrict : 'E',\n scope : {\n ngModel : '='\n },\n controller: ['$scope', '$filter', 'ServiceFilesData', function($scope, $filter, ServiceFilesData) {\n\n // ServiceFilesData inhertiance\n\n \t/*\n \t$scope.filesData = ServiceFilesData.data;\n\n \t$scope.$on('service:FilesData', function(event, data) {\n \t\t$scope.filesData = data;\n });\n */\n\n // controller logic\n\n \t$scope.modal = {state: 1};\n\n \t$scope.modalContainer = false;\n\n \t$scope.fileinfo = null;\n\n \t$scope.select = function(fileId) {\n \t$scope.toggleModal();\n \t$scope.ngModel = fileId;\n };\n\n \t$scope.reset = function() {\n \t\t$scope.ngModel = 0;\n \t\t$scope.fileinfo = null;\n };\n\n \t$scope.toggleModal = function() {\n \t\t$scope.modalContainer = !$scope.modalContainer;\n \t\t$scope.modal.state = !$scope.modal.state;\n };\n\n \t$scope.$watch(function() { return $scope.ngModel }, function(n, o) {\n if (n != 0 && n != null && n !== undefined) {\n \t/*\n var filtering = $filter('filter')($scope.filesData, {id: parseInt(n)}, true);\n if (filtering && filtering.length == 1) {\n \t$scope.fileinfo = filtering[0];\n }\n */\n ServiceFilesData.getFile(n).then(function(response) {\n \t$scope.fileinfo = response;\n });\n }\n\n /* reset file directive if an event resets the image model to undefined */\n if (n == 0) {\n \t$scope.reset();\n }\n });\n }],\n templateUrl : 'storageFileUpload'\n }\n });\n\n zaa.directive('storageFileDisplay', function() {\n \treturn {\n \t\trestrict: 'E',\n \t\tscope: {\n \t\t\tfileId: '@fileId'\n \t\t},\n \t\tcontroller: ['$scope', '$filter', 'ServiceFilesData', function($scope, $filter, ServiceFilesData) {\n\n \t\t\t// ServiceFilesData inheritance\n\n $scope.filesData = ServiceFilesData.data;\n\n $scope.$on('service:FilesData', function(event, data) {\n $scope.filesData = data;\n });\n\n // controller\n\n $scope.fileinfo = null;\n\n $scope.$watch('fileId', function(n, o) {\n if (n != 0 && n != null && n !== undefined) {\n \t\n \t$scope.ServiceFilesData.getFile(n).then(function(file) {\n \t\t$scope.fileinfo = file;\n \t});\n \t/*\n \tvar filtering = $filter('filter')($scope.filesData, {id: parseInt(n)}, true);\n if (filtering && filtering.length == 1) {\n \t$scope.fileinfo = filtering[0];\n }\n */\n }\n });\n \t\t}],\n \t\ttemplate: function() {\n return '
{{ fileinfo.name }}
';\n }\n \t}\n });\n\n zaa.directive('storageImageThumbnailDisplay', function() {\n return {\n restrict: 'E',\n scope: {\n imageId: '@imageId'\n },\n controller: ['$scope', '$filter', 'ServiceImagesData', 'ServiceFilesData', function($scope, $filter, ServiceImagesData, ServiceFilesData) {\n\n // ServiceFilesData inheritance\n\n $scope.filesData = ServiceFilesData.data;\n\n $scope.$on('service:FilesData', function(event, data) {\n $scope.filesData = data;\n });\n\n // ServiceImagesData inheritance\n\n /*\n $scope.imagesData = ServiceImagesData.data;\n\n $scope.$on('service:ImagesData', function(event, data) {\n $scope.imagesData = data;\n });\n */\n\n // controller logic\n\n $scope.$watch(function() { return $scope.imageId }, function(n, o) {\n if (n != 0 && n !== undefined) {\n\n \tServiceImagesData.getImage(n).then(function(response) {\n \t\tconsole.log(response);\n \t});\n \t\n \t/*\n \t * TODO USE getImage\n var filtering = $filter('findidfilter')($scope.imagesData, n, true);\n\n var file = $filter('findidfilter')($scope.filesData, filtering.fileId, true);\n\n if (file && file.thumbnail) {\n \t$scope.imageSrc = file.thumbnail.source;\n }\n */\n }\n });\n\n $scope.imageSrc = null;\n }],\n template: function() {\n return '
';\n }\n }\n });\n\n zaa.directive('storageImageUpload', function() {\n return {\n restrict : 'E',\n scope : {\n ngModel : '=',\n options : '=',\n },\n controller : ['$scope', '$http', '$filter', 'ServiceFiltersData', 'ServiceImagesData', 'AdminToastService', 'ServiceFilesData', function($scope, $http, $filter, ServiceFiltersData, ServiceImagesData, AdminToastService, ServiceFilesData) {\n\n // ServiceImagesData inheritance\n\n \t\t/*\n $scope.imagesData = ServiceImagesData.data;\n\n $scope.$on('service:ImagesData', function(event, data) {\n $scope.imagesData = data;\n });\n\n $scope.imagesDataReload = function() {\n return ServiceImagesData.load(true);\n }\n */\n\n // ServiceFiltesrData inheritance\n\n $scope.filtersData = ServiceFiltersData.data;\n\n $scope.$on('service:FiltersData', function(event, data) {\n $scope.filtersData = data;\n });\n\n // controller logic\n\n $scope.noFilters = function() {\n if ($scope.options) {\n return $scope.options.no_filter;\n }\n }\n\n $scope.thumbnailfilter = null;\n\n $scope.imageLoading = false;\n\n $scope.fileId = 0;\n\n $scope.filterId = 0;\n\n $scope.imageinfo = null;\n\n $scope.imageNotFoundError = false;\n\n $scope.filterApply = function() {\n\n ServiceFilesData.getFile($scope.fileId).then(function(response) {\n var images = $filter('filter')(response.images, {filterId: $scope.filterId}, true);\n\n // unable to find the image for the given filter, create the image for the filter\n if (images.length == 0) {\n $http.post('admin/api-admin-storage/image-filter', { fileId : $scope.fileId, filterId : $scope.filterId}).then(function(uploadResponse) {\n $scope.ngModel = uploadResponse.data.id;\n AdminToastService.success(i18n['js_dir_image_upload_ok']);\n $scope.imageLoading = false;\n });\n }\n });\n \n \t/*\n var items = $filter('filter')($scope.imagesData, {fileId: $scope.fileId, filterId: $scope.filterId}, true);\n if (items && items.length == 0) {\n $scope.imageLoading = true;\n // image does not exists make request.\n $http.post('admin/api-admin-storage/image-upload', $.param({ fileId : $scope.fileId, filterId : $scope.filterId }), {\n headers : {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}\n }).then(function(transport) {\n if (!transport.data.error) {\n $scope.imagesDataReload().then(function(r) {\n $scope.ngModel = transport.data.id;\n AdminToastService.success(i18n['js_dir_image_upload_ok']);\n $scope.imageLoading = false;\n });\n }\n }, function(error) {\n \tAdminToastService.error(i18n['js_dir_image_filter_error']);\n $scope.imageLoading = false;\n });\n } else {\n var item = items[0];\n $scope.ngModel = item.id\n $scope.imageinfo = item;\n }\n */\n };\n\n $scope.$watch(function() { return $scope.filterId }, function(n, o) {\n if (n != null && n !== undefined && $scope.fileId !== 0 && n !== o && n != o) {\n $scope.filterApply();\n }\n });\n\n $scope.$watch(function() { return $scope.fileId }, function(n, o) {\n \tif (n !== undefined && n != null && n != o) {\n \t\tif (n == 0) {\n $scope.filterId = 0;\n $scope.imageinfo = null;\n $scope.ngModel = 0;\n } else {\n \t$scope.filterApply();\n }\n }\n });\n\n $scope.$watch(function() { return $scope.ngModel }, function(n, o) {\n if (n != 0 && n != null && n !== undefined) {\n //var filtering = $filter('findidfilter')($scope.imagesData, n, true);\n ServiceImagesData.getImage(n).then(function(response) {\n \t$scope.imageinfo = response;\n });\n /*\n if (filtering) {\n $scope.imageinfo = filtering;\n $scope.filterId = filtering.filterId;\n $scope.fileId = filtering.fileId;\n } else {\n \t$scope.imageNotFoundError = true;\n }\n */\n }\n /* reset image preview directive if an event resets the image model to undefined */\n if (n == undefined || n == 0) {\n \t$scope.fileId = 0;\n $scope.filterId = 0;\n $scope.imageinfo = null;\n $scope.thumb = false;\n }\n\n });\n\n $scope.thumb = false;\n\n $scope.getThumbnailFilter = function() {\n \tif ($scope.thumbnailfilter === null) {\n \t\tif ('medium-thumbnail' in $scope.filtersData) {\n \t\t\t$scope.thumbnailfilter = $scope.filtersData['medium-thumbnail'];\n \t\t}\n \t}\n \treturn $scope.thumbnailfilter;\n }\n\n $scope.$watch('imageinfo', function(n, o) {\n \tif (n != 0 && n != null && n !== undefined) {\n \t\tif (n.filterId != 0) {\n \t\t\t$scope.thumb = n;\n \t\t} else {\n \t\t\tvar result = $filter('findthumbnail')($scope.imagesData, n.fileId, $scope.getThumbnailFilter().id);\n \t\t\tif (!result) {\n \t\t\t\t$scope.thumb = n;\n \t\t\t} else {\n \t\t\t\t$scope.thumb = result;\n \t\t\t}\n \t\t}\n \t}\n })\n }],\n templateUrl : 'storageImageUpload'\n }\n });\n\n /**\n * FILE MANAGER DIR\n */\n zaa.directive(\"storageFileManager\", function() {\n return {\n restrict : 'E',\n transclude : false,\n scope : {\n allowSelection : '@selection',\n onlyImages : '@onlyImages'\n },\n controller : [\n \t'$scope', '$http', '$filter', '$timeout', 'Upload', 'ServiceFoldersData', 'ServiceFilesData', 'LuyaLoading', 'AdminToastService', 'ServiceFoldersDirecotryId', \n \tfunction($scope, $http, $filter, $timeout, Upload, ServiceFoldersData, ServiceFilesData, LuyaLoading, AdminToastService, ServiceFoldersDirecotryId) {\n\n // ServiceFoldersData inheritance\n\n $scope.foldersData = ServiceFoldersData.data;\n\n $scope.$on('service:FoldersData', function(event, data) {\n $scope.foldersData = data;\n });\n\n $scope.foldersDataReload = function() {\n return ServiceFoldersData.load(true);\n };\n\n // ServiceFilesData inheritance\n\n $scope.filesData = [];\n\n $scope.paginations = [];\n \n // load files data for a given folder id\n $scope.$watch('currentFolderId', function(folderId) {\n \t$scope.getFilesForPageAndFolder(folderId, 0);\n });\n\n $scope.getFilesForPageAndFolder = function(folderId, pageId) {\n \t$http.get('admin/api-admin-storage/data-files?folderId='+folderId+'&page='+pageId).then(function(response) {\n $scope.filesData = response.data.data;\n $scope.filesMetaToPagination(response.data.__meta);\n \t});\n };\n\n $scope.filesMetaToPagination = function(meta) {\n var pages = [];\n console.log(meta);\n for (i = 0; i < meta.totalPages; i++) {\n var isActive = meta.currentPage == i;\n pages.push({isActive: isActive, label: i+1, index: i});\n }\n $scope.paginations = pages;\n };\n\n $scope.getFilesForPage = function(pageId) {\n $scope.getFilesForPageAndFolder($scope.currentFolderId, pageId);\n };\n \n // ServiceFolderId\n\n $scope.currentFolderId = ServiceFoldersDirecotryId.folderId;\n\n $scope.$on('FoldersDirectoryId', function(event, folderId) {\n \t$scope.currentFolderId = folderId;\n });\n\n $scope.foldersDirecotryIdReload = function() {\n \treturn ServiceFoldersDirecotryId.load(true);\n }\n\n // file replace logic\n\n $scope.folderCountMessage = function(folder) {\n \treturn i18nParam('js_filemanager_count_files_overlay', {count: folder.filesCount});\n }\n\n $scope.errorMsg = null;\n\n $scope.replaceFile = function(file, errorFiles) {\n \t$scope.replaceFiled = file;\n\n \tif (!file) {\n \t\treturn;\n \t}\n\n \tLuyaLoading.start();\n\n \tUpload.upload({\n \t\turl: 'admin/api-admin-storage/file-replace',\n data: {file: file, fileId: $scope.fileDetail.id}\n }).then(function (response) {\n \tLuyaLoading.stop();\n \tif (response.status == 200) {\n //$scope.filesDataReload().then(function() {\n \tvar fileref = $filter('findidfilter')($scope.filesData, $scope.fileDetail.id, true);\n \tvar random = (new Date()).toString();\n \tif (fileref.isImage) {\n\t \tfileref.thumbnail.source = fileref.thumbnail.source + \"?cb=\" + random;\n\t \tfileref.thumbnailMedium.source = fileref.thumbnailMedium.source + \"?cb=\" + random;\n\t }\n \t$scope.fileDetail = fileref;\n \tAdminToastService.success('the file has been replaced successfull.');\n //});\n \t}\n }, function() {\n \tLuyaLoading.stop();\n });\n };\n\n // upload logic\n\n $scope.$watch('uploadingfiles', function (uploadingfiles) {\n if (uploadingfiles != null) {\n $scope.uploadResults = 0;\n LuyaLoading.start(i18n['js_dir_upload_wait']);\n for (var i = 0; i < uploadingfiles.length; i++) {\n $scope.errorMsg = null;\n (function (uploadingfiles) {\n $scope.uploadUsingUpload(uploadingfiles);\n })(uploadingfiles[i]);\n }\n }\n });\n\n $scope.$watch('uploadResults', function(n, o) {\n if ($scope.uploadingfiles != null) {\n if (n == $scope.uploadingfiles.length && $scope.errorMsg == null) {\n //$scope.filesDataReload().then(function() {\n \tAdminToastService.success(i18n['js_dir_manager_upload_image_ok']);\n LuyaLoading.stop();\n //});\n }\n }\n })\n\n $scope.pasteUpload = function(e) {\n\n for (var i = 0 ; i < e.originalEvent.clipboardData.items.length ; i++) {\n var item = e.originalEvent.clipboardData.items[i];\n\n if (item.kind == 'file') {\n \tLuyaLoading.start(i18n['js_dir_upload_wait']);\n\t Upload.upload({\n\t url: 'admin/api-admin-storage/files-upload',\n\t fields: {'folderId': $scope.currentFolderId},\n\t file: item.getAsFile()\n\t }).then(function(response) {\n \t\tif (response.data.upload) {\n\t\t \t//$scope.filesDataReload().then(function() {\n\t\t \tAdminToastService.success(i18n['js_dir_manager_upload_image_ok']);\n\t\t \tLuyaLoading.stop();\n\t\t //});\n \t\t} else {\n \t\t\tAdminToastService.error(response.data.message);\n \t\t\tLuyaLoading.stop();\n \t\t}\n\n\t })\n }\n }\n }\n\n $scope.uploadUsingUpload = function(file) {\n \tfile.upload = Upload.upload({\n url: 'admin/api-admin-storage/files-upload',\n fields: {'folderId': $scope.currentFolderId},\n file: file\n });\n\n file.upload.then(function (response) {\n $timeout(function () {\n $scope.uploadResults++;\n file.processed = true;\n file.result = response.data;\n if (!file.result.upload) {\n \tAdminToastService.error(file.result.message);\n \tLuyaLoading.stop();\n $scope.errorMsg = true\n }\n });\n }, function (response) {\n if (response.status > 0) {\n $scope.errorMsg = true;\n }\n });\n\n file.upload.progress(function (evt) {\n file.processed = false;\n // Math.min is to fix IE which reports 200% sometimes\n file.progress = Math.min(100, parseInt(100.0 * evt.loaded / evt.total));\n });\n }\n\n // selector logic\n\n $scope.selectedFiles = [];\n\n $scope.toggleSelectionAll = function() {\n \tvar files = $filter('filemanagerfilesfilter')($scope.filesData, $scope.currentFolderId, $scope.onlyImages);\n \tfiles.forEach(function(value, key) {\n \t\t$scope.toggleSelection(value);\n \t})\n }\n\n $scope.toggleSelection = function(file) {\n if ($scope.allowSelection == 'true') {\n // parent inject\n $scope.$parent.select(file.id);\n return;\n }\n\n var i = $scope.selectedFiles.indexOf(file.id);\n if (i > -1) {\n $scope.selectedFiles.splice(i, 1);\n } else {\n $scope.selectedFiles.push(file.id);\n }\n };\n\n $scope.inSelection = function(file) {\n var response = $scope.selectedFiles.indexOf(file.id);\n\n if (response != -1) {\n return true;\n }\n\n return false;\n };\n\n // folder add\n\n $scope.showFolderForm = false;\n\n $scope.createNewFolder = function(newFolderName) {\n \tif (!newFolderName) {\n \t\treturn;\n \t}\n $http.post('admin/api-admin-storage/folder-create', $.param({ folderName : newFolderName , parentFolderId : $scope.currentFolderId }), {\n headers : {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}\n }).then(function() {\n $scope.foldersDataReload().then(function() {\n $scope.folderFormToggler();\n $scope.newFolderName = null;\n })\n });\n };\n\n $scope.folderFormToggler = function() {\n $scope.showFolderForm = !$scope.showFolderForm;\n };\n\n // controller logic\n\n $scope.searchQuery = '';\n\n $scope.sortField = 'name';\n\n $scope.changeSortField = function(name) {\n \t$scope.sortField = name;\n };\n\n $scope.changeCurrentFolderId = function(folderId, noState) {\n $scope.currentFolderId = folderId;\n if (noState !== true) {\n \tServiceFoldersDirecotryId.folderId = folderId;\n \t$http.post('admin/api-admin-common/save-filemanager-folder-state', {folderId : folderId}, {ignoreLoadingBar: true});\n }\n };\n\n $scope.toggleFolderItem = function(data) {\n if (data.toggle_open == undefined) {\n data['toggle_open'] = 1;\n } else {\n data['toggle_open'] = !data.toggle_open;\n }\n $http.post('admin/api-admin-common/filemanager-foldertree-history', {data : data}, {ignoreLoadingBar: true});\n };\n\n $scope.folderUpdateForm = false;\n\n $scope.folderDeleteForm = false;\n\n $scope.folderDeleteConfirmForm = false;\n \n $scope.updateFolder = function(folder) {\n $http.post('admin/api-admin-storage/folder-update?folderId=' + folder.id, $.param({ name : folder.name }), {\n headers : {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}\n });\n };\n \n $scope.deleteFolder = function(folder) {\n\n // check if folder is empty\n \t$http.post('admin/api-admin-storage/is-folder-empty?folderId=' + folder.id, $.param({ name : folder.name }), {\n headers : {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}\n }).then(function(transport) {\n if (transport.data == true) {\n\n $http.post('admin/api-admin-storage/folder-delete?folderId=' + folder.id, $.param({ name : folder.name }), {\n headers : {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}\n }).then(function(transport) {\n $scope.foldersDataReload().then(function() {\n //$scope.filesDataReload().then(function() {\n $scope.currentFolderId = 0;\n //});\n });\n });\n\n } else {\n AdminToastService.confirm(i18nParam('layout_filemanager_remove_dir_not_empty', {folderName: folder.name, count: folder.filesCount}), i18n['js_dir_manager_rm_folder_confirm_title'], ['$timeout', '$toast', function($timeout, $toast) {\n $http.post('admin/api-admin-storage/folder-delete?folderId=' + folder.id, $.param({ name : folder.name }), {\n headers : {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}\n }).then(function() {\n $scope.foldersDataReload().then(function() {\n //$scope.filesDataReload().then(function() {\n $scope.currentFolderId = 0;\n $toast.close();\n //});\n });\n });\n }]);\n }\n });\n };\n\n $scope.fileDetail = false;\n\n $scope.showFoldersToMove = false;\n\n $scope.largeImagePreviewState = true;\n \n $scope.fileDetailFull = false;\n \n $scope.nameEditMode = false;\n \n $scope.openFileDetail = function(file) {\n \tif ($scope.fileDetail.id == file.id) {\n \t\t$scope.closeFileDetail();\n \t} else {\n \t\t\n \t\tServiceFilesData.getFile(file.id).then(function(responseFile) {\n \t\t\t$scope.fileDetailFull = responseFile;\n \t\t});\n \t\t\n \t\t$scope.fileDetail = file;\n \t}\n };\n \n $scope.updateFileData = function() {\n \t\t$http.put('admin/api-admin-storage/file-update?id='+$scope.fileDetailFull.id, $scope.fileDetailFull).then(function(response) {\n \t\t\tvar file = $filter('findidfilter')($scope.filesData, $scope.fileDetail.id, true);\n \t\t\tfile.name = response.data.name_original;\n \t\t\t$scope.nameEditMode = false;\n \t\t});\n };\n\n $scope.closeFileDetail = function() {\n $scope.fileDetail = false;\n $scope.fileDetailFull = false;\n $scope.nameEditMode = false;\n };\n \n $scope.removeFile = function(detail) {\n \t$scope.selectedFiles = [];\n \t$scope.toggleSelection(detail);\n \t$scope.removeFiles();\n };\n\n $scope.moveFilesTo = function(folderId) {\n $http.post('admin/api-admin-storage/filemanager-move-files', $.param({'fileIds' : $scope.selectedFiles, 'toFolderId' : folderId}), {\n headers : {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}\n }).then(function(transport) {\n //$scope.filesDataReload().then(function() {\n $scope.selectedFiles = [];\n $scope.showFoldersToMove = false;\n //});\n });\n };\n\n $scope.removeFiles = function() {\n AdminToastService.confirm(i18n['js_dir_manager_rm_file_confirm'], i18n['js_dir_manager_rm_file_confirm_title'], ['$timeout', '$toast', function($timeout, $toast) {\n $http.post('admin/api-admin-storage/filemanager-remove-files', $.param({'ids' : $scope.selectedFiles}), {\n headers : {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}\n }).then(function(transport) {\n //$scope.filesDataReload().then(function() {\n $toast.close();\n AdminToastService.success(i18n['js_dir_manager_rm_file_ok']);\n $scope.selectedFiles = [];\n \t$scope.closeFileDetail();\n //});\n });\n }]);\n }\n\n // file detail view logic\n\n $scope.storeFileCaption = function(fileDetail) {\n \t$http.post('admin/api-admin-storage/filemanager-update-caption', $.param({'id': fileDetail.id, 'captionsText' : fileDetail.captionArray}), {\n headers : {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}\n }).then(function(transport) {\n \tAdminToastService.success('Captions has been updated');\n });\n }\n\n $scope.selectedFileFromParent = null;\n\n $scope.init = function() {\n \tif ($scope.$parent.fileinfo) {\n \t\t$scope.selectedFileFromParent = $scope.$parent.fileinfo;\n \t\t$scope.changeCurrentFolderId($scope.selectedFileFromParent.folderId, true);\n \t}\n }\n\n $scope.init();\n\n }],\n templateUrl : 'storageFileManager'\n }\n });\n\n zaa.directive(\"hasEnoughSpace\", ['$window', '$timeout', function($window, $timeout) {\n return {\n restrict: \"A\",\n scope: {\n \"loadingCondition\": \"=\",\n \"isFlexBox\": \"=\"\n },\n link: function (scope, element, attrs) {\n scope.elementWidth = 0;\n\n var getElementOriginalWidth = function() {\n var elementClone = element.clone().insertAfter(element);\n\n elementClone.css({\n 'position': 'fixed',\n 'top': 0,\n 'left': 0,\n 'visibility': 'hidden'\n });\n\n if(elementClone.css('display') === 'none') {\n elementClone.css('display', scope.isFlexBox ? 'flex' : 'block');\n }\n\n var elementOriginalWidth = elementClone.outerWidth();\n\n elementClone.remove();\n\n return elementOriginalWidth;\n };\n\n\n function checkSize() {\n $timeout(function() {\n if(!scope.elementOriginalWidth) {\n scope.elementOriginalWidth = getElementOriginalWidth();\n }\n\n if(element.hasClass('not-enough-space')) {\n element.removeClass('not-enough-space');\n element.addClass('has-enough-space');\n }\n\n var currentElementSpace = element.parent().outerWidth();\n\n if(currentElementSpace < scope.elementOriginalWidth) {\n element.removeClass('has-enough-space').addClass('not-enough-space');\n } else {\n element.removeClass('not-enough-space').addClass('has-enough-space');\n }\n });\n }\n\n angular.element($window).on('resize', function() {\n checkSize();\n });\n\n scope.$watch('loadingCondition', function(n) {\n if(n == true) {\n checkSize();\n }\n });\n\n }\n }\n }]);\n\n zaa.directive('activeClass', function () {\n return {\n restrict: 'A',\n scope: {\n activeClass: '@'\n },\n link: function (scope, element) {\n element.on('mouseenter', function() {\n element.addClass(scope.activeClass);\n });\n element.on('mouseleave', function() {\n element.removeClass(scope.activeClass);\n });\n element.on('click', function() {\n element.toggleClass(scope.activeClass);\n });\n }\n };\n });","\n\t\n\tzaa.controller(\"DefaultDashboardObjectController\", ['$scope', '$http', '$sce', function($scope, $http, $sce) {\n\n\t\t$scope.data;\n\n\t\t$scope.loadData = function(dataApiUrl) {\n\t\t\t$http.get(dataApiUrl).then(function(success) {\n\t\t\t\t$scope.data = success.data;\n\t\t\t});\n\t\t};\n\t}]);\n\n\t/**\n\t * Base Crud Controller\n\t *\n\t * Assigned config variables from the php view assigned from child to parent:\n\t *\n\t * + bool $config.inline Determines whether this crud is in inline mode orno\n\t */\n\tzaa.controller(\"CrudController\", ['$scope', '$filter', '$http', '$sce', '$state', '$timeout', '$injector', '$q', 'AdminLangService', 'LuyaLoading', 'AdminToastService', 'CrudTabService', function($scope, $filter, $http, $sce, $state, $timeout, $injector, $q, AdminLangService, LuyaLoading, AdminToastService, CrudTabService) {\n\n\t\t$scope.toast = AdminToastService;\n\n\t\t$scope.AdminLangService = AdminLangService;\n\n\t\t$scope.tabService = CrudTabService;\n\n\t\t/***** TABS AND SWITCHES *****/\n\n\t\t/**\n\t\t * 0 = list\n\t\t * 1 = add\n\t\t * 2 = edit\n\t\t */\n\t\t$scope.crudSwitchType = 0;\n\n\t\t$scope.switchToTab = function(tab) {\n\t\t\tangular.forEach($scope.tabService.tabs, function(item) {\n\t\t\t\titem.active = false;\n\t\t\t});\n\n\t\t\ttab.active = true;\n\n\t\t\t$scope.switchTo(4);\n\t\t};\n\t\t\n\t\t$scope.addAndswitchToTab = function(pk, route, index, label, model) {\n\t\t\t$scope.tabService.addTab(pk, route, index, label, model);\n\t\t\t\n\t\t\t$scope.switchTo(4);\n\t\t}\n\n\t\t$scope.closeTab = function(tab, index) {\n\t\t\t$scope.tabService.remove(index, $scope);\n\t\t};\n\n\t\t$scope.switchTo = function(type, reset) {\n\t\t\tif ($scope.config.relationCall) {\n\t\t\t\t$scope.crudSwitchType = type;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (reset) {\n\t\t\t\t$scope.resetData();\n\t\t\t}\n\n\t\t\tif (type == 0) {\n\t\t\t\t$http.get($scope.config.apiEndpoint + '/unlock');\n\t\t\t}\n\n\t\t\tif (type == 0 || type == 1) {\n\t\t\t\tif (!$scope.config.inline) {\n\t\t\t\t\t$state.go('default.route');\n\t\t\t\t}\n\t\t\t}\n\t\t\t$scope.crudSwitchType = type;\n\n\t\t\tif (type !== 4 && !$scope.config.inline) {\n\t\t\t\tangular.forEach($scope.tabService.tabs, function(item) {\n\t\t\t\t\titem.active = false;\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\t$scope.closeUpdate = function () {\n\t\t\t$scope.switchTo(0, true);\n\t };\n\n\t\t$scope.closeCreate = function() {\n\t\t\t$scope.switchTo(0, true);\n\t\t};\n\n\t\t$scope.activeWindowModal = true;\n\n\t\t$scope.openActiveWindow = function() {\n\t\t\t$scope.activeWindowModal = false;\n\t\t};\n\n\t\t$scope.closeActiveWindow = function() {\n\t\t\t$scope.activeWindowModal = true;\n\t\t};\n\n\t\t$scope.changeGroupByField = function() {\n\t\t\tif ($scope.config.groupByField == 0) {\n\t\t\t\t$scope.config.groupBy = 0;\n\t\t\t} else {\n\t\t\t\t$scope.config.groupBy = 1;\n\t\t\t}\n\t\t};\n\n\t\t/********** EXPORT ****/\n\n\t\t$scope.exportLoading = false;\n\n\t\t$scope.exportResponse = false;\n\n\t\t$scope.exportDownloadButton = false;\n\n\t\t$scope.exportData = function() {\n\t\t\t$scope.exportLoading = true;\n\t\t\t$http.get($scope.config.apiEndpoint + '/export').then(function(response) {\n\t\t\t\t$scope.exportLoading = false;\n\t\t\t\t$scope.exportResponse = response.data;\n\t\t\t\t$scope.exportDownloadButton = true;\n\t\t\t});\n\t\t};\n\n\t\t$scope.exportDownload = function() {\n\t\t\t$scope.exportDownloadButton = false;\n\t\t\twindow.open($scope.exportResponse.url);\n\t\t\treturn false;\n\t\t};\n\n\t\t$scope.applySaveCallback = function() {\n\t\t\tif ($scope.config.saveCallback) {\n\t\t\t\t$injector.invoke($scope.config.saveCallback, this);\n\t\t\t}\n\t\t};\n\n\t\t$scope.showCrudList = true;\n\n\t\t/*********** ORDER **********/\n\n\t\t$scope.isOrderBy = function(field) {\n\t\t\tif (field == $scope.config.orderBy) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t};\n\n\t\t$scope.changeOrder = function(field, sort) {\n\t\t\t$scope.config.orderBy = sort + field;\n\n\t\t\t$http.post('admin/api-admin-common/ngrest-order', {'apiEndpoint' : $scope.config.apiEndpoint, sort: sort, field: field}, { ignoreLoadingBar: true });\n\n\t\t\tif ($scope.pager && !$scope.config.pagerHiddenByAjaxSearch) {\n\t\t\t\t$scope.loadList(1);\n\t\t\t} else {\n\t\t\t\t$scope.data.listArray = $filter('orderBy')($scope.data.listArray, sort + field);\n\t\t\t}\n\t\t};\n\n\t\t$scope.reApplyOrder = function() {\n\t\t\t$scope.data.listArray = $filter('orderBy')($scope.data.listArray, $scope.config.orderBy);\n\t\t};\n\n\t\t/***************** ACTIVE WINDOW *********/\n\n\t\t$scope.reloadActiveWindow = function() {\n\t\t\t$scope.getActiveWindow($scope.data.aw.hash, $scope.data.aw.itemId);\n\t\t}\n\n\t\t$scope.getActiveWindow = function (activeWindowId, id, $event) {\n\t\t\t$http.post($scope.config.activeWindowRenderUrl, $.param({ itemId : id, activeWindowHash : activeWindowId , ngrestConfigHash : $scope.config.ngrestConfigHash }), {\n\t\t\t\theaders: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}\n\t\t\t})\n\t\t\t.then(function(response) {\n\t\t\t\t$scope.openActiveWindow();\n\t\t\t\t$scope.data.aw.itemId = id;\n\t\t\t\t$scope.data.aw.configCallbackUrl = $scope.config.activeWindowCallbackUrl;\n\t\t\t\t$scope.data.aw.configHash = $scope.config.ngrestConfigHash;\n\t\t\t\t$scope.data.aw.hash = activeWindowId;\n\t\t\t\t$scope.data.aw.content = $sce.trustAsHtml(response.data.content);\n\t\t\t\t$scope.data.aw.title = response.data.label;\n\t\t\t\t$scope.$broadcast('awloaded', {id: activeWindowId});\n\t\t\t})\n\t\t};\n\n\t\t$scope.getActiveWindowCallbackUrl = function(callback) {\n\t\t\treturn $scope.data.aw.configCallbackUrl + '?activeWindowCallback=' + callback + '&ngrestConfigHash=' + $scope.data.aw.configHash + '&activeWindowHash=' + $scope.data.aw.hash;\n\t\t};\n\n\t\t/**\n\t\t * new returns a promise promise.hten(function(answer) {\n\t\t * \n\t\t * }, function(error) {\n\t\t * \n\t\t * }, function(progress) {\n\t\t * \n\t\t * });\n\t\t *\n\t\t * instead of return variable\n\t\t */\n\t\t$scope.sendActiveWindowCallback = function(callback, data) {\n\t\t\tvar data = data || {};\n\t\t\treturn $http.post($scope.getActiveWindowCallbackUrl(callback), $.param(data), {\n\t\t\t\theaders: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}\n\t\t\t});\n\t\t};\n\n\t\t/*************** SEARCH ******************/\n\n\n\t\t$scope.$watch('config.searchQuery', function(n, o) {\n\t\t\tif (n == o || n == undefined || n == null) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t$scope.applySearchQuery(n);\n\t\t});\n\n\t\t$scope.applySearchQuery = function(n) {\n\t\t\tif (n == undefined || n == null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar blockRequest = false;\n\t\t\tif ($scope.pager) {\n\t\t\t\tif (n.length == 0) {\n\t\t\t\t\t$timeout.cancel($scope.searchPromise);\n\t\t\t\t\t$scope.data.listArray = $scope.data.list;\n\t\t\t\t\t$scope.config.pagerHiddenByAjaxSearch = false;\n\t\t\t\t} else {\n\t\t\t\t\t$timeout.cancel($scope.searchPromise);\n\n\t\t\t\t\tif (blockRequest) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t$scope.searchPromise = $timeout(function() {\n\t\t\t\t\t\tblockRequest = true;\n\t\t\t\t\t\t$http.post($scope.config.apiEndpoint + '/full-response?' + $scope.config.apiListQueryString, {query: n}).then(function(response) {\n\t\t\t\t\t\t\t$scope.config.pagerHiddenByAjaxSearch = true;\n\t\t\t\t\t\t\tblockRequest = false;\n\t\t\t\t\t\t\t$scope.config.fullSearchContainer = response.data;\n\t\t\t\t\t\t\t$scope.data.listArray = $filter('filter')(response.data, n);\n\t\t\t\t\t\t});\n\t\t\t\t\t}, 500)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$scope.config.pagerHiddenByAjaxSearch = false;\n\t\t\t\t$scope.data.listArray = $filter('filter')($scope.data.list, n);\n\t\t\t}\n\t\t};\n\n\t\t$scope.reApplySearch = function() {\n\t\t\t$scope.applySearchQuery($scope.config.searchQuery);\n\t\t}\n\n\t\t/******* RELATION CALLLS *********/\n\n\t\t/**\n\t\t * Modal view select a value from a modal into its parent plugin.\n\t\t */\n\t\t$scope.parentSelectInline = function(item) {\n\t\t\t$scope.$parent.$parent.$parent.setModelValue($scope.getRowPrimaryValue(item), item);\n\t\t};\n\t\t\n\t\t/**\n\t\t * Check if a field exists in the parents relation list, if yes hide the field\n\t\t * for the given form and return the relation call value instead in order to auto store those.\n\t\t */\n\t\t$scope.checkIfFieldExistsInParentRelation = function(field) {\n\t\t\t// this call is relation call, okay check for the parent relation defition\n\t\t\tif ($scope.config.relationCall) {\n\t\t\t\tvar relations = $scope.$parent.$parent.config.relations;\n\t\t\t\t\n\t\t\t\tvar definition = relations[parseInt($scope.config.relationCall.arrayIndex)];\n\t\t\t\t\n\t\t\t\tvar linkDefintion = definition.relationLink;\n\t\t\t\t\n\t\t\t\tif (linkDefintion !== null && linkDefintion.hasOwnProperty(field)) {\n\t\t\t\t\treturn parseInt($scope.config.relationCall.id);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\treturn false;\n\t\t}\n\n\t\t$scope.relationItems = [];\n\n\t\t/****** DELETE, UPDATE, CREATE */\n\n\t\t$scope.deleteItem = function(id, $event) {\n\t\t\tAdminToastService.confirm(i18n['js_ngrest_rm_page'], i18n['ngrest_button_delete'], ['$toast', function($toast) {\n\t\t\t\t$http.delete($scope.config.apiEndpoint + '/'+id).then(function(response) {\n\t\t\t\t\t$scope.loadList();\n\t\t\t\t\t$toast.close();\n\t\t\t\t\tAdminToastService.success(i18n['js_ngrest_rm_confirm']);\n\t\t\t\t}, function(data) {\n\t\t\t\t\t$scope.printErrors(data);\n\t\t\t\t});\n\t\t\t}]);\n\t\t};\n\n\t\t$scope.toggleUpdate = function(id) {\n\t\t\t$scope.resetData();\n\t\t\t$http.get($scope.config.apiEndpoint + '/'+id+'?' + $scope.config.apiUpdateQueryString).then(function(response) {\n\t\t\t\tvar data = response.data;\n\t\t\t\t$scope.data.update = data;\n\n\t\t\t\tif ($scope.config.relationCall) {\n\n\t\t\t\t\t$scope.crudSwitchType = 2;\n\t\t\t\t} else {\n\t\t\t\t\t$scope.switchTo(2);\n\t\t\t\t}\n\t\t\t\tif (!$scope.config.inline) {\n\t\t\t\t\t$state.go('default.route.detail', {id : id});\n\t\t\t\t}\n\t\t\t\t$scope.data.updateId = id;\n\t\t\t}, function(data) {\n\t\t\t\tAdminToastService.error(i18n['js_ngrest_error']);\n\t\t\t});\n\t\t};\n\n\t\t$scope.submitUpdate = function () {\n\t\t\t$http.put($scope.config.apiEndpoint + '/' + $scope.data.updateId, angular.toJson($scope.data.update, true)).then(function(response) {\n\t\t\t\tAdminToastService.success(i18n['js_ngrest_rm_update']);\n\t\t\t\t$scope.loadList();\n\t\t\t\t$scope.applySaveCallback();\n\t\t\t\t$scope.switchTo(0, true);\n\t\t\t\t$scope.highlightItemId($scope.data.updateId);\n\t\t\t}, function(response) {\n\t\t\t\t$scope.printErrors(response.data);\n\t\t\t});\n\t\t};\n\n\n\t\t$scope.submitCreate = function() {\n\n\t\t\tif ($scope.config.relationCall) {\n\t\t\t\t//$scope.data.create[$scope.relationCall.field] = parseInt($scope.relationCall.id);\n\t\t\t}\n\n\t\t\t$http.post($scope.config.apiEndpoint, angular.toJson($scope.data.create, true)).then(function(response) {\n\t\t\t\tAdminToastService.success(i18n['js_ngrest_rm_success']);\n\t\t\t\t$scope.loadList();\n\t\t\t\t$scope.applySaveCallback();\n\t\t\t\t$scope.switchTo(0, true);\n\t\t\t}, function(data) {\n\t\t\t\t$scope.printErrors(data.data);\n\t\t\t});\n\t\t};\n\n\t\t$scope.printErrors = function(data) {\n\t\t\tangular.forEach(data, function(value, key) {\n\t\t\t\tAdminToastService.error(value.message);\n\t\t\t});\n\t\t};\n\n\t\t$scope.resetData = function() {\n\t\t\t$scope.data.create = angular.copy({});\n\t\t\t$scope.data.update = angular.copy({});\n\t\t};\n\n\t\t/****** HIGHLIHGED ****/\n\n\t\t$scope.highlightId = 0;\n\n\t\t$scope.isHighlighted = function(itemId) {\n\t\t\tif (itemId[$scope.config.pk] == $scope.highlightId) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t};\n\n\t\t$scope.highlightItemId = function(id) {\n\t\t\t$scope.highlightId = id;\n\t\t\t$timeout(function() {\n\t\t\t\t$scope.highlightId = 0;\n\t\t\t}, 3000);\n\t\t}\n\n\t\t$scope.changeNgRestFilter = function() {\n\t\t\t$http.post('admin/api-admin-common/ngrest-filter', {'apiEndpoint' : $scope.config.apiEndpoint, 'filterName': $scope.config.filter}, { ignoreLoadingBar: true });\n\t\t\t$scope.loadList();\n\t\t}\n\n\t\t/*\n\n\t\t$scope.$watch('config.filter', function(n, o) {\n\t\t\tif (n != o && n != undefined) {\n\t\t\t\t$scope.blockFilterSeriveReload = true;\n\t\t\t\t$http.post('admin/api-admin-common/ngrest-filter', {'apiEndpoint' : $scope.config.apiEndpoint, 'filterName': $scope.config.filter}, { ignoreLoadingBar: true });\n\t\t\t\t$scope.reloadCrudList();\n\t\t\t}\n\t\t})\n\t\t*/\n\n\n\n\t\t/*** PAGINIATION ***/\n\n\t\t$scope.pagerPrevClick = function() {\n\t\t\tif ($scope.pager.currentPage != 1) {\n\t\t\t\t$scope.loadList(parseInt($scope.pager.currentPage)-1);\n\t\t\t}\n\t\t};\n\n\t\t$scope.pagerNextClick = function() {\n\t\t\tif ($scope.pager.currentPage != $scope.pager.pageCount) {\n\t\t\t\t$scope.loadList(parseInt($scope.pager.currentPage)+1);\n\t\t\t}\n\t\t};\n\n\t\t$scope.pager = false;\n\n\t\t$scope.setPagination = function(currentPage, pageCount, perPage, totalItems) {\n\t\t\tif (currentPage != null && pageCount != null && perPage != null && totalItems != null) {\n\n\t\t\t\t$scope.totalRows = totalItems;\n\t\t\t\tvar i = 1;\n\t\t\t\tvar urls = [];\n\t\t\t\tfor (i = 1; i <= pageCount; i++) {\n\t\t\t\t\turls.push(i);\n\t\t\t\t}\n\n\t\t\t\t$scope.pager = {\n\t\t\t\t\t'currentPage': currentPage,\n\t\t\t\t\t'pageCount': pageCount,\n\t\t\t\t\t'perPage': perPage,\n\t\t\t\t\t'totalItems': totalItems,\n\t\t\t\t\t'pages': urls,\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\t$scope.pager = false;\n\t\t\t}\n\t\t};\n\n\t\t/***** TOGGLER PLUGIN *****/\n\n\n\t\t$scope.toggleStatus = function(row, fieldName, fieldLabel, bindValue) {\n\t\t\tvar invertValue = !bindValue;\n\t\t\tvar invert = invertValue ? 1 : 0;\n\t\t\tvar rowId = row[$scope.config.pk];\n\t\t\tvar json = {};\n\t\t\tjson[fieldName] = invert;\n\t\t\t$http.put($scope.config.apiEndpoint + '/' + rowId +'?ngrestCallType=update&fields='+fieldName, angular.toJson(json, true)).then(function(response) {\n\t\t\t\trow[fieldName] = invert;\n\t\t\t\t$scope.highlightItemId(rowId);\n\t\t\t\tAdminToastService.success(i18nParam('js_ngrest_toggler_success', {field: fieldLabel}));\n\t\t\t}, function(data) {\n\t\t\t\t$scope.printErrors(data);\n\t\t\t});\n\t\t};\n\n\t\t/**** SORTABLE PLUGIN ****/\n\n\t\t$scope.sortableUp = function(index, row, fieldName) {\n\t\t\tvar switchWith = $scope.data.listArray[index-1];\n\t\t\t$scope.data.listArray[index-1] = row;\n\t\t\t$scope.data.listArray[index] = switchWith;\n\t\t\t$scope.updateSortableIndexPositions(fieldName);\n\t\t};\n\n\t\t$scope.sortableDown = function(index, row, fieldName) {\n\t\t\tvar switchWith = $scope.data.listArray[index+1];\n\t\t\t$scope.data.listArray[index+1] = row;\n\t\t\t$scope.data.listArray[index] = switchWith;\n\t\t\t$scope.updateSortableIndexPositions(fieldName);\n\t\t};\n\n\t\t$scope.updateSortableIndexPositions = function(fieldName) {\n\t\t\tangular.forEach($scope.data.listArray, function(value, key) {\n\t\t\t\tvar json = {};\n\t\t\t\tjson[fieldName] = key;\n\t\t\t\tvar rowId = value[$scope.config.pk];\n\t\t\t\t$http.put($scope.config.apiEndpoint + '/' + rowId +'?ngrestCallType=update&fields='+fieldName, angular.toJson(json, true), {\n\t\t\t\t\t ignoreLoadingBar: true\n\t\t\t\t});\n\t\t\t});\n\t\t};\n\n\t\t/***** LIST LOADERS ********/\n\n\t\t/**\n\t\t * This method is triggerd by the crudLoader directive to reload service data.\n\t\t */\n\t\t$scope.loadService = function() {\n\t\t\t$scope.initServiceAndConfig();\n\t\t};\n\n\t\t$scope.evalSettings = function(settings) {\n\t\t\tif (settings.hasOwnProperty('order')) {\n\t\t\t\t$scope.config.orderBy = settings['order'];\n\t\t\t}\n\n\t\t\tif (settings.hasOwnProperty('filterName')) {\n\t\t\t\t$scope.config.filter = settings['filterName'];\n\t\t\t}\n\t\t};\n\n\t\t$scope.getRowPrimaryValue = function(row) {\n\t\t\treturn row[$scope.config.pk];\n\t\t};\n\n\t\t$scope.initServiceAndConfig = function() {\n\t\t\tvar deferred = $q.defer();\n\t\t\t$http.get($scope.config.apiEndpoint + '/services').then(function(serviceResponse) {\n\t\t\t\t$scope.service = serviceResponse.data.service;\n\t\t\t\t$scope.serviceResponse = serviceResponse.data;\n\t\t\t\t$scope.evalSettings(serviceResponse.data._settings);\n\t\t\t\tdeferred.resolve();\n\t\t\t});\n\n\t\t\treturn deferred.promise;\n\t\t};\n\n\t\t$scope.getFieldHelp = function(fieldName) {\n\t\t\tif ($scope.serviceResponse && $scope.serviceResponse['_hints'] && $scope.serviceResponse._hints.hasOwnProperty(fieldName)) {\n\t\t\t\treturn $scope.serviceResponse._hints[fieldName];\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t\t$scope.loadList = function(pageId) {\n\t\t\tif (pageId == undefined && $scope.pager) {\n\t\t\t\t$scope.reloadCrudList($scope.pager.currentPage);\n\t\t\t} else {\n\t\t\t\t$scope.reloadCrudList(pageId);\n\t\t\t}\n\t\t};\n\t\t\n\t\t$scope.totalRows = 0;\n\n\t\t// this method is also used withing after save/update events in order to retrieve current selecter filter data.\n\t\t$scope.reloadCrudList = function(pageId) {\n\t\t\tif (parseInt($scope.config.filter) == 0) {\n\t\t\t\tif ($scope.config.relationCall) {\n\t\t\t\t\tvar url = $scope.config.apiEndpoint + '/relation-call/?' + $scope.config.apiListQueryString;\n\t\t\t\t\turl = url + '&arrayIndex=' + $scope.config.relationCall.arrayIndex + '&id=' + $scope.config.relationCall.id + '&modelClass=' + $scope.config.relationCall.modelClass;\n\t\t\t\t} else {\n\t\t\t\t\tvar url = $scope.config.apiEndpoint + '/?' + $scope.config.apiListQueryString;\n\t\t\t\t}\n\n\t\t\t\tif (pageId !== undefined) {\n\t\t\t\t\turl = url + '&page=' + pageId;\n\t\t\t\t}\n\t\t\t\tif ($scope.config.orderBy) {\n\t\t\t\t\turl = url + '&sort=' + $scope.config.orderBy.replace(\"+\", \"\");\n\t\t\t\t}\n\t\t\t\t$http.get(url).then(function(response) {\n\t\t\t\t\t$scope.totalRows = response.data.length;\n\t\t\t\t\t$scope.setPagination(\n\t\t\t\t\t\tresponse.headers('X-Pagination-Current-Page'),\n\t\t\t\t\t\tresponse.headers('X-Pagination-Page-Count'),\n\t\t\t\t\t\tresponse.headers('X-Pagination-Per-Page'),\n\t\t\t\t\t\tresponse.headers('X-Pagination-Total-Count')\n\t\t\t\t\t);\n\n\t\t\t\t\t$scope.data.list = response.data;\n\t\t\t\t\t$scope.data.listArray = response.data;\n\t\t\t\t\t$scope.reApplyOrder();\n\t\t\t\t\t$scope.reApplySearch();\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tvar url = $scope.config.apiEndpoint + '/filter?filterName=' + $scope.config.filter + '&' + $scope.config.apiListQueryString;\n\t\t\t\tif (pageId) {\n\t\t\t\t\turl = url + '&page=' + pageId;\n\t\t\t\t}\n\t\t\t\tif ($scope.config.orderBy) {\n\t\t\t\t\turl = url + '&sort=' + $scope.config.orderBy.replace(\"+\", \"\");\n\t\t\t\t}\n\t\t\t\t$http.get(url).then(function(response) {\n\t\t\t\t\t$scope.totalRows = response.data.length;\n\t\t\t\t\t$scope.setPagination(\n\t\t\t\t\t\tresponse.headers('X-Pagination-Current-Page'),\n\t\t\t\t\t\tresponse.headers('X-Pagination-Page-Count'),\n\t\t\t\t\t\tresponse.headers('X-Pagination-Per-Page'),\n\t\t\t\t\t\tresponse.headers('X-Pagination-Total-Count')\n\t\t\t\t\t);\n\t\t\t\t\t$scope.data.list = response.data;\n\t\t\t\t\t$scope.data.listArray = response.data;\n\t\t\t\t\t$scope.reApplyOrder();\n\t\t\t\t\t$scope.reApplySearch();\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\t$scope.service = false;\n\n\t\t/***** CONFIG AND INIT *****/\n\n\t\t$scope.data = {\n\t\t\tcreate : {},\n\t\t\tupdate : {},\n\t\t\taw : {},\n\t\t\tlist : {},\n\t\t\tupdateId : 0\n\t\t};\n\n\t\t$scope.$watch('config', function(n, o) {\n\t\t\t$timeout(function() {\n\t\t\t\t$scope.initServiceAndConfig().then(function() {\n\t\t\t\t\t$scope.loadList();\n\t\t\t\t});\n\t\t\t})\n\t\t});\n\t}]);\n\n// activeWindowController.js\n\n\tzaa.controller(\"ActiveWindowTagController\", ['$scope', '$http', 'AdminToastService', function($scope, $http, AdminToastService) {\n\n\t\t$scope.crud = $scope.$parent; // {{ data.aw.itemId }}\n\n\t\t$scope.tags = [];\n\n\t\t$scope.relation = {};\n\n\t\t$scope.newTagName = null;\n\n\t\t$scope.loadTags = function() {\n\t\t\t$http.get($scope.crud.getActiveWindowCallbackUrl('LoadTags')).then(function(transport) {\n\t\t\t\t$scope.tags = transport.data;\n\t\t\t});\n\t\t};\n\n\t\t$scope.loadRelations = function() {\n\t\t\t$http.get($scope.crud.getActiveWindowCallbackUrl('LoadRelations')).then(function(transport) {\n\t\t\t\t$scope.relation = {};\n\t\t\t\ttransport.data.forEach(function(value, key) {\n\t\t\t\t\t$scope.relation[value.tag_id] = 1;\n\t\t\t\t});\n\t\t\t});\n\t\t};\n\n\t\t$scope.saveTag = function() {\n\t\t\tvar tagName = $scope.newTagName;\n\n\t\t\tif (tagName !== \"\") {\n\t\t\t\t$scope.crud.sendActiveWindowCallback('SaveTag', {'tagName': tagName}).then(function(response) {\n\t\t\t\t\tif (response.data) {\n\t\t\t\t\t\t$scope.tags.push({id: response.data, name: tagName});\n\t\t\t\t\t\tAdminToastService.success(tagName + ' wurde gespeichert.');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tAdminToastService.error(tagName + ' ' + i18n['js_tag_exists']);\n\t\t\t\t\t}\n\t\t\t\t\t$scope.newTagName = null;\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\t$scope.saveRelation = function(tag, value) {\n\t\t\t$scope.crud.sendActiveWindowCallback('SaveRelation', {'tagId': tag.id, 'value': value}).then(function(response) {\n\n\t\t\t\t$scope.relation[tag.id] = response.data;\n\n\t\t\t\tAdminToastService.success(i18n['js_tag_success']);\n\t\t\t});\n\t\t};\n\n\t\t$scope.$watch(function() { return $scope.data.aw.itemId }, function(n, o) {\n\t\t\t$scope.loadRelations();\n\t\t});\n\n\t\t$scope.loadTags();\n\n\t}]);\n\n\t/**\n\t * ActiveWindow GalleryController\n\t *\n\t * Ability to upload images, removed images from index, add new images via selecting from\n\t * filemanager.\n\t *\n\t * Changes content when parent crud controller changes value for active aw.itemId.\n\t */\n\tzaa.controller(\"ActiveWindowGalleryController\", ['$scope', '$http', '$filter', function($scope, $http, $filter) {\n\n\t\t$scope.crud = $scope.$parent;\n\n\t\t$scope.files = [];\n\n\t\t$scope.select = function(id) {\n\t\t\tvar exists = $filter('filter')($scope.files, {'fileId' : id}, true);\n\t\t\t\n\t\t\tif (exists.length == 0) {\n\t\t\t\t$scope.crud.sendActiveWindowCallback('AddImageToIndex', {'fileId' : id }).then(function(response) {\n\t\t\t\t\tvar data = response.data;\n\t\t\t\t\t$scope.files.push(data);\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\t$scope.loadImages = function() {\n\t\t\t$http.get($scope.crud.getActiveWindowCallbackUrl('loadAllImages')).then(function(response) {\n\t\t\t\t$scope.files = response.data;\n\t\t\t})\n\t\t};\n\t\t\n\t\t$scope.changePosition = function(file, index, direction) {\n\t\t\tvar index = parseInt(index);\n\t\t\tvar oldRow = $scope.files[index];\n\t\t\tif (direction == 'up') {\n $scope.files[index] = $scope.files[index-1];\n $scope.files[index-1] = oldRow;\n\t\t\t} else if (direction == 'down') {\n $scope.files[index] = $scope.files[index+1];\n $scope.files[index+1] = oldRow;\n\t\t\t}\n\t\t\tvar newRow = $scope.files[index];\n\t\t\t\n\t\t\t$scope.crud.sendActiveWindowCallback('ChangeSortIndex', {'new': newRow, 'old': oldRow});\n\t\t};\n\t\t\n\t\t$scope.moveUp = function(file, index) {\n\t\t\t$scope.changePosition(file, index, 'up');\n\t\t};\n\t\t\n\t\t$scope.moveDown = function(file, index) {\n\t\t\t$scope.changePosition(file, index, 'down');\n\t\t}\n\n\t\t$scope.remove = function(file, index) {\n\t\t\t$scope.crud.sendActiveWindowCallback('RemoveFromIndex', {'imageId' : file.originalImageId }).then(function(response) {\n\t\t\t\t$scope.files.splice(index, 1);\n\t\t\t});\n\t\t};\n\n\t\t$scope.$watch(function() { return $scope.data.aw.itemId }, function(n, o) {\n\t\t\t$scope.loadImages();\n\t\t});\n\n\t}]);\n\n\tzaa.controller(\"ActiveWindowGroupAuth\", ['$scope', '$http', 'CacheReloadService', function($scope, $http, CacheReloadService) {\n\n\t\t$scope.crud = $scope.$parent; // {{ data.aw.itemId }}\n\n\t\t$scope.reload = function() {\n\t\t\tCacheReloadService.reload();\n\t\t};\n\n\t\t$scope.rights = [];\n\n\t\t$scope.auths = [];\n\n\t\t$scope.save = function(data) {\n\t\t\t$scope.crud.sendActiveWindowCallback('saveRights', {'data' : data }).then(function(response) {\n\t\t\t\t$scope.getRights();\n\t\t\t\t$scope.reload();\n\t\t\t});\n\t\t};\n\n\t\t$scope.toggleAll = function() {\n\t\t\tangular.forEach($scope.auths,function(value, key) {\n\t\t\t\t$scope.rights[value.id] = {base: 1, create: 1, update: 1, 'delete': 1 };\n\t\t\t});\n\t\t};\n\n\t\t$scope.untoggleAll = function() {\n\t\t\tangular.forEach($scope.auths,function(value, key) {\n\t\t\t\t$scope.rights[value.id] = {base: 0, create: 0, update: 0, 'delete': 0 };\n\t\t\t});\n\t\t};\n\n\t\t$scope.getRights = function() {\n\t\t\t$http.get($scope.crud.getActiveWindowCallbackUrl('getRights')).then(function(response) {\n\t\t\t\t$scope.rights = response.data.rights;\n\t\t\t\t$scope.auths = response.data.auths;\n\t\t\t});\n\t\t};\n\n\t\t$scope.$on('awloaded', function(e, d) {\n\t\t\t$scope.getRights();\n\t\t});\n\n\t\t$scope.$watch(function() { return $scope.data.aw.itemId }, function(n, o) {\n\t\t\t$scope.getRights();\n\t\t});\n\t}]);\n\n// DefaultController.js.\n\n\tzaa.controller(\"DefaultController\", ['$scope', '$http', '$state', '$stateParams', 'CrudTabService', function ($scope, $http, $state, $stateParams, CrudTabService) {\n\n\t\t$scope.moduleId = $state.params.moduleId;\n\n\t\t$scope.loadDashboard = function() {\n\t\t\t$scope.currentItem = null;\n\t\t\treturn $state.go('default', { 'moduleId' : $scope.moduleId});\n\t\t}\n\n\t\t$scope.isOpenModulenav = false;\n\n\t\t$scope.items = [];\n\n\t\t$scope.itemRoutes = [];\n\n\t\t$scope.currentItem = null;\n\n\t\t$scope.dashboard = [];\n\n\t\t$scope.itemAdd = function (name, items) {\n\n\t\t\t$scope.items.push({name : name, items : items});\n\n\t\t\tfor(var i in items) {\n\t\t\t\tvar data = items[i];\n\t\t\t\t$scope.itemRoutes[data.route] = {\n\t\t\t\t\talias : data.alias, icon : data.icon\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\t$scope.getDashboard = function(nodeId) {\n\t\t\t$http.get('admin/api-admin-menu/dashboard', { params : { 'nodeId' : nodeId }} ).then(function(data) {\n\t\t\t\t$scope.dashboard = data.data;\n\t\t\t});\n\t\t};\n\n\t\t$scope.init = function() {\n\t\t\t$scope.get();\n\t\t\t$scope.getDashboard($scope.moduleId);\n\t\t};\n\n\t\t$scope.resolveCurrentItem = function() {\n\t\t\tif (!$scope.currentItem) {\n\t\t\t\tif ($state.current.name == 'default.route' || $state.current.name == 'default.route.detail') {\n\t\t\t\t\tvar params = [$stateParams.moduleRouteId, $stateParams.controllerId, $stateParams.actionId];\n\t\t\t\t\tvar route = params.join(\"/\");\n\t\t\t\t\tif ($scope.itemRoutes.indexOf(route)) {\n\t\t\t\t\t\t$scope.currentItem = $scope.itemRoutes[route];\n\t\t\t\t\t\t$scope.currentItem.route = route;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\t$scope.click = function(item) {\n\t\t\t$scope.isOpenModulenav = false;\n\t\t\t$scope.currentItem = item;\n\n\t\t\tvar id = item.route;\n\t\t\tvar res = id.split(\"/\");\n\t\t\tCrudTabService.clear();\n\n\t\t\t$state.go('default.route', { moduleRouteId : res[0], controllerId : res[1], actionId : res[2]});\n\t\t};\n\n\t\t$scope.get = function () {\n\t\t\t$http.get('admin/api-admin-menu/items', { params : { 'nodeId' : $scope.moduleId }} ).then(function(response) {\n\t\t\t\tvar data = response.data;\n\t\t\t\tfor (var itm in data.groups) {\n\t\t\t\t\tvar grp = data.groups[itm];\n\t\t\t\t\t$scope.itemAdd(grp.name, grp.items);\n\t\t\t\t}\n\t\t\t\t$scope.resolveCurrentItem();\n\t\t\t})\n\t\t};\n\n\t\t$scope.$on('topMenuClick', function(e) {\n\t\t\t$scope.currentItem = null;\n\t\t});\n\n\t\t$scope.init();\n\t}]);\n\n\tzaa.controller(\"DashboardController\", ['$scope', function ($scope) {\n\t\t$scope.logItemOpen = false;\n\t}]);\n\n\tzaa.filter('lockFilter', function() {\n\t\treturn function(data, table, pk) {\n\t\t\tvar has = false;\n\t\t\tangular.forEach(data, function(value) {\n\t\t\t\tif (value.lock_table == table && value.lock_pk == pk) {\n\t\t\t\t\thas = value;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn has;\n };\n\t});\n\n\tzaa.controller(\"LayoutMenuController\", [\n\t\t'$scope', '$document', '$http', '$state', '$location', '$timeout', '$window', '$filter', 'HtmlStorage', 'CacheReloadService', 'AdminDebugBar', 'LuyaLoading', 'AdminToastService', 'AdminClassService', \n\t\tfunction ($scope, $document, $http, $state, $location, $timeout, $window, $filter, HtmlStorage, CacheReloadService, AdminDebugBar, LuyaLoading, AdminToastService, AdminClassService) {\n\n\t\t$scope.AdminClassService = AdminClassService;\n\n\t\t$scope.AdminDebugBar = AdminDebugBar;\n\n\t\t$scope.LuyaLoading = LuyaLoading;\n\n\t\t$scope.toastQueue = AdminToastService.queue;\n\n\t\t$scope.reload = function() {\n\t\t\tCacheReloadService.reload();\n\t\t};\n\n\t\t/* Main nav sidebar toggler */\n\n\t\t$scope.isHover = HtmlStorage.getValue('sidebarToggleState', false);\n\n\t\t$scope.toggleMainNavSize = function() {\n\t\t\t$scope.isHover = !$scope.isHover;\n\t\t\tHtmlStorage.setValue('sidebarToggleState', $scope.isHover);\n\t\t};\n\n\t\t/* PROFIL SETTINS */\n\n\t\t$scope.profile = {};\n\t\t$scope.settings = {};\n\t\t$scope.packages = [];\n\t\t\n\t\t$scope.getProfileAndSettings = function() {\n\t\t\t$http.get('admin/api-admin-user/session').then(function(success) {\n\t\t\t\t$scope.profile = success.data.user;\n\t\t\t\t$scope.settings = success.data.settings;\n\t\t\t\t$scope.packages = success.data.packages;\n\t\t\t});\n\t\t};\n\n\t\t/* Browser infos */\n\n\t\t$scope.browser = null;\n\n\t\t$scope.detectBrowser = function() {\n $scope.browser = [\n bowser.name.replace(' ', '-').toLowerCase() + '-' + bowser.version,\n (bowser.mac ? 'mac-os-' + (bowser.osversion ? bowser.osversion : '') : 'windows-' + (bowser.osversion ? bowser.osversion : ''))\n ].join(' ');\n\t\t};\n\n\t\t$scope.detectBrowser();\n\n\t\t$scope.getProfileAndSettings();\n\n\t\t$scope.debugDetail = null;\n\n\t\t$scope.debugDetailKey = null;\n\n\t\t$scope.loadDebugDetail = function(debugDetail, key) {\n\t\t\t$scope.debugDetail = debugDetail;\n\t\t\t$scope.debugDetailKey = key;\n\t\t};\n\n\t\t$scope.notify = null;\n\n\t\t$scope.forceReload = 0;\n\n\t\t$scope.showOnlineContainer = false;\n\n\t\t$scope.searchDetailClick = function(itemConfig, itemData) {\n\t\t\tif (itemConfig.type == 'custom') {\n\t\t\t\t$scope.click(itemConfig.menuItem).then(function() {\n\t\t\t\t\tif (itemConfig.stateProvider) {\n\t\t\t\t\t\tvar params = {};\n\t\t\t\t\t\tangular.forEach(itemConfig.stateProvider.params, function(value, key) {\n\t\t\t\t\t\t\tparams[key] = itemData[value];\n\t\t\t\t\t\t})\n\n\t\t\t\t\t\t$state.go(itemConfig.stateProvider.state, params).then(function() {\n\t\t\t\t\t\t\t$scope.closeSearchInput();\n\t\t\t\t\t\t})\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$scope.closeSearchInput();\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t} else {\n\t\t\t\t$scope.click(itemConfig.menuItem.module).then(function() {\n\t\t\t\t\tvar res = itemConfig.menuItem.route.split(\"/\");\n\t\t\t\t\t$state.go('default.route', { moduleRouteId : res[0], controllerId : res[1], actionId : res[2]}).then(function() {\n\t\t\t\t\t\tif (itemConfig.stateProvider) {\n\t\t\t\t\t\t\tvar params = {};\n\t\t\t\t\t\t\tangular.forEach(itemConfig.stateProvider.params, function(value, key) {\n\t\t\t\t\t\t\t\tparams[key] = itemData[value];\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t$state.go(itemConfig.stateProvider.state, params).then(function() {\n\t\t\t\t\t\t\t\t$scope.closeSearchInput();\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$scope.closeSearchInput();\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\t$scope.visibleAdminReloadDialog = false;\n\n\t\t$scope.lastKeyStroke = Date.now();\n\t\t\n\t\t$document.bind('keyup', function (e) {\n\t\t\t$scope.lastKeyStroke = Date.now();\n\t\t});\n\t\t\n\t\t(function tick(){\n\t\t\t$http.post('admin/api-admin-timestamp/index', {lastKeyStroke: $scope.lastKeyStroke}, {ignoreLoadingBar: true}).then(function(response) {\n\t\t\t\t$scope.forceReload = response.data.forceReload;\n\t\t\t\tif ($scope.forceReload && !$scope.visibleAdminReloadDialog) {\n\t\t\t\t\t$scope.visibleAdminReloadDialog = true;\n\t\t\t\t\tAdminToastService.confirm(i18n['js_admin_reload'], i18n['layout_btn_reload'], function() {\n\t\t\t\t\t\t$scope.reload();\n\t\t\t\t\t\t$scope.visibleAdminReloadDialog = false;\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t$scope.locked = response.data.locked;\n\t\t\t\t$scope.notify = response.data.useronline;\n\t\t\t\t$scope.idleStrokeDashoffset = response.data.idleStrokeDashoffset;\n\t\t\t\t$scope.idleTimeRelative = response.data.idleTimeRelative;\n\t\t\t\t$timeout(tick, 20000);\n\t\t\t})\n\t\t})();\n\n\t\t$scope.isLocked = function(table, pk) {\n\t\t\treturn $filter('lockFilter')($scope.locked, table, pk);\n\t\t};\n\t\t\n\t\t$scope.getLockedName = function(table, pk) {\n\t\t\tvar response = $scope.isLocked(table, pk);\n\t\t\t\n\t\t\treturn response.firstname + ' ' + response.lastname;\n\t\t};\n\n\t\t$scope.searchQuery = null;\n\n\t $scope.searchInputOpen = false;\n\n\t $scope.escapeSearchInput = function() {\n\t if ($scope.searchInputOpen) {\n\t $scope.closeSearchInput();\n\t }\n\t };\n\n\t $scope.toggleSearchInput = function() {\n\t \t$scope.searchInputOpen = !$scope.searchInputOpen;\n\t };\n\n\t $scope.openSearchInput = function() {\n\t $scope.searchInputOpen = true;\n\t };\n\n\t $scope.closeSearchInput = function() {\n\t $scope.searchInputOpen = false;\n\t };\n\n\t\t$scope.searchResponse = null;\n\n\t\t$scope.searchPromise = null;\n\n\t\t$scope.$watch(function() { return $scope.searchQuery}, function(n, o) {\n\t\t\tif (n !== o) {\n\t\t\t\tif (n.length > 2) {\n\t\t\t\t\t$timeout.cancel($scope.searchPromise);\n\t\t\t\t\t$scope.searchPromise = $timeout(function() {\n\t\t\t\t\t\t$http.get('admin/api-admin-search', { params : { query : n}}).then(function(response) {\n\t\t\t\t\t\t\t$scope.searchResponse = response.data;\n\t\t\t\t\t\t});\n\t\t\t\t\t}, 400)\n\t\t\t\t} else {\n\t $scope.searchResponse = null;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t$scope.items = [];\n\n\t\t$scope.currentItem = {};\n\n\t\t$scope.isOpen = false;\n\n\t\t$scope.click = function(menuItem) {\n\t\t\t$scope.isOpen = false;\n\t\t\t$scope.$broadcast('topMenuClick', { menuItem : menuItem });\n\t\t\tif (menuItem.template) {\n\t\t\t\treturn $state.go('custom', { 'templateId' : menuItem.template });\n\t\t\t} else {\n\t\t\t\treturn $state.go('default', { 'moduleId' : menuItem.id});\n\t\t\t}\n\t\t};\n\n\t\t$scope.isActive = function(item) {\n\t\t\tif (item.template) {\n\t\t\t\tif ($state.params.templateId == item.template) {\n\t\t\t\t\t$scope.currentItem = item;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ($state.params.moduleId == item.id) {\n\t\t\t\t\t$scope.currentItem = item;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\t$scope.get = function () {\n\t\t\t$http.get('admin/api-admin-menu').then(function(response) {\n\t\t\t\t$scope.items = response.data;\n\t\t\t});\n\t\t};\n\n\t\t$scope.get();\n\t}]);\n\n\tzaa.controller(\"AccountController\", ['$scope', '$http', '$window', 'AdminToastService', function($scope, $http, $window, AdminToastService) {\n\t\t\n\t\t$scope.pass = {};\n\t\t\n\t\t$scope.changePassword = function() {\n\t\t\t$http.post('admin/api-admin-user/change-password', $scope.pass).then(function(response) {\n\t\t\t\tAdminToastService.success(i18n['aws_changepassword_succes']);\n\t\t\t\t$scope.pass = {};\n\t\t\t}, function(error) {\n\t\t\t\tAdminToastService.errorArray(error.data);\n\t\t\t\t$scope.pass = {};\n\t\t\t});\n\t\t};\n\n\t\t$scope.changeSettings = function(settings) {\n\t\t\t$http.post('admin/api-admin-user/change-settings', settings).then(function(response) {\n\t\t\t\t$window.location.reload();\n\t\t\t});\n\t\t};\n\n\t\t$scope.profile = {};\n\t\t$scope.settings = {};\n\t\t$scope.activities = {};\n\t\t\n\t\t$scope.email = {};\n\n\t\t$scope.getProfile = function() {\n\t\t\t$http.get('admin/api-admin-user/session').then(function(success) {\n\t\t\t\t$scope.profile = success.data.user;\n\t\t\t\t$scope.settings = success.data.settings;\n\t\t\t\t$scope.activities = success.data.activities;\n\t\t\t});\n\t\t};\n\n\t\t$scope.changePersonData = function(data) {\n\t\t\t$http.put('admin/api-admin-user/session-update', data).then(function(success) {\n\t\t\t\tAdminToastService.success(i18n['js_account_update_profile_success']);\n\t\t\t\t$scope.getProfile();\n\t\t\t}, function(error) {\n\t\t\t\tAdminToastService.errorArray(error.data);\n\t\t\t});\n\t\t};\n\t\t\n\t\t$scope.changeEmail = function() {\n\t\t\t$http.put('admin/api-admin-user/change-email', {token: $scope.email.token}).then(function(success) {\n\t\t\t\tAdminToastService.success(i18n['js_account_update_profile_success']);\n\t\t\t\t$scope.getProfile();\n\t\t\t}, function(error) {\n\t\t\t\tAdminToastService.errorArray(error.data);\n\t\t\t});\n\t\t};\n\n\t\t$scope.getProfile();\n\t}]);"]} \ No newline at end of file +{"version":3,"sources":["dnd.js","zaa.js","services.js","filters.js","directives.js","controllers.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACxQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACnVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACrHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvkGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"main.uglified.js","sourcesContent":["angular.module('dnd', [])\n\n.factory('dndFactory', function() {\n\treturn {\n\t\t/**\n\t\t * variables to write\n\t\t */\n\t\tdata : {\n\t\t\tcontent: null, \n\t\t\tpos:null, \n\t\t\telement : null\n\t\t},\n\t\t/**\n\t\t * Element Getter\n\t\t */\n\t\tgetElement : function() {\n\t\t\treturn this.data.element;\n\t\t},\n\t\t/**\n\t\t * Elementer Setter\n\t\t */\n\t\tsetElement : function(e) {\n\t\t\tthis.data.element = e;\n\t\t},\n\t\t/**\n\t\t * Content Setter\n\t\t */\n\t\tsetContent : function(value) {\n\t\t\tthis.data.content = value;\n\t\t},\n\t\t/**\n\t\t * Content Getter\n\t\t */\n\t\tgetContent : function() {\n\t\t\treturn this.data.content;\n\t\t},\n\t\t/**\n\t\t * Pos Setter\n\t\t */\n\t\tsetPos: function(pos) {\n\t\t\tthis.data.pos = pos;\n\t\t},\n\t\t/**\n\t\t * Pos Getter\n\t\t */\n\t\tgetPos : function() {\n\t\t\treturn this.data.pos;\n\t\t}\n\t}\n})\n\n/**\n * Usage:\n * \n * ```js\n * dnd dnd-model=\"data\" dnd-isvalid=\"isValid(hover,dragged)\" dnd-drag-disabled dnd-diable-drag-middle dnd-drop-disabled dnd-ondrop=\"dropItem(dragged,dropped,position,element)\" dnd-css=\"{onDrag: 'drag-start', onHover: 'red', onHoverTop: 'red-top', onHoverMiddle: 'red-middle', onHoverBottom: 'red-bottom'}\"\n * ```\n * \n * + dnd-model: This is the model which will be used as \"dropped\", when drag is disabled this model is not needed\n * + dnd-disable-drag-middle\n * + dnd-drag-disabled\n * + dnd-is-valid\n * \n * Parts of the scripts are inspired by: https://github.com/marceljuenemann/angular-drag-and-drop-lists\n */\n.directive('dnd',['dndFactory', 'AdminClassService', function(dndFactory, AdminClassService) {\n\treturn {\n\t\trestrict : 'A',\n\t\ttransclude: false,\n\t\treplace: false,\n\t\ttemplate: false,\n\t\ttemplateURL: false,\n\t\tscope: {\n\t\t\tdndModel : '=',\n\t\t\tdndCss : '=',\n\t\t\tdndOndrop : '&',\n\t\t\tdndIsvalid : '&',\n\t\t},\n\t\tlink: function(scope, element, attrs) {\n\t\t\t// In standard-compliant browsers we use a custom mime type and also encode the dnd-type in it.\n\t\t\t// However, IE and Edge only support a limited number of mime types. The workarounds are described\n\t\t\t// in https://github.com/marceljuenemann/angular-drag-and-drop-lists/wiki/Data-Transfer-Design\n\t\t\tvar MIME_TYPE = 'application/x-dnd';\n\t\t\t// EDGE MIME TYPE\n\t\t\tvar EDGE_MIME_TYPE = 'application/json';\n\t\t\t// IE MIME TYPE\n\t\t\tvar MSIE_MIME_TYPE = 'Text';\n\t\t\t// if current droping is valid, defaults to true\n\t\t\tvar isValid = true;\n\t\t\t// whether middle dropping is disabled or not\n\t\t\tvar disableMiddleDrop = attrs.hasOwnProperty('dndDisableDragMiddle');\n\t \n\t\t\t/* DRAGABLE */\n\t \n\t\t\t/**\n\t\t\t * Enable dragging if not disabled.\n\t\t\t */\n\t if (!attrs.hasOwnProperty('dndDragDisabled')) {\n\t \telement.attr(\"draggable\", \"true\");\n\t }\n\t \n\t /**\n\t * Add a class to the current element\n\t */\n\t scope.addClass = function(className) {\n\t \telement.addClass(className);\n\t };\n\t \n\t /**\n\t * Remove a class from the current element, including timeout delay.\n\t */\n\t scope.removeClass = function(className, delay) {\n\t \telement.removeClass(className);\n\t };\n\t\n\t /**\n\t * DRAG START\n\t */\n\t element.on('dragstart', function(e) {\n\t \te = e.originalEvent || e;\n\t \t\n\t \te.stopPropagation();\n\t \t\n\t \t// Check whether the element is draggable, since dragstart might be triggered on a child.\n\t if (element.attr('draggable') == 'false') {\n\t \treturn true;\n\t }\n\t \n \tisValid = true;\n \tdndFactory.setContent(scope.dndModel);\n \tdndFactory.setElement(element[0]);\n \tscope.addClass(scope.dndCss.onDrag);\n \n var mimeType = 'text';\n var data = \"1\";\n \n try {\n e.dataTransfer.setData(mimeType, data);\n } catch (e) {\n \ttry {\n \t\te.dataTransfer.setData(EDGE_MIME_TYPE, data);\n\t } catch (e) {\n \t\t\te.dataTransfer.setData(MSIE_MIME_TYPE, data);\n\t }\n }\n });\n\t\n\t /**\n\t * DRAG END\n\t */\n\t element.on('dragend', function(e) {\n\t \te = e.originalEvent || e;\n\t \tscope.removeClass(scope.dndCss.onDrag);\n e.stopPropagation();\n });\n\t \n\t /* DROPABLE */\n\t \n\t /**\n\t * DRAG OVER ELEMENT\n\t */\n \telement.on('dragover', function(e) {\n \t\te = e.originalEvent || e;\n \t\t\n \t\ttry {\n \t\t\te.dataTransfer.dropEffect = 'move';\n \t\t} catch(e) {\n \t\t\t// catch ie exceptions\n \t\t}\n \n \t\te.preventDefault();\n\t \te.stopPropagation();\n \t\t\n\t\t if (!scope.dndIsvalid({hover: scope.dndModel, dragged: dndFactory.getContent()})) {\n\t \t\tisValid = false;\n\t \t\treturn false;\n\t \t}\n\t\t \n var re = element[0].getBoundingClientRect();\n\t\t var height = re.height;\n\t\t var mouseHeight = e.clientY - re.top;\n\t\t var percentage = (100 / height) * mouseHeight;\n\t\t if (disableMiddleDrop) {\n\t\t \tif (percentage <= 50) {\n \t\t \tscope.addClass(scope.dndCss.onHoverTop);\n \t\t \tscope.removeClass(scope.dndCss.onHoverMiddle);\n \t\t \tscope.removeClass(scope.dndCss.onHoverBottom);\n \t\t \tdndFactory.setPos('top');\n \t\t } else {\n \t\t \tscope.removeClass(scope.dndCss.onHoverTop);\n \t\t \tscope.removeClass(scope.dndCss.onHoverMiddle);\n \t\t \tscope.addClass(scope.dndCss.onHoverBottom);\n \t\t \tdndFactory.setPos('bottom');\n \t\t }\n\t\t } else {\n\t\t \tif (percentage <= 25) {\n \t\t \tscope.addClass(scope.dndCss.onHoverTop);\n \t\t \tscope.removeClass(scope.dndCss.onHoverMiddle);\n \t\t \tscope.removeClass(scope.dndCss.onHoverBottom);\n \t\t \tdndFactory.setPos('top');\n \t\t } else if (percentage >= 65) {\n \t\t \tscope.removeClass(scope.dndCss.onHoverTop);\n \t\t \tscope.removeClass(scope.dndCss.onHoverMiddle);\n \t\t \tscope.addClass(scope.dndCss.onHoverBottom);\n \t\t \tdndFactory.setPos('bottom');\n \t\t } else {\n \t\t \tscope.removeClass(scope.dndCss.onHoverTop);\n \t\t \tscope.addClass(scope.dndCss.onHoverMiddle);\n \t\t \tscope.removeClass(scope.dndCss.onHoverBottom);\n \t\t \tdndFactory.setPos('middle');\n \t\t }\n\t\t }\n\t\t \n\t\t scope.addClass(scope.dndCss.onHover);\n\t\t \n\t\t return false;\n\t\t });\n \t\n \t/**\n \t * DRAG ENTER element\n \t */\n \telement.on('dragenter', function(e) {\n \t\te = e.originalEvent || e;\n \t\tscope.addClass(scope.dndCss.onHover);\n \t\te.preventDefault();\n\t\t });\n\n \t/**\n \t * DRAG LEAVE\n \t */\n \t\telement.on('dragleave', function(e) {\n \t\t\tscope.removeClass(scope.dndCss.onHover, true);\n \t\t\tscope.removeClass(scope.dndCss.onHoverTop, true);\n \t\t\tscope.removeClass(scope.dndCss.onHoverMiddle, true);\n \t\t\tscope.removeClass(scope.dndCss.onHoverBottom, true);\n\t\t });\n\n \t\t/**\n \t\t * DROP (if enabled)\n \t\t */\n \t\tif (!attrs.hasOwnProperty('dndDropDisabled')) {\n\t element.on('drop', function(e) {\n\t \te = e.originalEvent || e;\n\t \t// The default behavior in Firefox is to interpret the dropped element as URL and\n\t // forward to it. We want to prevent that even if our drop is aborted.\n\t e.preventDefault();\n\t e.stopPropagation();\n\t \n\t scope.removeClass(scope.dndCss.onHover, true);\n\t \t\t\tscope.removeClass(scope.dndCss.onHoverTop, true);\n\t \t\t\tscope.removeClass(scope.dndCss.onHoverMiddle, true);\n\t \t\t\tscope.removeClass(scope.dndCss.onHoverBottom, true);\n\t \t\t\t\n \t\t if (isValid) {\n\t \tscope.$apply(function() {\n\t \t\tscope.dndOndrop({dragged: dndFactory.getContent(), dropped: scope.dndModel, position: dndFactory.getPos(), element: dndFactory.getElement()});\n\t \t});\n\t \treturn true;\n \t\t }\n \t\t return false;\n });\n \t\t}\n\t\t}\n\t};\n}]);","/**\n * guid creator\n * @returns {String}\n */\nfunction guid() {\n function s4() {\n return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);\n }\n\n return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();\n}\n/**\n * i18n localisation with params.\n *\n * ```js\n * i18nParam('js_i18n_translation_name', {variable: value});\n * ```\n *\n * Translations File:\n *\n * ```php\n * 'js_i18n_translation_name' => 'Hello %variable%',\n * ```\n * @param varName\n * @param params\n * @returns\n */\nfunction i18nParam(varName, params) {\n var varValue = i18n[varName];\n\n angular.forEach(params, function (value, key) {\n varValue = varValue.replace(\"%\" + key + \"%\", value);\n });\n\n return varValue;\n}\n/**\n * Type cast numeric values to integer\n *\n * @param value\n * @returns\n */\nfunction typeCastValue(value) {\n return angular.isNumber(value) ? parseInt(value) : value;\n}\n\n/* DEFINE LUYA ADMIN ANGULAR VAR */\n\nvar zaa = angular.module(\"zaa\", [\"ui.router\", \"dnd\", \"angular-loading-bar\", \"ngFileUpload\", \"ngWig\", \"flow\", \"angular.filter\", \"720kb.datepicker\", \"directive.ngColorwheel\"]);\n \n/* CONFIG */\n\nzaa.config(['$httpProvider', '$stateProvider', '$controllerProvider', '$urlMatcherFactoryProvider', function($httpProvider, $stateProvider, $controllerProvider, $urlMatcherFactoryProvider) {\n \t\n $httpProvider.interceptors.push(\"authInterceptor\");\n\n // used to bootstrap the angularjs controllers in the view \n zaa.bootstrap = $controllerProvider;\n\n $urlMatcherFactoryProvider.strictMode(false)\n\n /**\n * resolvers: https://github.com/angular-ui/ui-router/wiki#resolve\n */\n $stateProvider\n .state(\"default\", {\n url: \"/default/:moduleId\",\n templateUrl: function ($stateParams) {\n return \"admin/template/default\";\n }\n })\n .state(\"default.route\", {\n url: \"/:moduleRouteId/:controllerId/:actionId\",\n templateUrl: function ($stateParams) {\n return $stateParams.moduleRouteId + \"/\" + $stateParams.controllerId + \"/\" + $stateParams.actionId;\n },\n parent: 'default',\n resolve: {\n adminServiceResolver: adminServiceResolver\n }\n })\n .state(\"custom\", {\n url: \"/template/:templateId\",\n templateUrl: function ($stateParams) {\n return $stateParams.templateId;\n },\n resolve: {\n adminServiceResolver: adminServiceResolver,\n resolverProvider: ['resolver', function (resolver) {\n return resolver.then;\n }]\n }\n })\n .state(\"home\", {\n url: \"\",\n templateUrl: \"admin/default/dashboard\"\n })\n // ngrest crud detail view\n .state(\"default.route.detail\", {\n\t\t\t\turl: \"/:id\",\n\t\t\t\tparent: 'default.route',\n\t\t\t\ttemplate: '',\n\t\t\t\tcontroller: ['$scope', '$stateParams', function($scope, $stateParams) {\n\t\n\t\t\t\t\t$scope.crud = $scope.$parent;\n\t\n\t\t\t\t\t$scope.init = function() {\n\t\t\t\t\t\tif (!$scope.crud.config.inline) {\n\t\t\t\t\t\t\tif ($scope.crud.data.updateId != $stateParams.id) {\n\t\t\t\t\t\t\t\t$scope.crud.toggleUpdate($stateParams.id);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\n\t\t\t\t\t$scope.init();\n\t\t\t\t}]\n });\n }]);\n \n/* PROVIDERS */\n\n/**\n * resolver (or resolverProvider).\n * \n * > Warning: The config part is known injected `resolverProvider` even when the provider name is `resolver`.\n * > Info: can not rename this in admin 1.2 release due to usage in cms module old version branch\n * \n * Attach custom callback function to the custom state resolve. Use the resolverProvider in\n * your configuration part:\n *\n * ```js\n * zaa.config(function(resolverProvider) {\n *\t\tresolverProvider.addCallback(function(ServiceMenuData, ServiceBlocksData) {\n *\t\t\tServiceMenuData.load();\n *\t\t\tServiceBlocksData.load();\n *\t\t});\n * });\n * ```\n * \n * @see https://github.com/angular-ui/ui-router/wiki#resolve\n */\nzaa.provider(\"resolver\", [function() {\n var list = [];\n\n this.addCallback = function (callback) {\n list.push(callback);\n };\n\n this.$get = ['$injector', '$q', '$state', function ($injector, $q, $state) {\n return $q(function(resolve, reject) {\n for (var i in list) {\n $injector.invoke(list[i]);\n }\n })\n }];\n \n}]);\n\n/* FACTORIES */\n\n/**\n * LUYA LOADING\n */\nzaa.factory(\"LuyaLoading\", ['$timeout', function($timeout) {\n\n var state = false;\n var stateMessage = null;\n var timeoutPromise = null;\n\n return {\n start: function (myMessage) {\n if (myMessage == undefined) {\n stateMessage = i18n['js_zaa_server_proccess'];\n } else {\n stateMessage = myMessage;\n }\n // rm previous timeouts\n $timeout.cancel(timeoutPromise);\n\n timeoutPromise = $timeout(function () {\n state = true;\n }, 2000);\n },\n stop: function () {\n $timeout.cancel(timeoutPromise);\n state = false;\n },\n getStateMessage: function () {\n return stateMessage;\n },\n getState: function () {\n return state;\n }\n }\n}]);\n\n/**\n * Inside your Directive or Controller:\n * \n * ```js\n * AdminClassService.setClassSpace('modalBody', 'modal-open')\n * ```\n * \n * Inside your HTML layout file:\n * \n * ```html\n *
\n * ```\n * \n * In order to clear the class space afterwards:\n * \n * ```js\n * AdminClassService.clearSpace('modalBody');\n * ```\n */\nzaa.factory(\"AdminClassService\", function () {\n\n var service = [];\n\n service.vars = {};\n\n service.getClassSpace = function (spaceName) {\n if (service.vars.hasOwnProperty(spaceName)) {\n return service.vars[spaceName];\n }\n };\n\n service.hasClassSpace = function(spaceName) {\n \t if (service.vars.hasOwnProperty(spaceName)) {\n \t\t return true;\n \t }\n \t \n \t return false;\n };\n \n service.setClassSpace = function (spaceName, className) {\n service.vars[spaceName] = className;\n };\n \n service.clearSpace = function(spaceName) {\n \tif (service.vars.hasOwnProperty(spaceName)) {\n \t\tservice.vars[spaceName] = null;\n \t}\n };\n \n service.removeSpace = function(spaceName) {\n \tif (service.hasClassSpace(spaceName)) {\n \t\tdelete service.vars[spaceName];\n \t}\n };\n\n service.stack = 0;\n \n service.modalStackPush = function() {\n \tservice.stack += 1;\n };\n \n service.modalStackRemove = function() {\n \tif (service.stack <= 1) {\n \t\tservice.stack = 0; \n \t} else {\n \t\tservice.stack -= 1;\n \t}\n };\n \n service.modalStackRemoveAll = function() {\n \tservice.stack = 0;\n };\n \n service.modalStackIsEmpty = function() {\n \tif (service.stack == 0) {\n \t\treturn true;\n \t}\n \t\n \treturn false;\n };\n \n return service;\n});\n\nzaa.factory('CacheReloadService', ['$http', '$window', function ($http, $window) {\n\n var service = [];\n\n service.reload = function () {\n $http.get(\"admin/api-admin-common/cache\").then(function (response) {\n $window.location.reload();\n });\n }\n \n return service;\n}]);\n\nzaa.factory(\"authInterceptor\", ['$rootScope', '$q', 'AdminToastService', 'AdminDebugBar', function ($rootScope, $q, AdminToastService, AdminDebugBar) {\n return {\n request: function (config) {\n \tif (!config.hasOwnProperty('ignoreLoadingBar')) {\n \t\tconfig.debugId = AdminDebugBar.pushRequest(config);\n \t}\n \t\n \tif (config.hasOwnProperty('authToken')) {\n \t\tvar authToken = config.authToken;\n \t} else {\n \t\tvar authToken = $rootScope.luyacfg.authToken;\n \t}\n \t\n config.headers = config.headers || {};\n config.headers.Authorization = \"Bearer \" + authToken;\n var csrfToken = document.head.querySelector(\"[name=csrf-token]\").content;\n config.headers['X-CSRF-Token'] = csrfToken;\n \n return config || $q.when(config);\n },\n response: function(config) {\n \tif (!config.hasOwnProperty('ignoreLoadingBar')) {\n \t\tAdminDebugBar.pushResponse(config);\n \t}\n \t\n \treturn config || $q.when(config);\n },\n responseError: function (data) {\n if (data.status == 401 || data.status == 403 || data.status == 405) {\n \tif (!data.config.hasOwnProperty('authToken')) {\n \t\twindow.location = \"admin/default/logout\";\n \t}\n } else if (data.status != 422) {\n \tvar message = data.data.hasOwnProperty('message');\n \tif (message) {\n \t\tAdminToastService.error(data.data.message, 10000);\n \t} else {\n \t\tAdminToastService.error(\"Response Error: \" + data.status + \" \" + data.statusText, 10000);\n \t}\n \n }\n \n return $q.reject(data);\n }\n };\n}]);\n","// service resolver\nadminServiceResolver = ['ServiceFoldersData', 'ServiceImagesData', 'ServiceFilesData', 'ServiceFiltersData', 'ServiceLanguagesData', 'ServicePropertiesData', 'AdminLangService', 'ServiceFoldersDirecotryId', function(ServiceFoldersData, ServiceImagesData, ServiceFilesData, ServiceFiltersData, ServiceLanguagesData, ServicePropertiesData, AdminLangService, ServiceFoldersDirecotryId) {\n\tServiceFiltersData.load();\n\tServiceFoldersData.load();\n\t//ServiceImagesData.load();\n\t//ServiceFilesData.load();\n\tServiceLanguagesData.load();\n\tServicePropertiesData.load();\n\tAdminLangService.load();\n\tServiceFoldersDirecotryId.load();\n}];\n\n/**\n * all global admin services\n * \n * controller resolve: https://github.com/johnpapa/angular-styleguide#style-y080\n * \n * Service Inheritance:\n * \n * 1. Service must be prefix with Service\n * 2. Service must contain a forceReload state\n * 3. Service must broadcast an event 'service:FoldersData'\n * 4. Controller integration must look like\n * \n * ```\n * $scope.foldersData = ServiceFoldersData.data;\n *\t\t\t\t\n * $scope.$on('service:FoldersData', function(event, data) {\n * $scope.foldersData = data;\n * });\n *\t\t\t\t\n * $scope.foldersDataReload = function() {\n * return ServiceFoldersData.load(true);\n * }\n * ```\n * \n */\n\t\n/*\n\n$scope.foldersData = ServiceFoldersData.data;\n\t\t\t\t\t\n$scope.$on('service:FoldersData', function(event, data) {\n\t$scope.foldersData = data;\n});\n\n$scope.foldersDataReload = function() {\n\treturn ServiceFoldersData.load(true);\n}\n\n*/\nzaa.factory(\"ServiceFoldersData\", ['$http', '$q', '$rootScope', function($http, $q, $rootScope) {\n\t\n\tvar service = [];\n\t\n\tservice.data = null;\n\t\n\tservice.load = function(forceReload) {\n\t\treturn $q(function(resolve, reject) {\n\t\t\tif (service.data !== null && forceReload !== true) {\n\t\t\t\tresolve(service.data);\n\t\t\t} else {\n\t\t\t\t$http.get(\"admin/api-admin-storage/data-folders\").then(function(response) {\n\t\t\t\t\tservice.data = response.data;\n\t\t\t\t\t$rootScope.$broadcast('service:FoldersData', service.data);\n\t\t\t\t\tresolve(service.data);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t};\n\t\n\treturn service;\n}]);\n\n/*\n\n$scope.folderId = ServiceFoldersDirecotryId.folderId;\n\t\t\t\t\t\n$scope.$on('FoldersDirectoryId', function(event, folderId) {\n\t$scope.folderId = folderId;\n});\n\n$scope.foldersDirecotryIdReload = function() {\n\treturn ServiceFoldersDirecotryId.load(true);\n}\n\n*/\nzaa.factory(\"ServiceFoldersDirecotryId\", ['$http', '$q', '$rootScope', function($http, $q, $rootScope) {\n\t\n\tvar service = [];\n\t\n\tservice.folderId = false;\n\t\n\tservice.load = function(forceReload) {\n\t\treturn $q(function(resolve, reject) {\n\t\t\tif (service.folderId !== false && forceReload !== true) {\n\t\t\t\tresolve(service.folderId);\n\t\t\t} else {\n\t\t\t\t$http.get(\"admin/api-admin-common/get-filemanager-folder-state\").then(function(response) {\n\t\t\t\t\tservice.folderId = response.data;\n\t\t\t\t\t$rootScope.$broadcast('service:FoldersDirectoryId', service.folderId);\n\t\t\t\t\tresolve(service.folderId);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t};\n\t\n\treturn service;\n}]);\n\n/*\n\n$scope.imagesData = ServiceImagesData.data;\n\t\t\t\t\n$scope.$on('service:ImagesData', function(event, data) {\n\t$scope.imagesData = data;\n});\n\n$scope.imagesDataReload = function() {\n\treturn ServiceImagesData.load(true);\n}\n\n*/\nzaa.factory(\"ServiceImagesData\", ['$http', '$q', '$rootScope', '$log', function($http, $q, $rootScope, $log) {\n\tvar service = [];\n\t\n\tservice.data = {};\n\t\n\tservice.load = function(forceReload) {\n\t\t/*\n\t\treturn $q(function(resolve, reject) {\n\t\t\tif (service.data !== null && forceReload !== true) {\n\t\t\t\tresolve(service.data);\n\t\t\t} else {\n\t\t\t\t$http.get(\"admin/api-admin-storage/data-images\").then(function(response) {\n\t\t\t\t\tservice.data = response.data;\n\t\t\t\t\t$rootScope.$broadcast('service:ImagesData', service.data);\n\t\t\t\t\tresolve(service.data);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t\t*/\n\t};\n\t\n\t/**\n\t * Get a given file from the storage system by its id.\n\t * \n\t * ```js\n\t * ServiceImagesData.getImage(1).then(function(response) {\n\t * console.log(response);\n\t * });\n\t */\n\tservice.getImage = function(id, forceAsyncRequest) {\n\t\treturn $q(function(resolve, reject) {\n\t\t\t$log.info('request image id ' + id);\n\t\t\t\n\t\t\tif (service.data.hasOwnProperty(id)) {\n\t\t\t\t$log.info('image exists in data array.');\n\t\t\t\treturn resolve(service.data[id]);\n\t\t\t}\n\t\t\t\n\t\t\t$http.get('admin/api-admin-storage/image-info?id='+id).then(function(response) {\n\t\t\t\tvar data = response.data;\n \t\t\tservice.data[response.id] = data;\n \t\t\treturn resolve(data);\n \t\t});\n\t\t});\n\t};\n\t\n\treturn service;\n}]);\n\n/*\n\n$scope.filesData = ServiceFilesData.data;\n\t\t\t\t\n$scope.$on('service:FilesData', function(event, data) {\n\t$scope.filesData = data;\n});\n\n$scope.filesDataReload = function() {\n\treturn ServiceFilesData.load(true);\n}\n\t\t\t\t\n*/\nzaa.factory(\"ServiceFilesData\", ['$http', '$q', '$rootScope', '$log', function($http, $q, $rootScope, $log) {\n\tvar service = [];\n\t\n\tservice.data = {};\n\t\n\tservice.load = function(forceReload) {\n\t\t/*\n\t\treturn $q(function(resolve, reject) {\n\t\t\tif (service.data !== null && forceReload !== true) {\n\t\t\t\tresolve(service.data);\n\t\t\t} else {\n\t\t\t\t$log.info('load full list of all files from storage data-files api.');\n\t\t\t\t$http.get(\"admin/api-admin-storage/data-files\").then(function(response) {\n\t\t\t\t\tservice.data = response.data;\n\t\t\t\t\t$rootScope.$broadcast('service:FilesData', service.data);\n\t\t\t\t\tresolve(service.data);\n\t\t\t\t\t$log.info('files are loaded from storage api and written to data property.');\n\t\t\t\t\t$log.info(service.data);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t\t*/\n\t};\n\t\n\t/**\n\t * Get a given file from the storage system by its id.\n\t * \n\t * ```js\n\t * ServiceFilesData.getFile(1).then(function(response) {\n\t * console.log(response);\n\t * });\n\t */\n\tservice.getFile = function(id, forceAsyncRequest) {\n\t\treturn $q(function(resolve, reject) {\n\t\t\t$log.info('request file id ' + id);\n\t\t\t\n\t\t\tif (service.data.hasOwnProperty(id)) {\n\t\t\t\t$log.info('file exists in data array.');\n\t\t\t\treturn resolve(service.data[id]);\n\t\t\t}\n\t\t\t\n\t\t\t$http.get('admin/api-admin-storage/file-info?id='+id).then(function(response) {\n\t\t\t\tvar data = response.data;\n \t\t\tservice.data[response.id] = data;\n \t\t\treturn resolve(data);\n \t\t});\n\t\t});\n\t};\n\t\n\treturn service;\n}]);\n\n/*\n\n$scope.filtersData = ServiceFiltersData.data;\n\t\t\t\t\n$scope.$on('service:FiltersData', function(event, data) {\n\t$scope.filtersData = data;\n});\n\n$scope.filtersDataReload = function() {\n\treturn ServiceFiltersData.load(true);\n}\n\t\t\t\t\n*/\nzaa.factory(\"ServiceFiltersData\", ['$http', '$q', '$rootScope', function($http, $q, $rootScope) {\n\tvar service = [];\n\t\n\tservice.data = null;\n\t\n\tservice.load = function(forceReload) {\n\t\treturn $q(function(resolve, reject) {\n\t\t\tif (service.data !== null && forceReload !== true) {\n\t\t\t\tresolve(service.data);\n\t\t\t} else {\n\t\t\t\t$http.get(\"admin/api-admin-storage/data-filters\").then(function(response) {\n\t\t\t\t\tservice.data = response.data;\n\t\t\t\t\t$rootScope.$broadcast('service:FiltersData', service.data);\n\t\t\t\t\tresolve(service.data);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t};\n\t\n\treturn service;\n}]);\n\n/*\n\n$scope.languagesData = ServiceLanguagesData.data;\n\t\t\t\t\n$scope.$on('service:LanguagesData', function(event, data) {\n\t$scope.languagesData = data;\n});\n\n$scope.languagesDataReload = function() {\n\treturn ServiceLanguagesData.load(true);\n}\n\t\t\t\t\n*/\nzaa.factory(\"ServiceLanguagesData\", ['$http', '$q', '$rootScope', function($http, $q, $rootScope) {\n\tvar service = [];\n\t\n\tservice.data = [];\n\t\n\tservice.load = function(forceReload) {\n\t\treturn $q(function(resolve, reject) {\n\t\t\tif (service.data.length > 0 && forceReload !== true) {\n\t\t\t\tresolve(service.data);\n\t\t\t} else {\n\t\t\t\t$http.get(\"admin/api-admin-common/data-languages\").then(function(response) {\n\t\t\t\t\tservice.data = response.data;\n\t\t\t\t\t$rootScope.$broadcast('service:LanguagesData', service.data);\n\t\t\t\t\tresolve(service.data);\n\t\t\t\t})\n\t\t\t}\n\t\t});\n\t};\n\t\n\treturn service;\n}]);\n\n/*\n\n$scope.propertiesData = ServicePropertiesData.data;\n\t\t\t\t\n$scope.$on('service:PropertiesData', function(event, data) {\n\t$scope.propertiesData = data;\n});\n\n$scope.propertiesDataReload = function() {\n\treturn ServicePropertiesData.load(true);\n}\n\t\t\t\t\n*/\nzaa.factory(\"ServicePropertiesData\", ['$http', '$q', '$rootScope', function($http, $q, $rootScope) {\n\tvar service = [];\n\t\n\tservice.data = null;\n\t\n\tservice.load = function(forceReload) {\n\t\treturn $q(function(resolve, reject) {\n\t\t\tif (service.data !== null && forceReload !== true) {\n\t\t\t\tresolve(service.data);\n\t\t\t} else {\n\t\t\t\t$http.get(\"admin/api-admin-common/data-properties\").then(function(response) {\n\t\t\t\t\tservice.data = response.data;\n\t\t\t\t\t$rootScope.$broadcast('service:PropertiesData', service.data);\n\t\t\t\t\tresolve(service.data);\n\t\t\t\t})\n\t\t\t}\n\t\t});\n\t};\n\t\n\treturn service;\n}]);\n\nzaa.factory(\"CrudTabService\", function() {\n\t\n\tvar service = [];\n\t\n\tservice.tabs = [];\n\t\n\tservice.remove = function(index, $scope) {\n\t\tservice.tabs.splice(index, 1);\n\t\t\n\t\tif (service.tabs.length > 0) {\n\t\t\tvar lastTab = service.tabs.slice(-1)[0];\n\t\t\tlastTab.active = true;\n\t\t} else {\n\t\t\t$scope.switchTo(0);\n\t\t}\n\t};\n\t\n\tservice.addTab = function(id, api, arrayIndex, name, modelClass) {\n\t\tvar tab = {id: id, api: api, arrayIndex: arrayIndex, active: true, name: name, modelClass:modelClass};\n\t\t\n\t\tangular.forEach(service.tabs, function(item) {\n\t\t\titem.active = false;\n\t\t});\n\t\t\n\t\tservice.tabs.push(tab);\n\t\t\n\t};\n\t\n\tservice.clear = function() {\n\t\tservice.tabs = [];\n\t};\n\t\n\treturn service;\n});\n\n/*\n \n language service with selections\n \n*/\nzaa.factory(\"AdminLangService\", ['ServiceLanguagesData', '$rootScope', function(ServiceLanguagesData, $rootScope) {\n\t\n\tvar service = [];\n\t\n\tservice.data = [];\n\t\n\tservice.selection = [];\n\t\n\tservice.toggleSelection = function(lang) {\n\t\tvar exists = service.selection.indexOf(lang.short_code);\n\t\t\n\t\tif (exists == -1) {\n\t\t\tservice.selection.push(lang.short_code);\n\t\t\t$rootScope.$broadcast('service:LoadLanguage', lang);\n\t\t} else {\n\t\t\t/* #531: unable to deselect language, as at least 1 langauge must be activated. */\n\t\t\tif (service.selection.length > 1) {\n\t\t\t\tservice.selection.splice(exists, 1);\n\t\t\t}\n\t\t}\n\t};\n\t\n\tservice.isInSelection = function(langShortCode) {\n\t\tvar exists = service.selection.indexOf(langShortCode);\n\t\tif (exists == -1) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t};\n\t\n\tservice.resetDefault = function() {\n\t\tservice.selection = [];\n\t\tangular.forEach(ServiceLanguagesData.data, function(value, key) {\n\t\t\tif (value.is_default == 1) {\n\t\t\t\tif (!service.isInSelection(value.short_code)) {\n\t\t\t\t\tservice.toggleSelection(value);\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t};\n\t\n\tservice.load = function() {\n\t\tServiceLanguagesData.load().then(function(data) {\n\t\t\tservice.data = data;\n\t\t\t\n\t\t\tangular.forEach(data, function(value) {\n\t\t\t\tif (value.is_default == 1) {\n\t\t\t\t\tif (!service.isInSelection(value.short_code)) {\n\t\t\t\t\t\tservice.toggleSelection(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t\t\n\t\t});\n\t};\n\t\n\treturn service;\n}]);\n\n/*\n * Admin Debug Bar provides an array with debug information from the last request in order to find bugs without the developer tools of the browser \n */\nzaa.factory(\"AdminDebugBar\", function() {\n\t\n\tvar service = [];\n\t\n\tservice.data = [];\n\t\n\tservice.clear = function() {\n\t\tservice.data = [];\n\t};\n\t\n\tservice.pushRequest = function(request) {\n\t\treturn service.data.push({'url': request.url, 'requestData': request.data, 'responseData': null, 'responseStatus' : null, start:new Date(), end:null, parseTime: null});\n\t};\n\t\n\tservice.pushResponse = function(response) {\n\t\tvar responseCopy = response;\n\t\t\n\t\tvar serviceData = service.data[responseCopy.config.debugId];\n\t\t\n\t\tif (serviceData) {\n\t\t\tserviceData.responseData = responseCopy.data;\n\t\t\tserviceData.responseStatus = responseCopy.status;\n\t\t\tserviceData.end = new Date();\n\t\t\tserviceData.parseTime = new Date() - serviceData.start;\n\t\t}\n\t\t\n\t\treturn response;\n\t};\n\t\n\treturn service;\n});\n\n/*\n\n$scope.filesData = ServiceFilesData.data;\n\t\t\t\t\n$scope.$on('service:AdminToast', function(event, data) {\n\t$scope.filesData = data;\n});\n\nExamples\n\nAdminToastService.notify('Hello i am Message and will be dismissed in 2 Seconds');\n\nAdminToastService.confirm('Hello i am a callback and wait for your', 'Das löschen?', ['$q', '$http', function($q, $http) {\n\t// do some ajax call\n\t$http.get().then(function() {\n\t\tpromise.resolve();\n\t}).error(function() {\n\t\tpromise.reject();\n\t});\n}]);\n\nyou can also close this dialog by sourself in the callback\n\nAdminToastService.confirm('Are you sure?', 'Dialog Title', function() {\n\t// do something\n\tthis.close();\n});\n\ninstead of this you can also invoke $toast\n\nfunction($toast) {\n\t$toast.close();\n}\n\n*/\nzaa.factory(\"AdminToastService\", ['$q', '$timeout', '$injector', function($q, $timeout, $injector) {\n\tvar service = [];\n\t\n\tservice.notify = function(message, timeout, type) {\n\t\t\n\t\tif (timeout == undefined) {\n\t\t\ttimeout = 6000;\n\t\t}\n\t\t\n\t\tvar uuid = guid();\n\t\t\n\t\tservice.queue[uuid] = {message: message, timeout: timeout, uuid: uuid, type: type, close: function() {\n\t\t\tdelete service.queue[this.uuid];\n\t\t}};\n\t\t\n\t\t$timeout(function() {\n\t\t\tdelete service.queue[uuid];\n\t\t}, timeout);\n\t};\n\t\n\tservice.success = function(message, timeout) {\n\t\tservice.notify(message, timeout, 'success');\n\t};\n\n service.info = function(message, timeout) {\n service.notify(message, timeout, 'info');\n };\n\n service.warning = function(message, timeout) {\n service.notify(message, timeout, 'warning');\n };\n\t\n\tservice.error = function(message, timeout) {\n\t\tservice.notify(message, timeout, 'error');\n\t};\n\t\n\tservice.errorArray = function(array, timeout) {\n\t\tangular.forEach(array, function(value, key) {\n\t\t\tservice.error(value.message, timeout);\n\t\t});\n\t};\n\t\n\tservice.confirm = function(message, title, callback) {\n\t\tvar uuid = guid();\n\t\tservice.queue[uuid] = {message: message, title:title, click: function() {\n\t\t\tvar queue = this;\n\t\t\tvar response = $injector.invoke(this.callback, this, { $toast : this });\n\t\t\tif (response !== undefined) {\n\t\t\t\tresponse.then(function(r) {\n\t\t\t\t\tqueue.close();\n\t\t\t\t}, function(r) {\n\t\t\t\t\tqueue.close();\n\t\t\t\t}, function(r) {\n\t\t\t\t\t/* call or load at later time */\n\t\t\t\t});\n\t\t\t}\n\t\t}, uuid: uuid, callback: callback, type: 'confirm', close: function() {\n\t\t\tdelete service.queue[this.uuid];\n\t\t}}\n\t};\n\t\n\tservice.queue = {};\n\t\n\treturn service;\n}]);\n\n/*\n * \n * Saving data in Html Storage\n * \n *\t$scope.isHover = HtmlStorage.getValue('sidebarToggleState', false); \n *\t\t\n *\t$scope.toggleMainNavSize = function() {\n *\t $scope.isHover = !$scope.isHover;\n *\t HtmlStorage.setValue('sidebarToggleState', $scope.isHover);\n *\t}\n */\nzaa.factory('HtmlStorage', function() {\n\tvar service = {\n\t\t\n\t\tdata: {},\n\t\t\n\t\tisLoaded : false,\n\t\t\n\t\tloadData : function() {\n\t\t\tif (!service.isLoaded) {\n\t\t\t\tif (localStorage.getItem(\"HtmlStorage\")) {\n\t\t\t\t\tvar data = angular.fromJson(localStorage.getItem('HtmlStorage'));\n\t\t\t\t\t\n\t\t\t\t\tservice.data = data;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\n\t\tsaveData : function() {\n\t\t\tlocalStorage.removeItem('HtmlStorage');\n\t\t\tlocalStorage.setItem('HtmlStorage', angular.toJson(service.data));\n\t\t},\n\t\t\n\t\tgetValue : function(key, defaultValue) {\n\t\t\tservice.loadData();\n\t\t\t\n\t\t\tif (service.data.hasOwnProperty(key)) {\n\t\t\t\treturn service.data[key];\n\t\t\t}\n\t\t\t\n\t\t\treturn defaultValue;\n\t\t},\n\t\t\n\t\tsetValue : function(key, value) {\n\t\t\tservice.loadData();\n\t\t\t\n\t\t\tservice.data[key] = value;\n\t\t\t\n\t\t\tservice.saveData();\n\t\t}\n\t};\n\t\n\treturn service;\n});","\n \n zaa.filter(\"filemanagerdirsfilter\", function() {\n return function(input, parentFolderId) {\n var result = [];\n angular.forEach(input, function(value, key) {\n if (value.parentId == parentFolderId) {\n result.push(value);\n }\n });\n\n return result;\n };\n });\n\n zaa.filter(\"findthumbnail\", function() {\n \treturn function(input, fileId, thumbnailFilterId) {\n \t\tvar result = false;\n \t\tangular.forEach(input, function(value, key) {\n \t\t\tif (!result) {\n\t \t\t\tif (value.fileId == fileId && value.filterId == thumbnailFilterId) {\n\t \t\t\t\tresult = value;\n\t \t\t\t}\n \t\t\t}\n \t\t})\n\n \t\treturn result;\n \t}\n });\n\n zaa.filter(\"findidfilter\", function() {\n return function(input, id) {\n\n var result = false;\n\n angular.forEach(input, function(value, key) {\n if (value.id == id) {\n result = value;\n }\n });\n\n return result;\n }\n });\n\n zaa.filter(\"filemanagerfilesfilter\", function() {\n return function(input, folderId, onlyImages) {\n\n var result = [];\n\n angular.forEach(input, function(data) {\n if (onlyImages) {\n if (data.folderId == folderId && data.isImage == true) {\n result.push(data);\n }\n } else {\n if (data.folderId == folderId) {\n result.push(data);\n }\n }\n });\n\n return result;\n };\n });\n \n zaa.filter('trustAsUnsafe', ['$sce', function ($sce) {\n return function (val, enabled) {\n return $sce.trustAsHtml(val);\n };\n }]);\n \n zaa.filter('srcbox', function () {\n return function (input, search) {\n if (!input) return input;\n if (!search) return input;\n var expected = ('' + search).toLowerCase();\n var result = {};\n angular.forEach(input, function (value, key) {\n angular.forEach(value, function (kv, kk) {\n var actual = ('' + kv).toLowerCase();\n if (actual.indexOf(expected) !== -1) {\n result[key] = value;\n }\n });\n });\n return result;\n }\n });\n\n zaa.filter('trustAsResourceUrl', ['$sce', function ($sce) {\n return function (val, enabled) {\n if (!enabled) {\n return null;\n }\n return $sce.trustAsResourceUrl(val);\n };\n }]);\n\n zaa.filter('truncateMiddle', function () {\n return function (val, length, placeholder) {\n if(!length) {\n length = 30;\n }\n if(!placeholder) {\n placeholder = '...';\n }\n\n if(val.length <= length) {\n return val;\n }\n\n var targetLength = length - placeholder.length;\n var partLength = targetLength / 2;\n\n return (val.substring(0, partLength)) + placeholder + val.substring(val.length - partLength, val.length);\n };\n });","\n\n /* GLOBAL DIRECTIVES */\n\n /**\n * Directive to generate e chart diagrams.\n *\n * uses echarts.js component.\n */\n zaa.directive('echarts', function() {\n return {\n scope: {\n id: \"@\",\n legend: \"=\",\n item: \"=\",\n data: \"=\"\n },\n restrict: 'E',\n template: '
',\n replace: true,\n link: function($scope, element, attrs, controller) {\n var myChart = echarts.init(document.getElementById($scope.id),'macarons');\n var option = {\n tooltip: {\n show: true,\n trigger: 'item'\n },\n legend: {\n data: []\n },\n };\n /**\n * init the echart\n */\n myChart.setOption(option);\n $scope.$watch('data', function() {\n var option = $scope.$eval('data');\n if (option!=undefined) {\n myChart.setOption(angular.fromJson(option));\n }\n }, true);\n var w = angular.element(window);\n w.bind('resize', function(){\n /**\n * resize echarts when window zoom\n */\n myChart.resize();\n });\n }\n };\n });\n\n /**\n * Controller: $scope.content = $sce.trustAsHtml(response.data);\n * \n * Usage:\n * \n * ```\n *
\n * ```\n */\n zaa.directive(\"compileHtml\", ['$compile', '$parse', function ($compile, $parse) {\n return {\n restrict: \"A\",\n link: function (scope, element, attr) {\n var parsed = $parse(attr.ngBindHtml);\n scope.$watch(function () {\n return (parsed(scope) || \"\").toString();\n }, function () {\n $compile(element, null, -9999)(scope); //The -9999 makes it skip directives so that we do not recompile ourselves\n });\n }\n };\n }]);\n\n /**\n * Usage:\n *\n * ```\n *
\n * ```\n */\n zaa.directive(\"zaaEsc\", ['$document', function ($document) {\n return function (scope, element, attrs) {\n $document.on(\"keyup\", function (e) {\n if (e.keyCode == 27) {\n scope.$apply(function () {\n scope.$eval(attrs.zaaEsc);\n });\n }\n });\n };\n }]);\n\n /**\n * Returns the link options as value.\n */\n zaa.directive(\"linkObjectToString\", function () {\n return {\n restrict: 'E',\n relace: true,\n scope: {\n 'link': '='\n },\n template: function () {\n return '' +\n \t'' +\n \t'{{link.value}}' +\n '' +\n '{{link.value}}' +\n '';\n }\n }\n });\n\n /**\n * Generate a Tool Tip – usage:\n *\n * The default tooltip is positioned on the right side of the element:\n *\n * ```html\n * ...\n * ```\n *\n *\n * You can provide an Image URL beside or instead of text.\n *\n * ```html\n * ...\n * ```\n *\n * Change the position (`top`, `right`, `bottom` or `left`):\n *\n * ```html\n * ...\n * ```\n *\n *\n * Add an offset to the generated position. The example below adds 5px offset from left and pulls the tooltip 5px up.\n *\n * ```html\n * ...\n * ```\n *\n *\n * In order to trigger an expression call instead of a static text use:\n *\n * ```html\n * Span Text\n * ```\n *\n *\n * Disable tooltip based on variable (two way binding):\n *\n * ```html\n * Span Text\n * ```\n */\n zaa.directive(\"tooltip\", ['$document', function ($document) {\n return {\n restrict: 'A',\n scope: {\n 'tooltipText': '@',\n 'tooltipExpression': '=',\n 'tooltipPosition': '@',\n 'tooltipOffsetTop': '@',\n 'tooltipOffsetLeft': '@',\n 'tooltipImageUrl': '@',\n 'tooltipDisabled': '='\n },\n link: function (scope, element, attr) {\n var defaultPosition = 'right';\n\n var positions = {\n top: function() {\n var bcr = element[0].getBoundingClientRect();\n return {\n top: bcr.top - scope.pop.outerHeight(),\n left: (bcr.left + (bcr.width / 2)) - (scope.pop.outerWidth() / 2),\n }\n },\n bottom: function() {\n var bcr = element[0].getBoundingClientRect();\n return {\n top: bcr.top + bcr.height,\n left: (bcr.left + (bcr.width / 2)) - (scope.pop.outerWidth() / 2),\n }\n },\n right: function() {\n var bcr = element[0].getBoundingClientRect();\n return {\n top: (bcr.top + (bcr.height / 2)) - (scope.pop.outerHeight() / 2),\n left: bcr.left + bcr.width\n }\n },\n left: function() {\n var bcr = element[0].getBoundingClientRect();\n return {\n top: (bcr.top + (bcr.height / 2)) - (scope.pop.outerHeight() / 2),\n left: bcr.left - scope.pop.outerWidth()\n }\n }\n };\n\n var onScroll = function() {\n var offset = {};\n if(typeof positions[scope.tooltipPosition] === 'function') {\n offset = positions[scope.tooltipPosition]();\n } else {\n offset = positions[defaultPosition]();\n }\n\n if (typeof scope.tooltipOffsetTop == 'number') {\n offset.top = offset.top + scope.tooltipOffsetTop;\n }\n\n if (typeof scope.tooltipOffsetLeft == 'number') {\n offset.left = offset.left + scope.tooltipOffsetLeft;\n }\n\n scope.pop.css(offset);\n };\n\n element.on('mouseenter', function () {\n\n // Generate tooltip HTML for the first time\n if(!scope.pop && (typeof scope.tooltipDisabled === 'undefined' || scope.tooltipDisabled === false)) {\n if (scope.tooltipExpression) {\n scope.tooltipText = scope.tooltipExpression;\n }\n\n var html = '
' +\n '
' +\n '
' +\n (scope.tooltipText ? ('' + scope.tooltipText + '') : '') +\n '
' +\n '
';\n\n var $html = $(html);\n\n if(scope.tooltipImageUrl) {\n var image = new Image();\n image.onload = function() {\n onScroll();\n };\n image.src = scope.tooltipImageUrl;\n $html.find('.tooltip-inner').append(image);\n }\n\n scope.pop = $html;\n\n $document.find('body').append(scope.pop);\n scope.pop.hide();\n }\n\n // If tooltip shall be display...\n if(scope.pop && (typeof scope.tooltipDisabled === 'undefined' || scope.tooltipDisabled === false)) {\n\n // ..check position\n onScroll();\n\n // todo: Improve performance ...? x)\n // ..register scroll listener\n element.parents().on('scroll', onScroll);\n\n // ..show popup\n scope.pop.show();\n }\n });\n\n element.on('mouseleave', function () {\n element.parents().off('scroll', onScroll);\n\n if(scope.pop) {\n scope.pop.hide();\n }\n });\n\n scope.$on('$destroy', function() {\n if(scope.pop) {\n scope.pop.remove();\n }\n });\n }\n }\n }]);\n\n /**\n * Convert a string to number value, usefull in selects.\n *\n * ```\n * \n * ```\n */\n zaa.directive('focusMe', ['$timeout', '$parse', function ($timeout, $parse) {\n return {\n link: function (scope, element, attrs) {\n var model = $parse(attrs.focusMe);\n scope.$watch(model, function (value) {\n if (value === true) {\n $timeout(function () {\n element[0].focus();\n });\n }\n });\n }\n };\n }]);\n\n /**\n * ```\n * Test\n * ```\n */\n zaa.directive(\"clickPastePusher\", ['$rootScope', '$compile', function ($rootScope, $compile) {\n return {\n restrict: 'A',\n replace: false,\n link: function (scope, element, attrs) {\n element.bind('click', function () {\n $rootScope.$broadcast('insertPasteListener', attrs['clickPastePusher']);\n })\n }\n }\n }]);\n\n /**\n *\n * ```\n * $rootScope.$broadcast('insertPasteListener', $scope.someInput);\n * ```\n *\n * ```\n * \n * ```\n */\n zaa.directive('insertPasteListener', ['$rootScope', function ($rootScope) {\n return {\n restrict: 'A',\n link: function (scope, element, attrs) {\n element.bind(\"focus\", function () {\n $rootScope.lastElement = element[0];\n var offCallFn = $rootScope.$on('insertPasteListener', function (e, val) {\n var domElement = $rootScope.lastElement;\n\n if (domElement != element[0] || !domElement) {\n return false;\n }\n\n $rootScope.$$listeners.insertPasteListener = [];\n\n if (document.selection) {\n domElement.focus();\n var sel = document.selection.createRange();\n sel.text = val;\n domElement.focus();\n } else if (domElement.selectionStart || domElement.selectionStart === 0) {\n var startPos = domElement.selectionStart;\n var endPos = domElement.selectionEnd;\n var scrollTop = domElement.scrollTop;\n domElement.value = domElement.value.substring(0, startPos) + val + domElement.value.substring(endPos, domElement.value.length);\n domElement.focus();\n domElement.selectionStart = startPos + val.length;\n domElement.selectionEnd = startPos + val.length;\n domElement.scrollTop = scrollTop;\n } else {\n domElement.value += val;\n domElement.focus();\n }\n });\n });\n }\n }\n }]);\n\n\n /**\n * Example usage of luya admin modal:\n *\n * ```js\n * \n * \n *

Modal Container

\n *

Hello world!

\n *
\n * ```\n *\n * If you want to hidden use ng-if with modals, you have to use ng-if inside the modal like:\n *\n * ```js\n * \n *
\n *

This is only linked when modalState is visible

\n *
\n *
\n * ```\n *\n * > Using the ng-if outside of the modal wont work as it does not trigger the modalState due to child scope creation each time\n * > the ng-if is visible.\n *\n */\n zaa.directive(\"modal\", ['$timeout', function($timeout) {\n return {\n restrict: \"E\",\n scope: {\n isModalHidden: \"=\",\n title: '@modalTitle'\n },\n replace: true,\n transclude: true,\n templateUrl: \"modal\",\n controller : ['$scope', 'AdminClassService', function($scope, AdminClassService) {\n \t$scope.$watch('isModalHidden', function(n, o) {\n \t\tif (n !== o) {\n \t\t\tif (n) { // is hidden\n \t\t\t\tAdminClassService.modalStackRemove();\n \t\t} else { // is visible\n \t\t\tAdminClassService.modalStackPush();\n \t\t}\n \t\t}\n \t});\n\n \t/* ESC Key will close ALL modals, therefore we ensure the correct spaces */\n \t$scope.escModal = function() {\n \t\t$scope.isModalHidden = true;\n \t\tAdminClassService.modalStackRemoveAll();\n \t};\n }],\n link: function (scope, element) {\n \tscope.$on('$destroy', function() {\n \t\telement.remove();\n \t});\n \tangular.element(document.body).append(element);\n }\n }\n }]);\n\n /* CRUD, FORMS & FILE MANAGER */\n\n /**\n * If modelSelection and modelSetter is enabled, you can select a given row based in its primary key which will triggered the ngrest of the parent CRUD form.\n *\n * ```\n * \n * ```\n */\n zaa.directive(\"crudLoader\", ['$http', '$sce', function($http, $sce) {\n \treturn {\n \t\trestrict: \"E\",\n \t\treplace: true,\n \t\ttransclude: false,\n \t\tscope: {\n \t\t\t\"api\": \"@\",\n \t\t\t\"alias\" : \"@\",\n \t\t\t\"modelSelection\" : \"@\",\n \t\t\t\"modelSetter\": \"=\"\n \t\t},\n \t\tcontroller: ['$scope', function($scope) {\n\n \t\t\t$scope.input = { showWindow : true};\n\n \t\t\t$scope.content = null;\n\n \t\t\t$scope.toggleWindow = function() {\n \t\t\t\tif ($scope.input.showWindow) {\n \t\t\t\t\tvar url = $scope.api+'/?inline=1';\n \t\t\t\t\tvar modelSelection = parseInt($scope.modelSelection);\n \t\t\t\t\tif (modelSelection) {\n \t\t\t\t\t\turl = url + '&modelSelection=' + $scope.modelSetter;\n \t\t\t\t\t}\n \t\t\t\t\t$http.get(url).then(function(response) {\n \t\t\t\t\t\t$scope.content = $sce.trustAsHtml(response.data);\n \t\t\t\t\t\t$scope.input.showWindow = false;\n \t\t\t\t\t});\n \t\t\t\t} else {\n \t\t\t\t\t$scope.$parent.loadService();\n \t\t\t\t\t$scope.input.showWindow = true;\n \t\t\t\t}\n \t\t\t};\n\n \t\t\t$scope.$watch('input.showWindow', function(n, o) {\n \t\t\t\tif (n !== o && n == 1) {\n \t\t\t\t\t$scope.$parent.loadService();\n \t\t\t\t}\n \t\t\t});\n\n \t\t\t/**\n \t\t\t * @param integer $value contains the primary key\n \t\t\t * @param array $row contains the full row from the crud loader model in order to display data.\n \t\t\t */\n \t\t\t$scope.setModelValue = function(value, row) {\n \t\t\t\t$scope.modelSetter = value;\n \t\t\t\t$scope.toggleWindow();\n \t\t\t};\n \t\t}],\n \t\ttemplate: function() {\n \t\t\treturn '
';\n \t\t}\n \t}\n }]);\n\n /**\n * Directive to load curd relations.\n */\n zaa.directive(\"crudRelationLoader\", ['$http', '$sce', function($http, $sce) {\n \treturn {\n \t\trestrict: \"E\",\n \t\treplace: true,\n \t\ttransclude: false,\n \t\tscope: {\n \t\t\t\"api\": \"@api\",\n \t\t\t\"arrayIndex\": \"@arrayIndex\",\n \t\t\t\"modelClass\" : \"@modelClass\",\n \t\t\t\"id\": \"@id\"\n \t\t},\n \t\tcontroller: ['$scope', function($scope) {\n \t\t\t$scope.content = null;\n \t\t\t$http.get($scope.api+'/?inline=1&relation='+$scope.id+'&arrayIndex='+$scope.arrayIndex+'&modelClass='+$scope.modelClass).then(function(response) {\n\t\t\t\t\t$scope.content = $sce.trustAsHtml(response.data);\n \t\t\t});\n \t\t}],\n \t\ttemplate: function() {\n \t\t\treturn '
';\n \t\t}\n \t}\n }]);\n\n /**\n * Generate form input types based on ZAA Directives.\n *\n * Usage inside another Angular Template:\n *\n * ```php\n * \n * ```\n */\n zaa.directive(\"zaaInjector\", ['$compile', function($compile) {\n return {\n restrict: \"E\",\n replace: true,\n transclude: false,\n scope: {\n \"dir\": \"=\",\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"grid\": \"@grid\",\n \"fieldid\": \"@fieldid\",\n \"placeholder\": \"@placeholder\",\n \"initvalue\": \"@initvalue\"\n },\n link: function($scope, $element) {\n var elmn = $compile(angular.element('<' + $scope.dir + ' options=\"options\" initvalue=\"{{initvalue}}\" fieldid=\"{{fieldid}}\" placeholder=\"{{placeholder}}\" model=\"model\" label=\"{{label}}\" i18n=\"{{grid}}\" />'))($scope);\n $element.replaceWith(elmn);\n },\n }\n }]);\n\n /**\n * @var object $model Contains existing data for the displaying the existing relations\n *\n * ```js\n * [\n * \t{'sortpos': 1, 'value': 1},\n * {'sortpos': 2, 'value': 4},\n * ]\n * ```\n *\n * @var object $options Provides options to build the sort relation array:\n *\n * ```js\n * {\n * \t'sourceData': [\n * \t\t{'value': 1, 'label': 'Source Entry #1'}\n * \t\t{'value': 2, 'label': 'Source Entry #2'}\n * \t\t{'value': 3, 'label': 'Source Entry #3'}\n * \t\t{'value': 4, 'label': 'Source Entry #4'}\n * \t]\n * }\n * ```\n */\n zaa.directive(\"zaaSortRelationArray\", function() {\n \treturn {\n \t\trestrict: \"E\",\n \t\tscope: {\n \t\t\t\"model\": \"=\",\n \t\t\t\"options\": \"=\",\n \t\t\t\"label\": \"@label\",\n \t\t\t\"i18n\": \"@i18n\",\n \"id\": \"@fieldid\"\n \t\t},\n \t\tcontroller: ['$scope', '$filter', function($scope, $filter) {\n\n \t\t\t$scope.searchString;\n\n \t\t\t$scope.sourceData = [];\n\n $scope.dropdownOpen = false;\n\n \t\t\t$scope.$watch(function() { return $scope.model }, function(n, o) {\n \t\t\t\tif (n == undefined) {\n \t\t\t\t\t$scope.model = [];\n \t\t\t\t}\n \t\t\t});\n\n \t\t\t$scope.$watch(function() { return $scope.options }, function(n, o) {\n \t\t\t\tif (n !== undefined && n !== null) {\n \t\t\t\t\t$scope.sourceData = n.sourceData;\n \t\t\t\t}\n \t\t\t})\n\n \t\t\t$scope.getSourceOptions = function() {\n \t\t\t\treturn $scope.sourceData;\n \t\t\t};\n\n \t\t\t$scope.getModelItems = function() {\n \t\t\t\treturn $scope.model;\n \t\t\t}\n\n \t\t\t$scope.addToModel = function(option) {\n\n \t\t\t\tvar match = false;\n\n \t\t\t\tangular.forEach($scope.model, function(value, key) {\n \t\t\t\t\tif (value.value == option.value) {\n \t\t\t\t\t\tmatch = true;\n \t\t\t\t\t}\n \t\t\t\t});\n\n \t\t\t\tif (!match) {\n \t\t\t\t\t$scope.model.push({'value': option.value, 'label': option.label});\n \t\t\t\t}\n \t\t\t};\n\n \t\t\t$scope.removeFromModel = function(key) {\n \t\t\t\t$scope.model.splice(key, 1);\n \t\t\t}\n\n \t\t\t$scope.moveUp = function(index) {\n index = parseInt(index);\n var oldRow = $scope.model[index];\n $scope.model[index] = $scope.model[index-1];\n $scope.model[index-1] = oldRow;\n }\n\n $scope.moveDown = function(index) {\n index = parseInt(index);\n var oldRow = $scope.model[index];\n $scope.model[index] = $scope.model[index+1];\n $scope.model[index+1] = oldRow;\n };\n\n $scope.elementInModel = function(item) {\n \t\tvar match = false;\n\n \t\t\t\tangular.forEach($scope.model, function(value, key) {\n \t\t\t\t\tif (value.value == item.value) {\n \t\t\t\t\t\tmatch = true;\n \t\t\t\t\t}\n \t\t\t\t});\n\n \t\t\t\treturn !match;\n }\n \t\t}],\n \t\ttemplate: function() {\n \t\t\treturn '
' +\n '
' +\n '
' +\n '
' +\n '
' +\n '
' +\n 'play_arrow' +\n 'play_arrow' +\n '
' +\n\n '{{item.label}}' +\n\n '
' +\n 'delete' +\n '
' +\n '
' +\n '
' +\n '' +\n '
    ' +\n '
  • ' +\n 'add_circle{{ option.label }}' +\n '
  • ' +\n '
' +\n '
' +\n 'arrow_drop_up' +\n 'arrow_drop_down' +\n '
' +\n '
' +\n '
' +\n '
';\n \t\t}\n \t}\n });\n\n zaa.directive(\"zaaLink\", function(){\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\"\n },\n controller: ['$scope', function($scope) {\n \t$scope.unset = function() {\n \t\t$scope.model = false;\n \t\t$scope.data.model = null;\n \t};\n\n \t$scope.data = {\n \t\tmodalState: 1,\n \t\tmodel: null\n \t};\n\n \t$scope.$watch('model', function(n, o) {\n \t\tif (n) {\n \t\t\t$scope.data.model = n;\n \t\t}\n \t}, true);\n\n \t$scope.$watch('data.model', function(n, o) {\n \t\tif (n) {\n \t\t\t$scope.model = n;\n \t\t}\n \t}, true);\n }],\n template: function() {\n return '
{{label}}
' +\n '
' +\n '' +\n '
' +\n '
' +\n '' +\n '
' +\n '
'+\n '' +\n '
' +\n '
'+\n '
';\n }\n }\n });\n\n zaa.directive(\"zaaSlug\", function() {\n \treturn {\n \t\trestrict: \"E\",\n \t\tscope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\"\n },\n \t\tcontroller: ['$scope', '$filter', function($scope, $filter) {\n \t\t\t$scope.$watch(function() { return $scope.model; }, function(n, o) {\n \t\t\t\tif (n!=o) {\n \t\t\t\t\t$scope.model = $filter('slugify')(n);\n \t\t\t\t}\n \t\t\t});\n \t\t}],\n \t\ttemplate:function() {\n return '
';\n \t\t}\n \t}\n });\n\n zaa.directive(\"zaaColor\", function() {\n \treturn {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\"\n },\n controller: ['$scope', function($scope) {\n function getTextColor(){\n if(typeof $scope.model === 'undefined') {\n return '#000';\n }\n\n var hex = $scope.model;\n\n if(typeof $scope.model === 'string') {\n hex = hex.substr(1);\n }\n\n if(hex.length === 3) {\n var shorthandRegex = /^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i;\n hex = hex.replace(shorthandRegex, function(m, r, g, b) {\n return r + r + g + g + b + b;\n });\n }\n\n if(hex.length === 6) {\n var r = parseInt(hex.substr(0, 2), 16);\n var g = parseInt(hex.substr(2, 2), 16);\n var b = parseInt(hex.substr(4, 2), 16);\n var yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;\n return (yiq >= 128) ? '#000' : '#fff';\n }\n\n return '#000';\n }\n\n $scope.textColor = getTextColor();\n\n $scope.$watch(function() { return $scope.model; }, function(n, o) {\n $scope.textColor = getTextColor();\n });\n }],\n template: function() {\n return '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
' +\n '
' +\n '
';\n }\n }\n });\n\n zaa.directive(\"zaaWysiwyg\", function() {\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\"\n },\n template: function() {\n return '';\n }\n }\n });\n\n zaa.directive(\"zaaNumber\", function() {\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n \"placeholder\": \"@placeholder\",\n \"initvalue\" : \"@initvalue\"\n }, \n link: function($scope) {\n $scope.$watch(function() { return $scope.model }, function(n, o) {\n \tif (n == undefined) {\n \t\t$scope.model = parseInt($scope.initvalue);\n \t}\n if(angular.isNumber($scope.model)) {\n $scope.isValid = true;\n } else {\n $scope.isValid = false;\n }\n })\n }, template: function() {\n return '
';\n }\n }\n });\n\n zaa.directive(\"zaaDecimal\", function() {\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n \"placeholder\": \"@placeholder\"\n }, \n controller: ['$scope', function($scope) {\n if ($scope.options === null) {\n $scope.steps = 0.01;\n } else {\n $scope.steps = $scope.options['steps'];\n }\n }], \n link: function($scope) {\n $scope.$watch(function() { return $scope.model }, function(n, o) {\n if(angular.isNumber($scope.model)) {\n $scope.isValid = true;\n } else {\n $scope.isValid = false;\n }\n })\n },\n template: function() {\n return '
';\n }\n }\n });\n\n /**\n * \" />\n */\n zaa.directive(\"zaaText\", function(){\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n \"placeholder\": \"@placeholder\"\n },\n template: function() {\n return '
';\n }\n }\n });\n\n /**\n * \n */\n zaa.directive(\"zaaAsyncValue\", function(){\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"api\" : \"@\",\n \"fields\" : \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\"\n },\n controller: ['$scope', '$timeout', '$http', function($scope, $timeout, $http) {\n \t$timeout(function() {\n \t\t$scope.$watch('model', function(n, o) {\n \t\t\tif (n) {\n \t\t$scope.value = '';\n \t\t\t\t$http.get($scope.api + \"/\" + n + \"?fields=\" + $scope.fields.join()).then(function(response) {\n \t\t\t\t\t$scope.value;\n \t\t\t\t\tangular.forEach(response.data, function(value) {\n \t\t\t\t\t\tif (value) {\n \t\t\t\t\t\t\t$scope.value = $scope.value + value + \" \";\n \t\t\t\t\t\t}\n \t\t\t\t\t});\n \t\t\t\t});\n \t\t\t}\n \t\t});\n \t});\n\n \t$scope.resetValue = function() {\n \t\t$scope.model = 0;\n \t\t$scope.value = null;\n \t};\n }],\n template: function() {\n return '
';\n }\n }\n });\n\n zaa.directive(\"zaaTextarea\", function(){\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n \"placeholder\": \"@placeholder\"\n },\n template: function() {\n return '
';\n }\n }\n });\n\n zaa.directive(\"zaaPassword\", function(){\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\"\n },\n template: function() {\n return '
';\n }\n }\n });\n\n /**\n * \n */\n zaa.directive(\"zaaRadio\", function() {\n \treturn {\n\t \trestrict: \"E\",\n\t \tscope: {\n\t \"model\": \"=\",\n\t \"options\": \"=\",\n\t \"label\": \"@label\",\n\t \"i18n\": \"@i18n\",\n\t \"id\": \"@fieldid\",\n\t \"initvalue\": \"@initvalue\"\n\t \t},\n\t \tcontroller: ['$scope', function($scope) {\n\t \t\t$scope.setModelValue = function(value) {\n\t \t\t\t$scope.model = value;\n\t \t\t};\n\t \t}],\n\t \ttemplate: function() {\n\t \t\treturn '
' +\n\t\t\t\t '
' +\n\t\t\t\t \t'' +\n\t\t\t\t '
' +\n\t\t\t\t '
' +\n\t\t\t\t\t \t'
'+\n '' +\n\t\t\t\t\t \t\t''+\n\t\t\t\t\t \t'
'+\n\t\t\t\t\t '
'+\n\t\t\t\t '
';\n\t \t}\n \t};\n });\n\n /**\n *\n * Usage Example:\n *\n * ```js\n * \" options=\"modules\" />\n * ```\n *\n * If an initvalue is provided, you can not reset the model to null.\n *\n * Options value defintion:\n *\n * ```js\n * options=[{\"value\":123,\"label\":123-Label}, {\"value\":abc,\"label\":ABC-Label}]\n * ```\n *\n * In order to change the value and label keys which should be used to take the value and label keys within the given array use:\n *\n * ```js\n * \n * ```\n */\n zaa.directive(\"zaaSelect\", function() {\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"optionsvalue\" : \"@optionsvalue\",\n \"optionslabel\" : \"@optionslabel\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n \"initvalue\": \"@initvalue\"\n },\n controller: ['$scope', '$timeout', '$rootScope', function($scope, $timeout, $rootScope) {\n\n \t/* default scope values */\n\n \t$scope.isOpen = 0;\n\n \tif ($scope.optionsvalue == undefined) {\n \t\t$scope.optionsvalue = 'value';\n \t}\n\n \tif ($scope.optionslabel == undefined) {\n \t\t$scope.optionslabel = 'label';\n \t}\n\n\t\t if (angular.isNumber($scope.model)){\n\t\t $scope.model = typeCastValue($scope.model);\n\t\t }\n\n\t\t /* listeners */\n\n \t$scope.$on('closeAllSelects', function() {\n \t\tif ($scope.isOpen) {\n \t\t\t$scope.closeSelect();\n \t\t}\n \t});\n\n $timeout(function(){\n $scope.$watch(function() { return $scope.model }, function(n, o) {\n if (n == undefined || n == null || n == '') {\n if (angular.isNumber($scope.initvalue)) {\n $scope.initvalue = typeCastValue($scope.initvalue);\n }\n var exists = $scope.valueExistsInOptions(n);\n\n if (!exists) {\n \t$scope.model = $scope.initvalue;\n }\n }\n });\n });\n\n /* methods */\n\n $scope.valueExistsInOptions = function(value) {\n \tvar exists = false;\n \tangular.forEach($scope.options, function(item) {\n \t\tif (value == item.value) {\n \t\t\texists = true;\n \t\t}\n \t});\n \treturn exists;\n };\n\n \t$scope.toggleIsOpen = function() {\n \t\tif (!$scope.isOpen) {\n \t\t\t$rootScope.$broadcast('closeAllSelects');\n \t\t}\n \t\t$scope.isOpen = !$scope.isOpen;\n \t};\n\n \t$scope.closeSelect = function() {\n \t\t$scope.isOpen = 0;\n \t};\n\n $scope.setModelValue = function(option) {\n \t$scope.model = option[$scope.optionsvalue];\n \t$scope.closeSelect();\n };\n\n $scope.getSelectedLabel = function() {\n \tvar defaultLabel = i18n['ngrest_select_no_selection'];\n \tangular.forEach($scope.options, function(item) {\n \t\tif ($scope.model == item[$scope.optionsvalue]) {\n \t\t\tdefaultLabel = item[$scope.optionslabel];\n \t\t}\n \t});\n\n \treturn defaultLabel;\n };\n\n $scope.hasSelectedValue = function() {\n \tvar modelValue = $scope.model;\n\n \tif ($scope.valueExistsInOptions(modelValue) && modelValue != $scope.initvalue) {\n \t\treturn true;\n \t}\n\n \treturn false;\n };\n }],\n template: function() {\n return '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
' +\n '' +\n '
' +\n '{{getSelectedLabel()}}' +\n 'clear' +\n 'keyboard_arrow_down' +\n '
' +\n '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
' +\n '{{opt[optionslabel]}}' +\n '
' +\n '
' +\n '
' +\n '
' +\n '
' +\n '
';\n }\n }\n });\n\n /**\n * options = {'true-value' : 1, 'false-value' : 0};\n */\n zaa.directive(\"zaaCheckbox\", function() {\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n \"label\": \"@label\",\n \"initvalue\": \"@initvalue\"\n },\n controller: ['$scope', '$timeout', function($scope, $timeout) {\n if ($scope.options === null || $scope.options === undefined) {\n $scope.valueTrue = 1;\n $scope.valueFalse = 0;\n } else {\n $scope.valueTrue = $scope.options['true-value'];\n $scope.valueFalse = $scope.options['false-value'];\n }\n\n $scope.init = function() {\n \t\tif ($scope.model == undefined && $scope.model == null) {\n \t\t\t$scope.model = typeCastValue($scope.initvalue);\n \t\t}\n };\n $timeout(function() {\n \t$scope.init();\n \t})\n }],\n template: function() {\n return '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
' +\n '' +\n '' +\n '
' +\n '
' +\n '
';\n }\n }\n });\n\n /**\n * options arg object:\n *\n * options.items[] = [{\"value\" : 1, \"label\" => 'Label for Value 1' }]\n */\n zaa.directive(\"zaaCheckboxArray\", function(){\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n \"label\": \"@label\"\n },\n controller: ['$scope', '$filter', function($scope, $filter) {\n\n if ($scope.model == undefined) {\n $scope.model = [];\n }\n\n $scope.searchString = '';\n\n $scope.$watch('options', function(n, o) {\n \tif (n != undefined && n.hasOwnProperty('items')) {\n \t$scope.optionitems = $filter('orderBy')(n.items, 'label');\n }\n });\n\n $scope.filtering = function() {\n $scope.optionitems = $filter('filter')($scope.options.items, $scope.searchString);\n }\n\n $scope.toggleSelection = function (value) {\n \tif ($scope.model == undefined) {\n \t\t$scope.model = [];\n \t}\n\n for (var i in $scope.model) {\n if ($scope.model[i][\"value\"] == value.value) {\n $scope.model.splice(i, 1);\n return;\n }\n }\n $scope.model.push({'value': value.value});\n }\n\n $scope.isChecked = function(item) {\n for (var i in $scope.model) {\n if ($scope.model[i][\"value\"] == item.value) {\n return true;\n }\n }\n return false;\n }\n }],\n link: function(scope) {\n scope.random = Math.random().toString(36).substring(7);\n },\n template: function() {\n return '
' +\n '
' +\n '' +\n '
' +\n '
' +\n\n '
' +\n '
' +\n 'search' +\n '
' +\n '' +\n\n '{{optionitems.length}} ' + i18n['js_dir_till'] + ' {{options.items.length}}' +\n '
' +\n\n '
' +\n '' +\n '' +\n '
' +\n '
' +\n '
';\n }\n }\n });\n\n /**\n * https://github.com/720kb/angular-datepicker#date-validation - Date Picker\n * http://jsfiddle.net/bateast/Q6py9/1/ - Date Parse\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date - Date Objects\n * https://docs.angularjs.org/api/ng/filter/date - Angular Date Filter\n *\n * resetable: 1/0, This will enable or disable the ability to press the reset (set to null) button. use integer value\n */\n zaa.directive(\"zaaDatetime\", function() {\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"id\": \"@fieldid\",\n \"i18n\": \"@i18n\",\n \"resetable\" : \"@resetable\",\n },\n controller: ['$scope', '$filter', function($scope, $filter) {\n\n \t$scope.isNumeric = function(num) {\n \t return !isNaN(num)\n \t}\n\n \t$scope.$watch(function() { return $scope.model }, function(n, o) {\n \t\tif (n != null && n != undefined) {\n \t\t\tvar datep = new Date(n*1000);\n \t\t\t$scope.pickerPreselect = datep;\n \t\t\t$scope.date = $filter('date')(datep, 'dd.MM.yyyy');\n \t\t\t$scope.hour = $filter('date')(datep, 'H');\n \t\t\t$scope.min = $filter('date')(datep, 'm');\n \t\t} else {\n \t\t\t$scope.date = null;\n \t\t\t$scope.model = null;\n \t\t}\n \t});\n\n \t$scope.refactor = function(n) {\n \t\tif (!$scope.isNumeric($scope.hour) || $scope.hour == '') {\n\t\t\t\t\t\t$scope.hour = \"0\";\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!$scope.isNumeric($scope.min) || $scope.min == '') {\n\t\t\t\t\t\t$scope.min = \"0\";\n\t\t\t\t\t}\n\n \t\tif (n == 'Invalid Date' || n == \"\" || n == 'NaN') {\n \t\t\t\t$scope.date = null;\n \t\t\t\t$scope.model = null;\n \t\t\t} else {\n \t\t\tvar res = n.split(\".\");\n \t\t\tif (res.length == 3) {\n \t\t\t\tif (res[2].length == 4) {\n\n \t\t\t\t\t\tif (parseInt($scope.hour) > 23) {\n \t\t\t\t\t\t\t$scope.hour = 23;\n \t\t\t\t\t\t}\n\n \t\t\t\t\t\tif (parseInt($scope.min) > 59) {\n \t\t\t\t\t\t\t$scope.min = 59;\n \t\t\t\t\t\t}\n\n\t\t \t\t\t\tvar en = res[1] + \"/\" + res[0] + \"/\" + res[2] + \" \" + $scope.hour + \":\" + $scope.min;\n\t\t \t\t\t\t$scope.model = (Date.parse(en)/1000);\n\t\t \t\t\t\t$scope.datePickerToggler = false;\n \t\t\t\t}\n \t\t\t}\n \t\t\t}\n \t}\n\n \t$scope.$watch(function() { return $scope.date }, function(n, o) {\n \t\tif (n != o && n != undefined && n != null) {\n \t\t\t$scope.refactor(n);\n \t\t}\n \t});\n\n \t$scope.autoRefactor = function() {\n \t\t$scope.refactor($scope.date);\n \t};\n\n \t$scope.datePickerToggler = false;\n\n \t$scope.toggleDatePicker = function() {\n \t\t$scope.datePickerToggler = !$scope.datePickerToggler;\n \t};\n\n \t$scope.openDatePicker = function() {\n $scope.datePickerToggler = true;\n };\n\n $scope.closeDatePicker = function() {\n $scope.datePickerToggler = false;\n };\n\n \t$scope.hour = \"0\";\n\n \t$scope.min = \"0\";\n\n \t$scope.reset = function() {\n \t\t$scope.model = null;\n \t};\n\n \t$scope.getIsResetable = function() {\n \t\tif ($scope.resetable) {\n \t\t\treturn parseInt($scope.resetable);\n \t\t}\n\n \t\treturn true;\n \t};\n }],\n template: function() {\n \treturn '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '' +\n '' +\n '
' +\n 'date_range' +\n 'close' +\n '
' +\n '
' +\n \t '
' +\n '
' +\n '
' +\n 'access_time' +\n '
' +\n '' +\n '
' +\n '
' +\n '
:
' +\n '' +\n '
' +\n \t '
' +\n \t '
' +\n '
' +\n '
';\n }\n }\n });\n\n /**\n * resetable: whether rest button is enabled or not.\n */\n zaa.directive(\"zaaDate\", function() {\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"id\": \"@fieldid\",\n \"i18n\": \"@i18n\",\n \"resetable\" : \"@resetable\"\n },\n \tcontroller: ['$scope', '$filter', function($scope, $filter) {\n\n \t$scope.$watch(function() { return $scope.model }, function(n, o) {\n\n \t\tif (n != null && n != undefined) {\n \t\t\tvar datep = new Date(n*1000);\n \t\t\t$scope.pickerPreselect = datep;\n \t\t\t$scope.date = $filter('date')(datep, 'dd.MM.yyyy');\n \t\t} else {\n \t\t\t$scope.date = null;\n \t\t\t$scope.model = null;\n \t\t}\n \t});\n\n \t$scope.refactor = function(n) {\n \t\tif (n == 'Invalid Date' || n == \"\") {\n \t\t\t\t$scope.date = null;\n \t\t\t\t$scope.model = null;\n \t\t\t} else {\n \t\t\tvar res = n.split(\".\");\n \t\t\tif (res.length == 3) {\n \t\t\t\tif (res[2].length == 4) {\n \t\t\t\t\tvar en = res[1] + \"/\" + res[0] + \"/\" + res[2];\n\t\t \t\t\t\t$scope.model = (Date.parse(en)/1000);\n\t\t \t\t\t\t$scope.datePickerToggler = false;\n \t\t\t\t}\n \t\t\t}\n \t\t\t}\n \t}\n\n \t$scope.$watch(function() { return $scope.date }, function(n, o) {\n \t\tif (n != o && n != undefined && n != null) {\n \t\t\t$scope.refactor(n);\n \t\t}\n \t});\n\n \t$scope.autoRefactor = function() {\n \t\t$scope.refactor($scope.date);\n \t};\n\n \t$scope.datePickerToggler = false;\n\n \t$scope.toggleDatePicker = function() {\n \t\t$scope.datePickerToggler = !$scope.datePickerToggler;\n \t};\n\n $scope.openDatePicker = function() {\n $scope.datePickerToggler = true;\n };\n\n $scope.closeDatePicker = function() {\n $scope.datePickerToggler = false;\n };\n\n $scope.reset = function() {\n \t\t$scope.model = null;\n \t};\n\n \t$scope.getIsResetable = function() {\n \t\tif ($scope.resetable) {\n \t\t\treturn parseInt($scope.resetable);\n \t\t}\n\n \t\treturn true;\n \t};\n }],\n template: function() {\n \treturn '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '' +\n '' +\n '
' +\n 'date_range' +\n 'close' +\n '
' +\n '
' +\n '
' +\n '
' +\n '
';\n }\n }\n });\n\n zaa.directive(\"zaaTable\", function() {\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n },\n controller: ['$scope', function($scope) {\n\n if ($scope.model == undefined) {\n $scope.model = [{0:''}];\n }\n\n $scope.addColumn = function() {\n var len = 0;\n for (var o in $scope.model[0]) {\n len++;\n }\n\n for(var i in $scope.model) {\n $scope.model[i][len] = '';\n }\n }\n\n $scope.addRow = function() {\n var elmn = $scope.model[0];\n var ins = {};\n for (var i in elmn) {\n ins[i] = '';\n }\n\n $scope.model.push(ins);\n }\n\n $scope.removeColumn = function(key) {\n for (var i in $scope.model) {\n var item = $scope.model[i];\n if(item instanceof Array) {\n item.splice(key, 1);\n } else {\n delete item[key];\n }\n }\n }\n\n $scope.moveLeft = function(index) {\n index = parseInt(index);\n for (var i in $scope.model) {\n var oldValue = $scope.model[i][index];\n $scope.model[i][index] = $scope.model[i][index-1];\n $scope.model[i][index-1] = oldValue;\n }\n }\n\n $scope.moveRight = function(index) {\n index = parseInt(index);\n for (var i in $scope.model) {\n var oldValue = $scope.model[i][index];\n $scope.model[i][index] = $scope.model[i][index+1];\n $scope.model[i][index+1] = oldValue;\n }\n }\n\n $scope.moveUp = function(index) {\n index = parseInt(index);\n var oldRow = $scope.model[index];\n $scope.model[index] = $scope.model[index-1];\n $scope.model[index-1] = oldRow;\n }\n\n $scope.moveDown = function(index) {\n index = parseInt(index);\n var oldRow = $scope.model[index];\n $scope.model[index] = $scope.model[index+1];\n $scope.model[index+1] = oldRow;\n }\n\n $scope.removeRow = function(key) {\n $scope.model.splice(key, 1);\n }\n\n $scope.showRightButton = function(index) {\n if (parseInt(index) < Object.keys($scope.model[0]).length - 1) {\n return true;\n }\n return false;\n }\n $scope.showDownButton = function(index) {\n if (parseInt(index) < Object.keys($scope.model).length - 1) {\n return true;\n }\n return false;\n }\n }],\n template: function() {\n return '
' +\n '
' +\n '' +\n '' +\n '
' +\n '
' +\n '
' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n ''+\n '' +\n '' +\n '
' +\n '
' +\n '' +\n '' +\n '' +\n '
' +\n '
' +\n '
' +\n '' +\n '' +\n '' +\n '
' +\n '
'+\n ''+\n '
' +\n ''+\n ''+\n '
' +\n '
' +\n '
';\n }\n }\n });\n\n zaa.directive(\"zaaFileUpload\", function(){\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n },\n template: function() {\n return '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '' +\n '
' +\n '
';\n }\n }\n });\n\n zaa.directive(\"zaaImageUpload\", function(){\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n },\n template: function() {\n return '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '' +\n '
' +\n '
';\n }\n }\n });\n\n zaa.directive(\"zaaImageArrayUpload\", function(){\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n },\n link: function(scope, element, attributes){\n scope.$watch('model', function(newValue, oldValue) {\n if(newValue.length >= 1) {\n $(element).removeClass('is-empty').addClass('is-not-empty');\n } else {\n $(element).removeClass('is-not-empty').addClass('is-empty');\n }\n }, true);\n },\n controller: ['$scope', function($scope) {\n if ($scope.model == undefined) {\n $scope.model = [];\n }\n\n $scope.add = function() {\n \tif ($scope.model == null || $scope.model == '' || $scope.model == undefined) {\n \t\t$scope.model = [];\n \t}\n $scope.model.push({ imageId : 0, caption : '' });\n };\n\n $scope.remove = function(key) {\n $scope.model.splice(key, 1);\n };\n\n $scope.moveUp = function(index) {\n index = parseInt(index);\n var oldRow = $scope.model[index];\n $scope.model[index] = $scope.model[index-1];\n $scope.model[index-1] = oldRow;\n };\n\n $scope.moveDown = function(index) {\n index = parseInt(index);\n var oldRow = $scope.model[index];\n $scope.model[index] = $scope.model[index+1];\n $scope.model[index+1] = oldRow;\n };\n\n $scope.showDownButton = function(index) {\n if (parseInt(index) < Object.keys($scope.model).length - 1) {\n return true;\n }\n return false;\n };\n }],\n template: function() {\n return '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
' +\n '

0\">'+i18n['js_dir_no_selection']+'

' +\n '
' +\n '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
' +\n '' +\n '' +\n '
' +\n '
' +\n '
' +\n '
' +\n '
' +\n '' +\n '' +\n '' +\n '
' +\n '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
';\n }\n }\n });\n\n /**\n * Multiple selection of files.\n */\n zaa.directive(\"zaaFileArrayUpload\", function(){\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n },\n controller: ['$scope', '$element', '$timeout', function($scope, $element, $timeout) {\n\n if ($scope.model == undefined) {\n $scope.model = [];\n }\n\n $scope.add = function() {\n \tif ($scope.model == null || $scope.model == '' || $scope.model == undefined) {\n \t\t$scope.model = [];\n \t}\n $scope.model.push({ fileId : 0, caption : '' });\n };\n\n $scope.remove = function(key) {\n $scope.model.splice(key, 1);\n };\n\n $scope.moveUp = function(index) {\n index = parseInt(index);\n var oldRow = $scope.model[index];\n $scope.model[index] = $scope.model[index-1];\n $scope.model[index-1] = oldRow;\n };\n\n $scope.moveDown = function(index) {\n index = parseInt(index);\n var oldRow = $scope.model[index];\n $scope.model[index] = $scope.model[index+1];\n $scope.model[index+1] = oldRow;\n };\n\n $scope.showDownButton = function(index) {\n if (parseInt(index) < Object.keys($scope.model).length - 1) {\n return true;\n }\n return false;\n };\n }],\n template: function() {\n return '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
' +\n '

0\">'+i18n['js_dir_no_selection']+'

' +\n '
' +\n \t'' +\n '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
' +\n '' +\n '' +\n '
' +\n '
' +\n '
' +\n '
' +\n '
' +\n '' +\n '' +\n '' +\n '
' +\n '
' +\n '
' +\n '
' +\n '' +\n '
' +\n '
';\n }\n }\n });\n\n /**\n * Generates an array where each array element can contain another directive from zaa types.\n *\n * @retunr array\n */\n zaa.directive(\"zaaMultipleInputs\", function() {\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n },\n controller: ['$scope', '$timeout', function ($scope, $timeout) {\n $scope.init = function() {\n if ($scope.model == undefined || $scope.model == null) {\n $scope.model = [];\n } else {\n \tangular.forEach($scope.model, function(value, key) {\n \t\tvar len = Object.keys(value).length;\n \t\t/* issue #1519: if there are no keys, ensure the item is an object */\n \t\tif (len == 0) {\n \t\t\t$scope.model[key] = {};\n \t\t}\n \t})\n }\n };\n\n $scope.add = function() {\n if ($scope.model == null || $scope.model == '' || $scope.model == undefined) {\n $scope.model = [];\n }\n\n $scope.model.push({});\n };\n\n $scope.remove = function(key) {\n $scope.model.splice(key, 1);\n };\n\n $scope.moveUp = function(index) {\n index = parseInt(index);\n var oldRow = $scope.model[index];\n $scope.model[index] = $scope.model[index-1];\n $scope.model[index-1] = oldRow;\n };\n\n $scope.moveDown = function(index) {\n index = parseInt(index);\n var oldRow = $scope.model[index];\n $scope.model[index] = $scope.model[index+1];\n $scope.model[index+1] = oldRow;\n };\n\n $scope.showDownButton = function(index) {\n return parseInt(index) < Object.keys($scope.model).length - 1;\n };\n\n $timeout(function() {\n \t$scope.init();\n });\n }],\n template: function() {\n return '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
' +\n '

0\">'+i18n['js_dir_no_selection']+'

' +\n '
' +\n '
' +\n '
' +\n '
' +\n '' +\n '' +\n '' +\n '
' +\n '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
';\n }\n }\n });\n\n zaa.directive(\"zaaListArray\", function() {\n return {\n restrict: \"E\",\n scope: {\n \"model\": \"=\",\n \"options\": \"=\",\n \"label\": \"@label\",\n \"i18n\": \"@i18n\",\n \"id\": \"@fieldid\",\n },\n controller: ['$scope', '$element', '$timeout', function($scope, $element, $timeout) {\n\n $scope.init = function() {\n \tif ($scope.model == undefined || $scope.model == null) {\n $scope.model = [];\n }\n };\n\n $scope.add = function() {\n \tif ($scope.model == null || $scope.model == '' || $scope.model == undefined) {\n \t\t$scope.model = [];\n \t}\n $scope.model.push({ value : '' });\n $scope.setFocus();\n };\n\n $scope.remove = function(key) {\n $scope.model.splice(key, 1);\n };\n\n $scope.refactor = function(key, row) {\n if (key !== ($scope.model.length -1)) {\n if (row['value'] == \"\") {\n $scope.remove(key);\n }\n }\n };\n\n $scope.setFocus = function() {\n $timeout(function() {\n var input = $element.children('.list').children('.list__item:last-of-type').children('.list__left').children('input');\n\n if(input.length == 1) {\n input[0].focus();\n }\n }, 50);\n };\n\n $scope.moveUp = function(index) {\n index = parseInt(index);\n var oldRow = $scope.model[index];\n $scope.model[index] = $scope.model[index-1];\n $scope.model[index-1] = oldRow;\n }\n\n $scope.moveDown = function(index) {\n index = parseInt(index);\n var oldRow = $scope.model[index];\n $scope.model[index] = $scope.model[index+1];\n $scope.model[index+1] = oldRow;\n }\n\n $scope.showDownButton = function(index) {\n if (parseInt(index) < Object.keys($scope.model).length - 1) {\n return true;\n }\n return false;\n }\n\n $scope.init();\n\n }],\n template: function() {\n return '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
' +\n '

0\">'+i18n['js_dir_no_selection']+'

' +\n '
' +\n '' +\n '
' +\n '
' +\n '' +\n '' +\n '' +\n '
' +\n '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
';\n }\n }\n });\n // storage.js\n\n zaa.directive('storageFileUpload', function() {\n return {\n restrict : 'E',\n scope : {\n ngModel : '='\n },\n controller: ['$scope', '$filter', 'ServiceFilesData', function($scope, $filter, ServiceFilesData) {\n\n // ServiceFilesData inhertiance\n\n \t/*\n \t$scope.filesData = ServiceFilesData.data;\n\n \t$scope.$on('service:FilesData', function(event, data) {\n \t\t$scope.filesData = data;\n });\n */\n\n // controller logic\n\n \t$scope.modal = {state: 1};\n\n \t$scope.modalContainer = false;\n\n \t$scope.fileinfo = null;\n\n \t$scope.select = function(fileId) {\n \t$scope.toggleModal();\n \t$scope.ngModel = fileId;\n };\n\n \t$scope.reset = function() {\n \t\t$scope.ngModel = 0;\n \t\t$scope.fileinfo = null;\n };\n\n \t$scope.toggleModal = function() {\n \t\t$scope.modalContainer = !$scope.modalContainer;\n \t\t$scope.modal.state = !$scope.modal.state;\n };\n\n \t$scope.$watch(function() { return $scope.ngModel }, function(n, o) {\n if (n != 0 && n != null && n !== undefined) {\n \t/*\n var filtering = $filter('filter')($scope.filesData, {id: parseInt(n)}, true);\n if (filtering && filtering.length == 1) {\n \t$scope.fileinfo = filtering[0];\n }\n */\n ServiceFilesData.getFile(n).then(function(response) {\n \t$scope.fileinfo = response;\n });\n }\n\n /* reset file directive if an event resets the image model to undefined */\n if (n == 0) {\n \t$scope.reset();\n }\n });\n }],\n templateUrl : 'storageFileUpload'\n }\n });\n\n zaa.directive('storageFileDisplay', function() {\n \treturn {\n \t\trestrict: 'E',\n \t\tscope: {\n \t\t\tfileId: '@fileId'\n \t\t},\n \t\tcontroller: ['$scope', '$filter', 'ServiceFilesData', function($scope, $filter, ServiceFilesData) {\n\n \t\t\t// ServiceFilesData inheritance\n\n $scope.filesData = ServiceFilesData.data;\n\n $scope.$on('service:FilesData', function(event, data) {\n $scope.filesData = data;\n });\n\n // controller\n\n $scope.fileinfo = null;\n\n $scope.$watch('fileId', function(n, o) {\n if (n != 0 && n != null && n !== undefined) {\n \t\n \t$scope.ServiceFilesData.getFile(n).then(function(file) {\n \t\t$scope.fileinfo = file;\n \t});\n \t/*\n \tvar filtering = $filter('filter')($scope.filesData, {id: parseInt(n)}, true);\n if (filtering && filtering.length == 1) {\n \t$scope.fileinfo = filtering[0];\n }\n */\n }\n });\n \t\t}],\n \t\ttemplate: function() {\n return '
{{ fileinfo.name }}
';\n }\n \t}\n });\n\n zaa.directive('storageImageThumbnailDisplay', function() {\n return {\n restrict: 'E',\n scope: {\n imageId: '@imageId'\n },\n controller: ['$scope', '$filter', 'ServiceImagesData', 'ServiceFilesData', function($scope, $filter, ServiceImagesData, ServiceFilesData) {\n\n // ServiceFilesData inheritance\n\n $scope.filesData = ServiceFilesData.data;\n\n $scope.$on('service:FilesData', function(event, data) {\n $scope.filesData = data;\n });\n\n // ServiceImagesData inheritance\n\n /*\n $scope.imagesData = ServiceImagesData.data;\n\n $scope.$on('service:ImagesData', function(event, data) {\n $scope.imagesData = data;\n });\n */\n\n // controller logic\n\n $scope.$watch(function() { return $scope.imageId }, function(n, o) {\n if (n != 0 && n !== undefined) {\n\n \tServiceImagesData.getImage(n).then(function(response) {\n \t\tconsole.log(response);\n \t});\n \t\n \t/*\n \t * TODO USE getImage\n var filtering = $filter('findidfilter')($scope.imagesData, n, true);\n\n var file = $filter('findidfilter')($scope.filesData, filtering.fileId, true);\n\n if (file && file.thumbnail) {\n \t$scope.imageSrc = file.thumbnail.source;\n }\n */\n }\n });\n\n $scope.imageSrc = null;\n }],\n template: function() {\n return '
';\n }\n }\n });\n\n zaa.directive('storageImageUpload', function() {\n return {\n restrict : 'E',\n scope : {\n ngModel : '=',\n options : '=',\n },\n controller : ['$scope', '$http', '$filter', 'ServiceFiltersData', 'ServiceImagesData', 'AdminToastService', 'ServiceFilesData', function($scope, $http, $filter, ServiceFiltersData, ServiceImagesData, AdminToastService, ServiceFilesData) {\n\n // ServiceImagesData inheritance\n\n \t\t/*\n $scope.imagesData = ServiceImagesData.data;\n\n $scope.$on('service:ImagesData', function(event, data) {\n $scope.imagesData = data;\n });\n\n $scope.imagesDataReload = function() {\n return ServiceImagesData.load(true);\n }\n */\n\n // ServiceFiltesrData inheritance\n\n $scope.filtersData = ServiceFiltersData.data;\n\n $scope.$on('service:FiltersData', function(event, data) {\n $scope.filtersData = data;\n });\n\n // controller logic\n\n $scope.noFilters = function() {\n if ($scope.options) {\n return $scope.options.no_filter;\n }\n }\n\n $scope.thumbnailfilter = null;\n\n $scope.imageLoading = false;\n\n $scope.fileId = 0;\n\n $scope.filterId = 0;\n\n $scope.imageinfo = null;\n\n $scope.imageNotFoundError = false;\n\n $scope.filterApply = function() {\n ServiceFilesData.getFile($scope.fileId).then(function(response) {\n var images = $filter('filter')(response.images, {filterId: $scope.filterId}, true);\n $scope.imageLoading = true;\n // unable to find the image for the given filter, create the image for the filter\n if (images.length == 0) {\n $http.post('admin/api-admin-storage/image-filter', { fileId : $scope.fileId, filterId : $scope.filterId}).then(function(uploadResponse) {\n $scope.ngModel = uploadResponse.data.id;\n AdminToastService.success(i18n['js_dir_image_upload_ok']);\n $scope.imageLoading = false;\n });\n }\n });\n \n \t/*\n var items = $filter('filter')($scope.imagesData, {fileId: $scope.fileId, filterId: $scope.filterId}, true);\n if (items && items.length == 0) {\n $scope.imageLoading = true;\n // image does not exists make request.\n $http.post('admin/api-admin-storage/image-upload', $.param({ fileId : $scope.fileId, filterId : $scope.filterId }), {\n headers : {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}\n }).then(function(transport) {\n if (!transport.data.error) {\n $scope.imagesDataReload().then(function(r) {\n $scope.ngModel = transport.data.id;\n AdminToastService.success(i18n['js_dir_image_upload_ok']);\n $scope.imageLoading = false;\n });\n }\n }, function(error) {\n \tAdminToastService.error(i18n['js_dir_image_filter_error']);\n $scope.imageLoading = false;\n });\n } else {\n var item = items[0];\n $scope.ngModel = item.id\n $scope.imageinfo = item;\n }\n */\n };\n\n $scope.$watch(function() { return $scope.filterId }, function(n, o) {\n if (n != null && n !== undefined && $scope.fileId !== 0 && n !== o && n != o) {\n $scope.filterApply();\n }\n });\n\n $scope.$watch(function() { return $scope.fileId }, function(n, o) {\n \tif (n !== undefined && n != null && n != o) {\n \t\tif (n == 0) {\n $scope.filterId = 0;\n $scope.imageinfo = null;\n $scope.ngModel = 0;\n } else {\n \t$scope.filterApply();\n }\n }\n });\n\n $scope.$watch(function() { return $scope.ngModel }, function(n, o) {\n if (n != 0 && n != null && n !== undefined) {\n //var filtering = $filter('findidfilter')($scope.imagesData, n, true);\n ServiceImagesData.getImage(n).then(function(response) {\n \t$scope.imageinfo = response;\n \t$scope.fileId = response.file_id;\n \t$scope.filterId = response.filter_id;\n });\n /*\n if (filtering) {\n $scope.imageinfo = filtering;\n $scope.filterId = filtering.filterId;\n $scope.fileId = filtering.fileId;\n } else {\n \t$scope.imageNotFoundError = true;\n }\n */\n }\n /* reset image preview directive if an event resets the image model to undefined */\n if (n == undefined || n == 0) {\n \t$scope.fileId = 0;\n $scope.filterId = 0;\n $scope.imageinfo = null;\n $scope.thumb = false;\n }\n\n });\n\n $scope.thumb = false;\n\n $scope.getThumbnailFilter = function() {\n \tif ($scope.thumbnailfilter === null) {\n \t\tif ('medium-thumbnail' in $scope.filtersData) {\n \t\t\t$scope.thumbnailfilter = $scope.filtersData['medium-thumbnail'];\n \t\t}\n \t}\n \treturn $scope.thumbnailfilter;\n }\n\n $scope.$watch('imageinfo', function(n, o) {\n \tif (n != 0 && n != null && n !== undefined) {\n \t\tif (n.filterId != 0) {\n \t\t\t$scope.thumb = n;\n \t\t} else {\n \t\t\tvar result = $filter('findthumbnail')($scope.imagesData, n.fileId, $scope.getThumbnailFilter().id);\n \t\t\tif (!result) {\n \t\t\t\t$scope.thumb = n;\n \t\t\t} else {\n \t\t\t\t$scope.thumb = result;\n \t\t\t}\n \t\t}\n \t}\n })\n }],\n templateUrl : 'storageImageUpload'\n }\n });\n\n /**\n * FILE MANAGER DIR\n */\n zaa.directive(\"storageFileManager\", function() {\n return {\n restrict : 'E',\n transclude : false,\n scope : {\n allowSelection : '@selection',\n onlyImages : '@onlyImages'\n },\n controller : [\n \t'$scope', '$http', '$filter', '$timeout', 'Upload', 'ServiceFoldersData', 'ServiceFilesData', 'LuyaLoading', 'AdminToastService', 'ServiceFoldersDirecotryId', \n \tfunction($scope, $http, $filter, $timeout, Upload, ServiceFoldersData, ServiceFilesData, LuyaLoading, AdminToastService, ServiceFoldersDirecotryId) {\n\n // ServiceFoldersData inheritance\n\n $scope.foldersData = ServiceFoldersData.data;\n\n $scope.$on('service:FoldersData', function(event, data) {\n $scope.foldersData = data;\n });\n\n $scope.foldersDataReload = function() {\n return ServiceFoldersData.load(true);\n };\n\n // ServiceFilesData inheritance\n\n $scope.filesData = [];\n\n $scope.paginations = [];\n \n $scope.currentPageId = 0;\n \n // load files data for a given folder id\n $scope.$watch('currentFolderId', function(folderId) {\n \tconsole.log(folderId);\n \tif (folderId !== undefined) {\n \t\t$scope.getFilesForPageAndFolder(folderId, 0);\n \t}\n });\n\n $scope.getFilesForPageAndFolder = function(folderId, pageId) {\n \t$http.get('admin/api-admin-storage/data-files?folderId='+folderId+'&page='+pageId).then(function(response) {\n console.log('request filemanager list', folderId, pageId, response);\n \t\t$scope.filesData = response.data.data;\n $scope.filesMetaToPagination(response.data.__meta);\n \t});\n };\n\n $scope.filesMetaToPagination = function(meta) {\n var pages = [];\n for (i = 0; i < meta.totalPages; i++) {\n var isActive = meta.currentPage == i;\n pages.push({isActive: isActive, label: i+1, index: i});\n }\n $scope.paginations = pages;\n };\n\n $scope.getFilesForPage = function(pageId) {\n \t$scope.currentPageId = pageId;\n $scope.getFilesForPageAndFolder($scope.currentFolderId, pageId);\n };\n \n $scope.getFilesForCurrentPage = function() {\n \t$scope.getFilesForPageAndFolder($scope.currentFolderId, $scope.currentPageId);\n }\n \n // ServiceFolderId\n\n $scope.currentFolderId = ServiceFoldersDirecotryId.folderId;\n\n $scope.$on('FoldersDirectoryId', function(event, folderId) {\n \t$scope.currentFolderId = folderId;\n });\n\n $scope.foldersDirecotryIdReload = function() {\n \treturn ServiceFoldersDirecotryId.load(true);\n }\n\n // file replace logic\n\n $scope.folderCountMessage = function(folder) {\n \treturn i18nParam('js_filemanager_count_files_overlay', {count: folder.filesCount});\n }\n\n $scope.errorMsg = null;\n\n $scope.replaceFile = function(file, errorFiles) {\n \t$scope.replaceFiled = file;\n\n \tif (!file) {\n \t\treturn;\n \t}\n\n \tLuyaLoading.start();\n\n \tUpload.upload({\n \t\turl: 'admin/api-admin-storage/file-replace',\n data: {file: file, fileId: $scope.fileDetail.id}\n }).then(function (response) {\n \tLuyaLoading.stop();\n \tif (response.status == 200) {\n //$scope.filesDataReload().then(function() {\n \tvar fileref = $filter('findidfilter')($scope.filesData, $scope.fileDetail.id, true);\n \tvar random = (new Date()).toString();\n \tif (fileref.isImage) {\n\t \tfileref.thumbnail.source = fileref.thumbnail.source + \"?cb=\" + random;\n\t \tfileref.thumbnailMedium.source = fileref.thumbnailMedium.source + \"?cb=\" + random;\n\t }\n \t$scope.fileDetail = fileref;\n \tAdminToastService.success('the file has been replaced successfull.');\n //});\n \t}\n }, function() {\n \tLuyaLoading.stop();\n });\n };\n\n // upload logic\n\n $scope.$watch('uploadingfiles', function (uploadingfiles) {\n if (uploadingfiles != null) {\n $scope.uploadResults = 0;\n LuyaLoading.start(i18n['js_dir_upload_wait']);\n for (var i = 0; i < uploadingfiles.length; i++) {\n $scope.errorMsg = null;\n (function (uploadingfiles) {\n $scope.uploadUsingUpload(uploadingfiles);\n })(uploadingfiles[i]);\n }\n }\n });\n\n $scope.$watch('uploadResults', function(n, o) {\n if ($scope.uploadingfiles != null) {\n if (n == $scope.uploadingfiles.length && $scope.errorMsg == null) {\n \tAdminToastService.success(i18n['js_dir_manager_upload_image_ok']);\n LuyaLoading.stop();\n $scope.getFilesForCurrentPage();\n }\n }\n })\n\n $scope.pasteUpload = function(e) {\n\n for (var i = 0 ; i < e.originalEvent.clipboardData.items.length ; i++) {\n var item = e.originalEvent.clipboardData.items[i];\n\n if (item.kind == 'file') {\n \tLuyaLoading.start(i18n['js_dir_upload_wait']);\n\t Upload.upload({\n\t url: 'admin/api-admin-storage/files-upload',\n\t fields: {'folderId': $scope.currentFolderId},\n\t file: item.getAsFile()\n\t }).then(function(response) {\n \t\tif (response.data.upload) {\n\t\t \t//$scope.filesDataReload().then(function() {\n\t\t \tAdminToastService.success(i18n['js_dir_manager_upload_image_ok']);\n\t\t \tLuyaLoading.stop();\n\t\t //});\n \t\t} else {\n \t\t\tAdminToastService.error(response.data.message);\n \t\t\tLuyaLoading.stop();\n \t\t}\n\n\t })\n }\n }\n }\n\n $scope.uploadUsingUpload = function(file) {\n \tfile.upload = Upload.upload({\n url: 'admin/api-admin-storage/files-upload',\n fields: {'folderId': $scope.currentFolderId},\n file: file\n });\n\n file.upload.then(function (response) {\n $timeout(function () {\n $scope.uploadResults++;\n file.processed = true;\n file.result = response.data;\n if (!file.result.upload) {\n \tAdminToastService.error(file.result.message);\n \tLuyaLoading.stop();\n $scope.errorMsg = true\n }\n });\n }, function (response) {\n if (response.status > 0) {\n $scope.errorMsg = true;\n }\n });\n\n file.upload.progress(function (evt) {\n file.processed = false;\n // Math.min is to fix IE which reports 200% sometimes\n file.progress = Math.min(100, parseInt(100.0 * evt.loaded / evt.total));\n });\n }\n\n // selector logic\n\n $scope.selectedFiles = [];\n\n $scope.toggleSelectionAll = function() {\n \tvar files = $filter('filemanagerfilesfilter')($scope.filesData, $scope.currentFolderId, $scope.onlyImages);\n \tfiles.forEach(function(value, key) {\n \t\t$scope.toggleSelection(value);\n \t})\n }\n\n $scope.toggleSelection = function(file) {\n if ($scope.allowSelection == 'true') {\n // parent inject\n $scope.$parent.select(file.id);\n return;\n }\n\n var i = $scope.selectedFiles.indexOf(file.id);\n if (i > -1) {\n $scope.selectedFiles.splice(i, 1);\n } else {\n $scope.selectedFiles.push(file.id);\n }\n };\n\n $scope.inSelection = function(file) {\n var response = $scope.selectedFiles.indexOf(file.id);\n\n if (response != -1) {\n return true;\n }\n\n return false;\n };\n\n // folder add\n\n $scope.showFolderForm = false;\n\n $scope.createNewFolder = function(newFolderName) {\n \tif (!newFolderName) {\n \t\treturn;\n \t}\n $http.post('admin/api-admin-storage/folder-create', { folderName : newFolderName , parentFolderId : $scope.currentFolderId }).then(function() {\n $scope.foldersDataReload().then(function() {\n $scope.folderFormToggler();\n $scope.newFolderName = null;\n })\n });\n };\n\n $scope.folderFormToggler = function() {\n $scope.showFolderForm = !$scope.showFolderForm;\n };\n\n // controller logic\n\n $scope.searchQuery = '';\n\n $scope.sortField = 'name';\n\n $scope.changeSortField = function(name) {\n \t$scope.sortField = name;\n };\n\n $scope.changeCurrentFolderId = function(folderId, noState) {\n $scope.currentFolderId = folderId;\n $scope.currentPageId = 0;\n if (noState !== true) {\n \tServiceFoldersDirecotryId.folderId = folderId;\n \t$http.post('admin/api-admin-common/save-filemanager-folder-state', {folderId : folderId}, {ignoreLoadingBar: true});\n }\n };\n\n $scope.toggleFolderItem = function(data) {\n if (data.toggle_open == undefined) {\n data['toggle_open'] = 1;\n } else {\n data['toggle_open'] = !data.toggle_open;\n }\n $http.post('admin/api-admin-common/filemanager-foldertree-history', {data : data}, {ignoreLoadingBar: true});\n };\n\n $scope.folderUpdateForm = false;\n\n $scope.folderDeleteForm = false;\n\n $scope.folderDeleteConfirmForm = false;\n \n $scope.updateFolder = function(folder) {\n $http.post('admin/api-admin-storage/folder-update?folderId=' + folder.id, {name : folder.name });\n };\n \n $scope.deleteFolder = function(folder) {\n\n // check if folder is empty\n \t$http.post('admin/api-admin-storage/is-folder-empty?folderId=' + folder.id, { name : folder.name }).then(function(transport) {\n if (transport.data == true) {\n\n $http.post('admin/api-admin-storage/folder-delete?folderId=' + folder.id, { name : folder.name }).then(function(transport) {\n $scope.foldersDataReload().then(function() {\n //$scope.filesDataReload().then(function() {\n $scope.currentFolderId = 0;\n //});\n });\n });\n\n } else {\n AdminToastService.confirm(i18nParam('layout_filemanager_remove_dir_not_empty', {folderName: folder.name, count: folder.filesCount}), i18n['js_dir_manager_rm_folder_confirm_title'], ['$timeout', '$toast', function($timeout, $toast) {\n $http.post('admin/api-admin-storage/folder-delete?folderId=' + folder.id, { name : folder.name }).then(function() {\n $scope.foldersDataReload().then(function() {\n //$scope.filesDataReload().then(function() {\n $scope.currentFolderId = 0;\n $toast.close();\n //});\n });\n });\n }]);\n }\n });\n };\n\n $scope.fileDetail = false;\n\n $scope.showFoldersToMove = false;\n\n $scope.largeImagePreviewState = true;\n \n $scope.fileDetailFull = false;\n \n $scope.nameEditMode = false;\n \n $scope.openFileDetail = function(file) {\n \tif ($scope.fileDetail.id == file.id) {\n \t\t$scope.closeFileDetail();\n \t} else {\n \t\t\n \t\tServiceFilesData.getFile(file.id).then(function(responseFile) {\n \t\t\t$scope.fileDetailFull = responseFile;\n \t\t});\n \t\t\n \t\t$scope.fileDetail = file;\n \t}\n };\n \n $scope.updateFileData = function() {\n \t\t$http.put('admin/api-admin-storage/file-update?id='+$scope.fileDetailFull.id, $scope.fileDetailFull).then(function(response) {\n \t\t\tvar file = $filter('findidfilter')($scope.filesData, $scope.fileDetail.id, true);\n \t\t\tfile.name = response.data.name_original;\n \t\t\t$scope.nameEditMode = false;\n \t\t});\n };\n\n $scope.closeFileDetail = function() {\n $scope.fileDetail = false;\n $scope.fileDetailFull = false;\n $scope.nameEditMode = false;\n };\n \n $scope.removeFile = function(detail) {\n \t$scope.selectedFiles = [];\n \t$scope.toggleSelection(detail);\n \t$scope.removeFiles();\n };\n\n $scope.moveFilesTo = function(folderId) {\n $http.post('admin/api-admin-storage/filemanager-move-files', {'fileIds' : $scope.selectedFiles, 'toFolderId' : folderId}).then(function(transport) {\n //$scope.filesDataReload().then(function() {\n $scope.selectedFiles = [];\n $scope.showFoldersToMove = false;\n //});\n });\n };\n\n $scope.removeFiles = function() {\n AdminToastService.confirm(i18n['js_dir_manager_rm_file_confirm'], i18n['js_dir_manager_rm_file_confirm_title'], ['$timeout', '$toast', function($timeout, $toast) {\n $http.post('admin/api-admin-storage/filemanager-remove-files', {'ids' : $scope.selectedFiles}).then(function(transport) {\n //$scope.filesDataReload().then(function() {\n $toast.close();\n AdminToastService.success(i18n['js_dir_manager_rm_file_ok']);\n $scope.selectedFiles = [];\n \t$scope.closeFileDetail();\n //});\n });\n }]);\n }\n\n // file detail view logic\n\n $scope.storeFileCaption = function(fileDetail) {\n \t$http.post('admin/api-admin-storage/filemanager-update-caption', {'id': fileDetail.id, 'captionsText' : fileDetail.captionArray}).then(function(transport) {\n \tAdminToastService.success('Captions has been updated');\n });\n }\n\n $scope.selectedFileFromParent = null;\n\n $scope.init = function() {\n \tif ($scope.$parent.fileinfo) {\n \t\t$scope.selectedFileFromParent = $scope.$parent.fileinfo;\n \t\t$scope.changeCurrentFolderId($scope.selectedFileFromParent.folder_id, true);\n \t}\n }\n\n $scope.init();\n\n }],\n templateUrl : 'storageFileManager'\n }\n });\n\n zaa.directive(\"hasEnoughSpace\", ['$window', '$timeout', function($window, $timeout) {\n return {\n restrict: \"A\",\n scope: {\n \"loadingCondition\": \"=\",\n \"isFlexBox\": \"=\"\n },\n link: function (scope, element, attrs) {\n scope.elementWidth = 0;\n\n var getElementOriginalWidth = function() {\n var elementClone = element.clone().insertAfter(element);\n\n elementClone.css({\n 'position': 'fixed',\n 'top': 0,\n 'left': 0,\n 'visibility': 'hidden'\n });\n\n if(elementClone.css('display') === 'none') {\n elementClone.css('display', scope.isFlexBox ? 'flex' : 'block');\n }\n\n var elementOriginalWidth = elementClone.outerWidth();\n\n elementClone.remove();\n\n return elementOriginalWidth;\n };\n\n\n function checkSize() {\n $timeout(function() {\n if(!scope.elementOriginalWidth) {\n scope.elementOriginalWidth = getElementOriginalWidth();\n }\n\n if(element.hasClass('not-enough-space')) {\n element.removeClass('not-enough-space');\n element.addClass('has-enough-space');\n }\n\n var currentElementSpace = element.parent().outerWidth();\n\n if(currentElementSpace < scope.elementOriginalWidth) {\n element.removeClass('has-enough-space').addClass('not-enough-space');\n } else {\n element.removeClass('not-enough-space').addClass('has-enough-space');\n }\n });\n }\n\n angular.element($window).on('resize', function() {\n checkSize();\n });\n\n scope.$watch('loadingCondition', function(n) {\n if(n == true) {\n checkSize();\n }\n });\n\n }\n }\n }]);\n\n zaa.directive('activeClass', function () {\n return {\n restrict: 'A',\n scope: {\n activeClass: '@'\n },\n link: function (scope, element) {\n element.on('mouseenter', function() {\n element.addClass(scope.activeClass);\n });\n element.on('mouseleave', function() {\n element.removeClass(scope.activeClass);\n });\n element.on('click', function() {\n element.toggleClass(scope.activeClass);\n });\n }\n };\n });","\n\t\n\tzaa.controller(\"DefaultDashboardObjectController\", ['$scope', '$http', '$sce', function($scope, $http, $sce) {\n\n\t\t$scope.data;\n\n\t\t$scope.loadData = function(dataApiUrl) {\n\t\t\t$http.get(dataApiUrl).then(function(success) {\n\t\t\t\t$scope.data = success.data;\n\t\t\t});\n\t\t};\n\t}]);\n\n\t/**\n\t * Base Crud Controller\n\t *\n\t * Assigned config variables from the php view assigned from child to parent:\n\t *\n\t * + bool $config.inline Determines whether this crud is in inline mode orno\n\t */\n\tzaa.controller(\"CrudController\", ['$scope', '$filter', '$http', '$sce', '$state', '$timeout', '$injector', '$q', 'AdminLangService', 'LuyaLoading', 'AdminToastService', 'CrudTabService', function($scope, $filter, $http, $sce, $state, $timeout, $injector, $q, AdminLangService, LuyaLoading, AdminToastService, CrudTabService) {\n\n\t\t$scope.toast = AdminToastService;\n\n\t\t$scope.AdminLangService = AdminLangService;\n\n\t\t$scope.tabService = CrudTabService;\n\n\t\t/***** TABS AND SWITCHES *****/\n\n\t\t/**\n\t\t * 0 = list\n\t\t * 1 = add\n\t\t * 2 = edit\n\t\t */\n\t\t$scope.crudSwitchType = 0;\n\n\t\t$scope.switchToTab = function(tab) {\n\t\t\tangular.forEach($scope.tabService.tabs, function(item) {\n\t\t\t\titem.active = false;\n\t\t\t});\n\n\t\t\ttab.active = true;\n\n\t\t\t$scope.switchTo(4);\n\t\t};\n\t\t\n\t\t$scope.addAndswitchToTab = function(pk, route, index, label, model) {\n\t\t\t$scope.tabService.addTab(pk, route, index, label, model);\n\t\t\t\n\t\t\t$scope.switchTo(4);\n\t\t}\n\n\t\t$scope.closeTab = function(tab, index) {\n\t\t\t$scope.tabService.remove(index, $scope);\n\t\t};\n\n\t\t$scope.switchTo = function(type, reset) {\n\t\t\tif ($scope.config.relationCall) {\n\t\t\t\t$scope.crudSwitchType = type;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (reset) {\n\t\t\t\t$scope.resetData();\n\t\t\t}\n\n\t\t\tif (type == 0) {\n\t\t\t\t$http.get($scope.config.apiEndpoint + '/unlock');\n\t\t\t}\n\n\t\t\tif (type == 0 || type == 1) {\n\t\t\t\tif (!$scope.config.inline) {\n\t\t\t\t\t$state.go('default.route');\n\t\t\t\t}\n\t\t\t}\n\t\t\t$scope.crudSwitchType = type;\n\n\t\t\tif (type !== 4 && !$scope.config.inline) {\n\t\t\t\tangular.forEach($scope.tabService.tabs, function(item) {\n\t\t\t\t\titem.active = false;\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\t$scope.closeUpdate = function () {\n\t\t\t$scope.switchTo(0, true);\n\t };\n\n\t\t$scope.closeCreate = function() {\n\t\t\t$scope.switchTo(0, true);\n\t\t};\n\n\t\t$scope.activeWindowModal = true;\n\n\t\t$scope.openActiveWindow = function() {\n\t\t\t$scope.activeWindowModal = false;\n\t\t};\n\n\t\t$scope.closeActiveWindow = function() {\n\t\t\t$scope.activeWindowModal = true;\n\t\t};\n\n\t\t$scope.changeGroupByField = function() {\n\t\t\tif ($scope.config.groupByField == 0) {\n\t\t\t\t$scope.config.groupBy = 0;\n\t\t\t} else {\n\t\t\t\t$scope.config.groupBy = 1;\n\t\t\t}\n\t\t};\n\n\t\t/********** EXPORT ****/\n\n\t\t$scope.exportLoading = false;\n\n\t\t$scope.exportResponse = false;\n\n\t\t$scope.exportDownloadButton = false;\n\n\t\t$scope.exportData = function() {\n\t\t\t$scope.exportLoading = true;\n\t\t\t$http.get($scope.config.apiEndpoint + '/export').then(function(response) {\n\t\t\t\t$scope.exportLoading = false;\n\t\t\t\t$scope.exportResponse = response.data;\n\t\t\t\t$scope.exportDownloadButton = true;\n\t\t\t});\n\t\t};\n\n\t\t$scope.exportDownload = function() {\n\t\t\t$scope.exportDownloadButton = false;\n\t\t\twindow.open($scope.exportResponse.url);\n\t\t\treturn false;\n\t\t};\n\n\t\t$scope.applySaveCallback = function() {\n\t\t\tif ($scope.config.saveCallback) {\n\t\t\t\t$injector.invoke($scope.config.saveCallback, this);\n\t\t\t}\n\t\t};\n\n\t\t$scope.showCrudList = true;\n\n\t\t/*********** ORDER **********/\n\n\t\t$scope.isOrderBy = function(field) {\n\t\t\tif (field == $scope.config.orderBy) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t};\n\n\t\t$scope.changeOrder = function(field, sort) {\n\t\t\t$scope.config.orderBy = sort + field;\n\n\t\t\t$http.post('admin/api-admin-common/ngrest-order', {'apiEndpoint' : $scope.config.apiEndpoint, sort: sort, field: field}, { ignoreLoadingBar: true });\n\n\t\t\tif ($scope.pager && !$scope.config.pagerHiddenByAjaxSearch) {\n\t\t\t\t$scope.loadList(1);\n\t\t\t} else {\n\t\t\t\t$scope.data.listArray = $filter('orderBy')($scope.data.listArray, sort + field);\n\t\t\t}\n\t\t};\n\n\t\t$scope.reApplyOrder = function() {\n\t\t\t$scope.data.listArray = $filter('orderBy')($scope.data.listArray, $scope.config.orderBy);\n\t\t};\n\n\t\t/***************** ACTIVE WINDOW *********/\n\n\t\t$scope.reloadActiveWindow = function() {\n\t\t\t$scope.getActiveWindow($scope.data.aw.hash, $scope.data.aw.itemId);\n\t\t}\n\n\t\t$scope.getActiveWindow = function (activeWindowId, id, $event) {\n\t\t\t$http.post($scope.config.activeWindowRenderUrl, $.param({ itemId : id, activeWindowHash : activeWindowId , ngrestConfigHash : $scope.config.ngrestConfigHash }), {\n\t\t\t\theaders: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}\n\t\t\t})\n\t\t\t.then(function(response) {\n\t\t\t\t$scope.openActiveWindow();\n\t\t\t\t$scope.data.aw.itemId = id;\n\t\t\t\t$scope.data.aw.configCallbackUrl = $scope.config.activeWindowCallbackUrl;\n\t\t\t\t$scope.data.aw.configHash = $scope.config.ngrestConfigHash;\n\t\t\t\t$scope.data.aw.hash = activeWindowId;\n\t\t\t\t$scope.data.aw.content = $sce.trustAsHtml(response.data.content);\n\t\t\t\t$scope.data.aw.title = response.data.label;\n\t\t\t\t$scope.$broadcast('awloaded', {id: activeWindowId});\n\t\t\t})\n\t\t};\n\n\t\t$scope.getActiveWindowCallbackUrl = function(callback) {\n\t\t\treturn $scope.data.aw.configCallbackUrl + '?activeWindowCallback=' + callback + '&ngrestConfigHash=' + $scope.data.aw.configHash + '&activeWindowHash=' + $scope.data.aw.hash;\n\t\t};\n\n\t\t/**\n\t\t * new returns a promise promise.hten(function(answer) {\n\t\t * \n\t\t * }, function(error) {\n\t\t * \n\t\t * }, function(progress) {\n\t\t * \n\t\t * });\n\t\t *\n\t\t * instead of return variable\n\t\t */\n\t\t$scope.sendActiveWindowCallback = function(callback, data) {\n\t\t\tvar data = data || {};\n\t\t\treturn $http.post($scope.getActiveWindowCallbackUrl(callback), $.param(data), {\n\t\t\t\theaders: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}\n\t\t\t});\n\t\t};\n\n\t\t/*************** SEARCH ******************/\n\n\n\t\t$scope.$watch('config.searchQuery', function(n, o) {\n\t\t\tif (n == o || n == undefined || n == null) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t$scope.applySearchQuery(n);\n\t\t});\n\n\t\t$scope.applySearchQuery = function(n) {\n\t\t\tif (n == undefined || n == null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar blockRequest = false;\n\t\t\tif ($scope.pager) {\n\t\t\t\tif (n.length == 0) {\n\t\t\t\t\t$timeout.cancel($scope.searchPromise);\n\t\t\t\t\t$scope.data.listArray = $scope.data.list;\n\t\t\t\t\t$scope.config.pagerHiddenByAjaxSearch = false;\n\t\t\t\t} else {\n\t\t\t\t\t$timeout.cancel($scope.searchPromise);\n\n\t\t\t\t\tif (blockRequest) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t$scope.searchPromise = $timeout(function() {\n\t\t\t\t\t\tblockRequest = true;\n\t\t\t\t\t\t$http.post($scope.config.apiEndpoint + '/full-response?' + $scope.config.apiListQueryString, {query: n}).then(function(response) {\n\t\t\t\t\t\t\t$scope.config.pagerHiddenByAjaxSearch = true;\n\t\t\t\t\t\t\tblockRequest = false;\n\t\t\t\t\t\t\t$scope.config.fullSearchContainer = response.data;\n\t\t\t\t\t\t\t$scope.data.listArray = $filter('filter')(response.data, n);\n\t\t\t\t\t\t});\n\t\t\t\t\t}, 500)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$scope.config.pagerHiddenByAjaxSearch = false;\n\t\t\t\t$scope.data.listArray = $filter('filter')($scope.data.list, n);\n\t\t\t}\n\t\t};\n\n\t\t$scope.reApplySearch = function() {\n\t\t\t$scope.applySearchQuery($scope.config.searchQuery);\n\t\t}\n\n\t\t/******* RELATION CALLLS *********/\n\n\t\t/**\n\t\t * Modal view select a value from a modal into its parent plugin.\n\t\t */\n\t\t$scope.parentSelectInline = function(item) {\n\t\t\t$scope.$parent.$parent.$parent.setModelValue($scope.getRowPrimaryValue(item), item);\n\t\t};\n\t\t\n\t\t/**\n\t\t * Check if a field exists in the parents relation list, if yes hide the field\n\t\t * for the given form and return the relation call value instead in order to auto store those.\n\t\t */\n\t\t$scope.checkIfFieldExistsInParentRelation = function(field) {\n\t\t\t// this call is relation call, okay check for the parent relation defition\n\t\t\tif ($scope.config.relationCall) {\n\t\t\t\tvar relations = $scope.$parent.$parent.config.relations;\n\t\t\t\t\n\t\t\t\tvar definition = relations[parseInt($scope.config.relationCall.arrayIndex)];\n\t\t\t\t\n\t\t\t\tvar linkDefintion = definition.relationLink;\n\t\t\t\t\n\t\t\t\tif (linkDefintion !== null && linkDefintion.hasOwnProperty(field)) {\n\t\t\t\t\treturn parseInt($scope.config.relationCall.id);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\treturn false;\n\t\t}\n\n\t\t$scope.relationItems = [];\n\n\t\t/****** DELETE, UPDATE, CREATE */\n\n\t\t$scope.deleteItem = function(id, $event) {\n\t\t\tAdminToastService.confirm(i18n['js_ngrest_rm_page'], i18n['ngrest_button_delete'], ['$toast', function($toast) {\n\t\t\t\t$http.delete($scope.config.apiEndpoint + '/'+id).then(function(response) {\n\t\t\t\t\t$scope.loadList();\n\t\t\t\t\t$toast.close();\n\t\t\t\t\tAdminToastService.success(i18n['js_ngrest_rm_confirm']);\n\t\t\t\t}, function(data) {\n\t\t\t\t\t$scope.printErrors(data);\n\t\t\t\t});\n\t\t\t}]);\n\t\t};\n\n\t\t$scope.toggleUpdate = function(id) {\n\t\t\t$scope.resetData();\n\t\t\t$http.get($scope.config.apiEndpoint + '/'+id+'?' + $scope.config.apiUpdateQueryString).then(function(response) {\n\t\t\t\tvar data = response.data;\n\t\t\t\t$scope.data.update = data;\n\n\t\t\t\tif ($scope.config.relationCall) {\n\n\t\t\t\t\t$scope.crudSwitchType = 2;\n\t\t\t\t} else {\n\t\t\t\t\t$scope.switchTo(2);\n\t\t\t\t}\n\t\t\t\tif (!$scope.config.inline) {\n\t\t\t\t\t$state.go('default.route.detail', {id : id});\n\t\t\t\t}\n\t\t\t\t$scope.data.updateId = id;\n\t\t\t}, function(data) {\n\t\t\t\tAdminToastService.error(i18n['js_ngrest_error']);\n\t\t\t});\n\t\t};\n\n\t\t$scope.submitUpdate = function () {\n\t\t\t$http.put($scope.config.apiEndpoint + '/' + $scope.data.updateId, angular.toJson($scope.data.update, true)).then(function(response) {\n\t\t\t\tAdminToastService.success(i18n['js_ngrest_rm_update']);\n\t\t\t\t$scope.loadList();\n\t\t\t\t$scope.applySaveCallback();\n\t\t\t\t$scope.switchTo(0, true);\n\t\t\t\t$scope.highlightItemId($scope.data.updateId);\n\t\t\t}, function(response) {\n\t\t\t\t$scope.printErrors(response.data);\n\t\t\t});\n\t\t};\n\n\n\t\t$scope.submitCreate = function() {\n\n\t\t\tif ($scope.config.relationCall) {\n\t\t\t\t//$scope.data.create[$scope.relationCall.field] = parseInt($scope.relationCall.id);\n\t\t\t}\n\n\t\t\t$http.post($scope.config.apiEndpoint, angular.toJson($scope.data.create, true)).then(function(response) {\n\t\t\t\tAdminToastService.success(i18n['js_ngrest_rm_success']);\n\t\t\t\t$scope.loadList();\n\t\t\t\t$scope.applySaveCallback();\n\t\t\t\t$scope.switchTo(0, true);\n\t\t\t}, function(data) {\n\t\t\t\t$scope.printErrors(data.data);\n\t\t\t});\n\t\t};\n\n\t\t$scope.printErrors = function(data) {\n\t\t\tangular.forEach(data, function(value, key) {\n\t\t\t\tAdminToastService.error(value.message);\n\t\t\t});\n\t\t};\n\n\t\t$scope.resetData = function() {\n\t\t\t$scope.data.create = angular.copy({});\n\t\t\t$scope.data.update = angular.copy({});\n\t\t};\n\n\t\t/****** HIGHLIHGED ****/\n\n\t\t$scope.highlightId = 0;\n\n\t\t$scope.isHighlighted = function(itemId) {\n\t\t\tif (itemId[$scope.config.pk] == $scope.highlightId) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t};\n\n\t\t$scope.highlightItemId = function(id) {\n\t\t\t$scope.highlightId = id;\n\t\t\t$timeout(function() {\n\t\t\t\t$scope.highlightId = 0;\n\t\t\t}, 3000);\n\t\t}\n\n\t\t$scope.changeNgRestFilter = function() {\n\t\t\t$http.post('admin/api-admin-common/ngrest-filter', {'apiEndpoint' : $scope.config.apiEndpoint, 'filterName': $scope.config.filter}, { ignoreLoadingBar: true });\n\t\t\t$scope.loadList();\n\t\t}\n\n\t\t/*\n\n\t\t$scope.$watch('config.filter', function(n, o) {\n\t\t\tif (n != o && n != undefined) {\n\t\t\t\t$scope.blockFilterSeriveReload = true;\n\t\t\t\t$http.post('admin/api-admin-common/ngrest-filter', {'apiEndpoint' : $scope.config.apiEndpoint, 'filterName': $scope.config.filter}, { ignoreLoadingBar: true });\n\t\t\t\t$scope.reloadCrudList();\n\t\t\t}\n\t\t})\n\t\t*/\n\n\n\n\t\t/*** PAGINIATION ***/\n\n\t\t$scope.pagerPrevClick = function() {\n\t\t\tif ($scope.pager.currentPage != 1) {\n\t\t\t\t$scope.loadList(parseInt($scope.pager.currentPage)-1);\n\t\t\t}\n\t\t};\n\n\t\t$scope.pagerNextClick = function() {\n\t\t\tif ($scope.pager.currentPage != $scope.pager.pageCount) {\n\t\t\t\t$scope.loadList(parseInt($scope.pager.currentPage)+1);\n\t\t\t}\n\t\t};\n\n\t\t$scope.pager = false;\n\n\t\t$scope.setPagination = function(currentPage, pageCount, perPage, totalItems) {\n\t\t\tif (currentPage != null && pageCount != null && perPage != null && totalItems != null) {\n\n\t\t\t\t$scope.totalRows = totalItems;\n\t\t\t\tvar i = 1;\n\t\t\t\tvar urls = [];\n\t\t\t\tfor (i = 1; i <= pageCount; i++) {\n\t\t\t\t\turls.push(i);\n\t\t\t\t}\n\n\t\t\t\t$scope.pager = {\n\t\t\t\t\t'currentPage': currentPage,\n\t\t\t\t\t'pageCount': pageCount,\n\t\t\t\t\t'perPage': perPage,\n\t\t\t\t\t'totalItems': totalItems,\n\t\t\t\t\t'pages': urls,\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\t$scope.pager = false;\n\t\t\t}\n\t\t};\n\n\t\t/***** TOGGLER PLUGIN *****/\n\n\n\t\t$scope.toggleStatus = function(row, fieldName, fieldLabel, bindValue) {\n\t\t\tvar invertValue = !bindValue;\n\t\t\tvar invert = invertValue ? 1 : 0;\n\t\t\tvar rowId = row[$scope.config.pk];\n\t\t\tvar json = {};\n\t\t\tjson[fieldName] = invert;\n\t\t\t$http.put($scope.config.apiEndpoint + '/' + rowId +'?ngrestCallType=update&fields='+fieldName, angular.toJson(json, true)).then(function(response) {\n\t\t\t\trow[fieldName] = invert;\n\t\t\t\t$scope.highlightItemId(rowId);\n\t\t\t\tAdminToastService.success(i18nParam('js_ngrest_toggler_success', {field: fieldLabel}));\n\t\t\t}, function(data) {\n\t\t\t\t$scope.printErrors(data);\n\t\t\t});\n\t\t};\n\n\t\t/**** SORTABLE PLUGIN ****/\n\n\t\t$scope.sortableUp = function(index, row, fieldName) {\n\t\t\tvar switchWith = $scope.data.listArray[index-1];\n\t\t\t$scope.data.listArray[index-1] = row;\n\t\t\t$scope.data.listArray[index] = switchWith;\n\t\t\t$scope.updateSortableIndexPositions(fieldName);\n\t\t};\n\n\t\t$scope.sortableDown = function(index, row, fieldName) {\n\t\t\tvar switchWith = $scope.data.listArray[index+1];\n\t\t\t$scope.data.listArray[index+1] = row;\n\t\t\t$scope.data.listArray[index] = switchWith;\n\t\t\t$scope.updateSortableIndexPositions(fieldName);\n\t\t};\n\n\t\t$scope.updateSortableIndexPositions = function(fieldName) {\n\t\t\tangular.forEach($scope.data.listArray, function(value, key) {\n\t\t\t\tvar json = {};\n\t\t\t\tjson[fieldName] = key;\n\t\t\t\tvar rowId = value[$scope.config.pk];\n\t\t\t\t$http.put($scope.config.apiEndpoint + '/' + rowId +'?ngrestCallType=update&fields='+fieldName, angular.toJson(json, true), {\n\t\t\t\t\t ignoreLoadingBar: true\n\t\t\t\t});\n\t\t\t});\n\t\t};\n\n\t\t/***** LIST LOADERS ********/\n\n\t\t/**\n\t\t * This method is triggerd by the crudLoader directive to reload service data.\n\t\t */\n\t\t$scope.loadService = function() {\n\t\t\t$scope.initServiceAndConfig();\n\t\t};\n\n\t\t$scope.evalSettings = function(settings) {\n\t\t\tif (settings.hasOwnProperty('order')) {\n\t\t\t\t$scope.config.orderBy = settings['order'];\n\t\t\t}\n\n\t\t\tif (settings.hasOwnProperty('filterName')) {\n\t\t\t\t$scope.config.filter = settings['filterName'];\n\t\t\t}\n\t\t};\n\n\t\t$scope.getRowPrimaryValue = function(row) {\n\t\t\treturn row[$scope.config.pk];\n\t\t};\n\n\t\t$scope.initServiceAndConfig = function() {\n\t\t\tvar deferred = $q.defer();\n\t\t\t$http.get($scope.config.apiEndpoint + '/services').then(function(serviceResponse) {\n\t\t\t\t$scope.service = serviceResponse.data.service;\n\t\t\t\t$scope.serviceResponse = serviceResponse.data;\n\t\t\t\t$scope.evalSettings(serviceResponse.data._settings);\n\t\t\t\tdeferred.resolve();\n\t\t\t});\n\n\t\t\treturn deferred.promise;\n\t\t};\n\n\t\t$scope.getFieldHelp = function(fieldName) {\n\t\t\tif ($scope.serviceResponse && $scope.serviceResponse['_hints'] && $scope.serviceResponse._hints.hasOwnProperty(fieldName)) {\n\t\t\t\treturn $scope.serviceResponse._hints[fieldName];\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t\t$scope.loadList = function(pageId) {\n\t\t\tif (pageId == undefined && $scope.pager) {\n\t\t\t\t$scope.reloadCrudList($scope.pager.currentPage);\n\t\t\t} else {\n\t\t\t\t$scope.reloadCrudList(pageId);\n\t\t\t}\n\t\t};\n\t\t\n\t\t$scope.totalRows = 0;\n\n\t\t// this method is also used withing after save/update events in order to retrieve current selecter filter data.\n\t\t$scope.reloadCrudList = function(pageId) {\n\t\t\tif (parseInt($scope.config.filter) == 0) {\n\t\t\t\tif ($scope.config.relationCall) {\n\t\t\t\t\tvar url = $scope.config.apiEndpoint + '/relation-call/?' + $scope.config.apiListQueryString;\n\t\t\t\t\turl = url + '&arrayIndex=' + $scope.config.relationCall.arrayIndex + '&id=' + $scope.config.relationCall.id + '&modelClass=' + $scope.config.relationCall.modelClass;\n\t\t\t\t} else {\n\t\t\t\t\tvar url = $scope.config.apiEndpoint + '/?' + $scope.config.apiListQueryString;\n\t\t\t\t}\n\n\t\t\t\tif (pageId !== undefined) {\n\t\t\t\t\turl = url + '&page=' + pageId;\n\t\t\t\t}\n\t\t\t\tif ($scope.config.orderBy) {\n\t\t\t\t\turl = url + '&sort=' + $scope.config.orderBy.replace(\"+\", \"\");\n\t\t\t\t}\n\t\t\t\t$http.get(url).then(function(response) {\n\t\t\t\t\t$scope.totalRows = response.data.length;\n\t\t\t\t\t$scope.setPagination(\n\t\t\t\t\t\tresponse.headers('X-Pagination-Current-Page'),\n\t\t\t\t\t\tresponse.headers('X-Pagination-Page-Count'),\n\t\t\t\t\t\tresponse.headers('X-Pagination-Per-Page'),\n\t\t\t\t\t\tresponse.headers('X-Pagination-Total-Count')\n\t\t\t\t\t);\n\n\t\t\t\t\t$scope.data.list = response.data;\n\t\t\t\t\t$scope.data.listArray = response.data;\n\t\t\t\t\t$scope.reApplyOrder();\n\t\t\t\t\t$scope.reApplySearch();\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tvar url = $scope.config.apiEndpoint + '/filter?filterName=' + $scope.config.filter + '&' + $scope.config.apiListQueryString;\n\t\t\t\tif (pageId) {\n\t\t\t\t\turl = url + '&page=' + pageId;\n\t\t\t\t}\n\t\t\t\tif ($scope.config.orderBy) {\n\t\t\t\t\turl = url + '&sort=' + $scope.config.orderBy.replace(\"+\", \"\");\n\t\t\t\t}\n\t\t\t\t$http.get(url).then(function(response) {\n\t\t\t\t\t$scope.totalRows = response.data.length;\n\t\t\t\t\t$scope.setPagination(\n\t\t\t\t\t\tresponse.headers('X-Pagination-Current-Page'),\n\t\t\t\t\t\tresponse.headers('X-Pagination-Page-Count'),\n\t\t\t\t\t\tresponse.headers('X-Pagination-Per-Page'),\n\t\t\t\t\t\tresponse.headers('X-Pagination-Total-Count')\n\t\t\t\t\t);\n\t\t\t\t\t$scope.data.list = response.data;\n\t\t\t\t\t$scope.data.listArray = response.data;\n\t\t\t\t\t$scope.reApplyOrder();\n\t\t\t\t\t$scope.reApplySearch();\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\t$scope.service = false;\n\n\t\t/***** CONFIG AND INIT *****/\n\n\t\t$scope.data = {\n\t\t\tcreate : {},\n\t\t\tupdate : {},\n\t\t\taw : {},\n\t\t\tlist : {},\n\t\t\tupdateId : 0\n\t\t};\n\n\t\t$scope.$watch('config', function(n, o) {\n\t\t\t$timeout(function() {\n\t\t\t\t$scope.initServiceAndConfig().then(function() {\n\t\t\t\t\t$scope.loadList();\n\t\t\t\t});\n\t\t\t})\n\t\t});\n\t}]);\n\n// activeWindowController.js\n\n\tzaa.controller(\"ActiveWindowTagController\", ['$scope', '$http', 'AdminToastService', function($scope, $http, AdminToastService) {\n\n\t\t$scope.crud = $scope.$parent; // {{ data.aw.itemId }}\n\n\t\t$scope.tags = [];\n\n\t\t$scope.relation = {};\n\n\t\t$scope.newTagName = null;\n\n\t\t$scope.loadTags = function() {\n\t\t\t$http.get($scope.crud.getActiveWindowCallbackUrl('LoadTags')).then(function(transport) {\n\t\t\t\t$scope.tags = transport.data;\n\t\t\t});\n\t\t};\n\n\t\t$scope.loadRelations = function() {\n\t\t\t$http.get($scope.crud.getActiveWindowCallbackUrl('LoadRelations')).then(function(transport) {\n\t\t\t\t$scope.relation = {};\n\t\t\t\ttransport.data.forEach(function(value, key) {\n\t\t\t\t\t$scope.relation[value.tag_id] = 1;\n\t\t\t\t});\n\t\t\t});\n\t\t};\n\n\t\t$scope.saveTag = function() {\n\t\t\tvar tagName = $scope.newTagName;\n\n\t\t\tif (tagName !== \"\") {\n\t\t\t\t$scope.crud.sendActiveWindowCallback('SaveTag', {'tagName': tagName}).then(function(response) {\n\t\t\t\t\tif (response.data) {\n\t\t\t\t\t\t$scope.tags.push({id: response.data, name: tagName});\n\t\t\t\t\t\tAdminToastService.success(tagName + ' wurde gespeichert.');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tAdminToastService.error(tagName + ' ' + i18n['js_tag_exists']);\n\t\t\t\t\t}\n\t\t\t\t\t$scope.newTagName = null;\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\t$scope.saveRelation = function(tag, value) {\n\t\t\t$scope.crud.sendActiveWindowCallback('SaveRelation', {'tagId': tag.id, 'value': value}).then(function(response) {\n\n\t\t\t\t$scope.relation[tag.id] = response.data;\n\n\t\t\t\tAdminToastService.success(i18n['js_tag_success']);\n\t\t\t});\n\t\t};\n\n\t\t$scope.$watch(function() { return $scope.data.aw.itemId }, function(n, o) {\n\t\t\t$scope.loadRelations();\n\t\t});\n\n\t\t$scope.loadTags();\n\n\t}]);\n\n\t/**\n\t * ActiveWindow GalleryController\n\t *\n\t * Ability to upload images, removed images from index, add new images via selecting from\n\t * filemanager.\n\t *\n\t * Changes content when parent crud controller changes value for active aw.itemId.\n\t */\n\tzaa.controller(\"ActiveWindowGalleryController\", ['$scope', '$http', '$filter', function($scope, $http, $filter) {\n\n\t\t$scope.crud = $scope.$parent;\n\n\t\t$scope.files = [];\n\n\t\t$scope.select = function(id) {\n\t\t\tvar exists = $filter('filter')($scope.files, {'fileId' : id}, true);\n\t\t\t\n\t\t\tif (exists.length == 0) {\n\t\t\t\t$scope.crud.sendActiveWindowCallback('AddImageToIndex', {'fileId' : id }).then(function(response) {\n\t\t\t\t\tvar data = response.data;\n\t\t\t\t\t$scope.files.push(data);\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\t$scope.loadImages = function() {\n\t\t\t$http.get($scope.crud.getActiveWindowCallbackUrl('loadAllImages')).then(function(response) {\n\t\t\t\t$scope.files = response.data;\n\t\t\t})\n\t\t};\n\t\t\n\t\t$scope.changePosition = function(file, index, direction) {\n\t\t\tvar index = parseInt(index);\n\t\t\tvar oldRow = $scope.files[index];\n\t\t\tif (direction == 'up') {\n $scope.files[index] = $scope.files[index-1];\n $scope.files[index-1] = oldRow;\n\t\t\t} else if (direction == 'down') {\n $scope.files[index] = $scope.files[index+1];\n $scope.files[index+1] = oldRow;\n\t\t\t}\n\t\t\tvar newRow = $scope.files[index];\n\t\t\t\n\t\t\t$scope.crud.sendActiveWindowCallback('ChangeSortIndex', {'new': newRow, 'old': oldRow});\n\t\t};\n\t\t\n\t\t$scope.moveUp = function(file, index) {\n\t\t\t$scope.changePosition(file, index, 'up');\n\t\t};\n\t\t\n\t\t$scope.moveDown = function(file, index) {\n\t\t\t$scope.changePosition(file, index, 'down');\n\t\t}\n\n\t\t$scope.remove = function(file, index) {\n\t\t\t$scope.crud.sendActiveWindowCallback('RemoveFromIndex', {'imageId' : file.originalImageId }).then(function(response) {\n\t\t\t\t$scope.files.splice(index, 1);\n\t\t\t});\n\t\t};\n\n\t\t$scope.$watch(function() { return $scope.data.aw.itemId }, function(n, o) {\n\t\t\t$scope.loadImages();\n\t\t});\n\n\t}]);\n\n\tzaa.controller(\"ActiveWindowGroupAuth\", ['$scope', '$http', 'CacheReloadService', function($scope, $http, CacheReloadService) {\n\n\t\t$scope.crud = $scope.$parent; // {{ data.aw.itemId }}\n\n\t\t$scope.reload = function() {\n\t\t\tCacheReloadService.reload();\n\t\t};\n\n\t\t$scope.rights = [];\n\n\t\t$scope.auths = [];\n\n\t\t$scope.save = function(data) {\n\t\t\t$scope.crud.sendActiveWindowCallback('saveRights', {'data' : data }).then(function(response) {\n\t\t\t\t$scope.getRights();\n\t\t\t\t$scope.reload();\n\t\t\t});\n\t\t};\n\n\t\t$scope.toggleAll = function() {\n\t\t\tangular.forEach($scope.auths,function(value, key) {\n\t\t\t\t$scope.rights[value.id] = {base: 1, create: 1, update: 1, 'delete': 1 };\n\t\t\t});\n\t\t};\n\n\t\t$scope.untoggleAll = function() {\n\t\t\tangular.forEach($scope.auths,function(value, key) {\n\t\t\t\t$scope.rights[value.id] = {base: 0, create: 0, update: 0, 'delete': 0 };\n\t\t\t});\n\t\t};\n\n\t\t$scope.getRights = function() {\n\t\t\t$http.get($scope.crud.getActiveWindowCallbackUrl('getRights')).then(function(response) {\n\t\t\t\t$scope.rights = response.data.rights;\n\t\t\t\t$scope.auths = response.data.auths;\n\t\t\t});\n\t\t};\n\n\t\t$scope.$on('awloaded', function(e, d) {\n\t\t\t$scope.getRights();\n\t\t});\n\n\t\t$scope.$watch(function() { return $scope.data.aw.itemId }, function(n, o) {\n\t\t\t$scope.getRights();\n\t\t});\n\t}]);\n\n// DefaultController.js.\n\n\tzaa.controller(\"DefaultController\", ['$scope', '$http', '$state', '$stateParams', 'CrudTabService', function ($scope, $http, $state, $stateParams, CrudTabService) {\n\n\t\t$scope.moduleId = $state.params.moduleId;\n\n\t\t$scope.loadDashboard = function() {\n\t\t\t$scope.currentItem = null;\n\t\t\treturn $state.go('default', { 'moduleId' : $scope.moduleId});\n\t\t}\n\n\t\t$scope.isOpenModulenav = false;\n\n\t\t$scope.items = [];\n\n\t\t$scope.itemRoutes = [];\n\n\t\t$scope.currentItem = null;\n\n\t\t$scope.dashboard = [];\n\n\t\t$scope.itemAdd = function (name, items) {\n\n\t\t\t$scope.items.push({name : name, items : items});\n\n\t\t\tfor(var i in items) {\n\t\t\t\tvar data = items[i];\n\t\t\t\t$scope.itemRoutes[data.route] = {\n\t\t\t\t\talias : data.alias, icon : data.icon\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\t$scope.getDashboard = function(nodeId) {\n\t\t\t$http.get('admin/api-admin-menu/dashboard', { params : { 'nodeId' : nodeId }} ).then(function(data) {\n\t\t\t\t$scope.dashboard = data.data;\n\t\t\t});\n\t\t};\n\n\t\t$scope.init = function() {\n\t\t\t$scope.get();\n\t\t\t$scope.getDashboard($scope.moduleId);\n\t\t};\n\n\t\t$scope.resolveCurrentItem = function() {\n\t\t\tif (!$scope.currentItem) {\n\t\t\t\tif ($state.current.name == 'default.route' || $state.current.name == 'default.route.detail') {\n\t\t\t\t\tvar params = [$stateParams.moduleRouteId, $stateParams.controllerId, $stateParams.actionId];\n\t\t\t\t\tvar route = params.join(\"/\");\n\t\t\t\t\tif ($scope.itemRoutes.indexOf(route)) {\n\t\t\t\t\t\t$scope.currentItem = $scope.itemRoutes[route];\n\t\t\t\t\t\t$scope.currentItem.route = route;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\t$scope.click = function(item) {\n\t\t\t$scope.isOpenModulenav = false;\n\t\t\t$scope.currentItem = item;\n\n\t\t\tvar id = item.route;\n\t\t\tvar res = id.split(\"/\");\n\t\t\tCrudTabService.clear();\n\n\t\t\t$state.go('default.route', { moduleRouteId : res[0], controllerId : res[1], actionId : res[2]});\n\t\t};\n\n\t\t$scope.get = function () {\n\t\t\t$http.get('admin/api-admin-menu/items', { params : { 'nodeId' : $scope.moduleId }} ).then(function(response) {\n\t\t\t\tvar data = response.data;\n\t\t\t\tfor (var itm in data.groups) {\n\t\t\t\t\tvar grp = data.groups[itm];\n\t\t\t\t\t$scope.itemAdd(grp.name, grp.items);\n\t\t\t\t}\n\t\t\t\t$scope.resolveCurrentItem();\n\t\t\t})\n\t\t};\n\n\t\t$scope.$on('topMenuClick', function(e) {\n\t\t\t$scope.currentItem = null;\n\t\t});\n\n\t\t$scope.init();\n\t}]);\n\n\tzaa.controller(\"DashboardController\", ['$scope', function ($scope) {\n\t\t$scope.logItemOpen = false;\n\t}]);\n\n\tzaa.filter('lockFilter', function() {\n\t\treturn function(data, table, pk) {\n\t\t\tvar has = false;\n\t\t\tangular.forEach(data, function(value) {\n\t\t\t\tif (value.lock_table == table && value.lock_pk == pk) {\n\t\t\t\t\thas = value;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn has;\n };\n\t});\n\n\tzaa.controller(\"LayoutMenuController\", [\n\t\t'$scope', '$document', '$http', '$state', '$location', '$timeout', '$window', '$filter', 'HtmlStorage', 'CacheReloadService', 'AdminDebugBar', 'LuyaLoading', 'AdminToastService', 'AdminClassService', \n\t\tfunction ($scope, $document, $http, $state, $location, $timeout, $window, $filter, HtmlStorage, CacheReloadService, AdminDebugBar, LuyaLoading, AdminToastService, AdminClassService) {\n\n\t\t$scope.AdminClassService = AdminClassService;\n\n\t\t$scope.AdminDebugBar = AdminDebugBar;\n\n\t\t$scope.LuyaLoading = LuyaLoading;\n\n\t\t$scope.toastQueue = AdminToastService.queue;\n\n\t\t$scope.reload = function() {\n\t\t\tCacheReloadService.reload();\n\t\t};\n\n\t\t/* Main nav sidebar toggler */\n\n\t\t$scope.isHover = HtmlStorage.getValue('sidebarToggleState', false);\n\n\t\t$scope.toggleMainNavSize = function() {\n\t\t\t$scope.isHover = !$scope.isHover;\n\t\t\tHtmlStorage.setValue('sidebarToggleState', $scope.isHover);\n\t\t};\n\n\t\t/* PROFIL SETTINS */\n\n\t\t$scope.profile = {};\n\t\t$scope.settings = {};\n\t\t$scope.packages = [];\n\t\t\n\t\t$scope.getProfileAndSettings = function() {\n\t\t\t$http.get('admin/api-admin-user/session').then(function(success) {\n\t\t\t\t$scope.profile = success.data.user;\n\t\t\t\t$scope.settings = success.data.settings;\n\t\t\t\t$scope.packages = success.data.packages;\n\t\t\t});\n\t\t};\n\n\t\t/* Browser infos */\n\n\t\t$scope.browser = null;\n\n\t\t$scope.detectBrowser = function() {\n $scope.browser = [\n bowser.name.replace(' ', '-').toLowerCase() + '-' + bowser.version,\n (bowser.mac ? 'mac-os-' + (bowser.osversion ? bowser.osversion : '') : 'windows-' + (bowser.osversion ? bowser.osversion : ''))\n ].join(' ');\n\t\t};\n\n\t\t$scope.detectBrowser();\n\n\t\t$scope.getProfileAndSettings();\n\n\t\t$scope.debugDetail = null;\n\n\t\t$scope.debugDetailKey = null;\n\n\t\t$scope.loadDebugDetail = function(debugDetail, key) {\n\t\t\t$scope.debugDetail = debugDetail;\n\t\t\t$scope.debugDetailKey = key;\n\t\t};\n\n\t\t$scope.notify = null;\n\n\t\t$scope.forceReload = 0;\n\n\t\t$scope.showOnlineContainer = false;\n\n\t\t$scope.searchDetailClick = function(itemConfig, itemData) {\n\t\t\tif (itemConfig.type == 'custom') {\n\t\t\t\t$scope.click(itemConfig.menuItem).then(function() {\n\t\t\t\t\tif (itemConfig.stateProvider) {\n\t\t\t\t\t\tvar params = {};\n\t\t\t\t\t\tangular.forEach(itemConfig.stateProvider.params, function(value, key) {\n\t\t\t\t\t\t\tparams[key] = itemData[value];\n\t\t\t\t\t\t})\n\n\t\t\t\t\t\t$state.go(itemConfig.stateProvider.state, params).then(function() {\n\t\t\t\t\t\t\t$scope.closeSearchInput();\n\t\t\t\t\t\t})\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$scope.closeSearchInput();\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t} else {\n\t\t\t\t$scope.click(itemConfig.menuItem.module).then(function() {\n\t\t\t\t\tvar res = itemConfig.menuItem.route.split(\"/\");\n\t\t\t\t\t$state.go('default.route', { moduleRouteId : res[0], controllerId : res[1], actionId : res[2]}).then(function() {\n\t\t\t\t\t\tif (itemConfig.stateProvider) {\n\t\t\t\t\t\t\tvar params = {};\n\t\t\t\t\t\t\tangular.forEach(itemConfig.stateProvider.params, function(value, key) {\n\t\t\t\t\t\t\t\tparams[key] = itemData[value];\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t$state.go(itemConfig.stateProvider.state, params).then(function() {\n\t\t\t\t\t\t\t\t$scope.closeSearchInput();\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$scope.closeSearchInput();\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\t$scope.visibleAdminReloadDialog = false;\n\n\t\t$scope.lastKeyStroke = Date.now();\n\t\t\n\t\t$document.bind('keyup', function (e) {\n\t\t\t$scope.lastKeyStroke = Date.now();\n\t\t});\n\t\t\n\t\t(function tick(){\n\t\t\t$http.post('admin/api-admin-timestamp/index', {lastKeyStroke: $scope.lastKeyStroke}, {ignoreLoadingBar: true}).then(function(response) {\n\t\t\t\t$scope.forceReload = response.data.forceReload;\n\t\t\t\tif ($scope.forceReload && !$scope.visibleAdminReloadDialog) {\n\t\t\t\t\t$scope.visibleAdminReloadDialog = true;\n\t\t\t\t\tAdminToastService.confirm(i18n['js_admin_reload'], i18n['layout_btn_reload'], function() {\n\t\t\t\t\t\t$scope.reload();\n\t\t\t\t\t\t$scope.visibleAdminReloadDialog = false;\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t$scope.locked = response.data.locked;\n\t\t\t\t$scope.notify = response.data.useronline;\n\t\t\t\t$scope.idleStrokeDashoffset = response.data.idleStrokeDashoffset;\n\t\t\t\t$scope.idleTimeRelative = response.data.idleTimeRelative;\n\t\t\t\t$timeout(tick, 20000);\n\t\t\t})\n\t\t})();\n\n\t\t$scope.isLocked = function(table, pk) {\n\t\t\treturn $filter('lockFilter')($scope.locked, table, pk);\n\t\t};\n\t\t\n\t\t$scope.getLockedName = function(table, pk) {\n\t\t\tvar response = $scope.isLocked(table, pk);\n\t\t\t\n\t\t\treturn response.firstname + ' ' + response.lastname;\n\t\t};\n\n\t\t$scope.searchQuery = null;\n\n\t $scope.searchInputOpen = false;\n\n\t $scope.escapeSearchInput = function() {\n\t if ($scope.searchInputOpen) {\n\t $scope.closeSearchInput();\n\t }\n\t };\n\n\t $scope.toggleSearchInput = function() {\n\t \t$scope.searchInputOpen = !$scope.searchInputOpen;\n\t };\n\n\t $scope.openSearchInput = function() {\n\t $scope.searchInputOpen = true;\n\t };\n\n\t $scope.closeSearchInput = function() {\n\t $scope.searchInputOpen = false;\n\t };\n\n\t\t$scope.searchResponse = null;\n\n\t\t$scope.searchPromise = null;\n\n\t\t$scope.$watch(function() { return $scope.searchQuery}, function(n, o) {\n\t\t\tif (n !== o) {\n\t\t\t\tif (n.length > 2) {\n\t\t\t\t\t$timeout.cancel($scope.searchPromise);\n\t\t\t\t\t$scope.searchPromise = $timeout(function() {\n\t\t\t\t\t\t$http.get('admin/api-admin-search', { params : { query : n}}).then(function(response) {\n\t\t\t\t\t\t\t$scope.searchResponse = response.data;\n\t\t\t\t\t\t});\n\t\t\t\t\t}, 400)\n\t\t\t\t} else {\n\t $scope.searchResponse = null;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t$scope.items = [];\n\n\t\t$scope.currentItem = {};\n\n\t\t$scope.isOpen = false;\n\n\t\t$scope.click = function(menuItem) {\n\t\t\t$scope.isOpen = false;\n\t\t\t$scope.$broadcast('topMenuClick', { menuItem : menuItem });\n\t\t\tif (menuItem.template) {\n\t\t\t\treturn $state.go('custom', { 'templateId' : menuItem.template });\n\t\t\t} else {\n\t\t\t\treturn $state.go('default', { 'moduleId' : menuItem.id});\n\t\t\t}\n\t\t};\n\n\t\t$scope.isActive = function(item) {\n\t\t\tif (item.template) {\n\t\t\t\tif ($state.params.templateId == item.template) {\n\t\t\t\t\t$scope.currentItem = item;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ($state.params.moduleId == item.id) {\n\t\t\t\t\t$scope.currentItem = item;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\t$scope.get = function () {\n\t\t\t$http.get('admin/api-admin-menu').then(function(response) {\n\t\t\t\t$scope.items = response.data;\n\t\t\t});\n\t\t};\n\n\t\t$scope.get();\n\t}]);\n\n\tzaa.controller(\"AccountController\", ['$scope', '$http', '$window', 'AdminToastService', function($scope, $http, $window, AdminToastService) {\n\t\t\n\t\t$scope.pass = {};\n\t\t\n\t\t$scope.changePassword = function() {\n\t\t\t$http.post('admin/api-admin-user/change-password', $scope.pass).then(function(response) {\n\t\t\t\tAdminToastService.success(i18n['aws_changepassword_succes']);\n\t\t\t\t$scope.pass = {};\n\t\t\t}, function(error) {\n\t\t\t\tAdminToastService.errorArray(error.data);\n\t\t\t\t$scope.pass = {};\n\t\t\t});\n\t\t};\n\n\t\t$scope.changeSettings = function(settings) {\n\t\t\t$http.post('admin/api-admin-user/change-settings', settings).then(function(response) {\n\t\t\t\t$window.location.reload();\n\t\t\t});\n\t\t};\n\n\t\t$scope.profile = {};\n\t\t$scope.settings = {};\n\t\t$scope.activities = {};\n\t\t\n\t\t$scope.email = {};\n\n\t\t$scope.getProfile = function() {\n\t\t\t$http.get('admin/api-admin-user/session').then(function(success) {\n\t\t\t\t$scope.profile = success.data.user;\n\t\t\t\t$scope.settings = success.data.settings;\n\t\t\t\t$scope.activities = success.data.activities;\n\t\t\t});\n\t\t};\n\n\t\t$scope.changePersonData = function(data) {\n\t\t\t$http.put('admin/api-admin-user/session-update', data).then(function(success) {\n\t\t\t\tAdminToastService.success(i18n['js_account_update_profile_success']);\n\t\t\t\t$scope.getProfile();\n\t\t\t}, function(error) {\n\t\t\t\tAdminToastService.errorArray(error.data);\n\t\t\t});\n\t\t};\n\t\t\n\t\t$scope.changeEmail = function() {\n\t\t\t$http.put('admin/api-admin-user/change-email', {token: $scope.email.token}).then(function(success) {\n\t\t\t\tAdminToastService.success(i18n['js_account_update_profile_success']);\n\t\t\t\t$scope.getProfile();\n\t\t\t}, function(error) {\n\t\t\t\tAdminToastService.errorArray(error.data);\n\t\t\t});\n\t\t};\n\n\t\t$scope.getProfile();\n\t}]);"]} \ No newline at end of file diff --git a/src/resources/js/directives.js b/src/resources/js/directives.js index bdfff4b343..e8cddf4c5f 100644 --- a/src/resources/js/directives.js +++ b/src/resources/js/directives.js @@ -2525,10 +2525,9 @@ $scope.imageNotFoundError = false; $scope.filterApply = function() { - ServiceFilesData.getFile($scope.fileId).then(function(response) { var images = $filter('filter')(response.images, {filterId: $scope.filterId}, true); - + $scope.imageLoading = true; // unable to find the image for the given filter, create the image for the filter if (images.length == 0) { $http.post('admin/api-admin-storage/image-filter', { fileId : $scope.fileId, filterId : $scope.filterId}).then(function(uploadResponse) { @@ -2589,6 +2588,8 @@ //var filtering = $filter('findidfilter')($scope.imagesData, n, true); ServiceImagesData.getImage(n).then(function(response) { $scope.imageinfo = response; + $scope.fileId = response.file_id; + $scope.filterId = response.filter_id; }); /* if (filtering) { @@ -2673,21 +2674,26 @@ $scope.paginations = []; + $scope.currentPageId = 0; + // load files data for a given folder id $scope.$watch('currentFolderId', function(folderId) { - $scope.getFilesForPageAndFolder(folderId, 0); + console.log(folderId); + if (folderId !== undefined) { + $scope.getFilesForPageAndFolder(folderId, 0); + } }); $scope.getFilesForPageAndFolder = function(folderId, pageId) { $http.get('admin/api-admin-storage/data-files?folderId='+folderId+'&page='+pageId).then(function(response) { - $scope.filesData = response.data.data; + console.log('request filemanager list', folderId, pageId, response); + $scope.filesData = response.data.data; $scope.filesMetaToPagination(response.data.__meta); }); }; $scope.filesMetaToPagination = function(meta) { var pages = []; - console.log(meta); for (i = 0; i < meta.totalPages; i++) { var isActive = meta.currentPage == i; pages.push({isActive: isActive, label: i+1, index: i}); @@ -2696,9 +2702,14 @@ }; $scope.getFilesForPage = function(pageId) { + $scope.currentPageId = pageId; $scope.getFilesForPageAndFolder($scope.currentFolderId, pageId); }; + $scope.getFilesForCurrentPage = function() { + $scope.getFilesForPageAndFolder($scope.currentFolderId, $scope.currentPageId); + } + // ServiceFolderId $scope.currentFolderId = ServiceFoldersDirecotryId.folderId; @@ -2768,10 +2779,9 @@ $scope.$watch('uploadResults', function(n, o) { if ($scope.uploadingfiles != null) { if (n == $scope.uploadingfiles.length && $scope.errorMsg == null) { - //$scope.filesDataReload().then(function() { - AdminToastService.success(i18n['js_dir_manager_upload_image_ok']); - LuyaLoading.stop(); - //}); + AdminToastService.success(i18n['js_dir_manager_upload_image_ok']); + LuyaLoading.stop(); + $scope.getFilesForCurrentPage(); } } }) @@ -2878,9 +2888,7 @@ if (!newFolderName) { return; } - $http.post('admin/api-admin-storage/folder-create', $.param({ folderName : newFolderName , parentFolderId : $scope.currentFolderId }), { - headers : {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'} - }).then(function() { + $http.post('admin/api-admin-storage/folder-create', { folderName : newFolderName , parentFolderId : $scope.currentFolderId }).then(function() { $scope.foldersDataReload().then(function() { $scope.folderFormToggler(); $scope.newFolderName = null; @@ -2904,6 +2912,7 @@ $scope.changeCurrentFolderId = function(folderId, noState) { $scope.currentFolderId = folderId; + $scope.currentPageId = 0; if (noState !== true) { ServiceFoldersDirecotryId.folderId = folderId; $http.post('admin/api-admin-common/save-filemanager-folder-state', {folderId : folderId}, {ignoreLoadingBar: true}); @@ -2926,22 +2935,16 @@ $scope.folderDeleteConfirmForm = false; $scope.updateFolder = function(folder) { - $http.post('admin/api-admin-storage/folder-update?folderId=' + folder.id, $.param({ name : folder.name }), { - headers : {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'} - }); + $http.post('admin/api-admin-storage/folder-update?folderId=' + folder.id, {name : folder.name }); }; $scope.deleteFolder = function(folder) { // check if folder is empty - $http.post('admin/api-admin-storage/is-folder-empty?folderId=' + folder.id, $.param({ name : folder.name }), { - headers : {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'} - }).then(function(transport) { + $http.post('admin/api-admin-storage/is-folder-empty?folderId=' + folder.id, { name : folder.name }).then(function(transport) { if (transport.data == true) { - $http.post('admin/api-admin-storage/folder-delete?folderId=' + folder.id, $.param({ name : folder.name }), { - headers : {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'} - }).then(function(transport) { + $http.post('admin/api-admin-storage/folder-delete?folderId=' + folder.id, { name : folder.name }).then(function(transport) { $scope.foldersDataReload().then(function() { //$scope.filesDataReload().then(function() { $scope.currentFolderId = 0; @@ -2951,9 +2954,7 @@ } else { AdminToastService.confirm(i18nParam('layout_filemanager_remove_dir_not_empty', {folderName: folder.name, count: folder.filesCount}), i18n['js_dir_manager_rm_folder_confirm_title'], ['$timeout', '$toast', function($timeout, $toast) { - $http.post('admin/api-admin-storage/folder-delete?folderId=' + folder.id, $.param({ name : folder.name }), { - headers : {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'} - }).then(function() { + $http.post('admin/api-admin-storage/folder-delete?folderId=' + folder.id, { name : folder.name }).then(function() { $scope.foldersDataReload().then(function() { //$scope.filesDataReload().then(function() { $scope.currentFolderId = 0; @@ -3010,9 +3011,7 @@ }; $scope.moveFilesTo = function(folderId) { - $http.post('admin/api-admin-storage/filemanager-move-files', $.param({'fileIds' : $scope.selectedFiles, 'toFolderId' : folderId}), { - headers : {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'} - }).then(function(transport) { + $http.post('admin/api-admin-storage/filemanager-move-files', {'fileIds' : $scope.selectedFiles, 'toFolderId' : folderId}).then(function(transport) { //$scope.filesDataReload().then(function() { $scope.selectedFiles = []; $scope.showFoldersToMove = false; @@ -3022,9 +3021,7 @@ $scope.removeFiles = function() { AdminToastService.confirm(i18n['js_dir_manager_rm_file_confirm'], i18n['js_dir_manager_rm_file_confirm_title'], ['$timeout', '$toast', function($timeout, $toast) { - $http.post('admin/api-admin-storage/filemanager-remove-files', $.param({'ids' : $scope.selectedFiles}), { - headers : {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'} - }).then(function(transport) { + $http.post('admin/api-admin-storage/filemanager-remove-files', {'ids' : $scope.selectedFiles}).then(function(transport) { //$scope.filesDataReload().then(function() { $toast.close(); AdminToastService.success(i18n['js_dir_manager_rm_file_ok']); @@ -3038,9 +3035,7 @@ // file detail view logic $scope.storeFileCaption = function(fileDetail) { - $http.post('admin/api-admin-storage/filemanager-update-caption', $.param({'id': fileDetail.id, 'captionsText' : fileDetail.captionArray}), { - headers : {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'} - }).then(function(transport) { + $http.post('admin/api-admin-storage/filemanager-update-caption', {'id': fileDetail.id, 'captionsText' : fileDetail.captionArray}).then(function(transport) { AdminToastService.success('Captions has been updated'); }); } @@ -3050,7 +3045,7 @@ $scope.init = function() { if ($scope.$parent.fileinfo) { $scope.selectedFileFromParent = $scope.$parent.fileinfo; - $scope.changeCurrentFolderId($scope.selectedFileFromParent.folderId, true); + $scope.changeCurrentFolderId($scope.selectedFileFromParent.folder_id, true); } } diff --git a/src/views/layouts/_angulardirectives.php b/src/views/layouts/_angulardirectives.php index b072b70476..ff99e0d253 100644 --- a/src/views/layouts/_angulardirectives.php +++ b/src/views/layouts/_angulardirectives.php @@ -121,8 +121,8 @@ @@ -148,7 +148,7 @@
-
{{ imageinfo.resolutionWidth }} x {{ imageinfo.resolutionHeight }}
+
{{ imageinfo.resolution_width }} x {{ imageinfo.resolution_height }}