sogo/UI/WebServerResources/js/Common.js

3 lines
60 KiB
JavaScript
Raw Normal View History

2016-06-08 07:21:25 +02:00
function l(){var a,b,c=arguments[0],d=c,e=arguments;for(labels[c]?d=labels[c]:clabels[c]&&(d=clabels[c]),a=1,b=0;a<e.length;a++,b++)d=d.replace("%{"+b+"}",e[a]);return a=1,e.length>1&&(d=d.replace(/%((%)|s|d)/g,function(b){var c=null;if(b[2])c=b[2];else{switch(c=e[a],b){case"%d":c=parseFloat(c),isNaN(c)&&(c=0)}a++}return c})),d}function hexToRgb(a){var b=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);return b?{r:parseInt(b[1],16),g:parseInt(b[2],16),b:parseInt(b[3],16)}:null}function contrast(a){var b,c,d=1;if(b=hexToRgb(a)){c=[b.r/255,b.g/255,b.b/255];for(var e=0;e<c.length;++e)c[e]<=.03928?c[e]=c[e]/12.92:c[e]=Math.pow((c[e]+.055)/1.055,2.4);d=.2126*c[0]+.7152*c[1]+.0722*c[2]}return d>.179?"black":"white"}function guid(){function a(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return(a()+a()+"-"+a()+"-4"+a().substr(0,3)+"-"+a()+"-"+a()+a()+a()).toLowerCase()}!function(){"use strict";function a(a,b,c,d){d.definePalette("sogo-green",{50:"eaf5e9",100:"cbe5c8",200:"aad6a5",300:"88c781",400:"66b86a",500:"56b04c",600:"4da143",700:"388e3c",800:"367d2e",900:"225e1b",A100:"fafafa",A200:"69f0ae",A400:"00e676",A700:"00c853",contrastDefaultColor:"dark",contrastLightColors:["300","400","500","600","700","800","900"]}),d.definePalette("sogo-blue",{50:"f0faf9",100:"e1f5f3",200:"ceebe8",300:"bfe0dd",400:"b2d6d3",500:"a1ccc8",600:"8ebfbb",700:"7db3b0",800:"639997",900:"4d8080",A100:"d4f7fa",A200:"c3f5fa",A400:"53e3f0",A700:"00b0c0",contrastDefaultColor:"light",contrastDarkColors:["50","100","200"]}),d.definePalette("sogo-paper",{50:"fcf7f8",100:"f7f1dc",200:"ede5ca",300:"e6d8ba",400:"e2d2a3",500:"d6c48d",600:"baa870",700:"857545",800:"524517",900:"433809",1000:"000000",A100:"ffffff",A200:"eeeeee",A400:"bdbdbd",A700:"616161",contrastDefaultColor:"dark",contrastLightColors:["800","900"]}),d.theme("default").primaryPalette("sogo-blue",{"default":"900","hue-1":"400","hue-2":"800","hue-3":"A700"}).accentPalette("sogo-green",{"default":"500","hue-1":"A100","hue-2":"300","hue-3":"A700"}).backgroundPalette("grey",{"default":"50","hue-1":"200","hue-2":"300","hue-3":"500"}),DebugEnabled||(a.debugEnabled(!1),b.debugInfoEnabled(!1)),c.interceptors.push("AuthInterceptor"),c.interceptors.push("ErrorInterceptor")}function b(a,b){return{response:function(c){return c&&/^application\/json/.test(c.config.headers.Accept)&&/^<!DOCTYPE html>/.test(c.data)?(a.location.reload(!0),b.reject()):c}}}function c(a,b){return{responseError:function(c){return/^application\/json/.test(c.config.headers.Accept)&&a.$broadcast("http:Error",c),b.reject(c)}}}angular.module("SOGo.Common",["ngAnimate","ngMessages","ngSanitize","ngMaterial","mdColors"]).value("sgSettings",{isPopup:document.body.classList.contains("popup"),baseURL:function(){return ApplicationBaseURL||null},activeUser:function(a){var b={login:UserLogin||null,identification:UserIdentification||null,email:UserEmail||null,language:UserLanguage||null,folderURL:UserFolderURL||null,isSuperUser:IsSuperUser||null,path:{calendar:UserCalendarPath||null,contacts:UserContactsPath||null,mail:UserMailPath||null,preferences:UserPreferencesPath||null,administration:IsSuperUser?UserAdministrationPath:null,help:HelpURL||null,logoff:UserLogoffPath||null}};return a?b[a]:b}}).constant("sgColors",{selection:["#FFFFFF","#330033","#C0C0C0","#999999","#666666","#333333","#000000","#FFCCCC","#FF6666","#FF0000","#CC0000","#990000","#660000","#330000","#FFCC99","#FF9966","#FF9900","#FF6600","#CC6600","#993300","#663300","#FFFF99","#FFFF66","#FFCC66","#FFCC33","#CC9933","#996633","#663333","#FFFFCC","#FFFF33","#FFFF00","#FFCC00","#999900","#666600","#333300","#CCCCCC","#66FF99","#33FF33","#33CC00","#009900","#006600","#003300","#99FFFF","#33FFFF","#66CCCC","#00CCCC","#339999","#336666","#003333","#CCFFFF","#66FFFF","#33CCFF","#3366FF","#3333FF","#000099","#000066","#CCCCFF","#9999FF","#6666CC","#6633FF","#6600CC","#333399","#330099","#FFCCFF","#FF99FF","#CC66CC","#CC33CC","#993399","#663366","#99FF99"]}).constant("sgConstant",{xs:"(max-width: 599px)","gt-xs":"(min-width: 600px)",sm:"(min-width: 600px) and (max-width: 9
2016-06-07 16:31:29 +02:00
}}angular.module("SOGo.Common").directive("sgFolderStylesheet",a)}(),function(){"use strict";function a(){return{restrict:"A",scope:{placeholder:"=sgPlaceholder"},link:function(a,b,c){a.$watch("placeholder",function(){b[0].placeholder=a.placeholder})}}}angular.module("SOGo.Common").directive("sgPlaceholder",a)}(),function(){"use strict";function a(a){function b(b,c){var d=(b.find("md-input-container"),b.find("input")),e=b.find("md-select"),f=b.find("md-button");return d.attr("ng-model","$sgSearchController.searchText"),d.attr("ng-model-options","$sgSearchController.searchTextOptions"),d.attr("ng-change","$sgSearchController.onChange()"),e&&(e.attr("ng-model","$sgSearchController.searchField"),e.attr("ng-change","$sgSearchController.onChange()")),f&&f.attr("sg-search-cancel")?(f.attr("ng-click",f.attr("sg-search-cancel")),f.removeAttr("sg-search-cancel")):f=null,function(b,c,e,g){var h=c.find("button");g.formName=c.attr("name"),g.inputName=d.attr("name"),g.allowDot=a(c.attr("sg-allow-dot"))(b),g.doSearch=a(c.attr("sg-search")),f&&h&&h.on("click",g.cancelSearch)}}return{restrict:"A",controller:"sgSearchController",controllerAs:"$sgSearchController",priority:1001,compile:b}}function b(){function a(a,b){return function(a,b,c,d,e){e(function(a){b.append(a)})}}return{restrict:"A",priority:1e3,transclude:!0,compile:a}}function c(a,b,c){var d,e=this;d=angular.isNumber(a.minimumSearchLength)?a.minimumSearchLength:2,e.searchText=null,e.searchTextOptions={updateOn:"default blur",debounce:{"default":300,blur:0}},e.onChange=function(){var a=b[e.formName],c=a[e.inputName],d=c.$viewValue;(e.allowDot&&"."==d||a.$valid&&d)&&("."==d&&c.$setValidity("minlength",!0),e.doSearch(b,{searchText:d,searchField:e.searchField}))},e.cancelSearch=function(){e.searchText=null}}a.$inject=["$parse"],c.$inject=["$window","$scope","$element"],angular.module("SOGo.Common").controller("sgSearchController",c).directive("sgSearch",a).directive("sgSearch",b)}(),function(){"use strict";function a(){function a(a,b,c,d){function e(){return b.find("input").eq(0)}var f=a.$watch(e,function(b){var c;b.length&&(f(),c=b.controller("ngModel"),b.on("blur",function(){d.scope.selectedItem||a.$applyAsync(c.$setValidity("required",!1))}))})}return{link:a,require:"mdAutocomplete",restrict:"A"}}angular.module("SOGo.Common").directive("sgSelectOnly",a)}(),function(){"use strict";function a(a){return{restrict:"A",scope:{folderType:"@sgSubscribe",onFolderSelect:"&sgSubscribeOnSelect"},replace:!1,bindToController:!0,controller:c,controllerAs:"$sgSubscribeDialogController",link:b}}function b(a,b,c,d){b.find("input");b.on("click",d.showDialog)}function c(a){var b=this;b.showDialog=function(){a.show({templateUrl:"../Contacts/UIxContactsUserFolders",clickOutsideToClose:!0,locals:{folderType:b.folderType,onFolderSelect:b.onFolderSelect},controller:d,controllerAs:"subscribe"})}}function d(a,b,c,d){var e=this;e.selectedUser=null,e.users=[],e.searchTextOptions={updateOn:"default blur",debounce:{"default":300,blur:0}},e.onChange=function(a){d.$filter(e.searchText,null,{results:e.users}).then(function(b){a.$setValidity("matches",b.length>0),a.$setTouched(),e.selectedUser&&_.isUndefined(_.find(b,function(a){return a.uid==e.selectedUser.uid}))&&(e.selectedUser=null)})},e.selectUser=function(a){e.selectedUser==e.users[a]?e.selectedUser=null:e.users[a].$folders(b).then(function(){e.selectedUser=e.users[a]})},e.selectFolder=function(a){c({folderData:a})},e.close=function(){a.hide()}}a.$inject=["User"],c.$inject=["$mdDialog"],d.$inject=["$mdDialog","folderType","onFolderSelect","User"],angular.module("SOGo.Common").directive("sgSubscribe",a)}(),function(){"use strict";function a(){return{template:['<div class="sg-time-pane">',' <div class="hours-pane">',' <div ng-repeat="hoursBigLine in hours" layout="row" layout-xs="column">',' <div ng-repeat="hoursLine in hoursBigLine" layout="row" class="hours">',' <md-button class="hourBtn sg-time-selection-indicator" id="{{hour.id}}"'," md-no-ink",' ng-repeat="hour in hoursLine"','
//# sourceMappingURL=Common.js.map