2017-01-11 07:26:52 +01: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,e){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"}),DebugEnabled||(a.debugEnabled(!1),b.debugInfoEnabled(!1),e.disableWarnings(),d.generateThemesOnDemand(!0)),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)&&/^[\n\r ]*<!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},resourcesURL:function(){return ResourcesURL||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},minimumSearchLength:function(){return angular.isNumber(minimumSearchLength)?minimumSearchLength:2}}).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"
|
2016-12-16 07:09:03 +01:00
|
|
|
this.$confirmation=b,b)},a.prototype.$rightsAreDirty=function(){return this.rights&&!_.isEqual(this.rights,this.$shadowRights)},a.prototype.$resetRights=function(a){var b=this;a?_.map(_.keys(this.rights),function(a){angular.isString(b.rights[a])?b.rights[a]="None":b.rights[a]=0}):this.$shadowRights&&(this.rights=angular.copy(this.$shadowRights))},a.prototype.$folders=function(b){var c=this,d=a.$q.defer(),e={type:b};return this.$$folders?d.resolve(this.$$folders):a.$$resource.userResource(this.uid).fetch(null,"foldersSearch",e).then(function(a){c.$$folders=a.folders,d.resolve(a.folders)}),d.promise},a.prototype.$omit=function(){var a={};return angular.forEach(this,function(b,c){"constructor"!=c&&"$"!=c[0]&&(a[c]=b)}),a},a.prototype.toString=function(){return"[User "+this.c_email+"]"}}(),function(){"use strict";function a(){return{restrict:"AE",scope:{},bindToController:{size:"@",email:"=sgEmail",src:"=sgSrc"},transclude:!0,template:["<md-icon ng-transclude></md-icon>",'<img class="ng-hide" ng-src="{{vm.url}}" />'].join(""),link:b,controller:"sgAvatarImageController",controllerAs:"vm"}}function b(a,b,c,d){var e=b.find("img"),f=b.find("md-icon");c.size&&(e.attr("width",c.size),e.attr("height",c.size),f.css("font-size",c.size+"px")),d.img=e,d.genericImg=f}function c(a,b,c,d,e,f){function g(a){var b=f(a,k.size,e.defaults.SOGoAlternateAvatar);c({method:"GET",url:b,cache:!0,headers:{Accept:"image/*"}}).then(function(){k.url||(k.url=b,k.urlEmail=a,i())},function(){h()})}function h(){k.url=null,k.urlEmail=null,k.img.addClass("ng-hide"),k.genericImg.removeClass("ng-hide")}function i(){k.genericImg.addClass("ng-hide"),k.img.removeClass("ng-hide")}function j(){b.addClass("sg-avatar-image--zoomable"),l=function(){b.toggleClass("sg-avatar-image--zoom")},b.on("click",l)}var k,l;k=this,a.$on("$destroy",function(){l&&b.off("click",l)}),e.ready().then(function(){a.$watch(function(){return k.email},function(a,b){a&&k.urlEmail!=a?(h(),e.defaults.SOGoGravatarEnabled&&g(a)):a||h()})}),"sg-src"in b[0].attributes&&a.$watch(function(){return k.src},function(a){a&&(k.url=a,k.urlEmail=""+k.email,j(),i())})}c.$inject=["$scope","$element","$http","$q","Preferences","Gravatar"],angular.module("SOGo.Common").directive("sgAvatarImage",a).controller("sgAvatarImageController",c)}(),function(){"use strict";function a(a,b,c,d){function e(e,g){return e.on("click",function(a){this.hasAttribute("disabled")&&a.stopImmediatePropagation()}),function(e,g,h,i){function j(a,b,c,d,e){var f;if(angular.isDefined(d)){if(f=a(d),!f.constant)throw Error("Expected constant expression for `"+c+"`, but saw `"+d+"`.");return f(b)}return e}function k(a){g[0].hasAttribute("disabled")||e.$apply(function(){var b=i.$viewValue==m?n:m;i.$setViewValue(b,a&&a.type),i.$render()})}function l(){i.$viewValue==m?g.addClass(f):g.removeClass(f)}var m=j(a,e,"sgTrueValue",h.sgTrueValue,!0),n=j(a,e,"sgFalseValue",h.sgFalseValue,!1);i=i||d.fakeNgModel(),c(g),b.expectWithText(g,"aria-label"),g.on("click",k),i.$render=l}}var f="sg-checked";return{restrict:"E",replace:!0,transclude:!0,require:"?ngModel",template:['<button class="md-button sg-checkmark" type="button">'," <md-icon>check</md-icon>"," <span ng-transclude></span","</button>"].join(""),compile:e}}angular.module("SOGo.Common").directive("sgCheckmark",a),a.$inject=["$parse","$mdAria","$mdTheming","$mdUtil"]}(),function(){"use strict";function a(){function a(a,b,c,d){d.$render=function(){a.sgColor=d.$viewValue,a.sgIconColor=contrast(d.$viewValue)}}return{restrict:"E",require:"ngModel",template:["<md-menu>",' <md-button class="md-icon-button"',' label:aria-label="Options"'," ng-style=\"{ 'background-color': sgColor }\"",' ng-click="$mdOpenMenu()"',' md-menu-origin="md-menu-origin">',' <md-icon ng-style="{ color: sgIconColor }">color_lens</md-icon>'," </md-button>",' <md-menu-content width="3">',' <md-content class="md-padding">',' <md-grid-list class="sg-color-picker" md-cols="7" md-row-height="1:1" md-gutter="0.5em">',' <md-grid-tile ng-repeat="color in ::sgColors track
|
2017-01-11 07:26:52 +01:00
|
|
|
if(this.isTimeOpen){var b=this.$mdUtil.getClosest(a.target,"sg-time-pane");b||this.closeTimePane(),this.$scope.$digest()}},b.prototype.handleWindowBlur=function(){this.inputFocusedOnWindowBlur=document.activeElement===this.inputElement},b.prototype.evalAttr=function(a){this.$attrs[a]&&this.$scope.$parent.$eval(this.$attrs[a])}}(),function(){"use strict";function a(a,b){function c(a,c){return function(d,e,f,g){function h(){var a=g.$viewValue;l=g.$viewValue,c.sgToggleGridAttr&&(m=c.sgToggleGridAttr,a=_.map(g.$viewValue,c.sgToggleGridAttr)),_.forEach(o,function(b){var c=angular.element(b);_.includes(a,c.attr("value"))&&c.addClass("sg-active")})}function i(a){var b=_.findIndex(l,function(b){return m?b[m]==a:b==a});if(b<0)if(m){var c={};c[m]=a,l.push(c)}else l.push(a);else l.splice(b,1);d.$apply(function(){g.$setViewValue(l),g.$setDirty()})}var j,k,l,m,n,o=a.find("md-grid-tile");for(g=g||b.fakeNgModel(),g.$render=h,n=function(){var a=angular.element(this),b=a.attr("value");a.toggleClass("sg-active"),i(b)},k=0;k<o.length;k++)j=angular.element(o[k]),j.addClass("sg-icon-button"),j.find("figure").addClass("md-icon"),j.on("click",n)}}return{restrict:"A",require:"?ngModel",compile:c}}a.$inject=["$parse","$mdUtil"],angular.module("SOGo.Common").directive("sgToggleGrid",a)}(),function(){"use strict";function a(a,b){function c(c,d,e,f){var g=[];f.onInputBlur=function(){var c;this.inputHasFocus=!1,c=function(){var a=this.getChipBuffer().trim();this.validateModel();var b=this.ngModelCtrl.$valid;this.userInputNgModelCtrl&&(b&=this.userInputNgModelCtrl.$valid),a&&b&&(this.appendChip(a),this.resetChipBuffer())}.bind(this),this.autocompleteCtrl?(g.push(c),a.addEventListener("click",function(a){for(;g.length>0;){var c=g.splice(0,1)[0];b(function(){b(c)})}},!1)):c()}}return{link:c,require:"mdChips",restrict:"A"}}a.$inject=["$window","$timeout"],angular.module("SOGo.Common").directive("sgTransformOnBlur",a)}(),String.prototype.endsWith=function(a){return this.indexOf(a,this.length-a.length)!==-1},String.prototype.startsWith=function(a,b){return b=angular.isNumber(b)?b:0,this.lastIndexOf(a,b)===b},String.prototype._base64_keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",String.prototype.base64encode=function(){for(var a,b,c,d,e,f,g,h="",i=0,j=this.utf8encode();i<j.length;)a=j.charCodeAt(i++),b=j.charCodeAt(i++),c=j.charCodeAt(i++),d=a>>2,e=(3&a)<<4|b>>4,f=(15&b)<<2|c>>6,g=63&c,isNaN(b)?f=g=64:isNaN(c)&&(g=64),h=h+this._base64_keyStr.charAt(d)+this._base64_keyStr.charAt(e)+this._base64_keyStr.charAt(f)+this._base64_keyStr.charAt(g);return h},String.prototype.base64decode=function(){for(var a,b,c,d,e,f,g,h="",i=0,j=""+this;i<j.length;)d=this._base64_keyStr.indexOf(j.charAt(i++)),e=this._base64_keyStr.indexOf(j.charAt(i++)),f=this._base64_keyStr.indexOf(j.charAt(i++)),g=this._base64_keyStr.indexOf(j.charAt(i++)),a=d<<2|e>>4,b=(15&e)<<4|f>>2,c=(3&f)<<6|g,h+=String.fromCharCode(a),64!=f&&(h+=String.fromCharCode(b)),64!=g&&(h+=String.fromCharCode(c));return h},String.prototype.md5=function(){if(this.length){var a=function(a){function b(a,b){return a<<b|a>>>32-b}function c(a,b){var c,d,e,f,g;return e=2147483648&a,f=2147483648&b,c=1073741824&a,d=1073741824&b,g=(1073741823&a)+(1073741823&b),c&d?2147483648^g^e^f:c|d?1073741824&g?3221225472^g^e^f:1073741824^g^e^f:g^e^f}function d(a,b,c){return a&b|~a&c}function e(a,b,c){return a&c|b&~c}function f(a,b,c){return a^b^c}function g(a,b,c){return b^(a|~c)}function h(a,e,f,g,h,i,j){return a=c(a,c(c(d(e,f,g),h),j)),c(b(a,i),e)}function i(a,d,f,g,h,i,j){return a=c(a,c(c(e(d,f,g),h),j)),c(b(a,i),d)}function j(a,d,e,g,h,i,j){return a=c(a,c(c(f(d,e,g),h),j)),c(b(a,i),d)}function k(a,d,e,f,h,i,j){return a=c(a,c(c(g(d,e,f),h),j)),c(b(a,i),d)}function l(a){for(var b,c=a.length,d=c+8,e=(d-d%64)/64,f=16*(e+1),g=Array(f-1),h=0,i=0;i<c;)b=(i-i%4)/4,h=i%4*8,g[b]=g[b]|a.charCodeAt(i)<<h,i++;return b=(i-i%4)/4,h=i%4*8,g[b]=g[b]|128<<h,g[f-2]=c<<3,g[f-1]=c>>>29,g}function m(a){var b,c,d="",e="";for(c=0;c<=3;c++)b=a>>>8*c&255,e="0"+b.toString(16),d+=e.substr(e.length-2,2);return d}function n(a){a=a.rep
|
2015-08-07 16:37:36 +02:00
|
|
|
//# sourceMappingURL=Common.js.map
|