diff --git a/.gitattributes b/.gitattributes index 94495fdaf2..ca05d79419 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,3 +4,10 @@ ng.inx export-ignore README.md export-ignore LICENSE export-ignore + +# Store every text file with LF; the working tree matches on every platform. +* text=auto eol=lf + +# Windows batch scripts must keep CRLF; cmd.exe can misparse LF-only files. +*.bat text eol=crlf +*.cmd text eol=crlf diff --git a/assets/.thumbs/index.html b/assets/.thumbs/index.html index fdd3791786..cfb7d0fe18 100755 --- a/assets/.thumbs/index.html +++ b/assets/.thumbs/index.html @@ -1,2 +1,2 @@ -

Unauthorized access

+

Unauthorized access

You're not allowed to access file folder \ No newline at end of file diff --git a/assets/backup/index.html b/assets/backup/index.html index fdd3791786..cfb7d0fe18 100755 --- a/assets/backup/index.html +++ b/assets/backup/index.html @@ -1,2 +1,2 @@ -

Unauthorized access

+

Unauthorized access

You're not allowed to access file folder \ No newline at end of file diff --git a/assets/cache/images/index.html b/assets/cache/images/index.html index fdd3791786..cfb7d0fe18 100755 --- a/assets/cache/images/index.html +++ b/assets/cache/images/index.html @@ -1,2 +1,2 @@ -

Unauthorized access

+

Unauthorized access

You're not allowed to access file folder \ No newline at end of file diff --git a/assets/js/easy-ui/editors/imageBrowser.js b/assets/js/easy-ui/editors/imageBrowser.js index 62d65a5cc1..df4ff0119c 100755 --- a/assets/js/easy-ui/editors/imageBrowser.js +++ b/assets/js/easy-ui/editors/imageBrowser.js @@ -1,54 +1,54 @@ -(function($) { - $.extend($.fn.datagrid.defaults.editors, { - imageBrowser: { - thumb_prefix: '', - noImage: '', - init: function (container, options) { - var input = $('').appendTo(container); - var image = $('').appendTo(container); - this.thumb_prefix = options.thumb_prefix; - this.noImage = options.noImage; - image.click({ - target: this, - field: input, - browserUrl: options.browserUrl, - opener: options.opener - }, this.browse); - return input; - }, - destroy: function (target) { - $(target).remove(); - }, - getValue: function (target) { - return $(target).val(); - }, - setValue: function (target, value) { - $(target).val(value); - $(target).parent().find('img').attr('src', (value == '' ? this.noImage : this.thumb_prefix + value)); - }, - resize: function (target, width) { - return; - }, - browse: function (e) { - var width = screen.width * 0.5; - var height = screen.height * 0.5; - var iLeft = (screen.width - width) / 2; - var iTop = (screen.height - height) / 2; - var sOptions = 'toolbar=no,status=no,resizable=yes,dependent=yes'; - var url = e.data.browserUrl + '&opener=' + e.data.opener; - sOptions += ',width=' + width; - sOptions += ',height=' + height; - sOptions += ',left=' + iLeft; - sOptions += ',top=' + iTop; - window.KCFinder = {}; - window.KCFinder = { - callBack: function (url) { - window.KCFinder = null; - e.data.target.setValue(e.data.field, url); - } - }; - var oWindow = window.open(url, 'ImageBrowser', sOptions); - } - } - }); -})(jQuery); +(function($) { + $.extend($.fn.datagrid.defaults.editors, { + imageBrowser: { + thumb_prefix: '', + noImage: '', + init: function (container, options) { + var input = $('').appendTo(container); + var image = $('').appendTo(container); + this.thumb_prefix = options.thumb_prefix; + this.noImage = options.noImage; + image.click({ + target: this, + field: input, + browserUrl: options.browserUrl, + opener: options.opener + }, this.browse); + return input; + }, + destroy: function (target) { + $(target).remove(); + }, + getValue: function (target) { + return $(target).val(); + }, + setValue: function (target, value) { + $(target).val(value); + $(target).parent().find('img').attr('src', (value == '' ? this.noImage : this.thumb_prefix + value)); + }, + resize: function (target, width) { + return; + }, + browse: function (e) { + var width = screen.width * 0.5; + var height = screen.height * 0.5; + var iLeft = (screen.width - width) / 2; + var iTop = (screen.height - height) / 2; + var sOptions = 'toolbar=no,status=no,resizable=yes,dependent=yes'; + var url = e.data.browserUrl + '&opener=' + e.data.opener; + sOptions += ',width=' + width; + sOptions += ',height=' + height; + sOptions += ',left=' + iLeft; + sOptions += ',top=' + iTop; + window.KCFinder = {}; + window.KCFinder = { + callBack: function (url) { + window.KCFinder = null; + e.data.target.setValue(e.data.field, url); + } + }; + var oWindow = window.open(url, 'ImageBrowser', sOptions); + } + } + }); +})(jQuery); diff --git a/assets/js/easy-ui/plugins/jquery.accordion.js b/assets/js/easy-ui/plugins/jquery.accordion.js index 9513fef9d0..d5021f02c7 100755 --- a/assets/js/easy-ui/plugins/jquery.accordion.js +++ b/assets/js/easy-ui/plugins/jquery.accordion.js @@ -1,350 +1,350 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(_2,_3){ -var _4=$.data(_2,"accordion"); -var _5=_4.options; -var _6=_4.panels; -var cc=$(_2); -var _7=(_5.halign=="left"||_5.halign=="right"); -cc.children(".panel-last").removeClass("panel-last"); -cc.children(".panel:last").addClass("panel-last"); -if(_3){ -$.extend(_5,{width:_3.width,height:_3.height}); -} -cc._size(_5); -var _8=0; -var _9="auto"; -var _a=cc.find(">.panel>.accordion-header"); -if(_a.length){ -if(_7){ -$(_6[0]).panel("resize",{width:cc.width(),height:cc.height()}); -_8=$(_a[0])._outerWidth(); -}else{ -_8=$(_a[0]).css("height","")._outerHeight(); -} -} -if(!isNaN(parseInt(_5.height))){ -if(_7){ -_9=cc.width()-_8*_a.length; -}else{ -_9=cc.height()-_8*_a.length; -} -} -_b(true,_9-_b(false)); -function _b(_c,_d){ -var _e=0; -for(var i=0;i<_6.length;i++){ -var p=_6[i]; -if(_7){ -var h=p.panel("header")._outerWidth(_8); -}else{ -var h=p.panel("header")._outerHeight(_8); -} -if(p.panel("options").collapsible==_c){ -var _f=isNaN(_d)?undefined:(_d+_8*h.length); -if(_7){ -p.panel("resize",{height:cc.height(),width:(_c?_f:undefined)}); -_e+=p.panel("panel")._outerWidth()-_8*h.length; -}else{ -p.panel("resize",{width:cc.width(),height:(_c?_f:undefined)}); -_e+=p.panel("panel").outerHeight()-_8*h.length; -} -} -} -return _e; -}; -}; -function _10(_11,_12,_13,all){ -var _14=$.data(_11,"accordion").panels; -var pp=[]; -for(var i=0;i<_14.length;i++){ -var p=_14[i]; -if(_12){ -if(p.panel("options")[_12]==_13){ -pp.push(p); -} -}else{ -if(p[0]==$(_13)[0]){ -return i; -} -} -} -if(_12){ -return all?pp:(pp.length?pp[0]:null); -}else{ -return -1; -} -}; -function _15(_16){ -return _10(_16,"collapsed",false,true); -}; -function _17(_18){ -var pp=_15(_18); -return pp.length?pp[0]:null; -}; -function _19(_1a,_1b){ -return _10(_1a,null,_1b); -}; -function _1c(_1d,_1e){ -var _1f=$.data(_1d,"accordion").panels; -if(typeof _1e=="number"){ -if(_1e<0||_1e>=_1f.length){ -return null; -}else{ -return _1f[_1e]; -} -} -return _10(_1d,"title",_1e); -}; -function _20(_21){ -var _22=$.data(_21,"accordion").options; -var cc=$(_21); -if(_22.border){ -cc.removeClass("accordion-noborder"); -}else{ -cc.addClass("accordion-noborder"); -} -}; -function _23(_24){ -var _25=$.data(_24,"accordion"); -var cc=$(_24); -cc.addClass("accordion"); -_25.panels=[]; -cc.children("div").each(function(){ -var _26=$.extend({},$.parser.parseOptions(this),{selected:($(this).attr("selected")?true:undefined)}); -var pp=$(this); -_25.panels.push(pp); -_28(_24,pp,_26); -}); -cc.bind("_resize",function(e,_27){ -if($(this).hasClass("easyui-fluid")||_27){ -_1(_24); -} -return false; -}); -}; -function _28(_29,pp,_2a){ -var _2b=$.data(_29,"accordion").options; -pp.panel($.extend({},{collapsible:true,minimizable:false,maximizable:false,closable:false,doSize:false,collapsed:true,headerCls:"accordion-header",bodyCls:"accordion-body",halign:_2b.halign},_2a,{onBeforeExpand:function(){ -if(_2a.onBeforeExpand){ -if(_2a.onBeforeExpand.call(this)==false){ -return false; -} -} -if(!_2b.multiple){ -var all=$.grep(_15(_29),function(p){ -return p.panel("options").collapsible; -}); -for(var i=0;i.panel-last>.accordion-header").removeClass("accordion-header-border"); -if(_2a.onExpand){ -_2a.onExpand.call(this); -} -_2b.onSelect.call(_29,$(this).panel("options").title,_19(_29,this)); -},onBeforeCollapse:function(){ -if(_2a.onBeforeCollapse){ -if(_2a.onBeforeCollapse.call(this)==false){ -return false; -} -} -$(_29).find(">.panel-last>.accordion-header").addClass("accordion-header-border"); -var _2d=$(this).panel("header"); -_2d.removeClass("accordion-header-selected"); -_2d.find(".accordion-collapse").addClass("accordion-expand"); -},onCollapse:function(){ -if(isNaN(parseInt(_2b.height))){ -$(_29).find(">.panel-last>.accordion-header").removeClass("accordion-header-border"); -} -if(_2a.onCollapse){ -_2a.onCollapse.call(this); -} -_2b.onUnselect.call(_29,$(this).panel("options").title,_19(_29,this)); -}})); -var _2e=pp.panel("header"); -var _2f=_2e.children("div.panel-tool"); -_2f.children("a.panel-tool-collapse").hide(); -var t=$("").addClass("accordion-collapse accordion-expand").appendTo(_2f); -t.bind("click",function(){ -_30(pp); -return false; -}); -pp.panel("options").collapsible?t.show():t.hide(); -if(_2b.halign=="left"||_2b.halign=="right"){ -t.hide(); -} -_2e.click(function(){ -_30(pp); -return false; -}); -function _30(p){ -var _31=p.panel("options"); -if(_31.collapsible){ -var _32=_19(_29,p); -if(_31.collapsed){ -_33(_29,_32); -}else{ -_34(_29,_32); -} -} -}; -}; -function _33(_35,_36){ -var p=_1c(_35,_36); -if(!p){ -return; -} -_37(_35); -var _38=$.data(_35,"accordion").options; -p.panel("expand",_38.animate); -}; -function _34(_39,_3a){ -var p=_1c(_39,_3a); -if(!p){ -return; -} -_37(_39); -var _3b=$.data(_39,"accordion").options; -p.panel("collapse",_3b.animate); -}; -function _3c(_3d){ -var _3e=$.data(_3d,"accordion").options; -$(_3d).find(">.panel-last>.accordion-header").addClass("accordion-header-border"); -var p=_10(_3d,"selected",true); -if(p){ -_3f(_19(_3d,p)); -}else{ -_3f(_3e.selected); -} -function _3f(_40){ -var _41=_3e.animate; -_3e.animate=false; -_33(_3d,_40); -_3e.animate=_41; -}; -}; -function _37(_42){ -var _43=$.data(_42,"accordion").panels; -for(var i=0;i<_43.length;i++){ -_43[i].stop(true,true); -} -}; -function add(_44,_45){ -var _46=$.data(_44,"accordion"); -var _47=_46.options; -var _48=_46.panels; -if(_45.selected==undefined){ -_45.selected=true; -} -_37(_44); -var pp=$("
").appendTo(_44); -_48.push(pp); -_28(_44,pp,_45); -_1(_44); -_47.onAdd.call(_44,_45.title,_48.length-1); -if(_45.selected){ -_33(_44,_48.length-1); -} -}; -function _49(_4a,_4b){ -var _4c=$.data(_4a,"accordion"); -var _4d=_4c.options; -var _4e=_4c.panels; -_37(_4a); -var _4f=_1c(_4a,_4b); -var _50=_4f.panel("options").title; -var _51=_19(_4a,_4f); -if(!_4f){ -return; -} -if(_4d.onBeforeRemove.call(_4a,_50,_51)==false){ -return; -} -_4e.splice(_51,1); -_4f.panel("destroy"); -if(_4e.length){ -_1(_4a); -var _52=_17(_4a); -if(!_52){ -_33(_4a,0); -} -} -_4d.onRemove.call(_4a,_50,_51); -}; -$.fn.accordion=function(_53,_54){ -if(typeof _53=="string"){ -return $.fn.accordion.methods[_53](this,_54); -} -_53=_53||{}; -return this.each(function(){ -var _55=$.data(this,"accordion"); -if(_55){ -$.extend(_55.options,_53); -}else{ -$.data(this,"accordion",{options:$.extend({},$.fn.accordion.defaults,$.fn.accordion.parseOptions(this),_53),accordion:$(this).addClass("accordion"),panels:[]}); -_23(this); -} -_20(this); -_1(this); -_3c(this); -}); -}; -$.fn.accordion.methods={options:function(jq){ -return $.data(jq[0],"accordion").options; -},panels:function(jq){ -return $.data(jq[0],"accordion").panels; -},resize:function(jq,_56){ -return jq.each(function(){ -_1(this,_56); -}); -},getSelections:function(jq){ -return _15(jq[0]); -},getSelected:function(jq){ -return _17(jq[0]); -},getPanel:function(jq,_57){ -return _1c(jq[0],_57); -},getPanelIndex:function(jq,_58){ -return _19(jq[0],_58); -},select:function(jq,_59){ -return jq.each(function(){ -_33(this,_59); -}); -},unselect:function(jq,_5a){ -return jq.each(function(){ -_34(this,_5a); -}); -},add:function(jq,_5b){ -return jq.each(function(){ -add(this,_5b); -}); -},remove:function(jq,_5c){ -return jq.each(function(){ -_49(this,_5c); -}); -}}; -$.fn.accordion.parseOptions=function(_5d){ -var t=$(_5d); -return $.extend({},$.parser.parseOptions(_5d,["width","height","halign",{fit:"boolean",border:"boolean",animate:"boolean",multiple:"boolean",selected:"number"}])); -}; -$.fn.accordion.defaults={width:"auto",height:"auto",fit:false,border:true,animate:true,multiple:false,selected:0,halign:"top",onSelect:function(_5e,_5f){ -},onUnselect:function(_60,_61){ -},onAdd:function(_62,_63){ -},onBeforeRemove:function(_64,_65){ -},onRemove:function(_66,_67){ -}}; -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(_2,_3){ +var _4=$.data(_2,"accordion"); +var _5=_4.options; +var _6=_4.panels; +var cc=$(_2); +var _7=(_5.halign=="left"||_5.halign=="right"); +cc.children(".panel-last").removeClass("panel-last"); +cc.children(".panel:last").addClass("panel-last"); +if(_3){ +$.extend(_5,{width:_3.width,height:_3.height}); +} +cc._size(_5); +var _8=0; +var _9="auto"; +var _a=cc.find(">.panel>.accordion-header"); +if(_a.length){ +if(_7){ +$(_6[0]).panel("resize",{width:cc.width(),height:cc.height()}); +_8=$(_a[0])._outerWidth(); +}else{ +_8=$(_a[0]).css("height","")._outerHeight(); +} +} +if(!isNaN(parseInt(_5.height))){ +if(_7){ +_9=cc.width()-_8*_a.length; +}else{ +_9=cc.height()-_8*_a.length; +} +} +_b(true,_9-_b(false)); +function _b(_c,_d){ +var _e=0; +for(var i=0;i<_6.length;i++){ +var p=_6[i]; +if(_7){ +var h=p.panel("header")._outerWidth(_8); +}else{ +var h=p.panel("header")._outerHeight(_8); +} +if(p.panel("options").collapsible==_c){ +var _f=isNaN(_d)?undefined:(_d+_8*h.length); +if(_7){ +p.panel("resize",{height:cc.height(),width:(_c?_f:undefined)}); +_e+=p.panel("panel")._outerWidth()-_8*h.length; +}else{ +p.panel("resize",{width:cc.width(),height:(_c?_f:undefined)}); +_e+=p.panel("panel").outerHeight()-_8*h.length; +} +} +} +return _e; +}; +}; +function _10(_11,_12,_13,all){ +var _14=$.data(_11,"accordion").panels; +var pp=[]; +for(var i=0;i<_14.length;i++){ +var p=_14[i]; +if(_12){ +if(p.panel("options")[_12]==_13){ +pp.push(p); +} +}else{ +if(p[0]==$(_13)[0]){ +return i; +} +} +} +if(_12){ +return all?pp:(pp.length?pp[0]:null); +}else{ +return -1; +} +}; +function _15(_16){ +return _10(_16,"collapsed",false,true); +}; +function _17(_18){ +var pp=_15(_18); +return pp.length?pp[0]:null; +}; +function _19(_1a,_1b){ +return _10(_1a,null,_1b); +}; +function _1c(_1d,_1e){ +var _1f=$.data(_1d,"accordion").panels; +if(typeof _1e=="number"){ +if(_1e<0||_1e>=_1f.length){ +return null; +}else{ +return _1f[_1e]; +} +} +return _10(_1d,"title",_1e); +}; +function _20(_21){ +var _22=$.data(_21,"accordion").options; +var cc=$(_21); +if(_22.border){ +cc.removeClass("accordion-noborder"); +}else{ +cc.addClass("accordion-noborder"); +} +}; +function _23(_24){ +var _25=$.data(_24,"accordion"); +var cc=$(_24); +cc.addClass("accordion"); +_25.panels=[]; +cc.children("div").each(function(){ +var _26=$.extend({},$.parser.parseOptions(this),{selected:($(this).attr("selected")?true:undefined)}); +var pp=$(this); +_25.panels.push(pp); +_28(_24,pp,_26); +}); +cc.bind("_resize",function(e,_27){ +if($(this).hasClass("easyui-fluid")||_27){ +_1(_24); +} +return false; +}); +}; +function _28(_29,pp,_2a){ +var _2b=$.data(_29,"accordion").options; +pp.panel($.extend({},{collapsible:true,minimizable:false,maximizable:false,closable:false,doSize:false,collapsed:true,headerCls:"accordion-header",bodyCls:"accordion-body",halign:_2b.halign},_2a,{onBeforeExpand:function(){ +if(_2a.onBeforeExpand){ +if(_2a.onBeforeExpand.call(this)==false){ +return false; +} +} +if(!_2b.multiple){ +var all=$.grep(_15(_29),function(p){ +return p.panel("options").collapsible; +}); +for(var i=0;i.panel-last>.accordion-header").removeClass("accordion-header-border"); +if(_2a.onExpand){ +_2a.onExpand.call(this); +} +_2b.onSelect.call(_29,$(this).panel("options").title,_19(_29,this)); +},onBeforeCollapse:function(){ +if(_2a.onBeforeCollapse){ +if(_2a.onBeforeCollapse.call(this)==false){ +return false; +} +} +$(_29).find(">.panel-last>.accordion-header").addClass("accordion-header-border"); +var _2d=$(this).panel("header"); +_2d.removeClass("accordion-header-selected"); +_2d.find(".accordion-collapse").addClass("accordion-expand"); +},onCollapse:function(){ +if(isNaN(parseInt(_2b.height))){ +$(_29).find(">.panel-last>.accordion-header").removeClass("accordion-header-border"); +} +if(_2a.onCollapse){ +_2a.onCollapse.call(this); +} +_2b.onUnselect.call(_29,$(this).panel("options").title,_19(_29,this)); +}})); +var _2e=pp.panel("header"); +var _2f=_2e.children("div.panel-tool"); +_2f.children("a.panel-tool-collapse").hide(); +var t=$("").addClass("accordion-collapse accordion-expand").appendTo(_2f); +t.bind("click",function(){ +_30(pp); +return false; +}); +pp.panel("options").collapsible?t.show():t.hide(); +if(_2b.halign=="left"||_2b.halign=="right"){ +t.hide(); +} +_2e.click(function(){ +_30(pp); +return false; +}); +function _30(p){ +var _31=p.panel("options"); +if(_31.collapsible){ +var _32=_19(_29,p); +if(_31.collapsed){ +_33(_29,_32); +}else{ +_34(_29,_32); +} +} +}; +}; +function _33(_35,_36){ +var p=_1c(_35,_36); +if(!p){ +return; +} +_37(_35); +var _38=$.data(_35,"accordion").options; +p.panel("expand",_38.animate); +}; +function _34(_39,_3a){ +var p=_1c(_39,_3a); +if(!p){ +return; +} +_37(_39); +var _3b=$.data(_39,"accordion").options; +p.panel("collapse",_3b.animate); +}; +function _3c(_3d){ +var _3e=$.data(_3d,"accordion").options; +$(_3d).find(">.panel-last>.accordion-header").addClass("accordion-header-border"); +var p=_10(_3d,"selected",true); +if(p){ +_3f(_19(_3d,p)); +}else{ +_3f(_3e.selected); +} +function _3f(_40){ +var _41=_3e.animate; +_3e.animate=false; +_33(_3d,_40); +_3e.animate=_41; +}; +}; +function _37(_42){ +var _43=$.data(_42,"accordion").panels; +for(var i=0;i<_43.length;i++){ +_43[i].stop(true,true); +} +}; +function add(_44,_45){ +var _46=$.data(_44,"accordion"); +var _47=_46.options; +var _48=_46.panels; +if(_45.selected==undefined){ +_45.selected=true; +} +_37(_44); +var pp=$("
").appendTo(_44); +_48.push(pp); +_28(_44,pp,_45); +_1(_44); +_47.onAdd.call(_44,_45.title,_48.length-1); +if(_45.selected){ +_33(_44,_48.length-1); +} +}; +function _49(_4a,_4b){ +var _4c=$.data(_4a,"accordion"); +var _4d=_4c.options; +var _4e=_4c.panels; +_37(_4a); +var _4f=_1c(_4a,_4b); +var _50=_4f.panel("options").title; +var _51=_19(_4a,_4f); +if(!_4f){ +return; +} +if(_4d.onBeforeRemove.call(_4a,_50,_51)==false){ +return; +} +_4e.splice(_51,1); +_4f.panel("destroy"); +if(_4e.length){ +_1(_4a); +var _52=_17(_4a); +if(!_52){ +_33(_4a,0); +} +} +_4d.onRemove.call(_4a,_50,_51); +}; +$.fn.accordion=function(_53,_54){ +if(typeof _53=="string"){ +return $.fn.accordion.methods[_53](this,_54); +} +_53=_53||{}; +return this.each(function(){ +var _55=$.data(this,"accordion"); +if(_55){ +$.extend(_55.options,_53); +}else{ +$.data(this,"accordion",{options:$.extend({},$.fn.accordion.defaults,$.fn.accordion.parseOptions(this),_53),accordion:$(this).addClass("accordion"),panels:[]}); +_23(this); +} +_20(this); +_1(this); +_3c(this); +}); +}; +$.fn.accordion.methods={options:function(jq){ +return $.data(jq[0],"accordion").options; +},panels:function(jq){ +return $.data(jq[0],"accordion").panels; +},resize:function(jq,_56){ +return jq.each(function(){ +_1(this,_56); +}); +},getSelections:function(jq){ +return _15(jq[0]); +},getSelected:function(jq){ +return _17(jq[0]); +},getPanel:function(jq,_57){ +return _1c(jq[0],_57); +},getPanelIndex:function(jq,_58){ +return _19(jq[0],_58); +},select:function(jq,_59){ +return jq.each(function(){ +_33(this,_59); +}); +},unselect:function(jq,_5a){ +return jq.each(function(){ +_34(this,_5a); +}); +},add:function(jq,_5b){ +return jq.each(function(){ +add(this,_5b); +}); +},remove:function(jq,_5c){ +return jq.each(function(){ +_49(this,_5c); +}); +}}; +$.fn.accordion.parseOptions=function(_5d){ +var t=$(_5d); +return $.extend({},$.parser.parseOptions(_5d,["width","height","halign",{fit:"boolean",border:"boolean",animate:"boolean",multiple:"boolean",selected:"number"}])); +}; +$.fn.accordion.defaults={width:"auto",height:"auto",fit:false,border:true,animate:true,multiple:false,selected:0,halign:"top",onSelect:function(_5e,_5f){ +},onUnselect:function(_60,_61){ +},onAdd:function(_62,_63){ +},onBeforeRemove:function(_64,_65){ +},onRemove:function(_66,_67){ +}}; +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.calendar.js b/assets/js/easy-ui/plugins/jquery.calendar.js index 9ca3632ccb..5811c9b20f 100755 --- a/assets/js/easy-ui/plugins/jquery.calendar.js +++ b/assets/js/easy-ui/plugins/jquery.calendar.js @@ -1,403 +1,403 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(_2,_3){ -var _4=$.data(_2,"calendar").options; -var t=$(_2); -if(_3){ -$.extend(_4,{width:_3.width,height:_3.height}); -} -t._size(_4,t.parent()); -t.find(".calendar-body")._outerHeight(t.height()-t.find(".calendar-header")._outerHeight()); -if(t.find(".calendar-menu").is(":visible")){ -_5(_2); -} -}; -function _6(_7){ -$(_7).addClass("calendar").html("
"+"
"+"
"+"
"+"
"+"
"+""+"
"+"
"+"
"+"
"+"
"+""+""+""+"
"+"
"+"
"+"
"+"
"); -$(_7).bind("_resize",function(e,_8){ -if($(this).hasClass("easyui-fluid")||_8){ -_1(_7); -} -return false; -}); -}; -function _9(_a){ -var _b=$.data(_a,"calendar").options; -var _c=$(_a).find(".calendar-menu"); -_c.find(".calendar-menu-year").unbind(".calendar").bind("keypress.calendar",function(e){ -if(e.keyCode==13){ -_d(true); -} -}); -$(_a).unbind(".calendar").bind("mouseover.calendar",function(e){ -var t=_e(e.target); -if(t.hasClass("calendar-nav")||t.hasClass("calendar-text")||(t.hasClass("calendar-day")&&!t.hasClass("calendar-disabled"))){ -t.addClass("calendar-nav-hover"); -} -}).bind("mouseout.calendar",function(e){ -var t=_e(e.target); -if(t.hasClass("calendar-nav")||t.hasClass("calendar-text")||(t.hasClass("calendar-day")&&!t.hasClass("calendar-disabled"))){ -t.removeClass("calendar-nav-hover"); -} -}).bind("click.calendar",function(e){ -var t=_e(e.target); -if(t.hasClass("calendar-menu-next")||t.hasClass("calendar-nextyear")){ -_f(1); -}else{ -if(t.hasClass("calendar-menu-prev")||t.hasClass("calendar-prevyear")){ -_f(-1); -}else{ -if(t.hasClass("calendar-menu-month")){ -_c.find(".calendar-selected").removeClass("calendar-selected"); -t.addClass("calendar-selected"); -_d(true); -}else{ -if(t.hasClass("calendar-prevmonth")){ -_10(-1); -}else{ -if(t.hasClass("calendar-nextmonth")){ -_10(1); -}else{ -if(t.hasClass("calendar-text")){ -if(_c.is(":visible")){ -_c.hide(); -}else{ -_5(_a); -} -}else{ -if(t.hasClass("calendar-day")){ -if(t.hasClass("calendar-disabled")){ -return; -} -var _11=_b.current; -t.closest("div.calendar-body").find(".calendar-selected").removeClass("calendar-selected"); -t.addClass("calendar-selected"); -var _12=t.attr("abbr").split(","); -var y=parseInt(_12[0]); -var m=parseInt(_12[1]); -var d=parseInt(_12[2]); -_b.current=new Date(y,m-1,d); -_b.onSelect.call(_a,_b.current); -if(!_11||_11.getTime()!=_b.current.getTime()){ -_b.onChange.call(_a,_b.current,_11); -} -if(_b.year!=y||_b.month!=m){ -_b.year=y; -_b.month=m; -_19(_a); -} -} -} -} -} -} -} -} -}); -function _e(t){ -var day=$(t).closest(".calendar-day"); -if(day.length){ -return day; -}else{ -return $(t); -} -}; -function _d(_13){ -var _14=$(_a).find(".calendar-menu"); -var _15=_14.find(".calendar-menu-year").val(); -var _16=_14.find(".calendar-selected").attr("abbr"); -if(!isNaN(_15)){ -_b.year=parseInt(_15); -_b.month=parseInt(_16); -_19(_a); -} -if(_13){ -_14.hide(); -} -}; -function _f(_17){ -_b.year+=_17; -_19(_a); -_c.find(".calendar-menu-year").val(_b.year); -}; -function _10(_18){ -_b.month+=_18; -if(_b.month>12){ -_b.year++; -_b.month=1; -}else{ -if(_b.month<1){ -_b.year--; -_b.month=12; -} -} -_19(_a); -_c.find("td.calendar-selected").removeClass("calendar-selected"); -_c.find("td:eq("+(_b.month-1)+")").addClass("calendar-selected"); -}; -}; -function _5(_1a){ -var _1b=$.data(_1a,"calendar").options; -$(_1a).find(".calendar-menu").show(); -if($(_1a).find(".calendar-menu-month-inner").is(":empty")){ -$(_1a).find(".calendar-menu-month-inner").empty(); -var t=$("
").appendTo($(_1a).find(".calendar-menu-month-inner")); -var idx=0; -for(var i=0;i<3;i++){ -var tr=$("").appendTo(t); -for(var j=0;j<4;j++){ -$("").html(_1b.months[idx++]).attr("abbr",idx).appendTo(tr); -} -} -} -var _1c=$(_1a).find(".calendar-body"); -var _1d=$(_1a).find(".calendar-menu"); -var _1e=_1d.find(".calendar-menu-year-inner"); -var _1f=_1d.find(".calendar-menu-month-inner"); -_1e.find("input").val(_1b.year).focus(); -_1f.find("td.calendar-selected").removeClass("calendar-selected"); -_1f.find("td:eq("+(_1b.month-1)+")").addClass("calendar-selected"); -_1d._outerWidth(_1c._outerWidth()); -_1d._outerHeight(_1c._outerHeight()); -_1f._outerHeight(_1d.height()-_1e._outerHeight()); -}; -function _20(_21,_22,_23){ -var _24=$.data(_21,"calendar").options; -var _25=[]; -var _26=new Date(_22,_23,0).getDate(); -for(var i=1;i<=_26;i++){ -_25.push([_22,_23,i]); -} -var _27=[],_28=[]; -var _29=-1; -while(_25.length>0){ -var _2a=_25.shift(); -_28.push(_2a); -var day=new Date(_2a[0],_2a[1]-1,_2a[2]).getDay(); -if(_29==day){ -day=0; -}else{ -if(day==(_24.firstDay==0?7:_24.firstDay)-1){ -_27.push(_28); -_28=[]; -} -} -_29=day; -} -if(_28.length){ -_27.push(_28); -} -var _2b=_27[0]; -if(_2b.length<7){ -while(_2b.length<7){ -var _2c=_2b[0]; -var _2a=new Date(_2c[0],_2c[1]-1,_2c[2]-1); -_2b.unshift([_2a.getFullYear(),_2a.getMonth()+1,_2a.getDate()]); -} -}else{ -var _2c=_2b[0]; -var _28=[]; -for(var i=1;i<=7;i++){ -var _2a=new Date(_2c[0],_2c[1]-1,_2c[2]-i); -_28.unshift([_2a.getFullYear(),_2a.getMonth()+1,_2a.getDate()]); -} -_27.unshift(_28); -} -var _2d=_27[_27.length-1]; -while(_2d.length<7){ -var _2e=_2d[_2d.length-1]; -var _2a=new Date(_2e[0],_2e[1]-1,_2e[2]+1); -_2d.push([_2a.getFullYear(),_2a.getMonth()+1,_2a.getDate()]); -} -if(_27.length<6){ -var _2e=_2d[_2d.length-1]; -var _28=[]; -for(var i=1;i<=7;i++){ -var _2a=new Date(_2e[0],_2e[1]-1,_2e[2]+i); -_28.push([_2a.getFullYear(),_2a.getMonth()+1,_2a.getDate()]); -} -_27.push(_28); -} -return _27; -}; -function _19(_2f){ -var _30=$.data(_2f,"calendar").options; -if(_30.current&&!_30.validator.call(_2f,_30.current)){ -_30.current=null; -} -var now=new Date(); -var _31=now.getFullYear()+","+(now.getMonth()+1)+","+now.getDate(); -var _32=_30.current?(_30.current.getFullYear()+","+(_30.current.getMonth()+1)+","+_30.current.getDate()):""; -var _33=6-_30.firstDay; -var _34=_33+1; -if(_33>=7){ -_33-=7; -} -if(_34>=7){ -_34-=7; -} -$(_2f).find(".calendar-title span").html(_30.months[_30.month-1]+" "+_30.year); -var _35=$(_2f).find("div.calendar-body"); -_35.children("table").remove(); -var _36=[""]; -_36.push(""); -if(_30.showWeek){ -_36.push(""); -} -for(var i=_30.firstDay;i<_30.weeks.length;i++){ -_36.push(""); -} -for(var i=0;i<_30.firstDay;i++){ -_36.push(""); -} -_36.push(""); -_36.push(""); -var _37=_20(_2f,_30.year,_30.month); -for(var i=0;i<_37.length;i++){ -var _38=_37[i]; -var cls=""; -if(i==0){ -cls="calendar-first"; -}else{ -if(i==_37.length-1){ -cls="calendar-last"; -} -} -_36.push(""); -if(_30.showWeek){ -var _39=_30.getWeekNumber(new Date(_38[0][0],parseInt(_38[0][1])-1,_38[0][2])); -_36.push(""); -} -for(var j=0;j<_38.length;j++){ -var day=_38[j]; -var s=day[0]+","+day[1]+","+day[2]; -var _3a=new Date(day[0],parseInt(day[1])-1,day[2]); -var d=_30.formatter.call(_2f,_3a); -var css=_30.styler.call(_2f,_3a); -var _3b=""; -var _3c=""; -if(typeof css=="string"){ -_3c=css; -}else{ -if(css){ -_3b=css["class"]||""; -_3c=css["style"]||""; -} -} -var cls="calendar-day"; -if(!(_30.year==day[0]&&_30.month==day[1])){ -cls+=" calendar-other-month"; -} -if(s==_31){ -cls+=" calendar-today"; -} -if(s==_32){ -cls+=" calendar-selected"; -} -if(j==_33){ -cls+=" calendar-saturday"; -}else{ -if(j==_34){ -cls+=" calendar-sunday"; -} -} -if(j==0){ -cls+=" calendar-first"; -}else{ -if(j==_38.length-1){ -cls+=" calendar-last"; -} -} -cls+=" "+_3b; -if(!_30.validator.call(_2f,_3a)){ -cls+=" calendar-disabled"; -} -_36.push(""); -} -_36.push(""); -} -_36.push(""); -_36.push("
"+_30.weekNumberHeader+""+_30.weeks[i]+""+_30.weeks[i]+"
"+_39+""+d+"
"); -_35.append(_36.join("")); -_35.children("table.calendar-dtable").prependTo(_35); -_30.onNavigate.call(_2f,_30.year,_30.month); -}; -$.fn.calendar=function(_3d,_3e){ -if(typeof _3d=="string"){ -return $.fn.calendar.methods[_3d](this,_3e); -} -_3d=_3d||{}; -return this.each(function(){ -var _3f=$.data(this,"calendar"); -if(_3f){ -$.extend(_3f.options,_3d); -}else{ -_3f=$.data(this,"calendar",{options:$.extend({},$.fn.calendar.defaults,$.fn.calendar.parseOptions(this),_3d)}); -_6(this); -} -if(_3f.options.border==false){ -$(this).addClass("calendar-noborder"); -} -_1(this); -_9(this); -_19(this); -$(this).find("div.calendar-menu").hide(); -}); -}; -$.fn.calendar.methods={options:function(jq){ -return $.data(jq[0],"calendar").options; -},resize:function(jq,_40){ -return jq.each(function(){ -_1(this,_40); -}); -},moveTo:function(jq,_41){ -return jq.each(function(){ -if(!_41){ -var now=new Date(); -$(this).calendar({year:now.getFullYear(),month:now.getMonth()+1,current:_41}); -return; -} -var _42=$(this).calendar("options"); -if(_42.validator.call(this,_41)){ -var _43=_42.current; -$(this).calendar({year:_41.getFullYear(),month:_41.getMonth()+1,current:_41}); -if(!_43||_43.getTime()!=_41.getTime()){ -_42.onChange.call(this,_42.current,_43); -} -} -}); -}}; -$.fn.calendar.parseOptions=function(_44){ -var t=$(_44); -return $.extend({},$.parser.parseOptions(_44,["weekNumberHeader",{firstDay:"number",fit:"boolean",border:"boolean",showWeek:"boolean"}])); -}; -$.fn.calendar.defaults={width:180,height:180,fit:false,border:true,showWeek:false,firstDay:0,weeks:["S","M","T","W","T","F","S"],months:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],year:new Date().getFullYear(),month:new Date().getMonth()+1,current:(function(){ -var d=new Date(); -return new Date(d.getFullYear(),d.getMonth(),d.getDate()); -})(),weekNumberHeader:"",getWeekNumber:function(_45){ -var _46=new Date(_45.getTime()); -_46.setDate(_46.getDate()+4-(_46.getDay()||7)); -var _47=_46.getTime(); -_46.setMonth(0); -_46.setDate(1); -return Math.floor(Math.round((_47-_46)/86400000)/7)+1; -},formatter:function(_48){ -return _48.getDate(); -},styler:function(_49){ -return ""; -},validator:function(_4a){ -return true; -},onSelect:function(_4b){ -},onChange:function(_4c,_4d){ -},onNavigate:function(_4e,_4f){ -}}; -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(_2,_3){ +var _4=$.data(_2,"calendar").options; +var t=$(_2); +if(_3){ +$.extend(_4,{width:_3.width,height:_3.height}); +} +t._size(_4,t.parent()); +t.find(".calendar-body")._outerHeight(t.height()-t.find(".calendar-header")._outerHeight()); +if(t.find(".calendar-menu").is(":visible")){ +_5(_2); +} +}; +function _6(_7){ +$(_7).addClass("calendar").html("
"+"
"+"
"+"
"+"
"+"
"+""+"
"+"
"+"
"+"
"+"
"+""+""+""+"
"+"
"+"
"+"
"+"
"); +$(_7).bind("_resize",function(e,_8){ +if($(this).hasClass("easyui-fluid")||_8){ +_1(_7); +} +return false; +}); +}; +function _9(_a){ +var _b=$.data(_a,"calendar").options; +var _c=$(_a).find(".calendar-menu"); +_c.find(".calendar-menu-year").unbind(".calendar").bind("keypress.calendar",function(e){ +if(e.keyCode==13){ +_d(true); +} +}); +$(_a).unbind(".calendar").bind("mouseover.calendar",function(e){ +var t=_e(e.target); +if(t.hasClass("calendar-nav")||t.hasClass("calendar-text")||(t.hasClass("calendar-day")&&!t.hasClass("calendar-disabled"))){ +t.addClass("calendar-nav-hover"); +} +}).bind("mouseout.calendar",function(e){ +var t=_e(e.target); +if(t.hasClass("calendar-nav")||t.hasClass("calendar-text")||(t.hasClass("calendar-day")&&!t.hasClass("calendar-disabled"))){ +t.removeClass("calendar-nav-hover"); +} +}).bind("click.calendar",function(e){ +var t=_e(e.target); +if(t.hasClass("calendar-menu-next")||t.hasClass("calendar-nextyear")){ +_f(1); +}else{ +if(t.hasClass("calendar-menu-prev")||t.hasClass("calendar-prevyear")){ +_f(-1); +}else{ +if(t.hasClass("calendar-menu-month")){ +_c.find(".calendar-selected").removeClass("calendar-selected"); +t.addClass("calendar-selected"); +_d(true); +}else{ +if(t.hasClass("calendar-prevmonth")){ +_10(-1); +}else{ +if(t.hasClass("calendar-nextmonth")){ +_10(1); +}else{ +if(t.hasClass("calendar-text")){ +if(_c.is(":visible")){ +_c.hide(); +}else{ +_5(_a); +} +}else{ +if(t.hasClass("calendar-day")){ +if(t.hasClass("calendar-disabled")){ +return; +} +var _11=_b.current; +t.closest("div.calendar-body").find(".calendar-selected").removeClass("calendar-selected"); +t.addClass("calendar-selected"); +var _12=t.attr("abbr").split(","); +var y=parseInt(_12[0]); +var m=parseInt(_12[1]); +var d=parseInt(_12[2]); +_b.current=new Date(y,m-1,d); +_b.onSelect.call(_a,_b.current); +if(!_11||_11.getTime()!=_b.current.getTime()){ +_b.onChange.call(_a,_b.current,_11); +} +if(_b.year!=y||_b.month!=m){ +_b.year=y; +_b.month=m; +_19(_a); +} +} +} +} +} +} +} +} +}); +function _e(t){ +var day=$(t).closest(".calendar-day"); +if(day.length){ +return day; +}else{ +return $(t); +} +}; +function _d(_13){ +var _14=$(_a).find(".calendar-menu"); +var _15=_14.find(".calendar-menu-year").val(); +var _16=_14.find(".calendar-selected").attr("abbr"); +if(!isNaN(_15)){ +_b.year=parseInt(_15); +_b.month=parseInt(_16); +_19(_a); +} +if(_13){ +_14.hide(); +} +}; +function _f(_17){ +_b.year+=_17; +_19(_a); +_c.find(".calendar-menu-year").val(_b.year); +}; +function _10(_18){ +_b.month+=_18; +if(_b.month>12){ +_b.year++; +_b.month=1; +}else{ +if(_b.month<1){ +_b.year--; +_b.month=12; +} +} +_19(_a); +_c.find("td.calendar-selected").removeClass("calendar-selected"); +_c.find("td:eq("+(_b.month-1)+")").addClass("calendar-selected"); +}; +}; +function _5(_1a){ +var _1b=$.data(_1a,"calendar").options; +$(_1a).find(".calendar-menu").show(); +if($(_1a).find(".calendar-menu-month-inner").is(":empty")){ +$(_1a).find(".calendar-menu-month-inner").empty(); +var t=$("
").appendTo($(_1a).find(".calendar-menu-month-inner")); +var idx=0; +for(var i=0;i<3;i++){ +var tr=$("").appendTo(t); +for(var j=0;j<4;j++){ +$("").html(_1b.months[idx++]).attr("abbr",idx).appendTo(tr); +} +} +} +var _1c=$(_1a).find(".calendar-body"); +var _1d=$(_1a).find(".calendar-menu"); +var _1e=_1d.find(".calendar-menu-year-inner"); +var _1f=_1d.find(".calendar-menu-month-inner"); +_1e.find("input").val(_1b.year).focus(); +_1f.find("td.calendar-selected").removeClass("calendar-selected"); +_1f.find("td:eq("+(_1b.month-1)+")").addClass("calendar-selected"); +_1d._outerWidth(_1c._outerWidth()); +_1d._outerHeight(_1c._outerHeight()); +_1f._outerHeight(_1d.height()-_1e._outerHeight()); +}; +function _20(_21,_22,_23){ +var _24=$.data(_21,"calendar").options; +var _25=[]; +var _26=new Date(_22,_23,0).getDate(); +for(var i=1;i<=_26;i++){ +_25.push([_22,_23,i]); +} +var _27=[],_28=[]; +var _29=-1; +while(_25.length>0){ +var _2a=_25.shift(); +_28.push(_2a); +var day=new Date(_2a[0],_2a[1]-1,_2a[2]).getDay(); +if(_29==day){ +day=0; +}else{ +if(day==(_24.firstDay==0?7:_24.firstDay)-1){ +_27.push(_28); +_28=[]; +} +} +_29=day; +} +if(_28.length){ +_27.push(_28); +} +var _2b=_27[0]; +if(_2b.length<7){ +while(_2b.length<7){ +var _2c=_2b[0]; +var _2a=new Date(_2c[0],_2c[1]-1,_2c[2]-1); +_2b.unshift([_2a.getFullYear(),_2a.getMonth()+1,_2a.getDate()]); +} +}else{ +var _2c=_2b[0]; +var _28=[]; +for(var i=1;i<=7;i++){ +var _2a=new Date(_2c[0],_2c[1]-1,_2c[2]-i); +_28.unshift([_2a.getFullYear(),_2a.getMonth()+1,_2a.getDate()]); +} +_27.unshift(_28); +} +var _2d=_27[_27.length-1]; +while(_2d.length<7){ +var _2e=_2d[_2d.length-1]; +var _2a=new Date(_2e[0],_2e[1]-1,_2e[2]+1); +_2d.push([_2a.getFullYear(),_2a.getMonth()+1,_2a.getDate()]); +} +if(_27.length<6){ +var _2e=_2d[_2d.length-1]; +var _28=[]; +for(var i=1;i<=7;i++){ +var _2a=new Date(_2e[0],_2e[1]-1,_2e[2]+i); +_28.push([_2a.getFullYear(),_2a.getMonth()+1,_2a.getDate()]); +} +_27.push(_28); +} +return _27; +}; +function _19(_2f){ +var _30=$.data(_2f,"calendar").options; +if(_30.current&&!_30.validator.call(_2f,_30.current)){ +_30.current=null; +} +var now=new Date(); +var _31=now.getFullYear()+","+(now.getMonth()+1)+","+now.getDate(); +var _32=_30.current?(_30.current.getFullYear()+","+(_30.current.getMonth()+1)+","+_30.current.getDate()):""; +var _33=6-_30.firstDay; +var _34=_33+1; +if(_33>=7){ +_33-=7; +} +if(_34>=7){ +_34-=7; +} +$(_2f).find(".calendar-title span").html(_30.months[_30.month-1]+" "+_30.year); +var _35=$(_2f).find("div.calendar-body"); +_35.children("table").remove(); +var _36=[""]; +_36.push(""); +if(_30.showWeek){ +_36.push(""); +} +for(var i=_30.firstDay;i<_30.weeks.length;i++){ +_36.push(""); +} +for(var i=0;i<_30.firstDay;i++){ +_36.push(""); +} +_36.push(""); +_36.push(""); +var _37=_20(_2f,_30.year,_30.month); +for(var i=0;i<_37.length;i++){ +var _38=_37[i]; +var cls=""; +if(i==0){ +cls="calendar-first"; +}else{ +if(i==_37.length-1){ +cls="calendar-last"; +} +} +_36.push(""); +if(_30.showWeek){ +var _39=_30.getWeekNumber(new Date(_38[0][0],parseInt(_38[0][1])-1,_38[0][2])); +_36.push(""); +} +for(var j=0;j<_38.length;j++){ +var day=_38[j]; +var s=day[0]+","+day[1]+","+day[2]; +var _3a=new Date(day[0],parseInt(day[1])-1,day[2]); +var d=_30.formatter.call(_2f,_3a); +var css=_30.styler.call(_2f,_3a); +var _3b=""; +var _3c=""; +if(typeof css=="string"){ +_3c=css; +}else{ +if(css){ +_3b=css["class"]||""; +_3c=css["style"]||""; +} +} +var cls="calendar-day"; +if(!(_30.year==day[0]&&_30.month==day[1])){ +cls+=" calendar-other-month"; +} +if(s==_31){ +cls+=" calendar-today"; +} +if(s==_32){ +cls+=" calendar-selected"; +} +if(j==_33){ +cls+=" calendar-saturday"; +}else{ +if(j==_34){ +cls+=" calendar-sunday"; +} +} +if(j==0){ +cls+=" calendar-first"; +}else{ +if(j==_38.length-1){ +cls+=" calendar-last"; +} +} +cls+=" "+_3b; +if(!_30.validator.call(_2f,_3a)){ +cls+=" calendar-disabled"; +} +_36.push(""); +} +_36.push(""); +} +_36.push(""); +_36.push("
"+_30.weekNumberHeader+""+_30.weeks[i]+""+_30.weeks[i]+"
"+_39+""+d+"
"); +_35.append(_36.join("")); +_35.children("table.calendar-dtable").prependTo(_35); +_30.onNavigate.call(_2f,_30.year,_30.month); +}; +$.fn.calendar=function(_3d,_3e){ +if(typeof _3d=="string"){ +return $.fn.calendar.methods[_3d](this,_3e); +} +_3d=_3d||{}; +return this.each(function(){ +var _3f=$.data(this,"calendar"); +if(_3f){ +$.extend(_3f.options,_3d); +}else{ +_3f=$.data(this,"calendar",{options:$.extend({},$.fn.calendar.defaults,$.fn.calendar.parseOptions(this),_3d)}); +_6(this); +} +if(_3f.options.border==false){ +$(this).addClass("calendar-noborder"); +} +_1(this); +_9(this); +_19(this); +$(this).find("div.calendar-menu").hide(); +}); +}; +$.fn.calendar.methods={options:function(jq){ +return $.data(jq[0],"calendar").options; +},resize:function(jq,_40){ +return jq.each(function(){ +_1(this,_40); +}); +},moveTo:function(jq,_41){ +return jq.each(function(){ +if(!_41){ +var now=new Date(); +$(this).calendar({year:now.getFullYear(),month:now.getMonth()+1,current:_41}); +return; +} +var _42=$(this).calendar("options"); +if(_42.validator.call(this,_41)){ +var _43=_42.current; +$(this).calendar({year:_41.getFullYear(),month:_41.getMonth()+1,current:_41}); +if(!_43||_43.getTime()!=_41.getTime()){ +_42.onChange.call(this,_42.current,_43); +} +} +}); +}}; +$.fn.calendar.parseOptions=function(_44){ +var t=$(_44); +return $.extend({},$.parser.parseOptions(_44,["weekNumberHeader",{firstDay:"number",fit:"boolean",border:"boolean",showWeek:"boolean"}])); +}; +$.fn.calendar.defaults={width:180,height:180,fit:false,border:true,showWeek:false,firstDay:0,weeks:["S","M","T","W","T","F","S"],months:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],year:new Date().getFullYear(),month:new Date().getMonth()+1,current:(function(){ +var d=new Date(); +return new Date(d.getFullYear(),d.getMonth(),d.getDate()); +})(),weekNumberHeader:"",getWeekNumber:function(_45){ +var _46=new Date(_45.getTime()); +_46.setDate(_46.getDate()+4-(_46.getDay()||7)); +var _47=_46.getTime(); +_46.setMonth(0); +_46.setDate(1); +return Math.floor(Math.round((_47-_46)/86400000)/7)+1; +},formatter:function(_48){ +return _48.getDate(); +},styler:function(_49){ +return ""; +},validator:function(_4a){ +return true; +},onSelect:function(_4b){ +},onChange:function(_4c,_4d){ +},onNavigate:function(_4e,_4f){ +}}; +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.combo.js b/assets/js/easy-ui/plugins/jquery.combo.js index a74c3d0231..8d9ee99a22 100755 --- a/assets/js/easy-ui/plugins/jquery.combo.js +++ b/assets/js/easy-ui/plugins/jquery.combo.js @@ -1,386 +1,386 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -$(function(){ -$(document).unbind(".combo").bind("mousedown.combo mousewheel.combo",function(e){ -var p=$(e.target).closest("span.combo,div.combo-p,div.menu"); -if(p.length){ -_1(p); -return; -} -$("body>div.combo-p>div.combo-panel:visible").panel("close"); -}); -}); -function _2(_3){ -var _4=$.data(_3,"combo"); -var _5=_4.options; -if(!_4.panel){ -_4.panel=$("
").appendTo("body"); -_4.panel.panel({minWidth:_5.panelMinWidth,maxWidth:_5.panelMaxWidth,minHeight:_5.panelMinHeight,maxHeight:_5.panelMaxHeight,doSize:false,closed:true,cls:"combo-p",style:{position:"absolute",zIndex:10},onOpen:function(){ -var _6=$(this).panel("options").comboTarget; -var _7=$.data(_6,"combo"); -if(_7){ -_7.options.onShowPanel.call(_6); -} -},onBeforeClose:function(){ -_1($(this).parent()); -},onClose:function(){ -var _8=$(this).panel("options").comboTarget; -var _9=$(_8).data("combo"); -if(_9){ -_9.options.onHidePanel.call(_8); -} -}}); -} -var _a=$.extend(true,[],_5.icons); -if(_5.hasDownArrow){ -_a.push({iconCls:"combo-arrow",handler:function(e){ -_f(e.data.target); -}}); -} -$(_3).addClass("combo-f").textbox($.extend({},_5,{icons:_a,onChange:function(){ -}})); -$(_3).attr("comboName",$(_3).attr("textboxName")); -_4.combo=$(_3).next(); -_4.combo.addClass("combo"); -}; -function _b(_c){ -var _d=$.data(_c,"combo"); -var _e=_d.options; -var p=_d.panel; -if(p.is(":visible")){ -p.panel("close"); -} -if(!_e.cloned){ -p.panel("destroy"); -} -$(_c).textbox("destroy"); -}; -function _f(_10){ -var _11=$.data(_10,"combo").panel; -if(_11.is(":visible")){ -var _12=_11.combo("combo"); -_13(_12); -if(_12!=_10){ -$(_10).combo("showPanel"); -} -}else{ -var p=$(_10).closest("div.combo-p").children(".combo-panel"); -$("div.combo-panel:visible").not(_11).not(p).panel("close"); -$(_10).combo("showPanel"); -} -$(_10).combo("textbox").focus(); -}; -function _1(_14){ -$(_14).find(".combo-f").each(function(){ -var p=$(this).combo("panel"); -if(p.is(":visible")){ -p.panel("close"); -} -}); -}; -function _15(e){ -var _16=e.data.target; -var _17=$.data(_16,"combo"); -var _18=_17.options; -if(!_18.editable){ -_f(_16); -}else{ -var p=$(_16).closest("div.combo-p").children(".combo-panel"); -$("div.combo-panel:visible").not(p).each(function(){ -var _19=$(this).combo("combo"); -if(_19!=_16){ -_13(_19); -} -}); -} -}; -function _1a(e){ -var _1b=e.data.target; -var t=$(_1b); -var _1c=t.data("combo"); -var _1d=t.combo("options"); -_1c.panel.panel("options").comboTarget=_1b; -switch(e.keyCode){ -case 38: -_1d.keyHandler.up.call(_1b,e); -break; -case 40: -_1d.keyHandler.down.call(_1b,e); -break; -case 37: -_1d.keyHandler.left.call(_1b,e); -break; -case 39: -_1d.keyHandler.right.call(_1b,e); -break; -case 13: -e.preventDefault(); -_1d.keyHandler.enter.call(_1b,e); -return false; -case 9: -case 27: -_13(_1b); -break; -default: -if(_1d.editable){ -if(_1c.timer){ -clearTimeout(_1c.timer); -} -_1c.timer=setTimeout(function(){ -var q=t.combo("getText"); -if(_1c.previousText!=q){ -_1c.previousText=q; -t.combo("showPanel"); -_1d.keyHandler.query.call(_1b,q,e); -t.combo("validate"); -} -},_1d.delay); -} -} -}; -function _1e(_1f){ -var _20=$.data(_1f,"combo"); -var _21=_20.combo; -var _22=_20.panel; -var _23=$(_1f).combo("options"); -var _24=_22.panel("options"); -_24.comboTarget=_1f; -if(_24.closed){ -_22.panel("panel").show().css({zIndex:($.fn.menu?$.fn.menu.defaults.zIndex++:($.fn.window?$.fn.window.defaults.zIndex++:99)),left:-999999}); -_22.panel("resize",{width:(_23.panelWidth?_23.panelWidth:_21._outerWidth()),height:_23.panelHeight}); -_22.panel("panel").hide(); -_22.panel("open"); -} -(function(){ -if(_24.comboTarget==_1f&&_22.is(":visible")){ -_22.panel("move",{left:_25(),top:_26()}); -setTimeout(arguments.callee,200); -} -})(); -function _25(){ -var _27=_21.offset().left; -if(_23.panelAlign=="right"){ -_27+=_21._outerWidth()-_22._outerWidth(); -} -if(_27+_22._outerWidth()>$(window)._outerWidth()+$(document).scrollLeft()){ -_27=$(window)._outerWidth()+$(document).scrollLeft()-_22._outerWidth(); -} -if(_27<0){ -_27=0; -} -return _27; -}; -function _26(){ -var top=_21.offset().top+_21._outerHeight(); -if(top+_22._outerHeight()>$(window)._outerHeight()+$(document).scrollTop()){ -top=_21.offset().top-_22._outerHeight(); -} -if(top<$(document).scrollTop()){ -top=_21.offset().top+_21._outerHeight(); -} -return top; -}; -}; -function _13(_28){ -var _29=$.data(_28,"combo").panel; -_29.panel("close"); -}; -function _2a(_2b,_2c){ -var _2d=$.data(_2b,"combo"); -var _2e=$(_2b).textbox("getText"); -if(_2e!=_2c){ -$(_2b).textbox("setText",_2c); -} -_2d.previousText=_2c; -}; -function _2f(_30){ -var _31=$.data(_30,"combo"); -var _32=_31.options; -var _33=$(_30).next(); -var _34=[]; -_33.find(".textbox-value").each(function(){ -_34.push($(this).val()); -}); -if(_32.multivalue){ -return _34; -}else{ -return _34.length?_34[0].split(_32.separator):_34; -} -}; -function _35(_36,_37){ -var _38=$.data(_36,"combo"); -var _39=_38.combo; -var _3a=$(_36).combo("options"); -if(!$.isArray(_37)){ -_37=_37.split(_3a.separator); -} -var _3b=_2f(_36); -_39.find(".textbox-value").remove(); -if(_37.length){ -if(_3a.multivalue){ -for(var i=0;i<_37.length;i++){ -_3c(_37[i]); -} -}else{ -_3c(_37.join(_3a.separator)); -} -} -function _3c(_3d){ -var _3e=$(_36).attr("textboxName")||""; -var _3f=$("").appendTo(_39); -_3f.attr("name",_3e); -if(_3a.disabled){ -_3f.attr("disabled","disabled"); -} -_3f.val(_3d); -}; -var _40=(function(){ -if(_3b.length!=_37.length){ -return true; -} -for(var i=0;i<_37.length;i++){ -if(_37[i]!=_3b[i]){ -return true; -} -} -return false; -})(); -if(_40){ -$(_36).val(_37.join(_3a.separator)); -if(_3a.multiple){ -_3a.onChange.call(_36,_37,_3b); -}else{ -_3a.onChange.call(_36,_37[0],_3b[0]); -} -$(_36).closest("form").trigger("_change",[_36]); -} -}; -function _41(_42){ -var _43=_2f(_42); -return _43[0]; -}; -function _44(_45,_46){ -_35(_45,[_46]); -}; -function _47(_48){ -var _49=$.data(_48,"combo").options; -var _4a=_49.onChange; -_49.onChange=function(){ -}; -if(_49.multiple){ -_35(_48,_49.value?_49.value:[]); -}else{ -_44(_48,_49.value); -} -_49.onChange=_4a; -}; -$.fn.combo=function(_4b,_4c){ -if(typeof _4b=="string"){ -var _4d=$.fn.combo.methods[_4b]; -if(_4d){ -return _4d(this,_4c); -}else{ -return this.textbox(_4b,_4c); -} -} -_4b=_4b||{}; -return this.each(function(){ -var _4e=$.data(this,"combo"); -if(_4e){ -$.extend(_4e.options,_4b); -if(_4b.value!=undefined){ -_4e.options.originalValue=_4b.value; -} -}else{ -_4e=$.data(this,"combo",{options:$.extend({},$.fn.combo.defaults,$.fn.combo.parseOptions(this),_4b),previousText:""}); -_4e.options.originalValue=_4e.options.value; -} -_2(this); -_47(this); -}); -}; -$.fn.combo.methods={options:function(jq){ -var _4f=jq.textbox("options"); -return $.extend($.data(jq[0],"combo").options,{width:_4f.width,height:_4f.height,disabled:_4f.disabled,readonly:_4f.readonly}); -},cloneFrom:function(jq,_50){ -return jq.each(function(){ -$(this).textbox("cloneFrom",_50); -$.data(this,"combo",{options:$.extend(true,{cloned:true},$(_50).combo("options")),combo:$(this).next(),panel:$(_50).combo("panel")}); -$(this).addClass("combo-f").attr("comboName",$(this).attr("textboxName")); -}); -},combo:function(jq){ -return jq.closest(".combo-panel").panel("options").comboTarget; -},panel:function(jq){ -return $.data(jq[0],"combo").panel; -},destroy:function(jq){ -return jq.each(function(){ -_b(this); -}); -},showPanel:function(jq){ -return jq.each(function(){ -_1e(this); -}); -},hidePanel:function(jq){ -return jq.each(function(){ -_13(this); -}); -},clear:function(jq){ -return jq.each(function(){ -$(this).textbox("setText",""); -var _51=$.data(this,"combo").options; -if(_51.multiple){ -$(this).combo("setValues",[]); -}else{ -$(this).combo("setValue",""); -} -}); -},reset:function(jq){ -return jq.each(function(){ -var _52=$.data(this,"combo").options; -if(_52.multiple){ -$(this).combo("setValues",_52.originalValue); -}else{ -$(this).combo("setValue",_52.originalValue); -} -}); -},setText:function(jq,_53){ -return jq.each(function(){ -_2a(this,_53); -}); -},getValues:function(jq){ -return _2f(jq[0]); -},setValues:function(jq,_54){ -return jq.each(function(){ -_35(this,_54); -}); -},getValue:function(jq){ -return _41(jq[0]); -},setValue:function(jq,_55){ -return jq.each(function(){ -_44(this,_55); -}); -}}; -$.fn.combo.parseOptions=function(_56){ -var t=$(_56); -return $.extend({},$.fn.textbox.parseOptions(_56),$.parser.parseOptions(_56,["separator","panelAlign",{panelWidth:"number",hasDownArrow:"boolean",delay:"number",reversed:"boolean",multivalue:"boolean",selectOnNavigation:"boolean"},{panelMinWidth:"number",panelMaxWidth:"number",panelMinHeight:"number",panelMaxHeight:"number"}]),{panelHeight:(t.attr("panelHeight")=="auto"?"auto":parseInt(t.attr("panelHeight"))||undefined),multiple:(t.attr("multiple")?true:undefined)}); -}; -$.fn.combo.defaults=$.extend({},$.fn.textbox.defaults,{inputEvents:{click:_15,keydown:_1a,paste:_1a,drop:_1a},panelWidth:null,panelHeight:200,panelMinWidth:null,panelMaxWidth:null,panelMinHeight:null,panelMaxHeight:null,panelAlign:"left",reversed:false,multiple:false,multivalue:true,selectOnNavigation:true,separator:",",hasDownArrow:true,delay:200,keyHandler:{up:function(e){ -},down:function(e){ -},left:function(e){ -},right:function(e){ -},enter:function(e){ -},query:function(q,e){ -}},onShowPanel:function(){ -},onHidePanel:function(){ -},onChange:function(_57,_58){ -}}); -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +$(function(){ +$(document).unbind(".combo").bind("mousedown.combo mousewheel.combo",function(e){ +var p=$(e.target).closest("span.combo,div.combo-p,div.menu"); +if(p.length){ +_1(p); +return; +} +$("body>div.combo-p>div.combo-panel:visible").panel("close"); +}); +}); +function _2(_3){ +var _4=$.data(_3,"combo"); +var _5=_4.options; +if(!_4.panel){ +_4.panel=$("
").appendTo("body"); +_4.panel.panel({minWidth:_5.panelMinWidth,maxWidth:_5.panelMaxWidth,minHeight:_5.panelMinHeight,maxHeight:_5.panelMaxHeight,doSize:false,closed:true,cls:"combo-p",style:{position:"absolute",zIndex:10},onOpen:function(){ +var _6=$(this).panel("options").comboTarget; +var _7=$.data(_6,"combo"); +if(_7){ +_7.options.onShowPanel.call(_6); +} +},onBeforeClose:function(){ +_1($(this).parent()); +},onClose:function(){ +var _8=$(this).panel("options").comboTarget; +var _9=$(_8).data("combo"); +if(_9){ +_9.options.onHidePanel.call(_8); +} +}}); +} +var _a=$.extend(true,[],_5.icons); +if(_5.hasDownArrow){ +_a.push({iconCls:"combo-arrow",handler:function(e){ +_f(e.data.target); +}}); +} +$(_3).addClass("combo-f").textbox($.extend({},_5,{icons:_a,onChange:function(){ +}})); +$(_3).attr("comboName",$(_3).attr("textboxName")); +_4.combo=$(_3).next(); +_4.combo.addClass("combo"); +}; +function _b(_c){ +var _d=$.data(_c,"combo"); +var _e=_d.options; +var p=_d.panel; +if(p.is(":visible")){ +p.panel("close"); +} +if(!_e.cloned){ +p.panel("destroy"); +} +$(_c).textbox("destroy"); +}; +function _f(_10){ +var _11=$.data(_10,"combo").panel; +if(_11.is(":visible")){ +var _12=_11.combo("combo"); +_13(_12); +if(_12!=_10){ +$(_10).combo("showPanel"); +} +}else{ +var p=$(_10).closest("div.combo-p").children(".combo-panel"); +$("div.combo-panel:visible").not(_11).not(p).panel("close"); +$(_10).combo("showPanel"); +} +$(_10).combo("textbox").focus(); +}; +function _1(_14){ +$(_14).find(".combo-f").each(function(){ +var p=$(this).combo("panel"); +if(p.is(":visible")){ +p.panel("close"); +} +}); +}; +function _15(e){ +var _16=e.data.target; +var _17=$.data(_16,"combo"); +var _18=_17.options; +if(!_18.editable){ +_f(_16); +}else{ +var p=$(_16).closest("div.combo-p").children(".combo-panel"); +$("div.combo-panel:visible").not(p).each(function(){ +var _19=$(this).combo("combo"); +if(_19!=_16){ +_13(_19); +} +}); +} +}; +function _1a(e){ +var _1b=e.data.target; +var t=$(_1b); +var _1c=t.data("combo"); +var _1d=t.combo("options"); +_1c.panel.panel("options").comboTarget=_1b; +switch(e.keyCode){ +case 38: +_1d.keyHandler.up.call(_1b,e); +break; +case 40: +_1d.keyHandler.down.call(_1b,e); +break; +case 37: +_1d.keyHandler.left.call(_1b,e); +break; +case 39: +_1d.keyHandler.right.call(_1b,e); +break; +case 13: +e.preventDefault(); +_1d.keyHandler.enter.call(_1b,e); +return false; +case 9: +case 27: +_13(_1b); +break; +default: +if(_1d.editable){ +if(_1c.timer){ +clearTimeout(_1c.timer); +} +_1c.timer=setTimeout(function(){ +var q=t.combo("getText"); +if(_1c.previousText!=q){ +_1c.previousText=q; +t.combo("showPanel"); +_1d.keyHandler.query.call(_1b,q,e); +t.combo("validate"); +} +},_1d.delay); +} +} +}; +function _1e(_1f){ +var _20=$.data(_1f,"combo"); +var _21=_20.combo; +var _22=_20.panel; +var _23=$(_1f).combo("options"); +var _24=_22.panel("options"); +_24.comboTarget=_1f; +if(_24.closed){ +_22.panel("panel").show().css({zIndex:($.fn.menu?$.fn.menu.defaults.zIndex++:($.fn.window?$.fn.window.defaults.zIndex++:99)),left:-999999}); +_22.panel("resize",{width:(_23.panelWidth?_23.panelWidth:_21._outerWidth()),height:_23.panelHeight}); +_22.panel("panel").hide(); +_22.panel("open"); +} +(function(){ +if(_24.comboTarget==_1f&&_22.is(":visible")){ +_22.panel("move",{left:_25(),top:_26()}); +setTimeout(arguments.callee,200); +} +})(); +function _25(){ +var _27=_21.offset().left; +if(_23.panelAlign=="right"){ +_27+=_21._outerWidth()-_22._outerWidth(); +} +if(_27+_22._outerWidth()>$(window)._outerWidth()+$(document).scrollLeft()){ +_27=$(window)._outerWidth()+$(document).scrollLeft()-_22._outerWidth(); +} +if(_27<0){ +_27=0; +} +return _27; +}; +function _26(){ +var top=_21.offset().top+_21._outerHeight(); +if(top+_22._outerHeight()>$(window)._outerHeight()+$(document).scrollTop()){ +top=_21.offset().top-_22._outerHeight(); +} +if(top<$(document).scrollTop()){ +top=_21.offset().top+_21._outerHeight(); +} +return top; +}; +}; +function _13(_28){ +var _29=$.data(_28,"combo").panel; +_29.panel("close"); +}; +function _2a(_2b,_2c){ +var _2d=$.data(_2b,"combo"); +var _2e=$(_2b).textbox("getText"); +if(_2e!=_2c){ +$(_2b).textbox("setText",_2c); +} +_2d.previousText=_2c; +}; +function _2f(_30){ +var _31=$.data(_30,"combo"); +var _32=_31.options; +var _33=$(_30).next(); +var _34=[]; +_33.find(".textbox-value").each(function(){ +_34.push($(this).val()); +}); +if(_32.multivalue){ +return _34; +}else{ +return _34.length?_34[0].split(_32.separator):_34; +} +}; +function _35(_36,_37){ +var _38=$.data(_36,"combo"); +var _39=_38.combo; +var _3a=$(_36).combo("options"); +if(!$.isArray(_37)){ +_37=_37.split(_3a.separator); +} +var _3b=_2f(_36); +_39.find(".textbox-value").remove(); +if(_37.length){ +if(_3a.multivalue){ +for(var i=0;i<_37.length;i++){ +_3c(_37[i]); +} +}else{ +_3c(_37.join(_3a.separator)); +} +} +function _3c(_3d){ +var _3e=$(_36).attr("textboxName")||""; +var _3f=$("").appendTo(_39); +_3f.attr("name",_3e); +if(_3a.disabled){ +_3f.attr("disabled","disabled"); +} +_3f.val(_3d); +}; +var _40=(function(){ +if(_3b.length!=_37.length){ +return true; +} +for(var i=0;i<_37.length;i++){ +if(_37[i]!=_3b[i]){ +return true; +} +} +return false; +})(); +if(_40){ +$(_36).val(_37.join(_3a.separator)); +if(_3a.multiple){ +_3a.onChange.call(_36,_37,_3b); +}else{ +_3a.onChange.call(_36,_37[0],_3b[0]); +} +$(_36).closest("form").trigger("_change",[_36]); +} +}; +function _41(_42){ +var _43=_2f(_42); +return _43[0]; +}; +function _44(_45,_46){ +_35(_45,[_46]); +}; +function _47(_48){ +var _49=$.data(_48,"combo").options; +var _4a=_49.onChange; +_49.onChange=function(){ +}; +if(_49.multiple){ +_35(_48,_49.value?_49.value:[]); +}else{ +_44(_48,_49.value); +} +_49.onChange=_4a; +}; +$.fn.combo=function(_4b,_4c){ +if(typeof _4b=="string"){ +var _4d=$.fn.combo.methods[_4b]; +if(_4d){ +return _4d(this,_4c); +}else{ +return this.textbox(_4b,_4c); +} +} +_4b=_4b||{}; +return this.each(function(){ +var _4e=$.data(this,"combo"); +if(_4e){ +$.extend(_4e.options,_4b); +if(_4b.value!=undefined){ +_4e.options.originalValue=_4b.value; +} +}else{ +_4e=$.data(this,"combo",{options:$.extend({},$.fn.combo.defaults,$.fn.combo.parseOptions(this),_4b),previousText:""}); +_4e.options.originalValue=_4e.options.value; +} +_2(this); +_47(this); +}); +}; +$.fn.combo.methods={options:function(jq){ +var _4f=jq.textbox("options"); +return $.extend($.data(jq[0],"combo").options,{width:_4f.width,height:_4f.height,disabled:_4f.disabled,readonly:_4f.readonly}); +},cloneFrom:function(jq,_50){ +return jq.each(function(){ +$(this).textbox("cloneFrom",_50); +$.data(this,"combo",{options:$.extend(true,{cloned:true},$(_50).combo("options")),combo:$(this).next(),panel:$(_50).combo("panel")}); +$(this).addClass("combo-f").attr("comboName",$(this).attr("textboxName")); +}); +},combo:function(jq){ +return jq.closest(".combo-panel").panel("options").comboTarget; +},panel:function(jq){ +return $.data(jq[0],"combo").panel; +},destroy:function(jq){ +return jq.each(function(){ +_b(this); +}); +},showPanel:function(jq){ +return jq.each(function(){ +_1e(this); +}); +},hidePanel:function(jq){ +return jq.each(function(){ +_13(this); +}); +},clear:function(jq){ +return jq.each(function(){ +$(this).textbox("setText",""); +var _51=$.data(this,"combo").options; +if(_51.multiple){ +$(this).combo("setValues",[]); +}else{ +$(this).combo("setValue",""); +} +}); +},reset:function(jq){ +return jq.each(function(){ +var _52=$.data(this,"combo").options; +if(_52.multiple){ +$(this).combo("setValues",_52.originalValue); +}else{ +$(this).combo("setValue",_52.originalValue); +} +}); +},setText:function(jq,_53){ +return jq.each(function(){ +_2a(this,_53); +}); +},getValues:function(jq){ +return _2f(jq[0]); +},setValues:function(jq,_54){ +return jq.each(function(){ +_35(this,_54); +}); +},getValue:function(jq){ +return _41(jq[0]); +},setValue:function(jq,_55){ +return jq.each(function(){ +_44(this,_55); +}); +}}; +$.fn.combo.parseOptions=function(_56){ +var t=$(_56); +return $.extend({},$.fn.textbox.parseOptions(_56),$.parser.parseOptions(_56,["separator","panelAlign",{panelWidth:"number",hasDownArrow:"boolean",delay:"number",reversed:"boolean",multivalue:"boolean",selectOnNavigation:"boolean"},{panelMinWidth:"number",panelMaxWidth:"number",panelMinHeight:"number",panelMaxHeight:"number"}]),{panelHeight:(t.attr("panelHeight")=="auto"?"auto":parseInt(t.attr("panelHeight"))||undefined),multiple:(t.attr("multiple")?true:undefined)}); +}; +$.fn.combo.defaults=$.extend({},$.fn.textbox.defaults,{inputEvents:{click:_15,keydown:_1a,paste:_1a,drop:_1a},panelWidth:null,panelHeight:200,panelMinWidth:null,panelMaxWidth:null,panelMinHeight:null,panelMaxHeight:null,panelAlign:"left",reversed:false,multiple:false,multivalue:true,selectOnNavigation:true,separator:",",hasDownArrow:true,delay:200,keyHandler:{up:function(e){ +},down:function(e){ +},left:function(e){ +},right:function(e){ +},enter:function(e){ +},query:function(q,e){ +}},onShowPanel:function(){ +},onHidePanel:function(){ +},onChange:function(_57,_58){ +}}); +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.combobox.js b/assets/js/easy-ui/plugins/jquery.combobox.js index 51105ffbd4..be5f349955 100755 --- a/assets/js/easy-ui/plugins/jquery.combobox.js +++ b/assets/js/easy-ui/plugins/jquery.combobox.js @@ -1,587 +1,587 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(_2,_3){ -var _4=$.data(_2,"combobox"); -return $.easyui.indexOfArray(_4.data,_4.options.valueField,_3); -}; -function _5(_6,_7){ -var _8=$.data(_6,"combobox").options; -var _9=$(_6).combo("panel"); -var _a=_8.finder.getEl(_6,_7); -if(_a.length){ -if(_a.position().top<=0){ -var h=_9.scrollTop()+_a.position().top; -_9.scrollTop(h); -}else{ -if(_a.position().top+_a.outerHeight()>_9.height()){ -var h=_9.scrollTop()+_a.position().top+_a.outerHeight()-_9.height(); -_9.scrollTop(h); -} -} -} -_9.triggerHandler("scroll"); -}; -function _b(_c,_d){ -var _e=$.data(_c,"combobox").options; -var _f=$(_c).combobox("panel"); -var _10=_f.children("div.combobox-item-hover"); -if(!_10.length){ -_10=_f.children("div.combobox-item-selected"); -} -_10.removeClass("combobox-item-hover"); -var _11="div.combobox-item:visible:not(.combobox-item-disabled):first"; -var _12="div.combobox-item:visible:not(.combobox-item-disabled):last"; -if(!_10.length){ -_10=_f.children(_d=="next"?_11:_12); -}else{ -if(_d=="next"){ -_10=_10.nextAll(_11); -if(!_10.length){ -_10=_f.children(_11); -} -}else{ -_10=_10.prevAll(_11); -if(!_10.length){ -_10=_f.children(_12); -} -} -} -if(_10.length){ -_10.addClass("combobox-item-hover"); -var row=_e.finder.getRow(_c,_10); -if(row){ -$(_c).combobox("scrollTo",row[_e.valueField]); -if(_e.selectOnNavigation){ -_13(_c,row[_e.valueField]); -} -} -} -}; -function _13(_14,_15,_16){ -var _17=$.data(_14,"combobox").options; -var _18=$(_14).combo("getValues"); -if($.inArray(_15+"",_18)==-1){ -if(_17.multiple){ -_18.push(_15); -}else{ -_18=[_15]; -} -_19(_14,_18,_16); -} -}; -function _1a(_1b,_1c){ -var _1d=$.data(_1b,"combobox").options; -var _1e=$(_1b).combo("getValues"); -var _1f=$.inArray(_1c+"",_1e); -if(_1f>=0){ -_1e.splice(_1f,1); -_19(_1b,_1e); -} -}; -function _19(_20,_21,_22){ -var _23=$.data(_20,"combobox").options; -var _24=$(_20).combo("panel"); -if(!$.isArray(_21)){ -_21=_21.split(_23.separator); -} -if(!_23.multiple){ -_21=_21.length?[_21[0]]:[""]; -} -var _25=$(_20).combo("getValues"); -if(_24.is(":visible")){ -_24.find(".combobox-item-selected").each(function(){ -var row=_23.finder.getRow(_20,$(this)); -if(row){ -if($.easyui.indexOfArray(_25,row[_23.valueField])==-1){ -$(this).removeClass("combobox-item-selected"); -} -} -}); -} -$.map(_25,function(v){ -if($.easyui.indexOfArray(_21,v)==-1){ -var el=_23.finder.getEl(_20,v); -if(el.hasClass("combobox-item-selected")){ -el.removeClass("combobox-item-selected"); -_23.onUnselect.call(_20,_23.finder.getRow(_20,v)); -} -} -}); -var _26=null; -var vv=[],ss=[]; -for(var i=0;i<_21.length;i++){ -var v=_21[i]; -var s=v; -var row=_23.finder.getRow(_20,v); -if(row){ -s=row[_23.textField]; -_26=row; -var el=_23.finder.getEl(_20,v); -if(!el.hasClass("combobox-item-selected")){ -el.addClass("combobox-item-selected"); -_23.onSelect.call(_20,row); -} -} -vv.push(v); -ss.push(s); -} -if(!_22){ -$(_20).combo("setText",ss.join(_23.separator)); -} -if(_23.showItemIcon){ -var tb=$(_20).combobox("textbox"); -tb.removeClass("textbox-bgicon "+_23.textboxIconCls); -if(_26&&_26.iconCls){ -tb.addClass("textbox-bgicon "+_26.iconCls); -_23.textboxIconCls=_26.iconCls; -} -} -$(_20).combo("setValues",vv); -_24.triggerHandler("scroll"); -}; -function _27(_28,_29,_2a){ -var _2b=$.data(_28,"combobox"); -var _2c=_2b.options; -_2b.data=_2c.loadFilter.call(_28,_29); -_2c.view.render.call(_2c.view,_28,$(_28).combo("panel"),_2b.data); -var vv=$(_28).combobox("getValues"); -$.easyui.forEach(_2b.data,false,function(row){ -if(row["selected"]){ -$.easyui.addArrayItem(vv,row[_2c.valueField]+""); -} -}); -if(_2c.multiple){ -_19(_28,vv,_2a); -}else{ -_19(_28,vv.length?[vv[vv.length-1]]:[],_2a); -} -_2c.onLoadSuccess.call(_28,_29); -}; -function _2d(_2e,url,_2f,_30){ -var _31=$.data(_2e,"combobox").options; -if(url){ -_31.url=url; -} -_2f=$.extend({},_31.queryParams,_2f||{}); -if(_31.onBeforeLoad.call(_2e,_2f)==false){ -return; -} -_31.loader.call(_2e,_2f,function(_32){ -_27(_2e,_32,_30); -},function(){ -_31.onLoadError.apply(this,arguments); -}); -}; -function _33(_34,q){ -var _35=$.data(_34,"combobox"); -var _36=_35.options; -var _37=$(); -var qq=_36.multiple?q.split(_36.separator):[q]; -if(_36.mode=="remote"){ -_38(qq); -_2d(_34,null,{q:q},true); -}else{ -var _39=$(_34).combo("panel"); -_39.find(".combobox-item-hover").removeClass("combobox-item-hover"); -_39.find(".combobox-item,.combobox-group").hide(); -var _3a=_35.data; -var vv=[]; -$.map(qq,function(q){ -q=$.trim(q); -var _3b=q; -var _3c=undefined; -_37=$(); -for(var i=0;i<_3a.length;i++){ -var row=_3a[i]; -if(_36.filter.call(_34,q,row)){ -var v=row[_36.valueField]; -var s=row[_36.textField]; -var g=row[_36.groupField]; -var _3d=_36.finder.getEl(_34,v).show(); -if(s.toLowerCase()==q.toLowerCase()){ -_3b=v; -if(_36.reversed){ -_37=_3d; -}else{ -_13(_34,v,true); -} -} -if(_36.groupField&&_3c!=g){ -_36.finder.getGroupEl(_34,g).show(); -_3c=g; -} -} -} -vv.push(_3b); -}); -_38(vv); -} -function _38(vv){ -if(_36.reversed){ -_37.addClass("combobox-item-hover"); -}else{ -_19(_34,_36.multiple?(q?vv:[]):vv,true); -} -}; -}; -function _3e(_3f){ -var t=$(_3f); -var _40=t.combobox("options"); -var _41=t.combobox("panel"); -var _42=_41.children("div.combobox-item-hover"); -if(_42.length){ -_42.removeClass("combobox-item-hover"); -var row=_40.finder.getRow(_3f,_42); -var _43=row[_40.valueField]; -if(_40.multiple){ -if(_42.hasClass("combobox-item-selected")){ -t.combobox("unselect",_43); -}else{ -t.combobox("select",_43); -} -}else{ -t.combobox("select",_43); -} -} -var vv=[]; -$.map(t.combobox("getValues"),function(v){ -if(_1(_3f,v)>=0){ -vv.push(v); -} -}); -t.combobox("setValues",vv); -if(!_40.multiple){ -t.combobox("hidePanel"); -} -}; -function _44(_45){ -var _46=$.data(_45,"combobox"); -var _47=_46.options; -$(_45).addClass("combobox-f"); -$(_45).combo($.extend({},_47,{onShowPanel:function(){ -$(this).combo("panel").find("div.combobox-item:hidden,div.combobox-group:hidden").show(); -_19(this,$(this).combobox("getValues"),true); -$(this).combobox("scrollTo",$(this).combobox("getValue")); -_47.onShowPanel.call(this); -}})); -var p=$(_45).combo("panel"); -p.unbind(".combobox"); -for(var _48 in _47.panelEvents){ -p.bind(_48+".combobox",{target:_45},_47.panelEvents[_48]); -} -}; -function _49(e){ -$(this).children("div.combobox-item-hover").removeClass("combobox-item-hover"); -var _4a=$(e.target).closest("div.combobox-item"); -if(!_4a.hasClass("combobox-item-disabled")){ -_4a.addClass("combobox-item-hover"); -} -e.stopPropagation(); -}; -function _4b(e){ -$(e.target).closest("div.combobox-item").removeClass("combobox-item-hover"); -e.stopPropagation(); -}; -function _4c(e){ -var _4d=$(this).panel("options").comboTarget; -if(!_4d){ -return; -} -var _4e=$(_4d).combobox("options"); -var _4f=$(e.target).closest("div.combobox-item"); -if(!_4f.length||_4f.hasClass("combobox-item-disabled")){ -return; -} -var row=_4e.finder.getRow(_4d,_4f); -if(!row){ -return; -} -if(_4e.blurTimer){ -clearTimeout(_4e.blurTimer); -_4e.blurTimer=null; -} -_4e.onClick.call(_4d,row); -var _50=row[_4e.valueField]; -if(_4e.multiple){ -if(_4f.hasClass("combobox-item-selected")){ -_1a(_4d,_50); -}else{ -_13(_4d,_50); -} -}else{ -$(_4d).combobox("setValue",_50).combobox("hidePanel"); -} -e.stopPropagation(); -}; -function _51(e){ -var _52=$(this).panel("options").comboTarget; -if(!_52){ -return; -} -var _53=$(_52).combobox("options"); -if(_53.groupPosition=="sticky"){ -var _54=$(this).children(".combobox-stick"); -if(!_54.length){ -_54=$("
").appendTo(this); -} -_54.hide(); -var _55=$(_52).data("combobox"); -$(this).children(".combobox-group:visible").each(function(){ -var g=$(this); -var _56=_53.finder.getGroup(_52,g); -var _57=_55.data[_56.startIndex+_56.count-1]; -var _58=_53.finder.getEl(_52,_57[_53.valueField]); -if(g.position().top<0&&_58.position().top>0){ -_54.show().html(g.html()); -return false; -} -}); -} -}; -$.fn.combobox=function(_59,_5a){ -if(typeof _59=="string"){ -var _5b=$.fn.combobox.methods[_59]; -if(_5b){ -return _5b(this,_5a); -}else{ -return this.combo(_59,_5a); -} -} -_59=_59||{}; -return this.each(function(){ -var _5c=$.data(this,"combobox"); -if(_5c){ -$.extend(_5c.options,_59); -}else{ -_5c=$.data(this,"combobox",{options:$.extend({},$.fn.combobox.defaults,$.fn.combobox.parseOptions(this),_59),data:[]}); -} -_44(this); -if(_5c.options.data){ -_27(this,_5c.options.data); -}else{ -var _5d=$.fn.combobox.parseData(this); -if(_5d.length){ -_27(this,_5d); -} -} -_2d(this); -}); -}; -$.fn.combobox.methods={options:function(jq){ -var _5e=jq.combo("options"); -return $.extend($.data(jq[0],"combobox").options,{width:_5e.width,height:_5e.height,originalValue:_5e.originalValue,disabled:_5e.disabled,readonly:_5e.readonly}); -},cloneFrom:function(jq,_5f){ -return jq.each(function(){ -$(this).combo("cloneFrom",_5f); -$.data(this,"combobox",$(_5f).data("combobox")); -$(this).addClass("combobox-f").attr("comboboxName",$(this).attr("textboxName")); -}); -},getData:function(jq){ -return $.data(jq[0],"combobox").data; -},setValues:function(jq,_60){ -return jq.each(function(){ -_19(this,_60); -}); -},setValue:function(jq,_61){ -return jq.each(function(){ -_19(this,$.isArray(_61)?_61:[_61]); -}); -},clear:function(jq){ -return jq.each(function(){ -_19(this,[]); -}); -},reset:function(jq){ -return jq.each(function(){ -var _62=$(this).combobox("options"); -if(_62.multiple){ -$(this).combobox("setValues",_62.originalValue); -}else{ -$(this).combobox("setValue",_62.originalValue); -} -}); -},loadData:function(jq,_63){ -return jq.each(function(){ -_27(this,_63); -}); -},reload:function(jq,url){ -return jq.each(function(){ -if(typeof url=="string"){ -_2d(this,url); -}else{ -if(url){ -var _64=$(this).combobox("options"); -_64.queryParams=url; -} -_2d(this); -} -}); -},select:function(jq,_65){ -return jq.each(function(){ -_13(this,_65); -}); -},unselect:function(jq,_66){ -return jq.each(function(){ -_1a(this,_66); -}); -},scrollTo:function(jq,_67){ -return jq.each(function(){ -_5(this,_67); -}); -}}; -$.fn.combobox.parseOptions=function(_68){ -var t=$(_68); -return $.extend({},$.fn.combo.parseOptions(_68),$.parser.parseOptions(_68,["valueField","textField","groupField","groupPosition","mode","method","url",{showItemIcon:"boolean",limitToList:"boolean"}])); -}; -$.fn.combobox.parseData=function(_69){ -var _6a=[]; -var _6b=$(_69).combobox("options"); -$(_69).children().each(function(){ -if(this.tagName.toLowerCase()=="optgroup"){ -var _6c=$(this).attr("label"); -$(this).children().each(function(){ -_6d(this,_6c); -}); -}else{ -_6d(this); -} -}); -return _6a; -function _6d(el,_6e){ -var t=$(el); -var row={}; -row[_6b.valueField]=t.attr("value")!=undefined?t.attr("value"):t.text(); -row[_6b.textField]=t.text(); -row["selected"]=t.is(":selected"); -row["disabled"]=t.is(":disabled"); -if(_6e){ -_6b.groupField=_6b.groupField||"group"; -row[_6b.groupField]=_6e; -} -_6a.push(row); -}; -}; -var _6f=0; -var _70={render:function(_71,_72,_73){ -var _74=$.data(_71,"combobox"); -var _75=_74.options; -_6f++; -_74.itemIdPrefix="_easyui_combobox_i"+_6f; -_74.groupIdPrefix="_easyui_combobox_g"+_6f; -_74.groups=[]; -var dd=[]; -var _76=undefined; -for(var i=0;i<_73.length;i++){ -var row=_73[i]; -var v=row[_75.valueField]+""; -var s=row[_75.textField]; -var g=row[_75.groupField]; -if(g){ -if(_76!=g){ -_76=g; -_74.groups.push({value:g,startIndex:i,count:1}); -dd.push("
"); -dd.push(_75.groupFormatter?_75.groupFormatter.call(_71,g):g); -dd.push("
"); -}else{ -_74.groups[_74.groups.length-1].count++; -} -}else{ -_76=undefined; -} -var cls="combobox-item"+(row.disabled?" combobox-item-disabled":"")+(g?" combobox-gitem":""); -dd.push("
"); -if(_75.showItemIcon&&row.iconCls){ -dd.push(""); -} -dd.push(_75.formatter?_75.formatter.call(_71,row):s); -dd.push("
"); -} -$(_72).html(dd.join("")); -}}; -$.fn.combobox.defaults=$.extend({},$.fn.combo.defaults,{valueField:"value",textField:"text",groupPosition:"static",groupField:null,groupFormatter:function(_77){ -return _77; -},mode:"local",method:"post",url:null,data:null,queryParams:{},showItemIcon:false,limitToList:false,view:_70,keyHandler:{up:function(e){ -_b(this,"prev"); -e.preventDefault(); -},down:function(e){ -_b(this,"next"); -e.preventDefault(); -},left:function(e){ -},right:function(e){ -},enter:function(e){ -_3e(this); -},query:function(q,e){ -_33(this,q); -}},inputEvents:$.extend({},$.fn.combo.defaults.inputEvents,{blur:function(e){ -var _78=e.data.target; -var _79=$(_78).combobox("options"); -if(_79.reversed||_79.limitToList){ -if(_79.blurTimer){ -clearTimeout(_79.blurTimer); -} -_79.blurTimer=setTimeout(function(){ -var _7a=$(_78).parent().length; -if(_7a){ -if(_79.reversed){ -$(_78).combobox("setValues",$(_78).combobox("getValues")); -}else{ -if(_79.limitToList){ -_3e(_78); -} -} -_79.blurTimer=null; -} -},50); -} -}}),panelEvents:{mouseover:_49,mouseout:_4b,click:_4c,scroll:_51},filter:function(q,row){ -var _7b=$(this).combobox("options"); -return row[_7b.textField].toLowerCase().indexOf(q.toLowerCase())>=0; -},formatter:function(row){ -var _7c=$(this).combobox("options"); -return row[_7c.textField]; -},loader:function(_7d,_7e,_7f){ -var _80=$(this).combobox("options"); -if(!_80.url){ -return false; -} -$.ajax({type:_80.method,url:_80.url,data:_7d,dataType:"json",success:function(_81){ -_7e(_81); -},error:function(){ -_7f.apply(this,arguments); -}}); -},loadFilter:function(_82){ -return _82; -},finder:{getEl:function(_83,_84){ -var _85=_1(_83,_84); -var id=$.data(_83,"combobox").itemIdPrefix+"_"+_85; -return $("#"+id); -},getGroupEl:function(_86,_87){ -var _88=$.data(_86,"combobox"); -var _89=$.easyui.indexOfArray(_88.groups,"value",_87); -var id=_88.groupIdPrefix+"_"+_89; -return $("#"+id); -},getGroup:function(_8a,p){ -var _8b=$.data(_8a,"combobox"); -var _8c=p.attr("id").substr(_8b.groupIdPrefix.length+1); -return _8b.groups[parseInt(_8c)]; -},getRow:function(_8d,p){ -var _8e=$.data(_8d,"combobox"); -var _8f=(p instanceof $)?p.attr("id").substr(_8e.itemIdPrefix.length+1):_1(_8d,p); -return _8e.data[parseInt(_8f)]; -}},onBeforeLoad:function(_90){ -},onLoadSuccess:function(_91){ -},onLoadError:function(){ -},onSelect:function(_92){ -},onUnselect:function(_93){ -},onClick:function(_94){ -}}); -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(_2,_3){ +var _4=$.data(_2,"combobox"); +return $.easyui.indexOfArray(_4.data,_4.options.valueField,_3); +}; +function _5(_6,_7){ +var _8=$.data(_6,"combobox").options; +var _9=$(_6).combo("panel"); +var _a=_8.finder.getEl(_6,_7); +if(_a.length){ +if(_a.position().top<=0){ +var h=_9.scrollTop()+_a.position().top; +_9.scrollTop(h); +}else{ +if(_a.position().top+_a.outerHeight()>_9.height()){ +var h=_9.scrollTop()+_a.position().top+_a.outerHeight()-_9.height(); +_9.scrollTop(h); +} +} +} +_9.triggerHandler("scroll"); +}; +function _b(_c,_d){ +var _e=$.data(_c,"combobox").options; +var _f=$(_c).combobox("panel"); +var _10=_f.children("div.combobox-item-hover"); +if(!_10.length){ +_10=_f.children("div.combobox-item-selected"); +} +_10.removeClass("combobox-item-hover"); +var _11="div.combobox-item:visible:not(.combobox-item-disabled):first"; +var _12="div.combobox-item:visible:not(.combobox-item-disabled):last"; +if(!_10.length){ +_10=_f.children(_d=="next"?_11:_12); +}else{ +if(_d=="next"){ +_10=_10.nextAll(_11); +if(!_10.length){ +_10=_f.children(_11); +} +}else{ +_10=_10.prevAll(_11); +if(!_10.length){ +_10=_f.children(_12); +} +} +} +if(_10.length){ +_10.addClass("combobox-item-hover"); +var row=_e.finder.getRow(_c,_10); +if(row){ +$(_c).combobox("scrollTo",row[_e.valueField]); +if(_e.selectOnNavigation){ +_13(_c,row[_e.valueField]); +} +} +} +}; +function _13(_14,_15,_16){ +var _17=$.data(_14,"combobox").options; +var _18=$(_14).combo("getValues"); +if($.inArray(_15+"",_18)==-1){ +if(_17.multiple){ +_18.push(_15); +}else{ +_18=[_15]; +} +_19(_14,_18,_16); +} +}; +function _1a(_1b,_1c){ +var _1d=$.data(_1b,"combobox").options; +var _1e=$(_1b).combo("getValues"); +var _1f=$.inArray(_1c+"",_1e); +if(_1f>=0){ +_1e.splice(_1f,1); +_19(_1b,_1e); +} +}; +function _19(_20,_21,_22){ +var _23=$.data(_20,"combobox").options; +var _24=$(_20).combo("panel"); +if(!$.isArray(_21)){ +_21=_21.split(_23.separator); +} +if(!_23.multiple){ +_21=_21.length?[_21[0]]:[""]; +} +var _25=$(_20).combo("getValues"); +if(_24.is(":visible")){ +_24.find(".combobox-item-selected").each(function(){ +var row=_23.finder.getRow(_20,$(this)); +if(row){ +if($.easyui.indexOfArray(_25,row[_23.valueField])==-1){ +$(this).removeClass("combobox-item-selected"); +} +} +}); +} +$.map(_25,function(v){ +if($.easyui.indexOfArray(_21,v)==-1){ +var el=_23.finder.getEl(_20,v); +if(el.hasClass("combobox-item-selected")){ +el.removeClass("combobox-item-selected"); +_23.onUnselect.call(_20,_23.finder.getRow(_20,v)); +} +} +}); +var _26=null; +var vv=[],ss=[]; +for(var i=0;i<_21.length;i++){ +var v=_21[i]; +var s=v; +var row=_23.finder.getRow(_20,v); +if(row){ +s=row[_23.textField]; +_26=row; +var el=_23.finder.getEl(_20,v); +if(!el.hasClass("combobox-item-selected")){ +el.addClass("combobox-item-selected"); +_23.onSelect.call(_20,row); +} +} +vv.push(v); +ss.push(s); +} +if(!_22){ +$(_20).combo("setText",ss.join(_23.separator)); +} +if(_23.showItemIcon){ +var tb=$(_20).combobox("textbox"); +tb.removeClass("textbox-bgicon "+_23.textboxIconCls); +if(_26&&_26.iconCls){ +tb.addClass("textbox-bgicon "+_26.iconCls); +_23.textboxIconCls=_26.iconCls; +} +} +$(_20).combo("setValues",vv); +_24.triggerHandler("scroll"); +}; +function _27(_28,_29,_2a){ +var _2b=$.data(_28,"combobox"); +var _2c=_2b.options; +_2b.data=_2c.loadFilter.call(_28,_29); +_2c.view.render.call(_2c.view,_28,$(_28).combo("panel"),_2b.data); +var vv=$(_28).combobox("getValues"); +$.easyui.forEach(_2b.data,false,function(row){ +if(row["selected"]){ +$.easyui.addArrayItem(vv,row[_2c.valueField]+""); +} +}); +if(_2c.multiple){ +_19(_28,vv,_2a); +}else{ +_19(_28,vv.length?[vv[vv.length-1]]:[],_2a); +} +_2c.onLoadSuccess.call(_28,_29); +}; +function _2d(_2e,url,_2f,_30){ +var _31=$.data(_2e,"combobox").options; +if(url){ +_31.url=url; +} +_2f=$.extend({},_31.queryParams,_2f||{}); +if(_31.onBeforeLoad.call(_2e,_2f)==false){ +return; +} +_31.loader.call(_2e,_2f,function(_32){ +_27(_2e,_32,_30); +},function(){ +_31.onLoadError.apply(this,arguments); +}); +}; +function _33(_34,q){ +var _35=$.data(_34,"combobox"); +var _36=_35.options; +var _37=$(); +var qq=_36.multiple?q.split(_36.separator):[q]; +if(_36.mode=="remote"){ +_38(qq); +_2d(_34,null,{q:q},true); +}else{ +var _39=$(_34).combo("panel"); +_39.find(".combobox-item-hover").removeClass("combobox-item-hover"); +_39.find(".combobox-item,.combobox-group").hide(); +var _3a=_35.data; +var vv=[]; +$.map(qq,function(q){ +q=$.trim(q); +var _3b=q; +var _3c=undefined; +_37=$(); +for(var i=0;i<_3a.length;i++){ +var row=_3a[i]; +if(_36.filter.call(_34,q,row)){ +var v=row[_36.valueField]; +var s=row[_36.textField]; +var g=row[_36.groupField]; +var _3d=_36.finder.getEl(_34,v).show(); +if(s.toLowerCase()==q.toLowerCase()){ +_3b=v; +if(_36.reversed){ +_37=_3d; +}else{ +_13(_34,v,true); +} +} +if(_36.groupField&&_3c!=g){ +_36.finder.getGroupEl(_34,g).show(); +_3c=g; +} +} +} +vv.push(_3b); +}); +_38(vv); +} +function _38(vv){ +if(_36.reversed){ +_37.addClass("combobox-item-hover"); +}else{ +_19(_34,_36.multiple?(q?vv:[]):vv,true); +} +}; +}; +function _3e(_3f){ +var t=$(_3f); +var _40=t.combobox("options"); +var _41=t.combobox("panel"); +var _42=_41.children("div.combobox-item-hover"); +if(_42.length){ +_42.removeClass("combobox-item-hover"); +var row=_40.finder.getRow(_3f,_42); +var _43=row[_40.valueField]; +if(_40.multiple){ +if(_42.hasClass("combobox-item-selected")){ +t.combobox("unselect",_43); +}else{ +t.combobox("select",_43); +} +}else{ +t.combobox("select",_43); +} +} +var vv=[]; +$.map(t.combobox("getValues"),function(v){ +if(_1(_3f,v)>=0){ +vv.push(v); +} +}); +t.combobox("setValues",vv); +if(!_40.multiple){ +t.combobox("hidePanel"); +} +}; +function _44(_45){ +var _46=$.data(_45,"combobox"); +var _47=_46.options; +$(_45).addClass("combobox-f"); +$(_45).combo($.extend({},_47,{onShowPanel:function(){ +$(this).combo("panel").find("div.combobox-item:hidden,div.combobox-group:hidden").show(); +_19(this,$(this).combobox("getValues"),true); +$(this).combobox("scrollTo",$(this).combobox("getValue")); +_47.onShowPanel.call(this); +}})); +var p=$(_45).combo("panel"); +p.unbind(".combobox"); +for(var _48 in _47.panelEvents){ +p.bind(_48+".combobox",{target:_45},_47.panelEvents[_48]); +} +}; +function _49(e){ +$(this).children("div.combobox-item-hover").removeClass("combobox-item-hover"); +var _4a=$(e.target).closest("div.combobox-item"); +if(!_4a.hasClass("combobox-item-disabled")){ +_4a.addClass("combobox-item-hover"); +} +e.stopPropagation(); +}; +function _4b(e){ +$(e.target).closest("div.combobox-item").removeClass("combobox-item-hover"); +e.stopPropagation(); +}; +function _4c(e){ +var _4d=$(this).panel("options").comboTarget; +if(!_4d){ +return; +} +var _4e=$(_4d).combobox("options"); +var _4f=$(e.target).closest("div.combobox-item"); +if(!_4f.length||_4f.hasClass("combobox-item-disabled")){ +return; +} +var row=_4e.finder.getRow(_4d,_4f); +if(!row){ +return; +} +if(_4e.blurTimer){ +clearTimeout(_4e.blurTimer); +_4e.blurTimer=null; +} +_4e.onClick.call(_4d,row); +var _50=row[_4e.valueField]; +if(_4e.multiple){ +if(_4f.hasClass("combobox-item-selected")){ +_1a(_4d,_50); +}else{ +_13(_4d,_50); +} +}else{ +$(_4d).combobox("setValue",_50).combobox("hidePanel"); +} +e.stopPropagation(); +}; +function _51(e){ +var _52=$(this).panel("options").comboTarget; +if(!_52){ +return; +} +var _53=$(_52).combobox("options"); +if(_53.groupPosition=="sticky"){ +var _54=$(this).children(".combobox-stick"); +if(!_54.length){ +_54=$("
").appendTo(this); +} +_54.hide(); +var _55=$(_52).data("combobox"); +$(this).children(".combobox-group:visible").each(function(){ +var g=$(this); +var _56=_53.finder.getGroup(_52,g); +var _57=_55.data[_56.startIndex+_56.count-1]; +var _58=_53.finder.getEl(_52,_57[_53.valueField]); +if(g.position().top<0&&_58.position().top>0){ +_54.show().html(g.html()); +return false; +} +}); +} +}; +$.fn.combobox=function(_59,_5a){ +if(typeof _59=="string"){ +var _5b=$.fn.combobox.methods[_59]; +if(_5b){ +return _5b(this,_5a); +}else{ +return this.combo(_59,_5a); +} +} +_59=_59||{}; +return this.each(function(){ +var _5c=$.data(this,"combobox"); +if(_5c){ +$.extend(_5c.options,_59); +}else{ +_5c=$.data(this,"combobox",{options:$.extend({},$.fn.combobox.defaults,$.fn.combobox.parseOptions(this),_59),data:[]}); +} +_44(this); +if(_5c.options.data){ +_27(this,_5c.options.data); +}else{ +var _5d=$.fn.combobox.parseData(this); +if(_5d.length){ +_27(this,_5d); +} +} +_2d(this); +}); +}; +$.fn.combobox.methods={options:function(jq){ +var _5e=jq.combo("options"); +return $.extend($.data(jq[0],"combobox").options,{width:_5e.width,height:_5e.height,originalValue:_5e.originalValue,disabled:_5e.disabled,readonly:_5e.readonly}); +},cloneFrom:function(jq,_5f){ +return jq.each(function(){ +$(this).combo("cloneFrom",_5f); +$.data(this,"combobox",$(_5f).data("combobox")); +$(this).addClass("combobox-f").attr("comboboxName",$(this).attr("textboxName")); +}); +},getData:function(jq){ +return $.data(jq[0],"combobox").data; +},setValues:function(jq,_60){ +return jq.each(function(){ +_19(this,_60); +}); +},setValue:function(jq,_61){ +return jq.each(function(){ +_19(this,$.isArray(_61)?_61:[_61]); +}); +},clear:function(jq){ +return jq.each(function(){ +_19(this,[]); +}); +},reset:function(jq){ +return jq.each(function(){ +var _62=$(this).combobox("options"); +if(_62.multiple){ +$(this).combobox("setValues",_62.originalValue); +}else{ +$(this).combobox("setValue",_62.originalValue); +} +}); +},loadData:function(jq,_63){ +return jq.each(function(){ +_27(this,_63); +}); +},reload:function(jq,url){ +return jq.each(function(){ +if(typeof url=="string"){ +_2d(this,url); +}else{ +if(url){ +var _64=$(this).combobox("options"); +_64.queryParams=url; +} +_2d(this); +} +}); +},select:function(jq,_65){ +return jq.each(function(){ +_13(this,_65); +}); +},unselect:function(jq,_66){ +return jq.each(function(){ +_1a(this,_66); +}); +},scrollTo:function(jq,_67){ +return jq.each(function(){ +_5(this,_67); +}); +}}; +$.fn.combobox.parseOptions=function(_68){ +var t=$(_68); +return $.extend({},$.fn.combo.parseOptions(_68),$.parser.parseOptions(_68,["valueField","textField","groupField","groupPosition","mode","method","url",{showItemIcon:"boolean",limitToList:"boolean"}])); +}; +$.fn.combobox.parseData=function(_69){ +var _6a=[]; +var _6b=$(_69).combobox("options"); +$(_69).children().each(function(){ +if(this.tagName.toLowerCase()=="optgroup"){ +var _6c=$(this).attr("label"); +$(this).children().each(function(){ +_6d(this,_6c); +}); +}else{ +_6d(this); +} +}); +return _6a; +function _6d(el,_6e){ +var t=$(el); +var row={}; +row[_6b.valueField]=t.attr("value")!=undefined?t.attr("value"):t.text(); +row[_6b.textField]=t.text(); +row["selected"]=t.is(":selected"); +row["disabled"]=t.is(":disabled"); +if(_6e){ +_6b.groupField=_6b.groupField||"group"; +row[_6b.groupField]=_6e; +} +_6a.push(row); +}; +}; +var _6f=0; +var _70={render:function(_71,_72,_73){ +var _74=$.data(_71,"combobox"); +var _75=_74.options; +_6f++; +_74.itemIdPrefix="_easyui_combobox_i"+_6f; +_74.groupIdPrefix="_easyui_combobox_g"+_6f; +_74.groups=[]; +var dd=[]; +var _76=undefined; +for(var i=0;i<_73.length;i++){ +var row=_73[i]; +var v=row[_75.valueField]+""; +var s=row[_75.textField]; +var g=row[_75.groupField]; +if(g){ +if(_76!=g){ +_76=g; +_74.groups.push({value:g,startIndex:i,count:1}); +dd.push("
"); +dd.push(_75.groupFormatter?_75.groupFormatter.call(_71,g):g); +dd.push("
"); +}else{ +_74.groups[_74.groups.length-1].count++; +} +}else{ +_76=undefined; +} +var cls="combobox-item"+(row.disabled?" combobox-item-disabled":"")+(g?" combobox-gitem":""); +dd.push("
"); +if(_75.showItemIcon&&row.iconCls){ +dd.push(""); +} +dd.push(_75.formatter?_75.formatter.call(_71,row):s); +dd.push("
"); +} +$(_72).html(dd.join("")); +}}; +$.fn.combobox.defaults=$.extend({},$.fn.combo.defaults,{valueField:"value",textField:"text",groupPosition:"static",groupField:null,groupFormatter:function(_77){ +return _77; +},mode:"local",method:"post",url:null,data:null,queryParams:{},showItemIcon:false,limitToList:false,view:_70,keyHandler:{up:function(e){ +_b(this,"prev"); +e.preventDefault(); +},down:function(e){ +_b(this,"next"); +e.preventDefault(); +},left:function(e){ +},right:function(e){ +},enter:function(e){ +_3e(this); +},query:function(q,e){ +_33(this,q); +}},inputEvents:$.extend({},$.fn.combo.defaults.inputEvents,{blur:function(e){ +var _78=e.data.target; +var _79=$(_78).combobox("options"); +if(_79.reversed||_79.limitToList){ +if(_79.blurTimer){ +clearTimeout(_79.blurTimer); +} +_79.blurTimer=setTimeout(function(){ +var _7a=$(_78).parent().length; +if(_7a){ +if(_79.reversed){ +$(_78).combobox("setValues",$(_78).combobox("getValues")); +}else{ +if(_79.limitToList){ +_3e(_78); +} +} +_79.blurTimer=null; +} +},50); +} +}}),panelEvents:{mouseover:_49,mouseout:_4b,click:_4c,scroll:_51},filter:function(q,row){ +var _7b=$(this).combobox("options"); +return row[_7b.textField].toLowerCase().indexOf(q.toLowerCase())>=0; +},formatter:function(row){ +var _7c=$(this).combobox("options"); +return row[_7c.textField]; +},loader:function(_7d,_7e,_7f){ +var _80=$(this).combobox("options"); +if(!_80.url){ +return false; +} +$.ajax({type:_80.method,url:_80.url,data:_7d,dataType:"json",success:function(_81){ +_7e(_81); +},error:function(){ +_7f.apply(this,arguments); +}}); +},loadFilter:function(_82){ +return _82; +},finder:{getEl:function(_83,_84){ +var _85=_1(_83,_84); +var id=$.data(_83,"combobox").itemIdPrefix+"_"+_85; +return $("#"+id); +},getGroupEl:function(_86,_87){ +var _88=$.data(_86,"combobox"); +var _89=$.easyui.indexOfArray(_88.groups,"value",_87); +var id=_88.groupIdPrefix+"_"+_89; +return $("#"+id); +},getGroup:function(_8a,p){ +var _8b=$.data(_8a,"combobox"); +var _8c=p.attr("id").substr(_8b.groupIdPrefix.length+1); +return _8b.groups[parseInt(_8c)]; +},getRow:function(_8d,p){ +var _8e=$.data(_8d,"combobox"); +var _8f=(p instanceof $)?p.attr("id").substr(_8e.itemIdPrefix.length+1):_1(_8d,p); +return _8e.data[parseInt(_8f)]; +}},onBeforeLoad:function(_90){ +},onLoadSuccess:function(_91){ +},onLoadError:function(){ +},onSelect:function(_92){ +},onUnselect:function(_93){ +},onClick:function(_94){ +}}); +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.combogrid.js b/assets/js/easy-ui/plugins/jquery.combogrid.js index bd03ad4394..47c4ca7ef5 100755 --- a/assets/js/easy-ui/plugins/jquery.combogrid.js +++ b/assets/js/easy-ui/plugins/jquery.combogrid.js @@ -1,346 +1,346 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(_2){ -var _3=$.data(_2,"combogrid"); -var _4=_3.options; -var _5=_3.grid; -$(_2).addClass("combogrid-f").combo($.extend({},_4,{onShowPanel:function(){ -_20(this,$(this).combogrid("getValues"),true); -var p=$(this).combogrid("panel"); -var _6=p.outerHeight()-p.height(); -var _7=p._size("minHeight"); -var _8=p._size("maxHeight"); -var dg=$(this).combogrid("grid"); -dg.datagrid("resize",{width:"100%",height:(isNaN(parseInt(_4.panelHeight))?"auto":"100%"),minHeight:(_7?_7-_6:""),maxHeight:(_8?_8-_6:"")}); -var _9=dg.datagrid("getSelected"); -if(_9){ -dg.datagrid("scrollTo",dg.datagrid("getRowIndex",_9)); -} -_4.onShowPanel.call(this); -}})); -var _a=$(_2).combo("panel"); -if(!_5){ -_5=$("
").appendTo(_a); -_3.grid=_5; -} -_5.datagrid($.extend({},_4,{border:false,singleSelect:(!_4.multiple),onLoadSuccess:_b,onClickRow:_c,onSelect:_d("onSelect"),onUnselect:_d("onUnselect"),onSelectAll:_d("onSelectAll"),onUnselectAll:_d("onUnselectAll")})); -function _e(dg){ -return $(dg).closest(".combo-panel").panel("options").comboTarget||_2; -}; -function _b(_f){ -var _10=_e(this); -var _11=$(_10).data("combogrid"); -var _12=_11.options; -var _13=$(_10).combo("getValues"); -_20(_10,_13,_11.remainText); -_12.onLoadSuccess.call(this,_f); -}; -function _c(_14,row){ -var _15=_e(this); -var _16=$(_15).data("combogrid"); -var _17=_16.options; -_16.remainText=false; -_18.call(this); -if(!_17.multiple){ -$(_15).combo("hidePanel"); -} -_17.onClickRow.call(this,_14,row); -}; -function _d(_19){ -return function(_1a,row){ -var _1b=_e(this); -var _1c=$(_1b).combogrid("options"); -if(_19=="onUnselectAll"){ -if(_1c.multiple){ -_18.call(this); -} -}else{ -_18.call(this); -} -_1c[_19].call(this,_1a,row); -}; -}; -function _18(){ -var dg=$(this); -var _1d=_e(dg); -var _1e=$(_1d).data("combogrid"); -var _1f=_1e.options; -var vv=$.map(dg.datagrid("getSelections"),function(row){ -return row[_1f.idField]; -}); -vv=vv.concat(_1f.unselectedValues); -_20(_1d,vv,_1e.remainText); -}; -}; -function nav(_21,dir){ -var _22=$.data(_21,"combogrid"); -var _23=_22.options; -var _24=_22.grid; -var _25=_24.datagrid("getRows").length; -if(!_25){ -return; -} -var tr=_23.finder.getTr(_24[0],null,"highlight"); -if(!tr.length){ -tr=_23.finder.getTr(_24[0],null,"selected"); -} -var _26; -if(!tr.length){ -_26=(dir=="next"?0:_25-1); -}else{ -var _26=parseInt(tr.attr("datagrid-row-index")); -_26+=(dir=="next"?1:-1); -if(_26<0){ -_26=_25-1; -} -if(_26>=_25){ -_26=0; -} -} -_24.datagrid("highlightRow",_26); -if(_23.selectOnNavigation){ -_22.remainText=false; -_24.datagrid("selectRow",_26); -} -}; -function _20(_27,_28,_29){ -var _2a=$.data(_27,"combogrid"); -var _2b=_2a.options; -var _2c=_2a.grid; -var _2d=$(_27).combo("getValues"); -var _2e=$(_27).combo("options"); -var _2f=_2e.onChange; -_2e.onChange=function(){ -}; -var _30=_2c.datagrid("options"); -var _31=_30.onSelect; -var _32=_30.onUnselectAll; -_30.onSelect=_30.onUnselectAll=function(){ -}; -if(!$.isArray(_28)){ -_28=_28.split(_2b.separator); -} -if(!_2b.multiple){ -_28=_28.length?[_28[0]]:[""]; -} -var vv=$.map(_28,function(_33){ -return String(_33); -}); -vv=$.grep(vv,function(v,_34){ -return _34===$.inArray(v,vv); -}); -var _35=$.grep(_2c.datagrid("getSelections"),function(row,_36){ -return $.inArray(String(row[_2b.idField]),vv)>=0; -}); -_2c.datagrid("clearSelections"); -_2c.data("datagrid").selectedRows=_35; -var ss=[]; -_2b.unselectedValues=[]; -$.map(vv,function(v){ -var _37=_2c.datagrid("getRowIndex",v); -if(_37>=0){ -_2c.datagrid("selectRow",_37); -}else{ -_2b.unselectedValues.push(v); -} -ss.push(_38(v,_2c.datagrid("getRows"))||_38(v,_35)||_38(v,_2b.mappingRows)||v); -}); -$(_27).combo("setValues",_2d); -_2e.onChange=_2f; -_30.onSelect=_31; -_30.onUnselectAll=_32; -if(!_29){ -var s=ss.join(_2b.separator); -if($(_27).combo("getText")!=s){ -$(_27).combo("setText",s); -} -} -$(_27).combo("setValues",_28); -function _38(_39,a){ -var _3a=$.easyui.getArrayItem(a,_2b.idField,_39); -return _3a?_3a[_2b.textField]:undefined; -}; -}; -function _3b(_3c,q){ -var _3d=$.data(_3c,"combogrid"); -var _3e=_3d.options; -var _3f=_3d.grid; -_3d.remainText=true; -var qq=_3e.multiple?q.split(_3e.separator):[q]; -qq=$.grep(qq,function(q){ -return $.trim(q)!=""; -}); -if(_3e.mode=="remote"){ -_40(qq); -_3f.datagrid("load",$.extend({},_3e.queryParams,{q:q})); -}else{ -_3f.datagrid("highlightRow",-1); -var _41=_3f.datagrid("getRows"); -var vv=[]; -$.map(qq,function(q){ -q=$.trim(q); -var _42=q; -_43(_3e.mappingRows,q); -_43(_3f.datagrid("getSelections"),q); -var _44=_43(_41,q); -if(_44>=0){ -if(_3e.reversed){ -_3f.datagrid("highlightRow",_44); -} -}else{ -$.map(_41,function(row,i){ -if(_3e.filter.call(_3c,q,row)){ -_3f.datagrid("highlightRow",i); -} -}); -} -}); -_40(vv); -} -function _43(_45,q){ -for(var i=0;i<_45.length;i++){ -var row=_45[i]; -if((row[_3e.textField]||"").toLowerCase()==q.toLowerCase()){ -vv.push(row[_3e.idField]); -return i; -} -} -return -1; -}; -function _40(vv){ -if(!_3e.reversed){ -_20(_3c,vv,true); -} -}; -}; -function _46(_47){ -var _48=$.data(_47,"combogrid"); -var _49=_48.options; -var _4a=_48.grid; -var tr=_49.finder.getTr(_4a[0],null,"highlight"); -_48.remainText=false; -if(tr.length){ -var _4b=parseInt(tr.attr("datagrid-row-index")); -if(_49.multiple){ -if(tr.hasClass("datagrid-row-selected")){ -_4a.datagrid("unselectRow",_4b); -}else{ -_4a.datagrid("selectRow",_4b); -} -}else{ -_4a.datagrid("selectRow",_4b); -} -} -var vv=[]; -$.map(_4a.datagrid("getSelections"),function(row){ -vv.push(row[_49.idField]); -}); -$.map(_49.unselectedValues,function(v){ -if($.easyui.indexOfArray(_49.mappingRows,_49.idField,v)>=0){ -$.easyui.addArrayItem(vv,v); -} -}); -$(_47).combogrid("setValues",vv); -if(!_49.multiple){ -$(_47).combogrid("hidePanel"); -} -}; -$.fn.combogrid=function(_4c,_4d){ -if(typeof _4c=="string"){ -var _4e=$.fn.combogrid.methods[_4c]; -if(_4e){ -return _4e(this,_4d); -}else{ -return this.combo(_4c,_4d); -} -} -_4c=_4c||{}; -return this.each(function(){ -var _4f=$.data(this,"combogrid"); -if(_4f){ -$.extend(_4f.options,_4c); -}else{ -_4f=$.data(this,"combogrid",{options:$.extend({},$.fn.combogrid.defaults,$.fn.combogrid.parseOptions(this),_4c)}); -} -_1(this); -}); -}; -$.fn.combogrid.methods={options:function(jq){ -var _50=jq.combo("options"); -return $.extend($.data(jq[0],"combogrid").options,{width:_50.width,height:_50.height,originalValue:_50.originalValue,disabled:_50.disabled,readonly:_50.readonly}); -},cloneFrom:function(jq,_51){ -return jq.each(function(){ -$(this).combo("cloneFrom",_51); -$.data(this,"combogrid",{options:$.extend(true,{cloned:true},$(_51).combogrid("options")),combo:$(this).next(),panel:$(_51).combo("panel"),grid:$(_51).combogrid("grid")}); -}); -},grid:function(jq){ -return $.data(jq[0],"combogrid").grid; -},setValues:function(jq,_52){ -return jq.each(function(){ -var _53=$(this).combogrid("options"); -if($.isArray(_52)){ -_52=$.map(_52,function(_54){ -if(_54&&typeof _54=="object"){ -$.easyui.addArrayItem(_53.mappingRows,_53.idField,_54); -return _54[_53.idField]; -}else{ -return _54; -} -}); -} -_20(this,_52); -}); -},setValue:function(jq,_55){ -return jq.each(function(){ -$(this).combogrid("setValues",$.isArray(_55)?_55:[_55]); -}); -},clear:function(jq){ -return jq.each(function(){ -$(this).combogrid("setValues",[]); -}); -},reset:function(jq){ -return jq.each(function(){ -var _56=$(this).combogrid("options"); -if(_56.multiple){ -$(this).combogrid("setValues",_56.originalValue); -}else{ -$(this).combogrid("setValue",_56.originalValue); -} -}); -}}; -$.fn.combogrid.parseOptions=function(_57){ -var t=$(_57); -return $.extend({},$.fn.combo.parseOptions(_57),$.fn.datagrid.parseOptions(_57),$.parser.parseOptions(_57,["idField","textField","mode"])); -}; -$.fn.combogrid.defaults=$.extend({},$.fn.combo.defaults,$.fn.datagrid.defaults,{loadMsg:null,idField:null,textField:null,unselectedValues:[],mappingRows:[],mode:"local",keyHandler:{up:function(e){ -nav(this,"prev"); -e.preventDefault(); -},down:function(e){ -nav(this,"next"); -e.preventDefault(); -},left:function(e){ -},right:function(e){ -},enter:function(e){ -_46(this); -},query:function(q,e){ -_3b(this,q); -}},inputEvents:$.extend({},$.fn.combo.defaults.inputEvents,{blur:function(e){ -var _58=e.data.target; -var _59=$(_58).combogrid("options"); -if(_59.reversed){ -$(_58).combogrid("setValues",$(_58).combogrid("getValues")); -} -}}),filter:function(q,row){ -var _5a=$(this).combogrid("options"); -return (row[_5a.textField]||"").toLowerCase().indexOf(q.toLowerCase())>=0; -}}); -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(_2){ +var _3=$.data(_2,"combogrid"); +var _4=_3.options; +var _5=_3.grid; +$(_2).addClass("combogrid-f").combo($.extend({},_4,{onShowPanel:function(){ +_20(this,$(this).combogrid("getValues"),true); +var p=$(this).combogrid("panel"); +var _6=p.outerHeight()-p.height(); +var _7=p._size("minHeight"); +var _8=p._size("maxHeight"); +var dg=$(this).combogrid("grid"); +dg.datagrid("resize",{width:"100%",height:(isNaN(parseInt(_4.panelHeight))?"auto":"100%"),minHeight:(_7?_7-_6:""),maxHeight:(_8?_8-_6:"")}); +var _9=dg.datagrid("getSelected"); +if(_9){ +dg.datagrid("scrollTo",dg.datagrid("getRowIndex",_9)); +} +_4.onShowPanel.call(this); +}})); +var _a=$(_2).combo("panel"); +if(!_5){ +_5=$("
").appendTo(_a); +_3.grid=_5; +} +_5.datagrid($.extend({},_4,{border:false,singleSelect:(!_4.multiple),onLoadSuccess:_b,onClickRow:_c,onSelect:_d("onSelect"),onUnselect:_d("onUnselect"),onSelectAll:_d("onSelectAll"),onUnselectAll:_d("onUnselectAll")})); +function _e(dg){ +return $(dg).closest(".combo-panel").panel("options").comboTarget||_2; +}; +function _b(_f){ +var _10=_e(this); +var _11=$(_10).data("combogrid"); +var _12=_11.options; +var _13=$(_10).combo("getValues"); +_20(_10,_13,_11.remainText); +_12.onLoadSuccess.call(this,_f); +}; +function _c(_14,row){ +var _15=_e(this); +var _16=$(_15).data("combogrid"); +var _17=_16.options; +_16.remainText=false; +_18.call(this); +if(!_17.multiple){ +$(_15).combo("hidePanel"); +} +_17.onClickRow.call(this,_14,row); +}; +function _d(_19){ +return function(_1a,row){ +var _1b=_e(this); +var _1c=$(_1b).combogrid("options"); +if(_19=="onUnselectAll"){ +if(_1c.multiple){ +_18.call(this); +} +}else{ +_18.call(this); +} +_1c[_19].call(this,_1a,row); +}; +}; +function _18(){ +var dg=$(this); +var _1d=_e(dg); +var _1e=$(_1d).data("combogrid"); +var _1f=_1e.options; +var vv=$.map(dg.datagrid("getSelections"),function(row){ +return row[_1f.idField]; +}); +vv=vv.concat(_1f.unselectedValues); +_20(_1d,vv,_1e.remainText); +}; +}; +function nav(_21,dir){ +var _22=$.data(_21,"combogrid"); +var _23=_22.options; +var _24=_22.grid; +var _25=_24.datagrid("getRows").length; +if(!_25){ +return; +} +var tr=_23.finder.getTr(_24[0],null,"highlight"); +if(!tr.length){ +tr=_23.finder.getTr(_24[0],null,"selected"); +} +var _26; +if(!tr.length){ +_26=(dir=="next"?0:_25-1); +}else{ +var _26=parseInt(tr.attr("datagrid-row-index")); +_26+=(dir=="next"?1:-1); +if(_26<0){ +_26=_25-1; +} +if(_26>=_25){ +_26=0; +} +} +_24.datagrid("highlightRow",_26); +if(_23.selectOnNavigation){ +_22.remainText=false; +_24.datagrid("selectRow",_26); +} +}; +function _20(_27,_28,_29){ +var _2a=$.data(_27,"combogrid"); +var _2b=_2a.options; +var _2c=_2a.grid; +var _2d=$(_27).combo("getValues"); +var _2e=$(_27).combo("options"); +var _2f=_2e.onChange; +_2e.onChange=function(){ +}; +var _30=_2c.datagrid("options"); +var _31=_30.onSelect; +var _32=_30.onUnselectAll; +_30.onSelect=_30.onUnselectAll=function(){ +}; +if(!$.isArray(_28)){ +_28=_28.split(_2b.separator); +} +if(!_2b.multiple){ +_28=_28.length?[_28[0]]:[""]; +} +var vv=$.map(_28,function(_33){ +return String(_33); +}); +vv=$.grep(vv,function(v,_34){ +return _34===$.inArray(v,vv); +}); +var _35=$.grep(_2c.datagrid("getSelections"),function(row,_36){ +return $.inArray(String(row[_2b.idField]),vv)>=0; +}); +_2c.datagrid("clearSelections"); +_2c.data("datagrid").selectedRows=_35; +var ss=[]; +_2b.unselectedValues=[]; +$.map(vv,function(v){ +var _37=_2c.datagrid("getRowIndex",v); +if(_37>=0){ +_2c.datagrid("selectRow",_37); +}else{ +_2b.unselectedValues.push(v); +} +ss.push(_38(v,_2c.datagrid("getRows"))||_38(v,_35)||_38(v,_2b.mappingRows)||v); +}); +$(_27).combo("setValues",_2d); +_2e.onChange=_2f; +_30.onSelect=_31; +_30.onUnselectAll=_32; +if(!_29){ +var s=ss.join(_2b.separator); +if($(_27).combo("getText")!=s){ +$(_27).combo("setText",s); +} +} +$(_27).combo("setValues",_28); +function _38(_39,a){ +var _3a=$.easyui.getArrayItem(a,_2b.idField,_39); +return _3a?_3a[_2b.textField]:undefined; +}; +}; +function _3b(_3c,q){ +var _3d=$.data(_3c,"combogrid"); +var _3e=_3d.options; +var _3f=_3d.grid; +_3d.remainText=true; +var qq=_3e.multiple?q.split(_3e.separator):[q]; +qq=$.grep(qq,function(q){ +return $.trim(q)!=""; +}); +if(_3e.mode=="remote"){ +_40(qq); +_3f.datagrid("load",$.extend({},_3e.queryParams,{q:q})); +}else{ +_3f.datagrid("highlightRow",-1); +var _41=_3f.datagrid("getRows"); +var vv=[]; +$.map(qq,function(q){ +q=$.trim(q); +var _42=q; +_43(_3e.mappingRows,q); +_43(_3f.datagrid("getSelections"),q); +var _44=_43(_41,q); +if(_44>=0){ +if(_3e.reversed){ +_3f.datagrid("highlightRow",_44); +} +}else{ +$.map(_41,function(row,i){ +if(_3e.filter.call(_3c,q,row)){ +_3f.datagrid("highlightRow",i); +} +}); +} +}); +_40(vv); +} +function _43(_45,q){ +for(var i=0;i<_45.length;i++){ +var row=_45[i]; +if((row[_3e.textField]||"").toLowerCase()==q.toLowerCase()){ +vv.push(row[_3e.idField]); +return i; +} +} +return -1; +}; +function _40(vv){ +if(!_3e.reversed){ +_20(_3c,vv,true); +} +}; +}; +function _46(_47){ +var _48=$.data(_47,"combogrid"); +var _49=_48.options; +var _4a=_48.grid; +var tr=_49.finder.getTr(_4a[0],null,"highlight"); +_48.remainText=false; +if(tr.length){ +var _4b=parseInt(tr.attr("datagrid-row-index")); +if(_49.multiple){ +if(tr.hasClass("datagrid-row-selected")){ +_4a.datagrid("unselectRow",_4b); +}else{ +_4a.datagrid("selectRow",_4b); +} +}else{ +_4a.datagrid("selectRow",_4b); +} +} +var vv=[]; +$.map(_4a.datagrid("getSelections"),function(row){ +vv.push(row[_49.idField]); +}); +$.map(_49.unselectedValues,function(v){ +if($.easyui.indexOfArray(_49.mappingRows,_49.idField,v)>=0){ +$.easyui.addArrayItem(vv,v); +} +}); +$(_47).combogrid("setValues",vv); +if(!_49.multiple){ +$(_47).combogrid("hidePanel"); +} +}; +$.fn.combogrid=function(_4c,_4d){ +if(typeof _4c=="string"){ +var _4e=$.fn.combogrid.methods[_4c]; +if(_4e){ +return _4e(this,_4d); +}else{ +return this.combo(_4c,_4d); +} +} +_4c=_4c||{}; +return this.each(function(){ +var _4f=$.data(this,"combogrid"); +if(_4f){ +$.extend(_4f.options,_4c); +}else{ +_4f=$.data(this,"combogrid",{options:$.extend({},$.fn.combogrid.defaults,$.fn.combogrid.parseOptions(this),_4c)}); +} +_1(this); +}); +}; +$.fn.combogrid.methods={options:function(jq){ +var _50=jq.combo("options"); +return $.extend($.data(jq[0],"combogrid").options,{width:_50.width,height:_50.height,originalValue:_50.originalValue,disabled:_50.disabled,readonly:_50.readonly}); +},cloneFrom:function(jq,_51){ +return jq.each(function(){ +$(this).combo("cloneFrom",_51); +$.data(this,"combogrid",{options:$.extend(true,{cloned:true},$(_51).combogrid("options")),combo:$(this).next(),panel:$(_51).combo("panel"),grid:$(_51).combogrid("grid")}); +}); +},grid:function(jq){ +return $.data(jq[0],"combogrid").grid; +},setValues:function(jq,_52){ +return jq.each(function(){ +var _53=$(this).combogrid("options"); +if($.isArray(_52)){ +_52=$.map(_52,function(_54){ +if(_54&&typeof _54=="object"){ +$.easyui.addArrayItem(_53.mappingRows,_53.idField,_54); +return _54[_53.idField]; +}else{ +return _54; +} +}); +} +_20(this,_52); +}); +},setValue:function(jq,_55){ +return jq.each(function(){ +$(this).combogrid("setValues",$.isArray(_55)?_55:[_55]); +}); +},clear:function(jq){ +return jq.each(function(){ +$(this).combogrid("setValues",[]); +}); +},reset:function(jq){ +return jq.each(function(){ +var _56=$(this).combogrid("options"); +if(_56.multiple){ +$(this).combogrid("setValues",_56.originalValue); +}else{ +$(this).combogrid("setValue",_56.originalValue); +} +}); +}}; +$.fn.combogrid.parseOptions=function(_57){ +var t=$(_57); +return $.extend({},$.fn.combo.parseOptions(_57),$.fn.datagrid.parseOptions(_57),$.parser.parseOptions(_57,["idField","textField","mode"])); +}; +$.fn.combogrid.defaults=$.extend({},$.fn.combo.defaults,$.fn.datagrid.defaults,{loadMsg:null,idField:null,textField:null,unselectedValues:[],mappingRows:[],mode:"local",keyHandler:{up:function(e){ +nav(this,"prev"); +e.preventDefault(); +},down:function(e){ +nav(this,"next"); +e.preventDefault(); +},left:function(e){ +},right:function(e){ +},enter:function(e){ +_46(this); +},query:function(q,e){ +_3b(this,q); +}},inputEvents:$.extend({},$.fn.combo.defaults.inputEvents,{blur:function(e){ +var _58=e.data.target; +var _59=$(_58).combogrid("options"); +if(_59.reversed){ +$(_58).combogrid("setValues",$(_58).combogrid("getValues")); +} +}}),filter:function(q,row){ +var _5a=$(this).combogrid("options"); +return (row[_5a.textField]||"").toLowerCase().indexOf(q.toLowerCase())>=0; +}}); +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.combotree.js b/assets/js/easy-ui/plugins/jquery.combotree.js index 990d856d8e..710822261c 100755 --- a/assets/js/easy-ui/plugins/jquery.combotree.js +++ b/assets/js/easy-ui/plugins/jquery.combotree.js @@ -1,237 +1,237 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(_2){ -var _3=$.data(_2,"combotree"); -var _4=_3.options; -var _5=_3.tree; -$(_2).addClass("combotree-f"); -$(_2).combo($.extend({},_4,{onShowPanel:function(){ -if(_4.editable){ -_5.tree("doFilter",""); -} -_4.onShowPanel.call(this); -}})); -var _6=$(_2).combo("panel"); -if(!_5){ -_5=$("").appendTo(_6); -_3.tree=_5; -} -_5.tree($.extend({},_4,{checkbox:_4.multiple,onLoadSuccess:function(_7,_8){ -var _9=$(_2).combotree("getValues"); -if(_4.multiple){ -$.map(_5.tree("getChecked"),function(_a){ -$.easyui.addArrayItem(_9,_a.id); -}); -} -_15(_2,_9,_3.remainText); -_4.onLoadSuccess.call(this,_7,_8); -},onClick:function(_b){ -if(_4.multiple){ -$(this).tree(_b.checked?"uncheck":"check",_b.target); -}else{ -$(_2).combo("hidePanel"); -} -_3.remainText=false; -_e(_2); -_4.onClick.call(this,_b); -},onCheck:function(_c,_d){ -_3.remainText=false; -_e(_2); -_4.onCheck.call(this,_c,_d); -}})); -}; -function _e(_f){ -var _10=$.data(_f,"combotree"); -var _11=_10.options; -var _12=_10.tree; -var vv=[]; -if(_11.multiple){ -vv=$.map(_12.tree("getChecked"),function(_13){ -return _13.id; -}); -}else{ -var _14=_12.tree("getSelected"); -if(_14){ -vv.push(_14.id); -} -} -vv=vv.concat(_11.unselectedValues); -_15(_f,vv,_10.remainText); -}; -function _15(_16,_17,_18){ -var _19=$.data(_16,"combotree"); -var _1a=_19.options; -var _1b=_19.tree; -var _1c=_1b.tree("options"); -var _1d=_1c.onBeforeCheck; -var _1e=_1c.onCheck; -var _1f=_1c.onSelect; -_1c.onBeforeCheck=_1c.onCheck=_1c.onSelect=function(){ -}; -if(!$.isArray(_17)){ -_17=_17.split(_1a.separator); -} -if(!_1a.multiple){ -_17=_17.length?[_17[0]]:[""]; -} -var vv=$.map(_17,function(_20){ -return String(_20); -}); -_1b.find("div.tree-node-selected").removeClass("tree-node-selected"); -$.map(_1b.tree("getChecked"),function(_21){ -if($.inArray(String(_21.id),vv)==-1){ -_1b.tree("uncheck",_21.target); -} -}); -var ss=[]; -_1a.unselectedValues=[]; -$.map(vv,function(v){ -var _22=_1b.tree("find",v); -if(_22){ -_1b.tree("check",_22.target).tree("select",_22.target); -ss.push(_23(_22)); -}else{ -ss.push(_24(v,_1a.mappingRows)||v); -_1a.unselectedValues.push(v); -} -}); -if(_1a.multiple){ -$.map(_1b.tree("getChecked"),function(_25){ -var id=String(_25.id); -if($.inArray(id,vv)==-1){ -vv.push(id); -ss.push(_23(_25)); -} -}); -} -_1c.onBeforeCheck=_1d; -_1c.onCheck=_1e; -_1c.onSelect=_1f; -if(!_18){ -var s=ss.join(_1a.separator); -if($(_16).combo("getText")!=s){ -$(_16).combo("setText",s); -} -} -$(_16).combo("setValues",vv); -function _24(_26,a){ -var _27=$.easyui.getArrayItem(a,"id",_26); -return _27?_23(_27):undefined; -}; -function _23(_28){ -return _28[_1a.textField||""]||_28.text; -}; -}; -function _29(_2a,q){ -var _2b=$.data(_2a,"combotree"); -var _2c=_2b.options; -var _2d=_2b.tree; -_2b.remainText=true; -_2d.tree("doFilter",_2c.multiple?q.split(_2c.separator):q); -}; -function _2e(_2f){ -var _30=$.data(_2f,"combotree"); -_30.remainText=false; -$(_2f).combotree("setValues",$(_2f).combotree("getValues")); -$(_2f).combotree("hidePanel"); -}; -$.fn.combotree=function(_31,_32){ -if(typeof _31=="string"){ -var _33=$.fn.combotree.methods[_31]; -if(_33){ -return _33(this,_32); -}else{ -return this.combo(_31,_32); -} -} -_31=_31||{}; -return this.each(function(){ -var _34=$.data(this,"combotree"); -if(_34){ -$.extend(_34.options,_31); -}else{ -$.data(this,"combotree",{options:$.extend({},$.fn.combotree.defaults,$.fn.combotree.parseOptions(this),_31)}); -} -_1(this); -}); -}; -$.fn.combotree.methods={options:function(jq){ -var _35=jq.combo("options"); -return $.extend($.data(jq[0],"combotree").options,{width:_35.width,height:_35.height,originalValue:_35.originalValue,disabled:_35.disabled,readonly:_35.readonly}); -},clone:function(jq,_36){ -var t=jq.combo("clone",_36); -t.data("combotree",{options:$.extend(true,{},jq.combotree("options")),tree:jq.combotree("tree")}); -return t; -},tree:function(jq){ -return $.data(jq[0],"combotree").tree; -},loadData:function(jq,_37){ -return jq.each(function(){ -var _38=$.data(this,"combotree").options; -_38.data=_37; -var _39=$.data(this,"combotree").tree; -_39.tree("loadData",_37); -}); -},reload:function(jq,url){ -return jq.each(function(){ -var _3a=$.data(this,"combotree").options; -var _3b=$.data(this,"combotree").tree; -if(url){ -_3a.url=url; -} -_3b.tree({url:_3a.url}); -}); -},setValues:function(jq,_3c){ -return jq.each(function(){ -var _3d=$(this).combotree("options"); -if($.isArray(_3c)){ -_3c=$.map(_3c,function(_3e){ -if(_3e&&typeof _3e=="object"){ -$.easyui.addArrayItem(_3d.mappingRows,"id",_3e); -return _3e.id; -}else{ -return _3e; -} -}); -} -_15(this,_3c); -}); -},setValue:function(jq,_3f){ -return jq.each(function(){ -$(this).combotree("setValues",$.isArray(_3f)?_3f:[_3f]); -}); -},clear:function(jq){ -return jq.each(function(){ -$(this).combotree("setValues",[]); -}); -},reset:function(jq){ -return jq.each(function(){ -var _40=$(this).combotree("options"); -if(_40.multiple){ -$(this).combotree("setValues",_40.originalValue); -}else{ -$(this).combotree("setValue",_40.originalValue); -} -}); -}}; -$.fn.combotree.parseOptions=function(_41){ -return $.extend({},$.fn.combo.parseOptions(_41),$.fn.tree.parseOptions(_41)); -}; -$.fn.combotree.defaults=$.extend({},$.fn.combo.defaults,$.fn.tree.defaults,{editable:false,textField:null,unselectedValues:[],mappingRows:[],keyHandler:{up:function(e){ -},down:function(e){ -},left:function(e){ -},right:function(e){ -},enter:function(e){ -_2e(this); -},query:function(q,e){ -_29(this,q); -}}}); -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(_2){ +var _3=$.data(_2,"combotree"); +var _4=_3.options; +var _5=_3.tree; +$(_2).addClass("combotree-f"); +$(_2).combo($.extend({},_4,{onShowPanel:function(){ +if(_4.editable){ +_5.tree("doFilter",""); +} +_4.onShowPanel.call(this); +}})); +var _6=$(_2).combo("panel"); +if(!_5){ +_5=$("").appendTo(_6); +_3.tree=_5; +} +_5.tree($.extend({},_4,{checkbox:_4.multiple,onLoadSuccess:function(_7,_8){ +var _9=$(_2).combotree("getValues"); +if(_4.multiple){ +$.map(_5.tree("getChecked"),function(_a){ +$.easyui.addArrayItem(_9,_a.id); +}); +} +_15(_2,_9,_3.remainText); +_4.onLoadSuccess.call(this,_7,_8); +},onClick:function(_b){ +if(_4.multiple){ +$(this).tree(_b.checked?"uncheck":"check",_b.target); +}else{ +$(_2).combo("hidePanel"); +} +_3.remainText=false; +_e(_2); +_4.onClick.call(this,_b); +},onCheck:function(_c,_d){ +_3.remainText=false; +_e(_2); +_4.onCheck.call(this,_c,_d); +}})); +}; +function _e(_f){ +var _10=$.data(_f,"combotree"); +var _11=_10.options; +var _12=_10.tree; +var vv=[]; +if(_11.multiple){ +vv=$.map(_12.tree("getChecked"),function(_13){ +return _13.id; +}); +}else{ +var _14=_12.tree("getSelected"); +if(_14){ +vv.push(_14.id); +} +} +vv=vv.concat(_11.unselectedValues); +_15(_f,vv,_10.remainText); +}; +function _15(_16,_17,_18){ +var _19=$.data(_16,"combotree"); +var _1a=_19.options; +var _1b=_19.tree; +var _1c=_1b.tree("options"); +var _1d=_1c.onBeforeCheck; +var _1e=_1c.onCheck; +var _1f=_1c.onSelect; +_1c.onBeforeCheck=_1c.onCheck=_1c.onSelect=function(){ +}; +if(!$.isArray(_17)){ +_17=_17.split(_1a.separator); +} +if(!_1a.multiple){ +_17=_17.length?[_17[0]]:[""]; +} +var vv=$.map(_17,function(_20){ +return String(_20); +}); +_1b.find("div.tree-node-selected").removeClass("tree-node-selected"); +$.map(_1b.tree("getChecked"),function(_21){ +if($.inArray(String(_21.id),vv)==-1){ +_1b.tree("uncheck",_21.target); +} +}); +var ss=[]; +_1a.unselectedValues=[]; +$.map(vv,function(v){ +var _22=_1b.tree("find",v); +if(_22){ +_1b.tree("check",_22.target).tree("select",_22.target); +ss.push(_23(_22)); +}else{ +ss.push(_24(v,_1a.mappingRows)||v); +_1a.unselectedValues.push(v); +} +}); +if(_1a.multiple){ +$.map(_1b.tree("getChecked"),function(_25){ +var id=String(_25.id); +if($.inArray(id,vv)==-1){ +vv.push(id); +ss.push(_23(_25)); +} +}); +} +_1c.onBeforeCheck=_1d; +_1c.onCheck=_1e; +_1c.onSelect=_1f; +if(!_18){ +var s=ss.join(_1a.separator); +if($(_16).combo("getText")!=s){ +$(_16).combo("setText",s); +} +} +$(_16).combo("setValues",vv); +function _24(_26,a){ +var _27=$.easyui.getArrayItem(a,"id",_26); +return _27?_23(_27):undefined; +}; +function _23(_28){ +return _28[_1a.textField||""]||_28.text; +}; +}; +function _29(_2a,q){ +var _2b=$.data(_2a,"combotree"); +var _2c=_2b.options; +var _2d=_2b.tree; +_2b.remainText=true; +_2d.tree("doFilter",_2c.multiple?q.split(_2c.separator):q); +}; +function _2e(_2f){ +var _30=$.data(_2f,"combotree"); +_30.remainText=false; +$(_2f).combotree("setValues",$(_2f).combotree("getValues")); +$(_2f).combotree("hidePanel"); +}; +$.fn.combotree=function(_31,_32){ +if(typeof _31=="string"){ +var _33=$.fn.combotree.methods[_31]; +if(_33){ +return _33(this,_32); +}else{ +return this.combo(_31,_32); +} +} +_31=_31||{}; +return this.each(function(){ +var _34=$.data(this,"combotree"); +if(_34){ +$.extend(_34.options,_31); +}else{ +$.data(this,"combotree",{options:$.extend({},$.fn.combotree.defaults,$.fn.combotree.parseOptions(this),_31)}); +} +_1(this); +}); +}; +$.fn.combotree.methods={options:function(jq){ +var _35=jq.combo("options"); +return $.extend($.data(jq[0],"combotree").options,{width:_35.width,height:_35.height,originalValue:_35.originalValue,disabled:_35.disabled,readonly:_35.readonly}); +},clone:function(jq,_36){ +var t=jq.combo("clone",_36); +t.data("combotree",{options:$.extend(true,{},jq.combotree("options")),tree:jq.combotree("tree")}); +return t; +},tree:function(jq){ +return $.data(jq[0],"combotree").tree; +},loadData:function(jq,_37){ +return jq.each(function(){ +var _38=$.data(this,"combotree").options; +_38.data=_37; +var _39=$.data(this,"combotree").tree; +_39.tree("loadData",_37); +}); +},reload:function(jq,url){ +return jq.each(function(){ +var _3a=$.data(this,"combotree").options; +var _3b=$.data(this,"combotree").tree; +if(url){ +_3a.url=url; +} +_3b.tree({url:_3a.url}); +}); +},setValues:function(jq,_3c){ +return jq.each(function(){ +var _3d=$(this).combotree("options"); +if($.isArray(_3c)){ +_3c=$.map(_3c,function(_3e){ +if(_3e&&typeof _3e=="object"){ +$.easyui.addArrayItem(_3d.mappingRows,"id",_3e); +return _3e.id; +}else{ +return _3e; +} +}); +} +_15(this,_3c); +}); +},setValue:function(jq,_3f){ +return jq.each(function(){ +$(this).combotree("setValues",$.isArray(_3f)?_3f:[_3f]); +}); +},clear:function(jq){ +return jq.each(function(){ +$(this).combotree("setValues",[]); +}); +},reset:function(jq){ +return jq.each(function(){ +var _40=$(this).combotree("options"); +if(_40.multiple){ +$(this).combotree("setValues",_40.originalValue); +}else{ +$(this).combotree("setValue",_40.originalValue); +} +}); +}}; +$.fn.combotree.parseOptions=function(_41){ +return $.extend({},$.fn.combo.parseOptions(_41),$.fn.tree.parseOptions(_41)); +}; +$.fn.combotree.defaults=$.extend({},$.fn.combo.defaults,$.fn.tree.defaults,{editable:false,textField:null,unselectedValues:[],mappingRows:[],keyHandler:{up:function(e){ +},down:function(e){ +},left:function(e){ +},right:function(e){ +},enter:function(e){ +_2e(this); +},query:function(q,e){ +_29(this,q); +}}}); +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.datagrid-dnd.js b/assets/js/easy-ui/plugins/jquery.datagrid-dnd.js index bb5e7b9b00..af5f5b1594 100755 --- a/assets/js/easy-ui/plugins/jquery.datagrid-dnd.js +++ b/assets/js/easy-ui/plugins/jquery.datagrid-dnd.js @@ -1,302 +1,302 @@ -(function($){ - $.extend($.fn.datagrid.defaults, { - dragSelection: false, - onBeforeDrag: function(row){}, // return false to deny drag - onStartDrag: function(row){}, - onStopDrag: function(row){}, - onDragEnter: function(targetRow, sourceRow){}, // return false to deny drop - onDragOver: function(targetRow, sourceRow){}, // return false to deny drop - onDragLeave: function(targetRow, sourceRow){}, - onBeforeDrop: function(targetRow, sourceRow, point){}, - onDrop: function(targetRow, sourceRow, point){}, // point:'append','top','bottom' - }); - $.extend($.fn.datagrid.methods, { - _appendRow: function(jq, row){ - return jq.each(function(){ - var dg = $(this); - var rows = $.isArray(row) ? row : [row]; - $.map(rows, function(row){ - dg.datagrid('appendRow', row).datagrid('enableDnd', dg.datagrid('getRows').length-1); - if (row._selected){ - dg.datagrid('selectRow', dg.datagrid('getRows').length-1); - } - }); - }); - }, - _insertRow: function(jq, param){ - return jq.each(function(){ - var dg = $(this); - var index = param.index; - var row = param.row; - var rows = $.isArray(row) ? row : [row]; - $.map(rows, function(row, i){ - dg.datagrid('insertRow', { - index: (index+i), - row: row - }).datagrid('enableDnd', index+i); - if (row._selected){ - dg.datagrid('selectRow', index+i); - } - }); - }); - }, - _deleteRow: function(jq, row){ - return jq.each(function(){ - var dg = $(this); - var rows = $.isArray(row) ? row : [row]; - $.map(rows, function(row){ - var index = dg.datagrid('getRowIndex', row); - dg.datagrid('deleteRow', index); - }); - }); - } - }); - - var disabledDroppingRows = []; - - $.extend($.fn.datagrid.methods, { - enableDnd: function(jq, index){ - return jq.each(function(){ - var target = this; - var state = $.data(this, 'datagrid'); - var dg = $(this); - var opts = state.options; - - var draggableOptions = { - disabled: false, - revert: true, - cursor: 'pointer', - proxy: function(source) { - var p = $('
').appendTo('body'); - var draggingRow = getDraggingRow(source); - var rows = $.isArray(draggingRow) ? draggingRow : [draggingRow]; - $.map(rows, function(row,i){ - var index = dg.datagrid('getRowIndex', row); - var tr1 = opts.finder.getTr(target, index, 'body', 1); - var tr2 = opts.finder.getTr(target, index, 'body', 2); - tr2.clone().removeAttr('id').removeClass('droppable').appendTo(p); - tr1.clone().removeAttr('id').removeClass('droppable').find('td').insertBefore(p.find('tr:eq('+i+') td:first')); - $(' ').insertBefore(p.find('tr:eq('+i+') td:first')); - }); - p.find('td').css('vertical-align','middle'); - p.hide(); - return p; - }, - deltaX: 15, - deltaY: 15, - onBeforeDrag:function(e){ - var draggingRow = getDraggingRow(this); - if (opts.onBeforeDrag.call(target, draggingRow) == false){return false;} - if ($(e.target).parent().hasClass('datagrid-cell-check')){return false;} - if (e.which != 1){return false;} - $.map($.isArray(draggingRow)?draggingRow:[draggingRow], function(row){ - var index = $(target).datagrid('getRowIndex', row); - opts.finder.getTr(target, index).droppable({accept:'no-accept'}); - }); - }, - onStartDrag: function() { - $(this).draggable('proxy').css({ - left: -10000, - top: -10000 - }); - var draggingRow = getDraggingRow(this); - opts.onStartDrag.call(target, draggingRow); - state.draggingRow = draggingRow; - }, - onDrag: function(e) { - var x1=e.pageX,y1=e.pageY,x2=e.data.startX,y2=e.data.startY; - var d = Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); - if (d>3){ // when drag a little distance, show the proxy object - $(this).draggable('proxy').show(); - var tr = opts.finder.getTr(target, parseInt($(this).attr('datagrid-row-index')), 'body'); - $.extend(e.data, { - startX: tr.offset().left, - startY: tr.offset().top, - offsetWidth: 0, - offsetHeight: 0 - }); - } - this.pageY = e.pageY; - }, - onStopDrag:function(){ - $.map(disabledDroppingRows, function(row){ - var r = $(row); - if (r.hasClass('datagrid-row')){ - r.droppable('enable'); - } else if (r.find('tr.datagrid-row:first').length == 0){ - r.droppable('enable'); - } - }); - disabledDroppingRows = []; - - $.map($.isArray(state.draggingRow) ? state.draggingRow : [state.draggingRow], function(row){ - var index = dg.datagrid('getRowIndex', row); - dg.datagrid('enableDnd', index); - }); - opts.onStopDrag.call(target, state.draggingRow); - } - }; - var droppableOptions = { - accept: 'tr.datagrid-row', - onDragEnter: function(e, source){ - if ($(this).droppable('options').disabled){return;} - if (opts.onDragEnter.call(target, getRow(this), getDraggingRow(source)) == false){ - setProxyFlag(source, false); - var tr = opts.finder.getTr(target, $(this).attr('datagrid-row-index')); - tr.find('td').css('border', ''); - tr.droppable('disable'); - $(this).droppable('disable'); - disabledDroppingRows.push(this); - } - }, - onDragOver: function(e, source) { - if ($(this).droppable('options').disabled){ - return; - } - if ($.inArray(this, disabledDroppingRows) >= 0){ - return; - } - var pageY = source.pageY; - var top = $(this).offset().top; - var bottom = top + $(this).outerHeight(); - - setProxyFlag(source, true); - var tr = opts.finder.getTr(target, $(this).attr('datagrid-row-index')); - tr.children('td').css('border',''); - if (pageY > top + (bottom - top) / 2) { - tr.children('td').css('border-bottom','1px solid red'); - } else { - tr.children('td').css('border-top','1px solid red'); - } - - if (opts.onDragOver.call(target, getRow(this), getDraggingRow(source)) == false){ - setProxyFlag(source, false); - tr.find('td').css('border', ''); - tr.droppable('disable'); - $(this).droppable('disable'); - disabledDroppingRows.push(this); - } - }, - onDragLeave: function(e, source) { - if ($(this).droppable('options').disabled){ - return; - } - setProxyFlag(source, false); - var tr = opts.finder.getTr(target, $(this).attr('datagrid-row-index')); - tr.children('td').css('border',''); - opts.onDragLeave.call(target, getRow(this), getDraggingRow(source)); - }, - onDrop: function(e, source) { - if ($(this).droppable('options').disabled){ - return; - } - - var tr = opts.finder.getTr(target, $(this).attr('datagrid-row-index')); - var td = tr.children('td'); - var point = parseInt(td.css('border-top-width')) ? 'top' : 'bottom'; - td.css('border',''); - var dRow = getRow(this); - var sRow = getDraggingRow(source); - - if (opts.onBeforeDrop.call(target, dRow, sRow, point) == false){ - return; - } - insert.call(this); - opts.onDrop.call(target, dRow, sRow, point); - - function insert(){ - var sourceIndex = parseInt($(source).attr('datagrid-row-index')); - var destIndex = parseInt($(this).attr('datagrid-row-index')); - var sourceTarget = $(source).closest('div.datagrid-view').children('table')[0]; - var target = $(this).closest('div.datagrid-view').children('table')[0]; - - if ($(this).hasClass('datagrid-view')){ - $(target).datagrid('_appendRow', sRow); - $(sourceTarget).datagrid('_deleteRow', sRow); - if ($(sourceTarget).datagrid('getRows').length == 0){ - $(sourceTarget).datagrid('enableDnd'); - } - } else if (target != sourceTarget){ - var index = point == 'top' ? destIndex : (destIndex+1); - if (index >= 0){ - $(sourceTarget).datagrid('_deleteRow', sRow); - $(target).datagrid('_insertRow', { - index: index, - row: sRow - }); - } - } else { - var dg = $(target); - var index = point == 'top' ? destIndex : (destIndex+1); - if (index >= 0){ - dg.datagrid('_deleteRow', sRow); - var destIndex = parseInt($(this).attr('datagrid-row-index')); - var index = point == 'top' ? destIndex : (destIndex+1); - if (index >= 0){ - dg.datagrid('_insertRow', { - index: index, - row: sRow - }); - } - } - } - } - } - } - - if (index != undefined){ - var trs = opts.finder.getTr(this, index); - } else { - var trs = opts.finder.getTr(this, 0, 'allbody'); - } - trs.draggable(draggableOptions); - trs.droppable(droppableOptions); - setDroppable(target); - - function setProxyFlag(source, allowed){ - var icon = $(source).draggable('proxy').find('span.tree-dnd-icon'); - icon.removeClass('tree-dnd-yes tree-dnd-no').addClass(allowed ? 'tree-dnd-yes' : 'tree-dnd-no'); - } - function getRow(tr){ - if (!$(tr).hasClass('datagrid-row')){return null} - var target = $(tr).closest('div.datagrid-view').children('table')[0]; - var opts = $(target).datagrid('options'); - return opts.finder.getRow(target, $(tr)); - } - function getDraggingRow(tr){ - if (!$(tr).hasClass('datagrid-row')){return null} - var target = $(tr).closest('div.datagrid-view').children('table')[0]; - var opts = $(target).datagrid('options'); - if (opts.dragSelection){ - var rows = $(target).datagrid('getSelections'); - $.map(rows, function(row){ - row._selected = true; - }); - if (!rows.length){ - var row = opts.finder.getRow(target, $(tr)); - row._selected = false; - return row; - } - return rows; - } else { - var row = opts.finder.getRow(target, $(tr)); - if ($(tr).hasClass('datagrid-row-selected')){ - row._selected = true; - } - return row; - } - } - function setDroppable(target){ - var c = $(target).datagrid('getPanel').find('div.datagrid-view'); - c.droppable(droppableOptions); - if (c.find('tr.datagrid-row:first').length){ - c.droppable('disable'); - } else { - c.droppable('enable'); - } - } - }); - } - - }); -})(jQuery); +(function($){ + $.extend($.fn.datagrid.defaults, { + dragSelection: false, + onBeforeDrag: function(row){}, // return false to deny drag + onStartDrag: function(row){}, + onStopDrag: function(row){}, + onDragEnter: function(targetRow, sourceRow){}, // return false to deny drop + onDragOver: function(targetRow, sourceRow){}, // return false to deny drop + onDragLeave: function(targetRow, sourceRow){}, + onBeforeDrop: function(targetRow, sourceRow, point){}, + onDrop: function(targetRow, sourceRow, point){}, // point:'append','top','bottom' + }); + $.extend($.fn.datagrid.methods, { + _appendRow: function(jq, row){ + return jq.each(function(){ + var dg = $(this); + var rows = $.isArray(row) ? row : [row]; + $.map(rows, function(row){ + dg.datagrid('appendRow', row).datagrid('enableDnd', dg.datagrid('getRows').length-1); + if (row._selected){ + dg.datagrid('selectRow', dg.datagrid('getRows').length-1); + } + }); + }); + }, + _insertRow: function(jq, param){ + return jq.each(function(){ + var dg = $(this); + var index = param.index; + var row = param.row; + var rows = $.isArray(row) ? row : [row]; + $.map(rows, function(row, i){ + dg.datagrid('insertRow', { + index: (index+i), + row: row + }).datagrid('enableDnd', index+i); + if (row._selected){ + dg.datagrid('selectRow', index+i); + } + }); + }); + }, + _deleteRow: function(jq, row){ + return jq.each(function(){ + var dg = $(this); + var rows = $.isArray(row) ? row : [row]; + $.map(rows, function(row){ + var index = dg.datagrid('getRowIndex', row); + dg.datagrid('deleteRow', index); + }); + }); + } + }); + + var disabledDroppingRows = []; + + $.extend($.fn.datagrid.methods, { + enableDnd: function(jq, index){ + return jq.each(function(){ + var target = this; + var state = $.data(this, 'datagrid'); + var dg = $(this); + var opts = state.options; + + var draggableOptions = { + disabled: false, + revert: true, + cursor: 'pointer', + proxy: function(source) { + var p = $('
').appendTo('body'); + var draggingRow = getDraggingRow(source); + var rows = $.isArray(draggingRow) ? draggingRow : [draggingRow]; + $.map(rows, function(row,i){ + var index = dg.datagrid('getRowIndex', row); + var tr1 = opts.finder.getTr(target, index, 'body', 1); + var tr2 = opts.finder.getTr(target, index, 'body', 2); + tr2.clone().removeAttr('id').removeClass('droppable').appendTo(p); + tr1.clone().removeAttr('id').removeClass('droppable').find('td').insertBefore(p.find('tr:eq('+i+') td:first')); + $(' ').insertBefore(p.find('tr:eq('+i+') td:first')); + }); + p.find('td').css('vertical-align','middle'); + p.hide(); + return p; + }, + deltaX: 15, + deltaY: 15, + onBeforeDrag:function(e){ + var draggingRow = getDraggingRow(this); + if (opts.onBeforeDrag.call(target, draggingRow) == false){return false;} + if ($(e.target).parent().hasClass('datagrid-cell-check')){return false;} + if (e.which != 1){return false;} + $.map($.isArray(draggingRow)?draggingRow:[draggingRow], function(row){ + var index = $(target).datagrid('getRowIndex', row); + opts.finder.getTr(target, index).droppable({accept:'no-accept'}); + }); + }, + onStartDrag: function() { + $(this).draggable('proxy').css({ + left: -10000, + top: -10000 + }); + var draggingRow = getDraggingRow(this); + opts.onStartDrag.call(target, draggingRow); + state.draggingRow = draggingRow; + }, + onDrag: function(e) { + var x1=e.pageX,y1=e.pageY,x2=e.data.startX,y2=e.data.startY; + var d = Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); + if (d>3){ // when drag a little distance, show the proxy object + $(this).draggable('proxy').show(); + var tr = opts.finder.getTr(target, parseInt($(this).attr('datagrid-row-index')), 'body'); + $.extend(e.data, { + startX: tr.offset().left, + startY: tr.offset().top, + offsetWidth: 0, + offsetHeight: 0 + }); + } + this.pageY = e.pageY; + }, + onStopDrag:function(){ + $.map(disabledDroppingRows, function(row){ + var r = $(row); + if (r.hasClass('datagrid-row')){ + r.droppable('enable'); + } else if (r.find('tr.datagrid-row:first').length == 0){ + r.droppable('enable'); + } + }); + disabledDroppingRows = []; + + $.map($.isArray(state.draggingRow) ? state.draggingRow : [state.draggingRow], function(row){ + var index = dg.datagrid('getRowIndex', row); + dg.datagrid('enableDnd', index); + }); + opts.onStopDrag.call(target, state.draggingRow); + } + }; + var droppableOptions = { + accept: 'tr.datagrid-row', + onDragEnter: function(e, source){ + if ($(this).droppable('options').disabled){return;} + if (opts.onDragEnter.call(target, getRow(this), getDraggingRow(source)) == false){ + setProxyFlag(source, false); + var tr = opts.finder.getTr(target, $(this).attr('datagrid-row-index')); + tr.find('td').css('border', ''); + tr.droppable('disable'); + $(this).droppable('disable'); + disabledDroppingRows.push(this); + } + }, + onDragOver: function(e, source) { + if ($(this).droppable('options').disabled){ + return; + } + if ($.inArray(this, disabledDroppingRows) >= 0){ + return; + } + var pageY = source.pageY; + var top = $(this).offset().top; + var bottom = top + $(this).outerHeight(); + + setProxyFlag(source, true); + var tr = opts.finder.getTr(target, $(this).attr('datagrid-row-index')); + tr.children('td').css('border',''); + if (pageY > top + (bottom - top) / 2) { + tr.children('td').css('border-bottom','1px solid red'); + } else { + tr.children('td').css('border-top','1px solid red'); + } + + if (opts.onDragOver.call(target, getRow(this), getDraggingRow(source)) == false){ + setProxyFlag(source, false); + tr.find('td').css('border', ''); + tr.droppable('disable'); + $(this).droppable('disable'); + disabledDroppingRows.push(this); + } + }, + onDragLeave: function(e, source) { + if ($(this).droppable('options').disabled){ + return; + } + setProxyFlag(source, false); + var tr = opts.finder.getTr(target, $(this).attr('datagrid-row-index')); + tr.children('td').css('border',''); + opts.onDragLeave.call(target, getRow(this), getDraggingRow(source)); + }, + onDrop: function(e, source) { + if ($(this).droppable('options').disabled){ + return; + } + + var tr = opts.finder.getTr(target, $(this).attr('datagrid-row-index')); + var td = tr.children('td'); + var point = parseInt(td.css('border-top-width')) ? 'top' : 'bottom'; + td.css('border',''); + var dRow = getRow(this); + var sRow = getDraggingRow(source); + + if (opts.onBeforeDrop.call(target, dRow, sRow, point) == false){ + return; + } + insert.call(this); + opts.onDrop.call(target, dRow, sRow, point); + + function insert(){ + var sourceIndex = parseInt($(source).attr('datagrid-row-index')); + var destIndex = parseInt($(this).attr('datagrid-row-index')); + var sourceTarget = $(source).closest('div.datagrid-view').children('table')[0]; + var target = $(this).closest('div.datagrid-view').children('table')[0]; + + if ($(this).hasClass('datagrid-view')){ + $(target).datagrid('_appendRow', sRow); + $(sourceTarget).datagrid('_deleteRow', sRow); + if ($(sourceTarget).datagrid('getRows').length == 0){ + $(sourceTarget).datagrid('enableDnd'); + } + } else if (target != sourceTarget){ + var index = point == 'top' ? destIndex : (destIndex+1); + if (index >= 0){ + $(sourceTarget).datagrid('_deleteRow', sRow); + $(target).datagrid('_insertRow', { + index: index, + row: sRow + }); + } + } else { + var dg = $(target); + var index = point == 'top' ? destIndex : (destIndex+1); + if (index >= 0){ + dg.datagrid('_deleteRow', sRow); + var destIndex = parseInt($(this).attr('datagrid-row-index')); + var index = point == 'top' ? destIndex : (destIndex+1); + if (index >= 0){ + dg.datagrid('_insertRow', { + index: index, + row: sRow + }); + } + } + } + } + } + } + + if (index != undefined){ + var trs = opts.finder.getTr(this, index); + } else { + var trs = opts.finder.getTr(this, 0, 'allbody'); + } + trs.draggable(draggableOptions); + trs.droppable(droppableOptions); + setDroppable(target); + + function setProxyFlag(source, allowed){ + var icon = $(source).draggable('proxy').find('span.tree-dnd-icon'); + icon.removeClass('tree-dnd-yes tree-dnd-no').addClass(allowed ? 'tree-dnd-yes' : 'tree-dnd-no'); + } + function getRow(tr){ + if (!$(tr).hasClass('datagrid-row')){return null} + var target = $(tr).closest('div.datagrid-view').children('table')[0]; + var opts = $(target).datagrid('options'); + return opts.finder.getRow(target, $(tr)); + } + function getDraggingRow(tr){ + if (!$(tr).hasClass('datagrid-row')){return null} + var target = $(tr).closest('div.datagrid-view').children('table')[0]; + var opts = $(target).datagrid('options'); + if (opts.dragSelection){ + var rows = $(target).datagrid('getSelections'); + $.map(rows, function(row){ + row._selected = true; + }); + if (!rows.length){ + var row = opts.finder.getRow(target, $(tr)); + row._selected = false; + return row; + } + return rows; + } else { + var row = opts.finder.getRow(target, $(tr)); + if ($(tr).hasClass('datagrid-row-selected')){ + row._selected = true; + } + return row; + } + } + function setDroppable(target){ + var c = $(target).datagrid('getPanel').find('div.datagrid-view'); + c.droppable(droppableOptions); + if (c.find('tr.datagrid-row:first').length){ + c.droppable('disable'); + } else { + c.droppable('enable'); + } + } + }); + } + + }); +})(jQuery); diff --git a/assets/js/easy-ui/plugins/jquery.datagrid.js b/assets/js/easy-ui/plugins/jquery.datagrid.js index 618bb51205..e9deab4d6e 100755 --- a/assets/js/easy-ui/plugins/jquery.datagrid.js +++ b/assets/js/easy-ui/plugins/jquery.datagrid.js @@ -1,2574 +1,2574 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -var _1=0; -function _2(a,o){ -return $.easyui.indexOfArray(a,o); -}; -function _3(a,o,id){ -$.easyui.removeArrayItem(a,o,id); -}; -function _4(a,o,r){ -$.easyui.addArrayItem(a,o,r); -}; -function _5(_6,aa){ -return $.data(_6,"treegrid")?aa.slice(1):aa; -}; -function _7(_8){ -var _9=$.data(_8,"datagrid"); -var _a=_9.options; -var _b=_9.panel; -var dc=_9.dc; -var ss=null; -if(_a.sharedStyleSheet){ -ss=typeof _a.sharedStyleSheet=="boolean"?"head":_a.sharedStyleSheet; -}else{ -ss=_b.closest("div.datagrid-view"); -if(!ss.length){ -ss=dc.view; -} -} -var cc=$(ss); -var _c=$.data(cc[0],"ss"); -if(!_c){ -_c=$.data(cc[0],"ss",{cache:{},dirty:[]}); -} -return {add:function(_d){ -var ss=[""); -$(ss.join("\n")).appendTo(cc); -cc.children("style[easyui]:not(:last)").remove(); -},getRule:function(_10){ -var _11=cc.children("style[easyui]:last")[0]; -var _12=_11.styleSheet?_11.styleSheet:(_11.sheet||document.styleSheets[document.styleSheets.length-1]); -var _13=_12.cssRules||_12.rules; -return _13[_10]; -},set:function(_14,_15){ -var _16=_c.cache[_14]; -if(_16){ -_16.width=_15; -var _17=this.getRule(_16.index); -if(_17){ -_17.style["width"]=_15; -} -} -},remove:function(_18){ -var tmp=[]; -for(var s in _c.cache){ -if(s.indexOf(_18)==-1){ -tmp.push([s,_c.cache[s].width]); -} -} -_c.cache={}; -this.add(tmp); -},dirty:function(_19){ -if(_19){ -_c.dirty.push(_19); -} -},clean:function(){ -for(var i=0;i<_c.dirty.length;i++){ -this.remove(_c.dirty[i]); -} -_c.dirty=[]; -}}; -}; -function _1a(_1b,_1c){ -var _1d=$.data(_1b,"datagrid"); -var _1e=_1d.options; -var _1f=_1d.panel; -if(_1c){ -$.extend(_1e,_1c); -} -if(_1e.fit==true){ -var p=_1f.panel("panel").parent(); -_1e.width=p.width(); -_1e.height=p.height(); -} -_1f.panel("resize",_1e); -}; -function _20(_21){ -var _22=$.data(_21,"datagrid"); -var _23=_22.options; -var dc=_22.dc; -var _24=_22.panel; -var _25=_24.width(); -var _26=_24.height(); -var _27=dc.view; -var _28=dc.view1; -var _29=dc.view2; -var _2a=_28.children("div.datagrid-header"); -var _2b=_29.children("div.datagrid-header"); -var _2c=_2a.find("table"); -var _2d=_2b.find("table"); -_27.width(_25); -var _2e=_2a.children("div.datagrid-header-inner").show(); -_28.width(_2e.find("table").width()); -if(!_23.showHeader){ -_2e.hide(); -} -_29.width(_25-_28._outerWidth()); -_28.children()._outerWidth(_28.width()); -_29.children()._outerWidth(_29.width()); -var all=_2a.add(_2b).add(_2c).add(_2d); -all.css("height",""); -var hh=Math.max(_2c.height(),_2d.height()); -all._outerHeight(hh); -_27.children(".datagrid-empty").css("top",hh+"px"); -dc.body1.add(dc.body2).children("table.datagrid-btable-frozen").css({position:"absolute",top:dc.header2._outerHeight()}); -var _2f=dc.body2.children("table.datagrid-btable-frozen")._outerHeight(); -var _30=_2f+_2b._outerHeight()+_29.children(".datagrid-footer")._outerHeight(); -_24.children(":not(.datagrid-view,.datagrid-mask,.datagrid-mask-msg)").each(function(){ -_30+=$(this)._outerHeight(); -}); -var _31=_24.outerHeight()-_24.height(); -var _32=_24._size("minHeight")||""; -var _33=_24._size("maxHeight")||""; -_28.add(_29).children("div.datagrid-body").css({marginTop:_2f,height:(isNaN(parseInt(_23.height))?"":(_26-_30)),minHeight:(_32?_32-_31-_30:""),maxHeight:(_33?_33-_31-_30:"")}); -_27.height(_29.height()); -}; -function _34(_35,_36,_37){ -var _38=$.data(_35,"datagrid").data.rows; -var _39=$.data(_35,"datagrid").options; -var dc=$.data(_35,"datagrid").dc; -if(!dc.body1.is(":empty")&&(!_39.nowrap||_39.autoRowHeight||_37)){ -if(_36!=undefined){ -var tr1=_39.finder.getTr(_35,_36,"body",1); -var tr2=_39.finder.getTr(_35,_36,"body",2); -_3a(tr1,tr2); -}else{ -var tr1=_39.finder.getTr(_35,0,"allbody",1); -var tr2=_39.finder.getTr(_35,0,"allbody",2); -_3a(tr1,tr2); -if(_39.showFooter){ -var tr1=_39.finder.getTr(_35,0,"allfooter",1); -var tr2=_39.finder.getTr(_35,0,"allfooter",2); -_3a(tr1,tr2); -} -} -} -_20(_35); -if(_39.height=="auto"){ -var _3b=dc.body1.parent(); -var _3c=dc.body2; -var _3d=_3e(_3c); -var _3f=_3d.height; -if(_3d.width>_3c.width()){ -_3f+=18; -} -_3f-=parseInt(_3c.css("marginTop"))||0; -_3b.height(_3f); -_3c.height(_3f); -dc.view.height(dc.view2.height()); -} -dc.body2.triggerHandler("scroll"); -function _3a(_40,_41){ -for(var i=0;i<_41.length;i++){ -var tr1=$(_40[i]); -var tr2=$(_41[i]); -tr1.css("height",""); -tr2.css("height",""); -var _42=Math.max(tr1.height(),tr2.height()); -tr1.css("height",_42); -tr2.css("height",_42); -} -}; -function _3e(cc){ -var _43=0; -var _44=0; -$(cc).children().each(function(){ -var c=$(this); -if(c.is(":visible")){ -_44+=c._outerHeight(); -if(_43"); -} -_4a(true); -_4a(false); -_20(_46); -function _4a(_4b){ -var _4c=_4b?1:2; -var tr=_49.finder.getTr(_46,_47,"body",_4c); -(_4b?dc.body1:dc.body2).children("table.datagrid-btable-frozen").append(tr); -}; -}; -function _4d(_4e,_4f){ -function _50(){ -var _51=[]; -var _52=[]; -$(_4e).children("thead").each(function(){ -var opt=$.parser.parseOptions(this,[{frozen:"boolean"}]); -$(this).find("tr").each(function(){ -var _53=[]; -$(this).find("th").each(function(){ -var th=$(this); -var col=$.extend({},$.parser.parseOptions(this,["id","field","align","halign","order","width",{sortable:"boolean",checkbox:"boolean",resizable:"boolean",fixed:"boolean"},{rowspan:"number",colspan:"number"}]),{title:(th.html()||undefined),hidden:(th.attr("hidden")?true:undefined),formatter:(th.attr("formatter")?eval(th.attr("formatter")):undefined),styler:(th.attr("styler")?eval(th.attr("styler")):undefined),sorter:(th.attr("sorter")?eval(th.attr("sorter")):undefined)}); -if(col.width&&String(col.width).indexOf("%")==-1){ -col.width=parseInt(col.width); -} -if(th.attr("editor")){ -var s=$.trim(th.attr("editor")); -if(s.substr(0,1)=="{"){ -col.editor=eval("("+s+")"); -}else{ -col.editor=s; -} -} -_53.push(col); -}); -opt.frozen?_51.push(_53):_52.push(_53); -}); -}); -return [_51,_52]; -}; -var _54=$("
"+"
"+"
"+"
"+"
"+"
"+"
"+"
"+"
"+"
"+""+"
"+"
"+"
"+"
"+"
"+"
"+"
"+"
"+""+"
"+"
"+"
"+"
").insertAfter(_4e); -_54.panel({doSize:false,cls:"datagrid"}); -$(_4e).addClass("datagrid-f").hide().appendTo(_54.children("div.datagrid-view")); -var cc=_50(); -var _55=_54.children("div.datagrid-view"); -var _56=_55.children("div.datagrid-view1"); -var _57=_55.children("div.datagrid-view2"); -return {panel:_54,frozenColumns:cc[0],columns:cc[1],dc:{view:_55,view1:_56,view2:_57,header1:_56.children("div.datagrid-header").children("div.datagrid-header-inner"),header2:_57.children("div.datagrid-header").children("div.datagrid-header-inner"),body1:_56.children("div.datagrid-body").children("div.datagrid-body-inner"),body2:_57.children("div.datagrid-body"),footer1:_56.children("div.datagrid-footer").children("div.datagrid-footer-inner"),footer2:_57.children("div.datagrid-footer").children("div.datagrid-footer-inner")}}; -}; -function _58(_59){ -var _5a=$.data(_59,"datagrid"); -var _5b=_5a.options; -var dc=_5a.dc; -var _5c=_5a.panel; -_5a.ss=$(_59).datagrid("createStyleSheet"); -_5c.panel($.extend({},_5b,{id:null,doSize:false,onResize:function(_5d,_5e){ -if($.data(_59,"datagrid")){ -_20(_59); -$(_59).datagrid("fitColumns"); -_5b.onResize.call(_5c,_5d,_5e); -} -},onExpand:function(){ -if($.data(_59,"datagrid")){ -$(_59).datagrid("fixRowHeight").datagrid("fitColumns"); -_5b.onExpand.call(_5c); -} -}})); -_5a.rowIdPrefix="datagrid-row-r"+(++_1); -_5a.cellClassPrefix="datagrid-cell-c"+_1; -_5f(dc.header1,_5b.frozenColumns,true); -_5f(dc.header2,_5b.columns,false); -_60(); -dc.header1.add(dc.header2).css("display",_5b.showHeader?"block":"none"); -dc.footer1.add(dc.footer2).css("display",_5b.showFooter?"block":"none"); -if(_5b.toolbar){ -if($.isArray(_5b.toolbar)){ -$("div.datagrid-toolbar",_5c).remove(); -var tb=$("
").prependTo(_5c); -var tr=tb.find("tr"); -for(var i=0;i<_5b.toolbar.length;i++){ -var btn=_5b.toolbar[i]; -if(btn=="-"){ -$("
").appendTo(tr); -}else{ -var td=$("").appendTo(tr); -var _61=$("").appendTo(td); -_61[0].onclick=eval(btn.handler||function(){ -}); -_61.linkbutton($.extend({},btn,{plain:true})); -} -} -}else{ -$(_5b.toolbar).addClass("datagrid-toolbar").prependTo(_5c); -$(_5b.toolbar).show(); -} -}else{ -$("div.datagrid-toolbar",_5c).remove(); -} -$("div.datagrid-pager",_5c).remove(); -if(_5b.pagination){ -var _62=$("
"); -if(_5b.pagePosition=="bottom"){ -_62.appendTo(_5c); -}else{ -if(_5b.pagePosition=="top"){ -_62.addClass("datagrid-pager-top").prependTo(_5c); -}else{ -var _63=$("
").prependTo(_5c); -_62.appendTo(_5c); -_62=_62.add(_63); -} -} -_62.pagination({total:0,pageNumber:_5b.pageNumber,pageSize:_5b.pageSize,pageList:_5b.pageList,onSelectPage:function(_64,_65){ -_5b.pageNumber=_64||1; -_5b.pageSize=_65; -_62.pagination("refresh",{pageNumber:_64,pageSize:_65}); -_bf(_59); -}}); -_5b.pageSize=_62.pagination("options").pageSize; -} -function _5f(_66,_67,_68){ -if(!_67){ -return; -} -$(_66).show(); -$(_66).empty(); -var tmp=$("
").appendTo("body"); -tmp._outerWidth(99); -var _69=100-parseInt(tmp[0].style.width); -tmp.remove(); -var _6a=[]; -var _6b=[]; -var _6c=[]; -if(_5b.sortName){ -_6a=_5b.sortName.split(","); -_6b=_5b.sortOrder.split(","); -} -var t=$("
").appendTo(_66); -for(var i=0;i<_67.length;i++){ -var tr=$("").appendTo($("tbody",t)); -var _6d=_67[i]; -for(var j=0;j<_6d.length;j++){ -var col=_6d[j]; -var _6e=""; -if(col.rowspan){ -_6e+="rowspan=\""+col.rowspan+"\" "; -} -if(col.colspan){ -_6e+="colspan=\""+col.colspan+"\" "; -if(!col.id){ -col.id=["datagrid-td-group"+_1,i,j].join("-"); -} -} -if(col.id){ -_6e+="id=\""+col.id+"\""; -} -var td=$("").appendTo(tr); -if(col.checkbox){ -td.attr("field",col.field); -$("
").html("").appendTo(td); -}else{ -if(col.field){ -td.attr("field",col.field); -td.append("
"); -td.find("span:first").html(col.title); -var _6f=td.find("div.datagrid-cell"); -var pos=_2(_6a,col.field); -if(pos>=0){ -_6f.addClass("datagrid-sort-"+_6b[pos]); -} -if(col.sortable){ -_6f.addClass("datagrid-sort"); -} -if(col.resizable==false){ -_6f.attr("resizable","false"); -} -if(col.width){ -var _70=$.parser.parseValue("width",col.width,dc.view,_5b.scrollbarSize+(_5b.rownumbers?_5b.rownumberWidth:0)); -col.deltaWidth=_69; -col.boxWidth=_70-_69; -}else{ -col.auto=true; -} -_6f.css("text-align",(col.halign||col.align||"")); -col.cellClass=_5a.cellClassPrefix+"-"+col.field.replace(/[\.|\s]/g,"-"); -_6f.addClass(col.cellClass); -}else{ -$("
").html(col.title).appendTo(td); -} -} -if(col.hidden){ -td.hide(); -_6c.push(col.field); -} -} -} -if(_68&&_5b.rownumbers){ -var td=$("
"); -if($("tr",t).length==0){ -td.wrap("").parent().appendTo($("tbody",t)); -}else{ -td.prependTo($("tr:first",t)); -} -} -for(var i=0;i<_6c.length;i++){ -_c1(_59,_6c[i],-1); -} -}; -function _60(){ -var _71=[[".datagrid-header-rownumber",(_5b.rownumberWidth-1)+"px"],[".datagrid-cell-rownumber",(_5b.rownumberWidth-1)+"px"]]; -var _72=_73(_59,true).concat(_73(_59)); -for(var i=0;i<_72.length;i++){ -var col=_74(_59,_72[i]); -if(col&&!col.checkbox){ -_71.push(["."+col.cellClass,col.boxWidth?col.boxWidth+"px":"auto"]); -} -} -_5a.ss.add(_71); -_5a.ss.dirty(_5a.cellSelectorPrefix); -_5a.cellSelectorPrefix="."+_5a.cellClassPrefix; -}; -}; -function _75(_76){ -var _77=$.data(_76,"datagrid"); -var _78=_77.panel; -var _79=_77.options; -var dc=_77.dc; -var _7a=dc.header1.add(dc.header2); -_7a.unbind(".datagrid"); -for(var _7b in _79.headerEvents){ -_7a.bind(_7b+".datagrid",_79.headerEvents[_7b]); -} -var _7c=_7a.find("div.datagrid-cell"); -var _7d=_79.resizeHandle=="right"?"e":(_79.resizeHandle=="left"?"w":"e,w"); -_7c.each(function(){ -$(this).resizable({handles:_7d,disabled:($(this).attr("resizable")?$(this).attr("resizable")=="false":false),minWidth:25,onStartResize:function(e){ -_77.resizing=true; -_7a.css("cursor",$("body").css("cursor")); -if(!_77.proxy){ -_77.proxy=$("
").appendTo(dc.view); -} -_77.proxy.css({left:e.pageX-$(_78).offset().left-1,display:"none"}); -setTimeout(function(){ -if(_77.proxy){ -_77.proxy.show(); -} -},500); -},onResize:function(e){ -_77.proxy.css({left:e.pageX-$(_78).offset().left-1,display:"block"}); -return false; -},onStopResize:function(e){ -_7a.css("cursor",""); -$(this).css("height",""); -var _7e=$(this).parent().attr("field"); -var col=_74(_76,_7e); -col.width=$(this)._outerWidth(); -col.boxWidth=col.width-col.deltaWidth; -col.auto=undefined; -$(this).css("width",""); -$(_76).datagrid("fixColumnSize",_7e); -_77.proxy.remove(); -_77.proxy=null; -if($(this).parents("div:first.datagrid-header").parent().hasClass("datagrid-view1")){ -_20(_76); -} -$(_76).datagrid("fitColumns"); -_79.onResizeColumn.call(_76,_7e,col.width); -setTimeout(function(){ -_77.resizing=false; -},0); -}}); -}); -var bb=dc.body1.add(dc.body2); -bb.unbind(); -for(var _7b in _79.rowEvents){ -bb.bind(_7b,_79.rowEvents[_7b]); -} -dc.body1.bind("mousewheel DOMMouseScroll",function(e){ -e.preventDefault(); -var e1=e.originalEvent||window.event; -var _7f=e1.wheelDelta||e1.detail*(-1); -if("deltaY" in e1){ -_7f=e1.deltaY*-1; -} -var dg=$(e.target).closest("div.datagrid-view").children(".datagrid-f"); -var dc=dg.data("datagrid").dc; -dc.body2.scrollTop(dc.body2.scrollTop()-_7f); -}); -dc.body2.bind("scroll",function(){ -var b1=dc.view1.children("div.datagrid-body"); -b1.scrollTop($(this).scrollTop()); -var c1=dc.body1.children(":first"); -var c2=dc.body2.children(":first"); -if(c1.length&&c2.length){ -var _80=c1.offset().top; -var _81=c2.offset().top; -if(_80!=_81){ -b1.scrollTop(b1.scrollTop()+_80-_81); -} -} -dc.view2.children("div.datagrid-header,div.datagrid-footer")._scrollLeft($(this)._scrollLeft()); -dc.body2.children("table.datagrid-btable-frozen").css("left",-$(this)._scrollLeft()); -}); -}; -function _82(_83){ -return function(e){ -var td=$(e.target).closest("td[field]"); -if(td.length){ -var _84=_85(td); -if(!$(_84).data("datagrid").resizing&&_83){ -td.addClass("datagrid-header-over"); -}else{ -td.removeClass("datagrid-header-over"); -} -} -}; -}; -function _86(e){ -var _87=_85(e.target); -var _88=$(_87).datagrid("options"); -var ck=$(e.target).closest("input[type=checkbox]"); -if(ck.length){ -if(_88.singleSelect&&_88.selectOnCheck){ -return false; -} -if(ck.is(":checked")){ -_89(_87); -}else{ -_8a(_87); -} -e.stopPropagation(); -}else{ -var _8b=$(e.target).closest(".datagrid-cell"); -if(_8b.length){ -var p1=_8b.offset().left+5; -var p2=_8b.offset().left+_8b._outerWidth()-5; -if(e.pageXp1){ -_8c(_87,_8b.parent().attr("field")); -} -} -} -}; -function _8d(e){ -var _8e=_85(e.target); -var _8f=$(_8e).datagrid("options"); -var _90=$(e.target).closest(".datagrid-cell"); -if(_90.length){ -var p1=_90.offset().left+5; -var p2=_90.offset().left+_90._outerWidth()-5; -var _91=_8f.resizeHandle=="right"?(e.pageX>p2):(_8f.resizeHandle=="left"?(e.pageXp2)); -if(_91){ -var _92=_90.parent().attr("field"); -var col=_74(_8e,_92); -if(col.resizable==false){ -return; -} -$(_8e).datagrid("autoSizeColumn",_92); -col.auto=false; -} -} -}; -function _93(e){ -var _94=_85(e.target); -var _95=$(_94).datagrid("options"); -var td=$(e.target).closest("td[field]"); -_95.onHeaderContextMenu.call(_94,e,td.attr("field")); -}; -function _96(_97){ -return function(e){ -var tr=_98(e.target); -if(!tr){ -return; -} -var _99=_85(tr); -if($.data(_99,"datagrid").resizing){ -return; -} -var _9a=_9b(tr); -if(_97){ -_9c(_99,_9a); -}else{ -var _9d=$.data(_99,"datagrid").options; -_9d.finder.getTr(_99,_9a).removeClass("datagrid-row-over"); -} -}; -}; -function _9e(e){ -var tr=_98(e.target); -if(!tr){ -return; -} -var _9f=_85(tr); -var _a0=$.data(_9f,"datagrid").options; -var _a1=_9b(tr); -var tt=$(e.target); -if(tt.parent().hasClass("datagrid-cell-check")){ -if(_a0.singleSelect&&_a0.selectOnCheck){ -tt._propAttr("checked",!tt.is(":checked")); -_a2(_9f,_a1); -}else{ -if(tt.is(":checked")){ -tt._propAttr("checked",false); -_a2(_9f,_a1); -}else{ -tt._propAttr("checked",true); -_a3(_9f,_a1); -} -} -}else{ -var row=_a0.finder.getRow(_9f,_a1); -var td=tt.closest("td[field]",tr); -if(td.length){ -var _a4=td.attr("field"); -_a0.onClickCell.call(_9f,_a1,_a4,row[_a4]); -} -if(_a0.singleSelect==true){ -_a5(_9f,_a1); -}else{ -if(_a0.ctrlSelect){ -if(e.metaKey||e.ctrlKey){ -if(tr.hasClass("datagrid-row-selected")){ -_a6(_9f,_a1); -}else{ -_a5(_9f,_a1); -} -}else{ -if(e.shiftKey){ -$(_9f).datagrid("clearSelections"); -var _a7=Math.min(_a0.lastSelectedIndex||0,_a1); -var _a8=Math.max(_a0.lastSelectedIndex||0,_a1); -for(var i=_a7;i<=_a8;i++){ -_a5(_9f,i); -} -}else{ -$(_9f).datagrid("clearSelections"); -_a5(_9f,_a1); -_a0.lastSelectedIndex=_a1; -} -} -}else{ -if(tr.hasClass("datagrid-row-selected")){ -_a6(_9f,_a1); -}else{ -_a5(_9f,_a1); -} -} -} -_a0.onClickRow.apply(_9f,_5(_9f,[_a1,row])); -} -}; -function _a9(e){ -var tr=_98(e.target); -if(!tr){ -return; -} -var _aa=_85(tr); -var _ab=$.data(_aa,"datagrid").options; -var _ac=_9b(tr); -var row=_ab.finder.getRow(_aa,_ac); -var td=$(e.target).closest("td[field]",tr); -if(td.length){ -var _ad=td.attr("field"); -_ab.onDblClickCell.call(_aa,_ac,_ad,row[_ad]); -} -_ab.onDblClickRow.apply(_aa,_5(_aa,[_ac,row])); -}; -function _ae(e){ -var tr=_98(e.target); -if(tr){ -var _af=_85(tr); -var _b0=$.data(_af,"datagrid").options; -var _b1=_9b(tr); -var row=_b0.finder.getRow(_af,_b1); -_b0.onRowContextMenu.call(_af,e,_b1,row); -}else{ -var _b2=_98(e.target,".datagrid-body"); -if(_b2){ -var _af=_85(_b2); -var _b0=$.data(_af,"datagrid").options; -_b0.onRowContextMenu.call(_af,e,-1,null); -} -} -}; -function _85(t){ -return $(t).closest("div.datagrid-view").children(".datagrid-f")[0]; -}; -function _98(t,_b3){ -var tr=$(t).closest(_b3||"tr.datagrid-row"); -if(tr.length&&tr.parent().length){ -return tr; -}else{ -return undefined; -} -}; -function _9b(tr){ -if(tr.attr("datagrid-row-index")){ -return parseInt(tr.attr("datagrid-row-index")); -}else{ -return tr.attr("node-id"); -} -}; -function _8c(_b4,_b5){ -var _b6=$.data(_b4,"datagrid"); -var _b7=_b6.options; -_b5=_b5||{}; -var _b8={sortName:_b7.sortName,sortOrder:_b7.sortOrder}; -if(typeof _b5=="object"){ -$.extend(_b8,_b5); -} -var _b9=[]; -var _ba=[]; -if(_b8.sortName){ -_b9=_b8.sortName.split(","); -_ba=_b8.sortOrder.split(","); -} -if(typeof _b5=="string"){ -var _bb=_b5; -var col=_74(_b4,_bb); -if(!col.sortable||_b6.resizing){ -return; -} -var _bc=col.order||"asc"; -var pos=_2(_b9,_bb); -if(pos>=0){ -var _bd=_ba[pos]=="asc"?"desc":"asc"; -if(_b7.multiSort&&_bd==_bc){ -_b9.splice(pos,1); -_ba.splice(pos,1); -}else{ -_ba[pos]=_bd; -} -}else{ -if(_b7.multiSort){ -_b9.push(_bb); -_ba.push(_bc); -}else{ -_b9=[_bb]; -_ba=[_bc]; -} -} -_b8.sortName=_b9.join(","); -_b8.sortOrder=_ba.join(","); -} -if(_b7.onBeforeSortColumn.call(_b4,_b8.sortName,_b8.sortOrder)==false){ -return; -} -$.extend(_b7,_b8); -var dc=_b6.dc; -var _be=dc.header1.add(dc.header2); -_be.find("div.datagrid-cell").removeClass("datagrid-sort-asc datagrid-sort-desc"); -for(var i=0;i<_b9.length;i++){ -var col=_74(_b4,_b9[i]); -_be.find("div."+col.cellClass).addClass("datagrid-sort-"+_ba[i]); -} -if(_b7.remoteSort){ -_bf(_b4); -}else{ -_c0(_b4,$(_b4).datagrid("getData")); -} -_b7.onSortColumn.call(_b4,_b7.sortName,_b7.sortOrder); -}; -function _c1(_c2,_c3,_c4){ -_c5(true); -_c5(false); -function _c5(_c6){ -var aa=_c7(_c2,_c6); -if(aa.length){ -var _c8=aa[aa.length-1]; -var _c9=_2(_c8,_c3); -if(_c9>=0){ -for(var _ca=0;_ca=_d0.find("table").width()){ -dc.body2.css("overflow-x","hidden"); -} -function _d3(){ -if(!_cf.fitColumns){ -return; -} -if(!_ce.leftWidth){ -_ce.leftWidth=0; -} -var _d4=0; -var cc=[]; -var _d5=_73(_cd,false); -for(var i=0;i<_d5.length;i++){ -var col=_74(_cd,_d5[i]); -if(_d6(col)){ -_d4+=col.width; -cc.push({field:col.field,col:col,addingWidth:0}); -} -} -if(!_d4){ -return; -} -cc[cc.length-1].addingWidth-=_ce.leftWidth; -var _d7=_d0.children("div.datagrid-header-inner").show(); -var _d8=_d0.width()-_d0.find("table").width()-_cf.scrollbarSize+_ce.leftWidth; -var _d9=_d8/_d4; -if(!_cf.showHeader){ -_d7.hide(); -} -for(var i=0;i0){ -c.col.boxWidth+=c.addingWidth; -c.col.width+=c.addingWidth; -} -} -_ce.leftWidth=_d8; -$(_cd).datagrid("fixColumnSize"); -}; -function _d2(){ -var _db=false; -var _dc=_73(_cd,true).concat(_73(_cd,false)); -$.map(_dc,function(_dd){ -var col=_74(_cd,_dd); -if(String(col.width||"").indexOf("%")>=0){ -var _de=$.parser.parseValue("width",col.width,dc.view,_cf.scrollbarSize+(_cf.rownumbers?_cf.rownumberWidth:0))-col.deltaWidth; -if(_de>0){ -col.boxWidth=_de; -_db=true; -} -} -}); -if(_db){ -$(_cd).datagrid("fixColumnSize"); -} -}; -function _d1(fit){ -var _df=dc.header1.add(dc.header2).find(".datagrid-cell-group"); -if(_df.length){ -_df.each(function(){ -$(this)._outerWidth(fit?$(this).parent().width():10); -}); -if(fit){ -_20(_cd); -} -} -}; -function _d6(col){ -if(String(col.width||"").indexOf("%")>=0){ -return false; -} -if(!col.hidden&&!col.checkbox&&!col.auto&&!col.fixed){ -return true; -} -}; -}; -function _e0(_e1,_e2){ -var _e3=$.data(_e1,"datagrid"); -var _e4=_e3.options; -var dc=_e3.dc; -var tmp=$("
").appendTo("body"); -if(_e2){ -_1a(_e2); -$(_e1).datagrid("fitColumns"); -}else{ -var _e5=false; -var _e6=_73(_e1,true).concat(_73(_e1,false)); -for(var i=0;i<_e6.length;i++){ -var _e2=_e6[i]; -var col=_74(_e1,_e2); -if(col.auto){ -_1a(_e2); -_e5=true; -} -} -if(_e5){ -$(_e1).datagrid("fitColumns"); -} -} -tmp.remove(); -function _1a(_e7){ -var _e8=dc.view.find("div.datagrid-header td[field=\""+_e7+"\"] div.datagrid-cell"); -_e8.css("width",""); -var col=$(_e1).datagrid("getColumnOption",_e7); -col.width=undefined; -col.boxWidth=undefined; -col.auto=true; -$(_e1).datagrid("fixColumnSize",_e7); -var _e9=Math.max(_ea("header"),_ea("allbody"),_ea("allfooter"))+1; -_e8._outerWidth(_e9-1); -col.width=_e9; -col.boxWidth=parseInt(_e8[0].style.width); -col.deltaWidth=_e9-col.boxWidth; -_e8.css("width",""); -$(_e1).datagrid("fixColumnSize",_e7); -_e4.onResizeColumn.call(_e1,_e7,col.width); -function _ea(_eb){ -var _ec=0; -if(_eb=="header"){ -_ec=_ed(_e8); -}else{ -_e4.finder.getTr(_e1,0,_eb).find("td[field=\""+_e7+"\"] div.datagrid-cell").each(function(){ -var w=_ed($(this)); -if(_ec1){ -var col=_74(_f8,td.attr("field")); -var _fa=col.boxWidth+col.deltaWidth-1; -for(var i=1;i<_f9;i++){ -td=td.next(); -col=_74(_f8,td.attr("field")); -_fa+=col.boxWidth+col.deltaWidth; -} -$(this).children("div.datagrid-cell")._outerWidth(_fa); -} -}); -}; -function _f6(_fb){ -var dc=$.data(_fb,"datagrid").dc; -dc.view.find("div.datagrid-editable").each(function(){ -var _fc=$(this); -var _fd=_fc.parent().attr("field"); -var col=$(_fb).datagrid("getColumnOption",_fd); -_fc._outerWidth(col.boxWidth+col.deltaWidth-1); -var ed=$.data(this,"datagrid.editor"); -if(ed.actions.resize){ -ed.actions.resize(ed.target,_fc.width()); -} -}); -}; -function _74(_fe,_ff){ -function find(_100){ -if(_100){ -for(var i=0;i<_100.length;i++){ -var cc=_100[i]; -for(var j=0;j=0){ -var _109=col.field||col.id||""; -for(var c=0;c<(col.colspan||1);c++){ -for(var r=0;r<(col.rowspan||1);r++){ -aa[_106+r][_107]=_109; -} -_107++; -} -} -}); -} -return aa; -function _105(){ -var _10a=0; -$.map(_103[0]||[],function(col){ -_10a+=col.colspan||1; -}); -return _10a; -}; -function _108(a){ -for(var i=0;ib?1:-1); -}; -r=_111(r1[sn],r2[sn])*(so=="asc"?1:-1); -if(r!=0){ -return r; -} -} -return r; -}); -} -if(opts.view.onBeforeRender){ -opts.view.onBeforeRender.call(opts.view,_10d,data.rows); -} -opts.view.render.call(opts.view,_10d,dc.body2,false); -opts.view.render.call(opts.view,_10d,dc.body1,true); -if(opts.showFooter){ -opts.view.renderFooter.call(opts.view,_10d,dc.footer2,false); -opts.view.renderFooter.call(opts.view,_10d,dc.footer1,true); -} -if(opts.view.onAfterRender){ -opts.view.onAfterRender.call(opts.view,_10d); -} -_10e.ss.clean(); -var _112=$(_10d).datagrid("getPager"); -if(_112.length){ -var _113=_112.pagination("options"); -if(_113.total!=data.total){ -_112.pagination("refresh",{total:data.total}); -if(opts.pageNumber!=_113.pageNumber&&_113.pageNumber>0){ -opts.pageNumber=_113.pageNumber; -_bf(_10d); -} -} -} -_34(_10d); -dc.body2.triggerHandler("scroll"); -$(_10d).datagrid("setSelectionState"); -$(_10d).datagrid("autoSizeColumn"); -opts.onLoadSuccess.call(_10d,data); -}; -function _114(_115){ -var _116=$.data(_115,"datagrid"); -var opts=_116.options; -var dc=_116.dc; -dc.header1.add(dc.header2).find("input[type=checkbox]")._propAttr("checked",false); -if(opts.idField){ -var _117=$.data(_115,"treegrid")?true:false; -var _118=opts.onSelect; -var _119=opts.onCheck; -opts.onSelect=opts.onCheck=function(){ -}; -var rows=opts.finder.getRows(_115); -for(var i=0;i_12a.height()-_12b){ -_12a.scrollTop(_12a.scrollTop()+top+tr._outerHeight()-_12a.height()+_12b); -} -} -} -}; -function _9c(_12d,_12e){ -var _12f=$.data(_12d,"datagrid"); -var opts=_12f.options; -opts.finder.getTr(_12d,_12f.highlightIndex).removeClass("datagrid-row-over"); -opts.finder.getTr(_12d,_12e).addClass("datagrid-row-over"); -_12f.highlightIndex=_12e; -}; -function _a5(_130,_131,_132,_133){ -var _134=$.data(_130,"datagrid"); -var opts=_134.options; -var row=opts.finder.getRow(_130,_131); -if(!row){ -return; -} -if(opts.onBeforeSelect.apply(_130,_5(_130,[_131,row]))==false){ -return; -} -if(opts.singleSelect){ -_135(_130,true); -_134.selectedRows=[]; -} -if(!_132&&opts.checkOnSelect){ -_a2(_130,_131,true); -} -if(opts.idField){ -_4(_134.selectedRows,opts.idField,row); -} -opts.finder.getTr(_130,_131).addClass("datagrid-row-selected"); -opts.onSelect.apply(_130,_5(_130,[_131,row])); -if(!_133&&opts.scrollOnSelect){ -_125(_130,_131); -} -}; -function _a6(_136,_137,_138){ -var _139=$.data(_136,"datagrid"); -var dc=_139.dc; -var opts=_139.options; -var row=opts.finder.getRow(_136,_137); -if(!row){ -return; -} -if(opts.onBeforeUnselect.apply(_136,_5(_136,[_137,row]))==false){ -return; -} -if(!_138&&opts.checkOnSelect){ -_a3(_136,_137,true); -} -opts.finder.getTr(_136,_137).removeClass("datagrid-row-selected"); -if(opts.idField){ -_3(_139.selectedRows,opts.idField,row[opts.idField]); -} -opts.onUnselect.apply(_136,_5(_136,[_137,row])); -}; -function _13a(_13b,_13c){ -var _13d=$.data(_13b,"datagrid"); -var opts=_13d.options; -var rows=opts.finder.getRows(_13b); -var _13e=$.data(_13b,"datagrid").selectedRows; -if(!_13c&&opts.checkOnSelect){ -_89(_13b,true); -} -opts.finder.getTr(_13b,"","allbody").addClass("datagrid-row-selected"); -if(opts.idField){ -for(var _13f=0;_13f"); -cell.children("table").bind("click dblclick contextmenu",function(e){ -e.stopPropagation(); -}); -$.data(cell[0],"datagrid.editor",{actions:_174,target:_174.init(cell.find("td"),$.extend({height:opts.editorHeight},_173)),field:_171,type:_172,oldHtml:_175}); -} -} -}); -_34(_16f,_170,true); -}; -function _166(_177,_178){ -var opts=$.data(_177,"datagrid").options; -var tr=opts.finder.getTr(_177,_178); -tr.children("td").each(function(){ -var cell=$(this).find("div.datagrid-editable"); -if(cell.length){ -var ed=$.data(cell[0],"datagrid.editor"); -if(ed.actions.destroy){ -ed.actions.destroy(ed.target); -} -cell.html(ed.oldHtml); -$.removeData(cell[0],"datagrid.editor"); -cell.removeClass("datagrid-editable"); -cell.css("width",""); -} -}); -}; -function _159(_179,_17a){ -var tr=$.data(_179,"datagrid").options.finder.getTr(_179,_17a); -if(!tr.hasClass("datagrid-row-editing")){ -return true; -} -var vbox=tr.find(".validatebox-text"); -vbox.validatebox("validate"); -vbox.trigger("mouseleave"); -var _17b=tr.find(".validatebox-invalid"); -return _17b.length==0; -}; -function _17c(_17d,_17e){ -var _17f=$.data(_17d,"datagrid").insertedRows; -var _180=$.data(_17d,"datagrid").deletedRows; -var _181=$.data(_17d,"datagrid").updatedRows; -if(!_17e){ -var rows=[]; -rows=rows.concat(_17f); -rows=rows.concat(_180); -rows=rows.concat(_181); -return rows; -}else{ -if(_17e=="inserted"){ -return _17f; -}else{ -if(_17e=="deleted"){ -return _180; -}else{ -if(_17e=="updated"){ -return _181; -} -} -} -} -return []; -}; -function _182(_183,_184){ -var _185=$.data(_183,"datagrid"); -var opts=_185.options; -var data=_185.data; -var _186=_185.insertedRows; -var _187=_185.deletedRows; -$(_183).datagrid("cancelEdit",_184); -var row=opts.finder.getRow(_183,_184); -if(_2(_186,row)>=0){ -_3(_186,row); -}else{ -_187.push(row); -} -_3(_185.selectedRows,opts.idField,row[opts.idField]); -_3(_185.checkedRows,opts.idField,row[opts.idField]); -opts.view.deleteRow.call(opts.view,_183,_184); -if(opts.height=="auto"){ -_34(_183); -} -$(_183).datagrid("getPager").pagination("refresh",{total:data.total}); -}; -function _188(_189,_18a){ -var data=$.data(_189,"datagrid").data; -var view=$.data(_189,"datagrid").options.view; -var _18b=$.data(_189,"datagrid").insertedRows; -view.insertRow.call(view,_189,_18a.index,_18a.row); -_18b.push(_18a.row); -$(_189).datagrid("getPager").pagination("refresh",{total:data.total}); -}; -function _18c(_18d,row){ -var data=$.data(_18d,"datagrid").data; -var view=$.data(_18d,"datagrid").options.view; -var _18e=$.data(_18d,"datagrid").insertedRows; -view.insertRow.call(view,_18d,null,row); -_18e.push(row); -$(_18d).datagrid("getPager").pagination("refresh",{total:data.total}); -}; -function _18f(_190,_191){ -var _192=$.data(_190,"datagrid"); -var opts=_192.options; -var row=opts.finder.getRow(_190,_191.index); -var _193=false; -_191.row=_191.row||{}; -for(var _194 in _191.row){ -if(row[_194]!==_191.row[_194]){ -_193=true; -break; -} -} -if(_193){ -if(_2(_192.insertedRows,row)==-1){ -if(_2(_192.updatedRows,row)==-1){ -_192.updatedRows.push(row); -} -} -opts.view.updateRow.call(opts.view,_190,_191.index,_191.row); -} -}; -function _195(_196){ -var _197=$.data(_196,"datagrid"); -var data=_197.data; -var rows=data.rows; -var _198=[]; -for(var i=0;i=0){ -(_1a5=="s"?_a5:_a2)(_19c,_1a6,true); -} -} -}; -for(var i=0;i0){ -$(this).datagrid("loadData",data); -}else{ -opts.view.setEmptyMsg(this); -$(this).datagrid("autoSizeColumn"); -} -} -_bf(this); -}); -}; -function _1b6(_1b7){ -var _1b8={}; -$.map(_1b7,function(name){ -_1b8[name]=_1b9(name); -}); -return _1b8; -function _1b9(name){ -function isA(_1ba){ -return $.data($(_1ba)[0],name)!=undefined; -}; -return {init:function(_1bb,_1bc){ -var _1bd=$("").appendTo(_1bb); -if(_1bd[name]&&name!="text"){ -return _1bd[name](_1bc); -}else{ -return _1bd; -} -},destroy:function(_1be){ -if(isA(_1be,name)){ -$(_1be)[name]("destroy"); -} -},getValue:function(_1bf){ -if(isA(_1bf,name)){ -var opts=$(_1bf)[name]("options"); -if(opts.multiple){ -return $(_1bf)[name]("getValues").join(opts.separator); -}else{ -return $(_1bf)[name]("getValue"); -} -}else{ -return $(_1bf).val(); -} -},setValue:function(_1c0,_1c1){ -if(isA(_1c0,name)){ -var opts=$(_1c0)[name]("options"); -if(opts.multiple){ -if(_1c1){ -$(_1c0)[name]("setValues",_1c1.split(opts.separator)); -}else{ -$(_1c0)[name]("clear"); -} -}else{ -$(_1c0)[name]("setValue",_1c1); -} -}else{ -$(_1c0).val(_1c1); -} -},resize:function(_1c2,_1c3){ -if(isA(_1c2,name)){ -$(_1c2)[name]("resize",_1c3); -}else{ -$(_1c2)._size({width:_1c3,height:$.fn.datagrid.defaults.editorHeight}); -} -}}; -}; -}; -var _1c4=$.extend({},_1b6(["text","textbox","passwordbox","filebox","numberbox","numberspinner","combobox","combotree","combogrid","combotreegrid","datebox","datetimebox","timespinner","datetimespinner"]),{textarea:{init:function(_1c5,_1c6){ -var _1c7=$("").appendTo(_1c5); -_1c7.css("vertical-align","middle")._outerHeight(_1c6.height); -return _1c7; -},getValue:function(_1c8){ -return $(_1c8).val(); -},setValue:function(_1c9,_1ca){ -$(_1c9).val(_1ca); -},resize:function(_1cb,_1cc){ -$(_1cb)._outerWidth(_1cc); -}},checkbox:{init:function(_1cd,_1ce){ -var _1cf=$("").appendTo(_1cd); -_1cf.val(_1ce.on); -_1cf.attr("offval",_1ce.off); -return _1cf; -},getValue:function(_1d0){ -if($(_1d0).is(":checked")){ -return $(_1d0).val(); -}else{ -return $(_1d0).attr("offval"); -} -},setValue:function(_1d1,_1d2){ -var _1d3=false; -if($(_1d1).val()==_1d2){ -_1d3=true; -} -$(_1d1)._propAttr("checked",_1d3); -}},validatebox:{init:function(_1d4,_1d5){ -var _1d6=$("").appendTo(_1d4); -_1d6.validatebox(_1d5); -return _1d6; -},destroy:function(_1d7){ -$(_1d7).validatebox("destroy"); -},getValue:function(_1d8){ -return $(_1d8).val(); -},setValue:function(_1d9,_1da){ -$(_1d9).val(_1da); -},resize:function(_1db,_1dc){ -$(_1db)._outerWidth(_1dc)._outerHeight($.fn.datagrid.defaults.editorHeight); -}}}); -$.fn.datagrid.methods={options:function(jq){ -var _1dd=$.data(jq[0],"datagrid").options; -var _1de=$.data(jq[0],"datagrid").panel.panel("options"); -var opts=$.extend(_1dd,{width:_1de.width,height:_1de.height,closed:_1de.closed,collapsed:_1de.collapsed,minimized:_1de.minimized,maximized:_1de.maximized}); -return opts; -},setSelectionState:function(jq){ -return jq.each(function(){ -_114(this); -}); -},createStyleSheet:function(jq){ -return _7(jq[0]); -},getPanel:function(jq){ -return $.data(jq[0],"datagrid").panel; -},getPager:function(jq){ -return $.data(jq[0],"datagrid").panel.children("div.datagrid-pager"); -},getColumnFields:function(jq,_1df){ -return _73(jq[0],_1df); -},getColumnOption:function(jq,_1e0){ -return _74(jq[0],_1e0); -},resize:function(jq,_1e1){ -return jq.each(function(){ -_1a(this,_1e1); -}); -},load:function(jq,_1e2){ -return jq.each(function(){ -var opts=$(this).datagrid("options"); -if(typeof _1e2=="string"){ -opts.url=_1e2; -_1e2=null; -} -opts.pageNumber=1; -var _1e3=$(this).datagrid("getPager"); -_1e3.pagination("refresh",{pageNumber:1}); -_bf(this,_1e2); -}); -},reload:function(jq,_1e4){ -return jq.each(function(){ -var opts=$(this).datagrid("options"); -if(typeof _1e4=="string"){ -opts.url=_1e4; -_1e4=null; -} -_bf(this,_1e4); -}); -},reloadFooter:function(jq,_1e5){ -return jq.each(function(){ -var opts=$.data(this,"datagrid").options; -var dc=$.data(this,"datagrid").dc; -if(_1e5){ -$.data(this,"datagrid").footer=_1e5; -} -if(opts.showFooter){ -opts.view.renderFooter.call(opts.view,this,dc.footer2,false); -opts.view.renderFooter.call(opts.view,this,dc.footer1,true); -if(opts.view.onAfterRender){ -opts.view.onAfterRender.call(opts.view,this); -} -$(this).datagrid("fixRowHeight"); -} -}); -},loading:function(jq){ -return jq.each(function(){ -var opts=$.data(this,"datagrid").options; -$(this).datagrid("getPager").pagination("loading"); -if(opts.loadMsg){ -var _1e6=$(this).datagrid("getPanel"); -if(!_1e6.children("div.datagrid-mask").length){ -$("
").appendTo(_1e6); -var msg=$("
").html(opts.loadMsg).appendTo(_1e6); -msg._outerHeight(40); -msg.css({marginLeft:(-msg.outerWidth()/2),lineHeight:(msg.height()+"px")}); -} -} -}); -},loaded:function(jq){ -return jq.each(function(){ -$(this).datagrid("getPager").pagination("loaded"); -var _1e7=$(this).datagrid("getPanel"); -_1e7.children("div.datagrid-mask-msg").remove(); -_1e7.children("div.datagrid-mask").remove(); -}); -},fitColumns:function(jq){ -return jq.each(function(){ -_cc(this); -}); -},fixColumnSize:function(jq,_1e8){ -return jq.each(function(){ -_ef(this,_1e8); -}); -},fixRowHeight:function(jq,_1e9){ -return jq.each(function(){ -_34(this,_1e9); -}); -},freezeRow:function(jq,_1ea){ -return jq.each(function(){ -_45(this,_1ea); -}); -},autoSizeColumn:function(jq,_1eb){ -return jq.each(function(){ -_e0(this,_1eb); -}); -},loadData:function(jq,data){ -return jq.each(function(){ -_c0(this,data); -_195(this); -}); -},getData:function(jq){ -return $.data(jq[0],"datagrid").data; -},getRows:function(jq){ -return $.data(jq[0],"datagrid").data.rows; -},getFooterRows:function(jq){ -return $.data(jq[0],"datagrid").footer; -},getRowIndex:function(jq,id){ -return _11c(jq[0],id); -},getChecked:function(jq){ -return _122(jq[0]); -},getSelected:function(jq){ -var rows=_11f(jq[0]); -return rows.length>0?rows[0]:null; -},getSelections:function(jq){ -return _11f(jq[0]); -},clearSelections:function(jq){ -return jq.each(function(){ -var _1ec=$.data(this,"datagrid"); -var _1ed=_1ec.selectedRows; -var _1ee=_1ec.checkedRows; -_1ed.splice(0,_1ed.length); -_135(this); -if(_1ec.options.checkOnSelect){ -_1ee.splice(0,_1ee.length); -} -}); -},clearChecked:function(jq){ -return jq.each(function(){ -var _1ef=$.data(this,"datagrid"); -var _1f0=_1ef.selectedRows; -var _1f1=_1ef.checkedRows; -_1f1.splice(0,_1f1.length); -_8a(this); -if(_1ef.options.selectOnCheck){ -_1f0.splice(0,_1f0.length); -} -}); -},scrollTo:function(jq,_1f2){ -return jq.each(function(){ -_125(this,_1f2); -}); -},highlightRow:function(jq,_1f3){ -return jq.each(function(){ -_9c(this,_1f3); -_125(this,_1f3); -}); -},selectAll:function(jq){ -return jq.each(function(){ -_13a(this); -}); -},unselectAll:function(jq){ -return jq.each(function(){ -_135(this); -}); -},selectRow:function(jq,_1f4){ -return jq.each(function(){ -_a5(this,_1f4); -}); -},selectRecord:function(jq,id){ -return jq.each(function(){ -var opts=$.data(this,"datagrid").options; -if(opts.idField){ -var _1f5=_11c(this,id); -if(_1f5>=0){ -$(this).datagrid("selectRow",_1f5); -} -} -}); -},unselectRow:function(jq,_1f6){ -return jq.each(function(){ -_a6(this,_1f6); -}); -},checkRow:function(jq,_1f7){ -return jq.each(function(){ -_a2(this,_1f7); -}); -},uncheckRow:function(jq,_1f8){ -return jq.each(function(){ -_a3(this,_1f8); -}); -},checkAll:function(jq){ -return jq.each(function(){ -_89(this); -}); -},uncheckAll:function(jq){ -return jq.each(function(){ -_8a(this); -}); -},beginEdit:function(jq,_1f9){ -return jq.each(function(){ -_154(this,_1f9); -}); -},endEdit:function(jq,_1fa){ -return jq.each(function(){ -_15a(this,_1fa,false); -}); -},cancelEdit:function(jq,_1fb){ -return jq.each(function(){ -_15a(this,_1fb,true); -}); -},getEditors:function(jq,_1fc){ -return _167(jq[0],_1fc); -},getEditor:function(jq,_1fd){ -return _16b(jq[0],_1fd); -},refreshRow:function(jq,_1fe){ -return jq.each(function(){ -var opts=$.data(this,"datagrid").options; -opts.view.refreshRow.call(opts.view,this,_1fe); -}); -},validateRow:function(jq,_1ff){ -return _159(jq[0],_1ff); -},updateRow:function(jq,_200){ -return jq.each(function(){ -_18f(this,_200); -}); -},appendRow:function(jq,row){ -return jq.each(function(){ -_18c(this,row); -}); -},insertRow:function(jq,_201){ -return jq.each(function(){ -_188(this,_201); -}); -},deleteRow:function(jq,_202){ -return jq.each(function(){ -_182(this,_202); -}); -},getChanges:function(jq,_203){ -return _17c(jq[0],_203); -},acceptChanges:function(jq){ -return jq.each(function(){ -_199(this); -}); -},rejectChanges:function(jq){ -return jq.each(function(){ -_19b(this); -}); -},mergeCells:function(jq,_204){ -return jq.each(function(){ -_1ad(this,_204); -}); -},showColumn:function(jq,_205){ -return jq.each(function(){ -var col=$(this).datagrid("getColumnOption",_205); -if(col.hidden){ -col.hidden=false; -$(this).datagrid("getPanel").find("td[field=\""+_205+"\"]").show(); -_c1(this,_205,1); -$(this).datagrid("fitColumns"); -} -}); -},hideColumn:function(jq,_206){ -return jq.each(function(){ -var col=$(this).datagrid("getColumnOption",_206); -if(!col.hidden){ -col.hidden=true; -$(this).datagrid("getPanel").find("td[field=\""+_206+"\"]").hide(); -_c1(this,_206,-1); -$(this).datagrid("fitColumns"); -} -}); -},sort:function(jq,_207){ -return jq.each(function(){ -_8c(this,_207); -}); -},gotoPage:function(jq,_208){ -return jq.each(function(){ -var _209=this; -var page,cb; -if(typeof _208=="object"){ -page=_208.page; -cb=_208.callback; -}else{ -page=_208; -} -$(_209).datagrid("options").pageNumber=page; -$(_209).datagrid("getPager").pagination("refresh",{pageNumber:page}); -_bf(_209,null,function(){ -if(cb){ -cb.call(_209,page); -} -}); -}); -}}; -$.fn.datagrid.parseOptions=function(_20a){ -var t=$(_20a); -return $.extend({},$.fn.panel.parseOptions(_20a),$.parser.parseOptions(_20a,["url","toolbar","idField","sortName","sortOrder","pagePosition","resizeHandle",{sharedStyleSheet:"boolean",fitColumns:"boolean",autoRowHeight:"boolean",striped:"boolean",nowrap:"boolean"},{rownumbers:"boolean",singleSelect:"boolean",ctrlSelect:"boolean",checkOnSelect:"boolean",selectOnCheck:"boolean"},{pagination:"boolean",pageSize:"number",pageNumber:"number"},{multiSort:"boolean",remoteSort:"boolean",showHeader:"boolean",showFooter:"boolean"},{scrollbarSize:"number",scrollOnSelect:"boolean"}]),{pageList:(t.attr("pageList")?eval(t.attr("pageList")):undefined),loadMsg:(t.attr("loadMsg")!=undefined?t.attr("loadMsg"):undefined),rowStyler:(t.attr("rowStyler")?eval(t.attr("rowStyler")):undefined)}); -}; -$.fn.datagrid.parseData=function(_20b){ -var t=$(_20b); -var data={total:0,rows:[]}; -var _20c=t.datagrid("getColumnFields",true).concat(t.datagrid("getColumnFields",false)); -t.find("tbody tr").each(function(){ -data.total++; -var row={}; -$.extend(row,$.parser.parseOptions(this,["iconCls","state"])); -for(var i=0;i<_20c.length;i++){ -row[_20c[i]]=$(this).find("td:eq("+i+")").html(); -} -data.rows.push(row); -}); -return data; -}; -var _20d={render:function(_20e,_20f,_210){ -var rows=$(_20e).datagrid("getRows"); -$(_20f).html(this.renderTable(_20e,0,rows,_210)); -},renderFooter:function(_211,_212,_213){ -var opts=$.data(_211,"datagrid").options; -var rows=$.data(_211,"datagrid").footer||[]; -var _214=$(_211).datagrid("getColumnFields",_213); -var _215=[""]; -for(var i=0;i"); -_215.push(this.renderRow.call(this,_211,_214,_213,i,rows[i])); -_215.push(""); -} -_215.push("
"); -$(_212).html(_215.join("")); -},renderTable:function(_216,_217,rows,_218){ -var _219=$.data(_216,"datagrid"); -var opts=_219.options; -if(_218){ -if(!(opts.rownumbers||(opts.frozenColumns&&opts.frozenColumns.length))){ -return ""; -} -} -var _21a=$(_216).datagrid("getColumnFields",_218); -var _21b=[""]; -for(var i=0;i"); -_21b.push(this.renderRow.call(this,_216,_21a,_218,_217,row)); -_21b.push(""); -_217++; -} -_21b.push("
"); -return _21b.join(""); -},renderRow:function(_21e,_21f,_220,_221,_222){ -var opts=$.data(_21e,"datagrid").options; -var cc=[]; -if(_220&&opts.rownumbers){ -var _223=_221+1; -if(opts.pagination){ -_223+=(opts.pageNumber-1)*opts.pageSize; -} -cc.push("
"+_223+"
"); -} -for(var i=0;i<_21f.length;i++){ -var _224=_21f[i]; -var col=$(_21e).datagrid("getColumnOption",_224); -if(col){ -var _225=_222[_224]; -var css=col.styler?(col.styler.call(_21e,_225,_222,_221)||""):""; -var cs=this.getStyleValue(css); -var cls=cs.c?"class=\""+cs.c+"\"":""; -var _226=col.hidden?"style=\"display:none;"+cs.s+"\"":(cs.s?"style=\""+cs.s+"\"":""); -cc.push(""); -var _226=""; -if(!col.checkbox){ -if(col.align){ -_226+="text-align:"+col.align+";"; -} -if(!opts.nowrap){ -_226+="white-space:normal;height:auto;"; -}else{ -if(opts.autoRowHeight){ -_226+="height:auto;"; -} -} -} -cc.push("
"); -if(col.checkbox){ -cc.push(""); -}else{ -if(col.formatter){ -cc.push(col.formatter(_225,_222,_221)); -}else{ -cc.push(_225); -} -} -cc.push("
"); -cc.push(""); -} -} -return cc.join(""); -},getStyleValue:function(css){ -var _227=""; -var _228=""; -if(typeof css=="string"){ -_228=css; -}else{ -if(css){ -_227=css["class"]||""; -_228=css["style"]||""; -} -} -return {c:_227,s:_228}; -},refreshRow:function(_229,_22a){ -this.updateRow.call(this,_229,_22a,{}); -},updateRow:function(_22b,_22c,row){ -var opts=$.data(_22b,"datagrid").options; -var _22d=opts.finder.getRow(_22b,_22c); -$.extend(_22d,row); -var cs=_22e.call(this,_22c); -var _22f=cs.s; -var cls="datagrid-row "+(_22c%2&&opts.striped?"datagrid-row-alt ":" ")+cs.c; -function _22e(_230){ -var css=opts.rowStyler?opts.rowStyler.call(_22b,_230,_22d):""; -return this.getStyleValue(css); -}; -function _231(_232){ -var tr=opts.finder.getTr(_22b,_22c,"body",(_232?1:2)); -if(!tr.length){ -return; -} -var _233=$(_22b).datagrid("getColumnFields",_232); -var _234=tr.find("div.datagrid-cell-check input[type=checkbox]").is(":checked"); -tr.html(this.renderRow.call(this,_22b,_233,_232,_22c,_22d)); -var _235=(tr.hasClass("datagrid-row-checked")?" datagrid-row-checked":"")+(tr.hasClass("datagrid-row-selected")?" datagrid-row-selected":""); -tr.attr("style",_22f).attr("class",cls+_235); -if(_234){ -tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked",true); -} -}; -_231.call(this,true); -_231.call(this,false); -$(_22b).datagrid("fixRowHeight",_22c); -},insertRow:function(_236,_237,row){ -var _238=$.data(_236,"datagrid"); -var opts=_238.options; -var dc=_238.dc; -var data=_238.data; -if(_237==undefined||_237==null){ -_237=data.rows.length; -} -if(_237>data.rows.length){ -_237=data.rows.length; -} -function _239(_23a){ -var _23b=_23a?1:2; -for(var i=data.rows.length-1;i>=_237;i--){ -var tr=opts.finder.getTr(_236,i,"body",_23b); -tr.attr("datagrid-row-index",i+1); -tr.attr("id",_238.rowIdPrefix+"-"+_23b+"-"+(i+1)); -if(_23a&&opts.rownumbers){ -var _23c=i+2; -if(opts.pagination){ -_23c+=(opts.pageNumber-1)*opts.pageSize; -} -tr.find("div.datagrid-cell-rownumber").html(_23c); -} -if(opts.striped){ -tr.removeClass("datagrid-row-alt").addClass((i+1)%2?"datagrid-row-alt":""); -} -} -}; -function _23d(_23e){ -var _23f=_23e?1:2; -var _240=$(_236).datagrid("getColumnFields",_23e); -var _241=_238.rowIdPrefix+"-"+_23f+"-"+_237; -var tr=""; -if(_237>=data.rows.length){ -if(data.rows.length){ -opts.finder.getTr(_236,"","last",_23f).after(tr); -}else{ -var cc=_23e?dc.body1:dc.body2; -cc.html(""+tr+"
"); -} -}else{ -opts.finder.getTr(_236,_237+1,"body",_23f).before(tr); -} -}; -_239.call(this,true); -_239.call(this,false); -_23d.call(this,true); -_23d.call(this,false); -data.total+=1; -data.rows.splice(_237,0,row); -this.setEmptyMsg(_236); -this.refreshRow.call(this,_236,_237); -},deleteRow:function(_242,_243){ -var _244=$.data(_242,"datagrid"); -var opts=_244.options; -var data=_244.data; -function _245(_246){ -var _247=_246?1:2; -for(var i=_243+1;i").appendTo(_24e.dc.view); -d.html(opts.emptyMsg).css("top",h+"px"); -} -} -},renderEmptyRow:function(_250){ -var cols=$.map($(_250).datagrid("getColumnFields"),function(_251){ -return $(_250).datagrid("getColumnOption",_251); -}); -$.map(cols,function(col){ -col.formatter1=col.formatter; -col.styler1=col.styler; -col.formatter=col.styler=undefined; -}); -var _252=$.data(_250,"datagrid").dc.body2; -_252.html(this.renderTable(_250,0,[{}],false)); -_252.find("tbody *").css({height:1,borderColor:"transparent",background:"transparent"}); -var tr=_252.find(".datagrid-row"); -tr.removeClass("datagrid-row").removeAttr("datagrid-row-index"); -tr.find(".datagrid-cell,.datagrid-cell-check").empty(); -$.map(cols,function(col){ -col.formatter=col.formatter1; -col.styler=col.styler1; -col.formatter1=col.styler1=undefined; -}); -}}; -$.fn.datagrid.defaults=$.extend({},$.fn.panel.defaults,{sharedStyleSheet:false,frozenColumns:undefined,columns:undefined,fitColumns:false,resizeHandle:"right",autoRowHeight:true,toolbar:null,striped:false,method:"post",nowrap:true,idField:null,url:null,data:null,loadMsg:"Processing, please wait ...",emptyMsg:"",rownumbers:false,singleSelect:false,ctrlSelect:false,selectOnCheck:true,checkOnSelect:true,pagination:false,pagePosition:"bottom",pageNumber:1,pageSize:10,pageList:[10,20,30,40,50],queryParams:{},sortName:null,sortOrder:"asc",multiSort:false,remoteSort:true,showHeader:true,showFooter:false,scrollOnSelect:true,scrollbarSize:18,rownumberWidth:30,editorHeight:24,headerEvents:{mouseover:_82(true),mouseout:_82(false),click:_86,dblclick:_8d,contextmenu:_93},rowEvents:{mouseover:_96(true),mouseout:_96(false),click:_9e,dblclick:_a9,contextmenu:_ae},rowStyler:function(_253,_254){ -},loader:function(_255,_256,_257){ -var opts=$(this).datagrid("options"); -if(!opts.url){ -return false; -} -$.ajax({type:opts.method,url:opts.url,data:_255,dataType:"json",success:function(data){ -_256(data); -},error:function(){ -_257.apply(this,arguments); -}}); -},loadFilter:function(data){ -return data; -},editors:_1c4,finder:{getTr:function(_258,_259,type,_25a){ -type=type||"body"; -_25a=_25a||0; -var _25b=$.data(_258,"datagrid"); -var dc=_25b.dc; -var opts=_25b.options; -if(_25a==0){ -var tr1=opts.finder.getTr(_258,_259,type,1); -var tr2=opts.finder.getTr(_258,_259,type,2); -return tr1.add(tr2); -}else{ -if(type=="body"){ -var tr=$("#"+_25b.rowIdPrefix+"-"+_25a+"-"+_259); -if(!tr.length){ -tr=(_25a==1?dc.body1:dc.body2).find(">table>tbody>tr[datagrid-row-index="+_259+"]"); -} -return tr; -}else{ -if(type=="footer"){ -return (_25a==1?dc.footer1:dc.footer2).find(">table>tbody>tr[datagrid-row-index="+_259+"]"); -}else{ -if(type=="selected"){ -return (_25a==1?dc.body1:dc.body2).find(">table>tbody>tr.datagrid-row-selected"); -}else{ -if(type=="highlight"){ -return (_25a==1?dc.body1:dc.body2).find(">table>tbody>tr.datagrid-row-over"); -}else{ -if(type=="checked"){ -return (_25a==1?dc.body1:dc.body2).find(">table>tbody>tr.datagrid-row-checked"); -}else{ -if(type=="editing"){ -return (_25a==1?dc.body1:dc.body2).find(">table>tbody>tr.datagrid-row-editing"); -}else{ -if(type=="last"){ -return (_25a==1?dc.body1:dc.body2).find(">table>tbody>tr[datagrid-row-index]:last"); -}else{ -if(type=="allbody"){ -return (_25a==1?dc.body1:dc.body2).find(">table>tbody>tr[datagrid-row-index]"); -}else{ -if(type=="allfooter"){ -return (_25a==1?dc.footer1:dc.footer2).find(">table>tbody>tr[datagrid-row-index]"); -} -} -} -} -} -} -} -} -} -} -},getRow:function(_25c,p){ -var _25d=(typeof p=="object")?p.attr("datagrid-row-index"):p; -return $.data(_25c,"datagrid").data.rows[parseInt(_25d)]; -},getRows:function(_25e){ -return $(_25e).datagrid("getRows"); -}},view:_20d,onBeforeLoad:function(_25f){ -},onLoadSuccess:function(){ -},onLoadError:function(){ -},onClickRow:function(_260,_261){ -},onDblClickRow:function(_262,_263){ -},onClickCell:function(_264,_265,_266){ -},onDblClickCell:function(_267,_268,_269){ -},onBeforeSortColumn:function(sort,_26a){ -},onSortColumn:function(sort,_26b){ -},onResizeColumn:function(_26c,_26d){ -},onBeforeSelect:function(_26e,_26f){ -},onSelect:function(_270,_271){ -},onBeforeUnselect:function(_272,_273){ -},onUnselect:function(_274,_275){ -},onSelectAll:function(rows){ -},onUnselectAll:function(rows){ -},onBeforeCheck:function(_276,_277){ -},onCheck:function(_278,_279){ -},onBeforeUncheck:function(_27a,_27b){ -},onUncheck:function(_27c,_27d){ -},onCheckAll:function(rows){ -},onUncheckAll:function(rows){ -},onBeforeEdit:function(_27e,_27f){ -},onBeginEdit:function(_280,_281){ -},onEndEdit:function(_282,_283,_284){ -},onAfterEdit:function(_285,_286,_287){ -},onCancelEdit:function(_288,_289){ -},onHeaderContextMenu:function(e,_28a){ -},onRowContextMenu:function(e,_28b,_28c){ -}}); -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +var _1=0; +function _2(a,o){ +return $.easyui.indexOfArray(a,o); +}; +function _3(a,o,id){ +$.easyui.removeArrayItem(a,o,id); +}; +function _4(a,o,r){ +$.easyui.addArrayItem(a,o,r); +}; +function _5(_6,aa){ +return $.data(_6,"treegrid")?aa.slice(1):aa; +}; +function _7(_8){ +var _9=$.data(_8,"datagrid"); +var _a=_9.options; +var _b=_9.panel; +var dc=_9.dc; +var ss=null; +if(_a.sharedStyleSheet){ +ss=typeof _a.sharedStyleSheet=="boolean"?"head":_a.sharedStyleSheet; +}else{ +ss=_b.closest("div.datagrid-view"); +if(!ss.length){ +ss=dc.view; +} +} +var cc=$(ss); +var _c=$.data(cc[0],"ss"); +if(!_c){ +_c=$.data(cc[0],"ss",{cache:{},dirty:[]}); +} +return {add:function(_d){ +var ss=[""); +$(ss.join("\n")).appendTo(cc); +cc.children("style[easyui]:not(:last)").remove(); +},getRule:function(_10){ +var _11=cc.children("style[easyui]:last")[0]; +var _12=_11.styleSheet?_11.styleSheet:(_11.sheet||document.styleSheets[document.styleSheets.length-1]); +var _13=_12.cssRules||_12.rules; +return _13[_10]; +},set:function(_14,_15){ +var _16=_c.cache[_14]; +if(_16){ +_16.width=_15; +var _17=this.getRule(_16.index); +if(_17){ +_17.style["width"]=_15; +} +} +},remove:function(_18){ +var tmp=[]; +for(var s in _c.cache){ +if(s.indexOf(_18)==-1){ +tmp.push([s,_c.cache[s].width]); +} +} +_c.cache={}; +this.add(tmp); +},dirty:function(_19){ +if(_19){ +_c.dirty.push(_19); +} +},clean:function(){ +for(var i=0;i<_c.dirty.length;i++){ +this.remove(_c.dirty[i]); +} +_c.dirty=[]; +}}; +}; +function _1a(_1b,_1c){ +var _1d=$.data(_1b,"datagrid"); +var _1e=_1d.options; +var _1f=_1d.panel; +if(_1c){ +$.extend(_1e,_1c); +} +if(_1e.fit==true){ +var p=_1f.panel("panel").parent(); +_1e.width=p.width(); +_1e.height=p.height(); +} +_1f.panel("resize",_1e); +}; +function _20(_21){ +var _22=$.data(_21,"datagrid"); +var _23=_22.options; +var dc=_22.dc; +var _24=_22.panel; +var _25=_24.width(); +var _26=_24.height(); +var _27=dc.view; +var _28=dc.view1; +var _29=dc.view2; +var _2a=_28.children("div.datagrid-header"); +var _2b=_29.children("div.datagrid-header"); +var _2c=_2a.find("table"); +var _2d=_2b.find("table"); +_27.width(_25); +var _2e=_2a.children("div.datagrid-header-inner").show(); +_28.width(_2e.find("table").width()); +if(!_23.showHeader){ +_2e.hide(); +} +_29.width(_25-_28._outerWidth()); +_28.children()._outerWidth(_28.width()); +_29.children()._outerWidth(_29.width()); +var all=_2a.add(_2b).add(_2c).add(_2d); +all.css("height",""); +var hh=Math.max(_2c.height(),_2d.height()); +all._outerHeight(hh); +_27.children(".datagrid-empty").css("top",hh+"px"); +dc.body1.add(dc.body2).children("table.datagrid-btable-frozen").css({position:"absolute",top:dc.header2._outerHeight()}); +var _2f=dc.body2.children("table.datagrid-btable-frozen")._outerHeight(); +var _30=_2f+_2b._outerHeight()+_29.children(".datagrid-footer")._outerHeight(); +_24.children(":not(.datagrid-view,.datagrid-mask,.datagrid-mask-msg)").each(function(){ +_30+=$(this)._outerHeight(); +}); +var _31=_24.outerHeight()-_24.height(); +var _32=_24._size("minHeight")||""; +var _33=_24._size("maxHeight")||""; +_28.add(_29).children("div.datagrid-body").css({marginTop:_2f,height:(isNaN(parseInt(_23.height))?"":(_26-_30)),minHeight:(_32?_32-_31-_30:""),maxHeight:(_33?_33-_31-_30:"")}); +_27.height(_29.height()); +}; +function _34(_35,_36,_37){ +var _38=$.data(_35,"datagrid").data.rows; +var _39=$.data(_35,"datagrid").options; +var dc=$.data(_35,"datagrid").dc; +if(!dc.body1.is(":empty")&&(!_39.nowrap||_39.autoRowHeight||_37)){ +if(_36!=undefined){ +var tr1=_39.finder.getTr(_35,_36,"body",1); +var tr2=_39.finder.getTr(_35,_36,"body",2); +_3a(tr1,tr2); +}else{ +var tr1=_39.finder.getTr(_35,0,"allbody",1); +var tr2=_39.finder.getTr(_35,0,"allbody",2); +_3a(tr1,tr2); +if(_39.showFooter){ +var tr1=_39.finder.getTr(_35,0,"allfooter",1); +var tr2=_39.finder.getTr(_35,0,"allfooter",2); +_3a(tr1,tr2); +} +} +} +_20(_35); +if(_39.height=="auto"){ +var _3b=dc.body1.parent(); +var _3c=dc.body2; +var _3d=_3e(_3c); +var _3f=_3d.height; +if(_3d.width>_3c.width()){ +_3f+=18; +} +_3f-=parseInt(_3c.css("marginTop"))||0; +_3b.height(_3f); +_3c.height(_3f); +dc.view.height(dc.view2.height()); +} +dc.body2.triggerHandler("scroll"); +function _3a(_40,_41){ +for(var i=0;i<_41.length;i++){ +var tr1=$(_40[i]); +var tr2=$(_41[i]); +tr1.css("height",""); +tr2.css("height",""); +var _42=Math.max(tr1.height(),tr2.height()); +tr1.css("height",_42); +tr2.css("height",_42); +} +}; +function _3e(cc){ +var _43=0; +var _44=0; +$(cc).children().each(function(){ +var c=$(this); +if(c.is(":visible")){ +_44+=c._outerHeight(); +if(_43"); +} +_4a(true); +_4a(false); +_20(_46); +function _4a(_4b){ +var _4c=_4b?1:2; +var tr=_49.finder.getTr(_46,_47,"body",_4c); +(_4b?dc.body1:dc.body2).children("table.datagrid-btable-frozen").append(tr); +}; +}; +function _4d(_4e,_4f){ +function _50(){ +var _51=[]; +var _52=[]; +$(_4e).children("thead").each(function(){ +var opt=$.parser.parseOptions(this,[{frozen:"boolean"}]); +$(this).find("tr").each(function(){ +var _53=[]; +$(this).find("th").each(function(){ +var th=$(this); +var col=$.extend({},$.parser.parseOptions(this,["id","field","align","halign","order","width",{sortable:"boolean",checkbox:"boolean",resizable:"boolean",fixed:"boolean"},{rowspan:"number",colspan:"number"}]),{title:(th.html()||undefined),hidden:(th.attr("hidden")?true:undefined),formatter:(th.attr("formatter")?eval(th.attr("formatter")):undefined),styler:(th.attr("styler")?eval(th.attr("styler")):undefined),sorter:(th.attr("sorter")?eval(th.attr("sorter")):undefined)}); +if(col.width&&String(col.width).indexOf("%")==-1){ +col.width=parseInt(col.width); +} +if(th.attr("editor")){ +var s=$.trim(th.attr("editor")); +if(s.substr(0,1)=="{"){ +col.editor=eval("("+s+")"); +}else{ +col.editor=s; +} +} +_53.push(col); +}); +opt.frozen?_51.push(_53):_52.push(_53); +}); +}); +return [_51,_52]; +}; +var _54=$("
"+"
"+"
"+"
"+"
"+"
"+"
"+"
"+"
"+"
"+""+"
"+"
"+"
"+"
"+"
"+"
"+"
"+"
"+""+"
"+"
"+"
"+"
").insertAfter(_4e); +_54.panel({doSize:false,cls:"datagrid"}); +$(_4e).addClass("datagrid-f").hide().appendTo(_54.children("div.datagrid-view")); +var cc=_50(); +var _55=_54.children("div.datagrid-view"); +var _56=_55.children("div.datagrid-view1"); +var _57=_55.children("div.datagrid-view2"); +return {panel:_54,frozenColumns:cc[0],columns:cc[1],dc:{view:_55,view1:_56,view2:_57,header1:_56.children("div.datagrid-header").children("div.datagrid-header-inner"),header2:_57.children("div.datagrid-header").children("div.datagrid-header-inner"),body1:_56.children("div.datagrid-body").children("div.datagrid-body-inner"),body2:_57.children("div.datagrid-body"),footer1:_56.children("div.datagrid-footer").children("div.datagrid-footer-inner"),footer2:_57.children("div.datagrid-footer").children("div.datagrid-footer-inner")}}; +}; +function _58(_59){ +var _5a=$.data(_59,"datagrid"); +var _5b=_5a.options; +var dc=_5a.dc; +var _5c=_5a.panel; +_5a.ss=$(_59).datagrid("createStyleSheet"); +_5c.panel($.extend({},_5b,{id:null,doSize:false,onResize:function(_5d,_5e){ +if($.data(_59,"datagrid")){ +_20(_59); +$(_59).datagrid("fitColumns"); +_5b.onResize.call(_5c,_5d,_5e); +} +},onExpand:function(){ +if($.data(_59,"datagrid")){ +$(_59).datagrid("fixRowHeight").datagrid("fitColumns"); +_5b.onExpand.call(_5c); +} +}})); +_5a.rowIdPrefix="datagrid-row-r"+(++_1); +_5a.cellClassPrefix="datagrid-cell-c"+_1; +_5f(dc.header1,_5b.frozenColumns,true); +_5f(dc.header2,_5b.columns,false); +_60(); +dc.header1.add(dc.header2).css("display",_5b.showHeader?"block":"none"); +dc.footer1.add(dc.footer2).css("display",_5b.showFooter?"block":"none"); +if(_5b.toolbar){ +if($.isArray(_5b.toolbar)){ +$("div.datagrid-toolbar",_5c).remove(); +var tb=$("
").prependTo(_5c); +var tr=tb.find("tr"); +for(var i=0;i<_5b.toolbar.length;i++){ +var btn=_5b.toolbar[i]; +if(btn=="-"){ +$("
").appendTo(tr); +}else{ +var td=$("").appendTo(tr); +var _61=$("").appendTo(td); +_61[0].onclick=eval(btn.handler||function(){ +}); +_61.linkbutton($.extend({},btn,{plain:true})); +} +} +}else{ +$(_5b.toolbar).addClass("datagrid-toolbar").prependTo(_5c); +$(_5b.toolbar).show(); +} +}else{ +$("div.datagrid-toolbar",_5c).remove(); +} +$("div.datagrid-pager",_5c).remove(); +if(_5b.pagination){ +var _62=$("
"); +if(_5b.pagePosition=="bottom"){ +_62.appendTo(_5c); +}else{ +if(_5b.pagePosition=="top"){ +_62.addClass("datagrid-pager-top").prependTo(_5c); +}else{ +var _63=$("
").prependTo(_5c); +_62.appendTo(_5c); +_62=_62.add(_63); +} +} +_62.pagination({total:0,pageNumber:_5b.pageNumber,pageSize:_5b.pageSize,pageList:_5b.pageList,onSelectPage:function(_64,_65){ +_5b.pageNumber=_64||1; +_5b.pageSize=_65; +_62.pagination("refresh",{pageNumber:_64,pageSize:_65}); +_bf(_59); +}}); +_5b.pageSize=_62.pagination("options").pageSize; +} +function _5f(_66,_67,_68){ +if(!_67){ +return; +} +$(_66).show(); +$(_66).empty(); +var tmp=$("
").appendTo("body"); +tmp._outerWidth(99); +var _69=100-parseInt(tmp[0].style.width); +tmp.remove(); +var _6a=[]; +var _6b=[]; +var _6c=[]; +if(_5b.sortName){ +_6a=_5b.sortName.split(","); +_6b=_5b.sortOrder.split(","); +} +var t=$("
").appendTo(_66); +for(var i=0;i<_67.length;i++){ +var tr=$("").appendTo($("tbody",t)); +var _6d=_67[i]; +for(var j=0;j<_6d.length;j++){ +var col=_6d[j]; +var _6e=""; +if(col.rowspan){ +_6e+="rowspan=\""+col.rowspan+"\" "; +} +if(col.colspan){ +_6e+="colspan=\""+col.colspan+"\" "; +if(!col.id){ +col.id=["datagrid-td-group"+_1,i,j].join("-"); +} +} +if(col.id){ +_6e+="id=\""+col.id+"\""; +} +var td=$("").appendTo(tr); +if(col.checkbox){ +td.attr("field",col.field); +$("
").html("").appendTo(td); +}else{ +if(col.field){ +td.attr("field",col.field); +td.append("
"); +td.find("span:first").html(col.title); +var _6f=td.find("div.datagrid-cell"); +var pos=_2(_6a,col.field); +if(pos>=0){ +_6f.addClass("datagrid-sort-"+_6b[pos]); +} +if(col.sortable){ +_6f.addClass("datagrid-sort"); +} +if(col.resizable==false){ +_6f.attr("resizable","false"); +} +if(col.width){ +var _70=$.parser.parseValue("width",col.width,dc.view,_5b.scrollbarSize+(_5b.rownumbers?_5b.rownumberWidth:0)); +col.deltaWidth=_69; +col.boxWidth=_70-_69; +}else{ +col.auto=true; +} +_6f.css("text-align",(col.halign||col.align||"")); +col.cellClass=_5a.cellClassPrefix+"-"+col.field.replace(/[\.|\s]/g,"-"); +_6f.addClass(col.cellClass); +}else{ +$("
").html(col.title).appendTo(td); +} +} +if(col.hidden){ +td.hide(); +_6c.push(col.field); +} +} +} +if(_68&&_5b.rownumbers){ +var td=$("
"); +if($("tr",t).length==0){ +td.wrap("").parent().appendTo($("tbody",t)); +}else{ +td.prependTo($("tr:first",t)); +} +} +for(var i=0;i<_6c.length;i++){ +_c1(_59,_6c[i],-1); +} +}; +function _60(){ +var _71=[[".datagrid-header-rownumber",(_5b.rownumberWidth-1)+"px"],[".datagrid-cell-rownumber",(_5b.rownumberWidth-1)+"px"]]; +var _72=_73(_59,true).concat(_73(_59)); +for(var i=0;i<_72.length;i++){ +var col=_74(_59,_72[i]); +if(col&&!col.checkbox){ +_71.push(["."+col.cellClass,col.boxWidth?col.boxWidth+"px":"auto"]); +} +} +_5a.ss.add(_71); +_5a.ss.dirty(_5a.cellSelectorPrefix); +_5a.cellSelectorPrefix="."+_5a.cellClassPrefix; +}; +}; +function _75(_76){ +var _77=$.data(_76,"datagrid"); +var _78=_77.panel; +var _79=_77.options; +var dc=_77.dc; +var _7a=dc.header1.add(dc.header2); +_7a.unbind(".datagrid"); +for(var _7b in _79.headerEvents){ +_7a.bind(_7b+".datagrid",_79.headerEvents[_7b]); +} +var _7c=_7a.find("div.datagrid-cell"); +var _7d=_79.resizeHandle=="right"?"e":(_79.resizeHandle=="left"?"w":"e,w"); +_7c.each(function(){ +$(this).resizable({handles:_7d,disabled:($(this).attr("resizable")?$(this).attr("resizable")=="false":false),minWidth:25,onStartResize:function(e){ +_77.resizing=true; +_7a.css("cursor",$("body").css("cursor")); +if(!_77.proxy){ +_77.proxy=$("
").appendTo(dc.view); +} +_77.proxy.css({left:e.pageX-$(_78).offset().left-1,display:"none"}); +setTimeout(function(){ +if(_77.proxy){ +_77.proxy.show(); +} +},500); +},onResize:function(e){ +_77.proxy.css({left:e.pageX-$(_78).offset().left-1,display:"block"}); +return false; +},onStopResize:function(e){ +_7a.css("cursor",""); +$(this).css("height",""); +var _7e=$(this).parent().attr("field"); +var col=_74(_76,_7e); +col.width=$(this)._outerWidth(); +col.boxWidth=col.width-col.deltaWidth; +col.auto=undefined; +$(this).css("width",""); +$(_76).datagrid("fixColumnSize",_7e); +_77.proxy.remove(); +_77.proxy=null; +if($(this).parents("div:first.datagrid-header").parent().hasClass("datagrid-view1")){ +_20(_76); +} +$(_76).datagrid("fitColumns"); +_79.onResizeColumn.call(_76,_7e,col.width); +setTimeout(function(){ +_77.resizing=false; +},0); +}}); +}); +var bb=dc.body1.add(dc.body2); +bb.unbind(); +for(var _7b in _79.rowEvents){ +bb.bind(_7b,_79.rowEvents[_7b]); +} +dc.body1.bind("mousewheel DOMMouseScroll",function(e){ +e.preventDefault(); +var e1=e.originalEvent||window.event; +var _7f=e1.wheelDelta||e1.detail*(-1); +if("deltaY" in e1){ +_7f=e1.deltaY*-1; +} +var dg=$(e.target).closest("div.datagrid-view").children(".datagrid-f"); +var dc=dg.data("datagrid").dc; +dc.body2.scrollTop(dc.body2.scrollTop()-_7f); +}); +dc.body2.bind("scroll",function(){ +var b1=dc.view1.children("div.datagrid-body"); +b1.scrollTop($(this).scrollTop()); +var c1=dc.body1.children(":first"); +var c2=dc.body2.children(":first"); +if(c1.length&&c2.length){ +var _80=c1.offset().top; +var _81=c2.offset().top; +if(_80!=_81){ +b1.scrollTop(b1.scrollTop()+_80-_81); +} +} +dc.view2.children("div.datagrid-header,div.datagrid-footer")._scrollLeft($(this)._scrollLeft()); +dc.body2.children("table.datagrid-btable-frozen").css("left",-$(this)._scrollLeft()); +}); +}; +function _82(_83){ +return function(e){ +var td=$(e.target).closest("td[field]"); +if(td.length){ +var _84=_85(td); +if(!$(_84).data("datagrid").resizing&&_83){ +td.addClass("datagrid-header-over"); +}else{ +td.removeClass("datagrid-header-over"); +} +} +}; +}; +function _86(e){ +var _87=_85(e.target); +var _88=$(_87).datagrid("options"); +var ck=$(e.target).closest("input[type=checkbox]"); +if(ck.length){ +if(_88.singleSelect&&_88.selectOnCheck){ +return false; +} +if(ck.is(":checked")){ +_89(_87); +}else{ +_8a(_87); +} +e.stopPropagation(); +}else{ +var _8b=$(e.target).closest(".datagrid-cell"); +if(_8b.length){ +var p1=_8b.offset().left+5; +var p2=_8b.offset().left+_8b._outerWidth()-5; +if(e.pageXp1){ +_8c(_87,_8b.parent().attr("field")); +} +} +} +}; +function _8d(e){ +var _8e=_85(e.target); +var _8f=$(_8e).datagrid("options"); +var _90=$(e.target).closest(".datagrid-cell"); +if(_90.length){ +var p1=_90.offset().left+5; +var p2=_90.offset().left+_90._outerWidth()-5; +var _91=_8f.resizeHandle=="right"?(e.pageX>p2):(_8f.resizeHandle=="left"?(e.pageXp2)); +if(_91){ +var _92=_90.parent().attr("field"); +var col=_74(_8e,_92); +if(col.resizable==false){ +return; +} +$(_8e).datagrid("autoSizeColumn",_92); +col.auto=false; +} +} +}; +function _93(e){ +var _94=_85(e.target); +var _95=$(_94).datagrid("options"); +var td=$(e.target).closest("td[field]"); +_95.onHeaderContextMenu.call(_94,e,td.attr("field")); +}; +function _96(_97){ +return function(e){ +var tr=_98(e.target); +if(!tr){ +return; +} +var _99=_85(tr); +if($.data(_99,"datagrid").resizing){ +return; +} +var _9a=_9b(tr); +if(_97){ +_9c(_99,_9a); +}else{ +var _9d=$.data(_99,"datagrid").options; +_9d.finder.getTr(_99,_9a).removeClass("datagrid-row-over"); +} +}; +}; +function _9e(e){ +var tr=_98(e.target); +if(!tr){ +return; +} +var _9f=_85(tr); +var _a0=$.data(_9f,"datagrid").options; +var _a1=_9b(tr); +var tt=$(e.target); +if(tt.parent().hasClass("datagrid-cell-check")){ +if(_a0.singleSelect&&_a0.selectOnCheck){ +tt._propAttr("checked",!tt.is(":checked")); +_a2(_9f,_a1); +}else{ +if(tt.is(":checked")){ +tt._propAttr("checked",false); +_a2(_9f,_a1); +}else{ +tt._propAttr("checked",true); +_a3(_9f,_a1); +} +} +}else{ +var row=_a0.finder.getRow(_9f,_a1); +var td=tt.closest("td[field]",tr); +if(td.length){ +var _a4=td.attr("field"); +_a0.onClickCell.call(_9f,_a1,_a4,row[_a4]); +} +if(_a0.singleSelect==true){ +_a5(_9f,_a1); +}else{ +if(_a0.ctrlSelect){ +if(e.metaKey||e.ctrlKey){ +if(tr.hasClass("datagrid-row-selected")){ +_a6(_9f,_a1); +}else{ +_a5(_9f,_a1); +} +}else{ +if(e.shiftKey){ +$(_9f).datagrid("clearSelections"); +var _a7=Math.min(_a0.lastSelectedIndex||0,_a1); +var _a8=Math.max(_a0.lastSelectedIndex||0,_a1); +for(var i=_a7;i<=_a8;i++){ +_a5(_9f,i); +} +}else{ +$(_9f).datagrid("clearSelections"); +_a5(_9f,_a1); +_a0.lastSelectedIndex=_a1; +} +} +}else{ +if(tr.hasClass("datagrid-row-selected")){ +_a6(_9f,_a1); +}else{ +_a5(_9f,_a1); +} +} +} +_a0.onClickRow.apply(_9f,_5(_9f,[_a1,row])); +} +}; +function _a9(e){ +var tr=_98(e.target); +if(!tr){ +return; +} +var _aa=_85(tr); +var _ab=$.data(_aa,"datagrid").options; +var _ac=_9b(tr); +var row=_ab.finder.getRow(_aa,_ac); +var td=$(e.target).closest("td[field]",tr); +if(td.length){ +var _ad=td.attr("field"); +_ab.onDblClickCell.call(_aa,_ac,_ad,row[_ad]); +} +_ab.onDblClickRow.apply(_aa,_5(_aa,[_ac,row])); +}; +function _ae(e){ +var tr=_98(e.target); +if(tr){ +var _af=_85(tr); +var _b0=$.data(_af,"datagrid").options; +var _b1=_9b(tr); +var row=_b0.finder.getRow(_af,_b1); +_b0.onRowContextMenu.call(_af,e,_b1,row); +}else{ +var _b2=_98(e.target,".datagrid-body"); +if(_b2){ +var _af=_85(_b2); +var _b0=$.data(_af,"datagrid").options; +_b0.onRowContextMenu.call(_af,e,-1,null); +} +} +}; +function _85(t){ +return $(t).closest("div.datagrid-view").children(".datagrid-f")[0]; +}; +function _98(t,_b3){ +var tr=$(t).closest(_b3||"tr.datagrid-row"); +if(tr.length&&tr.parent().length){ +return tr; +}else{ +return undefined; +} +}; +function _9b(tr){ +if(tr.attr("datagrid-row-index")){ +return parseInt(tr.attr("datagrid-row-index")); +}else{ +return tr.attr("node-id"); +} +}; +function _8c(_b4,_b5){ +var _b6=$.data(_b4,"datagrid"); +var _b7=_b6.options; +_b5=_b5||{}; +var _b8={sortName:_b7.sortName,sortOrder:_b7.sortOrder}; +if(typeof _b5=="object"){ +$.extend(_b8,_b5); +} +var _b9=[]; +var _ba=[]; +if(_b8.sortName){ +_b9=_b8.sortName.split(","); +_ba=_b8.sortOrder.split(","); +} +if(typeof _b5=="string"){ +var _bb=_b5; +var col=_74(_b4,_bb); +if(!col.sortable||_b6.resizing){ +return; +} +var _bc=col.order||"asc"; +var pos=_2(_b9,_bb); +if(pos>=0){ +var _bd=_ba[pos]=="asc"?"desc":"asc"; +if(_b7.multiSort&&_bd==_bc){ +_b9.splice(pos,1); +_ba.splice(pos,1); +}else{ +_ba[pos]=_bd; +} +}else{ +if(_b7.multiSort){ +_b9.push(_bb); +_ba.push(_bc); +}else{ +_b9=[_bb]; +_ba=[_bc]; +} +} +_b8.sortName=_b9.join(","); +_b8.sortOrder=_ba.join(","); +} +if(_b7.onBeforeSortColumn.call(_b4,_b8.sortName,_b8.sortOrder)==false){ +return; +} +$.extend(_b7,_b8); +var dc=_b6.dc; +var _be=dc.header1.add(dc.header2); +_be.find("div.datagrid-cell").removeClass("datagrid-sort-asc datagrid-sort-desc"); +for(var i=0;i<_b9.length;i++){ +var col=_74(_b4,_b9[i]); +_be.find("div."+col.cellClass).addClass("datagrid-sort-"+_ba[i]); +} +if(_b7.remoteSort){ +_bf(_b4); +}else{ +_c0(_b4,$(_b4).datagrid("getData")); +} +_b7.onSortColumn.call(_b4,_b7.sortName,_b7.sortOrder); +}; +function _c1(_c2,_c3,_c4){ +_c5(true); +_c5(false); +function _c5(_c6){ +var aa=_c7(_c2,_c6); +if(aa.length){ +var _c8=aa[aa.length-1]; +var _c9=_2(_c8,_c3); +if(_c9>=0){ +for(var _ca=0;_ca=_d0.find("table").width()){ +dc.body2.css("overflow-x","hidden"); +} +function _d3(){ +if(!_cf.fitColumns){ +return; +} +if(!_ce.leftWidth){ +_ce.leftWidth=0; +} +var _d4=0; +var cc=[]; +var _d5=_73(_cd,false); +for(var i=0;i<_d5.length;i++){ +var col=_74(_cd,_d5[i]); +if(_d6(col)){ +_d4+=col.width; +cc.push({field:col.field,col:col,addingWidth:0}); +} +} +if(!_d4){ +return; +} +cc[cc.length-1].addingWidth-=_ce.leftWidth; +var _d7=_d0.children("div.datagrid-header-inner").show(); +var _d8=_d0.width()-_d0.find("table").width()-_cf.scrollbarSize+_ce.leftWidth; +var _d9=_d8/_d4; +if(!_cf.showHeader){ +_d7.hide(); +} +for(var i=0;i0){ +c.col.boxWidth+=c.addingWidth; +c.col.width+=c.addingWidth; +} +} +_ce.leftWidth=_d8; +$(_cd).datagrid("fixColumnSize"); +}; +function _d2(){ +var _db=false; +var _dc=_73(_cd,true).concat(_73(_cd,false)); +$.map(_dc,function(_dd){ +var col=_74(_cd,_dd); +if(String(col.width||"").indexOf("%")>=0){ +var _de=$.parser.parseValue("width",col.width,dc.view,_cf.scrollbarSize+(_cf.rownumbers?_cf.rownumberWidth:0))-col.deltaWidth; +if(_de>0){ +col.boxWidth=_de; +_db=true; +} +} +}); +if(_db){ +$(_cd).datagrid("fixColumnSize"); +} +}; +function _d1(fit){ +var _df=dc.header1.add(dc.header2).find(".datagrid-cell-group"); +if(_df.length){ +_df.each(function(){ +$(this)._outerWidth(fit?$(this).parent().width():10); +}); +if(fit){ +_20(_cd); +} +} +}; +function _d6(col){ +if(String(col.width||"").indexOf("%")>=0){ +return false; +} +if(!col.hidden&&!col.checkbox&&!col.auto&&!col.fixed){ +return true; +} +}; +}; +function _e0(_e1,_e2){ +var _e3=$.data(_e1,"datagrid"); +var _e4=_e3.options; +var dc=_e3.dc; +var tmp=$("
").appendTo("body"); +if(_e2){ +_1a(_e2); +$(_e1).datagrid("fitColumns"); +}else{ +var _e5=false; +var _e6=_73(_e1,true).concat(_73(_e1,false)); +for(var i=0;i<_e6.length;i++){ +var _e2=_e6[i]; +var col=_74(_e1,_e2); +if(col.auto){ +_1a(_e2); +_e5=true; +} +} +if(_e5){ +$(_e1).datagrid("fitColumns"); +} +} +tmp.remove(); +function _1a(_e7){ +var _e8=dc.view.find("div.datagrid-header td[field=\""+_e7+"\"] div.datagrid-cell"); +_e8.css("width",""); +var col=$(_e1).datagrid("getColumnOption",_e7); +col.width=undefined; +col.boxWidth=undefined; +col.auto=true; +$(_e1).datagrid("fixColumnSize",_e7); +var _e9=Math.max(_ea("header"),_ea("allbody"),_ea("allfooter"))+1; +_e8._outerWidth(_e9-1); +col.width=_e9; +col.boxWidth=parseInt(_e8[0].style.width); +col.deltaWidth=_e9-col.boxWidth; +_e8.css("width",""); +$(_e1).datagrid("fixColumnSize",_e7); +_e4.onResizeColumn.call(_e1,_e7,col.width); +function _ea(_eb){ +var _ec=0; +if(_eb=="header"){ +_ec=_ed(_e8); +}else{ +_e4.finder.getTr(_e1,0,_eb).find("td[field=\""+_e7+"\"] div.datagrid-cell").each(function(){ +var w=_ed($(this)); +if(_ec1){ +var col=_74(_f8,td.attr("field")); +var _fa=col.boxWidth+col.deltaWidth-1; +for(var i=1;i<_f9;i++){ +td=td.next(); +col=_74(_f8,td.attr("field")); +_fa+=col.boxWidth+col.deltaWidth; +} +$(this).children("div.datagrid-cell")._outerWidth(_fa); +} +}); +}; +function _f6(_fb){ +var dc=$.data(_fb,"datagrid").dc; +dc.view.find("div.datagrid-editable").each(function(){ +var _fc=$(this); +var _fd=_fc.parent().attr("field"); +var col=$(_fb).datagrid("getColumnOption",_fd); +_fc._outerWidth(col.boxWidth+col.deltaWidth-1); +var ed=$.data(this,"datagrid.editor"); +if(ed.actions.resize){ +ed.actions.resize(ed.target,_fc.width()); +} +}); +}; +function _74(_fe,_ff){ +function find(_100){ +if(_100){ +for(var i=0;i<_100.length;i++){ +var cc=_100[i]; +for(var j=0;j=0){ +var _109=col.field||col.id||""; +for(var c=0;c<(col.colspan||1);c++){ +for(var r=0;r<(col.rowspan||1);r++){ +aa[_106+r][_107]=_109; +} +_107++; +} +} +}); +} +return aa; +function _105(){ +var _10a=0; +$.map(_103[0]||[],function(col){ +_10a+=col.colspan||1; +}); +return _10a; +}; +function _108(a){ +for(var i=0;ib?1:-1); +}; +r=_111(r1[sn],r2[sn])*(so=="asc"?1:-1); +if(r!=0){ +return r; +} +} +return r; +}); +} +if(opts.view.onBeforeRender){ +opts.view.onBeforeRender.call(opts.view,_10d,data.rows); +} +opts.view.render.call(opts.view,_10d,dc.body2,false); +opts.view.render.call(opts.view,_10d,dc.body1,true); +if(opts.showFooter){ +opts.view.renderFooter.call(opts.view,_10d,dc.footer2,false); +opts.view.renderFooter.call(opts.view,_10d,dc.footer1,true); +} +if(opts.view.onAfterRender){ +opts.view.onAfterRender.call(opts.view,_10d); +} +_10e.ss.clean(); +var _112=$(_10d).datagrid("getPager"); +if(_112.length){ +var _113=_112.pagination("options"); +if(_113.total!=data.total){ +_112.pagination("refresh",{total:data.total}); +if(opts.pageNumber!=_113.pageNumber&&_113.pageNumber>0){ +opts.pageNumber=_113.pageNumber; +_bf(_10d); +} +} +} +_34(_10d); +dc.body2.triggerHandler("scroll"); +$(_10d).datagrid("setSelectionState"); +$(_10d).datagrid("autoSizeColumn"); +opts.onLoadSuccess.call(_10d,data); +}; +function _114(_115){ +var _116=$.data(_115,"datagrid"); +var opts=_116.options; +var dc=_116.dc; +dc.header1.add(dc.header2).find("input[type=checkbox]")._propAttr("checked",false); +if(opts.idField){ +var _117=$.data(_115,"treegrid")?true:false; +var _118=opts.onSelect; +var _119=opts.onCheck; +opts.onSelect=opts.onCheck=function(){ +}; +var rows=opts.finder.getRows(_115); +for(var i=0;i_12a.height()-_12b){ +_12a.scrollTop(_12a.scrollTop()+top+tr._outerHeight()-_12a.height()+_12b); +} +} +} +}; +function _9c(_12d,_12e){ +var _12f=$.data(_12d,"datagrid"); +var opts=_12f.options; +opts.finder.getTr(_12d,_12f.highlightIndex).removeClass("datagrid-row-over"); +opts.finder.getTr(_12d,_12e).addClass("datagrid-row-over"); +_12f.highlightIndex=_12e; +}; +function _a5(_130,_131,_132,_133){ +var _134=$.data(_130,"datagrid"); +var opts=_134.options; +var row=opts.finder.getRow(_130,_131); +if(!row){ +return; +} +if(opts.onBeforeSelect.apply(_130,_5(_130,[_131,row]))==false){ +return; +} +if(opts.singleSelect){ +_135(_130,true); +_134.selectedRows=[]; +} +if(!_132&&opts.checkOnSelect){ +_a2(_130,_131,true); +} +if(opts.idField){ +_4(_134.selectedRows,opts.idField,row); +} +opts.finder.getTr(_130,_131).addClass("datagrid-row-selected"); +opts.onSelect.apply(_130,_5(_130,[_131,row])); +if(!_133&&opts.scrollOnSelect){ +_125(_130,_131); +} +}; +function _a6(_136,_137,_138){ +var _139=$.data(_136,"datagrid"); +var dc=_139.dc; +var opts=_139.options; +var row=opts.finder.getRow(_136,_137); +if(!row){ +return; +} +if(opts.onBeforeUnselect.apply(_136,_5(_136,[_137,row]))==false){ +return; +} +if(!_138&&opts.checkOnSelect){ +_a3(_136,_137,true); +} +opts.finder.getTr(_136,_137).removeClass("datagrid-row-selected"); +if(opts.idField){ +_3(_139.selectedRows,opts.idField,row[opts.idField]); +} +opts.onUnselect.apply(_136,_5(_136,[_137,row])); +}; +function _13a(_13b,_13c){ +var _13d=$.data(_13b,"datagrid"); +var opts=_13d.options; +var rows=opts.finder.getRows(_13b); +var _13e=$.data(_13b,"datagrid").selectedRows; +if(!_13c&&opts.checkOnSelect){ +_89(_13b,true); +} +opts.finder.getTr(_13b,"","allbody").addClass("datagrid-row-selected"); +if(opts.idField){ +for(var _13f=0;_13f"); +cell.children("table").bind("click dblclick contextmenu",function(e){ +e.stopPropagation(); +}); +$.data(cell[0],"datagrid.editor",{actions:_174,target:_174.init(cell.find("td"),$.extend({height:opts.editorHeight},_173)),field:_171,type:_172,oldHtml:_175}); +} +} +}); +_34(_16f,_170,true); +}; +function _166(_177,_178){ +var opts=$.data(_177,"datagrid").options; +var tr=opts.finder.getTr(_177,_178); +tr.children("td").each(function(){ +var cell=$(this).find("div.datagrid-editable"); +if(cell.length){ +var ed=$.data(cell[0],"datagrid.editor"); +if(ed.actions.destroy){ +ed.actions.destroy(ed.target); +} +cell.html(ed.oldHtml); +$.removeData(cell[0],"datagrid.editor"); +cell.removeClass("datagrid-editable"); +cell.css("width",""); +} +}); +}; +function _159(_179,_17a){ +var tr=$.data(_179,"datagrid").options.finder.getTr(_179,_17a); +if(!tr.hasClass("datagrid-row-editing")){ +return true; +} +var vbox=tr.find(".validatebox-text"); +vbox.validatebox("validate"); +vbox.trigger("mouseleave"); +var _17b=tr.find(".validatebox-invalid"); +return _17b.length==0; +}; +function _17c(_17d,_17e){ +var _17f=$.data(_17d,"datagrid").insertedRows; +var _180=$.data(_17d,"datagrid").deletedRows; +var _181=$.data(_17d,"datagrid").updatedRows; +if(!_17e){ +var rows=[]; +rows=rows.concat(_17f); +rows=rows.concat(_180); +rows=rows.concat(_181); +return rows; +}else{ +if(_17e=="inserted"){ +return _17f; +}else{ +if(_17e=="deleted"){ +return _180; +}else{ +if(_17e=="updated"){ +return _181; +} +} +} +} +return []; +}; +function _182(_183,_184){ +var _185=$.data(_183,"datagrid"); +var opts=_185.options; +var data=_185.data; +var _186=_185.insertedRows; +var _187=_185.deletedRows; +$(_183).datagrid("cancelEdit",_184); +var row=opts.finder.getRow(_183,_184); +if(_2(_186,row)>=0){ +_3(_186,row); +}else{ +_187.push(row); +} +_3(_185.selectedRows,opts.idField,row[opts.idField]); +_3(_185.checkedRows,opts.idField,row[opts.idField]); +opts.view.deleteRow.call(opts.view,_183,_184); +if(opts.height=="auto"){ +_34(_183); +} +$(_183).datagrid("getPager").pagination("refresh",{total:data.total}); +}; +function _188(_189,_18a){ +var data=$.data(_189,"datagrid").data; +var view=$.data(_189,"datagrid").options.view; +var _18b=$.data(_189,"datagrid").insertedRows; +view.insertRow.call(view,_189,_18a.index,_18a.row); +_18b.push(_18a.row); +$(_189).datagrid("getPager").pagination("refresh",{total:data.total}); +}; +function _18c(_18d,row){ +var data=$.data(_18d,"datagrid").data; +var view=$.data(_18d,"datagrid").options.view; +var _18e=$.data(_18d,"datagrid").insertedRows; +view.insertRow.call(view,_18d,null,row); +_18e.push(row); +$(_18d).datagrid("getPager").pagination("refresh",{total:data.total}); +}; +function _18f(_190,_191){ +var _192=$.data(_190,"datagrid"); +var opts=_192.options; +var row=opts.finder.getRow(_190,_191.index); +var _193=false; +_191.row=_191.row||{}; +for(var _194 in _191.row){ +if(row[_194]!==_191.row[_194]){ +_193=true; +break; +} +} +if(_193){ +if(_2(_192.insertedRows,row)==-1){ +if(_2(_192.updatedRows,row)==-1){ +_192.updatedRows.push(row); +} +} +opts.view.updateRow.call(opts.view,_190,_191.index,_191.row); +} +}; +function _195(_196){ +var _197=$.data(_196,"datagrid"); +var data=_197.data; +var rows=data.rows; +var _198=[]; +for(var i=0;i=0){ +(_1a5=="s"?_a5:_a2)(_19c,_1a6,true); +} +} +}; +for(var i=0;i0){ +$(this).datagrid("loadData",data); +}else{ +opts.view.setEmptyMsg(this); +$(this).datagrid("autoSizeColumn"); +} +} +_bf(this); +}); +}; +function _1b6(_1b7){ +var _1b8={}; +$.map(_1b7,function(name){ +_1b8[name]=_1b9(name); +}); +return _1b8; +function _1b9(name){ +function isA(_1ba){ +return $.data($(_1ba)[0],name)!=undefined; +}; +return {init:function(_1bb,_1bc){ +var _1bd=$("").appendTo(_1bb); +if(_1bd[name]&&name!="text"){ +return _1bd[name](_1bc); +}else{ +return _1bd; +} +},destroy:function(_1be){ +if(isA(_1be,name)){ +$(_1be)[name]("destroy"); +} +},getValue:function(_1bf){ +if(isA(_1bf,name)){ +var opts=$(_1bf)[name]("options"); +if(opts.multiple){ +return $(_1bf)[name]("getValues").join(opts.separator); +}else{ +return $(_1bf)[name]("getValue"); +} +}else{ +return $(_1bf).val(); +} +},setValue:function(_1c0,_1c1){ +if(isA(_1c0,name)){ +var opts=$(_1c0)[name]("options"); +if(opts.multiple){ +if(_1c1){ +$(_1c0)[name]("setValues",_1c1.split(opts.separator)); +}else{ +$(_1c0)[name]("clear"); +} +}else{ +$(_1c0)[name]("setValue",_1c1); +} +}else{ +$(_1c0).val(_1c1); +} +},resize:function(_1c2,_1c3){ +if(isA(_1c2,name)){ +$(_1c2)[name]("resize",_1c3); +}else{ +$(_1c2)._size({width:_1c3,height:$.fn.datagrid.defaults.editorHeight}); +} +}}; +}; +}; +var _1c4=$.extend({},_1b6(["text","textbox","passwordbox","filebox","numberbox","numberspinner","combobox","combotree","combogrid","combotreegrid","datebox","datetimebox","timespinner","datetimespinner"]),{textarea:{init:function(_1c5,_1c6){ +var _1c7=$("").appendTo(_1c5); +_1c7.css("vertical-align","middle")._outerHeight(_1c6.height); +return _1c7; +},getValue:function(_1c8){ +return $(_1c8).val(); +},setValue:function(_1c9,_1ca){ +$(_1c9).val(_1ca); +},resize:function(_1cb,_1cc){ +$(_1cb)._outerWidth(_1cc); +}},checkbox:{init:function(_1cd,_1ce){ +var _1cf=$("").appendTo(_1cd); +_1cf.val(_1ce.on); +_1cf.attr("offval",_1ce.off); +return _1cf; +},getValue:function(_1d0){ +if($(_1d0).is(":checked")){ +return $(_1d0).val(); +}else{ +return $(_1d0).attr("offval"); +} +},setValue:function(_1d1,_1d2){ +var _1d3=false; +if($(_1d1).val()==_1d2){ +_1d3=true; +} +$(_1d1)._propAttr("checked",_1d3); +}},validatebox:{init:function(_1d4,_1d5){ +var _1d6=$("").appendTo(_1d4); +_1d6.validatebox(_1d5); +return _1d6; +},destroy:function(_1d7){ +$(_1d7).validatebox("destroy"); +},getValue:function(_1d8){ +return $(_1d8).val(); +},setValue:function(_1d9,_1da){ +$(_1d9).val(_1da); +},resize:function(_1db,_1dc){ +$(_1db)._outerWidth(_1dc)._outerHeight($.fn.datagrid.defaults.editorHeight); +}}}); +$.fn.datagrid.methods={options:function(jq){ +var _1dd=$.data(jq[0],"datagrid").options; +var _1de=$.data(jq[0],"datagrid").panel.panel("options"); +var opts=$.extend(_1dd,{width:_1de.width,height:_1de.height,closed:_1de.closed,collapsed:_1de.collapsed,minimized:_1de.minimized,maximized:_1de.maximized}); +return opts; +},setSelectionState:function(jq){ +return jq.each(function(){ +_114(this); +}); +},createStyleSheet:function(jq){ +return _7(jq[0]); +},getPanel:function(jq){ +return $.data(jq[0],"datagrid").panel; +},getPager:function(jq){ +return $.data(jq[0],"datagrid").panel.children("div.datagrid-pager"); +},getColumnFields:function(jq,_1df){ +return _73(jq[0],_1df); +},getColumnOption:function(jq,_1e0){ +return _74(jq[0],_1e0); +},resize:function(jq,_1e1){ +return jq.each(function(){ +_1a(this,_1e1); +}); +},load:function(jq,_1e2){ +return jq.each(function(){ +var opts=$(this).datagrid("options"); +if(typeof _1e2=="string"){ +opts.url=_1e2; +_1e2=null; +} +opts.pageNumber=1; +var _1e3=$(this).datagrid("getPager"); +_1e3.pagination("refresh",{pageNumber:1}); +_bf(this,_1e2); +}); +},reload:function(jq,_1e4){ +return jq.each(function(){ +var opts=$(this).datagrid("options"); +if(typeof _1e4=="string"){ +opts.url=_1e4; +_1e4=null; +} +_bf(this,_1e4); +}); +},reloadFooter:function(jq,_1e5){ +return jq.each(function(){ +var opts=$.data(this,"datagrid").options; +var dc=$.data(this,"datagrid").dc; +if(_1e5){ +$.data(this,"datagrid").footer=_1e5; +} +if(opts.showFooter){ +opts.view.renderFooter.call(opts.view,this,dc.footer2,false); +opts.view.renderFooter.call(opts.view,this,dc.footer1,true); +if(opts.view.onAfterRender){ +opts.view.onAfterRender.call(opts.view,this); +} +$(this).datagrid("fixRowHeight"); +} +}); +},loading:function(jq){ +return jq.each(function(){ +var opts=$.data(this,"datagrid").options; +$(this).datagrid("getPager").pagination("loading"); +if(opts.loadMsg){ +var _1e6=$(this).datagrid("getPanel"); +if(!_1e6.children("div.datagrid-mask").length){ +$("
").appendTo(_1e6); +var msg=$("
").html(opts.loadMsg).appendTo(_1e6); +msg._outerHeight(40); +msg.css({marginLeft:(-msg.outerWidth()/2),lineHeight:(msg.height()+"px")}); +} +} +}); +},loaded:function(jq){ +return jq.each(function(){ +$(this).datagrid("getPager").pagination("loaded"); +var _1e7=$(this).datagrid("getPanel"); +_1e7.children("div.datagrid-mask-msg").remove(); +_1e7.children("div.datagrid-mask").remove(); +}); +},fitColumns:function(jq){ +return jq.each(function(){ +_cc(this); +}); +},fixColumnSize:function(jq,_1e8){ +return jq.each(function(){ +_ef(this,_1e8); +}); +},fixRowHeight:function(jq,_1e9){ +return jq.each(function(){ +_34(this,_1e9); +}); +},freezeRow:function(jq,_1ea){ +return jq.each(function(){ +_45(this,_1ea); +}); +},autoSizeColumn:function(jq,_1eb){ +return jq.each(function(){ +_e0(this,_1eb); +}); +},loadData:function(jq,data){ +return jq.each(function(){ +_c0(this,data); +_195(this); +}); +},getData:function(jq){ +return $.data(jq[0],"datagrid").data; +},getRows:function(jq){ +return $.data(jq[0],"datagrid").data.rows; +},getFooterRows:function(jq){ +return $.data(jq[0],"datagrid").footer; +},getRowIndex:function(jq,id){ +return _11c(jq[0],id); +},getChecked:function(jq){ +return _122(jq[0]); +},getSelected:function(jq){ +var rows=_11f(jq[0]); +return rows.length>0?rows[0]:null; +},getSelections:function(jq){ +return _11f(jq[0]); +},clearSelections:function(jq){ +return jq.each(function(){ +var _1ec=$.data(this,"datagrid"); +var _1ed=_1ec.selectedRows; +var _1ee=_1ec.checkedRows; +_1ed.splice(0,_1ed.length); +_135(this); +if(_1ec.options.checkOnSelect){ +_1ee.splice(0,_1ee.length); +} +}); +},clearChecked:function(jq){ +return jq.each(function(){ +var _1ef=$.data(this,"datagrid"); +var _1f0=_1ef.selectedRows; +var _1f1=_1ef.checkedRows; +_1f1.splice(0,_1f1.length); +_8a(this); +if(_1ef.options.selectOnCheck){ +_1f0.splice(0,_1f0.length); +} +}); +},scrollTo:function(jq,_1f2){ +return jq.each(function(){ +_125(this,_1f2); +}); +},highlightRow:function(jq,_1f3){ +return jq.each(function(){ +_9c(this,_1f3); +_125(this,_1f3); +}); +},selectAll:function(jq){ +return jq.each(function(){ +_13a(this); +}); +},unselectAll:function(jq){ +return jq.each(function(){ +_135(this); +}); +},selectRow:function(jq,_1f4){ +return jq.each(function(){ +_a5(this,_1f4); +}); +},selectRecord:function(jq,id){ +return jq.each(function(){ +var opts=$.data(this,"datagrid").options; +if(opts.idField){ +var _1f5=_11c(this,id); +if(_1f5>=0){ +$(this).datagrid("selectRow",_1f5); +} +} +}); +},unselectRow:function(jq,_1f6){ +return jq.each(function(){ +_a6(this,_1f6); +}); +},checkRow:function(jq,_1f7){ +return jq.each(function(){ +_a2(this,_1f7); +}); +},uncheckRow:function(jq,_1f8){ +return jq.each(function(){ +_a3(this,_1f8); +}); +},checkAll:function(jq){ +return jq.each(function(){ +_89(this); +}); +},uncheckAll:function(jq){ +return jq.each(function(){ +_8a(this); +}); +},beginEdit:function(jq,_1f9){ +return jq.each(function(){ +_154(this,_1f9); +}); +},endEdit:function(jq,_1fa){ +return jq.each(function(){ +_15a(this,_1fa,false); +}); +},cancelEdit:function(jq,_1fb){ +return jq.each(function(){ +_15a(this,_1fb,true); +}); +},getEditors:function(jq,_1fc){ +return _167(jq[0],_1fc); +},getEditor:function(jq,_1fd){ +return _16b(jq[0],_1fd); +},refreshRow:function(jq,_1fe){ +return jq.each(function(){ +var opts=$.data(this,"datagrid").options; +opts.view.refreshRow.call(opts.view,this,_1fe); +}); +},validateRow:function(jq,_1ff){ +return _159(jq[0],_1ff); +},updateRow:function(jq,_200){ +return jq.each(function(){ +_18f(this,_200); +}); +},appendRow:function(jq,row){ +return jq.each(function(){ +_18c(this,row); +}); +},insertRow:function(jq,_201){ +return jq.each(function(){ +_188(this,_201); +}); +},deleteRow:function(jq,_202){ +return jq.each(function(){ +_182(this,_202); +}); +},getChanges:function(jq,_203){ +return _17c(jq[0],_203); +},acceptChanges:function(jq){ +return jq.each(function(){ +_199(this); +}); +},rejectChanges:function(jq){ +return jq.each(function(){ +_19b(this); +}); +},mergeCells:function(jq,_204){ +return jq.each(function(){ +_1ad(this,_204); +}); +},showColumn:function(jq,_205){ +return jq.each(function(){ +var col=$(this).datagrid("getColumnOption",_205); +if(col.hidden){ +col.hidden=false; +$(this).datagrid("getPanel").find("td[field=\""+_205+"\"]").show(); +_c1(this,_205,1); +$(this).datagrid("fitColumns"); +} +}); +},hideColumn:function(jq,_206){ +return jq.each(function(){ +var col=$(this).datagrid("getColumnOption",_206); +if(!col.hidden){ +col.hidden=true; +$(this).datagrid("getPanel").find("td[field=\""+_206+"\"]").hide(); +_c1(this,_206,-1); +$(this).datagrid("fitColumns"); +} +}); +},sort:function(jq,_207){ +return jq.each(function(){ +_8c(this,_207); +}); +},gotoPage:function(jq,_208){ +return jq.each(function(){ +var _209=this; +var page,cb; +if(typeof _208=="object"){ +page=_208.page; +cb=_208.callback; +}else{ +page=_208; +} +$(_209).datagrid("options").pageNumber=page; +$(_209).datagrid("getPager").pagination("refresh",{pageNumber:page}); +_bf(_209,null,function(){ +if(cb){ +cb.call(_209,page); +} +}); +}); +}}; +$.fn.datagrid.parseOptions=function(_20a){ +var t=$(_20a); +return $.extend({},$.fn.panel.parseOptions(_20a),$.parser.parseOptions(_20a,["url","toolbar","idField","sortName","sortOrder","pagePosition","resizeHandle",{sharedStyleSheet:"boolean",fitColumns:"boolean",autoRowHeight:"boolean",striped:"boolean",nowrap:"boolean"},{rownumbers:"boolean",singleSelect:"boolean",ctrlSelect:"boolean",checkOnSelect:"boolean",selectOnCheck:"boolean"},{pagination:"boolean",pageSize:"number",pageNumber:"number"},{multiSort:"boolean",remoteSort:"boolean",showHeader:"boolean",showFooter:"boolean"},{scrollbarSize:"number",scrollOnSelect:"boolean"}]),{pageList:(t.attr("pageList")?eval(t.attr("pageList")):undefined),loadMsg:(t.attr("loadMsg")!=undefined?t.attr("loadMsg"):undefined),rowStyler:(t.attr("rowStyler")?eval(t.attr("rowStyler")):undefined)}); +}; +$.fn.datagrid.parseData=function(_20b){ +var t=$(_20b); +var data={total:0,rows:[]}; +var _20c=t.datagrid("getColumnFields",true).concat(t.datagrid("getColumnFields",false)); +t.find("tbody tr").each(function(){ +data.total++; +var row={}; +$.extend(row,$.parser.parseOptions(this,["iconCls","state"])); +for(var i=0;i<_20c.length;i++){ +row[_20c[i]]=$(this).find("td:eq("+i+")").html(); +} +data.rows.push(row); +}); +return data; +}; +var _20d={render:function(_20e,_20f,_210){ +var rows=$(_20e).datagrid("getRows"); +$(_20f).html(this.renderTable(_20e,0,rows,_210)); +},renderFooter:function(_211,_212,_213){ +var opts=$.data(_211,"datagrid").options; +var rows=$.data(_211,"datagrid").footer||[]; +var _214=$(_211).datagrid("getColumnFields",_213); +var _215=[""]; +for(var i=0;i"); +_215.push(this.renderRow.call(this,_211,_214,_213,i,rows[i])); +_215.push(""); +} +_215.push("
"); +$(_212).html(_215.join("")); +},renderTable:function(_216,_217,rows,_218){ +var _219=$.data(_216,"datagrid"); +var opts=_219.options; +if(_218){ +if(!(opts.rownumbers||(opts.frozenColumns&&opts.frozenColumns.length))){ +return ""; +} +} +var _21a=$(_216).datagrid("getColumnFields",_218); +var _21b=[""]; +for(var i=0;i"); +_21b.push(this.renderRow.call(this,_216,_21a,_218,_217,row)); +_21b.push(""); +_217++; +} +_21b.push("
"); +return _21b.join(""); +},renderRow:function(_21e,_21f,_220,_221,_222){ +var opts=$.data(_21e,"datagrid").options; +var cc=[]; +if(_220&&opts.rownumbers){ +var _223=_221+1; +if(opts.pagination){ +_223+=(opts.pageNumber-1)*opts.pageSize; +} +cc.push("
"+_223+"
"); +} +for(var i=0;i<_21f.length;i++){ +var _224=_21f[i]; +var col=$(_21e).datagrid("getColumnOption",_224); +if(col){ +var _225=_222[_224]; +var css=col.styler?(col.styler.call(_21e,_225,_222,_221)||""):""; +var cs=this.getStyleValue(css); +var cls=cs.c?"class=\""+cs.c+"\"":""; +var _226=col.hidden?"style=\"display:none;"+cs.s+"\"":(cs.s?"style=\""+cs.s+"\"":""); +cc.push(""); +var _226=""; +if(!col.checkbox){ +if(col.align){ +_226+="text-align:"+col.align+";"; +} +if(!opts.nowrap){ +_226+="white-space:normal;height:auto;"; +}else{ +if(opts.autoRowHeight){ +_226+="height:auto;"; +} +} +} +cc.push("
"); +if(col.checkbox){ +cc.push(""); +}else{ +if(col.formatter){ +cc.push(col.formatter(_225,_222,_221)); +}else{ +cc.push(_225); +} +} +cc.push("
"); +cc.push(""); +} +} +return cc.join(""); +},getStyleValue:function(css){ +var _227=""; +var _228=""; +if(typeof css=="string"){ +_228=css; +}else{ +if(css){ +_227=css["class"]||""; +_228=css["style"]||""; +} +} +return {c:_227,s:_228}; +},refreshRow:function(_229,_22a){ +this.updateRow.call(this,_229,_22a,{}); +},updateRow:function(_22b,_22c,row){ +var opts=$.data(_22b,"datagrid").options; +var _22d=opts.finder.getRow(_22b,_22c); +$.extend(_22d,row); +var cs=_22e.call(this,_22c); +var _22f=cs.s; +var cls="datagrid-row "+(_22c%2&&opts.striped?"datagrid-row-alt ":" ")+cs.c; +function _22e(_230){ +var css=opts.rowStyler?opts.rowStyler.call(_22b,_230,_22d):""; +return this.getStyleValue(css); +}; +function _231(_232){ +var tr=opts.finder.getTr(_22b,_22c,"body",(_232?1:2)); +if(!tr.length){ +return; +} +var _233=$(_22b).datagrid("getColumnFields",_232); +var _234=tr.find("div.datagrid-cell-check input[type=checkbox]").is(":checked"); +tr.html(this.renderRow.call(this,_22b,_233,_232,_22c,_22d)); +var _235=(tr.hasClass("datagrid-row-checked")?" datagrid-row-checked":"")+(tr.hasClass("datagrid-row-selected")?" datagrid-row-selected":""); +tr.attr("style",_22f).attr("class",cls+_235); +if(_234){ +tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked",true); +} +}; +_231.call(this,true); +_231.call(this,false); +$(_22b).datagrid("fixRowHeight",_22c); +},insertRow:function(_236,_237,row){ +var _238=$.data(_236,"datagrid"); +var opts=_238.options; +var dc=_238.dc; +var data=_238.data; +if(_237==undefined||_237==null){ +_237=data.rows.length; +} +if(_237>data.rows.length){ +_237=data.rows.length; +} +function _239(_23a){ +var _23b=_23a?1:2; +for(var i=data.rows.length-1;i>=_237;i--){ +var tr=opts.finder.getTr(_236,i,"body",_23b); +tr.attr("datagrid-row-index",i+1); +tr.attr("id",_238.rowIdPrefix+"-"+_23b+"-"+(i+1)); +if(_23a&&opts.rownumbers){ +var _23c=i+2; +if(opts.pagination){ +_23c+=(opts.pageNumber-1)*opts.pageSize; +} +tr.find("div.datagrid-cell-rownumber").html(_23c); +} +if(opts.striped){ +tr.removeClass("datagrid-row-alt").addClass((i+1)%2?"datagrid-row-alt":""); +} +} +}; +function _23d(_23e){ +var _23f=_23e?1:2; +var _240=$(_236).datagrid("getColumnFields",_23e); +var _241=_238.rowIdPrefix+"-"+_23f+"-"+_237; +var tr=""; +if(_237>=data.rows.length){ +if(data.rows.length){ +opts.finder.getTr(_236,"","last",_23f).after(tr); +}else{ +var cc=_23e?dc.body1:dc.body2; +cc.html(""+tr+"
"); +} +}else{ +opts.finder.getTr(_236,_237+1,"body",_23f).before(tr); +} +}; +_239.call(this,true); +_239.call(this,false); +_23d.call(this,true); +_23d.call(this,false); +data.total+=1; +data.rows.splice(_237,0,row); +this.setEmptyMsg(_236); +this.refreshRow.call(this,_236,_237); +},deleteRow:function(_242,_243){ +var _244=$.data(_242,"datagrid"); +var opts=_244.options; +var data=_244.data; +function _245(_246){ +var _247=_246?1:2; +for(var i=_243+1;i").appendTo(_24e.dc.view); +d.html(opts.emptyMsg).css("top",h+"px"); +} +} +},renderEmptyRow:function(_250){ +var cols=$.map($(_250).datagrid("getColumnFields"),function(_251){ +return $(_250).datagrid("getColumnOption",_251); +}); +$.map(cols,function(col){ +col.formatter1=col.formatter; +col.styler1=col.styler; +col.formatter=col.styler=undefined; +}); +var _252=$.data(_250,"datagrid").dc.body2; +_252.html(this.renderTable(_250,0,[{}],false)); +_252.find("tbody *").css({height:1,borderColor:"transparent",background:"transparent"}); +var tr=_252.find(".datagrid-row"); +tr.removeClass("datagrid-row").removeAttr("datagrid-row-index"); +tr.find(".datagrid-cell,.datagrid-cell-check").empty(); +$.map(cols,function(col){ +col.formatter=col.formatter1; +col.styler=col.styler1; +col.formatter1=col.styler1=undefined; +}); +}}; +$.fn.datagrid.defaults=$.extend({},$.fn.panel.defaults,{sharedStyleSheet:false,frozenColumns:undefined,columns:undefined,fitColumns:false,resizeHandle:"right",autoRowHeight:true,toolbar:null,striped:false,method:"post",nowrap:true,idField:null,url:null,data:null,loadMsg:"Processing, please wait ...",emptyMsg:"",rownumbers:false,singleSelect:false,ctrlSelect:false,selectOnCheck:true,checkOnSelect:true,pagination:false,pagePosition:"bottom",pageNumber:1,pageSize:10,pageList:[10,20,30,40,50],queryParams:{},sortName:null,sortOrder:"asc",multiSort:false,remoteSort:true,showHeader:true,showFooter:false,scrollOnSelect:true,scrollbarSize:18,rownumberWidth:30,editorHeight:24,headerEvents:{mouseover:_82(true),mouseout:_82(false),click:_86,dblclick:_8d,contextmenu:_93},rowEvents:{mouseover:_96(true),mouseout:_96(false),click:_9e,dblclick:_a9,contextmenu:_ae},rowStyler:function(_253,_254){ +},loader:function(_255,_256,_257){ +var opts=$(this).datagrid("options"); +if(!opts.url){ +return false; +} +$.ajax({type:opts.method,url:opts.url,data:_255,dataType:"json",success:function(data){ +_256(data); +},error:function(){ +_257.apply(this,arguments); +}}); +},loadFilter:function(data){ +return data; +},editors:_1c4,finder:{getTr:function(_258,_259,type,_25a){ +type=type||"body"; +_25a=_25a||0; +var _25b=$.data(_258,"datagrid"); +var dc=_25b.dc; +var opts=_25b.options; +if(_25a==0){ +var tr1=opts.finder.getTr(_258,_259,type,1); +var tr2=opts.finder.getTr(_258,_259,type,2); +return tr1.add(tr2); +}else{ +if(type=="body"){ +var tr=$("#"+_25b.rowIdPrefix+"-"+_25a+"-"+_259); +if(!tr.length){ +tr=(_25a==1?dc.body1:dc.body2).find(">table>tbody>tr[datagrid-row-index="+_259+"]"); +} +return tr; +}else{ +if(type=="footer"){ +return (_25a==1?dc.footer1:dc.footer2).find(">table>tbody>tr[datagrid-row-index="+_259+"]"); +}else{ +if(type=="selected"){ +return (_25a==1?dc.body1:dc.body2).find(">table>tbody>tr.datagrid-row-selected"); +}else{ +if(type=="highlight"){ +return (_25a==1?dc.body1:dc.body2).find(">table>tbody>tr.datagrid-row-over"); +}else{ +if(type=="checked"){ +return (_25a==1?dc.body1:dc.body2).find(">table>tbody>tr.datagrid-row-checked"); +}else{ +if(type=="editing"){ +return (_25a==1?dc.body1:dc.body2).find(">table>tbody>tr.datagrid-row-editing"); +}else{ +if(type=="last"){ +return (_25a==1?dc.body1:dc.body2).find(">table>tbody>tr[datagrid-row-index]:last"); +}else{ +if(type=="allbody"){ +return (_25a==1?dc.body1:dc.body2).find(">table>tbody>tr[datagrid-row-index]"); +}else{ +if(type=="allfooter"){ +return (_25a==1?dc.footer1:dc.footer2).find(">table>tbody>tr[datagrid-row-index]"); +} +} +} +} +} +} +} +} +} +} +},getRow:function(_25c,p){ +var _25d=(typeof p=="object")?p.attr("datagrid-row-index"):p; +return $.data(_25c,"datagrid").data.rows[parseInt(_25d)]; +},getRows:function(_25e){ +return $(_25e).datagrid("getRows"); +}},view:_20d,onBeforeLoad:function(_25f){ +},onLoadSuccess:function(){ +},onLoadError:function(){ +},onClickRow:function(_260,_261){ +},onDblClickRow:function(_262,_263){ +},onClickCell:function(_264,_265,_266){ +},onDblClickCell:function(_267,_268,_269){ +},onBeforeSortColumn:function(sort,_26a){ +},onSortColumn:function(sort,_26b){ +},onResizeColumn:function(_26c,_26d){ +},onBeforeSelect:function(_26e,_26f){ +},onSelect:function(_270,_271){ +},onBeforeUnselect:function(_272,_273){ +},onUnselect:function(_274,_275){ +},onSelectAll:function(rows){ +},onUnselectAll:function(rows){ +},onBeforeCheck:function(_276,_277){ +},onCheck:function(_278,_279){ +},onBeforeUncheck:function(_27a,_27b){ +},onUncheck:function(_27c,_27d){ +},onCheckAll:function(rows){ +},onUncheckAll:function(rows){ +},onBeforeEdit:function(_27e,_27f){ +},onBeginEdit:function(_280,_281){ +},onEndEdit:function(_282,_283,_284){ +},onAfterEdit:function(_285,_286,_287){ +},onCancelEdit:function(_288,_289){ +},onHeaderContextMenu:function(e,_28a){ +},onRowContextMenu:function(e,_28b,_28c){ +}}); +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.datebox.js b/assets/js/easy-ui/plugins/jquery.datebox.js index d4aaec83d5..bd6f6df799 100755 --- a/assets/js/easy-ui/plugins/jquery.datebox.js +++ b/assets/js/easy-ui/plugins/jquery.datebox.js @@ -1,212 +1,212 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(_2){ -var _3=$.data(_2,"datebox"); -var _4=_3.options; -$(_2).addClass("datebox-f").combo($.extend({},_4,{onShowPanel:function(){ -_5(this); -_6(this); -_7(this); -_18(this,$(this).datebox("getText"),true); -_4.onShowPanel.call(this); -}})); -if(!_3.calendar){ -var _8=$(_2).combo("panel").css("overflow","hidden"); -_8.panel("options").onBeforeDestroy=function(){ -var c=$(this).find(".calendar-shared"); -if(c.length){ -c.insertBefore(c[0].pholder); -} -}; -var cc=$("
").prependTo(_8); -if(_4.sharedCalendar){ -var c=$(_4.sharedCalendar); -if(!c[0].pholder){ -c[0].pholder=$("
").insertAfter(c); -} -c.addClass("calendar-shared").appendTo(cc); -if(!c.hasClass("calendar")){ -c.calendar(); -} -_3.calendar=c; -}else{ -_3.calendar=$("
").appendTo(cc).calendar(); -} -$.extend(_3.calendar.calendar("options"),{fit:true,border:false,onSelect:function(_9){ -var _a=this.target; -var _b=$(_a).datebox("options"); -_18(_a,_b.formatter.call(_a,_9)); -$(_a).combo("hidePanel"); -_b.onSelect.call(_a,_9); -}}); -} -$(_2).combo("textbox").parent().addClass("datebox"); -$(_2).datebox("initValue",_4.value); -function _5(_c){ -var _d=$(_c).datebox("options"); -var _e=$(_c).combo("panel"); -_e.unbind(".datebox").bind("click.datebox",function(e){ -if($(e.target).hasClass("datebox-button-a")){ -var _f=parseInt($(e.target).attr("datebox-button-index")); -_d.buttons[_f].handler.call(e.target,_c); -} -}); -}; -function _6(_10){ -var _11=$(_10).combo("panel"); -if(_11.children("div.datebox-button").length){ -return; -} -var _12=$("
").appendTo(_11); -var tr=_12.find("tr"); -for(var i=0;i<_4.buttons.length;i++){ -var td=$("").appendTo(tr); -var btn=_4.buttons[i]; -var t=$("").html($.isFunction(btn.text)?btn.text(_10):btn.text).appendTo(td); -t.attr("datebox-button-index",i); -} -tr.find("td").css("width",(100/_4.buttons.length)+"%"); -}; -function _7(_13){ -var _14=$(_13).combo("panel"); -var cc=_14.children("div.datebox-calendar-inner"); -_14.children()._outerWidth(_14.width()); -_3.calendar.appendTo(cc); -_3.calendar[0].target=_13; -if(_4.panelHeight!="auto"){ -var _15=_14.height(); -_14.children().not(cc).each(function(){ -_15-=$(this).outerHeight(); -}); -cc._outerHeight(_15); -} -_3.calendar.calendar("resize"); -}; -}; -function _16(_17,q){ -_18(_17,q,true); -}; -function _19(_1a){ -var _1b=$.data(_1a,"datebox"); -var _1c=_1b.options; -var _1d=_1b.calendar.calendar("options").current; -if(_1d){ -_18(_1a,_1c.formatter.call(_1a,_1d)); -$(_1a).combo("hidePanel"); -} -}; -function _18(_1e,_1f,_20){ -var _21=$.data(_1e,"datebox"); -var _22=_21.options; -var _23=_21.calendar; -_23.calendar("moveTo",_22.parser.call(_1e,_1f)); -if(_20){ -$(_1e).combo("setValue",_1f); -}else{ -if(_1f){ -_1f=_22.formatter.call(_1e,_23.calendar("options").current); -} -$(_1e).combo("setText",_1f).combo("setValue",_1f); -} -}; -$.fn.datebox=function(_24,_25){ -if(typeof _24=="string"){ -var _26=$.fn.datebox.methods[_24]; -if(_26){ -return _26(this,_25); -}else{ -return this.combo(_24,_25); -} -} -_24=_24||{}; -return this.each(function(){ -var _27=$.data(this,"datebox"); -if(_27){ -$.extend(_27.options,_24); -}else{ -$.data(this,"datebox",{options:$.extend({},$.fn.datebox.defaults,$.fn.datebox.parseOptions(this),_24)}); -} -_1(this); -}); -}; -$.fn.datebox.methods={options:function(jq){ -var _28=jq.combo("options"); -return $.extend($.data(jq[0],"datebox").options,{width:_28.width,height:_28.height,originalValue:_28.originalValue,disabled:_28.disabled,readonly:_28.readonly}); -},cloneFrom:function(jq,_29){ -return jq.each(function(){ -$(this).combo("cloneFrom",_29); -$.data(this,"datebox",{options:$.extend(true,{},$(_29).datebox("options")),calendar:$(_29).datebox("calendar")}); -$(this).addClass("datebox-f"); -}); -},calendar:function(jq){ -return $.data(jq[0],"datebox").calendar; -},initValue:function(jq,_2a){ -return jq.each(function(){ -var _2b=$(this).datebox("options"); -var _2c=_2b.value; -if(_2c){ -_2c=_2b.formatter.call(this,_2b.parser.call(this,_2c)); -} -$(this).combo("initValue",_2c).combo("setText",_2c); -}); -},setValue:function(jq,_2d){ -return jq.each(function(){ -_18(this,_2d); -}); -},reset:function(jq){ -return jq.each(function(){ -var _2e=$(this).datebox("options"); -$(this).datebox("setValue",_2e.originalValue); -}); -}}; -$.fn.datebox.parseOptions=function(_2f){ -return $.extend({},$.fn.combo.parseOptions(_2f),$.parser.parseOptions(_2f,["sharedCalendar"])); -}; -$.fn.datebox.defaults=$.extend({},$.fn.combo.defaults,{panelWidth:180,panelHeight:"auto",sharedCalendar:null,keyHandler:{up:function(e){ -},down:function(e){ -},left:function(e){ -},right:function(e){ -},enter:function(e){ -_19(this); -},query:function(q,e){ -_16(this,q); -}},currentText:"Today",closeText:"Close",okText:"Ok",buttons:[{text:function(_30){ -return $(_30).datebox("options").currentText; -},handler:function(_31){ -var now=new Date(); -$(_31).datebox("calendar").calendar({year:now.getFullYear(),month:now.getMonth()+1,current:new Date(now.getFullYear(),now.getMonth(),now.getDate())}); -_19(_31); -}},{text:function(_32){ -return $(_32).datebox("options").closeText; -},handler:function(_33){ -$(this).closest("div.combo-panel").panel("close"); -}}],formatter:function(_34){ -var y=_34.getFullYear(); -var m=_34.getMonth()+1; -var d=_34.getDate(); -return (m<10?("0"+m):m)+"/"+(d<10?("0"+d):d)+"/"+y; -},parser:function(s){ -if(!s){ -return new Date(); -} -var ss=s.split("/"); -var m=parseInt(ss[0],10); -var d=parseInt(ss[1],10); -var y=parseInt(ss[2],10); -if(!isNaN(y)&&!isNaN(m)&&!isNaN(d)){ -return new Date(y,m-1,d); -}else{ -return new Date(); -} -},onSelect:function(_35){ -}}); -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(_2){ +var _3=$.data(_2,"datebox"); +var _4=_3.options; +$(_2).addClass("datebox-f").combo($.extend({},_4,{onShowPanel:function(){ +_5(this); +_6(this); +_7(this); +_18(this,$(this).datebox("getText"),true); +_4.onShowPanel.call(this); +}})); +if(!_3.calendar){ +var _8=$(_2).combo("panel").css("overflow","hidden"); +_8.panel("options").onBeforeDestroy=function(){ +var c=$(this).find(".calendar-shared"); +if(c.length){ +c.insertBefore(c[0].pholder); +} +}; +var cc=$("
").prependTo(_8); +if(_4.sharedCalendar){ +var c=$(_4.sharedCalendar); +if(!c[0].pholder){ +c[0].pholder=$("
").insertAfter(c); +} +c.addClass("calendar-shared").appendTo(cc); +if(!c.hasClass("calendar")){ +c.calendar(); +} +_3.calendar=c; +}else{ +_3.calendar=$("
").appendTo(cc).calendar(); +} +$.extend(_3.calendar.calendar("options"),{fit:true,border:false,onSelect:function(_9){ +var _a=this.target; +var _b=$(_a).datebox("options"); +_18(_a,_b.formatter.call(_a,_9)); +$(_a).combo("hidePanel"); +_b.onSelect.call(_a,_9); +}}); +} +$(_2).combo("textbox").parent().addClass("datebox"); +$(_2).datebox("initValue",_4.value); +function _5(_c){ +var _d=$(_c).datebox("options"); +var _e=$(_c).combo("panel"); +_e.unbind(".datebox").bind("click.datebox",function(e){ +if($(e.target).hasClass("datebox-button-a")){ +var _f=parseInt($(e.target).attr("datebox-button-index")); +_d.buttons[_f].handler.call(e.target,_c); +} +}); +}; +function _6(_10){ +var _11=$(_10).combo("panel"); +if(_11.children("div.datebox-button").length){ +return; +} +var _12=$("
").appendTo(_11); +var tr=_12.find("tr"); +for(var i=0;i<_4.buttons.length;i++){ +var td=$("").appendTo(tr); +var btn=_4.buttons[i]; +var t=$("").html($.isFunction(btn.text)?btn.text(_10):btn.text).appendTo(td); +t.attr("datebox-button-index",i); +} +tr.find("td").css("width",(100/_4.buttons.length)+"%"); +}; +function _7(_13){ +var _14=$(_13).combo("panel"); +var cc=_14.children("div.datebox-calendar-inner"); +_14.children()._outerWidth(_14.width()); +_3.calendar.appendTo(cc); +_3.calendar[0].target=_13; +if(_4.panelHeight!="auto"){ +var _15=_14.height(); +_14.children().not(cc).each(function(){ +_15-=$(this).outerHeight(); +}); +cc._outerHeight(_15); +} +_3.calendar.calendar("resize"); +}; +}; +function _16(_17,q){ +_18(_17,q,true); +}; +function _19(_1a){ +var _1b=$.data(_1a,"datebox"); +var _1c=_1b.options; +var _1d=_1b.calendar.calendar("options").current; +if(_1d){ +_18(_1a,_1c.formatter.call(_1a,_1d)); +$(_1a).combo("hidePanel"); +} +}; +function _18(_1e,_1f,_20){ +var _21=$.data(_1e,"datebox"); +var _22=_21.options; +var _23=_21.calendar; +_23.calendar("moveTo",_22.parser.call(_1e,_1f)); +if(_20){ +$(_1e).combo("setValue",_1f); +}else{ +if(_1f){ +_1f=_22.formatter.call(_1e,_23.calendar("options").current); +} +$(_1e).combo("setText",_1f).combo("setValue",_1f); +} +}; +$.fn.datebox=function(_24,_25){ +if(typeof _24=="string"){ +var _26=$.fn.datebox.methods[_24]; +if(_26){ +return _26(this,_25); +}else{ +return this.combo(_24,_25); +} +} +_24=_24||{}; +return this.each(function(){ +var _27=$.data(this,"datebox"); +if(_27){ +$.extend(_27.options,_24); +}else{ +$.data(this,"datebox",{options:$.extend({},$.fn.datebox.defaults,$.fn.datebox.parseOptions(this),_24)}); +} +_1(this); +}); +}; +$.fn.datebox.methods={options:function(jq){ +var _28=jq.combo("options"); +return $.extend($.data(jq[0],"datebox").options,{width:_28.width,height:_28.height,originalValue:_28.originalValue,disabled:_28.disabled,readonly:_28.readonly}); +},cloneFrom:function(jq,_29){ +return jq.each(function(){ +$(this).combo("cloneFrom",_29); +$.data(this,"datebox",{options:$.extend(true,{},$(_29).datebox("options")),calendar:$(_29).datebox("calendar")}); +$(this).addClass("datebox-f"); +}); +},calendar:function(jq){ +return $.data(jq[0],"datebox").calendar; +},initValue:function(jq,_2a){ +return jq.each(function(){ +var _2b=$(this).datebox("options"); +var _2c=_2b.value; +if(_2c){ +_2c=_2b.formatter.call(this,_2b.parser.call(this,_2c)); +} +$(this).combo("initValue",_2c).combo("setText",_2c); +}); +},setValue:function(jq,_2d){ +return jq.each(function(){ +_18(this,_2d); +}); +},reset:function(jq){ +return jq.each(function(){ +var _2e=$(this).datebox("options"); +$(this).datebox("setValue",_2e.originalValue); +}); +}}; +$.fn.datebox.parseOptions=function(_2f){ +return $.extend({},$.fn.combo.parseOptions(_2f),$.parser.parseOptions(_2f,["sharedCalendar"])); +}; +$.fn.datebox.defaults=$.extend({},$.fn.combo.defaults,{panelWidth:180,panelHeight:"auto",sharedCalendar:null,keyHandler:{up:function(e){ +},down:function(e){ +},left:function(e){ +},right:function(e){ +},enter:function(e){ +_19(this); +},query:function(q,e){ +_16(this,q); +}},currentText:"Today",closeText:"Close",okText:"Ok",buttons:[{text:function(_30){ +return $(_30).datebox("options").currentText; +},handler:function(_31){ +var now=new Date(); +$(_31).datebox("calendar").calendar({year:now.getFullYear(),month:now.getMonth()+1,current:new Date(now.getFullYear(),now.getMonth(),now.getDate())}); +_19(_31); +}},{text:function(_32){ +return $(_32).datebox("options").closeText; +},handler:function(_33){ +$(this).closest("div.combo-panel").panel("close"); +}}],formatter:function(_34){ +var y=_34.getFullYear(); +var m=_34.getMonth()+1; +var d=_34.getDate(); +return (m<10?("0"+m):m)+"/"+(d<10?("0"+d):d)+"/"+y; +},parser:function(s){ +if(!s){ +return new Date(); +} +var ss=s.split("/"); +var m=parseInt(ss[0],10); +var d=parseInt(ss[1],10); +var y=parseInt(ss[2],10); +if(!isNaN(y)&&!isNaN(m)&&!isNaN(d)){ +return new Date(y,m-1,d); +}else{ +return new Date(); +} +},onSelect:function(_35){ +}}); +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.datetimebox.js b/assets/js/easy-ui/plugins/jquery.datetimebox.js index 47dc1d705f..5331632a33 100755 --- a/assets/js/easy-ui/plugins/jquery.datetimebox.js +++ b/assets/js/easy-ui/plugins/jquery.datetimebox.js @@ -1,178 +1,178 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(_2){ -var _3=$.data(_2,"datetimebox"); -var _4=_3.options; -$(_2).datebox($.extend({},_4,{onShowPanel:function(){ -var _5=$(this).datetimebox("getValue"); -_d(this,_5,true); -_4.onShowPanel.call(this); -},formatter:$.fn.datebox.defaults.formatter,parser:$.fn.datebox.defaults.parser})); -$(_2).removeClass("datebox-f").addClass("datetimebox-f"); -$(_2).datebox("calendar").calendar({onSelect:function(_6){ -_4.onSelect.call(this.target,_6); -}}); -if(!_3.spinner){ -var _7=$(_2).datebox("panel"); -var p=$("
").insertAfter(_7.children("div.datebox-calendar-inner")); -_3.spinner=p.children("input"); -} -_3.spinner.timespinner({width:_4.spinnerWidth,showSeconds:_4.showSeconds,separator:_4.timeSeparator}); -$(_2).datetimebox("initValue",_4.value); -}; -function _8(_9){ -var c=$(_9).datetimebox("calendar"); -var t=$(_9).datetimebox("spinner"); -var _a=c.calendar("options").current; -return new Date(_a.getFullYear(),_a.getMonth(),_a.getDate(),t.timespinner("getHours"),t.timespinner("getMinutes"),t.timespinner("getSeconds")); -}; -function _b(_c,q){ -_d(_c,q,true); -}; -function _e(_f){ -var _10=$.data(_f,"datetimebox").options; -var _11=_8(_f); -_d(_f,_10.formatter.call(_f,_11)); -$(_f).combo("hidePanel"); -}; -function _d(_12,_13,_14){ -var _15=$.data(_12,"datetimebox").options; -$(_12).combo("setValue",_13); -if(!_14){ -if(_13){ -var _16=_15.parser.call(_12,_13); -$(_12).combo("setText",_15.formatter.call(_12,_16)); -$(_12).combo("setValue",_15.formatter.call(_12,_16)); -}else{ -$(_12).combo("setText",_13); -} -} -var _16=_15.parser.call(_12,_13); -$(_12).datetimebox("calendar").calendar("moveTo",_16); -$(_12).datetimebox("spinner").timespinner("setValue",_17(_16)); -function _17(_18){ -function _19(_1a){ -return (_1a<10?"0":"")+_1a; -}; -var tt=[_19(_18.getHours()),_19(_18.getMinutes())]; -if(_15.showSeconds){ -tt.push(_19(_18.getSeconds())); -} -return tt.join($(_12).datetimebox("spinner").timespinner("options").separator); -}; -}; -$.fn.datetimebox=function(_1b,_1c){ -if(typeof _1b=="string"){ -var _1d=$.fn.datetimebox.methods[_1b]; -if(_1d){ -return _1d(this,_1c); -}else{ -return this.datebox(_1b,_1c); -} -} -_1b=_1b||{}; -return this.each(function(){ -var _1e=$.data(this,"datetimebox"); -if(_1e){ -$.extend(_1e.options,_1b); -}else{ -$.data(this,"datetimebox",{options:$.extend({},$.fn.datetimebox.defaults,$.fn.datetimebox.parseOptions(this),_1b)}); -} -_1(this); -}); -}; -$.fn.datetimebox.methods={options:function(jq){ -var _1f=jq.datebox("options"); -return $.extend($.data(jq[0],"datetimebox").options,{originalValue:_1f.originalValue,disabled:_1f.disabled,readonly:_1f.readonly}); -},cloneFrom:function(jq,_20){ -return jq.each(function(){ -$(this).datebox("cloneFrom",_20); -$.data(this,"datetimebox",{options:$.extend(true,{},$(_20).datetimebox("options")),spinner:$(_20).datetimebox("spinner")}); -$(this).removeClass("datebox-f").addClass("datetimebox-f"); -}); -},spinner:function(jq){ -return $.data(jq[0],"datetimebox").spinner; -},initValue:function(jq,_21){ -return jq.each(function(){ -var _22=$(this).datetimebox("options"); -var _23=_22.value; -if(_23){ -_23=_22.formatter.call(this,_22.parser.call(this,_23)); -} -$(this).combo("initValue",_23).combo("setText",_23); -}); -},setValue:function(jq,_24){ -return jq.each(function(){ -_d(this,_24); -}); -},reset:function(jq){ -return jq.each(function(){ -var _25=$(this).datetimebox("options"); -$(this).datetimebox("setValue",_25.originalValue); -}); -}}; -$.fn.datetimebox.parseOptions=function(_26){ -var t=$(_26); -return $.extend({},$.fn.datebox.parseOptions(_26),$.parser.parseOptions(_26,["timeSeparator","spinnerWidth",{showSeconds:"boolean"}])); -}; -$.fn.datetimebox.defaults=$.extend({},$.fn.datebox.defaults,{spinnerWidth:"100%",showSeconds:true,timeSeparator:":",keyHandler:{up:function(e){ -},down:function(e){ -},left:function(e){ -},right:function(e){ -},enter:function(e){ -_e(this); -},query:function(q,e){ -_b(this,q); -}},buttons:[{text:function(_27){ -return $(_27).datetimebox("options").currentText; -},handler:function(_28){ -var _29=$(_28).datetimebox("options"); -_d(_28,_29.formatter.call(_28,new Date())); -$(_28).datetimebox("hidePanel"); -}},{text:function(_2a){ -return $(_2a).datetimebox("options").okText; -},handler:function(_2b){ -_e(_2b); -}},{text:function(_2c){ -return $(_2c).datetimebox("options").closeText; -},handler:function(_2d){ -$(_2d).datetimebox("hidePanel"); -}}],formatter:function(_2e){ -var h=_2e.getHours(); -var M=_2e.getMinutes(); -var s=_2e.getSeconds(); -function _2f(_30){ -return (_30<10?"0":"")+_30; -}; -var _31=$(this).datetimebox("spinner").timespinner("options").separator; -var r=$.fn.datebox.defaults.formatter(_2e)+" "+_2f(h)+_31+_2f(M); -if($(this).datetimebox("options").showSeconds){ -r+=_31+_2f(s); -} -return r; -},parser:function(s){ -if($.trim(s)==""){ -return new Date(); -} -var dt=s.split(" "); -var d=$.fn.datebox.defaults.parser(dt[0]); -if(dt.length<2){ -return d; -} -var _32=$(this).datetimebox("spinner").timespinner("options").separator; -var tt=dt[1].split(_32); -var _33=parseInt(tt[0],10)||0; -var _34=parseInt(tt[1],10)||0; -var _35=parseInt(tt[2],10)||0; -return new Date(d.getFullYear(),d.getMonth(),d.getDate(),_33,_34,_35); -}}); -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(_2){ +var _3=$.data(_2,"datetimebox"); +var _4=_3.options; +$(_2).datebox($.extend({},_4,{onShowPanel:function(){ +var _5=$(this).datetimebox("getValue"); +_d(this,_5,true); +_4.onShowPanel.call(this); +},formatter:$.fn.datebox.defaults.formatter,parser:$.fn.datebox.defaults.parser})); +$(_2).removeClass("datebox-f").addClass("datetimebox-f"); +$(_2).datebox("calendar").calendar({onSelect:function(_6){ +_4.onSelect.call(this.target,_6); +}}); +if(!_3.spinner){ +var _7=$(_2).datebox("panel"); +var p=$("
").insertAfter(_7.children("div.datebox-calendar-inner")); +_3.spinner=p.children("input"); +} +_3.spinner.timespinner({width:_4.spinnerWidth,showSeconds:_4.showSeconds,separator:_4.timeSeparator}); +$(_2).datetimebox("initValue",_4.value); +}; +function _8(_9){ +var c=$(_9).datetimebox("calendar"); +var t=$(_9).datetimebox("spinner"); +var _a=c.calendar("options").current; +return new Date(_a.getFullYear(),_a.getMonth(),_a.getDate(),t.timespinner("getHours"),t.timespinner("getMinutes"),t.timespinner("getSeconds")); +}; +function _b(_c,q){ +_d(_c,q,true); +}; +function _e(_f){ +var _10=$.data(_f,"datetimebox").options; +var _11=_8(_f); +_d(_f,_10.formatter.call(_f,_11)); +$(_f).combo("hidePanel"); +}; +function _d(_12,_13,_14){ +var _15=$.data(_12,"datetimebox").options; +$(_12).combo("setValue",_13); +if(!_14){ +if(_13){ +var _16=_15.parser.call(_12,_13); +$(_12).combo("setText",_15.formatter.call(_12,_16)); +$(_12).combo("setValue",_15.formatter.call(_12,_16)); +}else{ +$(_12).combo("setText",_13); +} +} +var _16=_15.parser.call(_12,_13); +$(_12).datetimebox("calendar").calendar("moveTo",_16); +$(_12).datetimebox("spinner").timespinner("setValue",_17(_16)); +function _17(_18){ +function _19(_1a){ +return (_1a<10?"0":"")+_1a; +}; +var tt=[_19(_18.getHours()),_19(_18.getMinutes())]; +if(_15.showSeconds){ +tt.push(_19(_18.getSeconds())); +} +return tt.join($(_12).datetimebox("spinner").timespinner("options").separator); +}; +}; +$.fn.datetimebox=function(_1b,_1c){ +if(typeof _1b=="string"){ +var _1d=$.fn.datetimebox.methods[_1b]; +if(_1d){ +return _1d(this,_1c); +}else{ +return this.datebox(_1b,_1c); +} +} +_1b=_1b||{}; +return this.each(function(){ +var _1e=$.data(this,"datetimebox"); +if(_1e){ +$.extend(_1e.options,_1b); +}else{ +$.data(this,"datetimebox",{options:$.extend({},$.fn.datetimebox.defaults,$.fn.datetimebox.parseOptions(this),_1b)}); +} +_1(this); +}); +}; +$.fn.datetimebox.methods={options:function(jq){ +var _1f=jq.datebox("options"); +return $.extend($.data(jq[0],"datetimebox").options,{originalValue:_1f.originalValue,disabled:_1f.disabled,readonly:_1f.readonly}); +},cloneFrom:function(jq,_20){ +return jq.each(function(){ +$(this).datebox("cloneFrom",_20); +$.data(this,"datetimebox",{options:$.extend(true,{},$(_20).datetimebox("options")),spinner:$(_20).datetimebox("spinner")}); +$(this).removeClass("datebox-f").addClass("datetimebox-f"); +}); +},spinner:function(jq){ +return $.data(jq[0],"datetimebox").spinner; +},initValue:function(jq,_21){ +return jq.each(function(){ +var _22=$(this).datetimebox("options"); +var _23=_22.value; +if(_23){ +_23=_22.formatter.call(this,_22.parser.call(this,_23)); +} +$(this).combo("initValue",_23).combo("setText",_23); +}); +},setValue:function(jq,_24){ +return jq.each(function(){ +_d(this,_24); +}); +},reset:function(jq){ +return jq.each(function(){ +var _25=$(this).datetimebox("options"); +$(this).datetimebox("setValue",_25.originalValue); +}); +}}; +$.fn.datetimebox.parseOptions=function(_26){ +var t=$(_26); +return $.extend({},$.fn.datebox.parseOptions(_26),$.parser.parseOptions(_26,["timeSeparator","spinnerWidth",{showSeconds:"boolean"}])); +}; +$.fn.datetimebox.defaults=$.extend({},$.fn.datebox.defaults,{spinnerWidth:"100%",showSeconds:true,timeSeparator:":",keyHandler:{up:function(e){ +},down:function(e){ +},left:function(e){ +},right:function(e){ +},enter:function(e){ +_e(this); +},query:function(q,e){ +_b(this,q); +}},buttons:[{text:function(_27){ +return $(_27).datetimebox("options").currentText; +},handler:function(_28){ +var _29=$(_28).datetimebox("options"); +_d(_28,_29.formatter.call(_28,new Date())); +$(_28).datetimebox("hidePanel"); +}},{text:function(_2a){ +return $(_2a).datetimebox("options").okText; +},handler:function(_2b){ +_e(_2b); +}},{text:function(_2c){ +return $(_2c).datetimebox("options").closeText; +},handler:function(_2d){ +$(_2d).datetimebox("hidePanel"); +}}],formatter:function(_2e){ +var h=_2e.getHours(); +var M=_2e.getMinutes(); +var s=_2e.getSeconds(); +function _2f(_30){ +return (_30<10?"0":"")+_30; +}; +var _31=$(this).datetimebox("spinner").timespinner("options").separator; +var r=$.fn.datebox.defaults.formatter(_2e)+" "+_2f(h)+_31+_2f(M); +if($(this).datetimebox("options").showSeconds){ +r+=_31+_2f(s); +} +return r; +},parser:function(s){ +if($.trim(s)==""){ +return new Date(); +} +var dt=s.split(" "); +var d=$.fn.datebox.defaults.parser(dt[0]); +if(dt.length<2){ +return d; +} +var _32=$(this).datetimebox("spinner").timespinner("options").separator; +var tt=dt[1].split(_32); +var _33=parseInt(tt[0],10)||0; +var _34=parseInt(tt[1],10)||0; +var _35=parseInt(tt[2],10)||0; +return new Date(d.getFullYear(),d.getMonth(),d.getDate(),_33,_34,_35); +}}); +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.datetimespinner.js b/assets/js/easy-ui/plugins/jquery.datetimespinner.js index 9d0376988f..e68d4a041c 100755 --- a/assets/js/easy-ui/plugins/jquery.datetimespinner.js +++ b/assets/js/easy-ui/plugins/jquery.datetimespinner.js @@ -1,61 +1,61 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(_2){ -var _3=$.data(_2,"datetimespinner").options; -$(_2).addClass("datetimespinner-f").timespinner(_3); -}; -$.fn.datetimespinner=function(_4,_5){ -if(typeof _4=="string"){ -var _6=$.fn.datetimespinner.methods[_4]; -if(_6){ -return _6(this,_5); -}else{ -return this.timespinner(_4,_5); -} -} -_4=_4||{}; -return this.each(function(){ -var _7=$.data(this,"datetimespinner"); -if(_7){ -$.extend(_7.options,_4); -}else{ -$.data(this,"datetimespinner",{options:$.extend({},$.fn.datetimespinner.defaults,$.fn.datetimespinner.parseOptions(this),_4)}); -} -_1(this); -}); -}; -$.fn.datetimespinner.methods={options:function(jq){ -var _8=jq.timespinner("options"); -return $.extend($.data(jq[0],"datetimespinner").options,{width:_8.width,value:_8.value,originalValue:_8.originalValue,disabled:_8.disabled,readonly:_8.readonly}); -}}; -$.fn.datetimespinner.parseOptions=function(_9){ -return $.extend({},$.fn.timespinner.parseOptions(_9),$.parser.parseOptions(_9,[])); -}; -$.fn.datetimespinner.defaults=$.extend({},$.fn.timespinner.defaults,{formatter:function(_a){ -if(!_a){ -return ""; -} -return $.fn.datebox.defaults.formatter.call(this,_a)+" "+$.fn.timespinner.defaults.formatter.call(this,_a); -},parser:function(s){ -s=$.trim(s); -if(!s){ -return null; -} -var dt=s.split(" "); -var _b=$.fn.datebox.defaults.parser.call(this,dt[0]); -if(dt.length<2){ -return _b; -} -var _c=$.fn.timespinner.defaults.parser.call(this,dt[1]); -return new Date(_b.getFullYear(),_b.getMonth(),_b.getDate(),_c.getHours(),_c.getMinutes(),_c.getSeconds()); -},selections:[[0,2],[3,5],[6,10],[11,13],[14,16],[17,19]]}); -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(_2){ +var _3=$.data(_2,"datetimespinner").options; +$(_2).addClass("datetimespinner-f").timespinner(_3); +}; +$.fn.datetimespinner=function(_4,_5){ +if(typeof _4=="string"){ +var _6=$.fn.datetimespinner.methods[_4]; +if(_6){ +return _6(this,_5); +}else{ +return this.timespinner(_4,_5); +} +} +_4=_4||{}; +return this.each(function(){ +var _7=$.data(this,"datetimespinner"); +if(_7){ +$.extend(_7.options,_4); +}else{ +$.data(this,"datetimespinner",{options:$.extend({},$.fn.datetimespinner.defaults,$.fn.datetimespinner.parseOptions(this),_4)}); +} +_1(this); +}); +}; +$.fn.datetimespinner.methods={options:function(jq){ +var _8=jq.timespinner("options"); +return $.extend($.data(jq[0],"datetimespinner").options,{width:_8.width,value:_8.value,originalValue:_8.originalValue,disabled:_8.disabled,readonly:_8.readonly}); +}}; +$.fn.datetimespinner.parseOptions=function(_9){ +return $.extend({},$.fn.timespinner.parseOptions(_9),$.parser.parseOptions(_9,[])); +}; +$.fn.datetimespinner.defaults=$.extend({},$.fn.timespinner.defaults,{formatter:function(_a){ +if(!_a){ +return ""; +} +return $.fn.datebox.defaults.formatter.call(this,_a)+" "+$.fn.timespinner.defaults.formatter.call(this,_a); +},parser:function(s){ +s=$.trim(s); +if(!s){ +return null; +} +var dt=s.split(" "); +var _b=$.fn.datebox.defaults.parser.call(this,dt[0]); +if(dt.length<2){ +return _b; +} +var _c=$.fn.timespinner.defaults.parser.call(this,dt[1]); +return new Date(_b.getFullYear(),_b.getMonth(),_b.getDate(),_c.getHours(),_c.getMinutes(),_c.getSeconds()); +},selections:[[0,2],[3,5],[6,10],[11,13],[14,16],[17,19]]}); +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.dialog.js b/assets/js/easy-ui/plugins/jquery.dialog.js index c611ecdcc2..8b5746eefb 100755 --- a/assets/js/easy-ui/plugins/jquery.dialog.js +++ b/assets/js/easy-ui/plugins/jquery.dialog.js @@ -1,136 +1,136 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(_2){ -var _3=$.data(_2,"dialog").options; -_3.inited=false; -$(_2).window($.extend({},_3,{onResize:function(w,h){ -if(_3.inited){ -_b(this); -_3.onResize.call(this,w,h); -} -}})); -var _4=$(_2).window("window"); -if(_3.toolbar){ -if($.isArray(_3.toolbar)){ -$(_2).siblings("div.dialog-toolbar").remove(); -var _5=$("
").appendTo(_4); -var tr=_5.find("tr"); -for(var i=0;i<_3.toolbar.length;i++){ -var _6=_3.toolbar[i]; -if(_6=="-"){ -$("
").appendTo(tr); -}else{ -var td=$("").appendTo(tr); -var _7=$("").appendTo(td); -_7[0].onclick=eval(_6.handler||function(){ -}); -_7.linkbutton($.extend({},_6,{plain:true})); -} -} -}else{ -$(_3.toolbar).addClass("dialog-toolbar").appendTo(_4); -$(_3.toolbar).show(); -} -}else{ -$(_2).siblings("div.dialog-toolbar").remove(); -} -if(_3.buttons){ -if($.isArray(_3.buttons)){ -$(_2).siblings("div.dialog-button").remove(); -var _8=$("
").appendTo(_4); -for(var i=0;i<_3.buttons.length;i++){ -var p=_3.buttons[i]; -var _9=$("").appendTo(_8); -if(p.handler){ -_9[0].onclick=p.handler; -} -_9.linkbutton(p); -} -}else{ -$(_3.buttons).addClass("dialog-button").appendTo(_4); -$(_3.buttons).show(); -} -}else{ -$(_2).siblings("div.dialog-button").remove(); -} -_3.inited=true; -var _a=_3.closed; -_4.show(); -$(_2).window("resize"); -if(_a){ -_4.hide(); -} -}; -function _b(_c,_d){ -var t=$(_c); -var _e=t.dialog("options"); -var _f=_e.noheader; -var tb=t.siblings(".dialog-toolbar"); -var bb=t.siblings(".dialog-button"); -tb.insertBefore(_c).css({borderTopWidth:(_f?1:0),top:(_f?tb.length:0)}); -bb.insertAfter(_c); -tb.add(bb)._outerWidth(t._outerWidth()).find(".easyui-fluid:visible").each(function(){ -$(this).triggerHandler("_resize"); -}); -var _10=tb._outerHeight()+bb._outerHeight(); -if(!isNaN(parseInt(_e.height))){ -t._outerHeight(t._outerHeight()-_10); -}else{ -var _11=t._size("min-height"); -if(_11){ -t._size("min-height",_11-_10); -} -var _12=t._size("max-height"); -if(_12){ -t._size("max-height",_12-_10); -} -} -var _13=$.data(_c,"window").shadow; -if(_13){ -var cc=t.panel("panel"); -_13.css({width:cc._outerWidth(),height:cc._outerHeight()}); -} -}; -$.fn.dialog=function(_14,_15){ -if(typeof _14=="string"){ -var _16=$.fn.dialog.methods[_14]; -if(_16){ -return _16(this,_15); -}else{ -return this.window(_14,_15); -} -} -_14=_14||{}; -return this.each(function(){ -var _17=$.data(this,"dialog"); -if(_17){ -$.extend(_17.options,_14); -}else{ -$.data(this,"dialog",{options:$.extend({},$.fn.dialog.defaults,$.fn.dialog.parseOptions(this),_14)}); -} -_1(this); -}); -}; -$.fn.dialog.methods={options:function(jq){ -var _18=$.data(jq[0],"dialog").options; -var _19=jq.panel("options"); -$.extend(_18,{width:_19.width,height:_19.height,left:_19.left,top:_19.top,closed:_19.closed,collapsed:_19.collapsed,minimized:_19.minimized,maximized:_19.maximized}); -return _18; -},dialog:function(jq){ -return jq.window("window"); -}}; -$.fn.dialog.parseOptions=function(_1a){ -var t=$(_1a); -return $.extend({},$.fn.window.parseOptions(_1a),$.parser.parseOptions(_1a,["toolbar","buttons"]),{toolbar:(t.children(".dialog-toolbar").length?t.children(".dialog-toolbar").removeClass("dialog-toolbar"):undefined),buttons:(t.children(".dialog-button").length?t.children(".dialog-button").removeClass("dialog-button"):undefined)}); -}; -$.fn.dialog.defaults=$.extend({},$.fn.window.defaults,{title:"New Dialog",collapsible:false,minimizable:false,maximizable:false,resizable:false,toolbar:null,buttons:null}); -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(_2){ +var _3=$.data(_2,"dialog").options; +_3.inited=false; +$(_2).window($.extend({},_3,{onResize:function(w,h){ +if(_3.inited){ +_b(this); +_3.onResize.call(this,w,h); +} +}})); +var _4=$(_2).window("window"); +if(_3.toolbar){ +if($.isArray(_3.toolbar)){ +$(_2).siblings("div.dialog-toolbar").remove(); +var _5=$("
").appendTo(_4); +var tr=_5.find("tr"); +for(var i=0;i<_3.toolbar.length;i++){ +var _6=_3.toolbar[i]; +if(_6=="-"){ +$("
").appendTo(tr); +}else{ +var td=$("").appendTo(tr); +var _7=$("").appendTo(td); +_7[0].onclick=eval(_6.handler||function(){ +}); +_7.linkbutton($.extend({},_6,{plain:true})); +} +} +}else{ +$(_3.toolbar).addClass("dialog-toolbar").appendTo(_4); +$(_3.toolbar).show(); +} +}else{ +$(_2).siblings("div.dialog-toolbar").remove(); +} +if(_3.buttons){ +if($.isArray(_3.buttons)){ +$(_2).siblings("div.dialog-button").remove(); +var _8=$("
").appendTo(_4); +for(var i=0;i<_3.buttons.length;i++){ +var p=_3.buttons[i]; +var _9=$("").appendTo(_8); +if(p.handler){ +_9[0].onclick=p.handler; +} +_9.linkbutton(p); +} +}else{ +$(_3.buttons).addClass("dialog-button").appendTo(_4); +$(_3.buttons).show(); +} +}else{ +$(_2).siblings("div.dialog-button").remove(); +} +_3.inited=true; +var _a=_3.closed; +_4.show(); +$(_2).window("resize"); +if(_a){ +_4.hide(); +} +}; +function _b(_c,_d){ +var t=$(_c); +var _e=t.dialog("options"); +var _f=_e.noheader; +var tb=t.siblings(".dialog-toolbar"); +var bb=t.siblings(".dialog-button"); +tb.insertBefore(_c).css({borderTopWidth:(_f?1:0),top:(_f?tb.length:0)}); +bb.insertAfter(_c); +tb.add(bb)._outerWidth(t._outerWidth()).find(".easyui-fluid:visible").each(function(){ +$(this).triggerHandler("_resize"); +}); +var _10=tb._outerHeight()+bb._outerHeight(); +if(!isNaN(parseInt(_e.height))){ +t._outerHeight(t._outerHeight()-_10); +}else{ +var _11=t._size("min-height"); +if(_11){ +t._size("min-height",_11-_10); +} +var _12=t._size("max-height"); +if(_12){ +t._size("max-height",_12-_10); +} +} +var _13=$.data(_c,"window").shadow; +if(_13){ +var cc=t.panel("panel"); +_13.css({width:cc._outerWidth(),height:cc._outerHeight()}); +} +}; +$.fn.dialog=function(_14,_15){ +if(typeof _14=="string"){ +var _16=$.fn.dialog.methods[_14]; +if(_16){ +return _16(this,_15); +}else{ +return this.window(_14,_15); +} +} +_14=_14||{}; +return this.each(function(){ +var _17=$.data(this,"dialog"); +if(_17){ +$.extend(_17.options,_14); +}else{ +$.data(this,"dialog",{options:$.extend({},$.fn.dialog.defaults,$.fn.dialog.parseOptions(this),_14)}); +} +_1(this); +}); +}; +$.fn.dialog.methods={options:function(jq){ +var _18=$.data(jq[0],"dialog").options; +var _19=jq.panel("options"); +$.extend(_18,{width:_19.width,height:_19.height,left:_19.left,top:_19.top,closed:_19.closed,collapsed:_19.collapsed,minimized:_19.minimized,maximized:_19.maximized}); +return _18; +},dialog:function(jq){ +return jq.window("window"); +}}; +$.fn.dialog.parseOptions=function(_1a){ +var t=$(_1a); +return $.extend({},$.fn.window.parseOptions(_1a),$.parser.parseOptions(_1a,["toolbar","buttons"]),{toolbar:(t.children(".dialog-toolbar").length?t.children(".dialog-toolbar").removeClass("dialog-toolbar"):undefined),buttons:(t.children(".dialog-button").length?t.children(".dialog-button").removeClass("dialog-button"):undefined)}); +}; +$.fn.dialog.defaults=$.extend({},$.fn.window.defaults,{title:"New Dialog",collapsible:false,minimizable:false,maximizable:false,resizable:false,toolbar:null,buttons:null}); +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.draggable.js b/assets/js/easy-ui/plugins/jquery.draggable.js index 1dfcd1ba16..49fa5f65e6 100755 --- a/assets/js/easy-ui/plugins/jquery.draggable.js +++ b/assets/js/easy-ui/plugins/jquery.draggable.js @@ -1,304 +1,304 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(e){ -var _2=$.data(e.data.target,"draggable"); -var _3=_2.options; -var _4=_2.proxy; -var _5=e.data; -var _6=_5.startLeft+e.pageX-_5.startX; -var _7=_5.startTop+e.pageY-_5.startY; -if(_4){ -if(_4.parent()[0]==document.body){ -if(_3.deltaX!=null&&_3.deltaX!=undefined){ -_6=e.pageX+_3.deltaX; -}else{ -_6=e.pageX-e.data.offsetWidth; -} -if(_3.deltaY!=null&&_3.deltaY!=undefined){ -_7=e.pageY+_3.deltaY; -}else{ -_7=e.pageY-e.data.offsetHeight; -} -}else{ -if(_3.deltaX!=null&&_3.deltaX!=undefined){ -_6+=e.data.offsetWidth+_3.deltaX; -} -if(_3.deltaY!=null&&_3.deltaY!=undefined){ -_7+=e.data.offsetHeight+_3.deltaY; -} -} -} -if(e.data.parent!=document.body){ -_6+=$(e.data.parent).scrollLeft(); -_7+=$(e.data.parent).scrollTop(); -} -if(_3.axis=="h"){ -_5.left=_6; -}else{ -if(_3.axis=="v"){ -_5.top=_7; -}else{ -_5.left=_6; -_5.top=_7; -} -} -}; -function _8(e){ -var _9=$.data(e.data.target,"draggable"); -var _a=_9.options; -var _b=_9.proxy; -if(!_b){ -_b=$(e.data.target); -} -_b.css({left:e.data.left,top:e.data.top}); -$("body").css("cursor",_a.cursor); -}; -function _c(e){ -if(!$.fn.draggable.isDragging){ -return false; -} -var _d=$.data(e.data.target,"draggable"); -var _e=_d.options; -var _f=$(".droppable:visible").filter(function(){ -return e.data.target!=this; -}).filter(function(){ -var _10=$.data(this,"droppable").options.accept; -if(_10){ -return $(_10).filter(function(){ -return this==e.data.target; -}).length>0; -}else{ -return true; -} -}); -_d.droppables=_f; -var _11=_d.proxy; -if(!_11){ -if(_e.proxy){ -if(_e.proxy=="clone"){ -_11=$(e.data.target).clone().insertAfter(e.data.target); -}else{ -_11=_e.proxy.call(e.data.target,e.data.target); -} -_d.proxy=_11; -}else{ -_11=$(e.data.target); -} -} -_11.css("position","absolute"); -_1(e); -_8(e); -_e.onStartDrag.call(e.data.target,e); -return false; -}; -function _12(e){ -if(!$.fn.draggable.isDragging){ -return false; -} -var _13=$.data(e.data.target,"draggable"); -_1(e); -if(_13.options.onDrag.call(e.data.target,e)!=false){ -_8(e); -} -var _14=e.data.target; -_13.droppables.each(function(){ -var _15=$(this); -if(_15.droppable("options").disabled){ -return; -} -var p2=_15.offset(); -if(e.pageX>p2.left&&e.pageXp2.top&&e.pageYp2.left&&e.pageXp2.top&&e.pageY_2b.options.edge; -}; -}); -}; -$.fn.draggable.methods={options:function(jq){ -return $.data(jq[0],"draggable").options; -},proxy:function(jq){ -return $.data(jq[0],"draggable").proxy; -},enable:function(jq){ -return jq.each(function(){ -$(this).draggable({disabled:false}); -}); -},disable:function(jq){ -return jq.each(function(){ -$(this).draggable({disabled:true}); -}); -}}; -$.fn.draggable.parseOptions=function(_30){ -var t=$(_30); -return $.extend({},$.parser.parseOptions(_30,["cursor","handle","axis",{"revert":"boolean","deltaX":"number","deltaY":"number","edge":"number","delay":"number"}]),{disabled:(t.attr("disabled")?true:undefined)}); -}; -$.fn.draggable.defaults={proxy:null,revert:false,cursor:"move",deltaX:null,deltaY:null,handle:null,disabled:false,edge:0,axis:null,delay:100,onBeforeDrag:function(e){ -},onStartDrag:function(e){ -},onDrag:function(e){ -},onStopDrag:function(e){ -}}; -$.fn.draggable.isDragging=false; -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(e){ +var _2=$.data(e.data.target,"draggable"); +var _3=_2.options; +var _4=_2.proxy; +var _5=e.data; +var _6=_5.startLeft+e.pageX-_5.startX; +var _7=_5.startTop+e.pageY-_5.startY; +if(_4){ +if(_4.parent()[0]==document.body){ +if(_3.deltaX!=null&&_3.deltaX!=undefined){ +_6=e.pageX+_3.deltaX; +}else{ +_6=e.pageX-e.data.offsetWidth; +} +if(_3.deltaY!=null&&_3.deltaY!=undefined){ +_7=e.pageY+_3.deltaY; +}else{ +_7=e.pageY-e.data.offsetHeight; +} +}else{ +if(_3.deltaX!=null&&_3.deltaX!=undefined){ +_6+=e.data.offsetWidth+_3.deltaX; +} +if(_3.deltaY!=null&&_3.deltaY!=undefined){ +_7+=e.data.offsetHeight+_3.deltaY; +} +} +} +if(e.data.parent!=document.body){ +_6+=$(e.data.parent).scrollLeft(); +_7+=$(e.data.parent).scrollTop(); +} +if(_3.axis=="h"){ +_5.left=_6; +}else{ +if(_3.axis=="v"){ +_5.top=_7; +}else{ +_5.left=_6; +_5.top=_7; +} +} +}; +function _8(e){ +var _9=$.data(e.data.target,"draggable"); +var _a=_9.options; +var _b=_9.proxy; +if(!_b){ +_b=$(e.data.target); +} +_b.css({left:e.data.left,top:e.data.top}); +$("body").css("cursor",_a.cursor); +}; +function _c(e){ +if(!$.fn.draggable.isDragging){ +return false; +} +var _d=$.data(e.data.target,"draggable"); +var _e=_d.options; +var _f=$(".droppable:visible").filter(function(){ +return e.data.target!=this; +}).filter(function(){ +var _10=$.data(this,"droppable").options.accept; +if(_10){ +return $(_10).filter(function(){ +return this==e.data.target; +}).length>0; +}else{ +return true; +} +}); +_d.droppables=_f; +var _11=_d.proxy; +if(!_11){ +if(_e.proxy){ +if(_e.proxy=="clone"){ +_11=$(e.data.target).clone().insertAfter(e.data.target); +}else{ +_11=_e.proxy.call(e.data.target,e.data.target); +} +_d.proxy=_11; +}else{ +_11=$(e.data.target); +} +} +_11.css("position","absolute"); +_1(e); +_8(e); +_e.onStartDrag.call(e.data.target,e); +return false; +}; +function _12(e){ +if(!$.fn.draggable.isDragging){ +return false; +} +var _13=$.data(e.data.target,"draggable"); +_1(e); +if(_13.options.onDrag.call(e.data.target,e)!=false){ +_8(e); +} +var _14=e.data.target; +_13.droppables.each(function(){ +var _15=$(this); +if(_15.droppable("options").disabled){ +return; +} +var p2=_15.offset(); +if(e.pageX>p2.left&&e.pageXp2.top&&e.pageYp2.left&&e.pageXp2.top&&e.pageY_2b.options.edge; +}; +}); +}; +$.fn.draggable.methods={options:function(jq){ +return $.data(jq[0],"draggable").options; +},proxy:function(jq){ +return $.data(jq[0],"draggable").proxy; +},enable:function(jq){ +return jq.each(function(){ +$(this).draggable({disabled:false}); +}); +},disable:function(jq){ +return jq.each(function(){ +$(this).draggable({disabled:true}); +}); +}}; +$.fn.draggable.parseOptions=function(_30){ +var t=$(_30); +return $.extend({},$.parser.parseOptions(_30,["cursor","handle","axis",{"revert":"boolean","deltaX":"number","deltaY":"number","edge":"number","delay":"number"}]),{disabled:(t.attr("disabled")?true:undefined)}); +}; +$.fn.draggable.defaults={proxy:null,revert:false,cursor:"move",deltaX:null,deltaY:null,handle:null,disabled:false,edge:0,axis:null,delay:100,onBeforeDrag:function(e){ +},onStartDrag:function(e){ +},onDrag:function(e){ +},onStopDrag:function(e){ +}}; +$.fn.draggable.isDragging=false; +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.droppable.js b/assets/js/easy-ui/plugins/jquery.droppable.js index f8236e1d41..1d42663607 100755 --- a/assets/js/easy-ui/plugins/jquery.droppable.js +++ b/assets/js/easy-ui/plugins/jquery.droppable.js @@ -1,62 +1,62 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(_2){ -$(_2).addClass("droppable"); -$(_2).bind("_dragenter",function(e,_3){ -$.data(_2,"droppable").options.onDragEnter.apply(_2,[e,_3]); -}); -$(_2).bind("_dragleave",function(e,_4){ -$.data(_2,"droppable").options.onDragLeave.apply(_2,[e,_4]); -}); -$(_2).bind("_dragover",function(e,_5){ -$.data(_2,"droppable").options.onDragOver.apply(_2,[e,_5]); -}); -$(_2).bind("_drop",function(e,_6){ -$.data(_2,"droppable").options.onDrop.apply(_2,[e,_6]); -}); -}; -$.fn.droppable=function(_7,_8){ -if(typeof _7=="string"){ -return $.fn.droppable.methods[_7](this,_8); -} -_7=_7||{}; -return this.each(function(){ -var _9=$.data(this,"droppable"); -if(_9){ -$.extend(_9.options,_7); -}else{ -_1(this); -$.data(this,"droppable",{options:$.extend({},$.fn.droppable.defaults,$.fn.droppable.parseOptions(this),_7)}); -} -}); -}; -$.fn.droppable.methods={options:function(jq){ -return $.data(jq[0],"droppable").options; -},enable:function(jq){ -return jq.each(function(){ -$(this).droppable({disabled:false}); -}); -},disable:function(jq){ -return jq.each(function(){ -$(this).droppable({disabled:true}); -}); -}}; -$.fn.droppable.parseOptions=function(_a){ -var t=$(_a); -return $.extend({},$.parser.parseOptions(_a,["accept"]),{disabled:(t.attr("disabled")?true:undefined)}); -}; -$.fn.droppable.defaults={accept:null,disabled:false,onDragEnter:function(e,_b){ -},onDragOver:function(e,_c){ -},onDragLeave:function(e,_d){ -},onDrop:function(e,_e){ -}}; -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(_2){ +$(_2).addClass("droppable"); +$(_2).bind("_dragenter",function(e,_3){ +$.data(_2,"droppable").options.onDragEnter.apply(_2,[e,_3]); +}); +$(_2).bind("_dragleave",function(e,_4){ +$.data(_2,"droppable").options.onDragLeave.apply(_2,[e,_4]); +}); +$(_2).bind("_dragover",function(e,_5){ +$.data(_2,"droppable").options.onDragOver.apply(_2,[e,_5]); +}); +$(_2).bind("_drop",function(e,_6){ +$.data(_2,"droppable").options.onDrop.apply(_2,[e,_6]); +}); +}; +$.fn.droppable=function(_7,_8){ +if(typeof _7=="string"){ +return $.fn.droppable.methods[_7](this,_8); +} +_7=_7||{}; +return this.each(function(){ +var _9=$.data(this,"droppable"); +if(_9){ +$.extend(_9.options,_7); +}else{ +_1(this); +$.data(this,"droppable",{options:$.extend({},$.fn.droppable.defaults,$.fn.droppable.parseOptions(this),_7)}); +} +}); +}; +$.fn.droppable.methods={options:function(jq){ +return $.data(jq[0],"droppable").options; +},enable:function(jq){ +return jq.each(function(){ +$(this).droppable({disabled:false}); +}); +},disable:function(jq){ +return jq.each(function(){ +$(this).droppable({disabled:true}); +}); +}}; +$.fn.droppable.parseOptions=function(_a){ +var t=$(_a); +return $.extend({},$.parser.parseOptions(_a,["accept"]),{disabled:(t.attr("disabled")?true:undefined)}); +}; +$.fn.droppable.defaults={accept:null,disabled:false,onDragEnter:function(e,_b){ +},onDragOver:function(e,_c){ +},onDragLeave:function(e,_d){ +},onDrop:function(e,_e){ +}}; +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.edatagrid.js b/assets/js/easy-ui/plugins/jquery.edatagrid.js index 61e0572bd9..14996dbcc5 100755 --- a/assets/js/easy-ui/plugins/jquery.edatagrid.js +++ b/assets/js/easy-ui/plugins/jquery.edatagrid.js @@ -1,461 +1,461 @@ -/** - * edatagrid - jQuery EasyUI - * - * Licensed under the GPL: - * http://www.gnu.org/licenses/gpl.txt - * - * Copyright 2011 stworthy [ stworthy@gmail.com ] - * - * Dependencies: - * datagrid - * messager - * - */ -(function($){ - // var oldLoadDataMethod = $.fn.datagrid.methods.loadData; - // $.fn.datagrid.methods.loadData = function(jq, data){ - // jq.each(function(){ - // $.data(this, 'datagrid').filterSource = null; - // }); - // return oldLoadDataMethod.call($.fn.datagrid.methods, jq, data); - // }; - - var currTarget; - $(function(){ - $(document).unbind('.edatagrid').bind('mousedown.edatagrid', function(e){ - var p = $(e.target).closest('div.datagrid-view,div.combo-panel'); - if (p.length){ - if (p.hasClass('datagrid-view')){ - var dg = p.children('table'); - if (dg.length && currTarget != dg[0]){ - _save(); - } - } - return; - } - _save(); - - function _save(){ - var dg = $(currTarget); - if (dg.length){ - dg.edatagrid('saveRow'); - currTarget = undefined; - } - } - }); - }); - - function buildGrid(target){ - var opts = $.data(target, 'edatagrid').options; - $(target).datagrid($.extend({}, opts, { - onDblClickCell:function(index,field,value){ - if (opts.editing){ - $(this).edatagrid('editRow', index); - focusEditor(target, field); - } - if (opts.onDblClickCell){ - opts.onDblClickCell.call(target, index, field, value); - } - }, - onClickCell:function(index,field,value){ - if (opts.editing && opts.editIndex >= 0){ - $(this).edatagrid('editRow', index); - focusEditor(target, field); - } - if (opts.onClickCell){ - opts.onClickCell.call(target, index, field, value); - } - }, - onAfterEdit: function(index, row){ - opts.editIndex = -1; - var url = row.isNewRecord ? opts.saveUrl : opts.updateUrl; - if (url){ - $.post(url, row, function(data){ - if (data.isError){ - $(target).edatagrid('cancelRow',index); - $(target).edatagrid('selectRow',index); - $(target).edatagrid('editRow',index); - opts.onError.call(target, index, data); - return; - } - data.isNewRecord = null; - $(target).datagrid('updateRow', { - index: index, - row: data - }); - if (opts.tree){ - var idValue = row[opts.idField||'id']; - var t = $(opts.tree); - var node = t.tree('find', idValue); - if (node){ - node.text = row[opts.treeTextField]; - t.tree('update', node); - } else { - var pnode = t.tree('find', row[opts.treeParentField]); - t.tree('append', { - parent: (pnode ? pnode.target : null), - data: [{id:idValue,text:row[opts.treeTextField]}] - }); - } - } - opts.onSave.call(target, index, row); - },'json'); - } else { - opts.onSave.call(target, index, row); - } - if (opts.onAfterEdit) opts.onAfterEdit.call(target, index, row); - }, - onCancelEdit: function(index, row){ - opts.editIndex = -1; - if (row.isNewRecord) { - $(this).datagrid('deleteRow', index); - } - if (opts.onCancelEdit) opts.onCancelEdit.call(target, index, row); - }, - onBeforeLoad: function(param){ - if (opts.onBeforeLoad.call(target, param) == false){return false} - $(this).edatagrid('cancelRow'); - if (opts.tree){ - var node = $(opts.tree).tree('getSelected'); - param[opts.treeParentField] = node ? node.id : undefined; - } - } - })); - - - - if (opts.tree){ - $(opts.tree).tree({ - url: opts.treeUrl, - onClick: function(node){ - $(target).datagrid('load'); - }, - onDrop: function(dest,source,point){ - var targetId = $(this).tree('getNode', dest).id; - $.ajax({ - url: opts.treeDndUrl, - type:'post', - data:{ - id:source.id, - targetId:targetId, - point:point - }, - dataType:'json', - success:function(){ - $(target).datagrid('load'); - } - }); - } - }); - } - } - - function focusEditor(target, field){ - var opts = $(target).edatagrid('options'); - var t; - var editor = $(target).datagrid('getEditor', {index:opts.editIndex,field:field}); - if (editor){ - t = editor.target; - } else { - var editors = $(target).datagrid('getEditors', opts.editIndex); - if (editors.length){ - t = editors[0].target; - } - } - if (t){ - if ($(t).hasClass('textbox-f')){ - $(t).textbox('textbox').focus(); - } else { - $(t).focus(); - } - } - } - - $.fn.edatagrid = function(options, param){ - if (typeof options == 'string'){ - var method = $.fn.edatagrid.methods[options]; - if (method){ - return method(this, param); - } else { - return this.datagrid(options, param); - } - } - - options = options || {}; - return this.each(function(){ - var state = $.data(this, 'edatagrid'); - if (state){ - $.extend(state.options, options); - } else { - $.data(this, 'edatagrid', { - options: $.extend({}, $.fn.edatagrid.defaults, $.fn.edatagrid.parseOptions(this), options) - }); - } - buildGrid(this); - }); - }; - - $.fn.edatagrid.parseOptions = function(target){ - return $.extend({}, $.fn.datagrid.parseOptions(target), { - }); - }; - - $.fn.edatagrid.methods = { - options: function(jq){ - var opts = $.data(jq[0], 'edatagrid').options; - return opts; - }, - loadData: function(jq, data){ - return jq.each(function(){ - $(this).edatagrid('cancelRow'); - $(this).datagrid('loadData', data); - }); - }, - enableEditing: function(jq){ - return jq.each(function(){ - var opts = $.data(this, 'edatagrid').options; - opts.editing = true; - }); - }, - disableEditing: function(jq){ - return jq.each(function(){ - var opts = $.data(this, 'edatagrid').options; - opts.editing = false; - }); - }, - editRow: function(jq, index){ - return jq.each(function(){ - var dg = $(this); - var opts = $.data(this, 'edatagrid').options; - var editIndex = opts.editIndex; - if (editIndex != index){ - if (dg.datagrid('validateRow', editIndex)){ - if (editIndex>=0){ - if (opts.onBeforeSave.call(this, editIndex) == false) { - setTimeout(function(){ - dg.datagrid('selectRow', editIndex); - },0); - return; - } - } - dg.datagrid('endEdit', editIndex); - dg.datagrid('beginEdit', index); - opts.editIndex = index; - focusEditor(this); - - if (currTarget != this && $(currTarget).length){ - $(currTarget).edatagrid('saveRow'); - currTarget = undefined; - } - if (opts.autoSave){ - currTarget = this; - } - - var rows = dg.datagrid('getRows'); - opts.onEdit.call(this, index, rows[index]); - } else { - setTimeout(function(){ - dg.datagrid('selectRow', editIndex); - }, 0); - } - } - }); - }, - addRow: function(jq, index){ - return jq.each(function(){ - var dg = $(this); - var opts = $.data(this, 'edatagrid').options; - if (opts.editIndex >= 0){ - if (!dg.datagrid('validateRow', opts.editIndex)){ - dg.datagrid('selectRow', opts.editIndex); - return; - } - if (opts.onBeforeSave.call(this, opts.editIndex) == false){ - setTimeout(function(){ - dg.datagrid('selectRow', opts.editIndex); - },0); - return; - } - dg.datagrid('endEdit', opts.editIndex); - } - var rows = dg.datagrid('getRows'); - - function _add(index, row){ - if (index == undefined){ - dg.datagrid('appendRow', row); - opts.editIndex = rows.length - 1; - } else { - dg.datagrid('insertRow', {index:index,row:row}); - opts.editIndex = index; - } - } - if (typeof index == 'object'){ - _add(index.index, $.extend(index.row, {isNewRecord:true})) - } else { - _add(index, {isNewRecord:true}); - } - -// if (index == undefined){ -// dg.datagrid('appendRow', {isNewRecord:true}); -// opts.editIndex = rows.length - 1; -// } else { -// dg.datagrid('insertRow', { -// index: index, -// row: {isNewRecord:true} -// }); -// opts.editIndex = index; -// } - - dg.datagrid('beginEdit', opts.editIndex); - dg.datagrid('selectRow', opts.editIndex); - - if (opts.tree){ - var node = $(opts.tree).tree('getSelected'); - rows[opts.editIndex][opts.treeParentField] = (node ? node.id : 0); - } - - opts.onAdd.call(this, opts.editIndex, rows[opts.editIndex]); - }); - }, - saveRow: function(jq){ - return jq.each(function(){ - var dg = $(this); - var opts = $.data(this, 'edatagrid').options; - if (opts.editIndex >= 0){ - if (opts.onBeforeSave.call(this, opts.editIndex) == false) { - setTimeout(function(){ - dg.datagrid('selectRow', opts.editIndex); - },0); - return; - } - $(this).datagrid('endEdit', opts.editIndex); - } - }); - }, - cancelRow: function(jq){ - return jq.each(function(){ - var opts = $.data(this, 'edatagrid').options; - if (opts.editIndex >= 0){ - $(this).datagrid('cancelEdit', opts.editIndex); - } - }); - }, - destroyRow: function(jq, index){ - return jq.each(function(){ - var dg = $(this); - var opts = $.data(this, 'edatagrid').options; - - var rows = []; - if (index == undefined){ - rows = dg.datagrid('getSelections'); - } else { - var rowIndexes = $.isArray(index) ? index : [index]; - for(var i=0; i= 0){ + $(this).edatagrid('editRow', index); + focusEditor(target, field); + } + if (opts.onClickCell){ + opts.onClickCell.call(target, index, field, value); + } + }, + onAfterEdit: function(index, row){ + opts.editIndex = -1; + var url = row.isNewRecord ? opts.saveUrl : opts.updateUrl; + if (url){ + $.post(url, row, function(data){ + if (data.isError){ + $(target).edatagrid('cancelRow',index); + $(target).edatagrid('selectRow',index); + $(target).edatagrid('editRow',index); + opts.onError.call(target, index, data); + return; + } + data.isNewRecord = null; + $(target).datagrid('updateRow', { + index: index, + row: data + }); + if (opts.tree){ + var idValue = row[opts.idField||'id']; + var t = $(opts.tree); + var node = t.tree('find', idValue); + if (node){ + node.text = row[opts.treeTextField]; + t.tree('update', node); + } else { + var pnode = t.tree('find', row[opts.treeParentField]); + t.tree('append', { + parent: (pnode ? pnode.target : null), + data: [{id:idValue,text:row[opts.treeTextField]}] + }); + } + } + opts.onSave.call(target, index, row); + },'json'); + } else { + opts.onSave.call(target, index, row); + } + if (opts.onAfterEdit) opts.onAfterEdit.call(target, index, row); + }, + onCancelEdit: function(index, row){ + opts.editIndex = -1; + if (row.isNewRecord) { + $(this).datagrid('deleteRow', index); + } + if (opts.onCancelEdit) opts.onCancelEdit.call(target, index, row); + }, + onBeforeLoad: function(param){ + if (opts.onBeforeLoad.call(target, param) == false){return false} + $(this).edatagrid('cancelRow'); + if (opts.tree){ + var node = $(opts.tree).tree('getSelected'); + param[opts.treeParentField] = node ? node.id : undefined; + } + } + })); + + + + if (opts.tree){ + $(opts.tree).tree({ + url: opts.treeUrl, + onClick: function(node){ + $(target).datagrid('load'); + }, + onDrop: function(dest,source,point){ + var targetId = $(this).tree('getNode', dest).id; + $.ajax({ + url: opts.treeDndUrl, + type:'post', + data:{ + id:source.id, + targetId:targetId, + point:point + }, + dataType:'json', + success:function(){ + $(target).datagrid('load'); + } + }); + } + }); + } + } + + function focusEditor(target, field){ + var opts = $(target).edatagrid('options'); + var t; + var editor = $(target).datagrid('getEditor', {index:opts.editIndex,field:field}); + if (editor){ + t = editor.target; + } else { + var editors = $(target).datagrid('getEditors', opts.editIndex); + if (editors.length){ + t = editors[0].target; + } + } + if (t){ + if ($(t).hasClass('textbox-f')){ + $(t).textbox('textbox').focus(); + } else { + $(t).focus(); + } + } + } + + $.fn.edatagrid = function(options, param){ + if (typeof options == 'string'){ + var method = $.fn.edatagrid.methods[options]; + if (method){ + return method(this, param); + } else { + return this.datagrid(options, param); + } + } + + options = options || {}; + return this.each(function(){ + var state = $.data(this, 'edatagrid'); + if (state){ + $.extend(state.options, options); + } else { + $.data(this, 'edatagrid', { + options: $.extend({}, $.fn.edatagrid.defaults, $.fn.edatagrid.parseOptions(this), options) + }); + } + buildGrid(this); + }); + }; + + $.fn.edatagrid.parseOptions = function(target){ + return $.extend({}, $.fn.datagrid.parseOptions(target), { + }); + }; + + $.fn.edatagrid.methods = { + options: function(jq){ + var opts = $.data(jq[0], 'edatagrid').options; + return opts; + }, + loadData: function(jq, data){ + return jq.each(function(){ + $(this).edatagrid('cancelRow'); + $(this).datagrid('loadData', data); + }); + }, + enableEditing: function(jq){ + return jq.each(function(){ + var opts = $.data(this, 'edatagrid').options; + opts.editing = true; + }); + }, + disableEditing: function(jq){ + return jq.each(function(){ + var opts = $.data(this, 'edatagrid').options; + opts.editing = false; + }); + }, + editRow: function(jq, index){ + return jq.each(function(){ + var dg = $(this); + var opts = $.data(this, 'edatagrid').options; + var editIndex = opts.editIndex; + if (editIndex != index){ + if (dg.datagrid('validateRow', editIndex)){ + if (editIndex>=0){ + if (opts.onBeforeSave.call(this, editIndex) == false) { + setTimeout(function(){ + dg.datagrid('selectRow', editIndex); + },0); + return; + } + } + dg.datagrid('endEdit', editIndex); + dg.datagrid('beginEdit', index); + opts.editIndex = index; + focusEditor(this); + + if (currTarget != this && $(currTarget).length){ + $(currTarget).edatagrid('saveRow'); + currTarget = undefined; + } + if (opts.autoSave){ + currTarget = this; + } + + var rows = dg.datagrid('getRows'); + opts.onEdit.call(this, index, rows[index]); + } else { + setTimeout(function(){ + dg.datagrid('selectRow', editIndex); + }, 0); + } + } + }); + }, + addRow: function(jq, index){ + return jq.each(function(){ + var dg = $(this); + var opts = $.data(this, 'edatagrid').options; + if (opts.editIndex >= 0){ + if (!dg.datagrid('validateRow', opts.editIndex)){ + dg.datagrid('selectRow', opts.editIndex); + return; + } + if (opts.onBeforeSave.call(this, opts.editIndex) == false){ + setTimeout(function(){ + dg.datagrid('selectRow', opts.editIndex); + },0); + return; + } + dg.datagrid('endEdit', opts.editIndex); + } + var rows = dg.datagrid('getRows'); + + function _add(index, row){ + if (index == undefined){ + dg.datagrid('appendRow', row); + opts.editIndex = rows.length - 1; + } else { + dg.datagrid('insertRow', {index:index,row:row}); + opts.editIndex = index; + } + } + if (typeof index == 'object'){ + _add(index.index, $.extend(index.row, {isNewRecord:true})) + } else { + _add(index, {isNewRecord:true}); + } + +// if (index == undefined){ +// dg.datagrid('appendRow', {isNewRecord:true}); +// opts.editIndex = rows.length - 1; +// } else { +// dg.datagrid('insertRow', { +// index: index, +// row: {isNewRecord:true} +// }); +// opts.editIndex = index; +// } + + dg.datagrid('beginEdit', opts.editIndex); + dg.datagrid('selectRow', opts.editIndex); + + if (opts.tree){ + var node = $(opts.tree).tree('getSelected'); + rows[opts.editIndex][opts.treeParentField] = (node ? node.id : 0); + } + + opts.onAdd.call(this, opts.editIndex, rows[opts.editIndex]); + }); + }, + saveRow: function(jq){ + return jq.each(function(){ + var dg = $(this); + var opts = $.data(this, 'edatagrid').options; + if (opts.editIndex >= 0){ + if (opts.onBeforeSave.call(this, opts.editIndex) == false) { + setTimeout(function(){ + dg.datagrid('selectRow', opts.editIndex); + },0); + return; + } + $(this).datagrid('endEdit', opts.editIndex); + } + }); + }, + cancelRow: function(jq){ + return jq.each(function(){ + var opts = $.data(this, 'edatagrid').options; + if (opts.editIndex >= 0){ + $(this).datagrid('cancelEdit', opts.editIndex); + } + }); + }, + destroyRow: function(jq, index){ + return jq.each(function(){ + var dg = $(this); + var opts = $.data(this, 'edatagrid').options; + + var rows = []; + if (index == undefined){ + rows = dg.datagrid('getSelections'); + } else { + var rowIndexes = $.isArray(index) ? index : [index]; + for(var i=0; i").appendTo(_8); -if(_8.linkbutton("options").disabled){ -_6.attr("disabled","disabled"); -}else{ -_6.removeAttr("disabled"); -} -} -}; -function _7(_9){ -var _a=$.data(_9,"filebox"); -var _b=_a.options; -_a.filebox.find(".textbox-value").remove(); -_b.oldValue=""; -var _c=$("").appendTo(_a.filebox); -_c.attr("id",_b.fileboxId).attr("name",$(_9).attr("textboxName")||""); -_c.attr("accept",_b.accept); -_c.attr("capture",_b.capture); -if(_b.multiple){ -_c.attr("multiple","multiple"); -} -_c.change(function(){ -var _d=this.value; -if(this.files){ -_d=$.map(this.files,function(_e){ -return _e.name; -}).join(_b.separator); -} -$(_9).filebox("setText",_d); -_b.onChange.call(_9,_d,_b.oldValue); -_b.oldValue=_d; -}); -return _c; -}; -$.fn.filebox=function(_f,_10){ -if(typeof _f=="string"){ -var _11=$.fn.filebox.methods[_f]; -if(_11){ -return _11(this,_10); -}else{ -return this.textbox(_f,_10); -} -} -_f=_f||{}; -return this.each(function(){ -var _12=$.data(this,"filebox"); -if(_12){ -$.extend(_12.options,_f); -}else{ -$.data(this,"filebox",{options:$.extend({},$.fn.filebox.defaults,$.fn.filebox.parseOptions(this),_f)}); -} -_2(this); -}); -}; -$.fn.filebox.methods={options:function(jq){ -var _13=jq.textbox("options"); -return $.extend($.data(jq[0],"filebox").options,{width:_13.width,value:_13.value,originalValue:_13.originalValue,disabled:_13.disabled,readonly:_13.readonly}); -},clear:function(jq){ -return jq.each(function(){ -$(this).textbox("clear"); -_7(this); -}); -},reset:function(jq){ -return jq.each(function(){ -$(this).filebox("clear"); -}); -},setValue:function(jq){ -return jq; -},setValues:function(jq){ -return jq; -}}; -$.fn.filebox.parseOptions=function(_14){ -var t=$(_14); -return $.extend({},$.fn.textbox.parseOptions(_14),$.parser.parseOptions(_14,["accept","capture","separator"]),{multiple:(t.attr("multiple")?true:undefined)}); -}; -$.fn.filebox.defaults=$.extend({},$.fn.textbox.defaults,{buttonIcon:null,buttonText:"Choose File",buttonAlign:"right",inputEvents:{},accept:"",capture:"",separator:",",multiple:false}); -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +var _1=0; +function _2(_3){ +var _4=$.data(_3,"filebox"); +var _5=_4.options; +_5.fileboxId="filebox_file_id_"+(++_1); +$(_3).addClass("filebox-f").textbox(_5); +$(_3).textbox("textbox").attr("readonly","readonly"); +_4.filebox=$(_3).next().addClass("filebox"); +var _6=_7(_3); +var _8=$(_3).filebox("button"); +if(_8.length){ +$("").appendTo(_8); +if(_8.linkbutton("options").disabled){ +_6.attr("disabled","disabled"); +}else{ +_6.removeAttr("disabled"); +} +} +}; +function _7(_9){ +var _a=$.data(_9,"filebox"); +var _b=_a.options; +_a.filebox.find(".textbox-value").remove(); +_b.oldValue=""; +var _c=$("").appendTo(_a.filebox); +_c.attr("id",_b.fileboxId).attr("name",$(_9).attr("textboxName")||""); +_c.attr("accept",_b.accept); +_c.attr("capture",_b.capture); +if(_b.multiple){ +_c.attr("multiple","multiple"); +} +_c.change(function(){ +var _d=this.value; +if(this.files){ +_d=$.map(this.files,function(_e){ +return _e.name; +}).join(_b.separator); +} +$(_9).filebox("setText",_d); +_b.onChange.call(_9,_d,_b.oldValue); +_b.oldValue=_d; +}); +return _c; +}; +$.fn.filebox=function(_f,_10){ +if(typeof _f=="string"){ +var _11=$.fn.filebox.methods[_f]; +if(_11){ +return _11(this,_10); +}else{ +return this.textbox(_f,_10); +} +} +_f=_f||{}; +return this.each(function(){ +var _12=$.data(this,"filebox"); +if(_12){ +$.extend(_12.options,_f); +}else{ +$.data(this,"filebox",{options:$.extend({},$.fn.filebox.defaults,$.fn.filebox.parseOptions(this),_f)}); +} +_2(this); +}); +}; +$.fn.filebox.methods={options:function(jq){ +var _13=jq.textbox("options"); +return $.extend($.data(jq[0],"filebox").options,{width:_13.width,value:_13.value,originalValue:_13.originalValue,disabled:_13.disabled,readonly:_13.readonly}); +},clear:function(jq){ +return jq.each(function(){ +$(this).textbox("clear"); +_7(this); +}); +},reset:function(jq){ +return jq.each(function(){ +$(this).filebox("clear"); +}); +},setValue:function(jq){ +return jq; +},setValues:function(jq){ +return jq; +}}; +$.fn.filebox.parseOptions=function(_14){ +var t=$(_14); +return $.extend({},$.fn.textbox.parseOptions(_14),$.parser.parseOptions(_14,["accept","capture","separator"]),{multiple:(t.attr("multiple")?true:undefined)}); +}; +$.fn.filebox.defaults=$.extend({},$.fn.textbox.defaults,{buttonIcon:null,buttonText:"Choose File",buttonAlign:"right",inputEvents:{},accept:"",capture:"",separator:",",multiple:false}); +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.form.js b/assets/js/easy-ui/plugins/jquery.form.js index b262a36ffc..b86478fafb 100755 --- a/assets/js/easy-ui/plugins/jquery.form.js +++ b/assets/js/easy-ui/plugins/jquery.form.js @@ -1,410 +1,410 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(_2,_3){ -var _4=$.data(_2,"form").options; -$.extend(_4,_3||{}); -var _5=$.extend({},_4.queryParams); -if(_4.onSubmit.call(_2,_5)==false){ -return; -} -var _6=$(_2).find(".textbox-text:focus"); -_6.triggerHandler("blur"); -_6.focus(); -var _7=null; -if(_4.dirty){ -var ff=[]; -$.map(_4.dirtyFields,function(f){ -if($(f).hasClass("textbox-f")){ -$(f).next().find(".textbox-value").each(function(){ -ff.push(this); -}); -}else{ -ff.push(f); -} -}); -_7=$(_2).find("input[name]:enabled,textarea[name]:enabled,select[name]:enabled").filter(function(){ -return $.inArray(this,ff)==-1; -}); -_7.attr("disabled","disabled"); -} -if(_4.ajax){ -if(_4.iframe){ -_8(_2,_5); -}else{ -if(window.FormData!==undefined){ -_9(_2,_5); -}else{ -_8(_2,_5); -} -} -}else{ -$(_2).submit(); -} -if(_4.dirty){ -_7.removeAttr("disabled"); -} -}; -function _8(_a,_b){ -var _c=$.data(_a,"form").options; -var _d="easyui_frame_"+(new Date().getTime()); -var _e=$("").appendTo("body"); -_e.attr("src",window.ActiveXObject?"javascript:false":"about:blank"); -_e.css({position:"absolute",top:-1000,left:-1000}); -_e.bind("load",cb); -_f(_b); -function _f(_10){ -var _11=$(_a); -if(_c.url){ -_11.attr("action",_c.url); -} -var t=_11.attr("target"),a=_11.attr("action"); -_11.attr("target",_d); -var _12=$(); -try{ -for(var n in _10){ -var _13=$("").val(_10[n]).appendTo(_11); -_12=_12.add(_13); -} -_14(); -_11[0].submit(); -} -finally{ -_11.attr("action",a); -t?_11.attr("target",t):_11.removeAttr("target"); -_12.remove(); -} -}; -function _14(){ -var f=$("#"+_d); -if(!f.length){ -return; -} -try{ -var s=f.contents()[0].readyState; -if(s&&s.toLowerCase()=="uninitialized"){ -setTimeout(_14,100); -} -} -catch(e){ -cb(); -} -}; -var _15=10; -function cb(){ -var f=$("#"+_d); -if(!f.length){ -return; -} -f.unbind(); -var _16=""; -try{ -var _17=f.contents().find("body"); -_16=_17.html(); -if(_16==""){ -if(--_15){ -setTimeout(cb,100); -return; -} -} -var ta=_17.find(">textarea"); -if(ta.length){ -_16=ta.val(); -}else{ -var pre=_17.find(">pre"); -if(pre.length){ -_16=pre.html(); -} -} -} -catch(e){ -} -_c.success.call(_a,_16); -setTimeout(function(){ -f.unbind(); -f.remove(); -},100); -}; -}; -function _9(_18,_19){ -var _1a=$.data(_18,"form").options; -var _1b=new FormData($(_18)[0]); -for(var _1c in _19){ -_1b.append(_1c,_19[_1c]); -} -$.ajax({url:_1a.url,type:"post",xhr:function(){ -var xhr=$.ajaxSettings.xhr(); -if(xhr.upload){ -xhr.upload.addEventListener("progress",function(e){ -if(e.lengthComputable){ -var _1d=e.total; -var _1e=e.loaded||e.position; -var _1f=Math.ceil(_1e*100/_1d); -_1a.onProgress.call(_18,_1f); -} -},false); -} -return xhr; -},data:_1b,dataType:"html",cache:false,contentType:false,processData:false,complete:function(res){ -_1a.success.call(_18,res.responseText); -}}); -}; -function _20(_21,_22){ -var _23=$.data(_21,"form").options; -if(typeof _22=="string"){ -var _24={}; -if(_23.onBeforeLoad.call(_21,_24)==false){ -return; -} -$.ajax({url:_22,data:_24,dataType:"json",success:function(_25){ -_26(_25); -},error:function(){ -_23.onLoadError.apply(_21,arguments); -}}); -}else{ -_26(_22); -} -function _26(_27){ -var _28=$(_21); -for(var _29 in _27){ -var val=_27[_29]; -if(!_2a(_29,val)){ -if(!_2b(_29,val)){ -_28.find("input[name=\""+_29+"\"]").val(val); -_28.find("textarea[name=\""+_29+"\"]").val(val); -_28.find("select[name=\""+_29+"\"]").val(val); -} -} -} -_23.onLoadSuccess.call(_21,_27); -_28.form("validate"); -}; -function _2a(_2c,val){ -var cc=$(_21).find("[switchbuttonName=\""+_2c+"\"]"); -if(cc.length){ -cc.switchbutton("uncheck"); -cc.each(function(){ -if(_2d($(this).switchbutton("options").value,val)){ -$(this).switchbutton("check"); -} -}); -return true; -} -cc=$(_21).find("input[name=\""+_2c+"\"][type=radio], input[name=\""+_2c+"\"][type=checkbox]"); -if(cc.length){ -cc._propAttr("checked",false); -cc.each(function(){ -if(_2d($(this).val(),val)){ -$(this)._propAttr("checked",true); -} -}); -return true; -} -return false; -}; -function _2d(v,val){ -if(v==String(val)||$.inArray(v,$.isArray(val)?val:[val])>=0){ -return true; -}else{ -return false; -} -}; -function _2b(_2e,val){ -var _2f=$(_21).find("[textboxName=\""+_2e+"\"],[sliderName=\""+_2e+"\"]"); -if(_2f.length){ -for(var i=0;i<_23.fieldTypes.length;i++){ -var _30=_23.fieldTypes[i]; -var _31=_2f.data(_30); -if(_31){ -if(_31.options.multiple||_31.options.range){ -_2f[_30]("setValues",val); -}else{ -_2f[_30]("setValue",val); -} -return true; -} -} -} -return false; -}; -}; -function _32(_33){ -$("input,select,textarea",_33).each(function(){ -if($(this).hasClass("textbox-value")){ -return; -} -var t=this.type,tag=this.tagName.toLowerCase(); -if(t=="text"||t=="hidden"||t=="password"||tag=="textarea"){ -this.value=""; -}else{ -if(t=="file"){ -var _34=$(this); -if(!_34.hasClass("textbox-value")){ -var _35=_34.clone().val(""); -_35.insertAfter(_34); -if(_34.data("validatebox")){ -_34.validatebox("destroy"); -_35.validatebox(); -}else{ -_34.remove(); -} -} -}else{ -if(t=="checkbox"||t=="radio"){ -this.checked=false; -}else{ -if(tag=="select"){ -this.selectedIndex=-1; -} -} -} -} -}); -var tmp=$(); -var _36=$(_33); -var _37=$.data(_33,"form").options; -for(var i=0;i<_37.fieldTypes.length;i++){ -var _38=_37.fieldTypes[i]; -var _39=_36.find("."+_38+"-f").not(tmp); -if(_39.length&&_39[_38]){ -_39[_38]("clear"); -tmp=tmp.add(_39); -} -} -_36.form("validate"); -}; -function _3a(_3b){ -_3b.reset(); -var _3c=$(_3b); -var _3d=$.data(_3b,"form").options; -for(var i=_3d.fieldTypes.length-1;i>=0;i--){ -var _3e=_3d.fieldTypes[i]; -var _3f=_3c.find("."+_3e+"-f"); -if(_3f.length&&_3f[_3e]){ -_3f[_3e]("reset"); -} -} -_3c.form("validate"); -}; -function _40(_41){ -var _42=$.data(_41,"form").options; -$(_41).unbind(".form"); -if(_42.ajax){ -$(_41).bind("submit.form",function(){ -setTimeout(function(){ -_1(_41,_42); -},0); -return false; -}); -} -$(_41).bind("_change.form",function(e,t){ -if($.inArray(t,_42.dirtyFields)==-1){ -_42.dirtyFields.push(t); -} -_42.onChange.call(this,t); -}).bind("change.form",function(e){ -var t=e.target; -if(!$(t).hasClass("textbox-text")){ -if($.inArray(t,_42.dirtyFields)==-1){ -_42.dirtyFields.push(t); -} -_42.onChange.call(this,t); -} -}); -_43(_41,_42.novalidate); -}; -function _44(_45,_46){ -_46=_46||{}; -var _47=$.data(_45,"form"); -if(_47){ -$.extend(_47.options,_46); -}else{ -$.data(_45,"form",{options:$.extend({},$.fn.form.defaults,$.fn.form.parseOptions(_45),_46)}); -} -}; -function _48(_49){ -if($.fn.validatebox){ -var t=$(_49); -t.find(".validatebox-text:not(:disabled)").validatebox("validate"); -var _4a=t.find(".validatebox-invalid"); -_4a.filter(":not(:disabled):first").focus(); -return _4a.length==0; -} -return true; -}; -function _43(_4b,_4c){ -var _4d=$.data(_4b,"form").options; -_4d.novalidate=_4c; -$(_4b).find(".validatebox-text:not(:disabled)").validatebox(_4c?"disableValidation":"enableValidation"); -}; -$.fn.form=function(_4e,_4f){ -if(typeof _4e=="string"){ -this.each(function(){ -_44(this); -}); -return $.fn.form.methods[_4e](this,_4f); -} -return this.each(function(){ -_44(this,_4e); -_40(this); -}); -}; -$.fn.form.methods={options:function(jq){ -return $.data(jq[0],"form").options; -},submit:function(jq,_50){ -return jq.each(function(){ -_1(this,_50); -}); -},load:function(jq,_51){ -return jq.each(function(){ -_20(this,_51); -}); -},clear:function(jq){ -return jq.each(function(){ -_32(this); -}); -},reset:function(jq){ -return jq.each(function(){ -_3a(this); -}); -},validate:function(jq){ -return _48(jq[0]); -},disableValidation:function(jq){ -return jq.each(function(){ -_43(this,true); -}); -},enableValidation:function(jq){ -return jq.each(function(){ -_43(this,false); -}); -},resetValidation:function(jq){ -return jq.each(function(){ -$(this).find(".validatebox-text:not(:disabled)").validatebox("resetValidation"); -}); -},resetDirty:function(jq){ -return jq.each(function(){ -$(this).form("options").dirtyFields=[]; -}); -}}; -$.fn.form.parseOptions=function(_52){ -var t=$(_52); -return $.extend({},$.parser.parseOptions(_52,[{ajax:"boolean",dirty:"boolean"}]),{url:(t.attr("action")?t.attr("action"):undefined)}); -}; -$.fn.form.defaults={fieldTypes:["combobox","combotree","combogrid","combotreegrid","datetimebox","datebox","combo","datetimespinner","timespinner","numberspinner","spinner","slider","searchbox","numberbox","passwordbox","filebox","textbox","switchbutton"],novalidate:false,ajax:true,iframe:true,dirty:false,dirtyFields:[],url:null,queryParams:{},onSubmit:function(_53){ -return $(this).form("validate"); -},onProgress:function(_54){ -},success:function(_55){ -},onBeforeLoad:function(_56){ -},onLoadSuccess:function(_57){ -},onLoadError:function(){ -},onChange:function(_58){ -}}; -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(_2,_3){ +var _4=$.data(_2,"form").options; +$.extend(_4,_3||{}); +var _5=$.extend({},_4.queryParams); +if(_4.onSubmit.call(_2,_5)==false){ +return; +} +var _6=$(_2).find(".textbox-text:focus"); +_6.triggerHandler("blur"); +_6.focus(); +var _7=null; +if(_4.dirty){ +var ff=[]; +$.map(_4.dirtyFields,function(f){ +if($(f).hasClass("textbox-f")){ +$(f).next().find(".textbox-value").each(function(){ +ff.push(this); +}); +}else{ +ff.push(f); +} +}); +_7=$(_2).find("input[name]:enabled,textarea[name]:enabled,select[name]:enabled").filter(function(){ +return $.inArray(this,ff)==-1; +}); +_7.attr("disabled","disabled"); +} +if(_4.ajax){ +if(_4.iframe){ +_8(_2,_5); +}else{ +if(window.FormData!==undefined){ +_9(_2,_5); +}else{ +_8(_2,_5); +} +} +}else{ +$(_2).submit(); +} +if(_4.dirty){ +_7.removeAttr("disabled"); +} +}; +function _8(_a,_b){ +var _c=$.data(_a,"form").options; +var _d="easyui_frame_"+(new Date().getTime()); +var _e=$("").appendTo("body"); +_e.attr("src",window.ActiveXObject?"javascript:false":"about:blank"); +_e.css({position:"absolute",top:-1000,left:-1000}); +_e.bind("load",cb); +_f(_b); +function _f(_10){ +var _11=$(_a); +if(_c.url){ +_11.attr("action",_c.url); +} +var t=_11.attr("target"),a=_11.attr("action"); +_11.attr("target",_d); +var _12=$(); +try{ +for(var n in _10){ +var _13=$("").val(_10[n]).appendTo(_11); +_12=_12.add(_13); +} +_14(); +_11[0].submit(); +} +finally{ +_11.attr("action",a); +t?_11.attr("target",t):_11.removeAttr("target"); +_12.remove(); +} +}; +function _14(){ +var f=$("#"+_d); +if(!f.length){ +return; +} +try{ +var s=f.contents()[0].readyState; +if(s&&s.toLowerCase()=="uninitialized"){ +setTimeout(_14,100); +} +} +catch(e){ +cb(); +} +}; +var _15=10; +function cb(){ +var f=$("#"+_d); +if(!f.length){ +return; +} +f.unbind(); +var _16=""; +try{ +var _17=f.contents().find("body"); +_16=_17.html(); +if(_16==""){ +if(--_15){ +setTimeout(cb,100); +return; +} +} +var ta=_17.find(">textarea"); +if(ta.length){ +_16=ta.val(); +}else{ +var pre=_17.find(">pre"); +if(pre.length){ +_16=pre.html(); +} +} +} +catch(e){ +} +_c.success.call(_a,_16); +setTimeout(function(){ +f.unbind(); +f.remove(); +},100); +}; +}; +function _9(_18,_19){ +var _1a=$.data(_18,"form").options; +var _1b=new FormData($(_18)[0]); +for(var _1c in _19){ +_1b.append(_1c,_19[_1c]); +} +$.ajax({url:_1a.url,type:"post",xhr:function(){ +var xhr=$.ajaxSettings.xhr(); +if(xhr.upload){ +xhr.upload.addEventListener("progress",function(e){ +if(e.lengthComputable){ +var _1d=e.total; +var _1e=e.loaded||e.position; +var _1f=Math.ceil(_1e*100/_1d); +_1a.onProgress.call(_18,_1f); +} +},false); +} +return xhr; +},data:_1b,dataType:"html",cache:false,contentType:false,processData:false,complete:function(res){ +_1a.success.call(_18,res.responseText); +}}); +}; +function _20(_21,_22){ +var _23=$.data(_21,"form").options; +if(typeof _22=="string"){ +var _24={}; +if(_23.onBeforeLoad.call(_21,_24)==false){ +return; +} +$.ajax({url:_22,data:_24,dataType:"json",success:function(_25){ +_26(_25); +},error:function(){ +_23.onLoadError.apply(_21,arguments); +}}); +}else{ +_26(_22); +} +function _26(_27){ +var _28=$(_21); +for(var _29 in _27){ +var val=_27[_29]; +if(!_2a(_29,val)){ +if(!_2b(_29,val)){ +_28.find("input[name=\""+_29+"\"]").val(val); +_28.find("textarea[name=\""+_29+"\"]").val(val); +_28.find("select[name=\""+_29+"\"]").val(val); +} +} +} +_23.onLoadSuccess.call(_21,_27); +_28.form("validate"); +}; +function _2a(_2c,val){ +var cc=$(_21).find("[switchbuttonName=\""+_2c+"\"]"); +if(cc.length){ +cc.switchbutton("uncheck"); +cc.each(function(){ +if(_2d($(this).switchbutton("options").value,val)){ +$(this).switchbutton("check"); +} +}); +return true; +} +cc=$(_21).find("input[name=\""+_2c+"\"][type=radio], input[name=\""+_2c+"\"][type=checkbox]"); +if(cc.length){ +cc._propAttr("checked",false); +cc.each(function(){ +if(_2d($(this).val(),val)){ +$(this)._propAttr("checked",true); +} +}); +return true; +} +return false; +}; +function _2d(v,val){ +if(v==String(val)||$.inArray(v,$.isArray(val)?val:[val])>=0){ +return true; +}else{ +return false; +} +}; +function _2b(_2e,val){ +var _2f=$(_21).find("[textboxName=\""+_2e+"\"],[sliderName=\""+_2e+"\"]"); +if(_2f.length){ +for(var i=0;i<_23.fieldTypes.length;i++){ +var _30=_23.fieldTypes[i]; +var _31=_2f.data(_30); +if(_31){ +if(_31.options.multiple||_31.options.range){ +_2f[_30]("setValues",val); +}else{ +_2f[_30]("setValue",val); +} +return true; +} +} +} +return false; +}; +}; +function _32(_33){ +$("input,select,textarea",_33).each(function(){ +if($(this).hasClass("textbox-value")){ +return; +} +var t=this.type,tag=this.tagName.toLowerCase(); +if(t=="text"||t=="hidden"||t=="password"||tag=="textarea"){ +this.value=""; +}else{ +if(t=="file"){ +var _34=$(this); +if(!_34.hasClass("textbox-value")){ +var _35=_34.clone().val(""); +_35.insertAfter(_34); +if(_34.data("validatebox")){ +_34.validatebox("destroy"); +_35.validatebox(); +}else{ +_34.remove(); +} +} +}else{ +if(t=="checkbox"||t=="radio"){ +this.checked=false; +}else{ +if(tag=="select"){ +this.selectedIndex=-1; +} +} +} +} +}); +var tmp=$(); +var _36=$(_33); +var _37=$.data(_33,"form").options; +for(var i=0;i<_37.fieldTypes.length;i++){ +var _38=_37.fieldTypes[i]; +var _39=_36.find("."+_38+"-f").not(tmp); +if(_39.length&&_39[_38]){ +_39[_38]("clear"); +tmp=tmp.add(_39); +} +} +_36.form("validate"); +}; +function _3a(_3b){ +_3b.reset(); +var _3c=$(_3b); +var _3d=$.data(_3b,"form").options; +for(var i=_3d.fieldTypes.length-1;i>=0;i--){ +var _3e=_3d.fieldTypes[i]; +var _3f=_3c.find("."+_3e+"-f"); +if(_3f.length&&_3f[_3e]){ +_3f[_3e]("reset"); +} +} +_3c.form("validate"); +}; +function _40(_41){ +var _42=$.data(_41,"form").options; +$(_41).unbind(".form"); +if(_42.ajax){ +$(_41).bind("submit.form",function(){ +setTimeout(function(){ +_1(_41,_42); +},0); +return false; +}); +} +$(_41).bind("_change.form",function(e,t){ +if($.inArray(t,_42.dirtyFields)==-1){ +_42.dirtyFields.push(t); +} +_42.onChange.call(this,t); +}).bind("change.form",function(e){ +var t=e.target; +if(!$(t).hasClass("textbox-text")){ +if($.inArray(t,_42.dirtyFields)==-1){ +_42.dirtyFields.push(t); +} +_42.onChange.call(this,t); +} +}); +_43(_41,_42.novalidate); +}; +function _44(_45,_46){ +_46=_46||{}; +var _47=$.data(_45,"form"); +if(_47){ +$.extend(_47.options,_46); +}else{ +$.data(_45,"form",{options:$.extend({},$.fn.form.defaults,$.fn.form.parseOptions(_45),_46)}); +} +}; +function _48(_49){ +if($.fn.validatebox){ +var t=$(_49); +t.find(".validatebox-text:not(:disabled)").validatebox("validate"); +var _4a=t.find(".validatebox-invalid"); +_4a.filter(":not(:disabled):first").focus(); +return _4a.length==0; +} +return true; +}; +function _43(_4b,_4c){ +var _4d=$.data(_4b,"form").options; +_4d.novalidate=_4c; +$(_4b).find(".validatebox-text:not(:disabled)").validatebox(_4c?"disableValidation":"enableValidation"); +}; +$.fn.form=function(_4e,_4f){ +if(typeof _4e=="string"){ +this.each(function(){ +_44(this); +}); +return $.fn.form.methods[_4e](this,_4f); +} +return this.each(function(){ +_44(this,_4e); +_40(this); +}); +}; +$.fn.form.methods={options:function(jq){ +return $.data(jq[0],"form").options; +},submit:function(jq,_50){ +return jq.each(function(){ +_1(this,_50); +}); +},load:function(jq,_51){ +return jq.each(function(){ +_20(this,_51); +}); +},clear:function(jq){ +return jq.each(function(){ +_32(this); +}); +},reset:function(jq){ +return jq.each(function(){ +_3a(this); +}); +},validate:function(jq){ +return _48(jq[0]); +},disableValidation:function(jq){ +return jq.each(function(){ +_43(this,true); +}); +},enableValidation:function(jq){ +return jq.each(function(){ +_43(this,false); +}); +},resetValidation:function(jq){ +return jq.each(function(){ +$(this).find(".validatebox-text:not(:disabled)").validatebox("resetValidation"); +}); +},resetDirty:function(jq){ +return jq.each(function(){ +$(this).form("options").dirtyFields=[]; +}); +}}; +$.fn.form.parseOptions=function(_52){ +var t=$(_52); +return $.extend({},$.parser.parseOptions(_52,[{ajax:"boolean",dirty:"boolean"}]),{url:(t.attr("action")?t.attr("action"):undefined)}); +}; +$.fn.form.defaults={fieldTypes:["combobox","combotree","combogrid","combotreegrid","datetimebox","datebox","combo","datetimespinner","timespinner","numberspinner","spinner","slider","searchbox","numberbox","passwordbox","filebox","textbox","switchbutton"],novalidate:false,ajax:true,iframe:true,dirty:false,dirtyFields:[],url:null,queryParams:{},onSubmit:function(_53){ +return $(this).form("validate"); +},onProgress:function(_54){ +},success:function(_55){ +},onBeforeLoad:function(_56){ +},onLoadSuccess:function(_57){ +},onLoadError:function(){ +},onChange:function(_58){ +}}; +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.layout.js b/assets/js/easy-ui/plugins/jquery.layout.js index 1f9ad3cedc..d4fd2f6758 100755 --- a/assets/js/easy-ui/plugins/jquery.layout.js +++ b/assets/js/easy-ui/plugins/jquery.layout.js @@ -1,518 +1,518 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -var _1=false; -function _2(_3,_4){ -var _5=$.data(_3,"layout"); -var _6=_5.options; -var _7=_5.panels; -var cc=$(_3); -if(_4){ -$.extend(_6,{width:_4.width,height:_4.height}); -} -if(_3.tagName.toLowerCase()=="body"){ -cc._size("fit"); -}else{ -cc._size(_6); -} -var _8={top:0,left:0,width:cc.width(),height:cc.height()}; -_9(_a(_7.expandNorth)?_7.expandNorth:_7.north,"n"); -_9(_a(_7.expandSouth)?_7.expandSouth:_7.south,"s"); -_b(_a(_7.expandEast)?_7.expandEast:_7.east,"e"); -_b(_a(_7.expandWest)?_7.expandWest:_7.west,"w"); -_7.center.panel("resize",_8); -function _9(pp,_c){ -if(!pp.length||!_a(pp)){ -return; -} -var _d=pp.panel("options"); -pp.panel("resize",{width:cc.width(),height:_d.height}); -var _e=pp.panel("panel").outerHeight(); -pp.panel("move",{left:0,top:(_c=="n"?0:cc.height()-_e)}); -_8.height-=_e; -if(_c=="n"){ -_8.top+=_e; -if(!_d.split&&_d.border){ -_8.top--; -} -} -if(!_d.split&&_d.border){ -_8.height++; -} -}; -function _b(pp,_f){ -if(!pp.length||!_a(pp)){ -return; -} -var _10=pp.panel("options"); -pp.panel("resize",{width:_10.width,height:_8.height}); -var _11=pp.panel("panel").outerWidth(); -pp.panel("move",{left:(_f=="e"?cc.width()-_11:0),top:_8.top}); -_8.width-=_11; -if(_f=="w"){ -_8.left+=_11; -if(!_10.split&&_10.border){ -_8.left--; -} -} -if(!_10.split&&_10.border){ -_8.width++; -} -}; -}; -function _12(_13){ -var cc=$(_13); -cc.addClass("layout"); -function _14(el){ -var _15=$.fn.layout.parsePanelOptions(el); -if("north,south,east,west,center".indexOf(_15.region)>=0){ -_19(_13,_15,el); -} -}; -var _16=cc.layout("options"); -var _17=_16.onAdd; -_16.onAdd=function(){ -}; -cc.find(">div,>form>div").each(function(){ -_14(this); -}); -_16.onAdd=_17; -cc.append("
"); -cc.bind("_resize",function(e,_18){ -if($(this).hasClass("easyui-fluid")||_18){ -_2(_13); -} -return false; -}); -}; -function _19(_1a,_1b,el){ -_1b.region=_1b.region||"center"; -var _1c=$.data(_1a,"layout").panels; -var cc=$(_1a); -var dir=_1b.region; -if(_1c[dir].length){ -return; -} -var pp=$(el); -if(!pp.length){ -pp=$("
").appendTo(cc); -} -var _1d=$.extend({},$.fn.layout.paneldefaults,{width:(pp.length?parseInt(pp[0].style.width)||pp.outerWidth():"auto"),height:(pp.length?parseInt(pp[0].style.height)||pp.outerHeight():"auto"),doSize:false,collapsible:true,onOpen:function(){ -var _1e=$(this).panel("header").children("div.panel-tool"); -_1e.children("a.panel-tool-collapse").hide(); -var _1f={north:"up",south:"down",east:"right",west:"left"}; -if(!_1f[dir]){ -return; -} -var _20="layout-button-"+_1f[dir]; -var t=_1e.children("a."+_20); -if(!t.length){ -t=$("").addClass(_20).appendTo(_1e); -t.bind("click",{dir:dir},function(e){ -_39(_1a,e.data.dir); -return false; -}); -} -$(this).panel("options").collapsible?t.show():t.hide(); -}},_1b,{cls:((_1b.cls||"")+" layout-panel layout-panel-"+dir),bodyCls:((_1b.bodyCls||"")+" layout-body")}); -pp.panel(_1d); -_1c[dir]=pp; -var _21={north:"s",south:"n",east:"w",west:"e"}; -var _22=pp.panel("panel"); -if(pp.panel("options").split){ -_22.addClass("layout-split-"+dir); -} -_22.resizable($.extend({},{handles:(_21[dir]||""),disabled:(!pp.panel("options").split),onStartResize:function(e){ -_1=true; -if(dir=="north"||dir=="south"){ -var _23=$(">div.layout-split-proxy-v",_1a); -}else{ -var _23=$(">div.layout-split-proxy-h",_1a); -} -var top=0,_24=0,_25=0,_26=0; -var pos={display:"block"}; -if(dir=="north"){ -pos.top=parseInt(_22.css("top"))+_22.outerHeight()-_23.height(); -pos.left=parseInt(_22.css("left")); -pos.width=_22.outerWidth(); -pos.height=_23.height(); -}else{ -if(dir=="south"){ -pos.top=parseInt(_22.css("top")); -pos.left=parseInt(_22.css("left")); -pos.width=_22.outerWidth(); -pos.height=_23.height(); -}else{ -if(dir=="east"){ -pos.top=parseInt(_22.css("top"))||0; -pos.left=parseInt(_22.css("left"))||0; -pos.width=_23.width(); -pos.height=_22.outerHeight(); -}else{ -if(dir=="west"){ -pos.top=parseInt(_22.css("top"))||0; -pos.left=_22.outerWidth()-_23.width(); -pos.width=_23.width(); -pos.height=_22.outerHeight(); -} -} -} -} -_23.css(pos); -$("
").css({left:0,top:0,width:cc.width(),height:cc.height()}).appendTo(cc); -},onResize:function(e){ -if(dir=="north"||dir=="south"){ -var _27=_28(this); -$(this).resizable("options").maxHeight=_27; -var _29=$(">div.layout-split-proxy-v",_1a); -var top=dir=="north"?e.data.height-_29.height():$(_1a).height()-e.data.height; -_29.css("top",top); -}else{ -var _2a=_28(this); -$(this).resizable("options").maxWidth=_2a; -var _29=$(">div.layout-split-proxy-h",_1a); -var _2b=dir=="west"?e.data.width-_29.width():$(_1a).width()-e.data.width; -_29.css("left",_2b); -} -return false; -},onStopResize:function(e){ -cc.children("div.layout-split-proxy-v,div.layout-split-proxy-h").hide(); -pp.panel("resize",e.data); -_2(_1a); -_1=false; -cc.find(">div.layout-mask").remove(); -}},_1b)); -cc.layout("options").onAdd.call(_1a,dir); -function _28(p){ -var _2c="expand"+dir.substring(0,1).toUpperCase()+dir.substring(1); -var _2d=_1c["center"]; -var _2e=(dir=="north"||dir=="south")?"minHeight":"minWidth"; -var _2f=(dir=="north"||dir=="south")?"maxHeight":"maxWidth"; -var _30=(dir=="north"||dir=="south")?"_outerHeight":"_outerWidth"; -var _31=$.parser.parseValue(_2f,_1c[dir].panel("options")[_2f],$(_1a)); -var _32=$.parser.parseValue(_2e,_2d.panel("options")[_2e],$(_1a)); -var _33=_2d.panel("panel")[_30]()-_32; -if(_a(_1c[_2c])){ -_33+=_1c[_2c][_30]()-1; -}else{ -_33+=$(p)[_30](); -} -if(_33>_31){ -_33=_31; -} -return _33; -}; -}; -function _34(_35,_36){ -var _37=$.data(_35,"layout").panels; -if(_37[_36].length){ -_37[_36].panel("destroy"); -_37[_36]=$(); -var _38="expand"+_36.substring(0,1).toUpperCase()+_36.substring(1); -if(_37[_38]){ -_37[_38].panel("destroy"); -_37[_38]=undefined; -} -$(_35).layout("options").onRemove.call(_35,_36); -} -}; -function _39(_3a,_3b,_3c){ -if(_3c==undefined){ -_3c="normal"; -} -var _3d=$.data(_3a,"layout").panels; -var p=_3d[_3b]; -var _3e=p.panel("options"); -if(_3e.onBeforeCollapse.call(p)==false){ -return; -} -var _3f="expand"+_3b.substring(0,1).toUpperCase()+_3b.substring(1); -if(!_3d[_3f]){ -_3d[_3f]=_40(_3b); -var ep=_3d[_3f].panel("panel"); -if(!_3e.expandMode){ -ep.css("cursor","default"); -}else{ -ep.bind("click",function(){ -if(_3e.expandMode=="dock"){ -_4f(_3a,_3b); -}else{ -p.panel("expand",false).panel("open"); -var _41=_42(); -p.panel("resize",_41.collapse); -p.panel("panel").animate(_41.expand,function(){ -$(this).unbind(".layout").bind("mouseleave.layout",{region:_3b},function(e){ -if(_1==true){ -return; -} -if($("body>div.combo-p>div.combo-panel:visible").length){ -return; -} -_39(_3a,e.data.region); -}); -$(_3a).layout("options").onExpand.call(_3a,_3b); -}); -} -return false; -}); -} -} -var _43=_42(); -if(!_a(_3d[_3f])){ -_3d.center.panel("resize",_43.resizeC); -} -p.panel("panel").animate(_43.collapse,_3c,function(){ -p.panel("collapse",false).panel("close"); -_3d[_3f].panel("open").panel("resize",_43.expandP); -$(this).unbind(".layout"); -$(_3a).layout("options").onCollapse.call(_3a,_3b); -}); -function _40(dir){ -var _44={"east":"left","west":"right","north":"down","south":"up"}; -var _45=(_3e.region=="north"||_3e.region=="south"); -var _46="layout-button-"+_44[dir]; -var p=$("
").appendTo(_3a); -p.panel($.extend({},$.fn.layout.paneldefaults,{cls:("layout-expand layout-expand-"+dir),title:" ",titleDirection:_3e.titleDirection,iconCls:(_3e.hideCollapsedContent?null:_3e.iconCls),closed:true,minWidth:0,minHeight:0,doSize:false,region:_3e.region,collapsedSize:_3e.collapsedSize,noheader:(!_45&&_3e.hideExpandTool),tools:((_45&&_3e.hideExpandTool)?null:[{iconCls:_46,handler:function(){ -_4f(_3a,_3b); -return false; -}}]),onResize:function(){ -var _47=$(this).children(".layout-expand-title"); -if(_47.length){ -_47._outerWidth($(this).height()); -var _48=($(this).width()-Math.min(_47._outerWidth(),_47._outerHeight()))/2; -var top=Math.max(_47._outerWidth(),_47._outerHeight()); -if(_47.hasClass("layout-expand-title-down")){ -_48+=Math.min(_47._outerWidth(),_47._outerHeight()); -top=0; -} -_47.css({left:(_48+"px"),top:(top+"px")}); -} -}})); -if(!_3e.hideCollapsedContent){ -var _49=typeof _3e.collapsedContent=="function"?_3e.collapsedContent.call(p[0],_3e.title):_3e.collapsedContent; -_45?p.panel("setTitle",_49):p.html(_49); -} -p.panel("panel").hover(function(){ -$(this).addClass("layout-expand-over"); -},function(){ -$(this).removeClass("layout-expand-over"); -}); -return p; -}; -function _42(){ -var cc=$(_3a); -var _4a=_3d.center.panel("options"); -var _4b=_3e.collapsedSize; -if(_3b=="east"){ -var _4c=p.panel("panel")._outerWidth(); -var _4d=_4a.width+_4c-_4b; -if(_3e.split||!_3e.border){ -_4d++; -} -return {resizeC:{width:_4d},expand:{left:cc.width()-_4c},expandP:{top:_4a.top,left:cc.width()-_4b,width:_4b,height:_4a.height},collapse:{left:cc.width(),top:_4a.top,height:_4a.height}}; -}else{ -if(_3b=="west"){ -var _4c=p.panel("panel")._outerWidth(); -var _4d=_4a.width+_4c-_4b; -if(_3e.split||!_3e.border){ -_4d++; -} -return {resizeC:{width:_4d,left:_4b-1},expand:{left:0},expandP:{left:0,top:_4a.top,width:_4b,height:_4a.height},collapse:{left:-_4c,top:_4a.top,height:_4a.height}}; -}else{ -if(_3b=="north"){ -var _4e=p.panel("panel")._outerHeight(); -var hh=_4a.height; -if(!_a(_3d.expandNorth)){ -hh+=_4e-_4b+((_3e.split||!_3e.border)?1:0); -} -_3d.east.add(_3d.west).add(_3d.expandEast).add(_3d.expandWest).panel("resize",{top:_4b-1,height:hh}); -return {resizeC:{top:_4b-1,height:hh},expand:{top:0},expandP:{top:0,left:0,width:cc.width(),height:_4b},collapse:{top:-_4e,width:cc.width()}}; -}else{ -if(_3b=="south"){ -var _4e=p.panel("panel")._outerHeight(); -var hh=_4a.height; -if(!_a(_3d.expandSouth)){ -hh+=_4e-_4b+((_3e.split||!_3e.border)?1:0); -} -_3d.east.add(_3d.west).add(_3d.expandEast).add(_3d.expandWest).panel("resize",{height:hh}); -return {resizeC:{height:hh},expand:{top:cc.height()-_4e},expandP:{top:cc.height()-_4b,left:0,width:cc.width(),height:_4b},collapse:{top:cc.height(),width:cc.width()}}; -} -} -} -} -}; -}; -function _4f(_50,_51){ -var _52=$.data(_50,"layout").panels; -var p=_52[_51]; -var _53=p.panel("options"); -if(_53.onBeforeExpand.call(p)==false){ -return; -} -var _54="expand"+_51.substring(0,1).toUpperCase()+_51.substring(1); -if(_52[_54]){ -_52[_54].panel("close"); -p.panel("panel").stop(true,true); -p.panel("expand",false).panel("open"); -var _55=_56(); -p.panel("resize",_55.collapse); -p.panel("panel").animate(_55.expand,function(){ -_2(_50); -$(_50).layout("options").onExpand.call(_50,_51); -}); -} -function _56(){ -var cc=$(_50); -var _57=_52.center.panel("options"); -if(_51=="east"&&_52.expandEast){ -return {collapse:{left:cc.width(),top:_57.top,height:_57.height},expand:{left:cc.width()-p.panel("panel")._outerWidth()}}; -}else{ -if(_51=="west"&&_52.expandWest){ -return {collapse:{left:-p.panel("panel")._outerWidth(),top:_57.top,height:_57.height},expand:{left:0}}; -}else{ -if(_51=="north"&&_52.expandNorth){ -return {collapse:{top:-p.panel("panel")._outerHeight(),width:cc.width()},expand:{top:0}}; -}else{ -if(_51=="south"&&_52.expandSouth){ -return {collapse:{top:cc.height(),width:cc.width()},expand:{top:cc.height()-p.panel("panel")._outerHeight()}}; -} -} -} -} -}; -}; -function _a(pp){ -if(!pp){ -return false; -} -if(pp.length){ -return pp.panel("panel").is(":visible"); -}else{ -return false; -} -}; -function _58(_59){ -var _5a=$.data(_59,"layout"); -var _5b=_5a.options; -var _5c=_5a.panels; -var _5d=_5b.onCollapse; -_5b.onCollapse=function(){ -}; -_5e("east"); -_5e("west"); -_5e("north"); -_5e("south"); -_5b.onCollapse=_5d; -function _5e(_5f){ -var p=_5c[_5f]; -if(p.length&&p.panel("options").collapsed){ -_39(_59,_5f,0); -} -}; -}; -function _60(_61,_62,_63){ -var p=$(_61).layout("panel",_62); -p.panel("options").split=_63; -var cls="layout-split-"+_62; -var _64=p.panel("panel").removeClass(cls); -if(_63){ -_64.addClass(cls); -} -_64.resizable({disabled:(!_63)}); -_2(_61); -}; -$.fn.layout=function(_65,_66){ -if(typeof _65=="string"){ -return $.fn.layout.methods[_65](this,_66); -} -_65=_65||{}; -return this.each(function(){ -var _67=$.data(this,"layout"); -if(_67){ -$.extend(_67.options,_65); -}else{ -var _68=$.extend({},$.fn.layout.defaults,$.fn.layout.parseOptions(this),_65); -$.data(this,"layout",{options:_68,panels:{center:$(),north:$(),south:$(),east:$(),west:$()}}); -_12(this); -} -_2(this); -_58(this); -}); -}; -$.fn.layout.methods={options:function(jq){ -return $.data(jq[0],"layout").options; -},resize:function(jq,_69){ -return jq.each(function(){ -_2(this,_69); -}); -},panel:function(jq,_6a){ -return $.data(jq[0],"layout").panels[_6a]; -},collapse:function(jq,_6b){ -return jq.each(function(){ -_39(this,_6b); -}); -},expand:function(jq,_6c){ -return jq.each(function(){ -_4f(this,_6c); -}); -},add:function(jq,_6d){ -return jq.each(function(){ -_19(this,_6d); -_2(this); -if($(this).layout("panel",_6d.region).panel("options").collapsed){ -_39(this,_6d.region,0); -} -}); -},remove:function(jq,_6e){ -return jq.each(function(){ -_34(this,_6e); -_2(this); -}); -},split:function(jq,_6f){ -return jq.each(function(){ -_60(this,_6f,true); -}); -},unsplit:function(jq,_70){ -return jq.each(function(){ -_60(this,_70,false); -}); -}}; -$.fn.layout.parseOptions=function(_71){ -return $.extend({},$.parser.parseOptions(_71,[{fit:"boolean"}])); -}; -$.fn.layout.defaults={fit:false,onExpand:function(_72){ -},onCollapse:function(_73){ -},onAdd:function(_74){ -},onRemove:function(_75){ -}}; -$.fn.layout.parsePanelOptions=function(_76){ -var t=$(_76); -return $.extend({},$.fn.panel.parseOptions(_76),$.parser.parseOptions(_76,["region",{split:"boolean",collpasedSize:"number",minWidth:"number",minHeight:"number",maxWidth:"number",maxHeight:"number"}])); -}; -$.fn.layout.paneldefaults=$.extend({},$.fn.panel.defaults,{region:null,split:false,collapsedSize:28,expandMode:"float",hideExpandTool:false,hideCollapsedContent:true,collapsedContent:function(_77){ -var p=$(this); -var _78=p.panel("options"); -if(_78.region=="north"||_78.region=="south"){ -return _77; -} -var cc=[]; -if(_78.iconCls){ -cc.push("
"); -} -cc.push("
"); -cc.push(_77); -cc.push("
"); -return cc.join(""); -},minWidth:10,minHeight:10,maxWidth:10000,maxHeight:10000}); -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +var _1=false; +function _2(_3,_4){ +var _5=$.data(_3,"layout"); +var _6=_5.options; +var _7=_5.panels; +var cc=$(_3); +if(_4){ +$.extend(_6,{width:_4.width,height:_4.height}); +} +if(_3.tagName.toLowerCase()=="body"){ +cc._size("fit"); +}else{ +cc._size(_6); +} +var _8={top:0,left:0,width:cc.width(),height:cc.height()}; +_9(_a(_7.expandNorth)?_7.expandNorth:_7.north,"n"); +_9(_a(_7.expandSouth)?_7.expandSouth:_7.south,"s"); +_b(_a(_7.expandEast)?_7.expandEast:_7.east,"e"); +_b(_a(_7.expandWest)?_7.expandWest:_7.west,"w"); +_7.center.panel("resize",_8); +function _9(pp,_c){ +if(!pp.length||!_a(pp)){ +return; +} +var _d=pp.panel("options"); +pp.panel("resize",{width:cc.width(),height:_d.height}); +var _e=pp.panel("panel").outerHeight(); +pp.panel("move",{left:0,top:(_c=="n"?0:cc.height()-_e)}); +_8.height-=_e; +if(_c=="n"){ +_8.top+=_e; +if(!_d.split&&_d.border){ +_8.top--; +} +} +if(!_d.split&&_d.border){ +_8.height++; +} +}; +function _b(pp,_f){ +if(!pp.length||!_a(pp)){ +return; +} +var _10=pp.panel("options"); +pp.panel("resize",{width:_10.width,height:_8.height}); +var _11=pp.panel("panel").outerWidth(); +pp.panel("move",{left:(_f=="e"?cc.width()-_11:0),top:_8.top}); +_8.width-=_11; +if(_f=="w"){ +_8.left+=_11; +if(!_10.split&&_10.border){ +_8.left--; +} +} +if(!_10.split&&_10.border){ +_8.width++; +} +}; +}; +function _12(_13){ +var cc=$(_13); +cc.addClass("layout"); +function _14(el){ +var _15=$.fn.layout.parsePanelOptions(el); +if("north,south,east,west,center".indexOf(_15.region)>=0){ +_19(_13,_15,el); +} +}; +var _16=cc.layout("options"); +var _17=_16.onAdd; +_16.onAdd=function(){ +}; +cc.find(">div,>form>div").each(function(){ +_14(this); +}); +_16.onAdd=_17; +cc.append("
"); +cc.bind("_resize",function(e,_18){ +if($(this).hasClass("easyui-fluid")||_18){ +_2(_13); +} +return false; +}); +}; +function _19(_1a,_1b,el){ +_1b.region=_1b.region||"center"; +var _1c=$.data(_1a,"layout").panels; +var cc=$(_1a); +var dir=_1b.region; +if(_1c[dir].length){ +return; +} +var pp=$(el); +if(!pp.length){ +pp=$("
").appendTo(cc); +} +var _1d=$.extend({},$.fn.layout.paneldefaults,{width:(pp.length?parseInt(pp[0].style.width)||pp.outerWidth():"auto"),height:(pp.length?parseInt(pp[0].style.height)||pp.outerHeight():"auto"),doSize:false,collapsible:true,onOpen:function(){ +var _1e=$(this).panel("header").children("div.panel-tool"); +_1e.children("a.panel-tool-collapse").hide(); +var _1f={north:"up",south:"down",east:"right",west:"left"}; +if(!_1f[dir]){ +return; +} +var _20="layout-button-"+_1f[dir]; +var t=_1e.children("a."+_20); +if(!t.length){ +t=$("").addClass(_20).appendTo(_1e); +t.bind("click",{dir:dir},function(e){ +_39(_1a,e.data.dir); +return false; +}); +} +$(this).panel("options").collapsible?t.show():t.hide(); +}},_1b,{cls:((_1b.cls||"")+" layout-panel layout-panel-"+dir),bodyCls:((_1b.bodyCls||"")+" layout-body")}); +pp.panel(_1d); +_1c[dir]=pp; +var _21={north:"s",south:"n",east:"w",west:"e"}; +var _22=pp.panel("panel"); +if(pp.panel("options").split){ +_22.addClass("layout-split-"+dir); +} +_22.resizable($.extend({},{handles:(_21[dir]||""),disabled:(!pp.panel("options").split),onStartResize:function(e){ +_1=true; +if(dir=="north"||dir=="south"){ +var _23=$(">div.layout-split-proxy-v",_1a); +}else{ +var _23=$(">div.layout-split-proxy-h",_1a); +} +var top=0,_24=0,_25=0,_26=0; +var pos={display:"block"}; +if(dir=="north"){ +pos.top=parseInt(_22.css("top"))+_22.outerHeight()-_23.height(); +pos.left=parseInt(_22.css("left")); +pos.width=_22.outerWidth(); +pos.height=_23.height(); +}else{ +if(dir=="south"){ +pos.top=parseInt(_22.css("top")); +pos.left=parseInt(_22.css("left")); +pos.width=_22.outerWidth(); +pos.height=_23.height(); +}else{ +if(dir=="east"){ +pos.top=parseInt(_22.css("top"))||0; +pos.left=parseInt(_22.css("left"))||0; +pos.width=_23.width(); +pos.height=_22.outerHeight(); +}else{ +if(dir=="west"){ +pos.top=parseInt(_22.css("top"))||0; +pos.left=_22.outerWidth()-_23.width(); +pos.width=_23.width(); +pos.height=_22.outerHeight(); +} +} +} +} +_23.css(pos); +$("
").css({left:0,top:0,width:cc.width(),height:cc.height()}).appendTo(cc); +},onResize:function(e){ +if(dir=="north"||dir=="south"){ +var _27=_28(this); +$(this).resizable("options").maxHeight=_27; +var _29=$(">div.layout-split-proxy-v",_1a); +var top=dir=="north"?e.data.height-_29.height():$(_1a).height()-e.data.height; +_29.css("top",top); +}else{ +var _2a=_28(this); +$(this).resizable("options").maxWidth=_2a; +var _29=$(">div.layout-split-proxy-h",_1a); +var _2b=dir=="west"?e.data.width-_29.width():$(_1a).width()-e.data.width; +_29.css("left",_2b); +} +return false; +},onStopResize:function(e){ +cc.children("div.layout-split-proxy-v,div.layout-split-proxy-h").hide(); +pp.panel("resize",e.data); +_2(_1a); +_1=false; +cc.find(">div.layout-mask").remove(); +}},_1b)); +cc.layout("options").onAdd.call(_1a,dir); +function _28(p){ +var _2c="expand"+dir.substring(0,1).toUpperCase()+dir.substring(1); +var _2d=_1c["center"]; +var _2e=(dir=="north"||dir=="south")?"minHeight":"minWidth"; +var _2f=(dir=="north"||dir=="south")?"maxHeight":"maxWidth"; +var _30=(dir=="north"||dir=="south")?"_outerHeight":"_outerWidth"; +var _31=$.parser.parseValue(_2f,_1c[dir].panel("options")[_2f],$(_1a)); +var _32=$.parser.parseValue(_2e,_2d.panel("options")[_2e],$(_1a)); +var _33=_2d.panel("panel")[_30]()-_32; +if(_a(_1c[_2c])){ +_33+=_1c[_2c][_30]()-1; +}else{ +_33+=$(p)[_30](); +} +if(_33>_31){ +_33=_31; +} +return _33; +}; +}; +function _34(_35,_36){ +var _37=$.data(_35,"layout").panels; +if(_37[_36].length){ +_37[_36].panel("destroy"); +_37[_36]=$(); +var _38="expand"+_36.substring(0,1).toUpperCase()+_36.substring(1); +if(_37[_38]){ +_37[_38].panel("destroy"); +_37[_38]=undefined; +} +$(_35).layout("options").onRemove.call(_35,_36); +} +}; +function _39(_3a,_3b,_3c){ +if(_3c==undefined){ +_3c="normal"; +} +var _3d=$.data(_3a,"layout").panels; +var p=_3d[_3b]; +var _3e=p.panel("options"); +if(_3e.onBeforeCollapse.call(p)==false){ +return; +} +var _3f="expand"+_3b.substring(0,1).toUpperCase()+_3b.substring(1); +if(!_3d[_3f]){ +_3d[_3f]=_40(_3b); +var ep=_3d[_3f].panel("panel"); +if(!_3e.expandMode){ +ep.css("cursor","default"); +}else{ +ep.bind("click",function(){ +if(_3e.expandMode=="dock"){ +_4f(_3a,_3b); +}else{ +p.panel("expand",false).panel("open"); +var _41=_42(); +p.panel("resize",_41.collapse); +p.panel("panel").animate(_41.expand,function(){ +$(this).unbind(".layout").bind("mouseleave.layout",{region:_3b},function(e){ +if(_1==true){ +return; +} +if($("body>div.combo-p>div.combo-panel:visible").length){ +return; +} +_39(_3a,e.data.region); +}); +$(_3a).layout("options").onExpand.call(_3a,_3b); +}); +} +return false; +}); +} +} +var _43=_42(); +if(!_a(_3d[_3f])){ +_3d.center.panel("resize",_43.resizeC); +} +p.panel("panel").animate(_43.collapse,_3c,function(){ +p.panel("collapse",false).panel("close"); +_3d[_3f].panel("open").panel("resize",_43.expandP); +$(this).unbind(".layout"); +$(_3a).layout("options").onCollapse.call(_3a,_3b); +}); +function _40(dir){ +var _44={"east":"left","west":"right","north":"down","south":"up"}; +var _45=(_3e.region=="north"||_3e.region=="south"); +var _46="layout-button-"+_44[dir]; +var p=$("
").appendTo(_3a); +p.panel($.extend({},$.fn.layout.paneldefaults,{cls:("layout-expand layout-expand-"+dir),title:" ",titleDirection:_3e.titleDirection,iconCls:(_3e.hideCollapsedContent?null:_3e.iconCls),closed:true,minWidth:0,minHeight:0,doSize:false,region:_3e.region,collapsedSize:_3e.collapsedSize,noheader:(!_45&&_3e.hideExpandTool),tools:((_45&&_3e.hideExpandTool)?null:[{iconCls:_46,handler:function(){ +_4f(_3a,_3b); +return false; +}}]),onResize:function(){ +var _47=$(this).children(".layout-expand-title"); +if(_47.length){ +_47._outerWidth($(this).height()); +var _48=($(this).width()-Math.min(_47._outerWidth(),_47._outerHeight()))/2; +var top=Math.max(_47._outerWidth(),_47._outerHeight()); +if(_47.hasClass("layout-expand-title-down")){ +_48+=Math.min(_47._outerWidth(),_47._outerHeight()); +top=0; +} +_47.css({left:(_48+"px"),top:(top+"px")}); +} +}})); +if(!_3e.hideCollapsedContent){ +var _49=typeof _3e.collapsedContent=="function"?_3e.collapsedContent.call(p[0],_3e.title):_3e.collapsedContent; +_45?p.panel("setTitle",_49):p.html(_49); +} +p.panel("panel").hover(function(){ +$(this).addClass("layout-expand-over"); +},function(){ +$(this).removeClass("layout-expand-over"); +}); +return p; +}; +function _42(){ +var cc=$(_3a); +var _4a=_3d.center.panel("options"); +var _4b=_3e.collapsedSize; +if(_3b=="east"){ +var _4c=p.panel("panel")._outerWidth(); +var _4d=_4a.width+_4c-_4b; +if(_3e.split||!_3e.border){ +_4d++; +} +return {resizeC:{width:_4d},expand:{left:cc.width()-_4c},expandP:{top:_4a.top,left:cc.width()-_4b,width:_4b,height:_4a.height},collapse:{left:cc.width(),top:_4a.top,height:_4a.height}}; +}else{ +if(_3b=="west"){ +var _4c=p.panel("panel")._outerWidth(); +var _4d=_4a.width+_4c-_4b; +if(_3e.split||!_3e.border){ +_4d++; +} +return {resizeC:{width:_4d,left:_4b-1},expand:{left:0},expandP:{left:0,top:_4a.top,width:_4b,height:_4a.height},collapse:{left:-_4c,top:_4a.top,height:_4a.height}}; +}else{ +if(_3b=="north"){ +var _4e=p.panel("panel")._outerHeight(); +var hh=_4a.height; +if(!_a(_3d.expandNorth)){ +hh+=_4e-_4b+((_3e.split||!_3e.border)?1:0); +} +_3d.east.add(_3d.west).add(_3d.expandEast).add(_3d.expandWest).panel("resize",{top:_4b-1,height:hh}); +return {resizeC:{top:_4b-1,height:hh},expand:{top:0},expandP:{top:0,left:0,width:cc.width(),height:_4b},collapse:{top:-_4e,width:cc.width()}}; +}else{ +if(_3b=="south"){ +var _4e=p.panel("panel")._outerHeight(); +var hh=_4a.height; +if(!_a(_3d.expandSouth)){ +hh+=_4e-_4b+((_3e.split||!_3e.border)?1:0); +} +_3d.east.add(_3d.west).add(_3d.expandEast).add(_3d.expandWest).panel("resize",{height:hh}); +return {resizeC:{height:hh},expand:{top:cc.height()-_4e},expandP:{top:cc.height()-_4b,left:0,width:cc.width(),height:_4b},collapse:{top:cc.height(),width:cc.width()}}; +} +} +} +} +}; +}; +function _4f(_50,_51){ +var _52=$.data(_50,"layout").panels; +var p=_52[_51]; +var _53=p.panel("options"); +if(_53.onBeforeExpand.call(p)==false){ +return; +} +var _54="expand"+_51.substring(0,1).toUpperCase()+_51.substring(1); +if(_52[_54]){ +_52[_54].panel("close"); +p.panel("panel").stop(true,true); +p.panel("expand",false).panel("open"); +var _55=_56(); +p.panel("resize",_55.collapse); +p.panel("panel").animate(_55.expand,function(){ +_2(_50); +$(_50).layout("options").onExpand.call(_50,_51); +}); +} +function _56(){ +var cc=$(_50); +var _57=_52.center.panel("options"); +if(_51=="east"&&_52.expandEast){ +return {collapse:{left:cc.width(),top:_57.top,height:_57.height},expand:{left:cc.width()-p.panel("panel")._outerWidth()}}; +}else{ +if(_51=="west"&&_52.expandWest){ +return {collapse:{left:-p.panel("panel")._outerWidth(),top:_57.top,height:_57.height},expand:{left:0}}; +}else{ +if(_51=="north"&&_52.expandNorth){ +return {collapse:{top:-p.panel("panel")._outerHeight(),width:cc.width()},expand:{top:0}}; +}else{ +if(_51=="south"&&_52.expandSouth){ +return {collapse:{top:cc.height(),width:cc.width()},expand:{top:cc.height()-p.panel("panel")._outerHeight()}}; +} +} +} +} +}; +}; +function _a(pp){ +if(!pp){ +return false; +} +if(pp.length){ +return pp.panel("panel").is(":visible"); +}else{ +return false; +} +}; +function _58(_59){ +var _5a=$.data(_59,"layout"); +var _5b=_5a.options; +var _5c=_5a.panels; +var _5d=_5b.onCollapse; +_5b.onCollapse=function(){ +}; +_5e("east"); +_5e("west"); +_5e("north"); +_5e("south"); +_5b.onCollapse=_5d; +function _5e(_5f){ +var p=_5c[_5f]; +if(p.length&&p.panel("options").collapsed){ +_39(_59,_5f,0); +} +}; +}; +function _60(_61,_62,_63){ +var p=$(_61).layout("panel",_62); +p.panel("options").split=_63; +var cls="layout-split-"+_62; +var _64=p.panel("panel").removeClass(cls); +if(_63){ +_64.addClass(cls); +} +_64.resizable({disabled:(!_63)}); +_2(_61); +}; +$.fn.layout=function(_65,_66){ +if(typeof _65=="string"){ +return $.fn.layout.methods[_65](this,_66); +} +_65=_65||{}; +return this.each(function(){ +var _67=$.data(this,"layout"); +if(_67){ +$.extend(_67.options,_65); +}else{ +var _68=$.extend({},$.fn.layout.defaults,$.fn.layout.parseOptions(this),_65); +$.data(this,"layout",{options:_68,panels:{center:$(),north:$(),south:$(),east:$(),west:$()}}); +_12(this); +} +_2(this); +_58(this); +}); +}; +$.fn.layout.methods={options:function(jq){ +return $.data(jq[0],"layout").options; +},resize:function(jq,_69){ +return jq.each(function(){ +_2(this,_69); +}); +},panel:function(jq,_6a){ +return $.data(jq[0],"layout").panels[_6a]; +},collapse:function(jq,_6b){ +return jq.each(function(){ +_39(this,_6b); +}); +},expand:function(jq,_6c){ +return jq.each(function(){ +_4f(this,_6c); +}); +},add:function(jq,_6d){ +return jq.each(function(){ +_19(this,_6d); +_2(this); +if($(this).layout("panel",_6d.region).panel("options").collapsed){ +_39(this,_6d.region,0); +} +}); +},remove:function(jq,_6e){ +return jq.each(function(){ +_34(this,_6e); +_2(this); +}); +},split:function(jq,_6f){ +return jq.each(function(){ +_60(this,_6f,true); +}); +},unsplit:function(jq,_70){ +return jq.each(function(){ +_60(this,_70,false); +}); +}}; +$.fn.layout.parseOptions=function(_71){ +return $.extend({},$.parser.parseOptions(_71,[{fit:"boolean"}])); +}; +$.fn.layout.defaults={fit:false,onExpand:function(_72){ +},onCollapse:function(_73){ +},onAdd:function(_74){ +},onRemove:function(_75){ +}}; +$.fn.layout.parsePanelOptions=function(_76){ +var t=$(_76); +return $.extend({},$.fn.panel.parseOptions(_76),$.parser.parseOptions(_76,["region",{split:"boolean",collpasedSize:"number",minWidth:"number",minHeight:"number",maxWidth:"number",maxHeight:"number"}])); +}; +$.fn.layout.paneldefaults=$.extend({},$.fn.panel.defaults,{region:null,split:false,collapsedSize:28,expandMode:"float",hideExpandTool:false,hideCollapsedContent:true,collapsedContent:function(_77){ +var p=$(this); +var _78=p.panel("options"); +if(_78.region=="north"||_78.region=="south"){ +return _77; +} +var cc=[]; +if(_78.iconCls){ +cc.push("
"); +} +cc.push("
"); +cc.push(_77); +cc.push("
"); +return cc.join(""); +},minWidth:10,minHeight:10,maxWidth:10000,maxHeight:10000}); +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.linkbutton.js b/assets/js/easy-ui/plugins/jquery.linkbutton.js index 74c1697de1..97cfa5d8bb 100755 --- a/assets/js/easy-ui/plugins/jquery.linkbutton.js +++ b/assets/js/easy-ui/plugins/jquery.linkbutton.js @@ -1,184 +1,184 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(_2,_3){ -var _4=$.data(_2,"linkbutton").options; -if(_3){ -$.extend(_4,_3); -} -if(_4.width||_4.height||_4.fit){ -var _5=$(_2); -var _6=_5.parent(); -var _7=_5.is(":visible"); -if(!_7){ -var _8=$("
").insertBefore(_2); -var _9={position:_5.css("position"),display:_5.css("display"),left:_5.css("left")}; -_5.appendTo("body"); -_5.css({position:"absolute",display:"inline-block",left:-20000}); -} -_5._size(_4,_6); -var _a=_5.find(".l-btn-left"); -_a.css("margin-top",0); -_a.css("margin-top",parseInt((_5.height()-_a.height())/2)+"px"); -if(!_7){ -_5.insertAfter(_8); -_5.css(_9); -_8.remove(); -} -} -}; -function _b(_c){ -var _d=$.data(_c,"linkbutton").options; -var t=$(_c).empty(); -t.addClass("l-btn").removeClass("l-btn-plain l-btn-selected l-btn-plain-selected l-btn-outline"); -t.removeClass("l-btn-small l-btn-medium l-btn-large").addClass("l-btn-"+_d.size); -if(_d.plain){ -t.addClass("l-btn-plain"); -} -if(_d.outline){ -t.addClass("l-btn-outline"); -} -if(_d.selected){ -t.addClass(_d.plain?"l-btn-selected l-btn-plain-selected":"l-btn-selected"); -} -t.attr("group",_d.group||""); -t.attr("id",_d.id||""); -var _e=$("").appendTo(t); -if(_d.text){ -$("").html(_d.text).appendTo(_e); -}else{ -$(" ").appendTo(_e); -} -if(_d.iconCls){ -$(" ").addClass(_d.iconCls).appendTo(_e); -_e.addClass("l-btn-icon-"+_d.iconAlign); -} -t.unbind(".linkbutton").bind("focus.linkbutton",function(){ -if(!_d.disabled){ -$(this).addClass("l-btn-focus"); -} -}).bind("blur.linkbutton",function(){ -$(this).removeClass("l-btn-focus"); -}).bind("click.linkbutton",function(){ -if(!_d.disabled){ -if(_d.toggle){ -if(_d.selected){ -$(this).linkbutton("unselect"); -}else{ -$(this).linkbutton("select"); -} -} -_d.onClick.call(this); -} -}); -_f(_c,_d.selected); -_10(_c,_d.disabled); -}; -function _f(_11,_12){ -var _13=$.data(_11,"linkbutton").options; -if(_12){ -if(_13.group){ -$("a.l-btn[group=\""+_13.group+"\"]").each(function(){ -var o=$(this).linkbutton("options"); -if(o.toggle){ -$(this).removeClass("l-btn-selected l-btn-plain-selected"); -o.selected=false; -} -}); -} -$(_11).addClass(_13.plain?"l-btn-selected l-btn-plain-selected":"l-btn-selected"); -_13.selected=true; -}else{ -if(!_13.group){ -$(_11).removeClass("l-btn-selected l-btn-plain-selected"); -_13.selected=false; -} -} -}; -function _10(_14,_15){ -var _16=$.data(_14,"linkbutton"); -var _17=_16.options; -$(_14).removeClass("l-btn-disabled l-btn-plain-disabled"); -if(_15){ -_17.disabled=true; -var _18=$(_14).attr("href"); -if(_18){ -_16.href=_18; -$(_14).attr("href","javascript:;"); -} -if(_14.onclick){ -_16.onclick=_14.onclick; -_14.onclick=null; -} -_17.plain?$(_14).addClass("l-btn-disabled l-btn-plain-disabled"):$(_14).addClass("l-btn-disabled"); -}else{ -_17.disabled=false; -if(_16.href){ -$(_14).attr("href",_16.href); -} -if(_16.onclick){ -_14.onclick=_16.onclick; -} -} -}; -$.fn.linkbutton=function(_19,_1a){ -if(typeof _19=="string"){ -return $.fn.linkbutton.methods[_19](this,_1a); -} -_19=_19||{}; -return this.each(function(){ -var _1b=$.data(this,"linkbutton"); -if(_1b){ -$.extend(_1b.options,_19); -}else{ -$.data(this,"linkbutton",{options:$.extend({},$.fn.linkbutton.defaults,$.fn.linkbutton.parseOptions(this),_19)}); -$(this).removeAttr("disabled"); -$(this).bind("_resize",function(e,_1c){ -if($(this).hasClass("easyui-fluid")||_1c){ -_1(this); -} -return false; -}); -} -_b(this); -_1(this); -}); -}; -$.fn.linkbutton.methods={options:function(jq){ -return $.data(jq[0],"linkbutton").options; -},resize:function(jq,_1d){ -return jq.each(function(){ -_1(this,_1d); -}); -},enable:function(jq){ -return jq.each(function(){ -_10(this,false); -}); -},disable:function(jq){ -return jq.each(function(){ -_10(this,true); -}); -},select:function(jq){ -return jq.each(function(){ -_f(this,true); -}); -},unselect:function(jq){ -return jq.each(function(){ -_f(this,false); -}); -}}; -$.fn.linkbutton.parseOptions=function(_1e){ -var t=$(_1e); -return $.extend({},$.parser.parseOptions(_1e,["id","iconCls","iconAlign","group","size","text",{plain:"boolean",toggle:"boolean",selected:"boolean",outline:"boolean"}]),{disabled:(t.attr("disabled")?true:undefined),text:($.trim(t.html())||undefined),iconCls:(t.attr("icon")||t.attr("iconCls"))}); -}; -$.fn.linkbutton.defaults={id:null,disabled:false,toggle:false,selected:false,outline:false,group:null,plain:false,text:"",iconCls:null,iconAlign:"left",size:"small",onClick:function(){ -}}; -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(_2,_3){ +var _4=$.data(_2,"linkbutton").options; +if(_3){ +$.extend(_4,_3); +} +if(_4.width||_4.height||_4.fit){ +var _5=$(_2); +var _6=_5.parent(); +var _7=_5.is(":visible"); +if(!_7){ +var _8=$("
").insertBefore(_2); +var _9={position:_5.css("position"),display:_5.css("display"),left:_5.css("left")}; +_5.appendTo("body"); +_5.css({position:"absolute",display:"inline-block",left:-20000}); +} +_5._size(_4,_6); +var _a=_5.find(".l-btn-left"); +_a.css("margin-top",0); +_a.css("margin-top",parseInt((_5.height()-_a.height())/2)+"px"); +if(!_7){ +_5.insertAfter(_8); +_5.css(_9); +_8.remove(); +} +} +}; +function _b(_c){ +var _d=$.data(_c,"linkbutton").options; +var t=$(_c).empty(); +t.addClass("l-btn").removeClass("l-btn-plain l-btn-selected l-btn-plain-selected l-btn-outline"); +t.removeClass("l-btn-small l-btn-medium l-btn-large").addClass("l-btn-"+_d.size); +if(_d.plain){ +t.addClass("l-btn-plain"); +} +if(_d.outline){ +t.addClass("l-btn-outline"); +} +if(_d.selected){ +t.addClass(_d.plain?"l-btn-selected l-btn-plain-selected":"l-btn-selected"); +} +t.attr("group",_d.group||""); +t.attr("id",_d.id||""); +var _e=$("").appendTo(t); +if(_d.text){ +$("").html(_d.text).appendTo(_e); +}else{ +$(" ").appendTo(_e); +} +if(_d.iconCls){ +$(" ").addClass(_d.iconCls).appendTo(_e); +_e.addClass("l-btn-icon-"+_d.iconAlign); +} +t.unbind(".linkbutton").bind("focus.linkbutton",function(){ +if(!_d.disabled){ +$(this).addClass("l-btn-focus"); +} +}).bind("blur.linkbutton",function(){ +$(this).removeClass("l-btn-focus"); +}).bind("click.linkbutton",function(){ +if(!_d.disabled){ +if(_d.toggle){ +if(_d.selected){ +$(this).linkbutton("unselect"); +}else{ +$(this).linkbutton("select"); +} +} +_d.onClick.call(this); +} +}); +_f(_c,_d.selected); +_10(_c,_d.disabled); +}; +function _f(_11,_12){ +var _13=$.data(_11,"linkbutton").options; +if(_12){ +if(_13.group){ +$("a.l-btn[group=\""+_13.group+"\"]").each(function(){ +var o=$(this).linkbutton("options"); +if(o.toggle){ +$(this).removeClass("l-btn-selected l-btn-plain-selected"); +o.selected=false; +} +}); +} +$(_11).addClass(_13.plain?"l-btn-selected l-btn-plain-selected":"l-btn-selected"); +_13.selected=true; +}else{ +if(!_13.group){ +$(_11).removeClass("l-btn-selected l-btn-plain-selected"); +_13.selected=false; +} +} +}; +function _10(_14,_15){ +var _16=$.data(_14,"linkbutton"); +var _17=_16.options; +$(_14).removeClass("l-btn-disabled l-btn-plain-disabled"); +if(_15){ +_17.disabled=true; +var _18=$(_14).attr("href"); +if(_18){ +_16.href=_18; +$(_14).attr("href","javascript:;"); +} +if(_14.onclick){ +_16.onclick=_14.onclick; +_14.onclick=null; +} +_17.plain?$(_14).addClass("l-btn-disabled l-btn-plain-disabled"):$(_14).addClass("l-btn-disabled"); +}else{ +_17.disabled=false; +if(_16.href){ +$(_14).attr("href",_16.href); +} +if(_16.onclick){ +_14.onclick=_16.onclick; +} +} +}; +$.fn.linkbutton=function(_19,_1a){ +if(typeof _19=="string"){ +return $.fn.linkbutton.methods[_19](this,_1a); +} +_19=_19||{}; +return this.each(function(){ +var _1b=$.data(this,"linkbutton"); +if(_1b){ +$.extend(_1b.options,_19); +}else{ +$.data(this,"linkbutton",{options:$.extend({},$.fn.linkbutton.defaults,$.fn.linkbutton.parseOptions(this),_19)}); +$(this).removeAttr("disabled"); +$(this).bind("_resize",function(e,_1c){ +if($(this).hasClass("easyui-fluid")||_1c){ +_1(this); +} +return false; +}); +} +_b(this); +_1(this); +}); +}; +$.fn.linkbutton.methods={options:function(jq){ +return $.data(jq[0],"linkbutton").options; +},resize:function(jq,_1d){ +return jq.each(function(){ +_1(this,_1d); +}); +},enable:function(jq){ +return jq.each(function(){ +_10(this,false); +}); +},disable:function(jq){ +return jq.each(function(){ +_10(this,true); +}); +},select:function(jq){ +return jq.each(function(){ +_f(this,true); +}); +},unselect:function(jq){ +return jq.each(function(){ +_f(this,false); +}); +}}; +$.fn.linkbutton.parseOptions=function(_1e){ +var t=$(_1e); +return $.extend({},$.parser.parseOptions(_1e,["id","iconCls","iconAlign","group","size","text",{plain:"boolean",toggle:"boolean",selected:"boolean",outline:"boolean"}]),{disabled:(t.attr("disabled")?true:undefined),text:($.trim(t.html())||undefined),iconCls:(t.attr("icon")||t.attr("iconCls"))}); +}; +$.fn.linkbutton.defaults={id:null,disabled:false,toggle:false,selected:false,outline:false,group:null,plain:false,text:"",iconCls:null,iconAlign:"left",size:"small",onClick:function(){ +}}; +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.menu.js b/assets/js/easy-ui/plugins/jquery.menu.js index b132a8c9b8..2308fd7572 100755 --- a/assets/js/easy-ui/plugins/jquery.menu.js +++ b/assets/js/easy-ui/plugins/jquery.menu.js @@ -1,491 +1,491 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -$(function(){ -$(document).unbind(".menu").bind("mousedown.menu",function(e){ -var m=$(e.target).closest("div.menu,div.combo-p"); -if(m.length){ -return; -} -$("body>div.menu-top:visible").not(".menu-inline").menu("hide"); -_1($("body>div.menu:visible").not(".menu-inline")); -}); -}); -function _2(_3){ -var _4=$.data(_3,"menu").options; -$(_3).addClass("menu-top"); -_4.inline?$(_3).addClass("menu-inline"):$(_3).appendTo("body"); -$(_3).bind("_resize",function(e,_5){ -if($(this).hasClass("easyui-fluid")||_5){ -$(_3).menu("resize",_3); -} -return false; -}); -var _6=_7($(_3)); -for(var i=0;i<_6.length;i++){ -_b(_3,_6[i]); -} -function _7(_8){ -var _9=[]; -_8.addClass("menu"); -_9.push(_8); -if(!_8.hasClass("menu-content")){ -_8.children("div").each(function(){ -var _a=$(this).children("div"); -if(_a.length){ -_a.appendTo("body"); -this.submenu=_a; -var mm=_7(_a); -_9=_9.concat(mm); -} -}); -} -return _9; -}; -}; -function _b(_c,_d){ -var _e=$(_d).addClass("menu"); -if(!_e.data("menu")){ -_e.data("menu",{options:$.parser.parseOptions(_e[0],["width","height"])}); -} -if(!_e.hasClass("menu-content")){ -_e.children("div").each(function(){ -_f(_c,this); -}); -$("
").prependTo(_e); -} -_10(_c,_e); -if(!_e.hasClass("menu-inline")){ -_e.hide(); -} -_11(_c,_e); -}; -function _f(_12,div,_13){ -var _14=$(div); -var _15=$.extend({},$.parser.parseOptions(_14[0],["id","name","iconCls","href",{separator:"boolean"}]),{disabled:(_14.attr("disabled")?true:undefined),text:$.trim(_14.html()),onclick:_14[0].onclick},_13||{}); -_15.onclick=_15.onclick||_15.handler||null; -_14.data("menuitem",{options:_15}); -if(_15.separator){ -_14.addClass("menu-sep"); -} -if(!_14.hasClass("menu-sep")){ -_14.addClass("menu-item"); -_14.empty().append($("
").html(_15.text)); -if(_15.iconCls){ -$("
").addClass(_15.iconCls).appendTo(_14); -} -if(_15.id){ -_14.attr("id",_15.id); -} -if(_15.onclick){ -if(typeof _15.onclick=="string"){ -_14.attr("onclick",_15.onclick); -}else{ -_14[0].onclick=eval(_15.onclick); -} -} -if(_15.disabled){ -_16(_12,_14[0],true); -} -if(_14[0].submenu){ -$("
").appendTo(_14); -} -} -}; -function _10(_17,_18){ -var _19=$.data(_17,"menu").options; -var _1a=_18.attr("style")||""; -var _1b=_18.is(":visible"); -_18.css({display:"block",left:-10000,height:"auto",overflow:"hidden"}); -_18.find(".menu-item").each(function(){ -$(this)._outerHeight(_19.itemHeight); -$(this).find(".menu-text").css({height:(_19.itemHeight-2)+"px",lineHeight:(_19.itemHeight-2)+"px"}); -}); -_18.removeClass("menu-noline").addClass(_19.noline?"menu-noline":""); -var _1c=_18.data("menu").options; -var _1d=_1c.width; -var _1e=_1c.height; -if(isNaN(parseInt(_1d))){ -_1d=0; -_18.find("div.menu-text").each(function(){ -if(_1d<$(this).outerWidth()){ -_1d=$(this).outerWidth(); -} -}); -_1d=_1d?_1d+40:""; -} -var _1f=_18.outerHeight(); -if(isNaN(parseInt(_1e))){ -_1e=_1f; -if(_18.hasClass("menu-top")&&_19.alignTo){ -var at=$(_19.alignTo); -var h1=at.offset().top-$(document).scrollTop(); -var h2=$(window)._outerHeight()+$(document).scrollTop()-at.offset().top-at._outerHeight(); -_1e=Math.min(_1e,Math.max(h1,h2)); -}else{ -if(_1e>$(window)._outerHeight()){ -_1e=$(window).height(); -} -} -} -_18.attr("style",_1a); -_18.show(); -_18._size($.extend({},_1c,{width:_1d,height:_1e,minWidth:_1c.minWidth||_19.minWidth,maxWidth:_1c.maxWidth||_19.maxWidth})); -_18.find(".easyui-fluid").triggerHandler("_resize",[true]); -_18.css("overflow",_18.outerHeight()<_1f?"auto":"hidden"); -_18.children("div.menu-line")._outerHeight(_1f-2); -if(!_1b){ -_18.hide(); -} -}; -function _11(_20,_21){ -var _22=$.data(_20,"menu"); -var _23=_22.options; -_21.unbind(".menu"); -for(var _24 in _23.events){ -_21.bind(_24+".menu",{target:_20},_23.events[_24]); -} -}; -function _25(e){ -var _26=e.data.target; -var _27=$.data(_26,"menu"); -if(_27.timer){ -clearTimeout(_27.timer); -_27.timer=null; -} -}; -function _28(e){ -var _29=e.data.target; -var _2a=$.data(_29,"menu"); -if(_2a.options.hideOnUnhover){ -_2a.timer=setTimeout(function(){ -_2b(_29,$(_29).hasClass("menu-inline")); -},_2a.options.duration); -} -}; -function _2c(e){ -var _2d=e.data.target; -var _2e=$(e.target).closest(".menu-item"); -if(_2e.length){ -_2e.siblings().each(function(){ -if(this.submenu){ -_1(this.submenu); -} -$(this).removeClass("menu-active"); -}); -_2e.addClass("menu-active"); -if(_2e.hasClass("menu-item-disabled")){ -_2e.addClass("menu-active-disabled"); -return; -} -var _2f=_2e[0].submenu; -if(_2f){ -$(_2d).menu("show",{menu:_2f,parent:_2e}); -} -} -}; -function _30(e){ -var _31=$(e.target).closest(".menu-item"); -if(_31.length){ -_31.removeClass("menu-active menu-active-disabled"); -var _32=_31[0].submenu; -if(_32){ -if(e.pageX>=parseInt(_32.css("left"))){ -_31.addClass("menu-active"); -}else{ -_1(_32); -} -}else{ -_31.removeClass("menu-active"); -} -} -}; -function _33(e){ -var _34=e.data.target; -var _35=$(e.target).closest(".menu-item"); -if(_35.length){ -var _36=$(_34).data("menu").options; -var _37=_35.data("menuitem").options; -if(_37.disabled){ -return; -} -if(!_35[0].submenu){ -_2b(_34,_36.inline); -if(_37.href){ -location.href=_37.href; -} -} -_35.trigger("mouseenter"); -_36.onClick.call(_34,$(_34).menu("getItem",_35[0])); -} -}; -function _2b(_38,_39){ -var _3a=$.data(_38,"menu"); -if(_3a){ -if($(_38).is(":visible")){ -_1($(_38)); -if(_39){ -$(_38).show(); -}else{ -_3a.options.onHide.call(_38); -} -} -} -return false; -}; -function _3b(_3c,_3d){ -_3d=_3d||{}; -var _3e,top; -var _3f=$.data(_3c,"menu").options; -var _40=$(_3d.menu||_3c); -$(_3c).menu("resize",_40[0]); -if(_40.hasClass("menu-top")){ -$.extend(_3f,_3d); -_3e=_3f.left; -top=_3f.top; -if(_3f.alignTo){ -var at=$(_3f.alignTo); -_3e=at.offset().left; -top=at.offset().top+at._outerHeight(); -if(_3f.align=="right"){ -_3e+=at.outerWidth()-_40.outerWidth(); -} -} -if(_3e+_40.outerWidth()>$(window)._outerWidth()+$(document)._scrollLeft()){ -_3e=$(window)._outerWidth()+$(document).scrollLeft()-_40.outerWidth()-5; -} -if(_3e<0){ -_3e=0; -} -top=_41(top,_3f.alignTo); -}else{ -var _42=_3d.parent; -_3e=_42.offset().left+_42.outerWidth()-2; -if(_3e+_40.outerWidth()+5>$(window)._outerWidth()+$(document).scrollLeft()){ -_3e=_42.offset().left-_40.outerWidth()+2; -} -top=_41(_42.offset().top-3); -} -function _41(top,_43){ -if(top+_40.outerHeight()>$(window)._outerHeight()+$(document).scrollTop()){ -if(_43){ -top=$(_43).offset().top-_40._outerHeight(); -}else{ -top=$(window)._outerHeight()+$(document).scrollTop()-_40.outerHeight(); -} -} -if(top<0){ -top=0; -} -return top; -}; -_40.css(_3f.position.call(_3c,_40[0],_3e,top)); -_40.show(0,function(){ -if(!_40[0].shadow){ -_40[0].shadow=$("
").insertAfter(_40); -} -_40[0].shadow.css({display:(_40.hasClass("menu-inline")?"none":"block"),zIndex:$.fn.menu.defaults.zIndex++,left:_40.css("left"),top:_40.css("top"),width:_40.outerWidth(),height:_40.outerHeight()}); -_40.css("z-index",$.fn.menu.defaults.zIndex++); -if(_40.hasClass("menu-top")){ -_3f.onShow.call(_3c); -} -}); -}; -function _1(_44){ -if(_44&&_44.length){ -_45(_44); -_44.find("div.menu-item").each(function(){ -if(this.submenu){ -_1(this.submenu); -} -$(this).removeClass("menu-active"); -}); -} -function _45(m){ -m.stop(true,true); -if(m[0].shadow){ -m[0].shadow.hide(); -} -m.hide(); -}; -}; -function _46(_47,_48){ -var _49=null; -var tmp=$("
"); -function _4a(_4b){ -_4b.children("div.menu-item").each(function(){ -var _4c=$(_47).menu("getItem",this); -var s=tmp.empty().html(_4c.text).text(); -if(_48==$.trim(s)){ -_49=_4c; -}else{ -if(this.submenu&&!_49){ -_4a(this.submenu); -} -} -}); -}; -_4a($(_47)); -tmp.remove(); -return _49; -}; -function _16(_4d,_4e,_4f){ -var t=$(_4e); -if(t.hasClass("menu-item")){ -var _50=t.data("menuitem").options; -_50.disabled=_4f; -if(_4f){ -t.addClass("menu-item-disabled"); -t[0].onclick=null; -}else{ -t.removeClass("menu-item-disabled"); -t[0].onclick=_50.onclick; -} -} -}; -function _51(_52,_53){ -var _54=$.data(_52,"menu").options; -var _55=$(_52); -if(_53.parent){ -if(!_53.parent.submenu){ -var _56=$("
").appendTo("body"); -_53.parent.submenu=_56; -$("
").appendTo(_53.parent); -_b(_52,_56); -} -_55=_53.parent.submenu; -} -var div=$("
").appendTo(_55); -_f(_52,div,_53); -}; -function _57(_58,_59){ -function _5a(el){ -if(el.submenu){ -el.submenu.children("div.menu-item").each(function(){ -_5a(this); -}); -var _5b=el.submenu[0].shadow; -if(_5b){ -_5b.remove(); -} -el.submenu.remove(); -} -$(el).remove(); -}; -_5a(_59); -}; -function _5c(_5d,_5e,_5f){ -var _60=$(_5e).parent(); -if(_5f){ -$(_5e).show(); -}else{ -$(_5e).hide(); -} -_10(_5d,_60); -}; -function _61(_62){ -$(_62).children("div.menu-item").each(function(){ -_57(_62,this); -}); -if(_62.shadow){ -_62.shadow.remove(); -} -$(_62).remove(); -}; -$.fn.menu=function(_63,_64){ -if(typeof _63=="string"){ -return $.fn.menu.methods[_63](this,_64); -} -_63=_63||{}; -return this.each(function(){ -var _65=$.data(this,"menu"); -if(_65){ -$.extend(_65.options,_63); -}else{ -_65=$.data(this,"menu",{options:$.extend({},$.fn.menu.defaults,$.fn.menu.parseOptions(this),_63)}); -_2(this); -} -$(this).css({left:_65.options.left,top:_65.options.top}); -}); -}; -$.fn.menu.methods={options:function(jq){ -return $.data(jq[0],"menu").options; -},show:function(jq,pos){ -return jq.each(function(){ -_3b(this,pos); -}); -},hide:function(jq){ -return jq.each(function(){ -_2b(this); -}); -},destroy:function(jq){ -return jq.each(function(){ -_61(this); -}); -},setText:function(jq,_66){ -return jq.each(function(){ -var _67=$(_66.target).data("menuitem").options; -_67.text=_66.text; -$(_66.target).children("div.menu-text").html(_66.text); -}); -},setIcon:function(jq,_68){ -return jq.each(function(){ -var _69=$(_68.target).data("menuitem").options; -_69.iconCls=_68.iconCls; -$(_68.target).children("div.menu-icon").remove(); -if(_68.iconCls){ -$("
").addClass(_68.iconCls).appendTo(_68.target); -} -}); -},getItem:function(jq,_6a){ -var _6b=$(_6a).data("menuitem").options; -return $.extend({},_6b,{target:$(_6a)[0]}); -},findItem:function(jq,_6c){ -return _46(jq[0],_6c); -},appendItem:function(jq,_6d){ -return jq.each(function(){ -_51(this,_6d); -}); -},removeItem:function(jq,_6e){ -return jq.each(function(){ -_57(this,_6e); -}); -},enableItem:function(jq,_6f){ -return jq.each(function(){ -_16(this,_6f,false); -}); -},disableItem:function(jq,_70){ -return jq.each(function(){ -_16(this,_70,true); -}); -},showItem:function(jq,_71){ -return jq.each(function(){ -_5c(this,_71,true); -}); -},hideItem:function(jq,_72){ -return jq.each(function(){ -_5c(this,_72,false); -}); -},resize:function(jq,_73){ -return jq.each(function(){ -_10(this,_73?$(_73):$(this)); -}); -}}; -$.fn.menu.parseOptions=function(_74){ -return $.extend({},$.parser.parseOptions(_74,[{minWidth:"number",itemHeight:"number",duration:"number",hideOnUnhover:"boolean"},{fit:"boolean",inline:"boolean",noline:"boolean"}])); -}; -$.fn.menu.defaults={zIndex:110000,left:0,top:0,alignTo:null,align:"left",minWidth:120,itemHeight:22,duration:100,hideOnUnhover:true,inline:false,fit:false,noline:false,events:{mouseenter:_25,mouseleave:_28,mouseover:_2c,mouseout:_30,click:_33},position:function(_75,_76,top){ -return {left:_76,top:top}; -},onShow:function(){ -},onHide:function(){ -},onClick:function(_77){ -}}; -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +$(function(){ +$(document).unbind(".menu").bind("mousedown.menu",function(e){ +var m=$(e.target).closest("div.menu,div.combo-p"); +if(m.length){ +return; +} +$("body>div.menu-top:visible").not(".menu-inline").menu("hide"); +_1($("body>div.menu:visible").not(".menu-inline")); +}); +}); +function _2(_3){ +var _4=$.data(_3,"menu").options; +$(_3).addClass("menu-top"); +_4.inline?$(_3).addClass("menu-inline"):$(_3).appendTo("body"); +$(_3).bind("_resize",function(e,_5){ +if($(this).hasClass("easyui-fluid")||_5){ +$(_3).menu("resize",_3); +} +return false; +}); +var _6=_7($(_3)); +for(var i=0;i<_6.length;i++){ +_b(_3,_6[i]); +} +function _7(_8){ +var _9=[]; +_8.addClass("menu"); +_9.push(_8); +if(!_8.hasClass("menu-content")){ +_8.children("div").each(function(){ +var _a=$(this).children("div"); +if(_a.length){ +_a.appendTo("body"); +this.submenu=_a; +var mm=_7(_a); +_9=_9.concat(mm); +} +}); +} +return _9; +}; +}; +function _b(_c,_d){ +var _e=$(_d).addClass("menu"); +if(!_e.data("menu")){ +_e.data("menu",{options:$.parser.parseOptions(_e[0],["width","height"])}); +} +if(!_e.hasClass("menu-content")){ +_e.children("div").each(function(){ +_f(_c,this); +}); +$("
").prependTo(_e); +} +_10(_c,_e); +if(!_e.hasClass("menu-inline")){ +_e.hide(); +} +_11(_c,_e); +}; +function _f(_12,div,_13){ +var _14=$(div); +var _15=$.extend({},$.parser.parseOptions(_14[0],["id","name","iconCls","href",{separator:"boolean"}]),{disabled:(_14.attr("disabled")?true:undefined),text:$.trim(_14.html()),onclick:_14[0].onclick},_13||{}); +_15.onclick=_15.onclick||_15.handler||null; +_14.data("menuitem",{options:_15}); +if(_15.separator){ +_14.addClass("menu-sep"); +} +if(!_14.hasClass("menu-sep")){ +_14.addClass("menu-item"); +_14.empty().append($("
").html(_15.text)); +if(_15.iconCls){ +$("
").addClass(_15.iconCls).appendTo(_14); +} +if(_15.id){ +_14.attr("id",_15.id); +} +if(_15.onclick){ +if(typeof _15.onclick=="string"){ +_14.attr("onclick",_15.onclick); +}else{ +_14[0].onclick=eval(_15.onclick); +} +} +if(_15.disabled){ +_16(_12,_14[0],true); +} +if(_14[0].submenu){ +$("
").appendTo(_14); +} +} +}; +function _10(_17,_18){ +var _19=$.data(_17,"menu").options; +var _1a=_18.attr("style")||""; +var _1b=_18.is(":visible"); +_18.css({display:"block",left:-10000,height:"auto",overflow:"hidden"}); +_18.find(".menu-item").each(function(){ +$(this)._outerHeight(_19.itemHeight); +$(this).find(".menu-text").css({height:(_19.itemHeight-2)+"px",lineHeight:(_19.itemHeight-2)+"px"}); +}); +_18.removeClass("menu-noline").addClass(_19.noline?"menu-noline":""); +var _1c=_18.data("menu").options; +var _1d=_1c.width; +var _1e=_1c.height; +if(isNaN(parseInt(_1d))){ +_1d=0; +_18.find("div.menu-text").each(function(){ +if(_1d<$(this).outerWidth()){ +_1d=$(this).outerWidth(); +} +}); +_1d=_1d?_1d+40:""; +} +var _1f=_18.outerHeight(); +if(isNaN(parseInt(_1e))){ +_1e=_1f; +if(_18.hasClass("menu-top")&&_19.alignTo){ +var at=$(_19.alignTo); +var h1=at.offset().top-$(document).scrollTop(); +var h2=$(window)._outerHeight()+$(document).scrollTop()-at.offset().top-at._outerHeight(); +_1e=Math.min(_1e,Math.max(h1,h2)); +}else{ +if(_1e>$(window)._outerHeight()){ +_1e=$(window).height(); +} +} +} +_18.attr("style",_1a); +_18.show(); +_18._size($.extend({},_1c,{width:_1d,height:_1e,minWidth:_1c.minWidth||_19.minWidth,maxWidth:_1c.maxWidth||_19.maxWidth})); +_18.find(".easyui-fluid").triggerHandler("_resize",[true]); +_18.css("overflow",_18.outerHeight()<_1f?"auto":"hidden"); +_18.children("div.menu-line")._outerHeight(_1f-2); +if(!_1b){ +_18.hide(); +} +}; +function _11(_20,_21){ +var _22=$.data(_20,"menu"); +var _23=_22.options; +_21.unbind(".menu"); +for(var _24 in _23.events){ +_21.bind(_24+".menu",{target:_20},_23.events[_24]); +} +}; +function _25(e){ +var _26=e.data.target; +var _27=$.data(_26,"menu"); +if(_27.timer){ +clearTimeout(_27.timer); +_27.timer=null; +} +}; +function _28(e){ +var _29=e.data.target; +var _2a=$.data(_29,"menu"); +if(_2a.options.hideOnUnhover){ +_2a.timer=setTimeout(function(){ +_2b(_29,$(_29).hasClass("menu-inline")); +},_2a.options.duration); +} +}; +function _2c(e){ +var _2d=e.data.target; +var _2e=$(e.target).closest(".menu-item"); +if(_2e.length){ +_2e.siblings().each(function(){ +if(this.submenu){ +_1(this.submenu); +} +$(this).removeClass("menu-active"); +}); +_2e.addClass("menu-active"); +if(_2e.hasClass("menu-item-disabled")){ +_2e.addClass("menu-active-disabled"); +return; +} +var _2f=_2e[0].submenu; +if(_2f){ +$(_2d).menu("show",{menu:_2f,parent:_2e}); +} +} +}; +function _30(e){ +var _31=$(e.target).closest(".menu-item"); +if(_31.length){ +_31.removeClass("menu-active menu-active-disabled"); +var _32=_31[0].submenu; +if(_32){ +if(e.pageX>=parseInt(_32.css("left"))){ +_31.addClass("menu-active"); +}else{ +_1(_32); +} +}else{ +_31.removeClass("menu-active"); +} +} +}; +function _33(e){ +var _34=e.data.target; +var _35=$(e.target).closest(".menu-item"); +if(_35.length){ +var _36=$(_34).data("menu").options; +var _37=_35.data("menuitem").options; +if(_37.disabled){ +return; +} +if(!_35[0].submenu){ +_2b(_34,_36.inline); +if(_37.href){ +location.href=_37.href; +} +} +_35.trigger("mouseenter"); +_36.onClick.call(_34,$(_34).menu("getItem",_35[0])); +} +}; +function _2b(_38,_39){ +var _3a=$.data(_38,"menu"); +if(_3a){ +if($(_38).is(":visible")){ +_1($(_38)); +if(_39){ +$(_38).show(); +}else{ +_3a.options.onHide.call(_38); +} +} +} +return false; +}; +function _3b(_3c,_3d){ +_3d=_3d||{}; +var _3e,top; +var _3f=$.data(_3c,"menu").options; +var _40=$(_3d.menu||_3c); +$(_3c).menu("resize",_40[0]); +if(_40.hasClass("menu-top")){ +$.extend(_3f,_3d); +_3e=_3f.left; +top=_3f.top; +if(_3f.alignTo){ +var at=$(_3f.alignTo); +_3e=at.offset().left; +top=at.offset().top+at._outerHeight(); +if(_3f.align=="right"){ +_3e+=at.outerWidth()-_40.outerWidth(); +} +} +if(_3e+_40.outerWidth()>$(window)._outerWidth()+$(document)._scrollLeft()){ +_3e=$(window)._outerWidth()+$(document).scrollLeft()-_40.outerWidth()-5; +} +if(_3e<0){ +_3e=0; +} +top=_41(top,_3f.alignTo); +}else{ +var _42=_3d.parent; +_3e=_42.offset().left+_42.outerWidth()-2; +if(_3e+_40.outerWidth()+5>$(window)._outerWidth()+$(document).scrollLeft()){ +_3e=_42.offset().left-_40.outerWidth()+2; +} +top=_41(_42.offset().top-3); +} +function _41(top,_43){ +if(top+_40.outerHeight()>$(window)._outerHeight()+$(document).scrollTop()){ +if(_43){ +top=$(_43).offset().top-_40._outerHeight(); +}else{ +top=$(window)._outerHeight()+$(document).scrollTop()-_40.outerHeight(); +} +} +if(top<0){ +top=0; +} +return top; +}; +_40.css(_3f.position.call(_3c,_40[0],_3e,top)); +_40.show(0,function(){ +if(!_40[0].shadow){ +_40[0].shadow=$("
").insertAfter(_40); +} +_40[0].shadow.css({display:(_40.hasClass("menu-inline")?"none":"block"),zIndex:$.fn.menu.defaults.zIndex++,left:_40.css("left"),top:_40.css("top"),width:_40.outerWidth(),height:_40.outerHeight()}); +_40.css("z-index",$.fn.menu.defaults.zIndex++); +if(_40.hasClass("menu-top")){ +_3f.onShow.call(_3c); +} +}); +}; +function _1(_44){ +if(_44&&_44.length){ +_45(_44); +_44.find("div.menu-item").each(function(){ +if(this.submenu){ +_1(this.submenu); +} +$(this).removeClass("menu-active"); +}); +} +function _45(m){ +m.stop(true,true); +if(m[0].shadow){ +m[0].shadow.hide(); +} +m.hide(); +}; +}; +function _46(_47,_48){ +var _49=null; +var tmp=$("
"); +function _4a(_4b){ +_4b.children("div.menu-item").each(function(){ +var _4c=$(_47).menu("getItem",this); +var s=tmp.empty().html(_4c.text).text(); +if(_48==$.trim(s)){ +_49=_4c; +}else{ +if(this.submenu&&!_49){ +_4a(this.submenu); +} +} +}); +}; +_4a($(_47)); +tmp.remove(); +return _49; +}; +function _16(_4d,_4e,_4f){ +var t=$(_4e); +if(t.hasClass("menu-item")){ +var _50=t.data("menuitem").options; +_50.disabled=_4f; +if(_4f){ +t.addClass("menu-item-disabled"); +t[0].onclick=null; +}else{ +t.removeClass("menu-item-disabled"); +t[0].onclick=_50.onclick; +} +} +}; +function _51(_52,_53){ +var _54=$.data(_52,"menu").options; +var _55=$(_52); +if(_53.parent){ +if(!_53.parent.submenu){ +var _56=$("
").appendTo("body"); +_53.parent.submenu=_56; +$("
").appendTo(_53.parent); +_b(_52,_56); +} +_55=_53.parent.submenu; +} +var div=$("
").appendTo(_55); +_f(_52,div,_53); +}; +function _57(_58,_59){ +function _5a(el){ +if(el.submenu){ +el.submenu.children("div.menu-item").each(function(){ +_5a(this); +}); +var _5b=el.submenu[0].shadow; +if(_5b){ +_5b.remove(); +} +el.submenu.remove(); +} +$(el).remove(); +}; +_5a(_59); +}; +function _5c(_5d,_5e,_5f){ +var _60=$(_5e).parent(); +if(_5f){ +$(_5e).show(); +}else{ +$(_5e).hide(); +} +_10(_5d,_60); +}; +function _61(_62){ +$(_62).children("div.menu-item").each(function(){ +_57(_62,this); +}); +if(_62.shadow){ +_62.shadow.remove(); +} +$(_62).remove(); +}; +$.fn.menu=function(_63,_64){ +if(typeof _63=="string"){ +return $.fn.menu.methods[_63](this,_64); +} +_63=_63||{}; +return this.each(function(){ +var _65=$.data(this,"menu"); +if(_65){ +$.extend(_65.options,_63); +}else{ +_65=$.data(this,"menu",{options:$.extend({},$.fn.menu.defaults,$.fn.menu.parseOptions(this),_63)}); +_2(this); +} +$(this).css({left:_65.options.left,top:_65.options.top}); +}); +}; +$.fn.menu.methods={options:function(jq){ +return $.data(jq[0],"menu").options; +},show:function(jq,pos){ +return jq.each(function(){ +_3b(this,pos); +}); +},hide:function(jq){ +return jq.each(function(){ +_2b(this); +}); +},destroy:function(jq){ +return jq.each(function(){ +_61(this); +}); +},setText:function(jq,_66){ +return jq.each(function(){ +var _67=$(_66.target).data("menuitem").options; +_67.text=_66.text; +$(_66.target).children("div.menu-text").html(_66.text); +}); +},setIcon:function(jq,_68){ +return jq.each(function(){ +var _69=$(_68.target).data("menuitem").options; +_69.iconCls=_68.iconCls; +$(_68.target).children("div.menu-icon").remove(); +if(_68.iconCls){ +$("
").addClass(_68.iconCls).appendTo(_68.target); +} +}); +},getItem:function(jq,_6a){ +var _6b=$(_6a).data("menuitem").options; +return $.extend({},_6b,{target:$(_6a)[0]}); +},findItem:function(jq,_6c){ +return _46(jq[0],_6c); +},appendItem:function(jq,_6d){ +return jq.each(function(){ +_51(this,_6d); +}); +},removeItem:function(jq,_6e){ +return jq.each(function(){ +_57(this,_6e); +}); +},enableItem:function(jq,_6f){ +return jq.each(function(){ +_16(this,_6f,false); +}); +},disableItem:function(jq,_70){ +return jq.each(function(){ +_16(this,_70,true); +}); +},showItem:function(jq,_71){ +return jq.each(function(){ +_5c(this,_71,true); +}); +},hideItem:function(jq,_72){ +return jq.each(function(){ +_5c(this,_72,false); +}); +},resize:function(jq,_73){ +return jq.each(function(){ +_10(this,_73?$(_73):$(this)); +}); +}}; +$.fn.menu.parseOptions=function(_74){ +return $.extend({},$.parser.parseOptions(_74,[{minWidth:"number",itemHeight:"number",duration:"number",hideOnUnhover:"boolean"},{fit:"boolean",inline:"boolean",noline:"boolean"}])); +}; +$.fn.menu.defaults={zIndex:110000,left:0,top:0,alignTo:null,align:"left",minWidth:120,itemHeight:22,duration:100,hideOnUnhover:true,inline:false,fit:false,noline:false,events:{mouseenter:_25,mouseleave:_28,mouseover:_2c,mouseout:_30,click:_33},position:function(_75,_76,top){ +return {left:_76,top:top}; +},onShow:function(){ +},onHide:function(){ +},onClick:function(_77){ +}}; +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.menubutton.js b/assets/js/easy-ui/plugins/jquery.menubutton.js index f440fa9c1d..4438e0b9db 100755 --- a/assets/js/easy-ui/plugins/jquery.menubutton.js +++ b/assets/js/easy-ui/plugins/jquery.menubutton.js @@ -1,128 +1,128 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(_2){ -var _3=$.data(_2,"menubutton").options; -var _4=$(_2); -_4.linkbutton(_3); -if(_3.hasDownArrow){ -_4.removeClass(_3.cls.btn1+" "+_3.cls.btn2).addClass("m-btn"); -_4.removeClass("m-btn-small m-btn-medium m-btn-large").addClass("m-btn-"+_3.size); -var _5=_4.find(".l-btn-left"); -$("").addClass(_3.cls.arrow).appendTo(_5); -$("").addClass("m-btn-line").appendTo(_5); -} -$(_2).menubutton("resize"); -if(_3.menu){ -$(_3.menu).menu({duration:_3.duration}); -var _6=$(_3.menu).menu("options"); -var _7=_6.onShow; -var _8=_6.onHide; -$.extend(_6,{onShow:function(){ -var _9=$(this).menu("options"); -var _a=$(_9.alignTo); -var _b=_a.menubutton("options"); -_a.addClass((_b.plain==true)?_b.cls.btn2:_b.cls.btn1); -_7.call(this); -},onHide:function(){ -var _c=$(this).menu("options"); -var _d=$(_c.alignTo); -var _e=_d.menubutton("options"); -_d.removeClass((_e.plain==true)?_e.cls.btn2:_e.cls.btn1); -_8.call(this); -}}); -} -}; -function _f(_10){ -var _11=$.data(_10,"menubutton").options; -var btn=$(_10); -var t=btn.find("."+_11.cls.trigger); -if(!t.length){ -t=btn; -} -t.unbind(".menubutton"); -var _12=null; -t.bind("click.menubutton",function(){ -if(!_13()){ -_14(_10); -return false; -} -}).bind("mouseenter.menubutton",function(){ -if(!_13()){ -_12=setTimeout(function(){ -_14(_10); -},_11.duration); -return false; -} -}).bind("mouseleave.menubutton",function(){ -if(_12){ -clearTimeout(_12); -} -$(_11.menu).triggerHandler("mouseleave"); -}); -function _13(){ -return $(_10).linkbutton("options").disabled; -}; -}; -function _14(_15){ -var _16=$(_15).menubutton("options"); -if(_16.disabled||!_16.menu){ -return; -} -$("body>div.menu-top").menu("hide"); -var btn=$(_15); -var mm=$(_16.menu); -if(mm.length){ -mm.menu("options").alignTo=btn; -mm.menu("show",{alignTo:btn,align:_16.menuAlign}); -} -btn.blur(); -}; -$.fn.menubutton=function(_17,_18){ -if(typeof _17=="string"){ -var _19=$.fn.menubutton.methods[_17]; -if(_19){ -return _19(this,_18); -}else{ -return this.linkbutton(_17,_18); -} -} -_17=_17||{}; -return this.each(function(){ -var _1a=$.data(this,"menubutton"); -if(_1a){ -$.extend(_1a.options,_17); -}else{ -$.data(this,"menubutton",{options:$.extend({},$.fn.menubutton.defaults,$.fn.menubutton.parseOptions(this),_17)}); -$(this).removeAttr("disabled"); -} -_1(this); -_f(this); -}); -}; -$.fn.menubutton.methods={options:function(jq){ -var _1b=jq.linkbutton("options"); -return $.extend($.data(jq[0],"menubutton").options,{toggle:_1b.toggle,selected:_1b.selected,disabled:_1b.disabled}); -},destroy:function(jq){ -return jq.each(function(){ -var _1c=$(this).menubutton("options"); -if(_1c.menu){ -$(_1c.menu).menu("destroy"); -} -$(this).remove(); -}); -}}; -$.fn.menubutton.parseOptions=function(_1d){ -var t=$(_1d); -return $.extend({},$.fn.linkbutton.parseOptions(_1d),$.parser.parseOptions(_1d,["menu",{plain:"boolean",hasDownArrow:"boolean",duration:"number"}])); -}; -$.fn.menubutton.defaults=$.extend({},$.fn.linkbutton.defaults,{plain:true,hasDownArrow:true,menu:null,menuAlign:"left",duration:100,cls:{btn1:"m-btn-active",btn2:"m-btn-plain-active",arrow:"m-btn-downarrow",trigger:"m-btn"}}); -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(_2){ +var _3=$.data(_2,"menubutton").options; +var _4=$(_2); +_4.linkbutton(_3); +if(_3.hasDownArrow){ +_4.removeClass(_3.cls.btn1+" "+_3.cls.btn2).addClass("m-btn"); +_4.removeClass("m-btn-small m-btn-medium m-btn-large").addClass("m-btn-"+_3.size); +var _5=_4.find(".l-btn-left"); +$("").addClass(_3.cls.arrow).appendTo(_5); +$("").addClass("m-btn-line").appendTo(_5); +} +$(_2).menubutton("resize"); +if(_3.menu){ +$(_3.menu).menu({duration:_3.duration}); +var _6=$(_3.menu).menu("options"); +var _7=_6.onShow; +var _8=_6.onHide; +$.extend(_6,{onShow:function(){ +var _9=$(this).menu("options"); +var _a=$(_9.alignTo); +var _b=_a.menubutton("options"); +_a.addClass((_b.plain==true)?_b.cls.btn2:_b.cls.btn1); +_7.call(this); +},onHide:function(){ +var _c=$(this).menu("options"); +var _d=$(_c.alignTo); +var _e=_d.menubutton("options"); +_d.removeClass((_e.plain==true)?_e.cls.btn2:_e.cls.btn1); +_8.call(this); +}}); +} +}; +function _f(_10){ +var _11=$.data(_10,"menubutton").options; +var btn=$(_10); +var t=btn.find("."+_11.cls.trigger); +if(!t.length){ +t=btn; +} +t.unbind(".menubutton"); +var _12=null; +t.bind("click.menubutton",function(){ +if(!_13()){ +_14(_10); +return false; +} +}).bind("mouseenter.menubutton",function(){ +if(!_13()){ +_12=setTimeout(function(){ +_14(_10); +},_11.duration); +return false; +} +}).bind("mouseleave.menubutton",function(){ +if(_12){ +clearTimeout(_12); +} +$(_11.menu).triggerHandler("mouseleave"); +}); +function _13(){ +return $(_10).linkbutton("options").disabled; +}; +}; +function _14(_15){ +var _16=$(_15).menubutton("options"); +if(_16.disabled||!_16.menu){ +return; +} +$("body>div.menu-top").menu("hide"); +var btn=$(_15); +var mm=$(_16.menu); +if(mm.length){ +mm.menu("options").alignTo=btn; +mm.menu("show",{alignTo:btn,align:_16.menuAlign}); +} +btn.blur(); +}; +$.fn.menubutton=function(_17,_18){ +if(typeof _17=="string"){ +var _19=$.fn.menubutton.methods[_17]; +if(_19){ +return _19(this,_18); +}else{ +return this.linkbutton(_17,_18); +} +} +_17=_17||{}; +return this.each(function(){ +var _1a=$.data(this,"menubutton"); +if(_1a){ +$.extend(_1a.options,_17); +}else{ +$.data(this,"menubutton",{options:$.extend({},$.fn.menubutton.defaults,$.fn.menubutton.parseOptions(this),_17)}); +$(this).removeAttr("disabled"); +} +_1(this); +_f(this); +}); +}; +$.fn.menubutton.methods={options:function(jq){ +var _1b=jq.linkbutton("options"); +return $.extend($.data(jq[0],"menubutton").options,{toggle:_1b.toggle,selected:_1b.selected,disabled:_1b.disabled}); +},destroy:function(jq){ +return jq.each(function(){ +var _1c=$(this).menubutton("options"); +if(_1c.menu){ +$(_1c.menu).menu("destroy"); +} +$(this).remove(); +}); +}}; +$.fn.menubutton.parseOptions=function(_1d){ +var t=$(_1d); +return $.extend({},$.fn.linkbutton.parseOptions(_1d),$.parser.parseOptions(_1d,["menu",{plain:"boolean",hasDownArrow:"boolean",duration:"number"}])); +}; +$.fn.menubutton.defaults=$.extend({},$.fn.linkbutton.defaults,{plain:true,hasDownArrow:true,menu:null,menuAlign:"left",duration:100,cls:{btn1:"m-btn-active",btn2:"m-btn-plain-active",arrow:"m-btn-downarrow",trigger:"m-btn"}}); +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.messager.js b/assets/js/easy-ui/plugins/jquery.messager.js index b4d6f54344..76738b60e4 100755 --- a/assets/js/easy-ui/plugins/jquery.messager.js +++ b/assets/js/easy-ui/plugins/jquery.messager.js @@ -1,187 +1,187 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(){ -$(document).unbind(".messager").bind("keydown.messager",function(e){ -if(e.keyCode==27){ -$("body").children("div.messager-window").children("div.messager-body").each(function(){ -$(this).dialog("close"); -}); -}else{ -if(e.keyCode==9){ -var _2=$("body").children("div.messager-window"); -if(!_2.length){ -return; -} -var _3=_2.find(".messager-input,.messager-button .l-btn"); -for(var i=0;i<_3.length;i++){ -if($(_3[i]).is(":focus")){ -$(_3[i>=_3.length-1?0:i+1]).focus(); -return false; -} -} -}else{ -if(e.keyCode==13){ -var _4=$(e.target).closest("input.messager-input"); -if(_4.length){ -var _5=_4.closest(".messager-body"); -_6(_5,_4.val()); -} -} -} -} -}); -}; -function _7(){ -$(document).unbind(".messager"); -}; -function _8(_9){ -var _a=$.extend({},$.messager.defaults,{modal:false,shadow:false,draggable:false,resizable:false,closed:true,style:{left:"",top:"",right:0,zIndex:$.fn.window.defaults.zIndex++,bottom:-document.body.scrollTop-document.documentElement.scrollTop},title:"",width:250,height:100,minHeight:0,showType:"slide",showSpeed:600,content:_9.msg,timeout:4000},_9); -var _b=$("
").appendTo("body"); -_b.dialog($.extend({},_a,{noheader:(_a.title?false:true),openAnimation:(_a.showType),closeAnimation:(_a.showType=="show"?"hide":_a.showType),openDuration:_a.showSpeed,closeDuration:_a.showSpeed,onOpen:function(){ -_b.dialog("dialog").hover(function(){ -if(_a.timer){ -clearTimeout(_a.timer); -} -},function(){ -_c(); -}); -_c(); -function _c(){ -if(_a.timeout>0){ -_a.timer=setTimeout(function(){ -if(_b.length&&_b.data("dialog")){ -_b.dialog("close"); -} -},_a.timeout); -} -}; -if(_9.onOpen){ -_9.onOpen.call(this); -}else{ -_a.onOpen.call(this); -} -},onClose:function(){ -if(_a.timer){ -clearTimeout(_a.timer); -} -if(_9.onClose){ -_9.onClose.call(this); -}else{ -_a.onClose.call(this); -} -_b.dialog("destroy"); -}})); -_b.dialog("dialog").css(_a.style); -_b.dialog("open"); -return _b; -}; -function _d(_e){ -_1(); -var _f=$("
").appendTo("body"); -_f.dialog($.extend({},_e,{noheader:(_e.title?false:true),onClose:function(){ -_7(); -if(_e.onClose){ -_e.onClose.call(this); -} -setTimeout(function(){ -_f.dialog("destroy"); -},100); -}})); -var win=_f.dialog("dialog").addClass("messager-window"); -win.find(".dialog-button").addClass("messager-button").find("a:first").focus(); -return _f; -}; -function _6(dlg,_10){ -dlg.dialog("close"); -dlg.dialog("options").fn(_10); -}; -$.messager={show:function(_11){ -return _8(_11); -},alert:function(_12,msg,_13,fn){ -var _14=typeof _12=="object"?_12:{title:_12,msg:msg,icon:_13,fn:fn}; -var cls=_14.icon?"messager-icon messager-"+_14.icon:""; -_14=$.extend({},$.messager.defaults,{content:"
"+"
"+_14.msg+"
"+"
"},_14); -if(!_14.buttons){ -_14.buttons=[{text:_14.ok,onClick:function(){ -_6(dlg); -}}]; -} -var dlg=_d(_14); -return dlg; -},confirm:function(_15,msg,fn){ -var _16=typeof _15=="object"?_15:{title:_15,msg:msg,fn:fn}; -_16=$.extend({},$.messager.defaults,{content:"
"+"
"+_16.msg+"
"+"
"},_16); -if(!_16.buttons){ -_16.buttons=[{text:_16.ok,onClick:function(){ -_6(dlg,true); -}},{text:_16.cancel,onClick:function(){ -_6(dlg,false); -}}]; -} -var dlg=_d(_16); -return dlg; -},prompt:function(_17,msg,fn){ -var _18=typeof _17=="object"?_17:{title:_17,msg:msg,fn:fn}; -_18=$.extend({},$.messager.defaults,{content:"
"+"
"+_18.msg+"
"+"
"+"
"+"
"},_18); -if(!_18.buttons){ -_18.buttons=[{text:_18.ok,onClick:function(){ -_6(dlg,dlg.find(".messager-input").val()); -}},{text:_18.cancel,onClick:function(){ -_6(dlg); -}}]; -} -var dlg=_d(_18); -dlg.find(".messager-input").focus(); -return dlg; -},progress:function(_19){ -var _1a={bar:function(){ -return $("body>div.messager-window").find("div.messager-p-bar"); -},close:function(){ -var dlg=$("body>div.messager-window>div.messager-body:has(div.messager-progress)"); -if(dlg.length){ -dlg.dialog("close"); -} -}}; -if(typeof _19=="string"){ -var _1b=_1a[_19]; -return _1b(); -} -_19=_19||{}; -var _1c=$.extend({},{title:"",minHeight:0,content:undefined,msg:"",text:undefined,interval:300},_19); -var dlg=_d($.extend({},$.messager.defaults,{content:"
"+_1c.msg+"
",closable:false,doSize:false},_1c,{onClose:function(){ -if(this.timer){ -clearInterval(this.timer); -} -if(_19.onClose){ -_19.onClose.call(this); -}else{ -$.messager.defaults.onClose.call(this); -} -}})); -var bar=dlg.find("div.messager-p-bar"); -bar.progressbar({text:_1c.text}); -dlg.dialog("resize"); -if(_1c.interval){ -dlg[0].timer=setInterval(function(){ -var v=bar.progressbar("getValue"); -v+=10; -if(v>100){ -v=0; -} -bar.progressbar("setValue",v); -},_1c.interval); -} -return dlg; -}}; -$.messager.defaults=$.extend({},$.fn.dialog.defaults,{ok:"Ok",cancel:"Cancel",width:300,height:"auto",minHeight:150,modal:true,collapsible:false,minimizable:false,maximizable:false,resizable:false,fn:function(){ -}}); -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(){ +$(document).unbind(".messager").bind("keydown.messager",function(e){ +if(e.keyCode==27){ +$("body").children("div.messager-window").children("div.messager-body").each(function(){ +$(this).dialog("close"); +}); +}else{ +if(e.keyCode==9){ +var _2=$("body").children("div.messager-window"); +if(!_2.length){ +return; +} +var _3=_2.find(".messager-input,.messager-button .l-btn"); +for(var i=0;i<_3.length;i++){ +if($(_3[i]).is(":focus")){ +$(_3[i>=_3.length-1?0:i+1]).focus(); +return false; +} +} +}else{ +if(e.keyCode==13){ +var _4=$(e.target).closest("input.messager-input"); +if(_4.length){ +var _5=_4.closest(".messager-body"); +_6(_5,_4.val()); +} +} +} +} +}); +}; +function _7(){ +$(document).unbind(".messager"); +}; +function _8(_9){ +var _a=$.extend({},$.messager.defaults,{modal:false,shadow:false,draggable:false,resizable:false,closed:true,style:{left:"",top:"",right:0,zIndex:$.fn.window.defaults.zIndex++,bottom:-document.body.scrollTop-document.documentElement.scrollTop},title:"",width:250,height:100,minHeight:0,showType:"slide",showSpeed:600,content:_9.msg,timeout:4000},_9); +var _b=$("
").appendTo("body"); +_b.dialog($.extend({},_a,{noheader:(_a.title?false:true),openAnimation:(_a.showType),closeAnimation:(_a.showType=="show"?"hide":_a.showType),openDuration:_a.showSpeed,closeDuration:_a.showSpeed,onOpen:function(){ +_b.dialog("dialog").hover(function(){ +if(_a.timer){ +clearTimeout(_a.timer); +} +},function(){ +_c(); +}); +_c(); +function _c(){ +if(_a.timeout>0){ +_a.timer=setTimeout(function(){ +if(_b.length&&_b.data("dialog")){ +_b.dialog("close"); +} +},_a.timeout); +} +}; +if(_9.onOpen){ +_9.onOpen.call(this); +}else{ +_a.onOpen.call(this); +} +},onClose:function(){ +if(_a.timer){ +clearTimeout(_a.timer); +} +if(_9.onClose){ +_9.onClose.call(this); +}else{ +_a.onClose.call(this); +} +_b.dialog("destroy"); +}})); +_b.dialog("dialog").css(_a.style); +_b.dialog("open"); +return _b; +}; +function _d(_e){ +_1(); +var _f=$("
").appendTo("body"); +_f.dialog($.extend({},_e,{noheader:(_e.title?false:true),onClose:function(){ +_7(); +if(_e.onClose){ +_e.onClose.call(this); +} +setTimeout(function(){ +_f.dialog("destroy"); +},100); +}})); +var win=_f.dialog("dialog").addClass("messager-window"); +win.find(".dialog-button").addClass("messager-button").find("a:first").focus(); +return _f; +}; +function _6(dlg,_10){ +dlg.dialog("close"); +dlg.dialog("options").fn(_10); +}; +$.messager={show:function(_11){ +return _8(_11); +},alert:function(_12,msg,_13,fn){ +var _14=typeof _12=="object"?_12:{title:_12,msg:msg,icon:_13,fn:fn}; +var cls=_14.icon?"messager-icon messager-"+_14.icon:""; +_14=$.extend({},$.messager.defaults,{content:"
"+"
"+_14.msg+"
"+"
"},_14); +if(!_14.buttons){ +_14.buttons=[{text:_14.ok,onClick:function(){ +_6(dlg); +}}]; +} +var dlg=_d(_14); +return dlg; +},confirm:function(_15,msg,fn){ +var _16=typeof _15=="object"?_15:{title:_15,msg:msg,fn:fn}; +_16=$.extend({},$.messager.defaults,{content:"
"+"
"+_16.msg+"
"+"
"},_16); +if(!_16.buttons){ +_16.buttons=[{text:_16.ok,onClick:function(){ +_6(dlg,true); +}},{text:_16.cancel,onClick:function(){ +_6(dlg,false); +}}]; +} +var dlg=_d(_16); +return dlg; +},prompt:function(_17,msg,fn){ +var _18=typeof _17=="object"?_17:{title:_17,msg:msg,fn:fn}; +_18=$.extend({},$.messager.defaults,{content:"
"+"
"+_18.msg+"
"+"
"+"
"+"
"},_18); +if(!_18.buttons){ +_18.buttons=[{text:_18.ok,onClick:function(){ +_6(dlg,dlg.find(".messager-input").val()); +}},{text:_18.cancel,onClick:function(){ +_6(dlg); +}}]; +} +var dlg=_d(_18); +dlg.find(".messager-input").focus(); +return dlg; +},progress:function(_19){ +var _1a={bar:function(){ +return $("body>div.messager-window").find("div.messager-p-bar"); +},close:function(){ +var dlg=$("body>div.messager-window>div.messager-body:has(div.messager-progress)"); +if(dlg.length){ +dlg.dialog("close"); +} +}}; +if(typeof _19=="string"){ +var _1b=_1a[_19]; +return _1b(); +} +_19=_19||{}; +var _1c=$.extend({},{title:"",minHeight:0,content:undefined,msg:"",text:undefined,interval:300},_19); +var dlg=_d($.extend({},$.messager.defaults,{content:"
"+_1c.msg+"
",closable:false,doSize:false},_1c,{onClose:function(){ +if(this.timer){ +clearInterval(this.timer); +} +if(_19.onClose){ +_19.onClose.call(this); +}else{ +$.messager.defaults.onClose.call(this); +} +}})); +var bar=dlg.find("div.messager-p-bar"); +bar.progressbar({text:_1c.text}); +dlg.dialog("resize"); +if(_1c.interval){ +dlg[0].timer=setInterval(function(){ +var v=bar.progressbar("getValue"); +v+=10; +if(v>100){ +v=0; +} +bar.progressbar("setValue",v); +},_1c.interval); +} +return dlg; +}}; +$.messager.defaults=$.extend({},$.fn.dialog.defaults,{ok:"Ok",cancel:"Cancel",width:300,height:"auto",minHeight:150,modal:true,collapsible:false,minimizable:false,maximizable:false,resizable:false,fn:function(){ +}}); +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.numberbox.js b/assets/js/easy-ui/plugins/jquery.numberbox.js index f9d4398978..2641cf82a9 100755 --- a/assets/js/easy-ui/plugins/jquery.numberbox.js +++ b/assets/js/easy-ui/plugins/jquery.numberbox.js @@ -1,178 +1,178 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(_2){ -var _3=$.data(_2,"numberbox"); -var _4=_3.options; -$(_2).addClass("numberbox-f").textbox(_4); -$(_2).textbox("textbox").css({imeMode:"disabled"}); -$(_2).attr("numberboxName",$(_2).attr("textboxName")); -_3.numberbox=$(_2).next(); -_3.numberbox.addClass("numberbox"); -var _5=_4.parser.call(_2,_4.value); -var _6=_4.formatter.call(_2,_5); -$(_2).numberbox("initValue",_5).numberbox("setText",_6); -}; -function _7(_8,_9){ -var _a=$.data(_8,"numberbox"); -var _b=_a.options; -_b.value=parseFloat(_9); -var _9=_b.parser.call(_8,_9); -var _c=_b.formatter.call(_8,_9); -_b.value=_9; -$(_8).textbox("setText",_c).textbox("setValue",_9); -_c=_b.formatter.call(_8,$(_8).textbox("getValue")); -$(_8).textbox("setText",_c); -}; -$.fn.numberbox=function(_d,_e){ -if(typeof _d=="string"){ -var _f=$.fn.numberbox.methods[_d]; -if(_f){ -return _f(this,_e); -}else{ -return this.textbox(_d,_e); -} -} -_d=_d||{}; -return this.each(function(){ -var _10=$.data(this,"numberbox"); -if(_10){ -$.extend(_10.options,_d); -}else{ -_10=$.data(this,"numberbox",{options:$.extend({},$.fn.numberbox.defaults,$.fn.numberbox.parseOptions(this),_d)}); -} -_1(this); -}); -}; -$.fn.numberbox.methods={options:function(jq){ -var _11=jq.data("textbox")?jq.textbox("options"):{}; -return $.extend($.data(jq[0],"numberbox").options,{width:_11.width,originalValue:_11.originalValue,disabled:_11.disabled,readonly:_11.readonly}); -},fix:function(jq){ -return jq.each(function(){ -var _12=$(this).numberbox("options"); -_12.value=null; -var _13=_12.parser.call(this,$(this).numberbox("getText")); -$(this).numberbox("setValue",_13); -}); -},setValue:function(jq,_14){ -return jq.each(function(){ -_7(this,_14); -}); -},clear:function(jq){ -return jq.each(function(){ -$(this).textbox("clear"); -$(this).numberbox("options").value=""; -}); -},reset:function(jq){ -return jq.each(function(){ -$(this).textbox("reset"); -$(this).numberbox("setValue",$(this).numberbox("getValue")); -}); -}}; -$.fn.numberbox.parseOptions=function(_15){ -var t=$(_15); -return $.extend({},$.fn.textbox.parseOptions(_15),$.parser.parseOptions(_15,["decimalSeparator","groupSeparator","suffix",{min:"number",max:"number",precision:"number"}]),{prefix:(t.attr("prefix")?t.attr("prefix"):undefined)}); -}; -$.fn.numberbox.defaults=$.extend({},$.fn.textbox.defaults,{inputEvents:{keypress:function(e){ -var _16=e.data.target; -var _17=$(_16).numberbox("options"); -return _17.filter.call(_16,e); -},blur:function(e){ -$(e.data.target).numberbox("fix"); -},keydown:function(e){ -if(e.keyCode==13){ -$(e.data.target).numberbox("fix"); -} -}},min:null,max:null,precision:0,decimalSeparator:".",groupSeparator:"",prefix:"",suffix:"",filter:function(e){ -var _18=$(this).numberbox("options"); -var s=$(this).numberbox("getText"); -if(e.metaKey||e.ctrlKey){ -return true; -} -if($.inArray(String(e.which),["46","8","13","0"])>=0){ -return true; -} -var tmp=$(""); -tmp.html(String.fromCharCode(e.which)); -var c=tmp.text(); -tmp.remove(); -if(!c){ -return true; -} -if(c=="-"||c==_18.decimalSeparator){ -return (s.indexOf(c)==-1)?true:false; -}else{ -if(c==_18.groupSeparator){ -return true; -}else{ -if("0123456789".indexOf(c)>=0){ -return true; -}else{ -return false; -} -} -} -},formatter:function(_19){ -if(!_19){ -return _19; -} -_19=_19+""; -var _1a=$(this).numberbox("options"); -var s1=_19,s2=""; -var _1b=_19.indexOf("."); -if(_1b>=0){ -s1=_19.substring(0,_1b); -s2=_19.substring(_1b+1,_19.length); -} -if(_1a.groupSeparator){ -var p=/(\d+)(\d{3})/; -while(p.test(s1)){ -s1=s1.replace(p,"$1"+_1a.groupSeparator+"$2"); -} -} -if(s2){ -return _1a.prefix+s1+_1a.decimalSeparator+s2+_1a.suffix; -}else{ -return _1a.prefix+s1+_1a.suffix; -} -},parser:function(s){ -s=s+""; -var _1c=$(this).numberbox("options"); -if(_1c.prefix){ -s=$.trim(s.replace(new RegExp("\\"+$.trim(_1c.prefix),"g"),"")); -} -if(_1c.suffix){ -s=$.trim(s.replace(new RegExp("\\"+$.trim(_1c.suffix),"g"),"")); -} -if(parseFloat(s)!=_1c.value){ -if(_1c.groupSeparator){ -s=$.trim(s.replace(new RegExp("\\"+_1c.groupSeparator,"g"),"")); -} -if(_1c.decimalSeparator){ -s=$.trim(s.replace(new RegExp("\\"+_1c.decimalSeparator,"g"),".")); -} -s=s.replace(/\s/g,""); -} -var val=parseFloat(s).toFixed(_1c.precision); -if(isNaN(val)){ -val=""; -}else{ -if(typeof (_1c.min)=="number"&&val<_1c.min){ -val=_1c.min.toFixed(_1c.precision); -}else{ -if(typeof (_1c.max)=="number"&&val>_1c.max){ -val=_1c.max.toFixed(_1c.precision); -} -} -} -return val; -}}); -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(_2){ +var _3=$.data(_2,"numberbox"); +var _4=_3.options; +$(_2).addClass("numberbox-f").textbox(_4); +$(_2).textbox("textbox").css({imeMode:"disabled"}); +$(_2).attr("numberboxName",$(_2).attr("textboxName")); +_3.numberbox=$(_2).next(); +_3.numberbox.addClass("numberbox"); +var _5=_4.parser.call(_2,_4.value); +var _6=_4.formatter.call(_2,_5); +$(_2).numberbox("initValue",_5).numberbox("setText",_6); +}; +function _7(_8,_9){ +var _a=$.data(_8,"numberbox"); +var _b=_a.options; +_b.value=parseFloat(_9); +var _9=_b.parser.call(_8,_9); +var _c=_b.formatter.call(_8,_9); +_b.value=_9; +$(_8).textbox("setText",_c).textbox("setValue",_9); +_c=_b.formatter.call(_8,$(_8).textbox("getValue")); +$(_8).textbox("setText",_c); +}; +$.fn.numberbox=function(_d,_e){ +if(typeof _d=="string"){ +var _f=$.fn.numberbox.methods[_d]; +if(_f){ +return _f(this,_e); +}else{ +return this.textbox(_d,_e); +} +} +_d=_d||{}; +return this.each(function(){ +var _10=$.data(this,"numberbox"); +if(_10){ +$.extend(_10.options,_d); +}else{ +_10=$.data(this,"numberbox",{options:$.extend({},$.fn.numberbox.defaults,$.fn.numberbox.parseOptions(this),_d)}); +} +_1(this); +}); +}; +$.fn.numberbox.methods={options:function(jq){ +var _11=jq.data("textbox")?jq.textbox("options"):{}; +return $.extend($.data(jq[0],"numberbox").options,{width:_11.width,originalValue:_11.originalValue,disabled:_11.disabled,readonly:_11.readonly}); +},fix:function(jq){ +return jq.each(function(){ +var _12=$(this).numberbox("options"); +_12.value=null; +var _13=_12.parser.call(this,$(this).numberbox("getText")); +$(this).numberbox("setValue",_13); +}); +},setValue:function(jq,_14){ +return jq.each(function(){ +_7(this,_14); +}); +},clear:function(jq){ +return jq.each(function(){ +$(this).textbox("clear"); +$(this).numberbox("options").value=""; +}); +},reset:function(jq){ +return jq.each(function(){ +$(this).textbox("reset"); +$(this).numberbox("setValue",$(this).numberbox("getValue")); +}); +}}; +$.fn.numberbox.parseOptions=function(_15){ +var t=$(_15); +return $.extend({},$.fn.textbox.parseOptions(_15),$.parser.parseOptions(_15,["decimalSeparator","groupSeparator","suffix",{min:"number",max:"number",precision:"number"}]),{prefix:(t.attr("prefix")?t.attr("prefix"):undefined)}); +}; +$.fn.numberbox.defaults=$.extend({},$.fn.textbox.defaults,{inputEvents:{keypress:function(e){ +var _16=e.data.target; +var _17=$(_16).numberbox("options"); +return _17.filter.call(_16,e); +},blur:function(e){ +$(e.data.target).numberbox("fix"); +},keydown:function(e){ +if(e.keyCode==13){ +$(e.data.target).numberbox("fix"); +} +}},min:null,max:null,precision:0,decimalSeparator:".",groupSeparator:"",prefix:"",suffix:"",filter:function(e){ +var _18=$(this).numberbox("options"); +var s=$(this).numberbox("getText"); +if(e.metaKey||e.ctrlKey){ +return true; +} +if($.inArray(String(e.which),["46","8","13","0"])>=0){ +return true; +} +var tmp=$(""); +tmp.html(String.fromCharCode(e.which)); +var c=tmp.text(); +tmp.remove(); +if(!c){ +return true; +} +if(c=="-"||c==_18.decimalSeparator){ +return (s.indexOf(c)==-1)?true:false; +}else{ +if(c==_18.groupSeparator){ +return true; +}else{ +if("0123456789".indexOf(c)>=0){ +return true; +}else{ +return false; +} +} +} +},formatter:function(_19){ +if(!_19){ +return _19; +} +_19=_19+""; +var _1a=$(this).numberbox("options"); +var s1=_19,s2=""; +var _1b=_19.indexOf("."); +if(_1b>=0){ +s1=_19.substring(0,_1b); +s2=_19.substring(_1b+1,_19.length); +} +if(_1a.groupSeparator){ +var p=/(\d+)(\d{3})/; +while(p.test(s1)){ +s1=s1.replace(p,"$1"+_1a.groupSeparator+"$2"); +} +} +if(s2){ +return _1a.prefix+s1+_1a.decimalSeparator+s2+_1a.suffix; +}else{ +return _1a.prefix+s1+_1a.suffix; +} +},parser:function(s){ +s=s+""; +var _1c=$(this).numberbox("options"); +if(_1c.prefix){ +s=$.trim(s.replace(new RegExp("\\"+$.trim(_1c.prefix),"g"),"")); +} +if(_1c.suffix){ +s=$.trim(s.replace(new RegExp("\\"+$.trim(_1c.suffix),"g"),"")); +} +if(parseFloat(s)!=_1c.value){ +if(_1c.groupSeparator){ +s=$.trim(s.replace(new RegExp("\\"+_1c.groupSeparator,"g"),"")); +} +if(_1c.decimalSeparator){ +s=$.trim(s.replace(new RegExp("\\"+_1c.decimalSeparator,"g"),".")); +} +s=s.replace(/\s/g,""); +} +var val=parseFloat(s).toFixed(_1c.precision); +if(isNaN(val)){ +val=""; +}else{ +if(typeof (_1c.min)=="number"&&val<_1c.min){ +val=_1c.min.toFixed(_1c.precision); +}else{ +if(typeof (_1c.max)=="number"&&val>_1c.max){ +val=_1c.max.toFixed(_1c.precision); +} +} +} +return val; +}}); +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.numberspinner.js b/assets/js/easy-ui/plugins/jquery.numberspinner.js index 058be6921b..81571bbd7f 100755 --- a/assets/js/easy-ui/plugins/jquery.numberspinner.js +++ b/assets/js/easy-ui/plugins/jquery.numberspinner.js @@ -1,58 +1,58 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(_2){ -$(_2).addClass("numberspinner-f"); -var _3=$.data(_2,"numberspinner").options; -$(_2).numberbox($.extend({},_3,{doSize:false})).spinner(_3); -$(_2).numberbox("setValue",_3.value); -}; -function _4(_5,_6){ -var _7=$.data(_5,"numberspinner").options; -var v=parseFloat($(_5).numberbox("getValue")||_7.value)||0; -if(_6){ -v-=_7.increment; -}else{ -v+=_7.increment; -} -$(_5).numberbox("setValue",v); -}; -$.fn.numberspinner=function(_8,_9){ -if(typeof _8=="string"){ -var _a=$.fn.numberspinner.methods[_8]; -if(_a){ -return _a(this,_9); -}else{ -return this.numberbox(_8,_9); -} -} -_8=_8||{}; -return this.each(function(){ -var _b=$.data(this,"numberspinner"); -if(_b){ -$.extend(_b.options,_8); -}else{ -$.data(this,"numberspinner",{options:$.extend({},$.fn.numberspinner.defaults,$.fn.numberspinner.parseOptions(this),_8)}); -} -_1(this); -}); -}; -$.fn.numberspinner.methods={options:function(jq){ -var _c=jq.numberbox("options"); -return $.extend($.data(jq[0],"numberspinner").options,{width:_c.width,value:_c.value,originalValue:_c.originalValue,disabled:_c.disabled,readonly:_c.readonly}); -}}; -$.fn.numberspinner.parseOptions=function(_d){ -return $.extend({},$.fn.spinner.parseOptions(_d),$.fn.numberbox.parseOptions(_d),{}); -}; -$.fn.numberspinner.defaults=$.extend({},$.fn.spinner.defaults,$.fn.numberbox.defaults,{spin:function(_e){ -_4(this,_e); -}}); -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(_2){ +$(_2).addClass("numberspinner-f"); +var _3=$.data(_2,"numberspinner").options; +$(_2).numberbox($.extend({},_3,{doSize:false})).spinner(_3); +$(_2).numberbox("setValue",_3.value); +}; +function _4(_5,_6){ +var _7=$.data(_5,"numberspinner").options; +var v=parseFloat($(_5).numberbox("getValue")||_7.value)||0; +if(_6){ +v-=_7.increment; +}else{ +v+=_7.increment; +} +$(_5).numberbox("setValue",v); +}; +$.fn.numberspinner=function(_8,_9){ +if(typeof _8=="string"){ +var _a=$.fn.numberspinner.methods[_8]; +if(_a){ +return _a(this,_9); +}else{ +return this.numberbox(_8,_9); +} +} +_8=_8||{}; +return this.each(function(){ +var _b=$.data(this,"numberspinner"); +if(_b){ +$.extend(_b.options,_8); +}else{ +$.data(this,"numberspinner",{options:$.extend({},$.fn.numberspinner.defaults,$.fn.numberspinner.parseOptions(this),_8)}); +} +_1(this); +}); +}; +$.fn.numberspinner.methods={options:function(jq){ +var _c=jq.numberbox("options"); +return $.extend($.data(jq[0],"numberspinner").options,{width:_c.width,value:_c.value,originalValue:_c.originalValue,disabled:_c.disabled,readonly:_c.readonly}); +}}; +$.fn.numberspinner.parseOptions=function(_d){ +return $.extend({},$.fn.spinner.parseOptions(_d),$.fn.numberbox.parseOptions(_d),{}); +}; +$.fn.numberspinner.defaults=$.extend({},$.fn.spinner.defaults,$.fn.numberbox.defaults,{spin:function(_e){ +_4(this,_e); +}}); +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.pagination.js b/assets/js/easy-ui/plugins/jquery.pagination.js index 37d6074c3a..8bcc4f7559 100755 --- a/assets/js/easy-ui/plugins/jquery.pagination.js +++ b/assets/js/easy-ui/plugins/jquery.pagination.js @@ -1,296 +1,296 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(_2){ -var _3=$.data(_2,"pagination"); -var _4=_3.options; -var bb=_3.bb={}; -var _5=$(_2).addClass("pagination").html("
"); -var tr=_5.find("tr"); -var aa=$.extend([],_4.layout); -if(!_4.showPageList){ -_6(aa,"list"); -} -if(!_4.showPageInfo){ -_6(aa,"info"); -} -if(!_4.showRefresh){ -_6(aa,"refresh"); -} -if(aa[0]=="sep"){ -aa.shift(); -} -if(aa[aa.length-1]=="sep"){ -aa.pop(); -} -for(var _7=0;_7"); -ps.bind("change",function(){ -_4.pageSize=parseInt($(this).val()); -_4.onChangePageSize.call(_2,_4.pageSize); -_10(_2,_4.pageNumber); -}); -for(var i=0;i<_4.pageList.length;i++){ -$("").text(_4.pageList[i]).appendTo(ps); -} -$("").append(ps).appendTo(tr); -}else{ -if(_8=="sep"){ -$("
").appendTo(tr); -}else{ -if(_8=="first"){ -bb.first=_9("first"); -}else{ -if(_8=="prev"){ -bb.prev=_9("prev"); -}else{ -if(_8=="next"){ -bb.next=_9("next"); -}else{ -if(_8=="last"){ -bb.last=_9("last"); -}else{ -if(_8=="manual"){ -$("").html(_4.beforePageText).appendTo(tr).wrap(""); -bb.num=$("").appendTo(tr).wrap(""); -bb.num.unbind(".pagination").bind("keydown.pagination",function(e){ -if(e.keyCode==13){ -var _a=parseInt($(this).val())||1; -_10(_2,_a); -return false; -} -}); -bb.after=$("").appendTo(tr).wrap(""); -}else{ -if(_8=="refresh"){ -bb.refresh=_9("refresh"); -}else{ -if(_8=="links"){ -$("").appendTo(tr); -}else{ -if(_8=="info"){ -if(_7==aa.length-1){ -$("
").appendTo(_5); -$("
").appendTo(_5); -}else{ -$("
").appendTo(tr); -} -} -} -} -} -} -} -} -} -} -} -} -if(_4.buttons){ -$("
").appendTo(tr); -if($.isArray(_4.buttons)){ -for(var i=0;i<_4.buttons.length;i++){ -var _b=_4.buttons[i]; -if(_b=="-"){ -$("
").appendTo(tr); -}else{ -var td=$("").appendTo(tr); -var a=$("").appendTo(td); -a[0].onclick=eval(_b.handler||function(){ -}); -a.linkbutton($.extend({},_b,{plain:true})); -} -} -}else{ -var td=$("").appendTo(tr); -$(_4.buttons).appendTo(td).show(); -} -} -function _9(_c){ -var _d=_4.nav[_c]; -var a=$("").appendTo(tr); -a.wrap(""); -a.linkbutton({iconCls:_d.iconCls,plain:true}).unbind(".pagination").bind("click.pagination",function(){ -_d.handler.call(_2); -}); -return a; -}; -function _6(aa,_e){ -var _f=$.inArray(_e,aa); -if(_f>=0){ -aa.splice(_f,1); -} -return aa; -}; -}; -function _10(_11,_12){ -var _13=$.data(_11,"pagination").options; -_14(_11,{pageNumber:_12}); -_13.onSelectPage.call(_11,_13.pageNumber,_13.pageSize); -}; -function _14(_15,_16){ -var _17=$.data(_15,"pagination"); -var _18=_17.options; -var bb=_17.bb; -$.extend(_18,_16||{}); -var ps=$(_15).find("select.pagination-page-list"); -if(ps.length){ -ps.val(_18.pageSize+""); -_18.pageSize=parseInt(ps.val()); -} -var _19=Math.ceil(_18.total/_18.pageSize)||1; -if(_18.pageNumber<1){ -_18.pageNumber=1; -} -if(_18.pageNumber>_19){ -_18.pageNumber=_19; -} -if(_18.total==0){ -_18.pageNumber=0; -_19=0; -} -if(bb.num){ -bb.num.val(_18.pageNumber); -} -if(bb.after){ -bb.after.html(_18.afterPageText.replace(/{pages}/,_19)); -} -var td=$(_15).find("td.pagination-links"); -if(td.length){ -td.empty(); -var _1a=_18.pageNumber-Math.floor(_18.links/2); -if(_1a<1){ -_1a=1; -} -var _1b=_1a+_18.links-1; -if(_1b>_19){ -_1b=_19; -} -_1a=_1b-_18.links+1; -if(_1a<1){ -_1a=1; -} -for(var i=_1a;i<=_1b;i++){ -var a=$("").appendTo(td); -a.linkbutton({plain:true,text:i}); -if(i==_18.pageNumber){ -a.linkbutton("select"); -}else{ -a.unbind(".pagination").bind("click.pagination",{pageNumber:i},function(e){ -_10(_15,e.data.pageNumber); -}); -} -} -} -var _1c=_18.displayMsg; -_1c=_1c.replace(/{from}/,_18.total==0?0:_18.pageSize*(_18.pageNumber-1)+1); -_1c=_1c.replace(/{to}/,Math.min(_18.pageSize*(_18.pageNumber),_18.total)); -_1c=_1c.replace(/{total}/,_18.total); -$(_15).find("div.pagination-info").html(_1c); -if(bb.first){ -bb.first.linkbutton({disabled:((!_18.total)||_18.pageNumber==1)}); -} -if(bb.prev){ -bb.prev.linkbutton({disabled:((!_18.total)||_18.pageNumber==1)}); -} -if(bb.next){ -bb.next.linkbutton({disabled:(_18.pageNumber==_19)}); -} -if(bb.last){ -bb.last.linkbutton({disabled:(_18.pageNumber==_19)}); -} -_1d(_15,_18.loading); -}; -function _1d(_1e,_1f){ -var _20=$.data(_1e,"pagination"); -var _21=_20.options; -_21.loading=_1f; -if(_21.showRefresh&&_20.bb.refresh){ -_20.bb.refresh.linkbutton({iconCls:(_21.loading?"pagination-loading":"pagination-load")}); -} -}; -$.fn.pagination=function(_22,_23){ -if(typeof _22=="string"){ -return $.fn.pagination.methods[_22](this,_23); -} -_22=_22||{}; -return this.each(function(){ -var _24; -var _25=$.data(this,"pagination"); -if(_25){ -_24=$.extend(_25.options,_22); -}else{ -_24=$.extend({},$.fn.pagination.defaults,$.fn.pagination.parseOptions(this),_22); -$.data(this,"pagination",{options:_24}); -} -_1(this); -_14(this); -}); -}; -$.fn.pagination.methods={options:function(jq){ -return $.data(jq[0],"pagination").options; -},loading:function(jq){ -return jq.each(function(){ -_1d(this,true); -}); -},loaded:function(jq){ -return jq.each(function(){ -_1d(this,false); -}); -},refresh:function(jq,_26){ -return jq.each(function(){ -_14(this,_26); -}); -},select:function(jq,_27){ -return jq.each(function(){ -_10(this,_27); -}); -}}; -$.fn.pagination.parseOptions=function(_28){ -var t=$(_28); -return $.extend({},$.parser.parseOptions(_28,[{total:"number",pageSize:"number",pageNumber:"number",links:"number"},{loading:"boolean",showPageList:"boolean",showPageInfo:"boolean",showRefresh:"boolean"}]),{pageList:(t.attr("pageList")?eval(t.attr("pageList")):undefined)}); -}; -$.fn.pagination.defaults={total:1,pageSize:10,pageNumber:1,pageList:[10,20,30,50],loading:false,buttons:null,showPageList:true,showPageInfo:true,showRefresh:true,links:10,layout:["list","sep","first","prev","sep","manual","sep","next","last","sep","refresh","info"],onSelectPage:function(_29,_2a){ -},onBeforeRefresh:function(_2b,_2c){ -},onRefresh:function(_2d,_2e){ -},onChangePageSize:function(_2f){ -},beforePageText:"Page",afterPageText:"of {pages}",displayMsg:"Displaying {from} to {to} of {total} items",nav:{first:{iconCls:"pagination-first",handler:function(){ -var _30=$(this).pagination("options"); -if(_30.pageNumber>1){ -$(this).pagination("select",1); -} -}},prev:{iconCls:"pagination-prev",handler:function(){ -var _31=$(this).pagination("options"); -if(_31.pageNumber>1){ -$(this).pagination("select",_31.pageNumber-1); -} -}},next:{iconCls:"pagination-next",handler:function(){ -var _32=$(this).pagination("options"); -var _33=Math.ceil(_32.total/_32.pageSize); -if(_32.pageNumber<_33){ -$(this).pagination("select",_32.pageNumber+1); -} -}},last:{iconCls:"pagination-last",handler:function(){ -var _34=$(this).pagination("options"); -var _35=Math.ceil(_34.total/_34.pageSize); -if(_34.pageNumber<_35){ -$(this).pagination("select",_35); -} -}},refresh:{iconCls:"pagination-refresh",handler:function(){ -var _36=$(this).pagination("options"); -if(_36.onBeforeRefresh.call(this,_36.pageNumber,_36.pageSize)!=false){ -$(this).pagination("select",_36.pageNumber); -_36.onRefresh.call(this,_36.pageNumber,_36.pageSize); -} -}}}}; -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(_2){ +var _3=$.data(_2,"pagination"); +var _4=_3.options; +var bb=_3.bb={}; +var _5=$(_2).addClass("pagination").html("
"); +var tr=_5.find("tr"); +var aa=$.extend([],_4.layout); +if(!_4.showPageList){ +_6(aa,"list"); +} +if(!_4.showPageInfo){ +_6(aa,"info"); +} +if(!_4.showRefresh){ +_6(aa,"refresh"); +} +if(aa[0]=="sep"){ +aa.shift(); +} +if(aa[aa.length-1]=="sep"){ +aa.pop(); +} +for(var _7=0;_7"); +ps.bind("change",function(){ +_4.pageSize=parseInt($(this).val()); +_4.onChangePageSize.call(_2,_4.pageSize); +_10(_2,_4.pageNumber); +}); +for(var i=0;i<_4.pageList.length;i++){ +$("").text(_4.pageList[i]).appendTo(ps); +} +$("").append(ps).appendTo(tr); +}else{ +if(_8=="sep"){ +$("
").appendTo(tr); +}else{ +if(_8=="first"){ +bb.first=_9("first"); +}else{ +if(_8=="prev"){ +bb.prev=_9("prev"); +}else{ +if(_8=="next"){ +bb.next=_9("next"); +}else{ +if(_8=="last"){ +bb.last=_9("last"); +}else{ +if(_8=="manual"){ +$("").html(_4.beforePageText).appendTo(tr).wrap(""); +bb.num=$("").appendTo(tr).wrap(""); +bb.num.unbind(".pagination").bind("keydown.pagination",function(e){ +if(e.keyCode==13){ +var _a=parseInt($(this).val())||1; +_10(_2,_a); +return false; +} +}); +bb.after=$("").appendTo(tr).wrap(""); +}else{ +if(_8=="refresh"){ +bb.refresh=_9("refresh"); +}else{ +if(_8=="links"){ +$("").appendTo(tr); +}else{ +if(_8=="info"){ +if(_7==aa.length-1){ +$("
").appendTo(_5); +$("
").appendTo(_5); +}else{ +$("
").appendTo(tr); +} +} +} +} +} +} +} +} +} +} +} +} +if(_4.buttons){ +$("
").appendTo(tr); +if($.isArray(_4.buttons)){ +for(var i=0;i<_4.buttons.length;i++){ +var _b=_4.buttons[i]; +if(_b=="-"){ +$("
").appendTo(tr); +}else{ +var td=$("").appendTo(tr); +var a=$("").appendTo(td); +a[0].onclick=eval(_b.handler||function(){ +}); +a.linkbutton($.extend({},_b,{plain:true})); +} +} +}else{ +var td=$("").appendTo(tr); +$(_4.buttons).appendTo(td).show(); +} +} +function _9(_c){ +var _d=_4.nav[_c]; +var a=$("").appendTo(tr); +a.wrap(""); +a.linkbutton({iconCls:_d.iconCls,plain:true}).unbind(".pagination").bind("click.pagination",function(){ +_d.handler.call(_2); +}); +return a; +}; +function _6(aa,_e){ +var _f=$.inArray(_e,aa); +if(_f>=0){ +aa.splice(_f,1); +} +return aa; +}; +}; +function _10(_11,_12){ +var _13=$.data(_11,"pagination").options; +_14(_11,{pageNumber:_12}); +_13.onSelectPage.call(_11,_13.pageNumber,_13.pageSize); +}; +function _14(_15,_16){ +var _17=$.data(_15,"pagination"); +var _18=_17.options; +var bb=_17.bb; +$.extend(_18,_16||{}); +var ps=$(_15).find("select.pagination-page-list"); +if(ps.length){ +ps.val(_18.pageSize+""); +_18.pageSize=parseInt(ps.val()); +} +var _19=Math.ceil(_18.total/_18.pageSize)||1; +if(_18.pageNumber<1){ +_18.pageNumber=1; +} +if(_18.pageNumber>_19){ +_18.pageNumber=_19; +} +if(_18.total==0){ +_18.pageNumber=0; +_19=0; +} +if(bb.num){ +bb.num.val(_18.pageNumber); +} +if(bb.after){ +bb.after.html(_18.afterPageText.replace(/{pages}/,_19)); +} +var td=$(_15).find("td.pagination-links"); +if(td.length){ +td.empty(); +var _1a=_18.pageNumber-Math.floor(_18.links/2); +if(_1a<1){ +_1a=1; +} +var _1b=_1a+_18.links-1; +if(_1b>_19){ +_1b=_19; +} +_1a=_1b-_18.links+1; +if(_1a<1){ +_1a=1; +} +for(var i=_1a;i<=_1b;i++){ +var a=$("").appendTo(td); +a.linkbutton({plain:true,text:i}); +if(i==_18.pageNumber){ +a.linkbutton("select"); +}else{ +a.unbind(".pagination").bind("click.pagination",{pageNumber:i},function(e){ +_10(_15,e.data.pageNumber); +}); +} +} +} +var _1c=_18.displayMsg; +_1c=_1c.replace(/{from}/,_18.total==0?0:_18.pageSize*(_18.pageNumber-1)+1); +_1c=_1c.replace(/{to}/,Math.min(_18.pageSize*(_18.pageNumber),_18.total)); +_1c=_1c.replace(/{total}/,_18.total); +$(_15).find("div.pagination-info").html(_1c); +if(bb.first){ +bb.first.linkbutton({disabled:((!_18.total)||_18.pageNumber==1)}); +} +if(bb.prev){ +bb.prev.linkbutton({disabled:((!_18.total)||_18.pageNumber==1)}); +} +if(bb.next){ +bb.next.linkbutton({disabled:(_18.pageNumber==_19)}); +} +if(bb.last){ +bb.last.linkbutton({disabled:(_18.pageNumber==_19)}); +} +_1d(_15,_18.loading); +}; +function _1d(_1e,_1f){ +var _20=$.data(_1e,"pagination"); +var _21=_20.options; +_21.loading=_1f; +if(_21.showRefresh&&_20.bb.refresh){ +_20.bb.refresh.linkbutton({iconCls:(_21.loading?"pagination-loading":"pagination-load")}); +} +}; +$.fn.pagination=function(_22,_23){ +if(typeof _22=="string"){ +return $.fn.pagination.methods[_22](this,_23); +} +_22=_22||{}; +return this.each(function(){ +var _24; +var _25=$.data(this,"pagination"); +if(_25){ +_24=$.extend(_25.options,_22); +}else{ +_24=$.extend({},$.fn.pagination.defaults,$.fn.pagination.parseOptions(this),_22); +$.data(this,"pagination",{options:_24}); +} +_1(this); +_14(this); +}); +}; +$.fn.pagination.methods={options:function(jq){ +return $.data(jq[0],"pagination").options; +},loading:function(jq){ +return jq.each(function(){ +_1d(this,true); +}); +},loaded:function(jq){ +return jq.each(function(){ +_1d(this,false); +}); +},refresh:function(jq,_26){ +return jq.each(function(){ +_14(this,_26); +}); +},select:function(jq,_27){ +return jq.each(function(){ +_10(this,_27); +}); +}}; +$.fn.pagination.parseOptions=function(_28){ +var t=$(_28); +return $.extend({},$.parser.parseOptions(_28,[{total:"number",pageSize:"number",pageNumber:"number",links:"number"},{loading:"boolean",showPageList:"boolean",showPageInfo:"boolean",showRefresh:"boolean"}]),{pageList:(t.attr("pageList")?eval(t.attr("pageList")):undefined)}); +}; +$.fn.pagination.defaults={total:1,pageSize:10,pageNumber:1,pageList:[10,20,30,50],loading:false,buttons:null,showPageList:true,showPageInfo:true,showRefresh:true,links:10,layout:["list","sep","first","prev","sep","manual","sep","next","last","sep","refresh","info"],onSelectPage:function(_29,_2a){ +},onBeforeRefresh:function(_2b,_2c){ +},onRefresh:function(_2d,_2e){ +},onChangePageSize:function(_2f){ +},beforePageText:"Page",afterPageText:"of {pages}",displayMsg:"Displaying {from} to {to} of {total} items",nav:{first:{iconCls:"pagination-first",handler:function(){ +var _30=$(this).pagination("options"); +if(_30.pageNumber>1){ +$(this).pagination("select",1); +} +}},prev:{iconCls:"pagination-prev",handler:function(){ +var _31=$(this).pagination("options"); +if(_31.pageNumber>1){ +$(this).pagination("select",_31.pageNumber-1); +} +}},next:{iconCls:"pagination-next",handler:function(){ +var _32=$(this).pagination("options"); +var _33=Math.ceil(_32.total/_32.pageSize); +if(_32.pageNumber<_33){ +$(this).pagination("select",_32.pageNumber+1); +} +}},last:{iconCls:"pagination-last",handler:function(){ +var _34=$(this).pagination("options"); +var _35=Math.ceil(_34.total/_34.pageSize); +if(_34.pageNumber<_35){ +$(this).pagination("select",_35); +} +}},refresh:{iconCls:"pagination-refresh",handler:function(){ +var _36=$(this).pagination("options"); +if(_36.onBeforeRefresh.call(this,_36.pageNumber,_36.pageSize)!=false){ +$(this).pagination("select",_36.pageNumber); +_36.onRefresh.call(this,_36.pageNumber,_36.pageSize); +} +}}}}; +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.panel.js b/assets/js/easy-ui/plugins/jquery.panel.js index daa4a9511e..da15ff452d 100755 --- a/assets/js/easy-ui/plugins/jquery.panel.js +++ b/assets/js/easy-ui/plugins/jquery.panel.js @@ -1,674 +1,674 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -$.fn._remove=function(){ -return this.each(function(){ -$(this).remove(); -try{ -this.outerHTML=""; -} -catch(err){ -} -}); -}; -function _1(_2){ -_2._remove(); -}; -function _3(_4,_5){ -var _6=$.data(_4,"panel"); -var _7=_6.options; -var _8=_6.panel; -var _9=_8.children(".panel-header"); -var _a=_8.children(".panel-body"); -var _b=_8.children(".panel-footer"); -var _c=(_7.halign=="left"||_7.halign=="right"); -if(_5){ -$.extend(_7,{width:_5.width,height:_5.height,minWidth:_5.minWidth,maxWidth:_5.maxWidth,minHeight:_5.minHeight,maxHeight:_5.maxHeight,left:_5.left,top:_5.top}); -} -_8._size(_7); -if(!_c){ -_9._outerWidth(_8.width()); -} -_a._outerWidth(_8.width()); -if(!isNaN(parseInt(_7.height))){ -if(_c){ -if(_7.header){ -var _d=$(_7.header)._outerWidth(); -}else{ -_9.css("width",""); -var _d=_9._outerWidth(); -} -var _e=_9.find(".panel-title"); -_d+=Math.min(_e._outerWidth(),_e._outerHeight()); -var _f=_8.height(); -_9._outerWidth(_d)._outerHeight(_f); -_e._outerWidth(_9.height()); -_a._outerWidth(_8.width()-_d-_b._outerWidth())._outerHeight(_f); -_b._outerHeight(_f); -_a.css({left:"",right:""}).css(_7.halign,(_9.position()[_7.halign]+_d)+"px"); -_7.panelCssWidth=_8.css("width"); -if(_7.collapsed){ -_8._outerWidth(_d+_b._outerWidth()); -} -}else{ -_a._outerHeight(_8.height()-_9._outerHeight()-_b._outerHeight()); -} -}else{ -_a.css("height",""); -var min=$.parser.parseValue("minHeight",_7.minHeight,_8.parent()); -var max=$.parser.parseValue("maxHeight",_7.maxHeight,_8.parent()); -var _10=_9._outerHeight()+_b._outerHeight()+_8._outerHeight()-_8.height(); -_a._size("minHeight",min?(min-_10):""); -_a._size("maxHeight",max?(max-_10):""); -} -_8.css({height:(_c?undefined:""),minHeight:"",maxHeight:"",left:_7.left,top:_7.top}); -_7.onResize.apply(_4,[_7.width,_7.height]); -$(_4).panel("doLayout"); -}; -function _11(_12,_13){ -var _14=$.data(_12,"panel"); -var _15=_14.options; -var _16=_14.panel; -if(_13){ -if(_13.left!=null){ -_15.left=_13.left; -} -if(_13.top!=null){ -_15.top=_13.top; -} -} -_16.css({left:_15.left,top:_15.top}); -_16.find(".tooltip-f").each(function(){ -$(this).tooltip("reposition"); -}); -_15.onMove.apply(_12,[_15.left,_15.top]); -}; -function _17(_18){ -$(_18).addClass("panel-body")._size("clear"); -var _19=$("
").insertBefore(_18); -_19[0].appendChild(_18); -_19.bind("_resize",function(e,_1a){ -if($(this).hasClass("easyui-fluid")||_1a){ -_3(_18); -} -return false; -}); -return _19; -}; -function _1b(_1c){ -var _1d=$.data(_1c,"panel"); -var _1e=_1d.options; -var _1f=_1d.panel; -_1f.css(_1e.style); -_1f.addClass(_1e.cls); -_1f.removeClass("panel-hleft panel-hright").addClass("panel-h"+_1e.halign); -_20(); -_21(); -var _22=$(_1c).panel("header"); -var _23=$(_1c).panel("body"); -var _24=$(_1c).siblings(".panel-footer"); -if(_1e.border){ -_22.removeClass("panel-header-noborder"); -_23.removeClass("panel-body-noborder"); -_24.removeClass("panel-footer-noborder"); -}else{ -_22.addClass("panel-header-noborder"); -_23.addClass("panel-body-noborder"); -_24.addClass("panel-footer-noborder"); -} -_22.addClass(_1e.headerCls); -_23.addClass(_1e.bodyCls); -$(_1c).attr("id",_1e.id||""); -if(_1e.content){ -$(_1c).panel("clear"); -$(_1c).html(_1e.content); -$.parser.parse($(_1c)); -} -function _20(){ -if(_1e.noheader||(!_1e.title&&!_1e.header)){ -_1(_1f.children(".panel-header")); -_1f.children(".panel-body").addClass("panel-body-noheader"); -}else{ -if(_1e.header){ -$(_1e.header).addClass("panel-header").prependTo(_1f); -}else{ -var _25=_1f.children(".panel-header"); -if(!_25.length){ -_25=$("
").prependTo(_1f); -} -if(!$.isArray(_1e.tools)){ -_25.find("div.panel-tool .panel-tool-a").appendTo(_1e.tools); -} -_25.empty(); -var _26=$("
").html(_1e.title).appendTo(_25); -if(_1e.iconCls){ -_26.addClass("panel-with-icon"); -$("
").addClass(_1e.iconCls).appendTo(_25); -} -if(_1e.halign=="left"||_1e.halign=="right"){ -_26.addClass("panel-title-"+_1e.titleDirection); -} -var _27=$("
").appendTo(_25); -_27.bind("click",function(e){ -e.stopPropagation(); -}); -if(_1e.tools){ -if($.isArray(_1e.tools)){ -$.map(_1e.tools,function(t){ -_28(_27,t.iconCls,eval(t.handler)); -}); -}else{ -$(_1e.tools).children().each(function(){ -$(this).addClass($(this).attr("iconCls")).addClass("panel-tool-a").appendTo(_27); -}); -} -} -if(_1e.collapsible){ -_28(_27,"panel-tool-collapse",function(){ -if(_1e.collapsed==true){ -_52(_1c,true); -}else{ -_3e(_1c,true); -} -}); -} -if(_1e.minimizable){ -_28(_27,"panel-tool-min",function(){ -_5d(_1c); -}); -} -if(_1e.maximizable){ -_28(_27,"panel-tool-max",function(){ -if(_1e.maximized==true){ -_61(_1c); -}else{ -_3d(_1c); -} -}); -} -if(_1e.closable){ -_28(_27,"panel-tool-close",function(){ -_3f(_1c); -}); -} -} -_1f.children("div.panel-body").removeClass("panel-body-noheader"); -} -}; -function _28(c,_29,_2a){ -var a=$("").addClass(_29).appendTo(c); -a.bind("click",_2a); -}; -function _21(){ -if(_1e.footer){ -$(_1e.footer).addClass("panel-footer").appendTo(_1f); -$(_1c).addClass("panel-body-nobottom"); -}else{ -_1f.children(".panel-footer").remove(); -$(_1c).removeClass("panel-body-nobottom"); -} -}; -}; -function _2b(_2c,_2d){ -var _2e=$.data(_2c,"panel"); -var _2f=_2e.options; -if(_30){ -_2f.queryParams=_2d; -} -if(!_2f.href){ -return; -} -if(!_2e.isLoaded||!_2f.cache){ -var _30=$.extend({},_2f.queryParams); -if(_2f.onBeforeLoad.call(_2c,_30)==false){ -return; -} -_2e.isLoaded=false; -if(_2f.loadingMessage){ -$(_2c).panel("clear"); -$(_2c).html($("
").html(_2f.loadingMessage)); -} -_2f.loader.call(_2c,_30,function(_31){ -var _32=_2f.extractor.call(_2c,_31); -$(_2c).panel("clear"); -$(_2c).html(_32); -$.parser.parse($(_2c)); -_2f.onLoad.apply(_2c,arguments); -_2e.isLoaded=true; -},function(){ -_2f.onLoadError.apply(_2c,arguments); -}); -} -}; -function _33(_34){ -var t=$(_34); -t.find(".combo-f").each(function(){ -$(this).combo("destroy"); -}); -t.find(".m-btn").each(function(){ -$(this).menubutton("destroy"); -}); -t.find(".s-btn").each(function(){ -$(this).splitbutton("destroy"); -}); -t.find(".tooltip-f").each(function(){ -$(this).tooltip("destroy"); -}); -t.children("div").each(function(){ -$(this)._size("unfit"); -}); -t.empty(); -}; -function _35(_36){ -$(_36).panel("doLayout",true); -}; -function _37(_38,_39){ -var _3a=$.data(_38,"panel").options; -var _3b=$.data(_38,"panel").panel; -if(_39!=true){ -if(_3a.onBeforeOpen.call(_38)==false){ -return; -} -} -_3b.stop(true,true); -if($.isFunction(_3a.openAnimation)){ -_3a.openAnimation.call(_38,cb); -}else{ -switch(_3a.openAnimation){ -case "slide": -_3b.slideDown(_3a.openDuration,cb); -break; -case "fade": -_3b.fadeIn(_3a.openDuration,cb); -break; -case "show": -_3b.show(_3a.openDuration,cb); -break; -default: -_3b.show(); -cb(); -} -} -function cb(){ -_3a.closed=false; -_3a.minimized=false; -var _3c=_3b.children(".panel-header").find("a.panel-tool-restore"); -if(_3c.length){ -_3a.maximized=true; -} -_3a.onOpen.call(_38); -if(_3a.maximized==true){ -_3a.maximized=false; -_3d(_38); -} -if(_3a.collapsed==true){ -_3a.collapsed=false; -_3e(_38); -} -if(!_3a.collapsed){ -_2b(_38); -_35(_38); -} -}; -}; -function _3f(_40,_41){ -var _42=$.data(_40,"panel"); -var _43=_42.options; -var _44=_42.panel; -if(_41!=true){ -if(_43.onBeforeClose.call(_40)==false){ -return; -} -} -_44.find(".tooltip-f").each(function(){ -$(this).tooltip("hide"); -}); -_44.stop(true,true); -_44._size("unfit"); -if($.isFunction(_43.closeAnimation)){ -_43.closeAnimation.call(_40,cb); -}else{ -switch(_43.closeAnimation){ -case "slide": -_44.slideUp(_43.closeDuration,cb); -break; -case "fade": -_44.fadeOut(_43.closeDuration,cb); -break; -case "hide": -_44.hide(_43.closeDuration,cb); -break; -default: -_44.hide(); -cb(); -} -} -function cb(){ -_43.closed=true; -_43.onClose.call(_40); -}; -}; -function _45(_46,_47){ -var _48=$.data(_46,"panel"); -var _49=_48.options; -var _4a=_48.panel; -if(_47!=true){ -if(_49.onBeforeDestroy.call(_46)==false){ -return; -} -} -$(_46).panel("clear").panel("clear","footer"); -_1(_4a); -_49.onDestroy.call(_46); -}; -function _3e(_4b,_4c){ -var _4d=$.data(_4b,"panel").options; -var _4e=$.data(_4b,"panel").panel; -var _4f=_4e.children(".panel-body"); -var _50=_4e.children(".panel-header"); -var _51=_50.find("a.panel-tool-collapse"); -if(_4d.collapsed==true){ -return; -} -_4f.stop(true,true); -if(_4d.onBeforeCollapse.call(_4b)==false){ -return; -} -_51.addClass("panel-tool-expand"); -if(_4c==true){ -if(_4d.halign=="left"||_4d.halign=="right"){ -_4e.animate({width:_50._outerWidth()+_4e.children(".panel-footer")._outerWidth()},function(){ -cb(); -}); -}else{ -_4f.slideUp("normal",function(){ -cb(); -}); -} -}else{ -if(_4d.halign=="left"||_4d.halign=="right"){ -_4e._outerWidth(_50._outerWidth()+_4e.children(".panel-footer")._outerWidth()); -} -cb(); -} -function cb(){ -_4f.hide(); -_4d.collapsed=true; -_4d.onCollapse.call(_4b); -}; -}; -function _52(_53,_54){ -var _55=$.data(_53,"panel").options; -var _56=$.data(_53,"panel").panel; -var _57=_56.children(".panel-body"); -var _58=_56.children(".panel-header").find("a.panel-tool-collapse"); -if(_55.collapsed==false){ -return; -} -_57.stop(true,true); -if(_55.onBeforeExpand.call(_53)==false){ -return; -} -_58.removeClass("panel-tool-expand"); -if(_54==true){ -if(_55.halign=="left"||_55.halign=="right"){ -_57.show(); -_56.animate({width:_55.panelCssWidth},function(){ -cb(); -}); -}else{ -_57.slideDown("normal",function(){ -cb(); -}); -} -}else{ -if(_55.halign=="left"||_55.halign=="right"){ -_56.css("width",_55.panelCssWidth); -} -cb(); -} -function cb(){ -_57.show(); -_55.collapsed=false; -_55.onExpand.call(_53); -_2b(_53); -_35(_53); -}; -}; -function _3d(_59){ -var _5a=$.data(_59,"panel").options; -var _5b=$.data(_59,"panel").panel; -var _5c=_5b.children(".panel-header").find("a.panel-tool-max"); -if(_5a.maximized==true){ -return; -} -_5c.addClass("panel-tool-restore"); -if(!$.data(_59,"panel").original){ -$.data(_59,"panel").original={width:_5a.width,height:_5a.height,left:_5a.left,top:_5a.top,fit:_5a.fit}; -} -_5a.left=0; -_5a.top=0; -_5a.fit=true; -_3(_59); -_5a.minimized=false; -_5a.maximized=true; -_5a.onMaximize.call(_59); -}; -function _5d(_5e){ -var _5f=$.data(_5e,"panel").options; -var _60=$.data(_5e,"panel").panel; -_60._size("unfit"); -_60.hide(); -_5f.minimized=true; -_5f.maximized=false; -_5f.onMinimize.call(_5e); -}; -function _61(_62){ -var _63=$.data(_62,"panel").options; -var _64=$.data(_62,"panel").panel; -var _65=_64.children(".panel-header").find("a.panel-tool-max"); -if(_63.maximized==false){ -return; -} -_64.show(); -_65.removeClass("panel-tool-restore"); -$.extend(_63,$.data(_62,"panel").original); -_3(_62); -_63.minimized=false; -_63.maximized=false; -$.data(_62,"panel").original=null; -_63.onRestore.call(_62); -}; -function _66(_67,_68){ -$.data(_67,"panel").options.title=_68; -$(_67).panel("header").find("div.panel-title").html(_68); -}; -var _69=null; -$(window).unbind(".panel").bind("resize.panel",function(){ -if(_69){ -clearTimeout(_69); -} -_69=setTimeout(function(){ -var _6a=$("body.layout"); -if(_6a.length){ -_6a.layout("resize"); -$("body").children(".easyui-fluid:visible").each(function(){ -$(this).triggerHandler("_resize"); -}); -}else{ -$("body").panel("doLayout"); -} -_69=null; -},100); -}); -$.fn.panel=function(_6b,_6c){ -if(typeof _6b=="string"){ -return $.fn.panel.methods[_6b](this,_6c); -} -_6b=_6b||{}; -return this.each(function(){ -var _6d=$.data(this,"panel"); -var _6e; -if(_6d){ -_6e=$.extend(_6d.options,_6b); -_6d.isLoaded=false; -}else{ -_6e=$.extend({},$.fn.panel.defaults,$.fn.panel.parseOptions(this),_6b); -$(this).attr("title",""); -_6d=$.data(this,"panel",{options:_6e,panel:_17(this),isLoaded:false}); -} -_1b(this); -$(this).show(); -if(_6e.doSize==true){ -_6d.panel.css("display","block"); -_3(this); -} -if(_6e.closed==true||_6e.minimized==true){ -_6d.panel.hide(); -}else{ -_37(this); -} -}); -}; -$.fn.panel.methods={options:function(jq){ -return $.data(jq[0],"panel").options; -},panel:function(jq){ -return $.data(jq[0],"panel").panel; -},header:function(jq){ -return $.data(jq[0],"panel").panel.children(".panel-header"); -},footer:function(jq){ -return jq.panel("panel").children(".panel-footer"); -},body:function(jq){ -return $.data(jq[0],"panel").panel.children(".panel-body"); -},setTitle:function(jq,_6f){ -return jq.each(function(){ -_66(this,_6f); -}); -},open:function(jq,_70){ -return jq.each(function(){ -_37(this,_70); -}); -},close:function(jq,_71){ -return jq.each(function(){ -_3f(this,_71); -}); -},destroy:function(jq,_72){ -return jq.each(function(){ -_45(this,_72); -}); -},clear:function(jq,_73){ -return jq.each(function(){ -_33(_73=="footer"?$(this).panel("footer"):this); -}); -},refresh:function(jq,_74){ -return jq.each(function(){ -var _75=$.data(this,"panel"); -_75.isLoaded=false; -if(_74){ -if(typeof _74=="string"){ -_75.options.href=_74; -}else{ -_75.options.queryParams=_74; -} -} -_2b(this); -}); -},resize:function(jq,_76){ -return jq.each(function(){ -_3(this,_76); -}); -},doLayout:function(jq,all){ -return jq.each(function(){ -_77(this,"body"); -_77($(this).siblings(".panel-footer")[0],"footer"); -function _77(_78,_79){ -if(!_78){ -return; -} -var _7a=_78==$("body")[0]; -var s=$(_78).find("div.panel:visible,div.accordion:visible,div.tabs-container:visible,div.layout:visible,.easyui-fluid:visible").filter(function(_7b,el){ -var p=$(el).parents(".panel-"+_79+":first"); -return _7a?p.length==0:p[0]==_78; -}); -s.each(function(){ -$(this).triggerHandler("_resize",[all||false]); -}); -}; -}); -},move:function(jq,_7c){ -return jq.each(function(){ -_11(this,_7c); -}); -},maximize:function(jq){ -return jq.each(function(){ -_3d(this); -}); -},minimize:function(jq){ -return jq.each(function(){ -_5d(this); -}); -},restore:function(jq){ -return jq.each(function(){ -_61(this); -}); -},collapse:function(jq,_7d){ -return jq.each(function(){ -_3e(this,_7d); -}); -},expand:function(jq,_7e){ -return jq.each(function(){ -_52(this,_7e); -}); -}}; -$.fn.panel.parseOptions=function(_7f){ -var t=$(_7f); -var hh=t.children(".panel-header,header"); -var ff=t.children(".panel-footer,footer"); -return $.extend({},$.parser.parseOptions(_7f,["id","width","height","left","top","title","iconCls","cls","headerCls","bodyCls","tools","href","method","header","footer","halign","titleDirection",{cache:"boolean",fit:"boolean",border:"boolean",noheader:"boolean"},{collapsible:"boolean",minimizable:"boolean",maximizable:"boolean"},{closable:"boolean",collapsed:"boolean",minimized:"boolean",maximized:"boolean",closed:"boolean"},"openAnimation","closeAnimation",{openDuration:"number",closeDuration:"number"},]),{loadingMessage:(t.attr("loadingMessage")!=undefined?t.attr("loadingMessage"):undefined),header:(hh.length?hh.removeClass("panel-header"):undefined),footer:(ff.length?ff.removeClass("panel-footer"):undefined)}); -}; -$.fn.panel.defaults={id:null,title:null,iconCls:null,width:"auto",height:"auto",left:null,top:null,cls:null,headerCls:null,bodyCls:null,style:{},href:null,cache:true,fit:false,border:true,doSize:true,noheader:false,content:null,halign:"top",titleDirection:"down",collapsible:false,minimizable:false,maximizable:false,closable:false,collapsed:false,minimized:false,maximized:false,closed:false,openAnimation:false,openDuration:400,closeAnimation:false,closeDuration:400,tools:null,footer:null,header:null,queryParams:{},method:"get",href:null,loadingMessage:"Loading...",loader:function(_80,_81,_82){ -var _83=$(this).panel("options"); -if(!_83.href){ -return false; -} -$.ajax({type:_83.method,url:_83.href,cache:false,data:_80,dataType:"html",success:function(_84){ -_81(_84); -},error:function(){ -_82.apply(this,arguments); -}}); -},extractor:function(_85){ -var _86=/]*>((.|[\n\r])*)<\/body>/im; -var _87=_86.exec(_85); -if(_87){ -return _87[1]; -}else{ -return _85; -} -},onBeforeLoad:function(_88){ -},onLoad:function(){ -},onLoadError:function(){ -},onBeforeOpen:function(){ -},onOpen:function(){ -},onBeforeClose:function(){ -},onClose:function(){ -},onBeforeDestroy:function(){ -},onDestroy:function(){ -},onResize:function(_89,_8a){ -},onMove:function(_8b,top){ -},onMaximize:function(){ -},onRestore:function(){ -},onMinimize:function(){ -},onBeforeCollapse:function(){ -},onBeforeExpand:function(){ -},onCollapse:function(){ -},onExpand:function(){ -}}; -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +$.fn._remove=function(){ +return this.each(function(){ +$(this).remove(); +try{ +this.outerHTML=""; +} +catch(err){ +} +}); +}; +function _1(_2){ +_2._remove(); +}; +function _3(_4,_5){ +var _6=$.data(_4,"panel"); +var _7=_6.options; +var _8=_6.panel; +var _9=_8.children(".panel-header"); +var _a=_8.children(".panel-body"); +var _b=_8.children(".panel-footer"); +var _c=(_7.halign=="left"||_7.halign=="right"); +if(_5){ +$.extend(_7,{width:_5.width,height:_5.height,minWidth:_5.minWidth,maxWidth:_5.maxWidth,minHeight:_5.minHeight,maxHeight:_5.maxHeight,left:_5.left,top:_5.top}); +} +_8._size(_7); +if(!_c){ +_9._outerWidth(_8.width()); +} +_a._outerWidth(_8.width()); +if(!isNaN(parseInt(_7.height))){ +if(_c){ +if(_7.header){ +var _d=$(_7.header)._outerWidth(); +}else{ +_9.css("width",""); +var _d=_9._outerWidth(); +} +var _e=_9.find(".panel-title"); +_d+=Math.min(_e._outerWidth(),_e._outerHeight()); +var _f=_8.height(); +_9._outerWidth(_d)._outerHeight(_f); +_e._outerWidth(_9.height()); +_a._outerWidth(_8.width()-_d-_b._outerWidth())._outerHeight(_f); +_b._outerHeight(_f); +_a.css({left:"",right:""}).css(_7.halign,(_9.position()[_7.halign]+_d)+"px"); +_7.panelCssWidth=_8.css("width"); +if(_7.collapsed){ +_8._outerWidth(_d+_b._outerWidth()); +} +}else{ +_a._outerHeight(_8.height()-_9._outerHeight()-_b._outerHeight()); +} +}else{ +_a.css("height",""); +var min=$.parser.parseValue("minHeight",_7.minHeight,_8.parent()); +var max=$.parser.parseValue("maxHeight",_7.maxHeight,_8.parent()); +var _10=_9._outerHeight()+_b._outerHeight()+_8._outerHeight()-_8.height(); +_a._size("minHeight",min?(min-_10):""); +_a._size("maxHeight",max?(max-_10):""); +} +_8.css({height:(_c?undefined:""),minHeight:"",maxHeight:"",left:_7.left,top:_7.top}); +_7.onResize.apply(_4,[_7.width,_7.height]); +$(_4).panel("doLayout"); +}; +function _11(_12,_13){ +var _14=$.data(_12,"panel"); +var _15=_14.options; +var _16=_14.panel; +if(_13){ +if(_13.left!=null){ +_15.left=_13.left; +} +if(_13.top!=null){ +_15.top=_13.top; +} +} +_16.css({left:_15.left,top:_15.top}); +_16.find(".tooltip-f").each(function(){ +$(this).tooltip("reposition"); +}); +_15.onMove.apply(_12,[_15.left,_15.top]); +}; +function _17(_18){ +$(_18).addClass("panel-body")._size("clear"); +var _19=$("
").insertBefore(_18); +_19[0].appendChild(_18); +_19.bind("_resize",function(e,_1a){ +if($(this).hasClass("easyui-fluid")||_1a){ +_3(_18); +} +return false; +}); +return _19; +}; +function _1b(_1c){ +var _1d=$.data(_1c,"panel"); +var _1e=_1d.options; +var _1f=_1d.panel; +_1f.css(_1e.style); +_1f.addClass(_1e.cls); +_1f.removeClass("panel-hleft panel-hright").addClass("panel-h"+_1e.halign); +_20(); +_21(); +var _22=$(_1c).panel("header"); +var _23=$(_1c).panel("body"); +var _24=$(_1c).siblings(".panel-footer"); +if(_1e.border){ +_22.removeClass("panel-header-noborder"); +_23.removeClass("panel-body-noborder"); +_24.removeClass("panel-footer-noborder"); +}else{ +_22.addClass("panel-header-noborder"); +_23.addClass("panel-body-noborder"); +_24.addClass("panel-footer-noborder"); +} +_22.addClass(_1e.headerCls); +_23.addClass(_1e.bodyCls); +$(_1c).attr("id",_1e.id||""); +if(_1e.content){ +$(_1c).panel("clear"); +$(_1c).html(_1e.content); +$.parser.parse($(_1c)); +} +function _20(){ +if(_1e.noheader||(!_1e.title&&!_1e.header)){ +_1(_1f.children(".panel-header")); +_1f.children(".panel-body").addClass("panel-body-noheader"); +}else{ +if(_1e.header){ +$(_1e.header).addClass("panel-header").prependTo(_1f); +}else{ +var _25=_1f.children(".panel-header"); +if(!_25.length){ +_25=$("
").prependTo(_1f); +} +if(!$.isArray(_1e.tools)){ +_25.find("div.panel-tool .panel-tool-a").appendTo(_1e.tools); +} +_25.empty(); +var _26=$("
").html(_1e.title).appendTo(_25); +if(_1e.iconCls){ +_26.addClass("panel-with-icon"); +$("
").addClass(_1e.iconCls).appendTo(_25); +} +if(_1e.halign=="left"||_1e.halign=="right"){ +_26.addClass("panel-title-"+_1e.titleDirection); +} +var _27=$("
").appendTo(_25); +_27.bind("click",function(e){ +e.stopPropagation(); +}); +if(_1e.tools){ +if($.isArray(_1e.tools)){ +$.map(_1e.tools,function(t){ +_28(_27,t.iconCls,eval(t.handler)); +}); +}else{ +$(_1e.tools).children().each(function(){ +$(this).addClass($(this).attr("iconCls")).addClass("panel-tool-a").appendTo(_27); +}); +} +} +if(_1e.collapsible){ +_28(_27,"panel-tool-collapse",function(){ +if(_1e.collapsed==true){ +_52(_1c,true); +}else{ +_3e(_1c,true); +} +}); +} +if(_1e.minimizable){ +_28(_27,"panel-tool-min",function(){ +_5d(_1c); +}); +} +if(_1e.maximizable){ +_28(_27,"panel-tool-max",function(){ +if(_1e.maximized==true){ +_61(_1c); +}else{ +_3d(_1c); +} +}); +} +if(_1e.closable){ +_28(_27,"panel-tool-close",function(){ +_3f(_1c); +}); +} +} +_1f.children("div.panel-body").removeClass("panel-body-noheader"); +} +}; +function _28(c,_29,_2a){ +var a=$("").addClass(_29).appendTo(c); +a.bind("click",_2a); +}; +function _21(){ +if(_1e.footer){ +$(_1e.footer).addClass("panel-footer").appendTo(_1f); +$(_1c).addClass("panel-body-nobottom"); +}else{ +_1f.children(".panel-footer").remove(); +$(_1c).removeClass("panel-body-nobottom"); +} +}; +}; +function _2b(_2c,_2d){ +var _2e=$.data(_2c,"panel"); +var _2f=_2e.options; +if(_30){ +_2f.queryParams=_2d; +} +if(!_2f.href){ +return; +} +if(!_2e.isLoaded||!_2f.cache){ +var _30=$.extend({},_2f.queryParams); +if(_2f.onBeforeLoad.call(_2c,_30)==false){ +return; +} +_2e.isLoaded=false; +if(_2f.loadingMessage){ +$(_2c).panel("clear"); +$(_2c).html($("
").html(_2f.loadingMessage)); +} +_2f.loader.call(_2c,_30,function(_31){ +var _32=_2f.extractor.call(_2c,_31); +$(_2c).panel("clear"); +$(_2c).html(_32); +$.parser.parse($(_2c)); +_2f.onLoad.apply(_2c,arguments); +_2e.isLoaded=true; +},function(){ +_2f.onLoadError.apply(_2c,arguments); +}); +} +}; +function _33(_34){ +var t=$(_34); +t.find(".combo-f").each(function(){ +$(this).combo("destroy"); +}); +t.find(".m-btn").each(function(){ +$(this).menubutton("destroy"); +}); +t.find(".s-btn").each(function(){ +$(this).splitbutton("destroy"); +}); +t.find(".tooltip-f").each(function(){ +$(this).tooltip("destroy"); +}); +t.children("div").each(function(){ +$(this)._size("unfit"); +}); +t.empty(); +}; +function _35(_36){ +$(_36).panel("doLayout",true); +}; +function _37(_38,_39){ +var _3a=$.data(_38,"panel").options; +var _3b=$.data(_38,"panel").panel; +if(_39!=true){ +if(_3a.onBeforeOpen.call(_38)==false){ +return; +} +} +_3b.stop(true,true); +if($.isFunction(_3a.openAnimation)){ +_3a.openAnimation.call(_38,cb); +}else{ +switch(_3a.openAnimation){ +case "slide": +_3b.slideDown(_3a.openDuration,cb); +break; +case "fade": +_3b.fadeIn(_3a.openDuration,cb); +break; +case "show": +_3b.show(_3a.openDuration,cb); +break; +default: +_3b.show(); +cb(); +} +} +function cb(){ +_3a.closed=false; +_3a.minimized=false; +var _3c=_3b.children(".panel-header").find("a.panel-tool-restore"); +if(_3c.length){ +_3a.maximized=true; +} +_3a.onOpen.call(_38); +if(_3a.maximized==true){ +_3a.maximized=false; +_3d(_38); +} +if(_3a.collapsed==true){ +_3a.collapsed=false; +_3e(_38); +} +if(!_3a.collapsed){ +_2b(_38); +_35(_38); +} +}; +}; +function _3f(_40,_41){ +var _42=$.data(_40,"panel"); +var _43=_42.options; +var _44=_42.panel; +if(_41!=true){ +if(_43.onBeforeClose.call(_40)==false){ +return; +} +} +_44.find(".tooltip-f").each(function(){ +$(this).tooltip("hide"); +}); +_44.stop(true,true); +_44._size("unfit"); +if($.isFunction(_43.closeAnimation)){ +_43.closeAnimation.call(_40,cb); +}else{ +switch(_43.closeAnimation){ +case "slide": +_44.slideUp(_43.closeDuration,cb); +break; +case "fade": +_44.fadeOut(_43.closeDuration,cb); +break; +case "hide": +_44.hide(_43.closeDuration,cb); +break; +default: +_44.hide(); +cb(); +} +} +function cb(){ +_43.closed=true; +_43.onClose.call(_40); +}; +}; +function _45(_46,_47){ +var _48=$.data(_46,"panel"); +var _49=_48.options; +var _4a=_48.panel; +if(_47!=true){ +if(_49.onBeforeDestroy.call(_46)==false){ +return; +} +} +$(_46).panel("clear").panel("clear","footer"); +_1(_4a); +_49.onDestroy.call(_46); +}; +function _3e(_4b,_4c){ +var _4d=$.data(_4b,"panel").options; +var _4e=$.data(_4b,"panel").panel; +var _4f=_4e.children(".panel-body"); +var _50=_4e.children(".panel-header"); +var _51=_50.find("a.panel-tool-collapse"); +if(_4d.collapsed==true){ +return; +} +_4f.stop(true,true); +if(_4d.onBeforeCollapse.call(_4b)==false){ +return; +} +_51.addClass("panel-tool-expand"); +if(_4c==true){ +if(_4d.halign=="left"||_4d.halign=="right"){ +_4e.animate({width:_50._outerWidth()+_4e.children(".panel-footer")._outerWidth()},function(){ +cb(); +}); +}else{ +_4f.slideUp("normal",function(){ +cb(); +}); +} +}else{ +if(_4d.halign=="left"||_4d.halign=="right"){ +_4e._outerWidth(_50._outerWidth()+_4e.children(".panel-footer")._outerWidth()); +} +cb(); +} +function cb(){ +_4f.hide(); +_4d.collapsed=true; +_4d.onCollapse.call(_4b); +}; +}; +function _52(_53,_54){ +var _55=$.data(_53,"panel").options; +var _56=$.data(_53,"panel").panel; +var _57=_56.children(".panel-body"); +var _58=_56.children(".panel-header").find("a.panel-tool-collapse"); +if(_55.collapsed==false){ +return; +} +_57.stop(true,true); +if(_55.onBeforeExpand.call(_53)==false){ +return; +} +_58.removeClass("panel-tool-expand"); +if(_54==true){ +if(_55.halign=="left"||_55.halign=="right"){ +_57.show(); +_56.animate({width:_55.panelCssWidth},function(){ +cb(); +}); +}else{ +_57.slideDown("normal",function(){ +cb(); +}); +} +}else{ +if(_55.halign=="left"||_55.halign=="right"){ +_56.css("width",_55.panelCssWidth); +} +cb(); +} +function cb(){ +_57.show(); +_55.collapsed=false; +_55.onExpand.call(_53); +_2b(_53); +_35(_53); +}; +}; +function _3d(_59){ +var _5a=$.data(_59,"panel").options; +var _5b=$.data(_59,"panel").panel; +var _5c=_5b.children(".panel-header").find("a.panel-tool-max"); +if(_5a.maximized==true){ +return; +} +_5c.addClass("panel-tool-restore"); +if(!$.data(_59,"panel").original){ +$.data(_59,"panel").original={width:_5a.width,height:_5a.height,left:_5a.left,top:_5a.top,fit:_5a.fit}; +} +_5a.left=0; +_5a.top=0; +_5a.fit=true; +_3(_59); +_5a.minimized=false; +_5a.maximized=true; +_5a.onMaximize.call(_59); +}; +function _5d(_5e){ +var _5f=$.data(_5e,"panel").options; +var _60=$.data(_5e,"panel").panel; +_60._size("unfit"); +_60.hide(); +_5f.minimized=true; +_5f.maximized=false; +_5f.onMinimize.call(_5e); +}; +function _61(_62){ +var _63=$.data(_62,"panel").options; +var _64=$.data(_62,"panel").panel; +var _65=_64.children(".panel-header").find("a.panel-tool-max"); +if(_63.maximized==false){ +return; +} +_64.show(); +_65.removeClass("panel-tool-restore"); +$.extend(_63,$.data(_62,"panel").original); +_3(_62); +_63.minimized=false; +_63.maximized=false; +$.data(_62,"panel").original=null; +_63.onRestore.call(_62); +}; +function _66(_67,_68){ +$.data(_67,"panel").options.title=_68; +$(_67).panel("header").find("div.panel-title").html(_68); +}; +var _69=null; +$(window).unbind(".panel").bind("resize.panel",function(){ +if(_69){ +clearTimeout(_69); +} +_69=setTimeout(function(){ +var _6a=$("body.layout"); +if(_6a.length){ +_6a.layout("resize"); +$("body").children(".easyui-fluid:visible").each(function(){ +$(this).triggerHandler("_resize"); +}); +}else{ +$("body").panel("doLayout"); +} +_69=null; +},100); +}); +$.fn.panel=function(_6b,_6c){ +if(typeof _6b=="string"){ +return $.fn.panel.methods[_6b](this,_6c); +} +_6b=_6b||{}; +return this.each(function(){ +var _6d=$.data(this,"panel"); +var _6e; +if(_6d){ +_6e=$.extend(_6d.options,_6b); +_6d.isLoaded=false; +}else{ +_6e=$.extend({},$.fn.panel.defaults,$.fn.panel.parseOptions(this),_6b); +$(this).attr("title",""); +_6d=$.data(this,"panel",{options:_6e,panel:_17(this),isLoaded:false}); +} +_1b(this); +$(this).show(); +if(_6e.doSize==true){ +_6d.panel.css("display","block"); +_3(this); +} +if(_6e.closed==true||_6e.minimized==true){ +_6d.panel.hide(); +}else{ +_37(this); +} +}); +}; +$.fn.panel.methods={options:function(jq){ +return $.data(jq[0],"panel").options; +},panel:function(jq){ +return $.data(jq[0],"panel").panel; +},header:function(jq){ +return $.data(jq[0],"panel").panel.children(".panel-header"); +},footer:function(jq){ +return jq.panel("panel").children(".panel-footer"); +},body:function(jq){ +return $.data(jq[0],"panel").panel.children(".panel-body"); +},setTitle:function(jq,_6f){ +return jq.each(function(){ +_66(this,_6f); +}); +},open:function(jq,_70){ +return jq.each(function(){ +_37(this,_70); +}); +},close:function(jq,_71){ +return jq.each(function(){ +_3f(this,_71); +}); +},destroy:function(jq,_72){ +return jq.each(function(){ +_45(this,_72); +}); +},clear:function(jq,_73){ +return jq.each(function(){ +_33(_73=="footer"?$(this).panel("footer"):this); +}); +},refresh:function(jq,_74){ +return jq.each(function(){ +var _75=$.data(this,"panel"); +_75.isLoaded=false; +if(_74){ +if(typeof _74=="string"){ +_75.options.href=_74; +}else{ +_75.options.queryParams=_74; +} +} +_2b(this); +}); +},resize:function(jq,_76){ +return jq.each(function(){ +_3(this,_76); +}); +},doLayout:function(jq,all){ +return jq.each(function(){ +_77(this,"body"); +_77($(this).siblings(".panel-footer")[0],"footer"); +function _77(_78,_79){ +if(!_78){ +return; +} +var _7a=_78==$("body")[0]; +var s=$(_78).find("div.panel:visible,div.accordion:visible,div.tabs-container:visible,div.layout:visible,.easyui-fluid:visible").filter(function(_7b,el){ +var p=$(el).parents(".panel-"+_79+":first"); +return _7a?p.length==0:p[0]==_78; +}); +s.each(function(){ +$(this).triggerHandler("_resize",[all||false]); +}); +}; +}); +},move:function(jq,_7c){ +return jq.each(function(){ +_11(this,_7c); +}); +},maximize:function(jq){ +return jq.each(function(){ +_3d(this); +}); +},minimize:function(jq){ +return jq.each(function(){ +_5d(this); +}); +},restore:function(jq){ +return jq.each(function(){ +_61(this); +}); +},collapse:function(jq,_7d){ +return jq.each(function(){ +_3e(this,_7d); +}); +},expand:function(jq,_7e){ +return jq.each(function(){ +_52(this,_7e); +}); +}}; +$.fn.panel.parseOptions=function(_7f){ +var t=$(_7f); +var hh=t.children(".panel-header,header"); +var ff=t.children(".panel-footer,footer"); +return $.extend({},$.parser.parseOptions(_7f,["id","width","height","left","top","title","iconCls","cls","headerCls","bodyCls","tools","href","method","header","footer","halign","titleDirection",{cache:"boolean",fit:"boolean",border:"boolean",noheader:"boolean"},{collapsible:"boolean",minimizable:"boolean",maximizable:"boolean"},{closable:"boolean",collapsed:"boolean",minimized:"boolean",maximized:"boolean",closed:"boolean"},"openAnimation","closeAnimation",{openDuration:"number",closeDuration:"number"},]),{loadingMessage:(t.attr("loadingMessage")!=undefined?t.attr("loadingMessage"):undefined),header:(hh.length?hh.removeClass("panel-header"):undefined),footer:(ff.length?ff.removeClass("panel-footer"):undefined)}); +}; +$.fn.panel.defaults={id:null,title:null,iconCls:null,width:"auto",height:"auto",left:null,top:null,cls:null,headerCls:null,bodyCls:null,style:{},href:null,cache:true,fit:false,border:true,doSize:true,noheader:false,content:null,halign:"top",titleDirection:"down",collapsible:false,minimizable:false,maximizable:false,closable:false,collapsed:false,minimized:false,maximized:false,closed:false,openAnimation:false,openDuration:400,closeAnimation:false,closeDuration:400,tools:null,footer:null,header:null,queryParams:{},method:"get",href:null,loadingMessage:"Loading...",loader:function(_80,_81,_82){ +var _83=$(this).panel("options"); +if(!_83.href){ +return false; +} +$.ajax({type:_83.method,url:_83.href,cache:false,data:_80,dataType:"html",success:function(_84){ +_81(_84); +},error:function(){ +_82.apply(this,arguments); +}}); +},extractor:function(_85){ +var _86=/]*>((.|[\n\r])*)<\/body>/im; +var _87=_86.exec(_85); +if(_87){ +return _87[1]; +}else{ +return _85; +} +},onBeforeLoad:function(_88){ +},onLoad:function(){ +},onLoadError:function(){ +},onBeforeOpen:function(){ +},onOpen:function(){ +},onBeforeClose:function(){ +},onClose:function(){ +},onBeforeDestroy:function(){ +},onDestroy:function(){ +},onResize:function(_89,_8a){ +},onMove:function(_8b,top){ +},onMaximize:function(){ +},onRestore:function(){ +},onMinimize:function(){ +},onBeforeCollapse:function(){ +},onBeforeExpand:function(){ +},onCollapse:function(){ +},onExpand:function(){ +}}; +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.parser.js b/assets/js/easy-ui/plugins/jquery.parser.js index da48ecf688..79a83ebe54 100755 --- a/assets/js/easy-ui/plugins/jquery.parser.js +++ b/assets/js/easy-ui/plugins/jquery.parser.js @@ -1,386 +1,386 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -$.easyui={indexOfArray:function(a,o,id){ -for(var i=0,_1=a.length;i<_1;i++){ -if(id==undefined){ -if(a[i]==o){ -return i; -} -}else{ -if(a[i][o]==id){ -return i; -} -} -} -return -1; -},removeArrayItem:function(a,o,id){ -if(typeof o=="string"){ -for(var i=0,_2=a.length;i<_2;i++){ -if(a[i][o]==id){ -a.splice(i,1); -return; -} -} -}else{ -var _3=this.indexOfArray(a,o); -if(_3!=-1){ -a.splice(_3,1); -} -} -},addArrayItem:function(a,o,r){ -var _4=this.indexOfArray(a,o,r?r[o]:undefined); -if(_4==-1){ -a.push(r?r:o); -}else{ -a[_4]=r?r:o; -} -},getArrayItem:function(a,o,id){ -var _5=this.indexOfArray(a,o,id); -return _5==-1?null:a[_5]; -},forEach:function(_6,_7,_8){ -var _9=[]; -for(var i=0;i<_6.length;i++){ -_9.push(_6[i]); -} -while(_9.length){ -var _a=_9.shift(); -if(_8(_a)==false){ -return; -} -if(_7&&_a.children){ -for(var i=_a.children.length-1;i>=0;i--){ -_9.unshift(_a.children[i]); -} -} -} -}}; -$.parser={auto:true,onComplete:function(_b){ -},plugins:["draggable","droppable","resizable","pagination","tooltip","linkbutton","menu","menubutton","splitbutton","switchbutton","progressbar","tree","textbox","passwordbox","filebox","combo","combobox","combotree","combogrid","combotreegrid","tagbox","numberbox","validatebox","searchbox","spinner","numberspinner","timespinner","datetimespinner","calendar","datebox","datetimebox","slider","layout","panel","datagrid","propertygrid","treegrid","datalist","tabs","accordion","window","dialog","form"],parse:function(_c){ -var aa=[]; -for(var i=0;i<$.parser.plugins.length;i++){ -var _d=$.parser.plugins[i]; -var r=$(".easyui-"+_d,_c); -if(r.length){ -if(r[_d]){ -r.each(function(){ -$(this)[_d]($.data(this,"options")||{}); -}); -}else{ -aa.push({name:_d,jq:r}); -} -} -} -if(aa.length&&window.easyloader){ -var _e=[]; -for(var i=0;i=0){ -v=Math.floor((_12.width()-_13)*v/100); -}else{ -v=Math.floor((_12.height()-_13)*v/100); -} -}else{ -v=parseInt(v)||undefined; -} -return v; -},parseOptions:function(_15,_16){ -var t=$(_15); -var _17={}; -var s=$.trim(t.attr("data-options")); -if(s){ -if(s.substring(0,1)!="{"){ -s="{"+s+"}"; -} -_17=(new Function("return "+s))(); -} -$.map(["width","height","left","top","minWidth","maxWidth","minHeight","maxHeight"],function(p){ -var pv=$.trim(_15.style[p]||""); -if(pv){ -if(pv.indexOf("%")==-1){ -pv=parseInt(pv); -if(isNaN(pv)){ -pv=undefined; -} -} -_17[p]=pv; -} -}); -if(_16){ -var _18={}; -for(var i=0;i<_16.length;i++){ -var pp=_16[i]; -if(typeof pp=="string"){ -_18[pp]=t.attr(pp); -}else{ -for(var _19 in pp){ -var _1a=pp[_19]; -if(_1a=="boolean"){ -_18[_19]=t.attr(_19)?(t.attr(_19)=="true"):undefined; -}else{ -if(_1a=="number"){ -_18[_19]=t.attr(_19)=="0"?0:parseFloat(t.attr(_19))||undefined; -} -} -} -} -} -$.extend(_17,_18); -} -return _17; -}}; -$(function(){ -var d=$("
").appendTo("body"); -$._boxModel=d.outerWidth()!=100; -d.remove(); -d=$("
").appendTo("body"); -$._positionFixed=(d.css("position")=="fixed"); -d.remove(); -if(!window.easyloader&&$.parser.auto){ -$.parser.parse(); -} -}); -$.fn._outerWidth=function(_1b){ -if(_1b==undefined){ -if(this[0]==window){ -return this.width()||document.body.clientWidth; -} -return this.outerWidth()||0; -} -return this._size("width",_1b); -}; -$.fn._outerHeight=function(_1c){ -if(_1c==undefined){ -if(this[0]==window){ -return this.height()||document.body.clientHeight; -} -return this.outerHeight()||0; -} -return this._size("height",_1c); -}; -$.fn._scrollLeft=function(_1d){ -if(_1d==undefined){ -return this.scrollLeft(); -}else{ -return this.each(function(){ -$(this).scrollLeft(_1d); -}); -} -}; -$.fn._propAttr=$.fn.prop||$.fn.attr; -$.fn._size=function(_1e,_1f){ -if(typeof _1e=="string"){ -if(_1e=="clear"){ -return this.each(function(){ -$(this).css({width:"",minWidth:"",maxWidth:"",height:"",minHeight:"",maxHeight:""}); -}); -}else{ -if(_1e=="fit"){ -return this.each(function(){ -_20(this,this.tagName=="BODY"?$("body"):$(this).parent(),true); -}); -}else{ -if(_1e=="unfit"){ -return this.each(function(){ -_20(this,$(this).parent(),false); -}); -}else{ -if(_1f==undefined){ -return _21(this[0],_1e); -}else{ -return this.each(function(){ -_21(this,_1e,_1f); -}); -} -} -} -} -}else{ -return this.each(function(){ -_1f=_1f||$(this).parent(); -$.extend(_1e,_20(this,_1f,_1e.fit)||{}); -var r1=_22(this,"width",_1f,_1e); -var r2=_22(this,"height",_1f,_1e); -if(r1||r2){ -$(this).addClass("easyui-fluid"); -}else{ -$(this).removeClass("easyui-fluid"); -} -}); -} -function _20(_23,_24,fit){ -if(!_24.length){ -return false; -} -var t=$(_23)[0]; -var p=_24[0]; -var _25=p.fcount||0; -if(fit){ -if(!t.fitted){ -t.fitted=true; -p.fcount=_25+1; -$(p).addClass("panel-noscroll"); -if(p.tagName=="BODY"){ -$("html").addClass("panel-fit"); -} -} -return {width:($(p).width()||1),height:($(p).height()||1)}; -}else{ -if(t.fitted){ -t.fitted=false; -p.fcount=_25-1; -if(p.fcount==0){ -$(p).removeClass("panel-noscroll"); -if(p.tagName=="BODY"){ -$("html").removeClass("panel-fit"); -} -} -} -return false; -} -}; -function _22(_26,_27,_28,_29){ -var t=$(_26); -var p=_27; -var p1=p.substr(0,1).toUpperCase()+p.substr(1); -var min=$.parser.parseValue("min"+p1,_29["min"+p1],_28); -var max=$.parser.parseValue("max"+p1,_29["max"+p1],_28); -var val=$.parser.parseValue(p,_29[p],_28); -var _2a=(String(_29[p]||"").indexOf("%")>=0?true:false); -if(!isNaN(val)){ -var v=Math.min(Math.max(val,min||0),max||99999); -if(!_2a){ -_29[p]=v; -} -t._size("min"+p1,""); -t._size("max"+p1,""); -t._size(p,v); -}else{ -t._size(p,""); -t._size("min"+p1,min); -t._size("max"+p1,max); -} -return _2a||_29.fit; -}; -function _21(_2b,_2c,_2d){ -var t=$(_2b); -if(_2d==undefined){ -_2d=parseInt(_2b.style[_2c]); -if(isNaN(_2d)){ -return undefined; -} -if($._boxModel){ -_2d+=_2e(); -} -return _2d; -}else{ -if(_2d===""){ -t.css(_2c,""); -}else{ -if($._boxModel){ -_2d-=_2e(); -if(_2d<0){ -_2d=0; -} -} -t.css(_2c,_2d+"px"); -} -} -function _2e(){ -if(_2c.toLowerCase().indexOf("width")>=0){ -return t.outerWidth()-t.width(); -}else{ -return t.outerHeight()-t.height(); -} -}; -}; -}; -})(jQuery); -(function($){ -var _2f=null; -var _30=null; -var _31=false; -function _32(e){ -if(e.touches.length!=1){ -return; -} -if(!_31){ -_31=true; -dblClickTimer=setTimeout(function(){ -_31=false; -},500); -}else{ -clearTimeout(dblClickTimer); -_31=false; -_33(e,"dblclick"); -} -_2f=setTimeout(function(){ -_33(e,"contextmenu",3); -},1000); -_33(e,"mousedown"); -if($.fn.draggable.isDragging||$.fn.resizable.isResizing){ -e.preventDefault(); -} -}; -function _34(e){ -if(e.touches.length!=1){ -return; -} -if(_2f){ -clearTimeout(_2f); -} -_33(e,"mousemove"); -if($.fn.draggable.isDragging||$.fn.resizable.isResizing){ -e.preventDefault(); -} -}; -function _35(e){ -if(_2f){ -clearTimeout(_2f); -} -_33(e,"mouseup"); -if($.fn.draggable.isDragging||$.fn.resizable.isResizing){ -e.preventDefault(); -} -}; -function _33(e,_36,_37){ -var _38=new $.Event(_36); -_38.pageX=e.changedTouches[0].pageX; -_38.pageY=e.changedTouches[0].pageY; -_38.which=_37||1; -$(e.target).trigger(_38); -}; -if(document.addEventListener){ -document.addEventListener("touchstart",_32,true); -document.addEventListener("touchmove",_34,true); -document.addEventListener("touchend",_35,true); -} -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +$.easyui={indexOfArray:function(a,o,id){ +for(var i=0,_1=a.length;i<_1;i++){ +if(id==undefined){ +if(a[i]==o){ +return i; +} +}else{ +if(a[i][o]==id){ +return i; +} +} +} +return -1; +},removeArrayItem:function(a,o,id){ +if(typeof o=="string"){ +for(var i=0,_2=a.length;i<_2;i++){ +if(a[i][o]==id){ +a.splice(i,1); +return; +} +} +}else{ +var _3=this.indexOfArray(a,o); +if(_3!=-1){ +a.splice(_3,1); +} +} +},addArrayItem:function(a,o,r){ +var _4=this.indexOfArray(a,o,r?r[o]:undefined); +if(_4==-1){ +a.push(r?r:o); +}else{ +a[_4]=r?r:o; +} +},getArrayItem:function(a,o,id){ +var _5=this.indexOfArray(a,o,id); +return _5==-1?null:a[_5]; +},forEach:function(_6,_7,_8){ +var _9=[]; +for(var i=0;i<_6.length;i++){ +_9.push(_6[i]); +} +while(_9.length){ +var _a=_9.shift(); +if(_8(_a)==false){ +return; +} +if(_7&&_a.children){ +for(var i=_a.children.length-1;i>=0;i--){ +_9.unshift(_a.children[i]); +} +} +} +}}; +$.parser={auto:true,onComplete:function(_b){ +},plugins:["draggable","droppable","resizable","pagination","tooltip","linkbutton","menu","menubutton","splitbutton","switchbutton","progressbar","tree","textbox","passwordbox","filebox","combo","combobox","combotree","combogrid","combotreegrid","tagbox","numberbox","validatebox","searchbox","spinner","numberspinner","timespinner","datetimespinner","calendar","datebox","datetimebox","slider","layout","panel","datagrid","propertygrid","treegrid","datalist","tabs","accordion","window","dialog","form"],parse:function(_c){ +var aa=[]; +for(var i=0;i<$.parser.plugins.length;i++){ +var _d=$.parser.plugins[i]; +var r=$(".easyui-"+_d,_c); +if(r.length){ +if(r[_d]){ +r.each(function(){ +$(this)[_d]($.data(this,"options")||{}); +}); +}else{ +aa.push({name:_d,jq:r}); +} +} +} +if(aa.length&&window.easyloader){ +var _e=[]; +for(var i=0;i=0){ +v=Math.floor((_12.width()-_13)*v/100); +}else{ +v=Math.floor((_12.height()-_13)*v/100); +} +}else{ +v=parseInt(v)||undefined; +} +return v; +},parseOptions:function(_15,_16){ +var t=$(_15); +var _17={}; +var s=$.trim(t.attr("data-options")); +if(s){ +if(s.substring(0,1)!="{"){ +s="{"+s+"}"; +} +_17=(new Function("return "+s))(); +} +$.map(["width","height","left","top","minWidth","maxWidth","minHeight","maxHeight"],function(p){ +var pv=$.trim(_15.style[p]||""); +if(pv){ +if(pv.indexOf("%")==-1){ +pv=parseInt(pv); +if(isNaN(pv)){ +pv=undefined; +} +} +_17[p]=pv; +} +}); +if(_16){ +var _18={}; +for(var i=0;i<_16.length;i++){ +var pp=_16[i]; +if(typeof pp=="string"){ +_18[pp]=t.attr(pp); +}else{ +for(var _19 in pp){ +var _1a=pp[_19]; +if(_1a=="boolean"){ +_18[_19]=t.attr(_19)?(t.attr(_19)=="true"):undefined; +}else{ +if(_1a=="number"){ +_18[_19]=t.attr(_19)=="0"?0:parseFloat(t.attr(_19))||undefined; +} +} +} +} +} +$.extend(_17,_18); +} +return _17; +}}; +$(function(){ +var d=$("
").appendTo("body"); +$._boxModel=d.outerWidth()!=100; +d.remove(); +d=$("
").appendTo("body"); +$._positionFixed=(d.css("position")=="fixed"); +d.remove(); +if(!window.easyloader&&$.parser.auto){ +$.parser.parse(); +} +}); +$.fn._outerWidth=function(_1b){ +if(_1b==undefined){ +if(this[0]==window){ +return this.width()||document.body.clientWidth; +} +return this.outerWidth()||0; +} +return this._size("width",_1b); +}; +$.fn._outerHeight=function(_1c){ +if(_1c==undefined){ +if(this[0]==window){ +return this.height()||document.body.clientHeight; +} +return this.outerHeight()||0; +} +return this._size("height",_1c); +}; +$.fn._scrollLeft=function(_1d){ +if(_1d==undefined){ +return this.scrollLeft(); +}else{ +return this.each(function(){ +$(this).scrollLeft(_1d); +}); +} +}; +$.fn._propAttr=$.fn.prop||$.fn.attr; +$.fn._size=function(_1e,_1f){ +if(typeof _1e=="string"){ +if(_1e=="clear"){ +return this.each(function(){ +$(this).css({width:"",minWidth:"",maxWidth:"",height:"",minHeight:"",maxHeight:""}); +}); +}else{ +if(_1e=="fit"){ +return this.each(function(){ +_20(this,this.tagName=="BODY"?$("body"):$(this).parent(),true); +}); +}else{ +if(_1e=="unfit"){ +return this.each(function(){ +_20(this,$(this).parent(),false); +}); +}else{ +if(_1f==undefined){ +return _21(this[0],_1e); +}else{ +return this.each(function(){ +_21(this,_1e,_1f); +}); +} +} +} +} +}else{ +return this.each(function(){ +_1f=_1f||$(this).parent(); +$.extend(_1e,_20(this,_1f,_1e.fit)||{}); +var r1=_22(this,"width",_1f,_1e); +var r2=_22(this,"height",_1f,_1e); +if(r1||r2){ +$(this).addClass("easyui-fluid"); +}else{ +$(this).removeClass("easyui-fluid"); +} +}); +} +function _20(_23,_24,fit){ +if(!_24.length){ +return false; +} +var t=$(_23)[0]; +var p=_24[0]; +var _25=p.fcount||0; +if(fit){ +if(!t.fitted){ +t.fitted=true; +p.fcount=_25+1; +$(p).addClass("panel-noscroll"); +if(p.tagName=="BODY"){ +$("html").addClass("panel-fit"); +} +} +return {width:($(p).width()||1),height:($(p).height()||1)}; +}else{ +if(t.fitted){ +t.fitted=false; +p.fcount=_25-1; +if(p.fcount==0){ +$(p).removeClass("panel-noscroll"); +if(p.tagName=="BODY"){ +$("html").removeClass("panel-fit"); +} +} +} +return false; +} +}; +function _22(_26,_27,_28,_29){ +var t=$(_26); +var p=_27; +var p1=p.substr(0,1).toUpperCase()+p.substr(1); +var min=$.parser.parseValue("min"+p1,_29["min"+p1],_28); +var max=$.parser.parseValue("max"+p1,_29["max"+p1],_28); +var val=$.parser.parseValue(p,_29[p],_28); +var _2a=(String(_29[p]||"").indexOf("%")>=0?true:false); +if(!isNaN(val)){ +var v=Math.min(Math.max(val,min||0),max||99999); +if(!_2a){ +_29[p]=v; +} +t._size("min"+p1,""); +t._size("max"+p1,""); +t._size(p,v); +}else{ +t._size(p,""); +t._size("min"+p1,min); +t._size("max"+p1,max); +} +return _2a||_29.fit; +}; +function _21(_2b,_2c,_2d){ +var t=$(_2b); +if(_2d==undefined){ +_2d=parseInt(_2b.style[_2c]); +if(isNaN(_2d)){ +return undefined; +} +if($._boxModel){ +_2d+=_2e(); +} +return _2d; +}else{ +if(_2d===""){ +t.css(_2c,""); +}else{ +if($._boxModel){ +_2d-=_2e(); +if(_2d<0){ +_2d=0; +} +} +t.css(_2c,_2d+"px"); +} +} +function _2e(){ +if(_2c.toLowerCase().indexOf("width")>=0){ +return t.outerWidth()-t.width(); +}else{ +return t.outerHeight()-t.height(); +} +}; +}; +}; +})(jQuery); +(function($){ +var _2f=null; +var _30=null; +var _31=false; +function _32(e){ +if(e.touches.length!=1){ +return; +} +if(!_31){ +_31=true; +dblClickTimer=setTimeout(function(){ +_31=false; +},500); +}else{ +clearTimeout(dblClickTimer); +_31=false; +_33(e,"dblclick"); +} +_2f=setTimeout(function(){ +_33(e,"contextmenu",3); +},1000); +_33(e,"mousedown"); +if($.fn.draggable.isDragging||$.fn.resizable.isResizing){ +e.preventDefault(); +} +}; +function _34(e){ +if(e.touches.length!=1){ +return; +} +if(_2f){ +clearTimeout(_2f); +} +_33(e,"mousemove"); +if($.fn.draggable.isDragging||$.fn.resizable.isResizing){ +e.preventDefault(); +} +}; +function _35(e){ +if(_2f){ +clearTimeout(_2f); +} +_33(e,"mouseup"); +if($.fn.draggable.isDragging||$.fn.resizable.isResizing){ +e.preventDefault(); +} +}; +function _33(e,_36,_37){ +var _38=new $.Event(_36); +_38.pageX=e.changedTouches[0].pageX; +_38.pageY=e.changedTouches[0].pageY; +_38.which=_37||1; +$(e.target).trigger(_38); +}; +if(document.addEventListener){ +document.addEventListener("touchstart",_32,true); +document.addEventListener("touchmove",_34,true); +document.addEventListener("touchend",_35,true); +} +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.progressbar.js b/assets/js/easy-ui/plugins/jquery.progressbar.js index 5b6f422407..decdc57d6a 100755 --- a/assets/js/easy-ui/plugins/jquery.progressbar.js +++ b/assets/js/easy-ui/plugins/jquery.progressbar.js @@ -1,113 +1,113 @@ -/** - * jQuery EasyUI 1.5.2-m - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -/** - * progressbar - jQuery EasyUI - * - * Dependencies: - * none - * - */ -(function($){ - function init(target){ - $(target).addClass('progressbar'); - $(target).html('
'); - $(target).bind('_resize', function(e,force){ - if ($(this).hasClass('easyui-fluid') || force){ - setSize(target); - } - return false; - }); - return $(target); - } - - function setSize(target,width){ - var opts = $.data(target, 'progressbar').options; - var bar = $.data(target, 'progressbar').bar; - if (width) opts.width = width; - bar._size(opts); - - bar.find('div.progressbar-text').css('width', bar.width()); - bar.find('div.progressbar-text,div.progressbar-value').css({ - height: bar.height()+'px', - lineHeight: bar.height()+'px' - }); - } - - $.fn.progressbar = function(options, param){ - if (typeof options == 'string'){ - var method = $.fn.progressbar.methods[options]; - if (method){ - return method(this, param); - } - } - - options = options || {}; - return this.each(function(){ - var state = $.data(this, 'progressbar'); - if (state){ - $.extend(state.options, options); - } else { - state = $.data(this, 'progressbar', { - options: $.extend({}, $.fn.progressbar.defaults, $.fn.progressbar.parseOptions(this), options), - bar: init(this) - }); - } - $(this).progressbar('setValue', state.options.value); - setSize(this); - }); - }; - - $.fn.progressbar.methods = { - options: function(jq){ - return $.data(jq[0], 'progressbar').options; - }, - resize: function(jq, width){ - return jq.each(function(){ - setSize(this, width); - }); - }, - getValue: function(jq){ - return $.data(jq[0], 'progressbar').options.value; - }, - setText: function(jq, text) { - return jq.each(function() { - var opts = $.data(this, 'progressbar').options; - opts.text = text; - }) - }, - setValue: function(jq, value){ - if (value < 0) value = 0; - if (value > 100) value = 100; - return jq.each(function(){ - var opts = $.data(this, 'progressbar').options; - var text = opts.text.replace(/{value}/, value); - var oldValue = opts.value; - opts.value = value; - $(this).find('div.progressbar-value').width(value+'%'); - $(this).find('div.progressbar-text').html(text); - if (oldValue != value){ - opts.onChange.call(this, value, oldValue); - } - }); - } - }; - - $.fn.progressbar.parseOptions = function(target){ - return $.extend({}, $.parser.parseOptions(target, ['width','height','text',{value:'number'}])); - }; - - $.fn.progressbar.defaults = { - width: 'auto', - height: 22, - value: 0, // percentage value - text: '{value}%', - onChange:function(newValue,oldValue){} - }; -})(jQuery); +/** + * jQuery EasyUI 1.5.2-m + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +/** + * progressbar - jQuery EasyUI + * + * Dependencies: + * none + * + */ +(function($){ + function init(target){ + $(target).addClass('progressbar'); + $(target).html('
'); + $(target).bind('_resize', function(e,force){ + if ($(this).hasClass('easyui-fluid') || force){ + setSize(target); + } + return false; + }); + return $(target); + } + + function setSize(target,width){ + var opts = $.data(target, 'progressbar').options; + var bar = $.data(target, 'progressbar').bar; + if (width) opts.width = width; + bar._size(opts); + + bar.find('div.progressbar-text').css('width', bar.width()); + bar.find('div.progressbar-text,div.progressbar-value').css({ + height: bar.height()+'px', + lineHeight: bar.height()+'px' + }); + } + + $.fn.progressbar = function(options, param){ + if (typeof options == 'string'){ + var method = $.fn.progressbar.methods[options]; + if (method){ + return method(this, param); + } + } + + options = options || {}; + return this.each(function(){ + var state = $.data(this, 'progressbar'); + if (state){ + $.extend(state.options, options); + } else { + state = $.data(this, 'progressbar', { + options: $.extend({}, $.fn.progressbar.defaults, $.fn.progressbar.parseOptions(this), options), + bar: init(this) + }); + } + $(this).progressbar('setValue', state.options.value); + setSize(this); + }); + }; + + $.fn.progressbar.methods = { + options: function(jq){ + return $.data(jq[0], 'progressbar').options; + }, + resize: function(jq, width){ + return jq.each(function(){ + setSize(this, width); + }); + }, + getValue: function(jq){ + return $.data(jq[0], 'progressbar').options.value; + }, + setText: function(jq, text) { + return jq.each(function() { + var opts = $.data(this, 'progressbar').options; + opts.text = text; + }) + }, + setValue: function(jq, value){ + if (value < 0) value = 0; + if (value > 100) value = 100; + return jq.each(function(){ + var opts = $.data(this, 'progressbar').options; + var text = opts.text.replace(/{value}/, value); + var oldValue = opts.value; + opts.value = value; + $(this).find('div.progressbar-value').width(value+'%'); + $(this).find('div.progressbar-text').html(text); + if (oldValue != value){ + opts.onChange.call(this, value, oldValue); + } + }); + } + }; + + $.fn.progressbar.parseOptions = function(target){ + return $.extend({}, $.parser.parseOptions(target, ['width','height','text',{value:'number'}])); + }; + + $.fn.progressbar.defaults = { + width: 'auto', + height: 22, + value: 0, // percentage value + text: '{value}%', + onChange:function(newValue,oldValue){} + }; +})(jQuery); diff --git a/assets/js/easy-ui/plugins/jquery.propertygrid.js b/assets/js/easy-ui/plugins/jquery.propertygrid.js index e64837d2e5..4dcfadbcba 100755 --- a/assets/js/easy-ui/plugins/jquery.propertygrid.js +++ b/assets/js/easy-ui/plugins/jquery.propertygrid.js @@ -1,330 +1,330 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -var _1; -$(document).unbind(".propertygrid").bind("mousedown.propertygrid",function(e){ -var p=$(e.target).closest("div.datagrid-view,div.combo-panel"); -if(p.length){ -return; -} -_2(_1); -_1=undefined; -}); -function _3(_4){ -var _5=$.data(_4,"propertygrid"); -var _6=$.data(_4,"propertygrid").options; -$(_4).datagrid($.extend({},_6,{cls:"propertygrid",view:(_6.showGroup?_6.groupView:_6.view),onBeforeEdit:function(_7,_8){ -if(_6.onBeforeEdit.call(_4,_7,_8)==false){ -return false; -} -var dg=$(this); -var _8=dg.datagrid("getRows")[_7]; -var _9=dg.datagrid("getColumnOption","value"); -_9.editor=_8.editor; -},onClickCell:function(_a,_b,_c){ -if(_1!=this){ -_2(_1); -_1=this; -} -if(_6.editIndex!=_a){ -_2(_1); -$(this).datagrid("beginEdit",_a); -var ed=$(this).datagrid("getEditor",{index:_a,field:_b}); -if(!ed){ -ed=$(this).datagrid("getEditor",{index:_a,field:"value"}); -} -if(ed){ -var t=$(ed.target); -var _d=t.data("textbox")?t.textbox("textbox"):t; -_d.focus(); -_6.editIndex=_a; -} -} -_6.onClickCell.call(_4,_a,_b,_c); -},loadFilter:function(_e){ -_2(this); -return _6.loadFilter.call(this,_e); -}})); -}; -function _2(_f){ -var t=$(_f); -if(!t.length){ -return; -} -var _10=$.data(_f,"propertygrid").options; -_10.finder.getTr(_f,null,"editing").each(function(){ -var _11=parseInt($(this).attr("datagrid-row-index")); -if(t.datagrid("validateRow",_11)){ -t.datagrid("endEdit",_11); -}else{ -t.datagrid("cancelEdit",_11); -} -}); -_10.editIndex=undefined; -}; -$.fn.propertygrid=function(_12,_13){ -if(typeof _12=="string"){ -var _14=$.fn.propertygrid.methods[_12]; -if(_14){ -return _14(this,_13); -}else{ -return this.datagrid(_12,_13); -} -} -_12=_12||{}; -return this.each(function(){ -var _15=$.data(this,"propertygrid"); -if(_15){ -$.extend(_15.options,_12); -}else{ -var _16=$.extend({},$.fn.propertygrid.defaults,$.fn.propertygrid.parseOptions(this),_12); -_16.frozenColumns=$.extend(true,[],_16.frozenColumns); -_16.columns=$.extend(true,[],_16.columns); -$.data(this,"propertygrid",{options:_16}); -} -_3(this); -}); -}; -$.fn.propertygrid.methods={options:function(jq){ -return $.data(jq[0],"propertygrid").options; -}}; -$.fn.propertygrid.parseOptions=function(_17){ -return $.extend({},$.fn.datagrid.parseOptions(_17),$.parser.parseOptions(_17,[{showGroup:"boolean"}])); -}; -var _18=$.extend({},$.fn.datagrid.defaults.view,{render:function(_19,_1a,_1b){ -var _1c=[]; -var _1d=this.groups; -for(var i=0;i<_1d.length;i++){ -_1c.push(this.renderGroup.call(this,_19,i,_1d[i],_1b)); -} -$(_1a).html(_1c.join("")); -},renderGroup:function(_1e,_1f,_20,_21){ -var _22=$.data(_1e,"datagrid"); -var _23=_22.options; -var _24=$(_1e).datagrid("getColumnFields",_21); -var _25=[]; -_25.push("
"); -if((_21&&(_23.rownumbers||_23.frozenColumns.length))||(!_21&&!(_23.rownumbers||_23.frozenColumns.length))){ -_25.push(""); -_25.push(" "); -_25.push(""); -} -if(!_21){ -_25.push(""); -_25.push(_23.groupFormatter.call(_1e,_20.value,_20.rows)); -_25.push(""); -} -_25.push("
"); -_25.push(""); -var _26=_20.startIndex; -for(var j=0;j<_20.rows.length;j++){ -var css=_23.rowStyler?_23.rowStyler.call(_1e,_26,_20.rows[j]):""; -var _27=""; -var _28=""; -if(typeof css=="string"){ -_28=css; -}else{ -if(css){ -_27=css["class"]||""; -_28=css["style"]||""; -} -} -var cls="class=\"datagrid-row "+(_26%2&&_23.striped?"datagrid-row-alt ":" ")+_27+"\""; -var _29=_28?"style=\""+_28+"\"":""; -var _2a=_22.rowIdPrefix+"-"+(_21?1:2)+"-"+_26; -_25.push(""); -_25.push(this.renderRow.call(this,_1e,_24,_21,_26,_20.rows[j])); -_25.push(""); -_26++; -} -_25.push("
"); -return _25.join(""); -},bindEvents:function(_2b){ -var _2c=$.data(_2b,"datagrid"); -var dc=_2c.dc; -var _2d=dc.body1.add(dc.body2); -var _2e=($.data(_2d[0],"events")||$._data(_2d[0],"events")).click[0].handler; -_2d.unbind("click").bind("click",function(e){ -var tt=$(e.target); -var _2f=tt.closest("span.datagrid-row-expander"); -if(_2f.length){ -var _30=_2f.closest("div.datagrid-group").attr("group-index"); -if(_2f.hasClass("datagrid-row-collapse")){ -$(_2b).datagrid("collapseGroup",_30); -}else{ -$(_2b).datagrid("expandGroup",_30); -} -}else{ -_2e(e); -} -e.stopPropagation(); -}); -},onBeforeRender:function(_31,_32){ -var _33=$.data(_31,"datagrid"); -var _34=_33.options; -_35(); -var _36=[]; -for(var i=0;i<_32.length;i++){ -var row=_32[i]; -var _37=_38(row[_34.groupField]); -if(!_37){ -_37={value:row[_34.groupField],rows:[row]}; -_36.push(_37); -}else{ -_37.rows.push(row); -} -} -var _39=0; -var _3a=[]; -for(var i=0;i<_36.length;i++){ -var _37=_36[i]; -_37.startIndex=_39; -_39+=_37.rows.length; -_3a=_3a.concat(_37.rows); -} -_33.data.rows=_3a; -this.groups=_36; -var _3b=this; -setTimeout(function(){ -_3b.bindEvents(_31); -},0); -function _38(_3c){ -for(var i=0;i<_36.length;i++){ -var _3d=_36[i]; -if(_3d.value==_3c){ -return _3d; -} -} -return null; -}; -function _35(){ -if(!$("#datagrid-group-style").length){ -$("head").append(""); -} -}; -}}); -$.extend($.fn.datagrid.methods,{groups:function(jq){ -return jq.datagrid("options").view.groups; -},expandGroup:function(jq,_3e){ -return jq.each(function(){ -var _3f=$.data(this,"datagrid").dc.view; -var _40=_3f.find(_3e!=undefined?"div.datagrid-group[group-index=\""+_3e+"\"]":"div.datagrid-group"); -var _41=_40.find("span.datagrid-row-expander"); -if(_41.hasClass("datagrid-row-expand")){ -_41.removeClass("datagrid-row-expand").addClass("datagrid-row-collapse"); -_40.next("table").show(); -} -$(this).datagrid("fixRowHeight"); -}); -},collapseGroup:function(jq,_42){ -return jq.each(function(){ -var _43=$.data(this,"datagrid").dc.view; -var _44=_43.find(_42!=undefined?"div.datagrid-group[group-index=\""+_42+"\"]":"div.datagrid-group"); -var _45=_44.find("span.datagrid-row-expander"); -if(_45.hasClass("datagrid-row-collapse")){ -_45.removeClass("datagrid-row-collapse").addClass("datagrid-row-expand"); -_44.next("table").hide(); -} -$(this).datagrid("fixRowHeight"); -}); -}}); -$.extend(_18,{refreshGroupTitle:function(_46,_47){ -var _48=$.data(_46,"datagrid"); -var _49=_48.options; -var dc=_48.dc; -var _4a=this.groups[_47]; -var _4b=dc.body2.children("div.datagrid-group[group-index="+_47+"]").find("span.datagrid-group-title"); -_4b.html(_49.groupFormatter.call(_46,_4a.value,_4a.rows)); -},insertRow:function(_4c,_4d,row){ -var _4e=$.data(_4c,"datagrid"); -var _4f=_4e.options; -var dc=_4e.dc; -var _50=null; -var _51; -if(!_4e.data.rows.length){ -$(_4c).datagrid("loadData",[row]); -return; -} -for(var i=0;i_50.startIndex+_50.rows.length){ -_4d=_50.startIndex+_50.rows.length; -} -} -$.fn.datagrid.defaults.view.insertRow.call(this,_4c,_4d,row); -if(_4d>=_50.startIndex+_50.rows.length){ -_52(_4d,true); -_52(_4d,false); -} -_50.rows.splice(_4d-_50.startIndex,0,row); -}else{ -_50={value:row[_4f.groupField],rows:[row],startIndex:_4e.data.rows.length}; -_51=this.groups.length; -dc.body1.append(this.renderGroup.call(this,_4c,_51,_50,true)); -dc.body2.append(this.renderGroup.call(this,_4c,_51,_50,false)); -this.groups.push(_50); -_4e.data.rows.push(row); -} -this.refreshGroupTitle(_4c,_51); -function _52(_53,_54){ -var _55=_54?1:2; -var _56=_4f.finder.getTr(_4c,_53-1,"body",_55); -var tr=_4f.finder.getTr(_4c,_53,"body",_55); -tr.insertAfter(_56); -}; -},updateRow:function(_57,_58,row){ -var _59=$.data(_57,"datagrid").options; -$.fn.datagrid.defaults.view.updateRow.call(this,_57,_58,row); -var tb=_59.finder.getTr(_57,_58,"body",2).closest("table.datagrid-btable"); -var _5a=parseInt(tb.prev().attr("group-index")); -this.refreshGroupTitle(_57,_5a); -},deleteRow:function(_5b,_5c){ -var _5d=$.data(_5b,"datagrid"); -var _5e=_5d.options; -var dc=_5d.dc; -var _5f=dc.body1.add(dc.body2); -var tb=_5e.finder.getTr(_5b,_5c,"body",2).closest("table.datagrid-btable"); -var _60=parseInt(tb.prev().attr("group-index")); -$.fn.datagrid.defaults.view.deleteRow.call(this,_5b,_5c); -var _61=this.groups[_60]; -if(_61.rows.length>1){ -_61.rows.splice(_5c-_61.startIndex,1); -this.refreshGroupTitle(_5b,_60); -}else{ -_5f.children("div.datagrid-group[group-index="+_60+"]").remove(); -for(var i=_60+1;i"); +if((_21&&(_23.rownumbers||_23.frozenColumns.length))||(!_21&&!(_23.rownumbers||_23.frozenColumns.length))){ +_25.push(""); +_25.push(" "); +_25.push(""); +} +if(!_21){ +_25.push(""); +_25.push(_23.groupFormatter.call(_1e,_20.value,_20.rows)); +_25.push(""); +} +_25.push("
"); +_25.push(""); +var _26=_20.startIndex; +for(var j=0;j<_20.rows.length;j++){ +var css=_23.rowStyler?_23.rowStyler.call(_1e,_26,_20.rows[j]):""; +var _27=""; +var _28=""; +if(typeof css=="string"){ +_28=css; +}else{ +if(css){ +_27=css["class"]||""; +_28=css["style"]||""; +} +} +var cls="class=\"datagrid-row "+(_26%2&&_23.striped?"datagrid-row-alt ":" ")+_27+"\""; +var _29=_28?"style=\""+_28+"\"":""; +var _2a=_22.rowIdPrefix+"-"+(_21?1:2)+"-"+_26; +_25.push(""); +_25.push(this.renderRow.call(this,_1e,_24,_21,_26,_20.rows[j])); +_25.push(""); +_26++; +} +_25.push("
"); +return _25.join(""); +},bindEvents:function(_2b){ +var _2c=$.data(_2b,"datagrid"); +var dc=_2c.dc; +var _2d=dc.body1.add(dc.body2); +var _2e=($.data(_2d[0],"events")||$._data(_2d[0],"events")).click[0].handler; +_2d.unbind("click").bind("click",function(e){ +var tt=$(e.target); +var _2f=tt.closest("span.datagrid-row-expander"); +if(_2f.length){ +var _30=_2f.closest("div.datagrid-group").attr("group-index"); +if(_2f.hasClass("datagrid-row-collapse")){ +$(_2b).datagrid("collapseGroup",_30); +}else{ +$(_2b).datagrid("expandGroup",_30); +} +}else{ +_2e(e); +} +e.stopPropagation(); +}); +},onBeforeRender:function(_31,_32){ +var _33=$.data(_31,"datagrid"); +var _34=_33.options; +_35(); +var _36=[]; +for(var i=0;i<_32.length;i++){ +var row=_32[i]; +var _37=_38(row[_34.groupField]); +if(!_37){ +_37={value:row[_34.groupField],rows:[row]}; +_36.push(_37); +}else{ +_37.rows.push(row); +} +} +var _39=0; +var _3a=[]; +for(var i=0;i<_36.length;i++){ +var _37=_36[i]; +_37.startIndex=_39; +_39+=_37.rows.length; +_3a=_3a.concat(_37.rows); +} +_33.data.rows=_3a; +this.groups=_36; +var _3b=this; +setTimeout(function(){ +_3b.bindEvents(_31); +},0); +function _38(_3c){ +for(var i=0;i<_36.length;i++){ +var _3d=_36[i]; +if(_3d.value==_3c){ +return _3d; +} +} +return null; +}; +function _35(){ +if(!$("#datagrid-group-style").length){ +$("head").append(""); +} +}; +}}); +$.extend($.fn.datagrid.methods,{groups:function(jq){ +return jq.datagrid("options").view.groups; +},expandGroup:function(jq,_3e){ +return jq.each(function(){ +var _3f=$.data(this,"datagrid").dc.view; +var _40=_3f.find(_3e!=undefined?"div.datagrid-group[group-index=\""+_3e+"\"]":"div.datagrid-group"); +var _41=_40.find("span.datagrid-row-expander"); +if(_41.hasClass("datagrid-row-expand")){ +_41.removeClass("datagrid-row-expand").addClass("datagrid-row-collapse"); +_40.next("table").show(); +} +$(this).datagrid("fixRowHeight"); +}); +},collapseGroup:function(jq,_42){ +return jq.each(function(){ +var _43=$.data(this,"datagrid").dc.view; +var _44=_43.find(_42!=undefined?"div.datagrid-group[group-index=\""+_42+"\"]":"div.datagrid-group"); +var _45=_44.find("span.datagrid-row-expander"); +if(_45.hasClass("datagrid-row-collapse")){ +_45.removeClass("datagrid-row-collapse").addClass("datagrid-row-expand"); +_44.next("table").hide(); +} +$(this).datagrid("fixRowHeight"); +}); +}}); +$.extend(_18,{refreshGroupTitle:function(_46,_47){ +var _48=$.data(_46,"datagrid"); +var _49=_48.options; +var dc=_48.dc; +var _4a=this.groups[_47]; +var _4b=dc.body2.children("div.datagrid-group[group-index="+_47+"]").find("span.datagrid-group-title"); +_4b.html(_49.groupFormatter.call(_46,_4a.value,_4a.rows)); +},insertRow:function(_4c,_4d,row){ +var _4e=$.data(_4c,"datagrid"); +var _4f=_4e.options; +var dc=_4e.dc; +var _50=null; +var _51; +if(!_4e.data.rows.length){ +$(_4c).datagrid("loadData",[row]); +return; +} +for(var i=0;i_50.startIndex+_50.rows.length){ +_4d=_50.startIndex+_50.rows.length; +} +} +$.fn.datagrid.defaults.view.insertRow.call(this,_4c,_4d,row); +if(_4d>=_50.startIndex+_50.rows.length){ +_52(_4d,true); +_52(_4d,false); +} +_50.rows.splice(_4d-_50.startIndex,0,row); +}else{ +_50={value:row[_4f.groupField],rows:[row],startIndex:_4e.data.rows.length}; +_51=this.groups.length; +dc.body1.append(this.renderGroup.call(this,_4c,_51,_50,true)); +dc.body2.append(this.renderGroup.call(this,_4c,_51,_50,false)); +this.groups.push(_50); +_4e.data.rows.push(row); +} +this.refreshGroupTitle(_4c,_51); +function _52(_53,_54){ +var _55=_54?1:2; +var _56=_4f.finder.getTr(_4c,_53-1,"body",_55); +var tr=_4f.finder.getTr(_4c,_53,"body",_55); +tr.insertAfter(_56); +}; +},updateRow:function(_57,_58,row){ +var _59=$.data(_57,"datagrid").options; +$.fn.datagrid.defaults.view.updateRow.call(this,_57,_58,row); +var tb=_59.finder.getTr(_57,_58,"body",2).closest("table.datagrid-btable"); +var _5a=parseInt(tb.prev().attr("group-index")); +this.refreshGroupTitle(_57,_5a); +},deleteRow:function(_5b,_5c){ +var _5d=$.data(_5b,"datagrid"); +var _5e=_5d.options; +var dc=_5d.dc; +var _5f=dc.body1.add(dc.body2); +var tb=_5e.finder.getTr(_5b,_5c,"body",2).closest("table.datagrid-btable"); +var _60=parseInt(tb.prev().attr("group-index")); +$.fn.datagrid.defaults.view.deleteRow.call(this,_5b,_5c); +var _61=this.groups[_60]; +if(_61.rows.length>1){ +_61.rows.splice(_5c-_61.startIndex,1); +this.refreshGroupTitle(_5b,_60); +}else{ +_5f.children("div.datagrid-group[group-index="+_60+"]").remove(); +for(var i=_60+1;i_13.top&&e.pageY<_13.top+_16){ -dir+="n"; -}else{ -if(e.pageY<_13.top+_15&&e.pageY>_13.top+_15-_16){ -dir+="s"; -} -} -if(e.pageX>_13.left&&e.pageX<_13.left+_16){ -dir+="w"; -}else{ -if(e.pageX<_13.left+_14&&e.pageX>_13.left+_14-_16){ -dir+="e"; -} -} -var _17=_d.handles.split(","); -for(var i=0;i<_17.length;i++){ -var _18=_17[i].replace(/(^\s*)|(\s*$)/g,""); -if(_18=="all"||_18==dir){ -return dir; -} -} -return ""; -}; -}); -}; -$.fn.resizable.methods={options:function(jq){ -return $.data(jq[0],"resizable").options; -},enable:function(jq){ -return jq.each(function(){ -$(this).resizable({disabled:false}); -}); -},disable:function(jq){ -return jq.each(function(){ -$(this).resizable({disabled:true}); -}); -}}; -$.fn.resizable.parseOptions=function(_19){ -var t=$(_19); -return $.extend({},$.parser.parseOptions(_19,["handles",{minWidth:"number",minHeight:"number",maxWidth:"number",maxHeight:"number",edge:"number"}]),{disabled:(t.attr("disabled")?true:undefined)}); -}; -$.fn.resizable.defaults={disabled:false,handles:"n, e, s, w, ne, se, sw, nw, all",minWidth:10,minHeight:10,maxWidth:10000,maxHeight:10000,edge:5,onStartResize:function(e){ -},onResize:function(e){ -},onStopResize:function(e){ -}}; -$.fn.resizable.isResizing=false; -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +$.fn.resizable=function(_1,_2){ +if(typeof _1=="string"){ +return $.fn.resizable.methods[_1](this,_2); +} +function _3(e){ +var _4=e.data; +var _5=$.data(_4.target,"resizable").options; +if(_4.dir.indexOf("e")!=-1){ +var _6=_4.startWidth+e.pageX-_4.startX; +_6=Math.min(Math.max(_6,_5.minWidth),_5.maxWidth); +_4.width=_6; +} +if(_4.dir.indexOf("s")!=-1){ +var _7=_4.startHeight+e.pageY-_4.startY; +_7=Math.min(Math.max(_7,_5.minHeight),_5.maxHeight); +_4.height=_7; +} +if(_4.dir.indexOf("w")!=-1){ +var _6=_4.startWidth-e.pageX+_4.startX; +_6=Math.min(Math.max(_6,_5.minWidth),_5.maxWidth); +_4.width=_6; +_4.left=_4.startLeft+_4.startWidth-_4.width; +} +if(_4.dir.indexOf("n")!=-1){ +var _7=_4.startHeight-e.pageY+_4.startY; +_7=Math.min(Math.max(_7,_5.minHeight),_5.maxHeight); +_4.height=_7; +_4.top=_4.startTop+_4.startHeight-_4.height; +} +}; +function _8(e){ +var _9=e.data; +var t=$(_9.target); +t.css({left:_9.left,top:_9.top}); +if(t.outerWidth()!=_9.width){ +t._outerWidth(_9.width); +} +if(t.outerHeight()!=_9.height){ +t._outerHeight(_9.height); +} +}; +function _a(e){ +$.fn.resizable.isResizing=true; +$.data(e.data.target,"resizable").options.onStartResize.call(e.data.target,e); +return false; +}; +function _b(e){ +_3(e); +if($.data(e.data.target,"resizable").options.onResize.call(e.data.target,e)!=false){ +_8(e); +} +return false; +}; +function _c(e){ +$.fn.resizable.isResizing=false; +_3(e,true); +_8(e); +$.data(e.data.target,"resizable").options.onStopResize.call(e.data.target,e); +$(document).unbind(".resizable"); +$("body").css("cursor",""); +return false; +}; +return this.each(function(){ +var _d=null; +var _e=$.data(this,"resizable"); +if(_e){ +$(this).unbind(".resizable"); +_d=$.extend(_e.options,_1||{}); +}else{ +_d=$.extend({},$.fn.resizable.defaults,$.fn.resizable.parseOptions(this),_1||{}); +$.data(this,"resizable",{options:_d}); +} +if(_d.disabled==true){ +return; +} +$(this).bind("mousemove.resizable",{target:this},function(e){ +if($.fn.resizable.isResizing){ +return; +} +var _f=_10(e); +if(_f==""){ +$(e.data.target).css("cursor",""); +}else{ +$(e.data.target).css("cursor",_f+"-resize"); +} +}).bind("mouseleave.resizable",{target:this},function(e){ +$(e.data.target).css("cursor",""); +}).bind("mousedown.resizable",{target:this},function(e){ +var dir=_10(e); +if(dir==""){ +return; +} +function _11(css){ +var val=parseInt($(e.data.target).css(css)); +if(isNaN(val)){ +return 0; +}else{ +return val; +} +}; +var _12={target:e.data.target,dir:dir,startLeft:_11("left"),startTop:_11("top"),left:_11("left"),top:_11("top"),startX:e.pageX,startY:e.pageY,startWidth:$(e.data.target).outerWidth(),startHeight:$(e.data.target).outerHeight(),width:$(e.data.target).outerWidth(),height:$(e.data.target).outerHeight(),deltaWidth:$(e.data.target).outerWidth()-$(e.data.target).width(),deltaHeight:$(e.data.target).outerHeight()-$(e.data.target).height()}; +$(document).bind("mousedown.resizable",_12,_a); +$(document).bind("mousemove.resizable",_12,_b); +$(document).bind("mouseup.resizable",_12,_c); +$("body").css("cursor",dir+"-resize"); +}); +function _10(e){ +var tt=$(e.data.target); +var dir=""; +var _13=tt.offset(); +var _14=tt.outerWidth(); +var _15=tt.outerHeight(); +var _16=_d.edge; +if(e.pageY>_13.top&&e.pageY<_13.top+_16){ +dir+="n"; +}else{ +if(e.pageY<_13.top+_15&&e.pageY>_13.top+_15-_16){ +dir+="s"; +} +} +if(e.pageX>_13.left&&e.pageX<_13.left+_16){ +dir+="w"; +}else{ +if(e.pageX<_13.left+_14&&e.pageX>_13.left+_14-_16){ +dir+="e"; +} +} +var _17=_d.handles.split(","); +for(var i=0;i<_17.length;i++){ +var _18=_17[i].replace(/(^\s*)|(\s*$)/g,""); +if(_18=="all"||_18==dir){ +return dir; +} +} +return ""; +}; +}); +}; +$.fn.resizable.methods={options:function(jq){ +return $.data(jq[0],"resizable").options; +},enable:function(jq){ +return jq.each(function(){ +$(this).resizable({disabled:false}); +}); +},disable:function(jq){ +return jq.each(function(){ +$(this).resizable({disabled:true}); +}); +}}; +$.fn.resizable.parseOptions=function(_19){ +var t=$(_19); +return $.extend({},$.parser.parseOptions(_19,["handles",{minWidth:"number",minHeight:"number",maxWidth:"number",maxHeight:"number",edge:"number"}]),{disabled:(t.attr("disabled")?true:undefined)}); +}; +$.fn.resizable.defaults={disabled:false,handles:"n, e, s, w, ne, se, sw, nw, all",minWidth:10,minHeight:10,maxWidth:10000,maxHeight:10000,edge:5,onStartResize:function(e){ +},onResize:function(e){ +},onStopResize:function(e){ +}}; +$.fn.resizable.isResizing=false; +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.searchbox.js b/assets/js/easy-ui/plugins/jquery.searchbox.js index 3b36649aad..b9de55731e 100755 --- a/assets/js/easy-ui/plugins/jquery.searchbox.js +++ b/assets/js/easy-ui/plugins/jquery.searchbox.js @@ -1,132 +1,132 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(_2){ -var _3=$.data(_2,"searchbox"); -var _4=_3.options; -var _5=$.extend(true,[],_4.icons); -_5.push({iconCls:"searchbox-button",handler:function(e){ -var t=$(e.data.target); -var _6=t.searchbox("options"); -_6.searcher.call(e.data.target,t.searchbox("getValue"),t.searchbox("getName")); -}}); -_7(); -var _8=_9(); -$(_2).addClass("searchbox-f").textbox($.extend({},_4,{icons:_5,buttonText:(_8?_8.text:"")})); -$(_2).attr("searchboxName",$(_2).attr("textboxName")); -_3.searchbox=$(_2).next(); -_3.searchbox.addClass("searchbox"); -_a(_8); -function _7(){ -if(_4.menu){ -_3.menu=$(_4.menu).menu(); -var _b=_3.menu.menu("options"); -var _c=_b.onClick; -_b.onClick=function(_d){ -_a(_d); -_c.call(this,_d); -}; -}else{ -if(_3.menu){ -_3.menu.menu("destroy"); -} -_3.menu=null; -} -}; -function _9(){ -if(_3.menu){ -var _e=_3.menu.children("div.menu-item:first"); -_3.menu.children("div.menu-item").each(function(){ -var _f=$.extend({},$.parser.parseOptions(this),{selected:($(this).attr("selected")?true:undefined)}); -if(_f.selected){ -_e=$(this); -return false; -} -}); -return _3.menu.menu("getItem",_e[0]); -}else{ -return null; -} -}; -function _a(_10){ -if(!_10){ -return; -} -$(_2).textbox("button").menubutton({text:_10.text,iconCls:(_10.iconCls||null),menu:_3.menu,menuAlign:_4.buttonAlign,plain:false}); -_3.searchbox.find("input.textbox-value").attr("name",_10.name||_10.text); -$(_2).searchbox("resize"); -}; -}; -$.fn.searchbox=function(_11,_12){ -if(typeof _11=="string"){ -var _13=$.fn.searchbox.methods[_11]; -if(_13){ -return _13(this,_12); -}else{ -return this.textbox(_11,_12); -} -} -_11=_11||{}; -return this.each(function(){ -var _14=$.data(this,"searchbox"); -if(_14){ -$.extend(_14.options,_11); -}else{ -$.data(this,"searchbox",{options:$.extend({},$.fn.searchbox.defaults,$.fn.searchbox.parseOptions(this),_11)}); -} -_1(this); -}); -}; -$.fn.searchbox.methods={options:function(jq){ -var _15=jq.textbox("options"); -return $.extend($.data(jq[0],"searchbox").options,{width:_15.width,value:_15.value,originalValue:_15.originalValue,disabled:_15.disabled,readonly:_15.readonly}); -},menu:function(jq){ -return $.data(jq[0],"searchbox").menu; -},getName:function(jq){ -return $.data(jq[0],"searchbox").searchbox.find("input.textbox-value").attr("name"); -},selectName:function(jq,_16){ -return jq.each(function(){ -var _17=$.data(this,"searchbox").menu; -if(_17){ -_17.children("div.menu-item").each(function(){ -var _18=_17.menu("getItem",this); -if(_18.name==_16){ -$(this).triggerHandler("click"); -return false; -} -}); -} -}); -},destroy:function(jq){ -return jq.each(function(){ -var _19=$(this).searchbox("menu"); -if(_19){ -_19.menu("destroy"); -} -$(this).textbox("destroy"); -}); -}}; -$.fn.searchbox.parseOptions=function(_1a){ -var t=$(_1a); -return $.extend({},$.fn.textbox.parseOptions(_1a),$.parser.parseOptions(_1a,["menu"]),{searcher:(t.attr("searcher")?eval(t.attr("searcher")):undefined)}); -}; -$.fn.searchbox.defaults=$.extend({},$.fn.textbox.defaults,{inputEvents:$.extend({},$.fn.textbox.defaults.inputEvents,{keydown:function(e){ -if(e.keyCode==13){ -e.preventDefault(); -var t=$(e.data.target); -var _1b=t.searchbox("options"); -t.searchbox("setValue",$(this).val()); -_1b.searcher.call(e.data.target,t.searchbox("getValue"),t.searchbox("getName")); -return false; -} -}}),buttonAlign:"left",menu:null,searcher:function(_1c,_1d){ -}}); -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(_2){ +var _3=$.data(_2,"searchbox"); +var _4=_3.options; +var _5=$.extend(true,[],_4.icons); +_5.push({iconCls:"searchbox-button",handler:function(e){ +var t=$(e.data.target); +var _6=t.searchbox("options"); +_6.searcher.call(e.data.target,t.searchbox("getValue"),t.searchbox("getName")); +}}); +_7(); +var _8=_9(); +$(_2).addClass("searchbox-f").textbox($.extend({},_4,{icons:_5,buttonText:(_8?_8.text:"")})); +$(_2).attr("searchboxName",$(_2).attr("textboxName")); +_3.searchbox=$(_2).next(); +_3.searchbox.addClass("searchbox"); +_a(_8); +function _7(){ +if(_4.menu){ +_3.menu=$(_4.menu).menu(); +var _b=_3.menu.menu("options"); +var _c=_b.onClick; +_b.onClick=function(_d){ +_a(_d); +_c.call(this,_d); +}; +}else{ +if(_3.menu){ +_3.menu.menu("destroy"); +} +_3.menu=null; +} +}; +function _9(){ +if(_3.menu){ +var _e=_3.menu.children("div.menu-item:first"); +_3.menu.children("div.menu-item").each(function(){ +var _f=$.extend({},$.parser.parseOptions(this),{selected:($(this).attr("selected")?true:undefined)}); +if(_f.selected){ +_e=$(this); +return false; +} +}); +return _3.menu.menu("getItem",_e[0]); +}else{ +return null; +} +}; +function _a(_10){ +if(!_10){ +return; +} +$(_2).textbox("button").menubutton({text:_10.text,iconCls:(_10.iconCls||null),menu:_3.menu,menuAlign:_4.buttonAlign,plain:false}); +_3.searchbox.find("input.textbox-value").attr("name",_10.name||_10.text); +$(_2).searchbox("resize"); +}; +}; +$.fn.searchbox=function(_11,_12){ +if(typeof _11=="string"){ +var _13=$.fn.searchbox.methods[_11]; +if(_13){ +return _13(this,_12); +}else{ +return this.textbox(_11,_12); +} +} +_11=_11||{}; +return this.each(function(){ +var _14=$.data(this,"searchbox"); +if(_14){ +$.extend(_14.options,_11); +}else{ +$.data(this,"searchbox",{options:$.extend({},$.fn.searchbox.defaults,$.fn.searchbox.parseOptions(this),_11)}); +} +_1(this); +}); +}; +$.fn.searchbox.methods={options:function(jq){ +var _15=jq.textbox("options"); +return $.extend($.data(jq[0],"searchbox").options,{width:_15.width,value:_15.value,originalValue:_15.originalValue,disabled:_15.disabled,readonly:_15.readonly}); +},menu:function(jq){ +return $.data(jq[0],"searchbox").menu; +},getName:function(jq){ +return $.data(jq[0],"searchbox").searchbox.find("input.textbox-value").attr("name"); +},selectName:function(jq,_16){ +return jq.each(function(){ +var _17=$.data(this,"searchbox").menu; +if(_17){ +_17.children("div.menu-item").each(function(){ +var _18=_17.menu("getItem",this); +if(_18.name==_16){ +$(this).triggerHandler("click"); +return false; +} +}); +} +}); +},destroy:function(jq){ +return jq.each(function(){ +var _19=$(this).searchbox("menu"); +if(_19){ +_19.menu("destroy"); +} +$(this).textbox("destroy"); +}); +}}; +$.fn.searchbox.parseOptions=function(_1a){ +var t=$(_1a); +return $.extend({},$.fn.textbox.parseOptions(_1a),$.parser.parseOptions(_1a,["menu"]),{searcher:(t.attr("searcher")?eval(t.attr("searcher")):undefined)}); +}; +$.fn.searchbox.defaults=$.extend({},$.fn.textbox.defaults,{inputEvents:$.extend({},$.fn.textbox.defaults.inputEvents,{keydown:function(e){ +if(e.keyCode==13){ +e.preventDefault(); +var t=$(e.data.target); +var _1b=t.searchbox("options"); +t.searchbox("setValue",$(this).val()); +_1b.searcher.call(e.data.target,t.searchbox("getValue"),t.searchbox("getName")); +return false; +} +}}),buttonAlign:"left",menu:null,searcher:function(_1c,_1d){ +}}); +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.slider.js b/assets/js/easy-ui/plugins/jquery.slider.js index 536c272547..59ef1a467a 100755 --- a/assets/js/easy-ui/plugins/jquery.slider.js +++ b/assets/js/easy-ui/plugins/jquery.slider.js @@ -1,339 +1,339 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(_2){ -var _3=$("
"+"
"+""+""+"
"+"
"+"
"+"
"+""+"
").insertAfter(_2); -var t=$(_2); -t.addClass("slider-f").hide(); -var _4=t.attr("name"); -if(_4){ -_3.find("input.slider-value").attr("name",_4); -t.removeAttr("name").attr("sliderName",_4); -} -_3.bind("_resize",function(e,_5){ -if($(this).hasClass("easyui-fluid")||_5){ -_6(_2); -} -return false; -}); -return _3; -}; -function _6(_7,_8){ -var _9=$.data(_7,"slider"); -var _a=_9.options; -var _b=_9.slider; -if(_8){ -if(_8.width){ -_a.width=_8.width; -} -if(_8.height){ -_a.height=_8.height; -} -} -_b._size(_a); -if(_a.mode=="h"){ -_b.css("height",""); -_b.children("div").css("height",""); -}else{ -_b.css("width",""); -_b.children("div").css("width",""); -_b.children("div.slider-rule,div.slider-rulelabel,div.slider-inner")._outerHeight(_b._outerHeight()); -} -_c(_7); -}; -function _d(_e){ -var _f=$.data(_e,"slider"); -var _10=_f.options; -var _11=_f.slider; -var aa=_10.mode=="h"?_10.rule:_10.rule.slice(0).reverse(); -if(_10.reversed){ -aa=aa.slice(0).reverse(); -} -_12(aa); -function _12(aa){ -var _13=_11.find("div.slider-rule"); -var _14=_11.find("div.slider-rulelabel"); -_13.empty(); -_14.empty(); -for(var i=0;i").appendTo(_13); -_16.css((_10.mode=="h"?"left":"top"),_15); -if(aa[i]!="|"){ -_16=$("").appendTo(_14); -_16.html(aa[i]); -if(_10.mode=="h"){ -_16.css({left:_15,marginLeft:-Math.round(_16.outerWidth()/2)}); -}else{ -_16.css({top:_15,marginTop:-Math.round(_16.outerHeight()/2)}); -} -} -} -}; -}; -function _17(_18){ -var _19=$.data(_18,"slider"); -var _1a=_19.options; -var _1b=_19.slider; -_1b.removeClass("slider-h slider-v slider-disabled"); -_1b.addClass(_1a.mode=="h"?"slider-h":"slider-v"); -_1b.addClass(_1a.disabled?"slider-disabled":""); -var _1c=_1b.find(".slider-inner"); -_1c.html(""+""); -if(_1a.range){ -_1c.append(""+""); -} -_1b.find("a.slider-handle").draggable({axis:_1a.mode,cursor:"pointer",disabled:_1a.disabled,onDrag:function(e){ -var _1d=e.data.left; -var _1e=_1b.width(); -if(_1a.mode!="h"){ -_1d=e.data.top; -_1e=_1b.height(); -} -if(_1d<0||_1d>_1e){ -return false; -}else{ -_1f(_1d,this); -return false; -} -},onStartDrag:function(){ -_19.isDragging=true; -_1a.onSlideStart.call(_18,_1a.value); -},onStopDrag:function(e){ -_1f(_1a.mode=="h"?e.data.left:e.data.top,this); -_1a.onSlideEnd.call(_18,_1a.value); -_1a.onComplete.call(_18,_1a.value); -_19.isDragging=false; -}}); -_1b.find("div.slider-inner").unbind(".slider").bind("mousedown.slider",function(e){ -if(_19.isDragging||_1a.disabled){ -return; -} -var pos=$(this).offset(); -_1f(_1a.mode=="h"?(e.pageX-pos.left):(e.pageY-pos.top)); -_1a.onComplete.call(_18,_1a.value); -}); -function _1f(pos,_20){ -var _21=_22(_18,pos); -var s=Math.abs(_21%_1a.step); -if(s<_1a.step/2){ -_21-=s; -}else{ -_21=_21-s+_1a.step; -} -if(_1a.range){ -var v1=_1a.value[0]; -var v2=_1a.value[1]; -var m=parseFloat((v1+v2)/2); -if(_20){ -var _23=$(_20).nextAll(".slider-handle").length>0; -if(_21<=v2&&_23){ -v1=_21; -}else{ -if(_21>=v1&&(!_23)){ -v2=_21; -} -} -}else{ -if(_21v2){ -v2=_21; -}else{ -_21_28.max){ -_2d=_28.max; -} -var _2e=$("").appendTo(_29); -_2e.attr("name",_2c); -_2e.val(_2d); -_2b.push(_2d); -var _2f=_29.find(".slider-handle:eq("+i+")"); -var tip=_2f.next(); -var pos=_30(_25,_2d); -if(_28.showTip){ -tip.show(); -tip.html(_28.tipFormatter.call(_25,_2d)); -}else{ -tip.hide(); -} -if(_28.mode=="h"){ -var _31="left:"+pos+"px;"; -_2f.attr("style",_31); -tip.attr("style",_31+"margin-left:"+(-Math.round(tip.outerWidth()/2))+"px"); -}else{ -var _31="top:"+pos+"px;"; -_2f.attr("style",_31); -tip.attr("style",_31+"margin-left:"+(-Math.round(tip.outerWidth()))+"px"); -} -} -_28.value=_28.range?_2b:_2b[0]; -$(_25).val(_28.range?_2b.join(_28.separator):_2b[0]); -if(_2a.join(",")!=_2b.join(",")){ -_28.onChange.call(_25,_28.value,(_28.range?_2a:_2a[0])); -} -}; -function _c(_32){ -var _33=$.data(_32,"slider").options; -var fn=_33.onChange; -_33.onChange=function(){ -}; -_24(_32,_33.value); -_33.onChange=fn; -}; -function _30(_34,_35){ -var _36=$.data(_34,"slider"); -var _37=_36.options; -var _38=_36.slider; -var _39=_37.mode=="h"?_38.width():_38.height(); -var pos=_37.converter.toPosition.call(_34,_35,_39); -if(_37.mode=="v"){ -pos=_38.height()-pos; -} -if(_37.reversed){ -pos=_39-pos; -} -return pos.toFixed(0); -}; -function _22(_3a,pos){ -var _3b=$.data(_3a,"slider"); -var _3c=_3b.options; -var _3d=_3b.slider; -var _3e=_3c.mode=="h"?_3d.width():_3d.height(); -var pos=_3c.mode=="h"?(_3c.reversed?(_3e-pos):pos):(_3c.reversed?pos:(_3e-pos)); -var _3f=_3c.converter.toValue.call(_3a,pos,_3e); -return _3f.toFixed(0); -}; -$.fn.slider=function(_40,_41){ -if(typeof _40=="string"){ -return $.fn.slider.methods[_40](this,_41); -} -_40=_40||{}; -return this.each(function(){ -var _42=$.data(this,"slider"); -if(_42){ -$.extend(_42.options,_40); -}else{ -_42=$.data(this,"slider",{options:$.extend({},$.fn.slider.defaults,$.fn.slider.parseOptions(this),_40),slider:_1(this)}); -$(this).removeAttr("disabled"); -} -var _43=_42.options; -_43.min=parseFloat(_43.min); -_43.max=parseFloat(_43.max); -if(_43.range){ -if(!$.isArray(_43.value)){ -_43.value=$.map(String(_43.value).split(_43.separator),function(v){ -return parseFloat(v); -}); -} -if(_43.value.length<2){ -_43.value.push(_43.max); -} -}else{ -_43.value=parseFloat(_43.value); -} -_43.step=parseFloat(_43.step); -_43.originalValue=_43.value; -_17(this); -_d(this); -_6(this); -}); -}; -$.fn.slider.methods={options:function(jq){ -return $.data(jq[0],"slider").options; -},destroy:function(jq){ -return jq.each(function(){ -$.data(this,"slider").slider.remove(); -$(this).remove(); -}); -},resize:function(jq,_44){ -return jq.each(function(){ -_6(this,_44); -}); -},getValue:function(jq){ -return jq.slider("options").value; -},getValues:function(jq){ -return jq.slider("options").value; -},setValue:function(jq,_45){ -return jq.each(function(){ -_24(this,[_45]); -}); -},setValues:function(jq,_46){ -return jq.each(function(){ -_24(this,_46); -}); -},clear:function(jq){ -return jq.each(function(){ -var _47=$(this).slider("options"); -_24(this,_47.range?[_47.min,_47.max]:[_47.min]); -}); -},reset:function(jq){ -return jq.each(function(){ -var _48=$(this).slider("options"); -$(this).slider(_48.range?"setValues":"setValue",_48.originalValue); -}); -},enable:function(jq){ -return jq.each(function(){ -$.data(this,"slider").options.disabled=false; -_17(this); -}); -},disable:function(jq){ -return jq.each(function(){ -$.data(this,"slider").options.disabled=true; -_17(this); -}); -}}; -$.fn.slider.parseOptions=function(_49){ -var t=$(_49); -return $.extend({},$.parser.parseOptions(_49,["width","height","mode",{reversed:"boolean",showTip:"boolean",range:"boolean",min:"number",max:"number",step:"number"}]),{value:(t.val()||undefined),disabled:(t.attr("disabled")?true:undefined),rule:(t.attr("rule")?eval(t.attr("rule")):undefined)}); -}; -$.fn.slider.defaults={width:"auto",height:"auto",mode:"h",reversed:false,showTip:false,disabled:false,range:false,value:0,separator:",",min:0,max:100,step:1,rule:[],tipFormatter:function(_4a){ -return _4a; -},converter:{toPosition:function(_4b,_4c){ -var _4d=$(this).slider("options"); -return (_4b-_4d.min)/(_4d.max-_4d.min)*_4c; -},toValue:function(pos,_4e){ -var _4f=$(this).slider("options"); -return _4f.min+(_4f.max-_4f.min)*(pos/_4e); -}},onChange:function(_50,_51){ -},onSlideStart:function(_52){ -},onSlideEnd:function(_53){ -},onComplete:function(_54){ -}}; -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(_2){ +var _3=$("
"+"
"+""+""+"
"+"
"+"
"+"
"+""+"
").insertAfter(_2); +var t=$(_2); +t.addClass("slider-f").hide(); +var _4=t.attr("name"); +if(_4){ +_3.find("input.slider-value").attr("name",_4); +t.removeAttr("name").attr("sliderName",_4); +} +_3.bind("_resize",function(e,_5){ +if($(this).hasClass("easyui-fluid")||_5){ +_6(_2); +} +return false; +}); +return _3; +}; +function _6(_7,_8){ +var _9=$.data(_7,"slider"); +var _a=_9.options; +var _b=_9.slider; +if(_8){ +if(_8.width){ +_a.width=_8.width; +} +if(_8.height){ +_a.height=_8.height; +} +} +_b._size(_a); +if(_a.mode=="h"){ +_b.css("height",""); +_b.children("div").css("height",""); +}else{ +_b.css("width",""); +_b.children("div").css("width",""); +_b.children("div.slider-rule,div.slider-rulelabel,div.slider-inner")._outerHeight(_b._outerHeight()); +} +_c(_7); +}; +function _d(_e){ +var _f=$.data(_e,"slider"); +var _10=_f.options; +var _11=_f.slider; +var aa=_10.mode=="h"?_10.rule:_10.rule.slice(0).reverse(); +if(_10.reversed){ +aa=aa.slice(0).reverse(); +} +_12(aa); +function _12(aa){ +var _13=_11.find("div.slider-rule"); +var _14=_11.find("div.slider-rulelabel"); +_13.empty(); +_14.empty(); +for(var i=0;i").appendTo(_13); +_16.css((_10.mode=="h"?"left":"top"),_15); +if(aa[i]!="|"){ +_16=$("").appendTo(_14); +_16.html(aa[i]); +if(_10.mode=="h"){ +_16.css({left:_15,marginLeft:-Math.round(_16.outerWidth()/2)}); +}else{ +_16.css({top:_15,marginTop:-Math.round(_16.outerHeight()/2)}); +} +} +} +}; +}; +function _17(_18){ +var _19=$.data(_18,"slider"); +var _1a=_19.options; +var _1b=_19.slider; +_1b.removeClass("slider-h slider-v slider-disabled"); +_1b.addClass(_1a.mode=="h"?"slider-h":"slider-v"); +_1b.addClass(_1a.disabled?"slider-disabled":""); +var _1c=_1b.find(".slider-inner"); +_1c.html(""+""); +if(_1a.range){ +_1c.append(""+""); +} +_1b.find("a.slider-handle").draggable({axis:_1a.mode,cursor:"pointer",disabled:_1a.disabled,onDrag:function(e){ +var _1d=e.data.left; +var _1e=_1b.width(); +if(_1a.mode!="h"){ +_1d=e.data.top; +_1e=_1b.height(); +} +if(_1d<0||_1d>_1e){ +return false; +}else{ +_1f(_1d,this); +return false; +} +},onStartDrag:function(){ +_19.isDragging=true; +_1a.onSlideStart.call(_18,_1a.value); +},onStopDrag:function(e){ +_1f(_1a.mode=="h"?e.data.left:e.data.top,this); +_1a.onSlideEnd.call(_18,_1a.value); +_1a.onComplete.call(_18,_1a.value); +_19.isDragging=false; +}}); +_1b.find("div.slider-inner").unbind(".slider").bind("mousedown.slider",function(e){ +if(_19.isDragging||_1a.disabled){ +return; +} +var pos=$(this).offset(); +_1f(_1a.mode=="h"?(e.pageX-pos.left):(e.pageY-pos.top)); +_1a.onComplete.call(_18,_1a.value); +}); +function _1f(pos,_20){ +var _21=_22(_18,pos); +var s=Math.abs(_21%_1a.step); +if(s<_1a.step/2){ +_21-=s; +}else{ +_21=_21-s+_1a.step; +} +if(_1a.range){ +var v1=_1a.value[0]; +var v2=_1a.value[1]; +var m=parseFloat((v1+v2)/2); +if(_20){ +var _23=$(_20).nextAll(".slider-handle").length>0; +if(_21<=v2&&_23){ +v1=_21; +}else{ +if(_21>=v1&&(!_23)){ +v2=_21; +} +} +}else{ +if(_21v2){ +v2=_21; +}else{ +_21_28.max){ +_2d=_28.max; +} +var _2e=$("").appendTo(_29); +_2e.attr("name",_2c); +_2e.val(_2d); +_2b.push(_2d); +var _2f=_29.find(".slider-handle:eq("+i+")"); +var tip=_2f.next(); +var pos=_30(_25,_2d); +if(_28.showTip){ +tip.show(); +tip.html(_28.tipFormatter.call(_25,_2d)); +}else{ +tip.hide(); +} +if(_28.mode=="h"){ +var _31="left:"+pos+"px;"; +_2f.attr("style",_31); +tip.attr("style",_31+"margin-left:"+(-Math.round(tip.outerWidth()/2))+"px"); +}else{ +var _31="top:"+pos+"px;"; +_2f.attr("style",_31); +tip.attr("style",_31+"margin-left:"+(-Math.round(tip.outerWidth()))+"px"); +} +} +_28.value=_28.range?_2b:_2b[0]; +$(_25).val(_28.range?_2b.join(_28.separator):_2b[0]); +if(_2a.join(",")!=_2b.join(",")){ +_28.onChange.call(_25,_28.value,(_28.range?_2a:_2a[0])); +} +}; +function _c(_32){ +var _33=$.data(_32,"slider").options; +var fn=_33.onChange; +_33.onChange=function(){ +}; +_24(_32,_33.value); +_33.onChange=fn; +}; +function _30(_34,_35){ +var _36=$.data(_34,"slider"); +var _37=_36.options; +var _38=_36.slider; +var _39=_37.mode=="h"?_38.width():_38.height(); +var pos=_37.converter.toPosition.call(_34,_35,_39); +if(_37.mode=="v"){ +pos=_38.height()-pos; +} +if(_37.reversed){ +pos=_39-pos; +} +return pos.toFixed(0); +}; +function _22(_3a,pos){ +var _3b=$.data(_3a,"slider"); +var _3c=_3b.options; +var _3d=_3b.slider; +var _3e=_3c.mode=="h"?_3d.width():_3d.height(); +var pos=_3c.mode=="h"?(_3c.reversed?(_3e-pos):pos):(_3c.reversed?pos:(_3e-pos)); +var _3f=_3c.converter.toValue.call(_3a,pos,_3e); +return _3f.toFixed(0); +}; +$.fn.slider=function(_40,_41){ +if(typeof _40=="string"){ +return $.fn.slider.methods[_40](this,_41); +} +_40=_40||{}; +return this.each(function(){ +var _42=$.data(this,"slider"); +if(_42){ +$.extend(_42.options,_40); +}else{ +_42=$.data(this,"slider",{options:$.extend({},$.fn.slider.defaults,$.fn.slider.parseOptions(this),_40),slider:_1(this)}); +$(this).removeAttr("disabled"); +} +var _43=_42.options; +_43.min=parseFloat(_43.min); +_43.max=parseFloat(_43.max); +if(_43.range){ +if(!$.isArray(_43.value)){ +_43.value=$.map(String(_43.value).split(_43.separator),function(v){ +return parseFloat(v); +}); +} +if(_43.value.length<2){ +_43.value.push(_43.max); +} +}else{ +_43.value=parseFloat(_43.value); +} +_43.step=parseFloat(_43.step); +_43.originalValue=_43.value; +_17(this); +_d(this); +_6(this); +}); +}; +$.fn.slider.methods={options:function(jq){ +return $.data(jq[0],"slider").options; +},destroy:function(jq){ +return jq.each(function(){ +$.data(this,"slider").slider.remove(); +$(this).remove(); +}); +},resize:function(jq,_44){ +return jq.each(function(){ +_6(this,_44); +}); +},getValue:function(jq){ +return jq.slider("options").value; +},getValues:function(jq){ +return jq.slider("options").value; +},setValue:function(jq,_45){ +return jq.each(function(){ +_24(this,[_45]); +}); +},setValues:function(jq,_46){ +return jq.each(function(){ +_24(this,_46); +}); +},clear:function(jq){ +return jq.each(function(){ +var _47=$(this).slider("options"); +_24(this,_47.range?[_47.min,_47.max]:[_47.min]); +}); +},reset:function(jq){ +return jq.each(function(){ +var _48=$(this).slider("options"); +$(this).slider(_48.range?"setValues":"setValue",_48.originalValue); +}); +},enable:function(jq){ +return jq.each(function(){ +$.data(this,"slider").options.disabled=false; +_17(this); +}); +},disable:function(jq){ +return jq.each(function(){ +$.data(this,"slider").options.disabled=true; +_17(this); +}); +}}; +$.fn.slider.parseOptions=function(_49){ +var t=$(_49); +return $.extend({},$.parser.parseOptions(_49,["width","height","mode",{reversed:"boolean",showTip:"boolean",range:"boolean",min:"number",max:"number",step:"number"}]),{value:(t.val()||undefined),disabled:(t.attr("disabled")?true:undefined),rule:(t.attr("rule")?eval(t.attr("rule")):undefined)}); +}; +$.fn.slider.defaults={width:"auto",height:"auto",mode:"h",reversed:false,showTip:false,disabled:false,range:false,value:0,separator:",",min:0,max:100,step:1,rule:[],tipFormatter:function(_4a){ +return _4a; +},converter:{toPosition:function(_4b,_4c){ +var _4d=$(this).slider("options"); +return (_4b-_4d.min)/(_4d.max-_4d.min)*_4c; +},toValue:function(pos,_4e){ +var _4f=$(this).slider("options"); +return _4f.min+(_4f.max-_4f.min)*(pos/_4e); +}},onChange:function(_50,_51){ +},onSlideStart:function(_52){ +},onSlideEnd:function(_53){ +},onComplete:function(_54){ +}}; +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.spinner.js b/assets/js/easy-ui/plugins/jquery.spinner.js index 82644ef711..fc9cfe7a69 100755 --- a/assets/js/easy-ui/plugins/jquery.spinner.js +++ b/assets/js/easy-ui/plugins/jquery.spinner.js @@ -1,129 +1,129 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(_2){ -var _3=$.data(_2,"spinner"); -var _4=_3.options; -var _5=$.extend(true,[],_4.icons); -if(_4.spinAlign=="left"||_4.spinAlign=="right"){ -_4.spinArrow=true; -_4.iconAlign=_4.spinAlign; -var _6={iconCls:"spinner-arrow",handler:function(e){ -var _7=$(e.target).closest(".spinner-arrow-up,.spinner-arrow-down"); -_13(e.data.target,_7.hasClass("spinner-arrow-down")); -}}; -if(_4.spinAlign=="left"){ -_5.unshift(_6); -}else{ -_5.push(_6); -} -}else{ -_4.spinArrow=false; -if(_4.spinAlign=="vertical"){ -if(_4.buttonAlign!="top"){ -_4.buttonAlign="bottom"; -} -_4.clsLeft="textbox-button-bottom"; -_4.clsRight="textbox-button-top"; -}else{ -_4.clsLeft="textbox-button-left"; -_4.clsRight="textbox-button-right"; -} -} -$(_2).addClass("spinner-f").textbox($.extend({},_4,{icons:_5,doSize:false,onResize:function(_8,_9){ -if(!_4.spinArrow){ -var _a=$(this).next(); -var _b=_a.find(".textbox-button:not(.spinner-button)"); -if(_b.length){ -var _c=_b.outerWidth(); -var _d=_b.outerHeight(); -var _e=_a.find(".spinner-button."+_4.clsLeft); -var _f=_a.find(".spinner-button."+_4.clsRight); -if(_4.buttonAlign=="right"){ -_f.css("marginRight",_c+"px"); -}else{ -if(_4.buttonAlign=="left"){ -_e.css("marginLeft",_c+"px"); -}else{ -if(_4.buttonAlign=="top"){ -_f.css("marginTop",_d+"px"); -}else{ -_e.css("marginBottom",_d+"px"); -} -} -} -} -} -_4.onResize.call(this,_8,_9); -}})); -$(_2).attr("spinnerName",$(_2).attr("textboxName")); -_3.spinner=$(_2).next(); -_3.spinner.addClass("spinner"); -if(_4.spinArrow){ -var _10=_3.spinner.find(".spinner-arrow"); -_10.append(""); -_10.append(""); -}else{ -var _11=$("").addClass(_4.clsLeft).appendTo(_3.spinner); -var _12=$("").addClass(_4.clsRight).appendTo(_3.spinner); -_11.linkbutton({iconCls:_4.reversed?"spinner-button-up":"spinner-button-down",onClick:function(){ -_13(_2,!_4.reversed); -}}); -_12.linkbutton({iconCls:_4.reversed?"spinner-button-down":"spinner-button-up",onClick:function(){ -_13(_2,_4.reversed); -}}); -if(_4.disabled){ -$(_2).spinner("disable"); -} -if(_4.readonly){ -$(_2).spinner("readonly"); -} -} -$(_2).spinner("resize"); -}; -function _13(_14,_15){ -var _16=$(_14).spinner("options"); -_16.spin.call(_14,_15); -_16[_15?"onSpinDown":"onSpinUp"].call(_14); -$(_14).spinner("validate"); -}; -$.fn.spinner=function(_17,_18){ -if(typeof _17=="string"){ -var _19=$.fn.spinner.methods[_17]; -if(_19){ -return _19(this,_18); -}else{ -return this.textbox(_17,_18); -} -} -_17=_17||{}; -return this.each(function(){ -var _1a=$.data(this,"spinner"); -if(_1a){ -$.extend(_1a.options,_17); -}else{ -_1a=$.data(this,"spinner",{options:$.extend({},$.fn.spinner.defaults,$.fn.spinner.parseOptions(this),_17)}); -} -_1(this); -}); -}; -$.fn.spinner.methods={options:function(jq){ -var _1b=jq.textbox("options"); -return $.extend($.data(jq[0],"spinner").options,{width:_1b.width,value:_1b.value,originalValue:_1b.originalValue,disabled:_1b.disabled,readonly:_1b.readonly}); -}}; -$.fn.spinner.parseOptions=function(_1c){ -return $.extend({},$.fn.textbox.parseOptions(_1c),$.parser.parseOptions(_1c,["min","max","spinAlign",{increment:"number",reversed:"boolean"}])); -}; -$.fn.spinner.defaults=$.extend({},$.fn.textbox.defaults,{min:null,max:null,increment:1,spinAlign:"right",reversed:false,spin:function(_1d){ -},onSpinUp:function(){ -},onSpinDown:function(){ -}}); -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(_2){ +var _3=$.data(_2,"spinner"); +var _4=_3.options; +var _5=$.extend(true,[],_4.icons); +if(_4.spinAlign=="left"||_4.spinAlign=="right"){ +_4.spinArrow=true; +_4.iconAlign=_4.spinAlign; +var _6={iconCls:"spinner-arrow",handler:function(e){ +var _7=$(e.target).closest(".spinner-arrow-up,.spinner-arrow-down"); +_13(e.data.target,_7.hasClass("spinner-arrow-down")); +}}; +if(_4.spinAlign=="left"){ +_5.unshift(_6); +}else{ +_5.push(_6); +} +}else{ +_4.spinArrow=false; +if(_4.spinAlign=="vertical"){ +if(_4.buttonAlign!="top"){ +_4.buttonAlign="bottom"; +} +_4.clsLeft="textbox-button-bottom"; +_4.clsRight="textbox-button-top"; +}else{ +_4.clsLeft="textbox-button-left"; +_4.clsRight="textbox-button-right"; +} +} +$(_2).addClass("spinner-f").textbox($.extend({},_4,{icons:_5,doSize:false,onResize:function(_8,_9){ +if(!_4.spinArrow){ +var _a=$(this).next(); +var _b=_a.find(".textbox-button:not(.spinner-button)"); +if(_b.length){ +var _c=_b.outerWidth(); +var _d=_b.outerHeight(); +var _e=_a.find(".spinner-button."+_4.clsLeft); +var _f=_a.find(".spinner-button."+_4.clsRight); +if(_4.buttonAlign=="right"){ +_f.css("marginRight",_c+"px"); +}else{ +if(_4.buttonAlign=="left"){ +_e.css("marginLeft",_c+"px"); +}else{ +if(_4.buttonAlign=="top"){ +_f.css("marginTop",_d+"px"); +}else{ +_e.css("marginBottom",_d+"px"); +} +} +} +} +} +_4.onResize.call(this,_8,_9); +}})); +$(_2).attr("spinnerName",$(_2).attr("textboxName")); +_3.spinner=$(_2).next(); +_3.spinner.addClass("spinner"); +if(_4.spinArrow){ +var _10=_3.spinner.find(".spinner-arrow"); +_10.append(""); +_10.append(""); +}else{ +var _11=$("").addClass(_4.clsLeft).appendTo(_3.spinner); +var _12=$("").addClass(_4.clsRight).appendTo(_3.spinner); +_11.linkbutton({iconCls:_4.reversed?"spinner-button-up":"spinner-button-down",onClick:function(){ +_13(_2,!_4.reversed); +}}); +_12.linkbutton({iconCls:_4.reversed?"spinner-button-down":"spinner-button-up",onClick:function(){ +_13(_2,_4.reversed); +}}); +if(_4.disabled){ +$(_2).spinner("disable"); +} +if(_4.readonly){ +$(_2).spinner("readonly"); +} +} +$(_2).spinner("resize"); +}; +function _13(_14,_15){ +var _16=$(_14).spinner("options"); +_16.spin.call(_14,_15); +_16[_15?"onSpinDown":"onSpinUp"].call(_14); +$(_14).spinner("validate"); +}; +$.fn.spinner=function(_17,_18){ +if(typeof _17=="string"){ +var _19=$.fn.spinner.methods[_17]; +if(_19){ +return _19(this,_18); +}else{ +return this.textbox(_17,_18); +} +} +_17=_17||{}; +return this.each(function(){ +var _1a=$.data(this,"spinner"); +if(_1a){ +$.extend(_1a.options,_17); +}else{ +_1a=$.data(this,"spinner",{options:$.extend({},$.fn.spinner.defaults,$.fn.spinner.parseOptions(this),_17)}); +} +_1(this); +}); +}; +$.fn.spinner.methods={options:function(jq){ +var _1b=jq.textbox("options"); +return $.extend($.data(jq[0],"spinner").options,{width:_1b.width,value:_1b.value,originalValue:_1b.originalValue,disabled:_1b.disabled,readonly:_1b.readonly}); +}}; +$.fn.spinner.parseOptions=function(_1c){ +return $.extend({},$.fn.textbox.parseOptions(_1c),$.parser.parseOptions(_1c,["min","max","spinAlign",{increment:"number",reversed:"boolean"}])); +}; +$.fn.spinner.defaults=$.extend({},$.fn.textbox.defaults,{min:null,max:null,increment:1,spinAlign:"right",reversed:false,spin:function(_1d){ +},onSpinUp:function(){ +},onSpinDown:function(){ +}}); +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.splitbutton.js b/assets/js/easy-ui/plugins/jquery.splitbutton.js index 06c7602387..8f503f4c53 100755 --- a/assets/js/easy-ui/plugins/jquery.splitbutton.js +++ b/assets/js/easy-ui/plugins/jquery.splitbutton.js @@ -1,49 +1,49 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(_2){ -var _3=$.data(_2,"splitbutton").options; -$(_2).menubutton(_3); -$(_2).addClass("s-btn"); -}; -$.fn.splitbutton=function(_4,_5){ -if(typeof _4=="string"){ -var _6=$.fn.splitbutton.methods[_4]; -if(_6){ -return _6(this,_5); -}else{ -return this.menubutton(_4,_5); -} -} -_4=_4||{}; -return this.each(function(){ -var _7=$.data(this,"splitbutton"); -if(_7){ -$.extend(_7.options,_4); -}else{ -$.data(this,"splitbutton",{options:$.extend({},$.fn.splitbutton.defaults,$.fn.splitbutton.parseOptions(this),_4)}); -$(this).removeAttr("disabled"); -} -_1(this); -}); -}; -$.fn.splitbutton.methods={options:function(jq){ -var _8=jq.menubutton("options"); -var _9=$.data(jq[0],"splitbutton").options; -$.extend(_9,{disabled:_8.disabled,toggle:_8.toggle,selected:_8.selected}); -return _9; -}}; -$.fn.splitbutton.parseOptions=function(_a){ -var t=$(_a); -return $.extend({},$.fn.linkbutton.parseOptions(_a),$.parser.parseOptions(_a,["menu",{plain:"boolean",duration:"number"}])); -}; -$.fn.splitbutton.defaults=$.extend({},$.fn.linkbutton.defaults,{plain:true,menu:null,duration:100,cls:{btn1:"m-btn-active s-btn-active",btn2:"m-btn-plain-active s-btn-plain-active",arrow:"m-btn-downarrow",trigger:"m-btn-line"}}); -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(_2){ +var _3=$.data(_2,"splitbutton").options; +$(_2).menubutton(_3); +$(_2).addClass("s-btn"); +}; +$.fn.splitbutton=function(_4,_5){ +if(typeof _4=="string"){ +var _6=$.fn.splitbutton.methods[_4]; +if(_6){ +return _6(this,_5); +}else{ +return this.menubutton(_4,_5); +} +} +_4=_4||{}; +return this.each(function(){ +var _7=$.data(this,"splitbutton"); +if(_7){ +$.extend(_7.options,_4); +}else{ +$.data(this,"splitbutton",{options:$.extend({},$.fn.splitbutton.defaults,$.fn.splitbutton.parseOptions(this),_4)}); +$(this).removeAttr("disabled"); +} +_1(this); +}); +}; +$.fn.splitbutton.methods={options:function(jq){ +var _8=jq.menubutton("options"); +var _9=$.data(jq[0],"splitbutton").options; +$.extend(_9,{disabled:_8.disabled,toggle:_8.toggle,selected:_8.selected}); +return _9; +}}; +$.fn.splitbutton.parseOptions=function(_a){ +var t=$(_a); +return $.extend({},$.fn.linkbutton.parseOptions(_a),$.parser.parseOptions(_a,["menu",{plain:"boolean",duration:"number"}])); +}; +$.fn.splitbutton.defaults=$.extend({},$.fn.linkbutton.defaults,{plain:true,menu:null,duration:100,cls:{btn1:"m-btn-active s-btn-active",btn2:"m-btn-plain-active s-btn-plain-active",arrow:"m-btn-downarrow",trigger:"m-btn-line"}}); +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.tabs.js b/assets/js/easy-ui/plugins/jquery.tabs.js index ad2a2805ef..b5ace148ab 100755 --- a/assets/js/easy-ui/plugins/jquery.tabs.js +++ b/assets/js/easy-ui/plugins/jquery.tabs.js @@ -1,708 +1,708 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(c){ -var w=0; -$(c).children().each(function(){ -w+=$(this).outerWidth(true); -}); -return w; -}; -function _2(_3){ -var _4=$.data(_3,"tabs").options; -if(_4.tabPosition=="left"||_4.tabPosition=="right"||!_4.showHeader){ -return; -} -var _5=$(_3).children("div.tabs-header"); -var _6=_5.children("div.tabs-tool:not(.tabs-tool-hidden)"); -var _7=_5.children("div.tabs-scroller-left"); -var _8=_5.children("div.tabs-scroller-right"); -var _9=_5.children("div.tabs-wrap"); -var _a=_5.outerHeight(); -if(_4.plain){ -_a-=_a-_5.height(); -} -_6._outerHeight(_a); -var _b=_1(_5.find("ul.tabs")); -var _c=_5.width()-_6._outerWidth(); -if(_b>_c){ -_7.add(_8).show()._outerHeight(_a); -if(_4.toolPosition=="left"){ -_6.css({left:_7.outerWidth(),right:""}); -_9.css({marginLeft:_7.outerWidth()+_6._outerWidth(),marginRight:_8._outerWidth(),width:_c-_7.outerWidth()-_8.outerWidth()}); -}else{ -_6.css({left:"",right:_8.outerWidth()}); -_9.css({marginLeft:_7.outerWidth(),marginRight:_8.outerWidth()+_6._outerWidth(),width:_c-_7.outerWidth()-_8.outerWidth()}); -} -}else{ -_7.add(_8).hide(); -if(_4.toolPosition=="left"){ -_6.css({left:0,right:""}); -_9.css({marginLeft:_6._outerWidth(),marginRight:0,width:_c}); -}else{ -_6.css({left:"",right:0}); -_9.css({marginLeft:0,marginRight:_6._outerWidth(),width:_c}); -} -} -}; -function _d(_e){ -var _f=$.data(_e,"tabs").options; -var _10=$(_e).children("div.tabs-header"); -if(_f.tools){ -if(typeof _f.tools=="string"){ -$(_f.tools).addClass("tabs-tool").appendTo(_10); -$(_f.tools).show(); -}else{ -_10.children("div.tabs-tool").remove(); -var _11=$("
").appendTo(_10); -var tr=_11.find("tr"); -for(var i=0;i<_f.tools.length;i++){ -var td=$("").appendTo(tr); -var _12=$("").appendTo(td); -_12[0].onclick=eval(_f.tools[i].handler||function(){ -}); -_12.linkbutton($.extend({},_f.tools[i],{plain:true})); -} -} -}else{ -_10.children("div.tabs-tool").remove(); -} -}; -function _13(_14,_15){ -var _16=$.data(_14,"tabs"); -var _17=_16.options; -var cc=$(_14); -if(!_17.doSize){ -return; -} -if(_15){ -$.extend(_17,{width:_15.width,height:_15.height}); -} -cc._size(_17); -var _18=cc.children("div.tabs-header"); -var _19=cc.children("div.tabs-panels"); -var _1a=_18.find("div.tabs-wrap"); -var ul=_1a.find(".tabs"); -ul.children("li").removeClass("tabs-first tabs-last"); -ul.children("li:first").addClass("tabs-first"); -ul.children("li:last").addClass("tabs-last"); -if(_17.tabPosition=="left"||_17.tabPosition=="right"){ -_18._outerWidth(_17.showHeader?_17.headerWidth:0); -_19._outerWidth(cc.width()-_18.outerWidth()); -_18.add(_19)._size("height",isNaN(parseInt(_17.height))?"":cc.height()); -_1a._outerWidth(_18.width()); -ul._outerWidth(_1a.width()).css("height",""); -}else{ -_18.children("div.tabs-scroller-left,div.tabs-scroller-right,div.tabs-tool:not(.tabs-tool-hidden)").css("display",_17.showHeader?"block":"none"); -_18._outerWidth(cc.width()).css("height",""); -if(_17.showHeader){ -_18.css("background-color",""); -_1a.css("height",""); -}else{ -_18.css("background-color","transparent"); -_18._outerHeight(0); -_1a._outerHeight(0); -} -ul._outerHeight(_17.tabHeight).css("width",""); -ul._outerHeight(ul.outerHeight()-ul.height()-1+_17.tabHeight).css("width",""); -_19._size("height",isNaN(parseInt(_17.height))?"":(cc.height()-_18.outerHeight())); -_19._size("width",cc.width()); -} -if(_16.tabs.length){ -var d1=ul.outerWidth(true)-ul.width(); -var li=ul.children("li:first"); -var d2=li.outerWidth(true)-li.width(); -var _1b=_18.width()-_18.children(".tabs-tool:not(.tabs-tool-hidden)")._outerWidth(); -var _1c=Math.floor((_1b-d1-d2*_16.tabs.length)/_16.tabs.length); -$.map(_16.tabs,function(p){ -_1d(p,(_17.justified&&$.inArray(_17.tabPosition,["top","bottom"])>=0)?_1c:undefined); -}); -if(_17.justified&&$.inArray(_17.tabPosition,["top","bottom"])>=0){ -var _1e=_1b-d1-_1(ul); -_1d(_16.tabs[_16.tabs.length-1],_1c+_1e); -} -} -_2(_14); -function _1d(p,_1f){ -var _20=p.panel("options"); -var p_t=_20.tab.find("a.tabs-inner"); -var _1f=_1f?_1f:(parseInt(_20.tabWidth||_17.tabWidth||undefined)); -if(_1f){ -p_t._outerWidth(_1f); -}else{ -p_t.css("width",""); -} -p_t._outerHeight(_17.tabHeight); -p_t.css("lineHeight",p_t.height()+"px"); -p_t.find(".easyui-fluid:visible").triggerHandler("_resize"); -}; -}; -function _21(_22){ -var _23=$.data(_22,"tabs").options; -var tab=_24(_22); -if(tab){ -var _25=$(_22).children("div.tabs-panels"); -var _26=_23.width=="auto"?"auto":_25.width(); -var _27=_23.height=="auto"?"auto":_25.height(); -tab.panel("resize",{width:_26,height:_27}); -} -}; -function _28(_29){ -var _2a=$.data(_29,"tabs").tabs; -var cc=$(_29).addClass("tabs-container"); -var _2b=$("
").insertBefore(cc); -cc.children("div").each(function(){ -_2b[0].appendChild(this); -}); -cc[0].appendChild(_2b[0]); -$("
"+"
"+"
"+"
"+"
    "+"
    "+"
    ").prependTo(_29); -cc.children("div.tabs-panels").children("div").each(function(i){ -var _2c=$.extend({},$.parser.parseOptions(this),{disabled:($(this).attr("disabled")?true:undefined),selected:($(this).attr("selected")?true:undefined)}); -_3c(_29,_2c,$(this)); -}); -cc.children("div.tabs-header").find(".tabs-scroller-left, .tabs-scroller-right").hover(function(){ -$(this).addClass("tabs-scroller-over"); -},function(){ -$(this).removeClass("tabs-scroller-over"); -}); -cc.bind("_resize",function(e,_2d){ -if($(this).hasClass("easyui-fluid")||_2d){ -_13(_29); -_21(_29); -} -return false; -}); -}; -function _2e(_2f){ -var _30=$.data(_2f,"tabs"); -var _31=_30.options; -$(_2f).children("div.tabs-header").unbind().bind("click",function(e){ -if($(e.target).hasClass("tabs-scroller-left")){ -$(_2f).tabs("scrollBy",-_31.scrollIncrement); -}else{ -if($(e.target).hasClass("tabs-scroller-right")){ -$(_2f).tabs("scrollBy",_31.scrollIncrement); -}else{ -var li=$(e.target).closest("li"); -if(li.hasClass("tabs-disabled")){ -return false; -} -var a=$(e.target).closest("a.tabs-close"); -if(a.length){ -_5a(_2f,_32(li)); -}else{ -if(li.length){ -var _33=_32(li); -var _34=_30.tabs[_33].panel("options"); -if(_34.collapsible){ -_34.closed?_50(_2f,_33):_75(_2f,_33); -}else{ -_50(_2f,_33); -} -} -} -return false; -} -} -}).bind("contextmenu",function(e){ -var li=$(e.target).closest("li"); -if(li.hasClass("tabs-disabled")){ -return; -} -if(li.length){ -_31.onContextMenu.call(_2f,e,li.find("span.tabs-title").html(),_32(li)); -} -}); -function _32(li){ -var _35=0; -li.parent().children("li").each(function(i){ -if(li[0]==this){ -_35=i; -return false; -} -}); -return _35; -}; -}; -function _36(_37){ -var _38=$.data(_37,"tabs").options; -var _39=$(_37).children("div.tabs-header"); -var _3a=$(_37).children("div.tabs-panels"); -_39.removeClass("tabs-header-top tabs-header-bottom tabs-header-left tabs-header-right"); -_3a.removeClass("tabs-panels-top tabs-panels-bottom tabs-panels-left tabs-panels-right"); -if(_38.tabPosition=="top"){ -_39.insertBefore(_3a); -}else{ -if(_38.tabPosition=="bottom"){ -_39.insertAfter(_3a); -_39.addClass("tabs-header-bottom"); -_3a.addClass("tabs-panels-top"); -}else{ -if(_38.tabPosition=="left"){ -_39.addClass("tabs-header-left"); -_3a.addClass("tabs-panels-right"); -}else{ -if(_38.tabPosition=="right"){ -_39.addClass("tabs-header-right"); -_3a.addClass("tabs-panels-left"); -} -} -} -} -if(_38.plain==true){ -_39.addClass("tabs-header-plain"); -}else{ -_39.removeClass("tabs-header-plain"); -} -_39.removeClass("tabs-header-narrow").addClass(_38.narrow?"tabs-header-narrow":""); -var _3b=_39.find(".tabs"); -_3b.removeClass("tabs-pill").addClass(_38.pill?"tabs-pill":""); -_3b.removeClass("tabs-narrow").addClass(_38.narrow?"tabs-narrow":""); -_3b.removeClass("tabs-justified").addClass(_38.justified?"tabs-justified":""); -if(_38.border==true){ -_39.removeClass("tabs-header-noborder"); -_3a.removeClass("tabs-panels-noborder"); -}else{ -_39.addClass("tabs-header-noborder"); -_3a.addClass("tabs-panels-noborder"); -} -_38.doSize=true; -}; -function _3c(_3d,_3e,pp){ -_3e=_3e||{}; -var _3f=$.data(_3d,"tabs"); -var _40=_3f.tabs; -if(_3e.index==undefined||_3e.index>_40.length){ -_3e.index=_40.length; -} -if(_3e.index<0){ -_3e.index=0; -} -var ul=$(_3d).children("div.tabs-header").find("ul.tabs"); -var _41=$(_3d).children("div.tabs-panels"); -var tab=$("
  • "+""+""+""+""+"
  • "); -if(!pp){ -pp=$("
    "); -} -if(_3e.index>=_40.length){ -tab.appendTo(ul); -pp.appendTo(_41); -_40.push(pp); -}else{ -tab.insertBefore(ul.children("li:eq("+_3e.index+")")); -pp.insertBefore(_41.children("div.panel:eq("+_3e.index+")")); -_40.splice(_3e.index,0,pp); -} -pp.panel($.extend({},_3e,{tab:tab,border:false,noheader:true,closed:true,doSize:false,iconCls:(_3e.icon?_3e.icon:undefined),onLoad:function(){ -if(_3e.onLoad){ -_3e.onLoad.call(this,arguments); -} -_3f.options.onLoad.call(_3d,$(this)); -},onBeforeOpen:function(){ -if(_3e.onBeforeOpen){ -if(_3e.onBeforeOpen.call(this)==false){ -return false; -} -} -var p=$(_3d).tabs("getSelected"); -if(p){ -if(p[0]!=this){ -$(_3d).tabs("unselect",_4a(_3d,p)); -p=$(_3d).tabs("getSelected"); -if(p){ -return false; -} -}else{ -_21(_3d); -return false; -} -} -var _42=$(this).panel("options"); -_42.tab.addClass("tabs-selected"); -var _43=$(_3d).find(">div.tabs-header>div.tabs-wrap"); -var _44=_42.tab.position().left; -var _45=_44+_42.tab.outerWidth(); -if(_44<0||_45>_43.width()){ -var _46=_44-(_43.width()-_42.tab.width())/2; -$(_3d).tabs("scrollBy",_46); -}else{ -$(_3d).tabs("scrollBy",0); -} -var _47=$(this).panel("panel"); -_47.css("display","block"); -_21(_3d); -_47.css("display","none"); -},onOpen:function(){ -if(_3e.onOpen){ -_3e.onOpen.call(this); -} -var _48=$(this).panel("options"); -_3f.selectHis.push(_48.title); -_3f.options.onSelect.call(_3d,_48.title,_4a(_3d,this)); -},onBeforeClose:function(){ -if(_3e.onBeforeClose){ -if(_3e.onBeforeClose.call(this)==false){ -return false; -} -} -$(this).panel("options").tab.removeClass("tabs-selected"); -},onClose:function(){ -if(_3e.onClose){ -_3e.onClose.call(this); -} -var _49=$(this).panel("options"); -_3f.options.onUnselect.call(_3d,_49.title,_4a(_3d,this)); -}})); -$(_3d).tabs("update",{tab:pp,options:pp.panel("options"),type:"header"}); -}; -function _4b(_4c,_4d){ -var _4e=$.data(_4c,"tabs"); -var _4f=_4e.options; -if(_4d.selected==undefined){ -_4d.selected=true; -} -_3c(_4c,_4d); -_4f.onAdd.call(_4c,_4d.title,_4d.index); -if(_4d.selected){ -_50(_4c,_4d.index); -} -}; -function _51(_52,_53){ -_53.type=_53.type||"all"; -var _54=$.data(_52,"tabs").selectHis; -var pp=_53.tab; -var _55=pp.panel("options"); -var _56=_55.title; -$.extend(_55,_53.options,{iconCls:(_53.options.icon?_53.options.icon:undefined)}); -if(_53.type=="all"||_53.type=="body"){ -pp.panel(); -} -if(_53.type=="all"||_53.type=="header"){ -var tab=_55.tab; -if(_55.header){ -tab.find(".tabs-inner").html($(_55.header)); -}else{ -var _57=tab.find("span.tabs-title"); -var _58=tab.find("span.tabs-icon"); -_57.html(_55.title); -_58.attr("class","tabs-icon"); -tab.find("a.tabs-close").remove(); -if(_55.closable){ -_57.addClass("tabs-closable"); -$("").appendTo(tab); -}else{ -_57.removeClass("tabs-closable"); -} -if(_55.iconCls){ -_57.addClass("tabs-with-icon"); -_58.addClass(_55.iconCls); -}else{ -_57.removeClass("tabs-with-icon"); -} -if(_55.tools){ -var _59=tab.find("span.tabs-p-tool"); -if(!_59.length){ -var _59=$("").insertAfter(tab.find("a.tabs-inner")); -} -if($.isArray(_55.tools)){ -_59.empty(); -for(var i=0;i<_55.tools.length;i++){ -var t=$("").appendTo(_59); -t.addClass(_55.tools[i].iconCls); -if(_55.tools[i].handler){ -t.bind("click",{handler:_55.tools[i].handler},function(e){ -if($(this).parents("li").hasClass("tabs-disabled")){ -return; -} -e.data.handler.call(this); -}); -} -} -}else{ -$(_55.tools).children().appendTo(_59); -} -var pr=_59.children().length*12; -if(_55.closable){ -pr+=8; -_59.css("right",""); -}else{ -pr-=3; -_59.css("right","5px"); -} -_57.css("padding-right",pr+"px"); -}else{ -tab.find("span.tabs-p-tool").remove(); -_57.css("padding-right",""); -} -} -if(_56!=_55.title){ -for(var i=0;i<_54.length;i++){ -if(_54[i]==_56){ -_54[i]=_55.title; -} -} -} -} -if(_55.disabled){ -_55.tab.addClass("tabs-disabled"); -}else{ -_55.tab.removeClass("tabs-disabled"); -} -_13(_52); -$.data(_52,"tabs").options.onUpdate.call(_52,_55.title,_4a(_52,pp)); -}; -function _5a(_5b,_5c){ -var _5d=$.data(_5b,"tabs").options; -var _5e=$.data(_5b,"tabs").tabs; -var _5f=$.data(_5b,"tabs").selectHis; -if(!_60(_5b,_5c)){ -return; -} -var tab=_61(_5b,_5c); -var _62=tab.panel("options").title; -var _63=_4a(_5b,tab); -if(_5d.onBeforeClose.call(_5b,_62,_63)==false){ -return; -} -var tab=_61(_5b,_5c,true); -tab.panel("options").tab.remove(); -tab.panel("destroy"); -_5d.onClose.call(_5b,_62,_63); -_13(_5b); -for(var i=0;i<_5f.length;i++){ -if(_5f[i]==_62){ -_5f.splice(i,1); -i--; -} -} -var _64=_5f.pop(); -if(_64){ -_50(_5b,_64); -}else{ -if(_5e.length){ -_50(_5b,0); -} -} -}; -function _61(_65,_66,_67){ -var _68=$.data(_65,"tabs").tabs; -var tab=null; -if(typeof _66=="number"){ -if(_66>=0&&_66<_68.length){ -tab=_68[_66]; -if(_67){ -_68.splice(_66,1); -} -} -}else{ -var tmp=$(""); -for(var i=0;i<_68.length;i++){ -var p=_68[i]; -tmp.html(p.panel("options").title); -if(tmp.text()==_66){ -tab=p; -if(_67){ -_68.splice(i,1); -} -break; -} -} -tmp.remove(); -} -return tab; -}; -function _4a(_69,tab){ -var _6a=$.data(_69,"tabs").tabs; -for(var i=0;i<_6a.length;i++){ -if(_6a[i][0]==$(tab)[0]){ -return i; -} -} -return -1; -}; -function _24(_6b){ -var _6c=$.data(_6b,"tabs").tabs; -for(var i=0;i<_6c.length;i++){ -var tab=_6c[i]; -if(tab.panel("options").tab.hasClass("tabs-selected")){ -return tab; -} -} -return null; -}; -function _6d(_6e){ -var _6f=$.data(_6e,"tabs"); -var _70=_6f.tabs; -for(var i=0;i<_70.length;i++){ -var _71=_70[i].panel("options"); -if(_71.selected&&!_71.disabled){ -_50(_6e,i); -return; -} -} -_50(_6e,_6f.options.selected); -}; -function _50(_72,_73){ -var p=_61(_72,_73); -if(p&&!p.is(":visible")){ -_74(_72); -if(!p.panel("options").disabled){ -p.panel("open"); -} -} -}; -function _75(_76,_77){ -var p=_61(_76,_77); -if(p&&p.is(":visible")){ -_74(_76); -p.panel("close"); -} -}; -function _74(_78){ -$(_78).children("div.tabs-panels").each(function(){ -$(this).stop(true,true); -}); -}; -function _60(_79,_7a){ -return _61(_79,_7a)!=null; -}; -function _7b(_7c,_7d){ -var _7e=$.data(_7c,"tabs").options; -_7e.showHeader=_7d; -$(_7c).tabs("resize"); -}; -function _7f(_80,_81){ -var _82=$(_80).find(">.tabs-header>.tabs-tool"); -if(_81){ -_82.removeClass("tabs-tool-hidden").show(); -}else{ -_82.addClass("tabs-tool-hidden").hide(); -} -$(_80).tabs("resize").tabs("scrollBy",0); -}; -$.fn.tabs=function(_83,_84){ -if(typeof _83=="string"){ -return $.fn.tabs.methods[_83](this,_84); -} -_83=_83||{}; -return this.each(function(){ -var _85=$.data(this,"tabs"); -if(_85){ -$.extend(_85.options,_83); -}else{ -$.data(this,"tabs",{options:$.extend({},$.fn.tabs.defaults,$.fn.tabs.parseOptions(this),_83),tabs:[],selectHis:[]}); -_28(this); -} -_d(this); -_36(this); -_13(this); -_2e(this); -_6d(this); -}); -}; -$.fn.tabs.methods={options:function(jq){ -var cc=jq[0]; -var _86=$.data(cc,"tabs").options; -var s=_24(cc); -_86.selected=s?_4a(cc,s):-1; -return _86; -},tabs:function(jq){ -return $.data(jq[0],"tabs").tabs; -},resize:function(jq,_87){ -return jq.each(function(){ -_13(this,_87); -_21(this); -}); -},add:function(jq,_88){ -return jq.each(function(){ -_4b(this,_88); -}); -},close:function(jq,_89){ -return jq.each(function(){ -_5a(this,_89); -}); -},getTab:function(jq,_8a){ -return _61(jq[0],_8a); -},getTabIndex:function(jq,tab){ -return _4a(jq[0],tab); -},getSelected:function(jq){ -return _24(jq[0]); -},select:function(jq,_8b){ -return jq.each(function(){ -_50(this,_8b); -}); -},unselect:function(jq,_8c){ -return jq.each(function(){ -_75(this,_8c); -}); -},exists:function(jq,_8d){ -return _60(jq[0],_8d); -},update:function(jq,_8e){ -return jq.each(function(){ -_51(this,_8e); -}); -},enableTab:function(jq,_8f){ -return jq.each(function(){ -var _90=$(this).tabs("getTab",_8f).panel("options"); -_90.tab.removeClass("tabs-disabled"); -_90.disabled=false; -}); -},disableTab:function(jq,_91){ -return jq.each(function(){ -var _92=$(this).tabs("getTab",_91).panel("options"); -_92.tab.addClass("tabs-disabled"); -_92.disabled=true; -}); -},showHeader:function(jq){ -return jq.each(function(){ -_7b(this,true); -}); -},hideHeader:function(jq){ -return jq.each(function(){ -_7b(this,false); -}); -},showTool:function(jq){ -return jq.each(function(){ -_7f(this,true); -}); -},hideTool:function(jq){ -return jq.each(function(){ -_7f(this,false); -}); -},scrollBy:function(jq,_93){ -return jq.each(function(){ -var _94=$(this).tabs("options"); -var _95=$(this).find(">div.tabs-header>div.tabs-wrap"); -var pos=Math.min(_95._scrollLeft()+_93,_96()); -_95.animate({scrollLeft:pos},_94.scrollDuration); -function _96(){ -var w=0; -var ul=_95.children("ul"); -ul.children("li").each(function(){ -w+=$(this).outerWidth(true); -}); -return w-_95.width()+(ul.outerWidth()-ul.width()); -}; -}); -}}; -$.fn.tabs.parseOptions=function(_97){ -return $.extend({},$.parser.parseOptions(_97,["tools","toolPosition","tabPosition",{fit:"boolean",border:"boolean",plain:"boolean"},{headerWidth:"number",tabWidth:"number",tabHeight:"number",selected:"number"},{showHeader:"boolean",justified:"boolean",narrow:"boolean",pill:"boolean"}])); -}; -$.fn.tabs.defaults={width:"auto",height:"auto",headerWidth:150,tabWidth:"auto",tabHeight:27,selected:0,showHeader:true,plain:false,fit:false,border:true,justified:false,narrow:false,pill:false,tools:null,toolPosition:"right",tabPosition:"top",scrollIncrement:100,scrollDuration:400,onLoad:function(_98){ -},onSelect:function(_99,_9a){ -},onUnselect:function(_9b,_9c){ -},onBeforeClose:function(_9d,_9e){ -},onClose:function(_9f,_a0){ -},onAdd:function(_a1,_a2){ -},onUpdate:function(_a3,_a4){ -},onContextMenu:function(e,_a5,_a6){ -}}; -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(c){ +var w=0; +$(c).children().each(function(){ +w+=$(this).outerWidth(true); +}); +return w; +}; +function _2(_3){ +var _4=$.data(_3,"tabs").options; +if(_4.tabPosition=="left"||_4.tabPosition=="right"||!_4.showHeader){ +return; +} +var _5=$(_3).children("div.tabs-header"); +var _6=_5.children("div.tabs-tool:not(.tabs-tool-hidden)"); +var _7=_5.children("div.tabs-scroller-left"); +var _8=_5.children("div.tabs-scroller-right"); +var _9=_5.children("div.tabs-wrap"); +var _a=_5.outerHeight(); +if(_4.plain){ +_a-=_a-_5.height(); +} +_6._outerHeight(_a); +var _b=_1(_5.find("ul.tabs")); +var _c=_5.width()-_6._outerWidth(); +if(_b>_c){ +_7.add(_8).show()._outerHeight(_a); +if(_4.toolPosition=="left"){ +_6.css({left:_7.outerWidth(),right:""}); +_9.css({marginLeft:_7.outerWidth()+_6._outerWidth(),marginRight:_8._outerWidth(),width:_c-_7.outerWidth()-_8.outerWidth()}); +}else{ +_6.css({left:"",right:_8.outerWidth()}); +_9.css({marginLeft:_7.outerWidth(),marginRight:_8.outerWidth()+_6._outerWidth(),width:_c-_7.outerWidth()-_8.outerWidth()}); +} +}else{ +_7.add(_8).hide(); +if(_4.toolPosition=="left"){ +_6.css({left:0,right:""}); +_9.css({marginLeft:_6._outerWidth(),marginRight:0,width:_c}); +}else{ +_6.css({left:"",right:0}); +_9.css({marginLeft:0,marginRight:_6._outerWidth(),width:_c}); +} +} +}; +function _d(_e){ +var _f=$.data(_e,"tabs").options; +var _10=$(_e).children("div.tabs-header"); +if(_f.tools){ +if(typeof _f.tools=="string"){ +$(_f.tools).addClass("tabs-tool").appendTo(_10); +$(_f.tools).show(); +}else{ +_10.children("div.tabs-tool").remove(); +var _11=$("
    ").appendTo(_10); +var tr=_11.find("tr"); +for(var i=0;i<_f.tools.length;i++){ +var td=$("").appendTo(tr); +var _12=$("").appendTo(td); +_12[0].onclick=eval(_f.tools[i].handler||function(){ +}); +_12.linkbutton($.extend({},_f.tools[i],{plain:true})); +} +} +}else{ +_10.children("div.tabs-tool").remove(); +} +}; +function _13(_14,_15){ +var _16=$.data(_14,"tabs"); +var _17=_16.options; +var cc=$(_14); +if(!_17.doSize){ +return; +} +if(_15){ +$.extend(_17,{width:_15.width,height:_15.height}); +} +cc._size(_17); +var _18=cc.children("div.tabs-header"); +var _19=cc.children("div.tabs-panels"); +var _1a=_18.find("div.tabs-wrap"); +var ul=_1a.find(".tabs"); +ul.children("li").removeClass("tabs-first tabs-last"); +ul.children("li:first").addClass("tabs-first"); +ul.children("li:last").addClass("tabs-last"); +if(_17.tabPosition=="left"||_17.tabPosition=="right"){ +_18._outerWidth(_17.showHeader?_17.headerWidth:0); +_19._outerWidth(cc.width()-_18.outerWidth()); +_18.add(_19)._size("height",isNaN(parseInt(_17.height))?"":cc.height()); +_1a._outerWidth(_18.width()); +ul._outerWidth(_1a.width()).css("height",""); +}else{ +_18.children("div.tabs-scroller-left,div.tabs-scroller-right,div.tabs-tool:not(.tabs-tool-hidden)").css("display",_17.showHeader?"block":"none"); +_18._outerWidth(cc.width()).css("height",""); +if(_17.showHeader){ +_18.css("background-color",""); +_1a.css("height",""); +}else{ +_18.css("background-color","transparent"); +_18._outerHeight(0); +_1a._outerHeight(0); +} +ul._outerHeight(_17.tabHeight).css("width",""); +ul._outerHeight(ul.outerHeight()-ul.height()-1+_17.tabHeight).css("width",""); +_19._size("height",isNaN(parseInt(_17.height))?"":(cc.height()-_18.outerHeight())); +_19._size("width",cc.width()); +} +if(_16.tabs.length){ +var d1=ul.outerWidth(true)-ul.width(); +var li=ul.children("li:first"); +var d2=li.outerWidth(true)-li.width(); +var _1b=_18.width()-_18.children(".tabs-tool:not(.tabs-tool-hidden)")._outerWidth(); +var _1c=Math.floor((_1b-d1-d2*_16.tabs.length)/_16.tabs.length); +$.map(_16.tabs,function(p){ +_1d(p,(_17.justified&&$.inArray(_17.tabPosition,["top","bottom"])>=0)?_1c:undefined); +}); +if(_17.justified&&$.inArray(_17.tabPosition,["top","bottom"])>=0){ +var _1e=_1b-d1-_1(ul); +_1d(_16.tabs[_16.tabs.length-1],_1c+_1e); +} +} +_2(_14); +function _1d(p,_1f){ +var _20=p.panel("options"); +var p_t=_20.tab.find("a.tabs-inner"); +var _1f=_1f?_1f:(parseInt(_20.tabWidth||_17.tabWidth||undefined)); +if(_1f){ +p_t._outerWidth(_1f); +}else{ +p_t.css("width",""); +} +p_t._outerHeight(_17.tabHeight); +p_t.css("lineHeight",p_t.height()+"px"); +p_t.find(".easyui-fluid:visible").triggerHandler("_resize"); +}; +}; +function _21(_22){ +var _23=$.data(_22,"tabs").options; +var tab=_24(_22); +if(tab){ +var _25=$(_22).children("div.tabs-panels"); +var _26=_23.width=="auto"?"auto":_25.width(); +var _27=_23.height=="auto"?"auto":_25.height(); +tab.panel("resize",{width:_26,height:_27}); +} +}; +function _28(_29){ +var _2a=$.data(_29,"tabs").tabs; +var cc=$(_29).addClass("tabs-container"); +var _2b=$("
    ").insertBefore(cc); +cc.children("div").each(function(){ +_2b[0].appendChild(this); +}); +cc[0].appendChild(_2b[0]); +$("
    "+"
    "+"
    "+"
    "+"
      "+"
      "+"
      ").prependTo(_29); +cc.children("div.tabs-panels").children("div").each(function(i){ +var _2c=$.extend({},$.parser.parseOptions(this),{disabled:($(this).attr("disabled")?true:undefined),selected:($(this).attr("selected")?true:undefined)}); +_3c(_29,_2c,$(this)); +}); +cc.children("div.tabs-header").find(".tabs-scroller-left, .tabs-scroller-right").hover(function(){ +$(this).addClass("tabs-scroller-over"); +},function(){ +$(this).removeClass("tabs-scroller-over"); +}); +cc.bind("_resize",function(e,_2d){ +if($(this).hasClass("easyui-fluid")||_2d){ +_13(_29); +_21(_29); +} +return false; +}); +}; +function _2e(_2f){ +var _30=$.data(_2f,"tabs"); +var _31=_30.options; +$(_2f).children("div.tabs-header").unbind().bind("click",function(e){ +if($(e.target).hasClass("tabs-scroller-left")){ +$(_2f).tabs("scrollBy",-_31.scrollIncrement); +}else{ +if($(e.target).hasClass("tabs-scroller-right")){ +$(_2f).tabs("scrollBy",_31.scrollIncrement); +}else{ +var li=$(e.target).closest("li"); +if(li.hasClass("tabs-disabled")){ +return false; +} +var a=$(e.target).closest("a.tabs-close"); +if(a.length){ +_5a(_2f,_32(li)); +}else{ +if(li.length){ +var _33=_32(li); +var _34=_30.tabs[_33].panel("options"); +if(_34.collapsible){ +_34.closed?_50(_2f,_33):_75(_2f,_33); +}else{ +_50(_2f,_33); +} +} +} +return false; +} +} +}).bind("contextmenu",function(e){ +var li=$(e.target).closest("li"); +if(li.hasClass("tabs-disabled")){ +return; +} +if(li.length){ +_31.onContextMenu.call(_2f,e,li.find("span.tabs-title").html(),_32(li)); +} +}); +function _32(li){ +var _35=0; +li.parent().children("li").each(function(i){ +if(li[0]==this){ +_35=i; +return false; +} +}); +return _35; +}; +}; +function _36(_37){ +var _38=$.data(_37,"tabs").options; +var _39=$(_37).children("div.tabs-header"); +var _3a=$(_37).children("div.tabs-panels"); +_39.removeClass("tabs-header-top tabs-header-bottom tabs-header-left tabs-header-right"); +_3a.removeClass("tabs-panels-top tabs-panels-bottom tabs-panels-left tabs-panels-right"); +if(_38.tabPosition=="top"){ +_39.insertBefore(_3a); +}else{ +if(_38.tabPosition=="bottom"){ +_39.insertAfter(_3a); +_39.addClass("tabs-header-bottom"); +_3a.addClass("tabs-panels-top"); +}else{ +if(_38.tabPosition=="left"){ +_39.addClass("tabs-header-left"); +_3a.addClass("tabs-panels-right"); +}else{ +if(_38.tabPosition=="right"){ +_39.addClass("tabs-header-right"); +_3a.addClass("tabs-panels-left"); +} +} +} +} +if(_38.plain==true){ +_39.addClass("tabs-header-plain"); +}else{ +_39.removeClass("tabs-header-plain"); +} +_39.removeClass("tabs-header-narrow").addClass(_38.narrow?"tabs-header-narrow":""); +var _3b=_39.find(".tabs"); +_3b.removeClass("tabs-pill").addClass(_38.pill?"tabs-pill":""); +_3b.removeClass("tabs-narrow").addClass(_38.narrow?"tabs-narrow":""); +_3b.removeClass("tabs-justified").addClass(_38.justified?"tabs-justified":""); +if(_38.border==true){ +_39.removeClass("tabs-header-noborder"); +_3a.removeClass("tabs-panels-noborder"); +}else{ +_39.addClass("tabs-header-noborder"); +_3a.addClass("tabs-panels-noborder"); +} +_38.doSize=true; +}; +function _3c(_3d,_3e,pp){ +_3e=_3e||{}; +var _3f=$.data(_3d,"tabs"); +var _40=_3f.tabs; +if(_3e.index==undefined||_3e.index>_40.length){ +_3e.index=_40.length; +} +if(_3e.index<0){ +_3e.index=0; +} +var ul=$(_3d).children("div.tabs-header").find("ul.tabs"); +var _41=$(_3d).children("div.tabs-panels"); +var tab=$("
    • "+""+""+""+""+"
    • "); +if(!pp){ +pp=$("
      "); +} +if(_3e.index>=_40.length){ +tab.appendTo(ul); +pp.appendTo(_41); +_40.push(pp); +}else{ +tab.insertBefore(ul.children("li:eq("+_3e.index+")")); +pp.insertBefore(_41.children("div.panel:eq("+_3e.index+")")); +_40.splice(_3e.index,0,pp); +} +pp.panel($.extend({},_3e,{tab:tab,border:false,noheader:true,closed:true,doSize:false,iconCls:(_3e.icon?_3e.icon:undefined),onLoad:function(){ +if(_3e.onLoad){ +_3e.onLoad.call(this,arguments); +} +_3f.options.onLoad.call(_3d,$(this)); +},onBeforeOpen:function(){ +if(_3e.onBeforeOpen){ +if(_3e.onBeforeOpen.call(this)==false){ +return false; +} +} +var p=$(_3d).tabs("getSelected"); +if(p){ +if(p[0]!=this){ +$(_3d).tabs("unselect",_4a(_3d,p)); +p=$(_3d).tabs("getSelected"); +if(p){ +return false; +} +}else{ +_21(_3d); +return false; +} +} +var _42=$(this).panel("options"); +_42.tab.addClass("tabs-selected"); +var _43=$(_3d).find(">div.tabs-header>div.tabs-wrap"); +var _44=_42.tab.position().left; +var _45=_44+_42.tab.outerWidth(); +if(_44<0||_45>_43.width()){ +var _46=_44-(_43.width()-_42.tab.width())/2; +$(_3d).tabs("scrollBy",_46); +}else{ +$(_3d).tabs("scrollBy",0); +} +var _47=$(this).panel("panel"); +_47.css("display","block"); +_21(_3d); +_47.css("display","none"); +},onOpen:function(){ +if(_3e.onOpen){ +_3e.onOpen.call(this); +} +var _48=$(this).panel("options"); +_3f.selectHis.push(_48.title); +_3f.options.onSelect.call(_3d,_48.title,_4a(_3d,this)); +},onBeforeClose:function(){ +if(_3e.onBeforeClose){ +if(_3e.onBeforeClose.call(this)==false){ +return false; +} +} +$(this).panel("options").tab.removeClass("tabs-selected"); +},onClose:function(){ +if(_3e.onClose){ +_3e.onClose.call(this); +} +var _49=$(this).panel("options"); +_3f.options.onUnselect.call(_3d,_49.title,_4a(_3d,this)); +}})); +$(_3d).tabs("update",{tab:pp,options:pp.panel("options"),type:"header"}); +}; +function _4b(_4c,_4d){ +var _4e=$.data(_4c,"tabs"); +var _4f=_4e.options; +if(_4d.selected==undefined){ +_4d.selected=true; +} +_3c(_4c,_4d); +_4f.onAdd.call(_4c,_4d.title,_4d.index); +if(_4d.selected){ +_50(_4c,_4d.index); +} +}; +function _51(_52,_53){ +_53.type=_53.type||"all"; +var _54=$.data(_52,"tabs").selectHis; +var pp=_53.tab; +var _55=pp.panel("options"); +var _56=_55.title; +$.extend(_55,_53.options,{iconCls:(_53.options.icon?_53.options.icon:undefined)}); +if(_53.type=="all"||_53.type=="body"){ +pp.panel(); +} +if(_53.type=="all"||_53.type=="header"){ +var tab=_55.tab; +if(_55.header){ +tab.find(".tabs-inner").html($(_55.header)); +}else{ +var _57=tab.find("span.tabs-title"); +var _58=tab.find("span.tabs-icon"); +_57.html(_55.title); +_58.attr("class","tabs-icon"); +tab.find("a.tabs-close").remove(); +if(_55.closable){ +_57.addClass("tabs-closable"); +$("").appendTo(tab); +}else{ +_57.removeClass("tabs-closable"); +} +if(_55.iconCls){ +_57.addClass("tabs-with-icon"); +_58.addClass(_55.iconCls); +}else{ +_57.removeClass("tabs-with-icon"); +} +if(_55.tools){ +var _59=tab.find("span.tabs-p-tool"); +if(!_59.length){ +var _59=$("").insertAfter(tab.find("a.tabs-inner")); +} +if($.isArray(_55.tools)){ +_59.empty(); +for(var i=0;i<_55.tools.length;i++){ +var t=$("").appendTo(_59); +t.addClass(_55.tools[i].iconCls); +if(_55.tools[i].handler){ +t.bind("click",{handler:_55.tools[i].handler},function(e){ +if($(this).parents("li").hasClass("tabs-disabled")){ +return; +} +e.data.handler.call(this); +}); +} +} +}else{ +$(_55.tools).children().appendTo(_59); +} +var pr=_59.children().length*12; +if(_55.closable){ +pr+=8; +_59.css("right",""); +}else{ +pr-=3; +_59.css("right","5px"); +} +_57.css("padding-right",pr+"px"); +}else{ +tab.find("span.tabs-p-tool").remove(); +_57.css("padding-right",""); +} +} +if(_56!=_55.title){ +for(var i=0;i<_54.length;i++){ +if(_54[i]==_56){ +_54[i]=_55.title; +} +} +} +} +if(_55.disabled){ +_55.tab.addClass("tabs-disabled"); +}else{ +_55.tab.removeClass("tabs-disabled"); +} +_13(_52); +$.data(_52,"tabs").options.onUpdate.call(_52,_55.title,_4a(_52,pp)); +}; +function _5a(_5b,_5c){ +var _5d=$.data(_5b,"tabs").options; +var _5e=$.data(_5b,"tabs").tabs; +var _5f=$.data(_5b,"tabs").selectHis; +if(!_60(_5b,_5c)){ +return; +} +var tab=_61(_5b,_5c); +var _62=tab.panel("options").title; +var _63=_4a(_5b,tab); +if(_5d.onBeforeClose.call(_5b,_62,_63)==false){ +return; +} +var tab=_61(_5b,_5c,true); +tab.panel("options").tab.remove(); +tab.panel("destroy"); +_5d.onClose.call(_5b,_62,_63); +_13(_5b); +for(var i=0;i<_5f.length;i++){ +if(_5f[i]==_62){ +_5f.splice(i,1); +i--; +} +} +var _64=_5f.pop(); +if(_64){ +_50(_5b,_64); +}else{ +if(_5e.length){ +_50(_5b,0); +} +} +}; +function _61(_65,_66,_67){ +var _68=$.data(_65,"tabs").tabs; +var tab=null; +if(typeof _66=="number"){ +if(_66>=0&&_66<_68.length){ +tab=_68[_66]; +if(_67){ +_68.splice(_66,1); +} +} +}else{ +var tmp=$(""); +for(var i=0;i<_68.length;i++){ +var p=_68[i]; +tmp.html(p.panel("options").title); +if(tmp.text()==_66){ +tab=p; +if(_67){ +_68.splice(i,1); +} +break; +} +} +tmp.remove(); +} +return tab; +}; +function _4a(_69,tab){ +var _6a=$.data(_69,"tabs").tabs; +for(var i=0;i<_6a.length;i++){ +if(_6a[i][0]==$(tab)[0]){ +return i; +} +} +return -1; +}; +function _24(_6b){ +var _6c=$.data(_6b,"tabs").tabs; +for(var i=0;i<_6c.length;i++){ +var tab=_6c[i]; +if(tab.panel("options").tab.hasClass("tabs-selected")){ +return tab; +} +} +return null; +}; +function _6d(_6e){ +var _6f=$.data(_6e,"tabs"); +var _70=_6f.tabs; +for(var i=0;i<_70.length;i++){ +var _71=_70[i].panel("options"); +if(_71.selected&&!_71.disabled){ +_50(_6e,i); +return; +} +} +_50(_6e,_6f.options.selected); +}; +function _50(_72,_73){ +var p=_61(_72,_73); +if(p&&!p.is(":visible")){ +_74(_72); +if(!p.panel("options").disabled){ +p.panel("open"); +} +} +}; +function _75(_76,_77){ +var p=_61(_76,_77); +if(p&&p.is(":visible")){ +_74(_76); +p.panel("close"); +} +}; +function _74(_78){ +$(_78).children("div.tabs-panels").each(function(){ +$(this).stop(true,true); +}); +}; +function _60(_79,_7a){ +return _61(_79,_7a)!=null; +}; +function _7b(_7c,_7d){ +var _7e=$.data(_7c,"tabs").options; +_7e.showHeader=_7d; +$(_7c).tabs("resize"); +}; +function _7f(_80,_81){ +var _82=$(_80).find(">.tabs-header>.tabs-tool"); +if(_81){ +_82.removeClass("tabs-tool-hidden").show(); +}else{ +_82.addClass("tabs-tool-hidden").hide(); +} +$(_80).tabs("resize").tabs("scrollBy",0); +}; +$.fn.tabs=function(_83,_84){ +if(typeof _83=="string"){ +return $.fn.tabs.methods[_83](this,_84); +} +_83=_83||{}; +return this.each(function(){ +var _85=$.data(this,"tabs"); +if(_85){ +$.extend(_85.options,_83); +}else{ +$.data(this,"tabs",{options:$.extend({},$.fn.tabs.defaults,$.fn.tabs.parseOptions(this),_83),tabs:[],selectHis:[]}); +_28(this); +} +_d(this); +_36(this); +_13(this); +_2e(this); +_6d(this); +}); +}; +$.fn.tabs.methods={options:function(jq){ +var cc=jq[0]; +var _86=$.data(cc,"tabs").options; +var s=_24(cc); +_86.selected=s?_4a(cc,s):-1; +return _86; +},tabs:function(jq){ +return $.data(jq[0],"tabs").tabs; +},resize:function(jq,_87){ +return jq.each(function(){ +_13(this,_87); +_21(this); +}); +},add:function(jq,_88){ +return jq.each(function(){ +_4b(this,_88); +}); +},close:function(jq,_89){ +return jq.each(function(){ +_5a(this,_89); +}); +},getTab:function(jq,_8a){ +return _61(jq[0],_8a); +},getTabIndex:function(jq,tab){ +return _4a(jq[0],tab); +},getSelected:function(jq){ +return _24(jq[0]); +},select:function(jq,_8b){ +return jq.each(function(){ +_50(this,_8b); +}); +},unselect:function(jq,_8c){ +return jq.each(function(){ +_75(this,_8c); +}); +},exists:function(jq,_8d){ +return _60(jq[0],_8d); +},update:function(jq,_8e){ +return jq.each(function(){ +_51(this,_8e); +}); +},enableTab:function(jq,_8f){ +return jq.each(function(){ +var _90=$(this).tabs("getTab",_8f).panel("options"); +_90.tab.removeClass("tabs-disabled"); +_90.disabled=false; +}); +},disableTab:function(jq,_91){ +return jq.each(function(){ +var _92=$(this).tabs("getTab",_91).panel("options"); +_92.tab.addClass("tabs-disabled"); +_92.disabled=true; +}); +},showHeader:function(jq){ +return jq.each(function(){ +_7b(this,true); +}); +},hideHeader:function(jq){ +return jq.each(function(){ +_7b(this,false); +}); +},showTool:function(jq){ +return jq.each(function(){ +_7f(this,true); +}); +},hideTool:function(jq){ +return jq.each(function(){ +_7f(this,false); +}); +},scrollBy:function(jq,_93){ +return jq.each(function(){ +var _94=$(this).tabs("options"); +var _95=$(this).find(">div.tabs-header>div.tabs-wrap"); +var pos=Math.min(_95._scrollLeft()+_93,_96()); +_95.animate({scrollLeft:pos},_94.scrollDuration); +function _96(){ +var w=0; +var ul=_95.children("ul"); +ul.children("li").each(function(){ +w+=$(this).outerWidth(true); +}); +return w-_95.width()+(ul.outerWidth()-ul.width()); +}; +}); +}}; +$.fn.tabs.parseOptions=function(_97){ +return $.extend({},$.parser.parseOptions(_97,["tools","toolPosition","tabPosition",{fit:"boolean",border:"boolean",plain:"boolean"},{headerWidth:"number",tabWidth:"number",tabHeight:"number",selected:"number"},{showHeader:"boolean",justified:"boolean",narrow:"boolean",pill:"boolean"}])); +}; +$.fn.tabs.defaults={width:"auto",height:"auto",headerWidth:150,tabWidth:"auto",tabHeight:27,selected:0,showHeader:true,plain:false,fit:false,border:true,justified:false,narrow:false,pill:false,tools:null,toolPosition:"right",tabPosition:"top",scrollIncrement:100,scrollDuration:400,onLoad:function(_98){ +},onSelect:function(_99,_9a){ +},onUnselect:function(_9b,_9c){ +},onBeforeClose:function(_9d,_9e){ +},onClose:function(_9f,_a0){ +},onAdd:function(_a1,_a2){ +},onUpdate:function(_a3,_a4){ +},onContextMenu:function(e,_a5,_a6){ +}}; +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.textbox.js b/assets/js/easy-ui/plugins/jquery.textbox.js index e6bee872b7..08be422c4f 100755 --- a/assets/js/easy-ui/plugins/jquery.textbox.js +++ b/assets/js/easy-ui/plugins/jquery.textbox.js @@ -1,559 +1,559 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -var _1=0; -function _2(_3){ -$(_3).addClass("textbox-f").hide(); -var _4=$(""+""+""+"").insertAfter(_3); -var _5=$(_3).attr("name"); -if(_5){ -_4.find("input.textbox-value").attr("name",_5); -$(_3).removeAttr("name").attr("textboxName",_5); -} -return _4; -}; -function _6(_7){ -var _8=$.data(_7,"textbox"); -var _9=_8.options; -var tb=_8.textbox; -var _a="_easyui_textbox_input"+(++_1); -tb.addClass(_9.cls); -tb.find(".textbox-text").remove(); -if(_9.multiline){ -$("").prependTo(tb); -}else{ -$("").prependTo(tb); -} -$("#"+_a).attr("tabindex",$(_7).attr("tabindex")||"").css("text-align",_7.style.textAlign||""); -tb.find(".textbox-addon").remove(); -var bb=_9.icons?$.extend(true,[],_9.icons):[]; -if(_9.iconCls){ -bb.push({iconCls:_9.iconCls,disabled:true}); -} -if(bb.length){ -var bc=$("").prependTo(tb); -bc.addClass("textbox-addon-"+_9.iconAlign); -for(var i=0;i"); -} -} -tb.find(".textbox-button").remove(); -if(_9.buttonText||_9.buttonIcon){ -var _b=$("").prependTo(tb); -_b.addClass("textbox-button-"+_9.buttonAlign).linkbutton({text:_9.buttonText,iconCls:_9.buttonIcon,onClick:function(){ -var t=$(this).parent().prev(); -t.textbox("options").onClickButton.call(t[0]); -}}); -} -if(_9.label){ -if(typeof _9.label=="object"){ -_8.label=$(_9.label); -_8.label.attr("for",_a); -}else{ -$(_8.label).remove(); -_8.label=$("").html(_9.label); -_8.label.css("textAlign",_9.labelAlign).attr("for",_a); -if(_9.labelPosition=="after"){ -_8.label.insertAfter(tb); -}else{ -_8.label.insertBefore(_7); -} -_8.label.removeClass("textbox-label-left textbox-label-right textbox-label-top"); -_8.label.addClass("textbox-label-"+_9.labelPosition); -} -}else{ -$(_8.label).remove(); -} -_c(_7); -_d(_7,_9.disabled); -_e(_7,_9.readonly); -}; -function _f(_10){ -var _11=$.data(_10,"textbox"); -var tb=_11.textbox; -tb.find(".textbox-text").validatebox("destroy"); -tb.remove(); -$(_11.label).remove(); -$(_10).remove(); -}; -function _12(_13,_14){ -var _15=$.data(_13,"textbox"); -var _16=_15.options; -var tb=_15.textbox; -var _17=tb.parent(); -if(_14){ -if(typeof _14=="object"){ -$.extend(_16,_14); -}else{ -_16.width=_14; -} -} -if(isNaN(parseInt(_16.width))){ -var c=$(_13).clone(); -c.css("visibility","hidden"); -c.insertAfter(_13); -_16.width=c.outerWidth(); -c.remove(); -} -var _18=tb.is(":visible"); -if(!_18){ -tb.appendTo("body"); -} -var _19=tb.find(".textbox-text"); -var btn=tb.find(".textbox-button"); -var _1a=tb.find(".textbox-addon"); -var _1b=_1a.find(".textbox-icon"); -if(_16.height=="auto"){ -_19.css({margin:"",paddingTop:"",paddingBottom:"",height:"",lineHeight:""}); -} -tb._size(_16,_17); -if(_16.label&&_16.labelPosition){ -if(_16.labelPosition=="top"){ -_15.label._size({width:_16.labelWidth=="auto"?tb.outerWidth():_16.labelWidth},tb); -if(_16.height!="auto"){ -tb._size("height",tb.outerHeight()-_15.label.outerHeight()); -} -}else{ -_15.label._size({width:_16.labelWidth,height:tb.outerHeight()},tb); -if(!_16.multiline){ -_15.label.css("lineHeight",_15.label.height()+"px"); -} -tb._size("width",tb.outerWidth()-_15.label.outerWidth()); -} -} -if(_16.buttonAlign=="left"||_16.buttonAlign=="right"){ -btn.linkbutton("resize",{height:tb.height()}); -}else{ -btn.linkbutton("resize",{width:"100%"}); -} -var _1c=tb.width()-_1b.length*_16.iconWidth-_1d("left")-_1d("right"); -var _1e=_16.height=="auto"?_19.outerHeight():(tb.height()-_1d("top")-_1d("bottom")); -_1a.css(_16.iconAlign,_1d(_16.iconAlign)+"px"); -_1a.css("top",_1d("top")+"px"); -_1b.css({width:_16.iconWidth+"px",height:_1e+"px"}); -_19.css({paddingLeft:(_13.style.paddingLeft||""),paddingRight:(_13.style.paddingRight||""),marginLeft:_1f("left"),marginRight:_1f("right"),marginTop:_1d("top"),marginBottom:_1d("bottom")}); -if(_16.multiline){ -_19.css({paddingTop:(_13.style.paddingTop||""),paddingBottom:(_13.style.paddingBottom||"")}); -_19._outerHeight(_1e); -}else{ -_19.css({paddingTop:0,paddingBottom:0,height:_1e+"px",lineHeight:_1e+"px"}); -} -_19._outerWidth(_1c); -_16.onResizing.call(_13,_16.width,_16.height); -if(!_18){ -tb.insertAfter(_13); -} -_16.onResize.call(_13,_16.width,_16.height); -function _1f(_20){ -return (_16.iconAlign==_20?_1a._outerWidth():0)+_1d(_20); -}; -function _1d(_21){ -var w=0; -btn.filter(".textbox-button-"+_21).each(function(){ -if(_21=="left"||_21=="right"){ -w+=$(this).outerWidth(); -}else{ -w+=$(this).outerHeight(); -} -}); -return w; -}; -}; -function _c(_22){ -var _23=$(_22).textbox("options"); -var _24=$(_22).textbox("textbox"); -_24.validatebox($.extend({},_23,{deltaX:function(_25){ -return $(_22).textbox("getTipX",_25); -},deltaY:function(_26){ -return $(_22).textbox("getTipY",_26); -},onBeforeValidate:function(){ -_23.onBeforeValidate.call(_22); -var box=$(this); -if(!box.is(":focus")){ -if(box.val()!==_23.value){ -_23.oldInputValue=box.val(); -box.val(_23.value); -} -} -},onValidate:function(_27){ -var box=$(this); -if(_23.oldInputValue!=undefined){ -box.val(_23.oldInputValue); -_23.oldInputValue=undefined; -} -var tb=box.parent(); -if(_27){ -tb.removeClass("textbox-invalid"); -}else{ -tb.addClass("textbox-invalid"); -} -_23.onValidate.call(_22,_27); -}})); -}; -function _28(_29){ -var _2a=$.data(_29,"textbox"); -var _2b=_2a.options; -var tb=_2a.textbox; -var _2c=tb.find(".textbox-text"); -_2c.attr("placeholder",_2b.prompt); -_2c.unbind(".textbox"); -$(_2a.label).unbind(".textbox"); -if(!_2b.disabled&&!_2b.readonly){ -if(_2a.label){ -$(_2a.label).bind("click.textbox",function(e){ -if(!_2b.hasFocusMe){ -_2c.focus(); -$(_29).textbox("setSelectionRange",{start:0,end:_2c.val().length}); -} -}); -} -_2c.bind("blur.textbox",function(e){ -if(!tb.hasClass("textbox-focused")){ -return; -} -_2b.value=$(this).val(); -if(_2b.value==""){ -$(this).val(_2b.prompt).addClass("textbox-prompt"); -}else{ -$(this).removeClass("textbox-prompt"); -} -tb.removeClass("textbox-focused"); -}).bind("focus.textbox",function(e){ -_2b.hasFocusMe=true; -if(tb.hasClass("textbox-focused")){ -return; -} -if($(this).val()!=_2b.value){ -$(this).val(_2b.value); -} -$(this).removeClass("textbox-prompt"); -tb.addClass("textbox-focused"); -}); -for(var _2d in _2b.inputEvents){ -_2c.bind(_2d+".textbox",{target:_29},_2b.inputEvents[_2d]); -} -} -var _2e=tb.find(".textbox-addon"); -_2e.unbind().bind("click",{target:_29},function(e){ -var _2f=$(e.target).closest("a.textbox-icon:not(.textbox-icon-disabled)"); -if(_2f.length){ -var _30=parseInt(_2f.attr("icon-index")); -var _31=_2b.icons[_30]; -if(_31&&_31.handler){ -_31.handler.call(_2f[0],e); -} -_2b.onClickIcon.call(_29,_30); -} -}); -_2e.find(".textbox-icon").each(function(_32){ -var _33=_2b.icons[_32]; -var _34=$(this); -if(!_33||_33.disabled||_2b.disabled||_2b.readonly){ -_34.addClass("textbox-icon-disabled"); -}else{ -_34.removeClass("textbox-icon-disabled"); -} -}); -var btn=tb.find(".textbox-button"); -btn.linkbutton((_2b.disabled||_2b.readonly)?"disable":"enable"); -tb.unbind(".textbox").bind("_resize.textbox",function(e,_35){ -if($(this).hasClass("easyui-fluid")||_35){ -_12(_29); -} -return false; -}); -}; -function _d(_36,_37){ -var _38=$.data(_36,"textbox"); -var _39=_38.options; -var tb=_38.textbox; -var _3a=tb.find(".textbox-text"); -var ss=$(_36).add(tb.find(".textbox-value")); -_39.disabled=_37; -if(_39.disabled){ -_3a.blur(); -_3a.validatebox("disable"); -tb.addClass("textbox-disabled"); -ss.attr("disabled","disabled"); -$(_38.label).addClass("textbox-label-disabled"); -}else{ -_3a.validatebox("enable"); -tb.removeClass("textbox-disabled"); -ss.removeAttr("disabled"); -$(_38.label).removeClass("textbox-label-disabled"); -} -}; -function _e(_3b,_3c){ -var _3d=$.data(_3b,"textbox"); -var _3e=_3d.options; -var tb=_3d.textbox; -var _3f=tb.find(".textbox-text"); -_3e.readonly=_3c==undefined?true:_3c; -if(_3e.readonly){ -_3f.triggerHandler("blur.textbox"); -} -_3f.validatebox("readonly",_3e.readonly); -tb.removeClass("textbox-readonly").addClass(_3e.readonly?"textbox-readonly":""); -}; -$.fn.textbox=function(_40,_41){ -if(typeof _40=="string"){ -var _42=$.fn.textbox.methods[_40]; -if(_42){ -return _42(this,_41); -}else{ -return this.each(function(){ -var _43=$(this).textbox("textbox"); -_43.validatebox(_40,_41); -}); -} -} -_40=_40||{}; -return this.each(function(){ -var _44=$.data(this,"textbox"); -if(_44){ -$.extend(_44.options,_40); -if(_40.value!=undefined){ -_44.options.originalValue=_40.value; -} -}else{ -_44=$.data(this,"textbox",{options:$.extend({},$.fn.textbox.defaults,$.fn.textbox.parseOptions(this),_40),textbox:_2(this)}); -_44.options.originalValue=_44.options.value; -} -_6(this); -_28(this); -if(_44.options.doSize){ -_12(this); -} -var _45=_44.options.value; -_44.options.value=""; -$(this).textbox("initValue",_45); -}); -}; -$.fn.textbox.methods={options:function(jq){ -return $.data(jq[0],"textbox").options; -},cloneFrom:function(jq,_46){ -return jq.each(function(){ -var t=$(this); -if(t.data("textbox")){ -return; -} -if(!$(_46).data("textbox")){ -$(_46).textbox(); -} -var _47=$.extend(true,{},$(_46).textbox("options")); -var _48=t.attr("name")||""; -t.addClass("textbox-f").hide(); -t.removeAttr("name").attr("textboxName",_48); -var _49=$(_46).next().clone().insertAfter(t); -var _4a="_easyui_textbox_input"+(++_1); -_49.find(".textbox-value").attr("name",_48); -_49.find(".textbox-text").attr("id",_4a); -var _4b=$($(_46).textbox("label")).clone(); -if(_4b.length){ -_4b.attr("for",_4a); -if(_47.labelPosition=="after"){ -_4b.insertAfter(t.next()); -}else{ -_4b.insertBefore(t); -} -} -$.data(this,"textbox",{options:_47,textbox:_49,label:(_4b.length?_4b:undefined)}); -var _4c=$(_46).textbox("button"); -if(_4c.length){ -t.textbox("button").linkbutton($.extend(true,{},_4c.linkbutton("options"))); -} -_28(this); -_c(this); -}); -},textbox:function(jq){ -return $.data(jq[0],"textbox").textbox.find(".textbox-text"); -},button:function(jq){ -return $.data(jq[0],"textbox").textbox.find(".textbox-button"); -},label:function(jq){ -return $.data(jq[0],"textbox").label; -},destroy:function(jq){ -return jq.each(function(){ -_f(this); -}); -},resize:function(jq,_4d){ -return jq.each(function(){ -_12(this,_4d); -}); -},disable:function(jq){ -return jq.each(function(){ -_d(this,true); -_28(this); -}); -},enable:function(jq){ -return jq.each(function(){ -_d(this,false); -_28(this); -}); -},readonly:function(jq,_4e){ -return jq.each(function(){ -_e(this,_4e); -_28(this); -}); -},isValid:function(jq){ -return jq.textbox("textbox").validatebox("isValid"); -},clear:function(jq){ -return jq.each(function(){ -$(this).textbox("setValue",""); -}); -},setText:function(jq,_4f){ -return jq.each(function(){ -var _50=$(this).textbox("options"); -var _51=$(this).textbox("textbox"); -_4f=_4f==undefined?"":String(_4f); -if($(this).textbox("getText")!=_4f){ -_51.val(_4f); -} -_50.value=_4f; -if(!_51.is(":focus")){ -if(_4f){ -_51.removeClass("textbox-prompt"); -}else{ -_51.val(_50.prompt).addClass("textbox-prompt"); -} -} -$(this).textbox("validate"); -}); -},initValue:function(jq,_52){ -return jq.each(function(){ -var _53=$.data(this,"textbox"); -$(this).textbox("setText",_52); -_53.textbox.find(".textbox-value").val(_52); -$(this).val(_52); -}); -},setValue:function(jq,_54){ -return jq.each(function(){ -var _55=$.data(this,"textbox").options; -var _56=$(this).textbox("getValue"); -$(this).textbox("initValue",_54); -if(_56!=_54){ -_55.onChange.call(this,_54,_56); -$(this).closest("form").trigger("_change",[this]); -} -}); -},getText:function(jq){ -var _57=jq.textbox("textbox"); -if(_57.is(":focus")){ -return _57.val(); -}else{ -return jq.textbox("options").value; -} -},getValue:function(jq){ -return jq.data("textbox").textbox.find(".textbox-value").val(); -},reset:function(jq){ -return jq.each(function(){ -var _58=$(this).textbox("options"); -$(this).textbox("textbox").val(_58.originalValue); -$(this).textbox("setValue",_58.originalValue); -}); -},getIcon:function(jq,_59){ -return jq.data("textbox").textbox.find(".textbox-icon:eq("+_59+")"); -},getTipX:function(jq,_5a){ -var _5b=jq.data("textbox"); -var _5c=_5b.options; -var tb=_5b.textbox; -var _5d=tb.find(".textbox-text"); -var _5a=_5a||_5c.tipPosition; -var p1=tb.offset(); -var p2=_5d.offset(); -var w1=tb.outerWidth(); -var w2=_5d.outerWidth(); -if(_5a=="right"){ -return w1-w2-p2.left+p1.left; -}else{ -if(_5a=="left"){ -return p1.left-p2.left; -}else{ -return (w1-w2-p2.left+p1.left)/2-(p2.left-p1.left)/2; -} -} -},getTipY:function(jq,_5e){ -var _5f=jq.data("textbox"); -var _60=_5f.options; -var tb=_5f.textbox; -var _61=tb.find(".textbox-text"); -var _5e=_5e||_60.tipPosition; -var p1=tb.offset(); -var p2=_61.offset(); -var h1=tb.outerHeight(); -var h2=_61.outerHeight(); -if(_5e=="left"||_5e=="right"){ -return (h1-h2-p2.top+p1.top)/2-(p2.top-p1.top)/2; -}else{ -if(_5e=="bottom"){ -return (h1-h2-p2.top+p1.top); -}else{ -return (p1.top-p2.top); -} -} -},getSelectionStart:function(jq){ -return jq.textbox("getSelectionRange").start; -},getSelectionRange:function(jq){ -var _62=jq.textbox("textbox")[0]; -var _63=0; -var end=0; -if(typeof _62.selectionStart=="number"){ -_63=_62.selectionStart; -end=_62.selectionEnd; -}else{ -if(_62.createTextRange){ -var s=document.selection.createRange(); -var _64=_62.createTextRange(); -_64.setEndPoint("EndToStart",s); -_63=_64.text.length; -end=_63+s.text.length; -} -} -return {start:_63,end:end}; -},setSelectionRange:function(jq,_65){ -return jq.each(function(){ -var _66=$(this).textbox("textbox")[0]; -var _67=_65.start; -var end=_65.end; -if(_66.setSelectionRange){ -_66.setSelectionRange(_67,end); -}else{ -if(_66.createTextRange){ -var _68=_66.createTextRange(); -_68.collapse(); -_68.moveEnd("character",end); -_68.moveStart("character",_67); -_68.select(); -} -} -}); -}}; -$.fn.textbox.parseOptions=function(_69){ -var t=$(_69); -return $.extend({},$.fn.validatebox.parseOptions(_69),$.parser.parseOptions(_69,["prompt","iconCls","iconAlign","buttonText","buttonIcon","buttonAlign","label","labelPosition","labelAlign",{multiline:"boolean",iconWidth:"number",labelWidth:"number"}]),{value:(t.val()||undefined),type:(t.attr("type")?t.attr("type"):undefined)}); -}; -$.fn.textbox.defaults=$.extend({},$.fn.validatebox.defaults,{doSize:true,width:"auto",height:"auto",cls:null,prompt:"",value:"",type:"text",multiline:false,icons:[],iconCls:null,iconAlign:"right",iconWidth:18,buttonText:"",buttonIcon:null,buttonAlign:"right",label:null,labelWidth:"auto",labelPosition:"before",labelAlign:"left",inputEvents:{blur:function(e){ -var t=$(e.data.target); -var _6a=t.textbox("options"); -if(t.textbox("getValue")!=_6a.value){ -t.textbox("setValue",_6a.value); -} -},keydown:function(e){ -if(e.keyCode==13){ -var t=$(e.data.target); -t.textbox("setValue",t.textbox("getText")); -} -}},onChange:function(_6b,_6c){ -},onResizing:function(_6d,_6e){ -},onResize:function(_6f,_70){ -},onClickButton:function(){ -},onClickIcon:function(_71){ -}}); -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +var _1=0; +function _2(_3){ +$(_3).addClass("textbox-f").hide(); +var _4=$(""+""+""+"").insertAfter(_3); +var _5=$(_3).attr("name"); +if(_5){ +_4.find("input.textbox-value").attr("name",_5); +$(_3).removeAttr("name").attr("textboxName",_5); +} +return _4; +}; +function _6(_7){ +var _8=$.data(_7,"textbox"); +var _9=_8.options; +var tb=_8.textbox; +var _a="_easyui_textbox_input"+(++_1); +tb.addClass(_9.cls); +tb.find(".textbox-text").remove(); +if(_9.multiline){ +$("").prependTo(tb); +}else{ +$("").prependTo(tb); +} +$("#"+_a).attr("tabindex",$(_7).attr("tabindex")||"").css("text-align",_7.style.textAlign||""); +tb.find(".textbox-addon").remove(); +var bb=_9.icons?$.extend(true,[],_9.icons):[]; +if(_9.iconCls){ +bb.push({iconCls:_9.iconCls,disabled:true}); +} +if(bb.length){ +var bc=$("").prependTo(tb); +bc.addClass("textbox-addon-"+_9.iconAlign); +for(var i=0;i"); +} +} +tb.find(".textbox-button").remove(); +if(_9.buttonText||_9.buttonIcon){ +var _b=$("").prependTo(tb); +_b.addClass("textbox-button-"+_9.buttonAlign).linkbutton({text:_9.buttonText,iconCls:_9.buttonIcon,onClick:function(){ +var t=$(this).parent().prev(); +t.textbox("options").onClickButton.call(t[0]); +}}); +} +if(_9.label){ +if(typeof _9.label=="object"){ +_8.label=$(_9.label); +_8.label.attr("for",_a); +}else{ +$(_8.label).remove(); +_8.label=$("").html(_9.label); +_8.label.css("textAlign",_9.labelAlign).attr("for",_a); +if(_9.labelPosition=="after"){ +_8.label.insertAfter(tb); +}else{ +_8.label.insertBefore(_7); +} +_8.label.removeClass("textbox-label-left textbox-label-right textbox-label-top"); +_8.label.addClass("textbox-label-"+_9.labelPosition); +} +}else{ +$(_8.label).remove(); +} +_c(_7); +_d(_7,_9.disabled); +_e(_7,_9.readonly); +}; +function _f(_10){ +var _11=$.data(_10,"textbox"); +var tb=_11.textbox; +tb.find(".textbox-text").validatebox("destroy"); +tb.remove(); +$(_11.label).remove(); +$(_10).remove(); +}; +function _12(_13,_14){ +var _15=$.data(_13,"textbox"); +var _16=_15.options; +var tb=_15.textbox; +var _17=tb.parent(); +if(_14){ +if(typeof _14=="object"){ +$.extend(_16,_14); +}else{ +_16.width=_14; +} +} +if(isNaN(parseInt(_16.width))){ +var c=$(_13).clone(); +c.css("visibility","hidden"); +c.insertAfter(_13); +_16.width=c.outerWidth(); +c.remove(); +} +var _18=tb.is(":visible"); +if(!_18){ +tb.appendTo("body"); +} +var _19=tb.find(".textbox-text"); +var btn=tb.find(".textbox-button"); +var _1a=tb.find(".textbox-addon"); +var _1b=_1a.find(".textbox-icon"); +if(_16.height=="auto"){ +_19.css({margin:"",paddingTop:"",paddingBottom:"",height:"",lineHeight:""}); +} +tb._size(_16,_17); +if(_16.label&&_16.labelPosition){ +if(_16.labelPosition=="top"){ +_15.label._size({width:_16.labelWidth=="auto"?tb.outerWidth():_16.labelWidth},tb); +if(_16.height!="auto"){ +tb._size("height",tb.outerHeight()-_15.label.outerHeight()); +} +}else{ +_15.label._size({width:_16.labelWidth,height:tb.outerHeight()},tb); +if(!_16.multiline){ +_15.label.css("lineHeight",_15.label.height()+"px"); +} +tb._size("width",tb.outerWidth()-_15.label.outerWidth()); +} +} +if(_16.buttonAlign=="left"||_16.buttonAlign=="right"){ +btn.linkbutton("resize",{height:tb.height()}); +}else{ +btn.linkbutton("resize",{width:"100%"}); +} +var _1c=tb.width()-_1b.length*_16.iconWidth-_1d("left")-_1d("right"); +var _1e=_16.height=="auto"?_19.outerHeight():(tb.height()-_1d("top")-_1d("bottom")); +_1a.css(_16.iconAlign,_1d(_16.iconAlign)+"px"); +_1a.css("top",_1d("top")+"px"); +_1b.css({width:_16.iconWidth+"px",height:_1e+"px"}); +_19.css({paddingLeft:(_13.style.paddingLeft||""),paddingRight:(_13.style.paddingRight||""),marginLeft:_1f("left"),marginRight:_1f("right"),marginTop:_1d("top"),marginBottom:_1d("bottom")}); +if(_16.multiline){ +_19.css({paddingTop:(_13.style.paddingTop||""),paddingBottom:(_13.style.paddingBottom||"")}); +_19._outerHeight(_1e); +}else{ +_19.css({paddingTop:0,paddingBottom:0,height:_1e+"px",lineHeight:_1e+"px"}); +} +_19._outerWidth(_1c); +_16.onResizing.call(_13,_16.width,_16.height); +if(!_18){ +tb.insertAfter(_13); +} +_16.onResize.call(_13,_16.width,_16.height); +function _1f(_20){ +return (_16.iconAlign==_20?_1a._outerWidth():0)+_1d(_20); +}; +function _1d(_21){ +var w=0; +btn.filter(".textbox-button-"+_21).each(function(){ +if(_21=="left"||_21=="right"){ +w+=$(this).outerWidth(); +}else{ +w+=$(this).outerHeight(); +} +}); +return w; +}; +}; +function _c(_22){ +var _23=$(_22).textbox("options"); +var _24=$(_22).textbox("textbox"); +_24.validatebox($.extend({},_23,{deltaX:function(_25){ +return $(_22).textbox("getTipX",_25); +},deltaY:function(_26){ +return $(_22).textbox("getTipY",_26); +},onBeforeValidate:function(){ +_23.onBeforeValidate.call(_22); +var box=$(this); +if(!box.is(":focus")){ +if(box.val()!==_23.value){ +_23.oldInputValue=box.val(); +box.val(_23.value); +} +} +},onValidate:function(_27){ +var box=$(this); +if(_23.oldInputValue!=undefined){ +box.val(_23.oldInputValue); +_23.oldInputValue=undefined; +} +var tb=box.parent(); +if(_27){ +tb.removeClass("textbox-invalid"); +}else{ +tb.addClass("textbox-invalid"); +} +_23.onValidate.call(_22,_27); +}})); +}; +function _28(_29){ +var _2a=$.data(_29,"textbox"); +var _2b=_2a.options; +var tb=_2a.textbox; +var _2c=tb.find(".textbox-text"); +_2c.attr("placeholder",_2b.prompt); +_2c.unbind(".textbox"); +$(_2a.label).unbind(".textbox"); +if(!_2b.disabled&&!_2b.readonly){ +if(_2a.label){ +$(_2a.label).bind("click.textbox",function(e){ +if(!_2b.hasFocusMe){ +_2c.focus(); +$(_29).textbox("setSelectionRange",{start:0,end:_2c.val().length}); +} +}); +} +_2c.bind("blur.textbox",function(e){ +if(!tb.hasClass("textbox-focused")){ +return; +} +_2b.value=$(this).val(); +if(_2b.value==""){ +$(this).val(_2b.prompt).addClass("textbox-prompt"); +}else{ +$(this).removeClass("textbox-prompt"); +} +tb.removeClass("textbox-focused"); +}).bind("focus.textbox",function(e){ +_2b.hasFocusMe=true; +if(tb.hasClass("textbox-focused")){ +return; +} +if($(this).val()!=_2b.value){ +$(this).val(_2b.value); +} +$(this).removeClass("textbox-prompt"); +tb.addClass("textbox-focused"); +}); +for(var _2d in _2b.inputEvents){ +_2c.bind(_2d+".textbox",{target:_29},_2b.inputEvents[_2d]); +} +} +var _2e=tb.find(".textbox-addon"); +_2e.unbind().bind("click",{target:_29},function(e){ +var _2f=$(e.target).closest("a.textbox-icon:not(.textbox-icon-disabled)"); +if(_2f.length){ +var _30=parseInt(_2f.attr("icon-index")); +var _31=_2b.icons[_30]; +if(_31&&_31.handler){ +_31.handler.call(_2f[0],e); +} +_2b.onClickIcon.call(_29,_30); +} +}); +_2e.find(".textbox-icon").each(function(_32){ +var _33=_2b.icons[_32]; +var _34=$(this); +if(!_33||_33.disabled||_2b.disabled||_2b.readonly){ +_34.addClass("textbox-icon-disabled"); +}else{ +_34.removeClass("textbox-icon-disabled"); +} +}); +var btn=tb.find(".textbox-button"); +btn.linkbutton((_2b.disabled||_2b.readonly)?"disable":"enable"); +tb.unbind(".textbox").bind("_resize.textbox",function(e,_35){ +if($(this).hasClass("easyui-fluid")||_35){ +_12(_29); +} +return false; +}); +}; +function _d(_36,_37){ +var _38=$.data(_36,"textbox"); +var _39=_38.options; +var tb=_38.textbox; +var _3a=tb.find(".textbox-text"); +var ss=$(_36).add(tb.find(".textbox-value")); +_39.disabled=_37; +if(_39.disabled){ +_3a.blur(); +_3a.validatebox("disable"); +tb.addClass("textbox-disabled"); +ss.attr("disabled","disabled"); +$(_38.label).addClass("textbox-label-disabled"); +}else{ +_3a.validatebox("enable"); +tb.removeClass("textbox-disabled"); +ss.removeAttr("disabled"); +$(_38.label).removeClass("textbox-label-disabled"); +} +}; +function _e(_3b,_3c){ +var _3d=$.data(_3b,"textbox"); +var _3e=_3d.options; +var tb=_3d.textbox; +var _3f=tb.find(".textbox-text"); +_3e.readonly=_3c==undefined?true:_3c; +if(_3e.readonly){ +_3f.triggerHandler("blur.textbox"); +} +_3f.validatebox("readonly",_3e.readonly); +tb.removeClass("textbox-readonly").addClass(_3e.readonly?"textbox-readonly":""); +}; +$.fn.textbox=function(_40,_41){ +if(typeof _40=="string"){ +var _42=$.fn.textbox.methods[_40]; +if(_42){ +return _42(this,_41); +}else{ +return this.each(function(){ +var _43=$(this).textbox("textbox"); +_43.validatebox(_40,_41); +}); +} +} +_40=_40||{}; +return this.each(function(){ +var _44=$.data(this,"textbox"); +if(_44){ +$.extend(_44.options,_40); +if(_40.value!=undefined){ +_44.options.originalValue=_40.value; +} +}else{ +_44=$.data(this,"textbox",{options:$.extend({},$.fn.textbox.defaults,$.fn.textbox.parseOptions(this),_40),textbox:_2(this)}); +_44.options.originalValue=_44.options.value; +} +_6(this); +_28(this); +if(_44.options.doSize){ +_12(this); +} +var _45=_44.options.value; +_44.options.value=""; +$(this).textbox("initValue",_45); +}); +}; +$.fn.textbox.methods={options:function(jq){ +return $.data(jq[0],"textbox").options; +},cloneFrom:function(jq,_46){ +return jq.each(function(){ +var t=$(this); +if(t.data("textbox")){ +return; +} +if(!$(_46).data("textbox")){ +$(_46).textbox(); +} +var _47=$.extend(true,{},$(_46).textbox("options")); +var _48=t.attr("name")||""; +t.addClass("textbox-f").hide(); +t.removeAttr("name").attr("textboxName",_48); +var _49=$(_46).next().clone().insertAfter(t); +var _4a="_easyui_textbox_input"+(++_1); +_49.find(".textbox-value").attr("name",_48); +_49.find(".textbox-text").attr("id",_4a); +var _4b=$($(_46).textbox("label")).clone(); +if(_4b.length){ +_4b.attr("for",_4a); +if(_47.labelPosition=="after"){ +_4b.insertAfter(t.next()); +}else{ +_4b.insertBefore(t); +} +} +$.data(this,"textbox",{options:_47,textbox:_49,label:(_4b.length?_4b:undefined)}); +var _4c=$(_46).textbox("button"); +if(_4c.length){ +t.textbox("button").linkbutton($.extend(true,{},_4c.linkbutton("options"))); +} +_28(this); +_c(this); +}); +},textbox:function(jq){ +return $.data(jq[0],"textbox").textbox.find(".textbox-text"); +},button:function(jq){ +return $.data(jq[0],"textbox").textbox.find(".textbox-button"); +},label:function(jq){ +return $.data(jq[0],"textbox").label; +},destroy:function(jq){ +return jq.each(function(){ +_f(this); +}); +},resize:function(jq,_4d){ +return jq.each(function(){ +_12(this,_4d); +}); +},disable:function(jq){ +return jq.each(function(){ +_d(this,true); +_28(this); +}); +},enable:function(jq){ +return jq.each(function(){ +_d(this,false); +_28(this); +}); +},readonly:function(jq,_4e){ +return jq.each(function(){ +_e(this,_4e); +_28(this); +}); +},isValid:function(jq){ +return jq.textbox("textbox").validatebox("isValid"); +},clear:function(jq){ +return jq.each(function(){ +$(this).textbox("setValue",""); +}); +},setText:function(jq,_4f){ +return jq.each(function(){ +var _50=$(this).textbox("options"); +var _51=$(this).textbox("textbox"); +_4f=_4f==undefined?"":String(_4f); +if($(this).textbox("getText")!=_4f){ +_51.val(_4f); +} +_50.value=_4f; +if(!_51.is(":focus")){ +if(_4f){ +_51.removeClass("textbox-prompt"); +}else{ +_51.val(_50.prompt).addClass("textbox-prompt"); +} +} +$(this).textbox("validate"); +}); +},initValue:function(jq,_52){ +return jq.each(function(){ +var _53=$.data(this,"textbox"); +$(this).textbox("setText",_52); +_53.textbox.find(".textbox-value").val(_52); +$(this).val(_52); +}); +},setValue:function(jq,_54){ +return jq.each(function(){ +var _55=$.data(this,"textbox").options; +var _56=$(this).textbox("getValue"); +$(this).textbox("initValue",_54); +if(_56!=_54){ +_55.onChange.call(this,_54,_56); +$(this).closest("form").trigger("_change",[this]); +} +}); +},getText:function(jq){ +var _57=jq.textbox("textbox"); +if(_57.is(":focus")){ +return _57.val(); +}else{ +return jq.textbox("options").value; +} +},getValue:function(jq){ +return jq.data("textbox").textbox.find(".textbox-value").val(); +},reset:function(jq){ +return jq.each(function(){ +var _58=$(this).textbox("options"); +$(this).textbox("textbox").val(_58.originalValue); +$(this).textbox("setValue",_58.originalValue); +}); +},getIcon:function(jq,_59){ +return jq.data("textbox").textbox.find(".textbox-icon:eq("+_59+")"); +},getTipX:function(jq,_5a){ +var _5b=jq.data("textbox"); +var _5c=_5b.options; +var tb=_5b.textbox; +var _5d=tb.find(".textbox-text"); +var _5a=_5a||_5c.tipPosition; +var p1=tb.offset(); +var p2=_5d.offset(); +var w1=tb.outerWidth(); +var w2=_5d.outerWidth(); +if(_5a=="right"){ +return w1-w2-p2.left+p1.left; +}else{ +if(_5a=="left"){ +return p1.left-p2.left; +}else{ +return (w1-w2-p2.left+p1.left)/2-(p2.left-p1.left)/2; +} +} +},getTipY:function(jq,_5e){ +var _5f=jq.data("textbox"); +var _60=_5f.options; +var tb=_5f.textbox; +var _61=tb.find(".textbox-text"); +var _5e=_5e||_60.tipPosition; +var p1=tb.offset(); +var p2=_61.offset(); +var h1=tb.outerHeight(); +var h2=_61.outerHeight(); +if(_5e=="left"||_5e=="right"){ +return (h1-h2-p2.top+p1.top)/2-(p2.top-p1.top)/2; +}else{ +if(_5e=="bottom"){ +return (h1-h2-p2.top+p1.top); +}else{ +return (p1.top-p2.top); +} +} +},getSelectionStart:function(jq){ +return jq.textbox("getSelectionRange").start; +},getSelectionRange:function(jq){ +var _62=jq.textbox("textbox")[0]; +var _63=0; +var end=0; +if(typeof _62.selectionStart=="number"){ +_63=_62.selectionStart; +end=_62.selectionEnd; +}else{ +if(_62.createTextRange){ +var s=document.selection.createRange(); +var _64=_62.createTextRange(); +_64.setEndPoint("EndToStart",s); +_63=_64.text.length; +end=_63+s.text.length; +} +} +return {start:_63,end:end}; +},setSelectionRange:function(jq,_65){ +return jq.each(function(){ +var _66=$(this).textbox("textbox")[0]; +var _67=_65.start; +var end=_65.end; +if(_66.setSelectionRange){ +_66.setSelectionRange(_67,end); +}else{ +if(_66.createTextRange){ +var _68=_66.createTextRange(); +_68.collapse(); +_68.moveEnd("character",end); +_68.moveStart("character",_67); +_68.select(); +} +} +}); +}}; +$.fn.textbox.parseOptions=function(_69){ +var t=$(_69); +return $.extend({},$.fn.validatebox.parseOptions(_69),$.parser.parseOptions(_69,["prompt","iconCls","iconAlign","buttonText","buttonIcon","buttonAlign","label","labelPosition","labelAlign",{multiline:"boolean",iconWidth:"number",labelWidth:"number"}]),{value:(t.val()||undefined),type:(t.attr("type")?t.attr("type"):undefined)}); +}; +$.fn.textbox.defaults=$.extend({},$.fn.validatebox.defaults,{doSize:true,width:"auto",height:"auto",cls:null,prompt:"",value:"",type:"text",multiline:false,icons:[],iconCls:null,iconAlign:"right",iconWidth:18,buttonText:"",buttonIcon:null,buttonAlign:"right",label:null,labelWidth:"auto",labelPosition:"before",labelAlign:"left",inputEvents:{blur:function(e){ +var t=$(e.data.target); +var _6a=t.textbox("options"); +if(t.textbox("getValue")!=_6a.value){ +t.textbox("setValue",_6a.value); +} +},keydown:function(e){ +if(e.keyCode==13){ +var t=$(e.data.target); +t.textbox("setValue",t.textbox("getText")); +} +}},onChange:function(_6b,_6c){ +},onResizing:function(_6d,_6e){ +},onResize:function(_6f,_70){ +},onClickButton:function(){ +},onClickIcon:function(_71){ +}}); +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.timespinner.js b/assets/js/easy-ui/plugins/jquery.timespinner.js index deaddcacde..8fc7a5a23a 100755 --- a/assets/js/easy-ui/plugins/jquery.timespinner.js +++ b/assets/js/easy-ui/plugins/jquery.timespinner.js @@ -1,149 +1,149 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(_2){ -var _3=$.data(_2,"timespinner").options; -$(_2).addClass("timespinner-f").spinner(_3); -var _4=_3.formatter.call(_2,_3.parser.call(_2,_3.value)); -$(_2).timespinner("initValue",_4); -}; -function _5(e){ -var _6=e.data.target; -var _7=$.data(_6,"timespinner").options; -var _8=$(_6).timespinner("getSelectionStart"); -for(var i=0;i<_7.selections.length;i++){ -var _9=_7.selections[i]; -if(_8>=_9[0]&&_8<=_9[1]){ -_a(_6,i); -return; -} -} -}; -function _a(_b,_c){ -var _d=$.data(_b,"timespinner").options; -if(_c!=undefined){ -_d.highlight=_c; -} -var _e=_d.selections[_d.highlight]; -if(_e){ -var tb=$(_b).timespinner("textbox"); -$(_b).timespinner("setSelectionRange",{start:_e[0],end:_e[1]}); -tb.focus(); -} -}; -function _f(_10,_11){ -var _12=$.data(_10,"timespinner").options; -var _11=_12.parser.call(_10,_11); -var _13=_12.formatter.call(_10,_11); -$(_10).spinner("setValue",_13); -}; -function _14(_15,_16){ -var _17=$.data(_15,"timespinner").options; -var s=$(_15).timespinner("getValue"); -var _18=_17.selections[_17.highlight]; -var s1=s.substring(0,_18[0]); -var s2=s.substring(_18[0],_18[1]); -var s3=s.substring(_18[1]); -var v=s1+((parseInt(s2,10)||0)+_17.increment*(_16?-1:1))+s3; -$(_15).timespinner("setValue",v); -_a(_15); -}; -$.fn.timespinner=function(_19,_1a){ -if(typeof _19=="string"){ -var _1b=$.fn.timespinner.methods[_19]; -if(_1b){ -return _1b(this,_1a); -}else{ -return this.spinner(_19,_1a); -} -} -_19=_19||{}; -return this.each(function(){ -var _1c=$.data(this,"timespinner"); -if(_1c){ -$.extend(_1c.options,_19); -}else{ -$.data(this,"timespinner",{options:$.extend({},$.fn.timespinner.defaults,$.fn.timespinner.parseOptions(this),_19)}); -} -_1(this); -}); -}; -$.fn.timespinner.methods={options:function(jq){ -var _1d=jq.data("spinner")?jq.spinner("options"):{}; -return $.extend($.data(jq[0],"timespinner").options,{width:_1d.width,value:_1d.value,originalValue:_1d.originalValue,disabled:_1d.disabled,readonly:_1d.readonly}); -},setValue:function(jq,_1e){ -return jq.each(function(){ -_f(this,_1e); -}); -},getHours:function(jq){ -var _1f=$.data(jq[0],"timespinner").options; -var vv=jq.timespinner("getValue").split(_1f.separator); -return parseInt(vv[0],10); -},getMinutes:function(jq){ -var _20=$.data(jq[0],"timespinner").options; -var vv=jq.timespinner("getValue").split(_20.separator); -return parseInt(vv[1],10); -},getSeconds:function(jq){ -var _21=$.data(jq[0],"timespinner").options; -var vv=jq.timespinner("getValue").split(_21.separator); -return parseInt(vv[2],10)||0; -}}; -$.fn.timespinner.parseOptions=function(_22){ -return $.extend({},$.fn.spinner.parseOptions(_22),$.parser.parseOptions(_22,["separator",{showSeconds:"boolean",highlight:"number"}])); -}; -$.fn.timespinner.defaults=$.extend({},$.fn.spinner.defaults,{inputEvents:$.extend({},$.fn.spinner.defaults.inputEvents,{click:function(e){ -_5.call(this,e); -},blur:function(e){ -var t=$(e.data.target); -t.timespinner("setValue",t.timespinner("getText")); -},keydown:function(e){ -if(e.keyCode==13){ -var t=$(e.data.target); -t.timespinner("setValue",t.timespinner("getText")); -} -}}),formatter:function(_23){ -if(!_23){ -return ""; -} -var _24=$(this).timespinner("options"); -var tt=[_25(_23.getHours()),_25(_23.getMinutes())]; -if(_24.showSeconds){ -tt.push(_25(_23.getSeconds())); -} -return tt.join(_24.separator); -function _25(_26){ -return (_26<10?"0":"")+_26; -}; -},parser:function(s){ -var _27=$(this).timespinner("options"); -var _28=_29(s); -if(_28){ -var min=_29(_27.min); -var max=_29(_27.max); -if(min&&min>_28){ -_28=min; -} -if(max&&max<_28){ -_28=max; -} -} -return _28; -function _29(s){ -if(!s){ -return null; -} -var tt=s.split(_27.separator); -return new Date(1900,0,0,parseInt(tt[0],10)||0,parseInt(tt[1],10)||0,parseInt(tt[2],10)||0); -}; -},selections:[[0,2],[3,5],[6,8]],separator:":",showSeconds:false,highlight:0,spin:function(_2a){ -_14(this,_2a); -}}); -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(_2){ +var _3=$.data(_2,"timespinner").options; +$(_2).addClass("timespinner-f").spinner(_3); +var _4=_3.formatter.call(_2,_3.parser.call(_2,_3.value)); +$(_2).timespinner("initValue",_4); +}; +function _5(e){ +var _6=e.data.target; +var _7=$.data(_6,"timespinner").options; +var _8=$(_6).timespinner("getSelectionStart"); +for(var i=0;i<_7.selections.length;i++){ +var _9=_7.selections[i]; +if(_8>=_9[0]&&_8<=_9[1]){ +_a(_6,i); +return; +} +} +}; +function _a(_b,_c){ +var _d=$.data(_b,"timespinner").options; +if(_c!=undefined){ +_d.highlight=_c; +} +var _e=_d.selections[_d.highlight]; +if(_e){ +var tb=$(_b).timespinner("textbox"); +$(_b).timespinner("setSelectionRange",{start:_e[0],end:_e[1]}); +tb.focus(); +} +}; +function _f(_10,_11){ +var _12=$.data(_10,"timespinner").options; +var _11=_12.parser.call(_10,_11); +var _13=_12.formatter.call(_10,_11); +$(_10).spinner("setValue",_13); +}; +function _14(_15,_16){ +var _17=$.data(_15,"timespinner").options; +var s=$(_15).timespinner("getValue"); +var _18=_17.selections[_17.highlight]; +var s1=s.substring(0,_18[0]); +var s2=s.substring(_18[0],_18[1]); +var s3=s.substring(_18[1]); +var v=s1+((parseInt(s2,10)||0)+_17.increment*(_16?-1:1))+s3; +$(_15).timespinner("setValue",v); +_a(_15); +}; +$.fn.timespinner=function(_19,_1a){ +if(typeof _19=="string"){ +var _1b=$.fn.timespinner.methods[_19]; +if(_1b){ +return _1b(this,_1a); +}else{ +return this.spinner(_19,_1a); +} +} +_19=_19||{}; +return this.each(function(){ +var _1c=$.data(this,"timespinner"); +if(_1c){ +$.extend(_1c.options,_19); +}else{ +$.data(this,"timespinner",{options:$.extend({},$.fn.timespinner.defaults,$.fn.timespinner.parseOptions(this),_19)}); +} +_1(this); +}); +}; +$.fn.timespinner.methods={options:function(jq){ +var _1d=jq.data("spinner")?jq.spinner("options"):{}; +return $.extend($.data(jq[0],"timespinner").options,{width:_1d.width,value:_1d.value,originalValue:_1d.originalValue,disabled:_1d.disabled,readonly:_1d.readonly}); +},setValue:function(jq,_1e){ +return jq.each(function(){ +_f(this,_1e); +}); +},getHours:function(jq){ +var _1f=$.data(jq[0],"timespinner").options; +var vv=jq.timespinner("getValue").split(_1f.separator); +return parseInt(vv[0],10); +},getMinutes:function(jq){ +var _20=$.data(jq[0],"timespinner").options; +var vv=jq.timespinner("getValue").split(_20.separator); +return parseInt(vv[1],10); +},getSeconds:function(jq){ +var _21=$.data(jq[0],"timespinner").options; +var vv=jq.timespinner("getValue").split(_21.separator); +return parseInt(vv[2],10)||0; +}}; +$.fn.timespinner.parseOptions=function(_22){ +return $.extend({},$.fn.spinner.parseOptions(_22),$.parser.parseOptions(_22,["separator",{showSeconds:"boolean",highlight:"number"}])); +}; +$.fn.timespinner.defaults=$.extend({},$.fn.spinner.defaults,{inputEvents:$.extend({},$.fn.spinner.defaults.inputEvents,{click:function(e){ +_5.call(this,e); +},blur:function(e){ +var t=$(e.data.target); +t.timespinner("setValue",t.timespinner("getText")); +},keydown:function(e){ +if(e.keyCode==13){ +var t=$(e.data.target); +t.timespinner("setValue",t.timespinner("getText")); +} +}}),formatter:function(_23){ +if(!_23){ +return ""; +} +var _24=$(this).timespinner("options"); +var tt=[_25(_23.getHours()),_25(_23.getMinutes())]; +if(_24.showSeconds){ +tt.push(_25(_23.getSeconds())); +} +return tt.join(_24.separator); +function _25(_26){ +return (_26<10?"0":"")+_26; +}; +},parser:function(s){ +var _27=$(this).timespinner("options"); +var _28=_29(s); +if(_28){ +var min=_29(_27.min); +var max=_29(_27.max); +if(min&&min>_28){ +_28=min; +} +if(max&&max<_28){ +_28=max; +} +} +return _28; +function _29(s){ +if(!s){ +return null; +} +var tt=s.split(_27.separator); +return new Date(1900,0,0,parseInt(tt[0],10)||0,parseInt(tt[1],10)||0,parseInt(tt[2],10)||0); +}; +},selections:[[0,2],[3,5],[6,8]],separator:":",showSeconds:false,highlight:0,spin:function(_2a){ +_14(this,_2a); +}}); +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.tooltip.js b/assets/js/easy-ui/plugins/jquery.tooltip.js index 272dc7afdf..259588a2f0 100755 --- a/assets/js/easy-ui/plugins/jquery.tooltip.js +++ b/assets/js/easy-ui/plugins/jquery.tooltip.js @@ -1,234 +1,234 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(_2){ -$(_2).addClass("tooltip-f"); -}; -function _3(_4){ -var _5=$.data(_4,"tooltip").options; -$(_4).unbind(".tooltip").bind(_5.showEvent+".tooltip",function(e){ -$(_4).tooltip("show",e); -}).bind(_5.hideEvent+".tooltip",function(e){ -$(_4).tooltip("hide",e); -}).bind("mousemove.tooltip",function(e){ -if(_5.trackMouse){ -_5.trackMouseX=e.pageX; -_5.trackMouseY=e.pageY; -$(_4).tooltip("reposition"); -} -}); -}; -function _6(_7){ -var _8=$.data(_7,"tooltip"); -if(_8.showTimer){ -clearTimeout(_8.showTimer); -_8.showTimer=null; -} -if(_8.hideTimer){ -clearTimeout(_8.hideTimer); -_8.hideTimer=null; -} -}; -function _9(_a){ -var _b=$.data(_a,"tooltip"); -if(!_b||!_b.tip){ -return; -} -var _c=_b.options; -var _d=_b.tip; -var _e={left:-100000,top:-100000}; -if($(_a).is(":visible")){ -_e=_f(_c.position); -if(_c.position=="top"&&_e.top<0){ -_e=_f("bottom"); -}else{ -if((_c.position=="bottom")&&(_e.top+_d._outerHeight()>$(window)._outerHeight()+$(document).scrollTop())){ -_e=_f("top"); -} -} -if(_e.left<0){ -if(_c.position=="left"){ -_e=_f("right"); -}else{ -$(_a).tooltip("arrow").css("left",_d._outerWidth()/2+_e.left); -_e.left=0; -} -}else{ -if(_e.left+_d._outerWidth()>$(window)._outerWidth()+$(document)._scrollLeft()){ -if(_c.position=="right"){ -_e=_f("left"); -}else{ -var _10=_e.left; -_e.left=$(window)._outerWidth()+$(document)._scrollLeft()-_d._outerWidth(); -$(_a).tooltip("arrow").css("left",_d._outerWidth()/2-(_e.left-_10)); -} -} -} -} -_d.css({left:_e.left,top:_e.top,zIndex:(_c.zIndex!=undefined?_c.zIndex:($.fn.window?$.fn.window.defaults.zIndex++:""))}); -_c.onPosition.call(_a,_e.left,_e.top); -function _f(_11){ -_c.position=_11||"bottom"; -_d.removeClass("tooltip-top tooltip-bottom tooltip-left tooltip-right").addClass("tooltip-"+_c.position); -var _12,top; -var _13=$.isFunction(_c.deltaX)?_c.deltaX.call(_a,_c.position):_c.deltaX; -var _14=$.isFunction(_c.deltaY)?_c.deltaY.call(_a,_c.position):_c.deltaY; -if(_c.trackMouse){ -t=$(); -_12=_c.trackMouseX+_13; -top=_c.trackMouseY+_14; -}else{ -var t=$(_a); -_12=t.offset().left+_13; -top=t.offset().top+_14; -} -switch(_c.position){ -case "right": -_12+=t._outerWidth()+12+(_c.trackMouse?12:0); -top-=(_d._outerHeight()-t._outerHeight())/2; -break; -case "left": -_12-=_d._outerWidth()+12+(_c.trackMouse?12:0); -top-=(_d._outerHeight()-t._outerHeight())/2; -break; -case "top": -_12-=(_d._outerWidth()-t._outerWidth())/2; -top-=_d._outerHeight()+12+(_c.trackMouse?12:0); -break; -case "bottom": -_12-=(_d._outerWidth()-t._outerWidth())/2; -top+=t._outerHeight()+12+(_c.trackMouse?12:0); -break; -} -return {left:_12,top:top}; -}; -}; -function _15(_16,e){ -var _17=$.data(_16,"tooltip"); -var _18=_17.options; -var tip=_17.tip; -if(!tip){ -tip=$("
      "+"
      "+"
      "+"
      "+"
      ").appendTo("body"); -_17.tip=tip; -_19(_16); -} -_6(_16); -_17.showTimer=setTimeout(function(){ -$(_16).tooltip("reposition"); -tip.show(); -_18.onShow.call(_16,e); -var _1a=tip.children(".tooltip-arrow-outer"); -var _1b=tip.children(".tooltip-arrow"); -var bc="border-"+_18.position+"-color"; -_1a.add(_1b).css({borderTopColor:"",borderBottomColor:"",borderLeftColor:"",borderRightColor:""}); -_1a.css(bc,tip.css(bc)); -_1b.css(bc,tip.css("backgroundColor")); -},_18.showDelay); -}; -function _1c(_1d,e){ -var _1e=$.data(_1d,"tooltip"); -if(_1e&&_1e.tip){ -_6(_1d); -_1e.hideTimer=setTimeout(function(){ -_1e.tip.hide(); -_1e.options.onHide.call(_1d,e); -},_1e.options.hideDelay); -} -}; -function _19(_1f,_20){ -var _21=$.data(_1f,"tooltip"); -var _22=_21.options; -if(_20){ -_22.content=_20; -} -if(!_21.tip){ -return; -} -var cc=typeof _22.content=="function"?_22.content.call(_1f):_22.content; -_21.tip.children(".tooltip-content").html(cc); -_22.onUpdate.call(_1f,cc); -}; -function _23(_24){ -var _25=$.data(_24,"tooltip"); -if(_25){ -_6(_24); -var _26=_25.options; -if(_25.tip){ -_25.tip.remove(); -} -if(_26._title){ -$(_24).attr("title",_26._title); -} -$.removeData(_24,"tooltip"); -$(_24).unbind(".tooltip").removeClass("tooltip-f"); -_26.onDestroy.call(_24); -} -}; -$.fn.tooltip=function(_27,_28){ -if(typeof _27=="string"){ -return $.fn.tooltip.methods[_27](this,_28); -} -_27=_27||{}; -return this.each(function(){ -var _29=$.data(this,"tooltip"); -if(_29){ -$.extend(_29.options,_27); -}else{ -$.data(this,"tooltip",{options:$.extend({},$.fn.tooltip.defaults,$.fn.tooltip.parseOptions(this),_27)}); -_1(this); -} -_3(this); -_19(this); -}); -}; -$.fn.tooltip.methods={options:function(jq){ -return $.data(jq[0],"tooltip").options; -},tip:function(jq){ -return $.data(jq[0],"tooltip").tip; -},arrow:function(jq){ -return jq.tooltip("tip").children(".tooltip-arrow-outer,.tooltip-arrow"); -},show:function(jq,e){ -return jq.each(function(){ -_15(this,e); -}); -},hide:function(jq,e){ -return jq.each(function(){ -_1c(this,e); -}); -},update:function(jq,_2a){ -return jq.each(function(){ -_19(this,_2a); -}); -},reposition:function(jq){ -return jq.each(function(){ -_9(this); -}); -},destroy:function(jq){ -return jq.each(function(){ -_23(this); -}); -}}; -$.fn.tooltip.parseOptions=function(_2b){ -var t=$(_2b); -var _2c=$.extend({},$.parser.parseOptions(_2b,["position","showEvent","hideEvent","content",{trackMouse:"boolean",deltaX:"number",deltaY:"number",showDelay:"number",hideDelay:"number"}]),{_title:t.attr("title")}); -t.attr("title",""); -if(!_2c.content){ -_2c.content=_2c._title; -} -return _2c; -}; -$.fn.tooltip.defaults={position:"bottom",content:null,trackMouse:false,deltaX:0,deltaY:0,showEvent:"mouseenter",hideEvent:"mouseleave",showDelay:200,hideDelay:100,onShow:function(e){ -},onHide:function(e){ -},onUpdate:function(_2d){ -},onPosition:function(_2e,top){ -},onDestroy:function(){ -}}; -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(_2){ +$(_2).addClass("tooltip-f"); +}; +function _3(_4){ +var _5=$.data(_4,"tooltip").options; +$(_4).unbind(".tooltip").bind(_5.showEvent+".tooltip",function(e){ +$(_4).tooltip("show",e); +}).bind(_5.hideEvent+".tooltip",function(e){ +$(_4).tooltip("hide",e); +}).bind("mousemove.tooltip",function(e){ +if(_5.trackMouse){ +_5.trackMouseX=e.pageX; +_5.trackMouseY=e.pageY; +$(_4).tooltip("reposition"); +} +}); +}; +function _6(_7){ +var _8=$.data(_7,"tooltip"); +if(_8.showTimer){ +clearTimeout(_8.showTimer); +_8.showTimer=null; +} +if(_8.hideTimer){ +clearTimeout(_8.hideTimer); +_8.hideTimer=null; +} +}; +function _9(_a){ +var _b=$.data(_a,"tooltip"); +if(!_b||!_b.tip){ +return; +} +var _c=_b.options; +var _d=_b.tip; +var _e={left:-100000,top:-100000}; +if($(_a).is(":visible")){ +_e=_f(_c.position); +if(_c.position=="top"&&_e.top<0){ +_e=_f("bottom"); +}else{ +if((_c.position=="bottom")&&(_e.top+_d._outerHeight()>$(window)._outerHeight()+$(document).scrollTop())){ +_e=_f("top"); +} +} +if(_e.left<0){ +if(_c.position=="left"){ +_e=_f("right"); +}else{ +$(_a).tooltip("arrow").css("left",_d._outerWidth()/2+_e.left); +_e.left=0; +} +}else{ +if(_e.left+_d._outerWidth()>$(window)._outerWidth()+$(document)._scrollLeft()){ +if(_c.position=="right"){ +_e=_f("left"); +}else{ +var _10=_e.left; +_e.left=$(window)._outerWidth()+$(document)._scrollLeft()-_d._outerWidth(); +$(_a).tooltip("arrow").css("left",_d._outerWidth()/2-(_e.left-_10)); +} +} +} +} +_d.css({left:_e.left,top:_e.top,zIndex:(_c.zIndex!=undefined?_c.zIndex:($.fn.window?$.fn.window.defaults.zIndex++:""))}); +_c.onPosition.call(_a,_e.left,_e.top); +function _f(_11){ +_c.position=_11||"bottom"; +_d.removeClass("tooltip-top tooltip-bottom tooltip-left tooltip-right").addClass("tooltip-"+_c.position); +var _12,top; +var _13=$.isFunction(_c.deltaX)?_c.deltaX.call(_a,_c.position):_c.deltaX; +var _14=$.isFunction(_c.deltaY)?_c.deltaY.call(_a,_c.position):_c.deltaY; +if(_c.trackMouse){ +t=$(); +_12=_c.trackMouseX+_13; +top=_c.trackMouseY+_14; +}else{ +var t=$(_a); +_12=t.offset().left+_13; +top=t.offset().top+_14; +} +switch(_c.position){ +case "right": +_12+=t._outerWidth()+12+(_c.trackMouse?12:0); +top-=(_d._outerHeight()-t._outerHeight())/2; +break; +case "left": +_12-=_d._outerWidth()+12+(_c.trackMouse?12:0); +top-=(_d._outerHeight()-t._outerHeight())/2; +break; +case "top": +_12-=(_d._outerWidth()-t._outerWidth())/2; +top-=_d._outerHeight()+12+(_c.trackMouse?12:0); +break; +case "bottom": +_12-=(_d._outerWidth()-t._outerWidth())/2; +top+=t._outerHeight()+12+(_c.trackMouse?12:0); +break; +} +return {left:_12,top:top}; +}; +}; +function _15(_16,e){ +var _17=$.data(_16,"tooltip"); +var _18=_17.options; +var tip=_17.tip; +if(!tip){ +tip=$("
      "+"
      "+"
      "+"
      "+"
      ").appendTo("body"); +_17.tip=tip; +_19(_16); +} +_6(_16); +_17.showTimer=setTimeout(function(){ +$(_16).tooltip("reposition"); +tip.show(); +_18.onShow.call(_16,e); +var _1a=tip.children(".tooltip-arrow-outer"); +var _1b=tip.children(".tooltip-arrow"); +var bc="border-"+_18.position+"-color"; +_1a.add(_1b).css({borderTopColor:"",borderBottomColor:"",borderLeftColor:"",borderRightColor:""}); +_1a.css(bc,tip.css(bc)); +_1b.css(bc,tip.css("backgroundColor")); +},_18.showDelay); +}; +function _1c(_1d,e){ +var _1e=$.data(_1d,"tooltip"); +if(_1e&&_1e.tip){ +_6(_1d); +_1e.hideTimer=setTimeout(function(){ +_1e.tip.hide(); +_1e.options.onHide.call(_1d,e); +},_1e.options.hideDelay); +} +}; +function _19(_1f,_20){ +var _21=$.data(_1f,"tooltip"); +var _22=_21.options; +if(_20){ +_22.content=_20; +} +if(!_21.tip){ +return; +} +var cc=typeof _22.content=="function"?_22.content.call(_1f):_22.content; +_21.tip.children(".tooltip-content").html(cc); +_22.onUpdate.call(_1f,cc); +}; +function _23(_24){ +var _25=$.data(_24,"tooltip"); +if(_25){ +_6(_24); +var _26=_25.options; +if(_25.tip){ +_25.tip.remove(); +} +if(_26._title){ +$(_24).attr("title",_26._title); +} +$.removeData(_24,"tooltip"); +$(_24).unbind(".tooltip").removeClass("tooltip-f"); +_26.onDestroy.call(_24); +} +}; +$.fn.tooltip=function(_27,_28){ +if(typeof _27=="string"){ +return $.fn.tooltip.methods[_27](this,_28); +} +_27=_27||{}; +return this.each(function(){ +var _29=$.data(this,"tooltip"); +if(_29){ +$.extend(_29.options,_27); +}else{ +$.data(this,"tooltip",{options:$.extend({},$.fn.tooltip.defaults,$.fn.tooltip.parseOptions(this),_27)}); +_1(this); +} +_3(this); +_19(this); +}); +}; +$.fn.tooltip.methods={options:function(jq){ +return $.data(jq[0],"tooltip").options; +},tip:function(jq){ +return $.data(jq[0],"tooltip").tip; +},arrow:function(jq){ +return jq.tooltip("tip").children(".tooltip-arrow-outer,.tooltip-arrow"); +},show:function(jq,e){ +return jq.each(function(){ +_15(this,e); +}); +},hide:function(jq,e){ +return jq.each(function(){ +_1c(this,e); +}); +},update:function(jq,_2a){ +return jq.each(function(){ +_19(this,_2a); +}); +},reposition:function(jq){ +return jq.each(function(){ +_9(this); +}); +},destroy:function(jq){ +return jq.each(function(){ +_23(this); +}); +}}; +$.fn.tooltip.parseOptions=function(_2b){ +var t=$(_2b); +var _2c=$.extend({},$.parser.parseOptions(_2b,["position","showEvent","hideEvent","content",{trackMouse:"boolean",deltaX:"number",deltaY:"number",showDelay:"number",hideDelay:"number"}]),{_title:t.attr("title")}); +t.attr("title",""); +if(!_2c.content){ +_2c.content=_2c._title; +} +return _2c; +}; +$.fn.tooltip.defaults={position:"bottom",content:null,trackMouse:false,deltaX:0,deltaY:0,showEvent:"mouseenter",hideEvent:"mouseleave",showDelay:200,hideDelay:100,onShow:function(e){ +},onHide:function(e){ +},onUpdate:function(_2d){ +},onPosition:function(_2e,top){ +},onDestroy:function(){ +}}; +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.tree.js b/assets/js/easy-ui/plugins/jquery.tree.js index d6a220e33d..81a39cf7d0 100755 --- a/assets/js/easy-ui/plugins/jquery.tree.js +++ b/assets/js/easy-ui/plugins/jquery.tree.js @@ -1,1247 +1,1247 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(_2){ -var _3=$(_2); -_3.addClass("tree"); -return _3; -}; -function _4(_5){ -var _6=$.data(_5,"tree").options; -$(_5).unbind().bind("mouseover",function(e){ -var tt=$(e.target); -var _7=tt.closest("div.tree-node"); -if(!_7.length){ -return; -} -_7.addClass("tree-node-hover"); -if(tt.hasClass("tree-hit")){ -if(tt.hasClass("tree-expanded")){ -tt.addClass("tree-expanded-hover"); -}else{ -tt.addClass("tree-collapsed-hover"); -} -} -e.stopPropagation(); -}).bind("mouseout",function(e){ -var tt=$(e.target); -var _8=tt.closest("div.tree-node"); -if(!_8.length){ -return; -} -_8.removeClass("tree-node-hover"); -if(tt.hasClass("tree-hit")){ -if(tt.hasClass("tree-expanded")){ -tt.removeClass("tree-expanded-hover"); -}else{ -tt.removeClass("tree-collapsed-hover"); -} -} -e.stopPropagation(); -}).bind("click",function(e){ -var tt=$(e.target); -var _9=tt.closest("div.tree-node"); -if(!_9.length){ -return; -} -if(tt.hasClass("tree-hit")){ -_85(_5,_9[0]); -return false; -}else{ -if(tt.hasClass("tree-checkbox")){ -_34(_5,_9[0]); -return false; -}else{ -_d9(_5,_9[0]); -_6.onClick.call(_5,_c(_5,_9[0])); -} -} -e.stopPropagation(); -}).bind("dblclick",function(e){ -var _a=$(e.target).closest("div.tree-node"); -if(!_a.length){ -return; -} -_d9(_5,_a[0]); -_6.onDblClick.call(_5,_c(_5,_a[0])); -e.stopPropagation(); -}).bind("contextmenu",function(e){ -var _b=$(e.target).closest("div.tree-node"); -if(!_b.length){ -return; -} -_6.onContextMenu.call(_5,e,_c(_5,_b[0])); -e.stopPropagation(); -}); -}; -function _d(_e){ -var _f=$.data(_e,"tree").options; -_f.dnd=false; -var _10=$(_e).find("div.tree-node"); -_10.draggable("disable"); -_10.css("cursor","pointer"); -}; -function _11(_12){ -var _13=$.data(_12,"tree"); -var _14=_13.options; -var _15=_13.tree; -_13.disabledNodes=[]; -_14.dnd=true; -_15.find("div.tree-node").draggable({disabled:false,revert:true,cursor:"pointer",proxy:function(_16){ -var p=$("
      ").appendTo("body"); -p.html(" "+$(_16).find(".tree-title").html()); -p.hide(); -return p; -},deltaX:15,deltaY:15,onBeforeDrag:function(e){ -if(_14.onBeforeDrag.call(_12,_c(_12,this))==false){ -return false; -} -if($(e.target).hasClass("tree-hit")||$(e.target).hasClass("tree-checkbox")){ -return false; -} -if(e.which!=1){ -return false; -} -var _17=$(this).find("span.tree-indent"); -if(_17.length){ -e.data.offsetWidth-=_17.length*_17.width(); -} -},onStartDrag:function(e){ -$(this).next("ul").find("div.tree-node").each(function(){ -$(this).droppable("disable"); -_13.disabledNodes.push(this); -}); -$(this).draggable("proxy").css({left:-10000,top:-10000}); -_14.onStartDrag.call(_12,_c(_12,this)); -var _18=_c(_12,this); -if(_18.id==undefined){ -_18.id="easyui_tree_node_id_temp"; -_60(_12,_18); -} -_13.draggingNodeId=_18.id; -},onDrag:function(e){ -var x1=e.pageX,y1=e.pageY,x2=e.data.startX,y2=e.data.startY; -var d=Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); -if(d>3){ -$(this).draggable("proxy").show(); -} -this.pageY=e.pageY; -},onStopDrag:function(){ -for(var i=0;i<_13.disabledNodes.length;i++){ -$(_13.disabledNodes[i]).droppable("enable"); -} -_13.disabledNodes=[]; -var _19=_d0(_12,_13.draggingNodeId); -if(_19&&_19.id=="easyui_tree_node_id_temp"){ -_19.id=""; -_60(_12,_19); -} -_14.onStopDrag.call(_12,_19); -}}).droppable({accept:"div.tree-node",onDragEnter:function(e,_1a){ -if(_14.onDragEnter.call(_12,this,_1b(_1a))==false){ -_1c(_1a,false); -$(this).removeClass("tree-node-append tree-node-top tree-node-bottom"); -$(this).droppable("disable"); -_13.disabledNodes.push(this); -} -},onDragOver:function(e,_1d){ -if($(this).droppable("options").disabled){ -return; -} -var _1e=_1d.pageY; -var top=$(this).offset().top; -var _1f=top+$(this).outerHeight(); -_1c(_1d,true); -$(this).removeClass("tree-node-append tree-node-top tree-node-bottom"); -if(_1e>top+(_1f-top)/2){ -if(_1f-_1e<5){ -$(this).addClass("tree-node-bottom"); -}else{ -$(this).addClass("tree-node-append"); -} -}else{ -if(_1e-top<5){ -$(this).addClass("tree-node-top"); -}else{ -$(this).addClass("tree-node-append"); -} -} -if(_14.onDragOver.call(_12,this,_1b(_1d))==false){ -_1c(_1d,false); -$(this).removeClass("tree-node-append tree-node-top tree-node-bottom"); -$(this).droppable("disable"); -_13.disabledNodes.push(this); -} -},onDragLeave:function(e,_20){ -_1c(_20,false); -$(this).removeClass("tree-node-append tree-node-top tree-node-bottom"); -_14.onDragLeave.call(_12,this,_1b(_20)); -},onDrop:function(e,_21){ -var _22=this; -var _23,_24; -if($(this).hasClass("tree-node-append")){ -_23=_25; -_24="append"; -}else{ -_23=_26; -_24=$(this).hasClass("tree-node-top")?"top":"bottom"; -} -if(_14.onBeforeDrop.call(_12,_22,_1b(_21),_24)==false){ -$(this).removeClass("tree-node-append tree-node-top tree-node-bottom"); -return; -} -_23(_21,_22,_24); -$(this).removeClass("tree-node-append tree-node-top tree-node-bottom"); -}}); -function _1b(_27,pop){ -return $(_27).closest("ul.tree").tree(pop?"pop":"getData",_27); -}; -function _1c(_28,_29){ -var _2a=$(_28).draggable("proxy").find("span.tree-dnd-icon"); -_2a.removeClass("tree-dnd-yes tree-dnd-no").addClass(_29?"tree-dnd-yes":"tree-dnd-no"); -}; -function _25(_2b,_2c){ -if(_c(_12,_2c).state=="closed"){ -_79(_12,_2c,function(){ -_2d(); -}); -}else{ -_2d(); -} -function _2d(){ -var _2e=_1b(_2b,true); -$(_12).tree("append",{parent:_2c,data:[_2e]}); -_14.onDrop.call(_12,_2c,_2e,"append"); -}; -}; -function _26(_2f,_30,_31){ -var _32={}; -if(_31=="top"){ -_32.before=_30; -}else{ -_32.after=_30; -} -var _33=_1b(_2f,true); -_32.data=_33; -$(_12).tree("insert",_32); -_14.onDrop.call(_12,_30,_33,_31); -}; -}; -function _34(_35,_36,_37,_38){ -var _39=$.data(_35,"tree"); -var _3a=_39.options; -if(!_3a.checkbox){ -return; -} -var _3b=_c(_35,_36); -if(!_3b.checkState){ -return; -} -var ck=$(_36).find(".tree-checkbox"); -if(_37==undefined){ -if(ck.hasClass("tree-checkbox1")){ -_37=false; -}else{ -if(ck.hasClass("tree-checkbox0")){ -_37=true; -}else{ -if(_3b._checked==undefined){ -_3b._checked=$(_36).find(".tree-checkbox").hasClass("tree-checkbox1"); -} -_37=!_3b._checked; -} -} -} -_3b._checked=_37; -if(_37){ -if(ck.hasClass("tree-checkbox1")){ -return; -} -}else{ -if(ck.hasClass("tree-checkbox0")){ -return; -} -} -if(!_38){ -if(_3a.onBeforeCheck.call(_35,_3b,_37)==false){ -return; -} -} -if(_3a.cascadeCheck){ -_3c(_35,_3b,_37); -_3d(_35,_3b); -}else{ -_3e(_35,_3b,_37?"1":"0"); -} -if(!_38){ -_3a.onCheck.call(_35,_3b,_37); -} -}; -function _3c(_3f,_40,_41){ -var _42=$.data(_3f,"tree").options; -var _43=_41?1:0; -_3e(_3f,_40,_43); -if(_42.deepCheck){ -$.easyui.forEach(_40.children||[],true,function(n){ -_3e(_3f,n,_43); -}); -}else{ -var _44=[]; -if(_40.children&&_40.children.length){ -_44.push(_40); -} -$.easyui.forEach(_40.children||[],true,function(n){ -if(!n.hidden){ -_3e(_3f,n,_43); -if(n.children&&n.children.length){ -_44.push(n); -} -} -}); -for(var i=_44.length-1;i>=0;i--){ -var _45=_44[i]; -_3e(_3f,_45,_46(_45)); -} -} -}; -function _3e(_47,_48,_49){ -var _4a=$.data(_47,"tree").options; -if(!_48.checkState||_49==undefined){ -return; -} -if(_48.hidden&&!_4a.deepCheck){ -return; -} -var ck=$("#"+_48.domId).find(".tree-checkbox"); -_48.checkState=["unchecked","checked","indeterminate"][_49]; -_48.checked=(_48.checkState=="checked"); -ck.removeClass("tree-checkbox0 tree-checkbox1 tree-checkbox2"); -ck.addClass("tree-checkbox"+_49); -}; -function _3d(_4b,_4c){ -var pd=_4d(_4b,$("#"+_4c.domId)[0]); -if(pd){ -_3e(_4b,pd,_46(pd)); -_3d(_4b,pd); -} -}; -function _46(row){ -var c0=0; -var c1=0; -var len=0; -$.easyui.forEach(row.children||[],false,function(r){ -if(r.checkState){ -len++; -if(r.checkState=="checked"){ -c1++; -}else{ -if(r.checkState=="unchecked"){ -c0++; -} -} -} -}); -if(len==0){ -return undefined; -} -var _4e=0; -if(c0==len){ -_4e=0; -}else{ -if(c1==len){ -_4e=1; -}else{ -_4e=2; -} -} -return _4e; -}; -function _4f(_50,_51){ -var _52=$.data(_50,"tree").options; -if(!_52.checkbox){ -return; -} -var _53=$(_51); -var ck=_53.find(".tree-checkbox"); -var _54=_c(_50,_51); -if(_52.view.hasCheckbox(_50,_54)){ -if(!ck.length){ -_54.checkState=_54.checkState||"unchecked"; -$("").insertBefore(_53.find(".tree-title")); -} -if(_54.checkState=="checked"){ -_34(_50,_51,true,true); -}else{ -if(_54.checkState=="unchecked"){ -_34(_50,_51,false,true); -}else{ -var _55=_46(_54); -if(_55===0){ -_34(_50,_51,false,true); -}else{ -if(_55===1){ -_34(_50,_51,true,true); -} -} -} -} -}else{ -ck.remove(); -_54.checkState=undefined; -_54.checked=undefined; -_3d(_50,_54); -} -}; -function _56(_57,ul,_58,_59,_5a){ -var _5b=$.data(_57,"tree"); -var _5c=_5b.options; -var _5d=$(ul).prevAll("div.tree-node:first"); -_58=_5c.loadFilter.call(_57,_58,_5d[0]); -var _5e=_5f(_57,"domId",_5d.attr("id")); -if(!_59){ -_5e?_5e.children=_58:_5b.data=_58; -$(ul).empty(); -}else{ -if(_5e){ -_5e.children?_5e.children=_5e.children.concat(_58):_5e.children=_58; -}else{ -_5b.data=_5b.data.concat(_58); -} -} -_5c.view.render.call(_5c.view,_57,ul,_58); -if(_5c.dnd){ -_11(_57); -} -if(_5e){ -_60(_57,_5e); -} -for(var i=0;i<_5b.tmpIds.length;i++){ -_34(_57,$("#"+_5b.tmpIds[i])[0],true,true); -} -_5b.tmpIds=[]; -setTimeout(function(){ -_61(_57,_57); -},0); -if(!_5a){ -_5c.onLoadSuccess.call(_57,_5e,_58); -} -}; -function _61(_62,ul,_63){ -var _64=$.data(_62,"tree").options; -if(_64.lines){ -$(_62).addClass("tree-lines"); -}else{ -$(_62).removeClass("tree-lines"); -return; -} -if(!_63){ -_63=true; -$(_62).find("span.tree-indent").removeClass("tree-line tree-join tree-joinbottom"); -$(_62).find("div.tree-node").removeClass("tree-node-last tree-root-first tree-root-one"); -var _65=$(_62).tree("getRoots"); -if(_65.length>1){ -$(_65[0].target).addClass("tree-root-first"); -}else{ -if(_65.length==1){ -$(_65[0].target).addClass("tree-root-one"); -} -} -} -$(ul).children("li").each(function(){ -var _66=$(this).children("div.tree-node"); -var ul=_66.next("ul"); -if(ul.length){ -if($(this).next().length){ -_67(_66); -} -_61(_62,ul,_63); -}else{ -_68(_66); -} -}); -var _69=$(ul).children("li:last").children("div.tree-node").addClass("tree-node-last"); -_69.children("span.tree-join").removeClass("tree-join").addClass("tree-joinbottom"); -function _68(_6a,_6b){ -var _6c=_6a.find("span.tree-icon"); -_6c.prev("span.tree-indent").addClass("tree-join"); -}; -function _67(_6d){ -var _6e=_6d.find("span.tree-indent, span.tree-hit").length; -_6d.next().find("div.tree-node").each(function(){ -$(this).children("span:eq("+(_6e-1)+")").addClass("tree-line"); -}); -}; -}; -function _6f(_70,ul,_71,_72){ -var _73=$.data(_70,"tree").options; -_71=$.extend({},_73.queryParams,_71||{}); -var _74=null; -if(_70!=ul){ -var _75=$(ul).prev(); -_74=_c(_70,_75[0]); -} -if(_73.onBeforeLoad.call(_70,_74,_71)==false){ -return; -} -var _76=$(ul).prev().children("span.tree-folder"); -_76.addClass("tree-loading"); -var _77=_73.loader.call(_70,_71,function(_78){ -_76.removeClass("tree-loading"); -_56(_70,ul,_78); -if(_72){ -_72(); -} -},function(){ -_76.removeClass("tree-loading"); -_73.onLoadError.apply(_70,arguments); -if(_72){ -_72(); -} -}); -if(_77==false){ -_76.removeClass("tree-loading"); -} -}; -function _79(_7a,_7b,_7c){ -var _7d=$.data(_7a,"tree").options; -var hit=$(_7b).children("span.tree-hit"); -if(hit.length==0){ -return; -} -if(hit.hasClass("tree-expanded")){ -return; -} -var _7e=_c(_7a,_7b); -if(_7d.onBeforeExpand.call(_7a,_7e)==false){ -return; -} -hit.removeClass("tree-collapsed tree-collapsed-hover").addClass("tree-expanded"); -hit.next().addClass("tree-folder-open"); -var ul=$(_7b).next(); -if(ul.length){ -if(_7d.animate){ -ul.slideDown("normal",function(){ -_7e.state="open"; -_7d.onExpand.call(_7a,_7e); -if(_7c){ -_7c(); -} -}); -}else{ -ul.css("display","block"); -_7e.state="open"; -_7d.onExpand.call(_7a,_7e); -if(_7c){ -_7c(); -} -} -}else{ -var _7f=$("
        ").insertAfter(_7b); -_6f(_7a,_7f[0],{id:_7e.id},function(){ -if(_7f.is(":empty")){ -_7f.remove(); -} -if(_7d.animate){ -_7f.slideDown("normal",function(){ -_7e.state="open"; -_7d.onExpand.call(_7a,_7e); -if(_7c){ -_7c(); -} -}); -}else{ -_7f.css("display","block"); -_7e.state="open"; -_7d.onExpand.call(_7a,_7e); -if(_7c){ -_7c(); -} -} -}); -} -}; -function _80(_81,_82){ -var _83=$.data(_81,"tree").options; -var hit=$(_82).children("span.tree-hit"); -if(hit.length==0){ -return; -} -if(hit.hasClass("tree-collapsed")){ -return; -} -var _84=_c(_81,_82); -if(_83.onBeforeCollapse.call(_81,_84)==false){ -return; -} -hit.removeClass("tree-expanded tree-expanded-hover").addClass("tree-collapsed"); -hit.next().removeClass("tree-folder-open"); -var ul=$(_82).next(); -if(_83.animate){ -ul.slideUp("normal",function(){ -_84.state="closed"; -_83.onCollapse.call(_81,_84); -}); -}else{ -ul.css("display","none"); -_84.state="closed"; -_83.onCollapse.call(_81,_84); -} -}; -function _85(_86,_87){ -var hit=$(_87).children("span.tree-hit"); -if(hit.length==0){ -return; -} -if(hit.hasClass("tree-expanded")){ -_80(_86,_87); -}else{ -_79(_86,_87); -} -}; -function _88(_89,_8a){ -var _8b=_8c(_89,_8a); -if(_8a){ -_8b.unshift(_c(_89,_8a)); -} -for(var i=0;i<_8b.length;i++){ -_79(_89,_8b[i].target); -} -}; -function _8d(_8e,_8f){ -var _90=[]; -var p=_4d(_8e,_8f); -while(p){ -_90.unshift(p); -p=_4d(_8e,p.target); -} -for(var i=0;i<_90.length;i++){ -_79(_8e,_90[i].target); -} -}; -function _91(_92,_93){ -var c=$(_92).parent(); -while(c[0].tagName!="BODY"&&c.css("overflow-y")!="auto"){ -c=c.parent(); -} -var n=$(_93); -var _94=n.offset().top; -if(c[0].tagName!="BODY"){ -var _95=c.offset().top; -if(_94<_95){ -c.scrollTop(c.scrollTop()+_94-_95); -}else{ -if(_94+n.outerHeight()>_95+c.outerHeight()-18){ -c.scrollTop(c.scrollTop()+_94+n.outerHeight()-_95-c.outerHeight()+18); -} -} -}else{ -c.scrollTop(_94); -} -}; -function _96(_97,_98){ -var _99=_8c(_97,_98); -if(_98){ -_99.unshift(_c(_97,_98)); -} -for(var i=0;i<_99.length;i++){ -_80(_97,_99[i].target); -} -}; -function _9a(_9b,_9c){ -var _9d=$(_9c.parent); -var _9e=_9c.data; -if(!_9e){ -return; -} -_9e=$.isArray(_9e)?_9e:[_9e]; -if(!_9e.length){ -return; -} -var ul; -if(_9d.length==0){ -ul=$(_9b); -}else{ -if(_9f(_9b,_9d[0])){ -var _a0=_9d.find("span.tree-icon"); -_a0.removeClass("tree-file").addClass("tree-folder tree-folder-open"); -var hit=$("").insertBefore(_a0); -if(hit.prev().length){ -hit.prev().remove(); -} -} -ul=_9d.next(); -if(!ul.length){ -ul=$("
          ").insertAfter(_9d); -} -} -_56(_9b,ul[0],_9e,true,true); -}; -function _a1(_a2,_a3){ -var ref=_a3.before||_a3.after; -var _a4=_4d(_a2,ref); -var _a5=_a3.data; -if(!_a5){ -return; -} -_a5=$.isArray(_a5)?_a5:[_a5]; -if(!_a5.length){ -return; -} -_9a(_a2,{parent:(_a4?_a4.target:null),data:_a5}); -var _a6=_a4?_a4.children:$(_a2).tree("getRoots"); -for(var i=0;i<_a6.length;i++){ -if(_a6[i].domId==$(ref).attr("id")){ -for(var j=_a5.length-1;j>=0;j--){ -_a6.splice((_a3.before?i:(i+1)),0,_a5[j]); -} -_a6.splice(_a6.length-_a5.length,_a5.length); -break; -} -} -var li=$(); -for(var i=0;i<_a5.length;i++){ -li=li.add($("#"+_a5[i].domId).parent()); -} -if(_a3.before){ -li.insertBefore($(ref).parent()); -}else{ -li.insertAfter($(ref).parent()); -} -}; -function _a7(_a8,_a9){ -var _aa=del(_a9); -$(_a9).parent().remove(); -if(_aa){ -if(!_aa.children||!_aa.children.length){ -var _ab=$(_aa.target); -_ab.find(".tree-icon").removeClass("tree-folder").addClass("tree-file"); -_ab.find(".tree-hit").remove(); -$("").prependTo(_ab); -_ab.next().remove(); -} -_60(_a8,_aa); -} -_61(_a8,_a8); -function del(_ac){ -var id=$(_ac).attr("id"); -var _ad=_4d(_a8,_ac); -var cc=_ad?_ad.children:$.data(_a8,"tree").data; -for(var i=0;i").appendTo(nt); -_e6.val(_e4.text).focus(); -_e6.width(_e5+20); -_e6._outerHeight(18); -_e6.bind("click",function(e){ -return false; -}).bind("mousedown",function(e){ -e.stopPropagation(); -}).bind("mousemove",function(e){ -e.stopPropagation(); -}).bind("keydown",function(e){ -if(e.keyCode==13){ -_e7(_e1,_e2); -return false; -}else{ -if(e.keyCode==27){ -_ed(_e1,_e2); -return false; -} -} -}).bind("blur",function(e){ -e.stopPropagation(); -_e7(_e1,_e2); -}); -}; -function _e7(_e8,_e9){ -var _ea=$.data(_e8,"tree").options; -$(_e9).css("position",""); -var _eb=$(_e9).find("input.tree-editor"); -var val=_eb.val(); -_eb.remove(); -var _ec=_c(_e8,_e9); -_ec.text=val; -_60(_e8,_ec); -_ea.onAfterEdit.call(_e8,_ec); -}; -function _ed(_ee,_ef){ -var _f0=$.data(_ee,"tree").options; -$(_ef).css("position",""); -$(_ef).find("input.tree-editor").remove(); -var _f1=_c(_ee,_ef); -_60(_ee,_f1); -_f0.onCancelEdit.call(_ee,_f1); -}; -function _f2(_f3,q){ -var _f4=$.data(_f3,"tree"); -var _f5=_f4.options; -var ids={}; -$.easyui.forEach(_f4.data,true,function(_f6){ -if(_f5.filter.call(_f3,q,_f6)){ -$("#"+_f6.domId).removeClass("tree-node-hidden"); -ids[_f6.domId]=1; -_f6.hidden=false; -}else{ -$("#"+_f6.domId).addClass("tree-node-hidden"); -_f6.hidden=true; -} -}); -for(var id in ids){ -_f7(id); -} -function _f7(_f8){ -var p=$(_f3).tree("getParent",$("#"+_f8)[0]); -while(p){ -$(p.target).removeClass("tree-node-hidden"); -p.hidden=false; -p=$(_f3).tree("getParent",p.target); -} -}; -}; -$.fn.tree=function(_f9,_fa){ -if(typeof _f9=="string"){ -return $.fn.tree.methods[_f9](this,_fa); -} -var _f9=_f9||{}; -return this.each(function(){ -var _fb=$.data(this,"tree"); -var _fc; -if(_fb){ -_fc=$.extend(_fb.options,_f9); -_fb.options=_fc; -}else{ -_fc=$.extend({},$.fn.tree.defaults,$.fn.tree.parseOptions(this),_f9); -$.data(this,"tree",{options:_fc,tree:_1(this),data:[],tmpIds:[]}); -var _fd=$.fn.tree.parseData(this); -if(_fd.length){ -_56(this,this,_fd); -} -} -_4(this); -if(_fc.data){ -_56(this,this,$.extend(true,[],_fc.data)); -} -_6f(this,this); -}); -}; -$.fn.tree.methods={options:function(jq){ -return $.data(jq[0],"tree").options; -},loadData:function(jq,_fe){ -return jq.each(function(){ -_56(this,this,_fe); -}); -},getNode:function(jq,_ff){ -return _c(jq[0],_ff); -},getData:function(jq,_100){ -return _c9(jq[0],_100); -},reload:function(jq,_101){ -return jq.each(function(){ -if(_101){ -var node=$(_101); -var hit=node.children("span.tree-hit"); -hit.removeClass("tree-expanded tree-expanded-hover").addClass("tree-collapsed"); -node.next().remove(); -_79(this,_101); -}else{ -$(this).empty(); -_6f(this,this); -} -}); -},getRoot:function(jq,_102){ -return _b3(jq[0],_102); -},getRoots:function(jq){ -return _b7(jq[0]); -},getParent:function(jq,_103){ -return _4d(jq[0],_103); -},getChildren:function(jq,_104){ -return _8c(jq[0],_104); -},getChecked:function(jq,_105){ -return _c2(jq[0],_105); -},getSelected:function(jq){ -return _c6(jq[0]); -},isLeaf:function(jq,_106){ -return _9f(jq[0],_106); -},find:function(jq,id){ -return _d0(jq[0],id); -},select:function(jq,_107){ -return jq.each(function(){ -_d9(this,_107); -}); -},check:function(jq,_108){ -return jq.each(function(){ -_34(this,_108,true); -}); -},uncheck:function(jq,_109){ -return jq.each(function(){ -_34(this,_109,false); -}); -},collapse:function(jq,_10a){ -return jq.each(function(){ -_80(this,_10a); -}); -},expand:function(jq,_10b){ -return jq.each(function(){ -_79(this,_10b); -}); -},collapseAll:function(jq,_10c){ -return jq.each(function(){ -_96(this,_10c); -}); -},expandAll:function(jq,_10d){ -return jq.each(function(){ -_88(this,_10d); -}); -},expandTo:function(jq,_10e){ -return jq.each(function(){ -_8d(this,_10e); -}); -},scrollTo:function(jq,_10f){ -return jq.each(function(){ -_91(this,_10f); -}); -},toggle:function(jq,_110){ -return jq.each(function(){ -_85(this,_110); -}); -},append:function(jq,_111){ -return jq.each(function(){ -_9a(this,_111); -}); -},insert:function(jq,_112){ -return jq.each(function(){ -_a1(this,_112); -}); -},remove:function(jq,_113){ -return jq.each(function(){ -_a7(this,_113); -}); -},pop:function(jq,_114){ -var node=jq.tree("getData",_114); -jq.tree("remove",_114); -return node; -},update:function(jq,_115){ -return jq.each(function(){ -_60(this,$.extend({},_115,{checkState:_115.checked?"checked":(_115.checked===false?"unchecked":undefined)})); -}); -},enableDnd:function(jq){ -return jq.each(function(){ -_11(this); -}); -},disableDnd:function(jq){ -return jq.each(function(){ -_d(this); -}); -},beginEdit:function(jq,_116){ -return jq.each(function(){ -_e0(this,_116); -}); -},endEdit:function(jq,_117){ -return jq.each(function(){ -_e7(this,_117); -}); -},cancelEdit:function(jq,_118){ -return jq.each(function(){ -_ed(this,_118); -}); -},doFilter:function(jq,q){ -return jq.each(function(){ -_f2(this,q); -}); -}}; -$.fn.tree.parseOptions=function(_119){ -var t=$(_119); -return $.extend({},$.parser.parseOptions(_119,["url","method",{checkbox:"boolean",cascadeCheck:"boolean",onlyLeafCheck:"boolean"},{animate:"boolean",lines:"boolean",dnd:"boolean"}])); -}; -$.fn.tree.parseData=function(_11a){ -var data=[]; -_11b(data,$(_11a)); -return data; -function _11b(aa,tree){ -tree.children("li").each(function(){ -var node=$(this); -var item=$.extend({},$.parser.parseOptions(this,["id","iconCls","state"]),{checked:(node.attr("checked")?true:undefined)}); -item.text=node.children("span").html(); -if(!item.text){ -item.text=node.html(); -} -var _11c=node.children("ul"); -if(_11c.length){ -item.children=[]; -_11b(item.children,_11c); -} -aa.push(item); -}); -}; -}; -var _11d=1; -var _11e={render:function(_11f,ul,data){ -var _120=$.data(_11f,"tree"); -var opts=_120.options; -var _121=$(ul).prev(".tree-node"); -var _122=_121.length?$(_11f).tree("getNode",_121[0]):null; -var _123=_121.find("span.tree-indent, span.tree-hit").length; -var cc=_124.call(this,_123,data); -$(ul).append(cc.join("")); -function _124(_125,_126){ -var cc=[]; -for(var i=0;i<_126.length;i++){ -var item=_126[i]; -if(item.state!="open"&&item.state!="closed"){ -item.state="open"; -} -item.domId="_easyui_tree_"+_11d++; -cc.push("
        • "); -cc.push("
          "); -for(var j=0;j<_125;j++){ -cc.push(""); -} -if(item.state=="closed"){ -cc.push(""); -cc.push(""); -}else{ -if(item.children&&item.children.length){ -cc.push(""); -cc.push(""); -}else{ -cc.push(""); -cc.push(""); -} -} -if(this.hasCheckbox(_11f,item)){ -var flag=0; -if(_122&&_122.checkState=="checked"&&opts.cascadeCheck){ -flag=1; -item.checked=true; -}else{ -if(item.checked){ -$.easyui.addArrayItem(_120.tmpIds,item.domId); -} -} -item.checkState=flag?"checked":"unchecked"; -cc.push(""); -}else{ -item.checkState=undefined; -item.checked=undefined; -} -cc.push(""+opts.formatter.call(_11f,item)+""); -cc.push("
          "); -if(item.children&&item.children.length){ -var tmp=_124.call(this,_125+1,item.children); -cc.push("
            "); -cc=cc.concat(tmp); -cc.push("
          "); -} -cc.push("
        • "); -} -return cc; -}; -},hasCheckbox:function(_127,item){ -var _128=$.data(_127,"tree"); -var opts=_128.options; -if(opts.checkbox){ -if($.isFunction(opts.checkbox)){ -if(opts.checkbox.call(_127,item)){ -return true; -}else{ -return false; -} -}else{ -if(opts.onlyLeafCheck){ -if(item.state=="open"&&!(item.children&&item.children.length)){ -return true; -} -}else{ -return true; -} -} -} -return false; -}}; -$.fn.tree.defaults={url:null,method:"post",animate:false,checkbox:false,cascadeCheck:true,onlyLeafCheck:false,lines:false,dnd:false,data:null,queryParams:{},formatter:function(node){ -return node.text; -},filter:function(q,node){ -var qq=[]; -$.map($.isArray(q)?q:[q],function(q){ -q=$.trim(q); -if(q){ -qq.push(q); -} -}); -for(var i=0;i=0){ -return true; -} -} -return !qq.length; -},loader:function(_12a,_12b,_12c){ -var opts=$(this).tree("options"); -if(!opts.url){ -return false; -} -$.ajax({type:opts.method,url:opts.url,data:_12a,dataType:"json",success:function(data){ -_12b(data); -},error:function(){ -_12c.apply(this,arguments); -}}); -},loadFilter:function(data,_12d){ -return data; -},view:_11e,onBeforeLoad:function(node,_12e){ -},onLoadSuccess:function(node,data){ -},onLoadError:function(){ -},onClick:function(node){ -},onDblClick:function(node){ -},onBeforeExpand:function(node){ -},onExpand:function(node){ -},onBeforeCollapse:function(node){ -},onCollapse:function(node){ -},onBeforeCheck:function(node,_12f){ -},onCheck:function(node,_130){ -},onBeforeSelect:function(node){ -},onSelect:function(node){ -},onContextMenu:function(e,node){ -},onBeforeDrag:function(node){ -},onStartDrag:function(node){ -},onStopDrag:function(node){ -},onDragEnter:function(_131,_132){ -},onDragOver:function(_133,_134){ -},onDragLeave:function(_135,_136){ -},onBeforeDrop:function(_137,_138,_139){ -},onDrop:function(_13a,_13b,_13c){ -},onBeforeEdit:function(node){ -},onAfterEdit:function(node){ -},onCancelEdit:function(node){ -}}; -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(_2){ +var _3=$(_2); +_3.addClass("tree"); +return _3; +}; +function _4(_5){ +var _6=$.data(_5,"tree").options; +$(_5).unbind().bind("mouseover",function(e){ +var tt=$(e.target); +var _7=tt.closest("div.tree-node"); +if(!_7.length){ +return; +} +_7.addClass("tree-node-hover"); +if(tt.hasClass("tree-hit")){ +if(tt.hasClass("tree-expanded")){ +tt.addClass("tree-expanded-hover"); +}else{ +tt.addClass("tree-collapsed-hover"); +} +} +e.stopPropagation(); +}).bind("mouseout",function(e){ +var tt=$(e.target); +var _8=tt.closest("div.tree-node"); +if(!_8.length){ +return; +} +_8.removeClass("tree-node-hover"); +if(tt.hasClass("tree-hit")){ +if(tt.hasClass("tree-expanded")){ +tt.removeClass("tree-expanded-hover"); +}else{ +tt.removeClass("tree-collapsed-hover"); +} +} +e.stopPropagation(); +}).bind("click",function(e){ +var tt=$(e.target); +var _9=tt.closest("div.tree-node"); +if(!_9.length){ +return; +} +if(tt.hasClass("tree-hit")){ +_85(_5,_9[0]); +return false; +}else{ +if(tt.hasClass("tree-checkbox")){ +_34(_5,_9[0]); +return false; +}else{ +_d9(_5,_9[0]); +_6.onClick.call(_5,_c(_5,_9[0])); +} +} +e.stopPropagation(); +}).bind("dblclick",function(e){ +var _a=$(e.target).closest("div.tree-node"); +if(!_a.length){ +return; +} +_d9(_5,_a[0]); +_6.onDblClick.call(_5,_c(_5,_a[0])); +e.stopPropagation(); +}).bind("contextmenu",function(e){ +var _b=$(e.target).closest("div.tree-node"); +if(!_b.length){ +return; +} +_6.onContextMenu.call(_5,e,_c(_5,_b[0])); +e.stopPropagation(); +}); +}; +function _d(_e){ +var _f=$.data(_e,"tree").options; +_f.dnd=false; +var _10=$(_e).find("div.tree-node"); +_10.draggable("disable"); +_10.css("cursor","pointer"); +}; +function _11(_12){ +var _13=$.data(_12,"tree"); +var _14=_13.options; +var _15=_13.tree; +_13.disabledNodes=[]; +_14.dnd=true; +_15.find("div.tree-node").draggable({disabled:false,revert:true,cursor:"pointer",proxy:function(_16){ +var p=$("
          ").appendTo("body"); +p.html(" "+$(_16).find(".tree-title").html()); +p.hide(); +return p; +},deltaX:15,deltaY:15,onBeforeDrag:function(e){ +if(_14.onBeforeDrag.call(_12,_c(_12,this))==false){ +return false; +} +if($(e.target).hasClass("tree-hit")||$(e.target).hasClass("tree-checkbox")){ +return false; +} +if(e.which!=1){ +return false; +} +var _17=$(this).find("span.tree-indent"); +if(_17.length){ +e.data.offsetWidth-=_17.length*_17.width(); +} +},onStartDrag:function(e){ +$(this).next("ul").find("div.tree-node").each(function(){ +$(this).droppable("disable"); +_13.disabledNodes.push(this); +}); +$(this).draggable("proxy").css({left:-10000,top:-10000}); +_14.onStartDrag.call(_12,_c(_12,this)); +var _18=_c(_12,this); +if(_18.id==undefined){ +_18.id="easyui_tree_node_id_temp"; +_60(_12,_18); +} +_13.draggingNodeId=_18.id; +},onDrag:function(e){ +var x1=e.pageX,y1=e.pageY,x2=e.data.startX,y2=e.data.startY; +var d=Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); +if(d>3){ +$(this).draggable("proxy").show(); +} +this.pageY=e.pageY; +},onStopDrag:function(){ +for(var i=0;i<_13.disabledNodes.length;i++){ +$(_13.disabledNodes[i]).droppable("enable"); +} +_13.disabledNodes=[]; +var _19=_d0(_12,_13.draggingNodeId); +if(_19&&_19.id=="easyui_tree_node_id_temp"){ +_19.id=""; +_60(_12,_19); +} +_14.onStopDrag.call(_12,_19); +}}).droppable({accept:"div.tree-node",onDragEnter:function(e,_1a){ +if(_14.onDragEnter.call(_12,this,_1b(_1a))==false){ +_1c(_1a,false); +$(this).removeClass("tree-node-append tree-node-top tree-node-bottom"); +$(this).droppable("disable"); +_13.disabledNodes.push(this); +} +},onDragOver:function(e,_1d){ +if($(this).droppable("options").disabled){ +return; +} +var _1e=_1d.pageY; +var top=$(this).offset().top; +var _1f=top+$(this).outerHeight(); +_1c(_1d,true); +$(this).removeClass("tree-node-append tree-node-top tree-node-bottom"); +if(_1e>top+(_1f-top)/2){ +if(_1f-_1e<5){ +$(this).addClass("tree-node-bottom"); +}else{ +$(this).addClass("tree-node-append"); +} +}else{ +if(_1e-top<5){ +$(this).addClass("tree-node-top"); +}else{ +$(this).addClass("tree-node-append"); +} +} +if(_14.onDragOver.call(_12,this,_1b(_1d))==false){ +_1c(_1d,false); +$(this).removeClass("tree-node-append tree-node-top tree-node-bottom"); +$(this).droppable("disable"); +_13.disabledNodes.push(this); +} +},onDragLeave:function(e,_20){ +_1c(_20,false); +$(this).removeClass("tree-node-append tree-node-top tree-node-bottom"); +_14.onDragLeave.call(_12,this,_1b(_20)); +},onDrop:function(e,_21){ +var _22=this; +var _23,_24; +if($(this).hasClass("tree-node-append")){ +_23=_25; +_24="append"; +}else{ +_23=_26; +_24=$(this).hasClass("tree-node-top")?"top":"bottom"; +} +if(_14.onBeforeDrop.call(_12,_22,_1b(_21),_24)==false){ +$(this).removeClass("tree-node-append tree-node-top tree-node-bottom"); +return; +} +_23(_21,_22,_24); +$(this).removeClass("tree-node-append tree-node-top tree-node-bottom"); +}}); +function _1b(_27,pop){ +return $(_27).closest("ul.tree").tree(pop?"pop":"getData",_27); +}; +function _1c(_28,_29){ +var _2a=$(_28).draggable("proxy").find("span.tree-dnd-icon"); +_2a.removeClass("tree-dnd-yes tree-dnd-no").addClass(_29?"tree-dnd-yes":"tree-dnd-no"); +}; +function _25(_2b,_2c){ +if(_c(_12,_2c).state=="closed"){ +_79(_12,_2c,function(){ +_2d(); +}); +}else{ +_2d(); +} +function _2d(){ +var _2e=_1b(_2b,true); +$(_12).tree("append",{parent:_2c,data:[_2e]}); +_14.onDrop.call(_12,_2c,_2e,"append"); +}; +}; +function _26(_2f,_30,_31){ +var _32={}; +if(_31=="top"){ +_32.before=_30; +}else{ +_32.after=_30; +} +var _33=_1b(_2f,true); +_32.data=_33; +$(_12).tree("insert",_32); +_14.onDrop.call(_12,_30,_33,_31); +}; +}; +function _34(_35,_36,_37,_38){ +var _39=$.data(_35,"tree"); +var _3a=_39.options; +if(!_3a.checkbox){ +return; +} +var _3b=_c(_35,_36); +if(!_3b.checkState){ +return; +} +var ck=$(_36).find(".tree-checkbox"); +if(_37==undefined){ +if(ck.hasClass("tree-checkbox1")){ +_37=false; +}else{ +if(ck.hasClass("tree-checkbox0")){ +_37=true; +}else{ +if(_3b._checked==undefined){ +_3b._checked=$(_36).find(".tree-checkbox").hasClass("tree-checkbox1"); +} +_37=!_3b._checked; +} +} +} +_3b._checked=_37; +if(_37){ +if(ck.hasClass("tree-checkbox1")){ +return; +} +}else{ +if(ck.hasClass("tree-checkbox0")){ +return; +} +} +if(!_38){ +if(_3a.onBeforeCheck.call(_35,_3b,_37)==false){ +return; +} +} +if(_3a.cascadeCheck){ +_3c(_35,_3b,_37); +_3d(_35,_3b); +}else{ +_3e(_35,_3b,_37?"1":"0"); +} +if(!_38){ +_3a.onCheck.call(_35,_3b,_37); +} +}; +function _3c(_3f,_40,_41){ +var _42=$.data(_3f,"tree").options; +var _43=_41?1:0; +_3e(_3f,_40,_43); +if(_42.deepCheck){ +$.easyui.forEach(_40.children||[],true,function(n){ +_3e(_3f,n,_43); +}); +}else{ +var _44=[]; +if(_40.children&&_40.children.length){ +_44.push(_40); +} +$.easyui.forEach(_40.children||[],true,function(n){ +if(!n.hidden){ +_3e(_3f,n,_43); +if(n.children&&n.children.length){ +_44.push(n); +} +} +}); +for(var i=_44.length-1;i>=0;i--){ +var _45=_44[i]; +_3e(_3f,_45,_46(_45)); +} +} +}; +function _3e(_47,_48,_49){ +var _4a=$.data(_47,"tree").options; +if(!_48.checkState||_49==undefined){ +return; +} +if(_48.hidden&&!_4a.deepCheck){ +return; +} +var ck=$("#"+_48.domId).find(".tree-checkbox"); +_48.checkState=["unchecked","checked","indeterminate"][_49]; +_48.checked=(_48.checkState=="checked"); +ck.removeClass("tree-checkbox0 tree-checkbox1 tree-checkbox2"); +ck.addClass("tree-checkbox"+_49); +}; +function _3d(_4b,_4c){ +var pd=_4d(_4b,$("#"+_4c.domId)[0]); +if(pd){ +_3e(_4b,pd,_46(pd)); +_3d(_4b,pd); +} +}; +function _46(row){ +var c0=0; +var c1=0; +var len=0; +$.easyui.forEach(row.children||[],false,function(r){ +if(r.checkState){ +len++; +if(r.checkState=="checked"){ +c1++; +}else{ +if(r.checkState=="unchecked"){ +c0++; +} +} +} +}); +if(len==0){ +return undefined; +} +var _4e=0; +if(c0==len){ +_4e=0; +}else{ +if(c1==len){ +_4e=1; +}else{ +_4e=2; +} +} +return _4e; +}; +function _4f(_50,_51){ +var _52=$.data(_50,"tree").options; +if(!_52.checkbox){ +return; +} +var _53=$(_51); +var ck=_53.find(".tree-checkbox"); +var _54=_c(_50,_51); +if(_52.view.hasCheckbox(_50,_54)){ +if(!ck.length){ +_54.checkState=_54.checkState||"unchecked"; +$("").insertBefore(_53.find(".tree-title")); +} +if(_54.checkState=="checked"){ +_34(_50,_51,true,true); +}else{ +if(_54.checkState=="unchecked"){ +_34(_50,_51,false,true); +}else{ +var _55=_46(_54); +if(_55===0){ +_34(_50,_51,false,true); +}else{ +if(_55===1){ +_34(_50,_51,true,true); +} +} +} +} +}else{ +ck.remove(); +_54.checkState=undefined; +_54.checked=undefined; +_3d(_50,_54); +} +}; +function _56(_57,ul,_58,_59,_5a){ +var _5b=$.data(_57,"tree"); +var _5c=_5b.options; +var _5d=$(ul).prevAll("div.tree-node:first"); +_58=_5c.loadFilter.call(_57,_58,_5d[0]); +var _5e=_5f(_57,"domId",_5d.attr("id")); +if(!_59){ +_5e?_5e.children=_58:_5b.data=_58; +$(ul).empty(); +}else{ +if(_5e){ +_5e.children?_5e.children=_5e.children.concat(_58):_5e.children=_58; +}else{ +_5b.data=_5b.data.concat(_58); +} +} +_5c.view.render.call(_5c.view,_57,ul,_58); +if(_5c.dnd){ +_11(_57); +} +if(_5e){ +_60(_57,_5e); +} +for(var i=0;i<_5b.tmpIds.length;i++){ +_34(_57,$("#"+_5b.tmpIds[i])[0],true,true); +} +_5b.tmpIds=[]; +setTimeout(function(){ +_61(_57,_57); +},0); +if(!_5a){ +_5c.onLoadSuccess.call(_57,_5e,_58); +} +}; +function _61(_62,ul,_63){ +var _64=$.data(_62,"tree").options; +if(_64.lines){ +$(_62).addClass("tree-lines"); +}else{ +$(_62).removeClass("tree-lines"); +return; +} +if(!_63){ +_63=true; +$(_62).find("span.tree-indent").removeClass("tree-line tree-join tree-joinbottom"); +$(_62).find("div.tree-node").removeClass("tree-node-last tree-root-first tree-root-one"); +var _65=$(_62).tree("getRoots"); +if(_65.length>1){ +$(_65[0].target).addClass("tree-root-first"); +}else{ +if(_65.length==1){ +$(_65[0].target).addClass("tree-root-one"); +} +} +} +$(ul).children("li").each(function(){ +var _66=$(this).children("div.tree-node"); +var ul=_66.next("ul"); +if(ul.length){ +if($(this).next().length){ +_67(_66); +} +_61(_62,ul,_63); +}else{ +_68(_66); +} +}); +var _69=$(ul).children("li:last").children("div.tree-node").addClass("tree-node-last"); +_69.children("span.tree-join").removeClass("tree-join").addClass("tree-joinbottom"); +function _68(_6a,_6b){ +var _6c=_6a.find("span.tree-icon"); +_6c.prev("span.tree-indent").addClass("tree-join"); +}; +function _67(_6d){ +var _6e=_6d.find("span.tree-indent, span.tree-hit").length; +_6d.next().find("div.tree-node").each(function(){ +$(this).children("span:eq("+(_6e-1)+")").addClass("tree-line"); +}); +}; +}; +function _6f(_70,ul,_71,_72){ +var _73=$.data(_70,"tree").options; +_71=$.extend({},_73.queryParams,_71||{}); +var _74=null; +if(_70!=ul){ +var _75=$(ul).prev(); +_74=_c(_70,_75[0]); +} +if(_73.onBeforeLoad.call(_70,_74,_71)==false){ +return; +} +var _76=$(ul).prev().children("span.tree-folder"); +_76.addClass("tree-loading"); +var _77=_73.loader.call(_70,_71,function(_78){ +_76.removeClass("tree-loading"); +_56(_70,ul,_78); +if(_72){ +_72(); +} +},function(){ +_76.removeClass("tree-loading"); +_73.onLoadError.apply(_70,arguments); +if(_72){ +_72(); +} +}); +if(_77==false){ +_76.removeClass("tree-loading"); +} +}; +function _79(_7a,_7b,_7c){ +var _7d=$.data(_7a,"tree").options; +var hit=$(_7b).children("span.tree-hit"); +if(hit.length==0){ +return; +} +if(hit.hasClass("tree-expanded")){ +return; +} +var _7e=_c(_7a,_7b); +if(_7d.onBeforeExpand.call(_7a,_7e)==false){ +return; +} +hit.removeClass("tree-collapsed tree-collapsed-hover").addClass("tree-expanded"); +hit.next().addClass("tree-folder-open"); +var ul=$(_7b).next(); +if(ul.length){ +if(_7d.animate){ +ul.slideDown("normal",function(){ +_7e.state="open"; +_7d.onExpand.call(_7a,_7e); +if(_7c){ +_7c(); +} +}); +}else{ +ul.css("display","block"); +_7e.state="open"; +_7d.onExpand.call(_7a,_7e); +if(_7c){ +_7c(); +} +} +}else{ +var _7f=$("
            ").insertAfter(_7b); +_6f(_7a,_7f[0],{id:_7e.id},function(){ +if(_7f.is(":empty")){ +_7f.remove(); +} +if(_7d.animate){ +_7f.slideDown("normal",function(){ +_7e.state="open"; +_7d.onExpand.call(_7a,_7e); +if(_7c){ +_7c(); +} +}); +}else{ +_7f.css("display","block"); +_7e.state="open"; +_7d.onExpand.call(_7a,_7e); +if(_7c){ +_7c(); +} +} +}); +} +}; +function _80(_81,_82){ +var _83=$.data(_81,"tree").options; +var hit=$(_82).children("span.tree-hit"); +if(hit.length==0){ +return; +} +if(hit.hasClass("tree-collapsed")){ +return; +} +var _84=_c(_81,_82); +if(_83.onBeforeCollapse.call(_81,_84)==false){ +return; +} +hit.removeClass("tree-expanded tree-expanded-hover").addClass("tree-collapsed"); +hit.next().removeClass("tree-folder-open"); +var ul=$(_82).next(); +if(_83.animate){ +ul.slideUp("normal",function(){ +_84.state="closed"; +_83.onCollapse.call(_81,_84); +}); +}else{ +ul.css("display","none"); +_84.state="closed"; +_83.onCollapse.call(_81,_84); +} +}; +function _85(_86,_87){ +var hit=$(_87).children("span.tree-hit"); +if(hit.length==0){ +return; +} +if(hit.hasClass("tree-expanded")){ +_80(_86,_87); +}else{ +_79(_86,_87); +} +}; +function _88(_89,_8a){ +var _8b=_8c(_89,_8a); +if(_8a){ +_8b.unshift(_c(_89,_8a)); +} +for(var i=0;i<_8b.length;i++){ +_79(_89,_8b[i].target); +} +}; +function _8d(_8e,_8f){ +var _90=[]; +var p=_4d(_8e,_8f); +while(p){ +_90.unshift(p); +p=_4d(_8e,p.target); +} +for(var i=0;i<_90.length;i++){ +_79(_8e,_90[i].target); +} +}; +function _91(_92,_93){ +var c=$(_92).parent(); +while(c[0].tagName!="BODY"&&c.css("overflow-y")!="auto"){ +c=c.parent(); +} +var n=$(_93); +var _94=n.offset().top; +if(c[0].tagName!="BODY"){ +var _95=c.offset().top; +if(_94<_95){ +c.scrollTop(c.scrollTop()+_94-_95); +}else{ +if(_94+n.outerHeight()>_95+c.outerHeight()-18){ +c.scrollTop(c.scrollTop()+_94+n.outerHeight()-_95-c.outerHeight()+18); +} +} +}else{ +c.scrollTop(_94); +} +}; +function _96(_97,_98){ +var _99=_8c(_97,_98); +if(_98){ +_99.unshift(_c(_97,_98)); +} +for(var i=0;i<_99.length;i++){ +_80(_97,_99[i].target); +} +}; +function _9a(_9b,_9c){ +var _9d=$(_9c.parent); +var _9e=_9c.data; +if(!_9e){ +return; +} +_9e=$.isArray(_9e)?_9e:[_9e]; +if(!_9e.length){ +return; +} +var ul; +if(_9d.length==0){ +ul=$(_9b); +}else{ +if(_9f(_9b,_9d[0])){ +var _a0=_9d.find("span.tree-icon"); +_a0.removeClass("tree-file").addClass("tree-folder tree-folder-open"); +var hit=$("").insertBefore(_a0); +if(hit.prev().length){ +hit.prev().remove(); +} +} +ul=_9d.next(); +if(!ul.length){ +ul=$("
              ").insertAfter(_9d); +} +} +_56(_9b,ul[0],_9e,true,true); +}; +function _a1(_a2,_a3){ +var ref=_a3.before||_a3.after; +var _a4=_4d(_a2,ref); +var _a5=_a3.data; +if(!_a5){ +return; +} +_a5=$.isArray(_a5)?_a5:[_a5]; +if(!_a5.length){ +return; +} +_9a(_a2,{parent:(_a4?_a4.target:null),data:_a5}); +var _a6=_a4?_a4.children:$(_a2).tree("getRoots"); +for(var i=0;i<_a6.length;i++){ +if(_a6[i].domId==$(ref).attr("id")){ +for(var j=_a5.length-1;j>=0;j--){ +_a6.splice((_a3.before?i:(i+1)),0,_a5[j]); +} +_a6.splice(_a6.length-_a5.length,_a5.length); +break; +} +} +var li=$(); +for(var i=0;i<_a5.length;i++){ +li=li.add($("#"+_a5[i].domId).parent()); +} +if(_a3.before){ +li.insertBefore($(ref).parent()); +}else{ +li.insertAfter($(ref).parent()); +} +}; +function _a7(_a8,_a9){ +var _aa=del(_a9); +$(_a9).parent().remove(); +if(_aa){ +if(!_aa.children||!_aa.children.length){ +var _ab=$(_aa.target); +_ab.find(".tree-icon").removeClass("tree-folder").addClass("tree-file"); +_ab.find(".tree-hit").remove(); +$("").prependTo(_ab); +_ab.next().remove(); +} +_60(_a8,_aa); +} +_61(_a8,_a8); +function del(_ac){ +var id=$(_ac).attr("id"); +var _ad=_4d(_a8,_ac); +var cc=_ad?_ad.children:$.data(_a8,"tree").data; +for(var i=0;i").appendTo(nt); +_e6.val(_e4.text).focus(); +_e6.width(_e5+20); +_e6._outerHeight(18); +_e6.bind("click",function(e){ +return false; +}).bind("mousedown",function(e){ +e.stopPropagation(); +}).bind("mousemove",function(e){ +e.stopPropagation(); +}).bind("keydown",function(e){ +if(e.keyCode==13){ +_e7(_e1,_e2); +return false; +}else{ +if(e.keyCode==27){ +_ed(_e1,_e2); +return false; +} +} +}).bind("blur",function(e){ +e.stopPropagation(); +_e7(_e1,_e2); +}); +}; +function _e7(_e8,_e9){ +var _ea=$.data(_e8,"tree").options; +$(_e9).css("position",""); +var _eb=$(_e9).find("input.tree-editor"); +var val=_eb.val(); +_eb.remove(); +var _ec=_c(_e8,_e9); +_ec.text=val; +_60(_e8,_ec); +_ea.onAfterEdit.call(_e8,_ec); +}; +function _ed(_ee,_ef){ +var _f0=$.data(_ee,"tree").options; +$(_ef).css("position",""); +$(_ef).find("input.tree-editor").remove(); +var _f1=_c(_ee,_ef); +_60(_ee,_f1); +_f0.onCancelEdit.call(_ee,_f1); +}; +function _f2(_f3,q){ +var _f4=$.data(_f3,"tree"); +var _f5=_f4.options; +var ids={}; +$.easyui.forEach(_f4.data,true,function(_f6){ +if(_f5.filter.call(_f3,q,_f6)){ +$("#"+_f6.domId).removeClass("tree-node-hidden"); +ids[_f6.domId]=1; +_f6.hidden=false; +}else{ +$("#"+_f6.domId).addClass("tree-node-hidden"); +_f6.hidden=true; +} +}); +for(var id in ids){ +_f7(id); +} +function _f7(_f8){ +var p=$(_f3).tree("getParent",$("#"+_f8)[0]); +while(p){ +$(p.target).removeClass("tree-node-hidden"); +p.hidden=false; +p=$(_f3).tree("getParent",p.target); +} +}; +}; +$.fn.tree=function(_f9,_fa){ +if(typeof _f9=="string"){ +return $.fn.tree.methods[_f9](this,_fa); +} +var _f9=_f9||{}; +return this.each(function(){ +var _fb=$.data(this,"tree"); +var _fc; +if(_fb){ +_fc=$.extend(_fb.options,_f9); +_fb.options=_fc; +}else{ +_fc=$.extend({},$.fn.tree.defaults,$.fn.tree.parseOptions(this),_f9); +$.data(this,"tree",{options:_fc,tree:_1(this),data:[],tmpIds:[]}); +var _fd=$.fn.tree.parseData(this); +if(_fd.length){ +_56(this,this,_fd); +} +} +_4(this); +if(_fc.data){ +_56(this,this,$.extend(true,[],_fc.data)); +} +_6f(this,this); +}); +}; +$.fn.tree.methods={options:function(jq){ +return $.data(jq[0],"tree").options; +},loadData:function(jq,_fe){ +return jq.each(function(){ +_56(this,this,_fe); +}); +},getNode:function(jq,_ff){ +return _c(jq[0],_ff); +},getData:function(jq,_100){ +return _c9(jq[0],_100); +},reload:function(jq,_101){ +return jq.each(function(){ +if(_101){ +var node=$(_101); +var hit=node.children("span.tree-hit"); +hit.removeClass("tree-expanded tree-expanded-hover").addClass("tree-collapsed"); +node.next().remove(); +_79(this,_101); +}else{ +$(this).empty(); +_6f(this,this); +} +}); +},getRoot:function(jq,_102){ +return _b3(jq[0],_102); +},getRoots:function(jq){ +return _b7(jq[0]); +},getParent:function(jq,_103){ +return _4d(jq[0],_103); +},getChildren:function(jq,_104){ +return _8c(jq[0],_104); +},getChecked:function(jq,_105){ +return _c2(jq[0],_105); +},getSelected:function(jq){ +return _c6(jq[0]); +},isLeaf:function(jq,_106){ +return _9f(jq[0],_106); +},find:function(jq,id){ +return _d0(jq[0],id); +},select:function(jq,_107){ +return jq.each(function(){ +_d9(this,_107); +}); +},check:function(jq,_108){ +return jq.each(function(){ +_34(this,_108,true); +}); +},uncheck:function(jq,_109){ +return jq.each(function(){ +_34(this,_109,false); +}); +},collapse:function(jq,_10a){ +return jq.each(function(){ +_80(this,_10a); +}); +},expand:function(jq,_10b){ +return jq.each(function(){ +_79(this,_10b); +}); +},collapseAll:function(jq,_10c){ +return jq.each(function(){ +_96(this,_10c); +}); +},expandAll:function(jq,_10d){ +return jq.each(function(){ +_88(this,_10d); +}); +},expandTo:function(jq,_10e){ +return jq.each(function(){ +_8d(this,_10e); +}); +},scrollTo:function(jq,_10f){ +return jq.each(function(){ +_91(this,_10f); +}); +},toggle:function(jq,_110){ +return jq.each(function(){ +_85(this,_110); +}); +},append:function(jq,_111){ +return jq.each(function(){ +_9a(this,_111); +}); +},insert:function(jq,_112){ +return jq.each(function(){ +_a1(this,_112); +}); +},remove:function(jq,_113){ +return jq.each(function(){ +_a7(this,_113); +}); +},pop:function(jq,_114){ +var node=jq.tree("getData",_114); +jq.tree("remove",_114); +return node; +},update:function(jq,_115){ +return jq.each(function(){ +_60(this,$.extend({},_115,{checkState:_115.checked?"checked":(_115.checked===false?"unchecked":undefined)})); +}); +},enableDnd:function(jq){ +return jq.each(function(){ +_11(this); +}); +},disableDnd:function(jq){ +return jq.each(function(){ +_d(this); +}); +},beginEdit:function(jq,_116){ +return jq.each(function(){ +_e0(this,_116); +}); +},endEdit:function(jq,_117){ +return jq.each(function(){ +_e7(this,_117); +}); +},cancelEdit:function(jq,_118){ +return jq.each(function(){ +_ed(this,_118); +}); +},doFilter:function(jq,q){ +return jq.each(function(){ +_f2(this,q); +}); +}}; +$.fn.tree.parseOptions=function(_119){ +var t=$(_119); +return $.extend({},$.parser.parseOptions(_119,["url","method",{checkbox:"boolean",cascadeCheck:"boolean",onlyLeafCheck:"boolean"},{animate:"boolean",lines:"boolean",dnd:"boolean"}])); +}; +$.fn.tree.parseData=function(_11a){ +var data=[]; +_11b(data,$(_11a)); +return data; +function _11b(aa,tree){ +tree.children("li").each(function(){ +var node=$(this); +var item=$.extend({},$.parser.parseOptions(this,["id","iconCls","state"]),{checked:(node.attr("checked")?true:undefined)}); +item.text=node.children("span").html(); +if(!item.text){ +item.text=node.html(); +} +var _11c=node.children("ul"); +if(_11c.length){ +item.children=[]; +_11b(item.children,_11c); +} +aa.push(item); +}); +}; +}; +var _11d=1; +var _11e={render:function(_11f,ul,data){ +var _120=$.data(_11f,"tree"); +var opts=_120.options; +var _121=$(ul).prev(".tree-node"); +var _122=_121.length?$(_11f).tree("getNode",_121[0]):null; +var _123=_121.find("span.tree-indent, span.tree-hit").length; +var cc=_124.call(this,_123,data); +$(ul).append(cc.join("")); +function _124(_125,_126){ +var cc=[]; +for(var i=0;i<_126.length;i++){ +var item=_126[i]; +if(item.state!="open"&&item.state!="closed"){ +item.state="open"; +} +item.domId="_easyui_tree_"+_11d++; +cc.push("
            • "); +cc.push("
              "); +for(var j=0;j<_125;j++){ +cc.push(""); +} +if(item.state=="closed"){ +cc.push(""); +cc.push(""); +}else{ +if(item.children&&item.children.length){ +cc.push(""); +cc.push(""); +}else{ +cc.push(""); +cc.push(""); +} +} +if(this.hasCheckbox(_11f,item)){ +var flag=0; +if(_122&&_122.checkState=="checked"&&opts.cascadeCheck){ +flag=1; +item.checked=true; +}else{ +if(item.checked){ +$.easyui.addArrayItem(_120.tmpIds,item.domId); +} +} +item.checkState=flag?"checked":"unchecked"; +cc.push(""); +}else{ +item.checkState=undefined; +item.checked=undefined; +} +cc.push(""+opts.formatter.call(_11f,item)+""); +cc.push("
              "); +if(item.children&&item.children.length){ +var tmp=_124.call(this,_125+1,item.children); +cc.push("
                "); +cc=cc.concat(tmp); +cc.push("
              "); +} +cc.push("
            • "); +} +return cc; +}; +},hasCheckbox:function(_127,item){ +var _128=$.data(_127,"tree"); +var opts=_128.options; +if(opts.checkbox){ +if($.isFunction(opts.checkbox)){ +if(opts.checkbox.call(_127,item)){ +return true; +}else{ +return false; +} +}else{ +if(opts.onlyLeafCheck){ +if(item.state=="open"&&!(item.children&&item.children.length)){ +return true; +} +}else{ +return true; +} +} +} +return false; +}}; +$.fn.tree.defaults={url:null,method:"post",animate:false,checkbox:false,cascadeCheck:true,onlyLeafCheck:false,lines:false,dnd:false,data:null,queryParams:{},formatter:function(node){ +return node.text; +},filter:function(q,node){ +var qq=[]; +$.map($.isArray(q)?q:[q],function(q){ +q=$.trim(q); +if(q){ +qq.push(q); +} +}); +for(var i=0;i=0){ +return true; +} +} +return !qq.length; +},loader:function(_12a,_12b,_12c){ +var opts=$(this).tree("options"); +if(!opts.url){ +return false; +} +$.ajax({type:opts.method,url:opts.url,data:_12a,dataType:"json",success:function(data){ +_12b(data); +},error:function(){ +_12c.apply(this,arguments); +}}); +},loadFilter:function(data,_12d){ +return data; +},view:_11e,onBeforeLoad:function(node,_12e){ +},onLoadSuccess:function(node,data){ +},onLoadError:function(){ +},onClick:function(node){ +},onDblClick:function(node){ +},onBeforeExpand:function(node){ +},onExpand:function(node){ +},onBeforeCollapse:function(node){ +},onCollapse:function(node){ +},onBeforeCheck:function(node,_12f){ +},onCheck:function(node,_130){ +},onBeforeSelect:function(node){ +},onSelect:function(node){ +},onContextMenu:function(e,node){ +},onBeforeDrag:function(node){ +},onStartDrag:function(node){ +},onStopDrag:function(node){ +},onDragEnter:function(_131,_132){ +},onDragOver:function(_133,_134){ +},onDragLeave:function(_135,_136){ +},onBeforeDrop:function(_137,_138,_139){ +},onDrop:function(_13a,_13b,_13c){ +},onBeforeEdit:function(node){ +},onAfterEdit:function(node){ +},onCancelEdit:function(node){ +}}; +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.treegrid.js b/assets/js/easy-ui/plugins/jquery.treegrid.js index 1f51ea73de..c0125dc1c5 100755 --- a/assets/js/easy-ui/plugins/jquery.treegrid.js +++ b/assets/js/easy-ui/plugins/jquery.treegrid.js @@ -1,1350 +1,1350 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(_2){ -var _3=$.data(_2,"treegrid"); -var _4=_3.options; -$(_2).datagrid($.extend({},_4,{url:null,data:null,loader:function(){ -return false; -},onBeforeLoad:function(){ -return false; -},onLoadSuccess:function(){ -},onResizeColumn:function(_5,_6){ -_16(_2); -_4.onResizeColumn.call(_2,_5,_6); -},onBeforeSortColumn:function(_7,_8){ -if(_4.onBeforeSortColumn.call(_2,_7,_8)==false){ -return false; -} -},onSortColumn:function(_9,_a){ -_4.sortName=_9; -_4.sortOrder=_a; -if(_4.remoteSort){ -_15(_2); -}else{ -var _b=$(_2).treegrid("getData"); -_56(_2,null,_b); -} -_4.onSortColumn.call(_2,_9,_a); -},onClickCell:function(_c,_d){ -_4.onClickCell.call(_2,_d,_37(_2,_c)); -},onDblClickCell:function(_e,_f){ -_4.onDblClickCell.call(_2,_f,_37(_2,_e)); -},onRowContextMenu:function(e,_10){ -_4.onContextMenu.call(_2,e,_37(_2,_10)); -}})); -var _11=$.data(_2,"datagrid").options; -_4.columns=_11.columns; -_4.frozenColumns=_11.frozenColumns; -_3.dc=$.data(_2,"datagrid").dc; -if(_4.pagination){ -var _12=$(_2).datagrid("getPager"); -_12.pagination({pageNumber:_4.pageNumber,pageSize:_4.pageSize,pageList:_4.pageList,onSelectPage:function(_13,_14){ -_4.pageNumber=_13; -_4.pageSize=_14; -_15(_2); -}}); -_4.pageSize=_12.pagination("options").pageSize; -} -}; -function _16(_17,_18){ -var _19=$.data(_17,"datagrid").options; -var dc=$.data(_17,"datagrid").dc; -if(!dc.body1.is(":empty")&&(!_19.nowrap||_19.autoRowHeight)){ -if(_18!=undefined){ -var _1a=_1b(_17,_18); -for(var i=0;i<_1a.length;i++){ -_1c(_1a[i][_19.idField]); -} -} -} -$(_17).datagrid("fixRowHeight",_18); -function _1c(_1d){ -var tr1=_19.finder.getTr(_17,_1d,"body",1); -var tr2=_19.finder.getTr(_17,_1d,"body",2); -tr1.css("height",""); -tr2.css("height",""); -var _1e=Math.max(tr1.height(),tr2.height()); -tr1.css("height",_1e); -tr2.css("height",_1e); -}; -}; -function _1f(_20){ -var dc=$.data(_20,"datagrid").dc; -var _21=$.data(_20,"treegrid").options; -if(!_21.rownumbers){ -return; -} -dc.body1.find("div.datagrid-cell-rownumber").each(function(i){ -$(this).html(i+1); -}); -}; -function _22(_23){ -return function(e){ -$.fn.datagrid.defaults.rowEvents[_23?"mouseover":"mouseout"](e); -var tt=$(e.target); -var fn=_23?"addClass":"removeClass"; -if(tt.hasClass("tree-hit")){ -tt.hasClass("tree-expanded")?tt[fn]("tree-expanded-hover"):tt[fn]("tree-collapsed-hover"); -} -}; -}; -function _24(e){ -var tt=$(e.target); -var tr=tt.closest("tr.datagrid-row"); -if(!tr.length||!tr.parent().length){ -return; -} -var _25=tr.attr("node-id"); -var _26=_27(tr); -if(tt.hasClass("tree-hit")){ -_28(_26,_25); -}else{ -if(tt.hasClass("tree-checkbox")){ -_29(_26,_25); -}else{ -var _2a=$(_26).datagrid("options"); -if(!tt.parent().hasClass("datagrid-cell-check")&&!_2a.singleSelect&&e.shiftKey){ -var _2b=$(_26).treegrid("getChildren"); -var _2c=$.easyui.indexOfArray(_2b,_2a.idField,_2a.lastSelectedIndex); -var _2d=$.easyui.indexOfArray(_2b,_2a.idField,_25); -var _2e=Math.min(Math.max(_2c,0),_2d); -var to=Math.max(_2c,_2d); -var row=_2b[_2d]; -var td=tt.closest("td[field]",tr); -if(td.length){ -var _2f=td.attr("field"); -_2a.onClickCell.call(_26,_25,_2f,row[_2f]); -} -$(_26).treegrid("clearSelections"); -for(var i=_2e;i<=to;i++){ -$(_26).treegrid("selectRow",_2b[i][_2a.idField]); -} -_2a.onClickRow.call(_26,row); -}else{ -$.fn.datagrid.defaults.rowEvents.click(e); -} -} -} -}; -function _27(t){ -return $(t).closest("div.datagrid-view").children(".datagrid-f")[0]; -}; -function _29(_30,_31,_32,_33){ -var _34=$.data(_30,"treegrid"); -var _35=_34.checkedRows; -var _36=_34.options; -if(!_36.checkbox){ -return; -} -var row=_37(_30,_31); -if(!row.checkState){ -return; -} -var tr=_36.finder.getTr(_30,_31); -var ck=tr.find(".tree-checkbox"); -if(_32==undefined){ -if(ck.hasClass("tree-checkbox1")){ -_32=false; -}else{ -if(ck.hasClass("tree-checkbox0")){ -_32=true; -}else{ -if(row._checked==undefined){ -row._checked=ck.hasClass("tree-checkbox1"); -} -_32=!row._checked; -} -} -} -row._checked=_32; -if(_32){ -if(ck.hasClass("tree-checkbox1")){ -return; -} -}else{ -if(ck.hasClass("tree-checkbox0")){ -return; -} -} -if(!_33){ -if(_36.onBeforeCheckNode.call(_30,row,_32)==false){ -return; -} -} -if(_36.cascadeCheck){ -_38(_30,row,_32); -_39(_30,row); -}else{ -_3a(_30,row,_32?"1":"0"); -} -if(!_33){ -_36.onCheckNode.call(_30,row,_32); -} -}; -function _3a(_3b,row,_3c){ -var _3d=$.data(_3b,"treegrid"); -var _3e=_3d.checkedRows; -var _3f=_3d.options; -if(!row.checkState||_3c==undefined){ -return; -} -var tr=_3f.finder.getTr(_3b,row[_3f.idField]); -var ck=tr.find(".tree-checkbox"); -if(!ck.length){ -return; -} -row.checkState=["unchecked","checked","indeterminate"][_3c]; -row.checked=(row.checkState=="checked"); -ck.removeClass("tree-checkbox0 tree-checkbox1 tree-checkbox2"); -ck.addClass("tree-checkbox"+_3c); -if(_3c==0){ -$.easyui.removeArrayItem(_3e,_3f.idField,row[_3f.idField]); -}else{ -$.easyui.addArrayItem(_3e,_3f.idField,row); -} -}; -function _38(_40,row,_41){ -var _42=_41?1:0; -_3a(_40,row,_42); -$.easyui.forEach(row.children||[],true,function(r){ -_3a(_40,r,_42); -}); -}; -function _39(_43,row){ -var _44=$.data(_43,"treegrid").options; -var _45=_46(_43,row[_44.idField]); -if(_45){ -_3a(_43,_45,_47(_45)); -_39(_43,_45); -} -}; -function _47(row){ -var len=0; -var c0=0; -var c1=0; -$.easyui.forEach(row.children||[],false,function(r){ -if(r.checkState){ -len++; -if(r.checkState=="checked"){ -c1++; -}else{ -if(r.checkState=="unchecked"){ -c0++; -} -} -} -}); -if(len==0){ -return undefined; -} -var _48=0; -if(c0==len){ -_48=0; -}else{ -if(c1==len){ -_48=1; -}else{ -_48=2; -} -} -return _48; -}; -function _49(_4a,_4b){ -var _4c=$.data(_4a,"treegrid").options; -if(!_4c.checkbox){ -return; -} -var row=_37(_4a,_4b); -var tr=_4c.finder.getTr(_4a,_4b); -var ck=tr.find(".tree-checkbox"); -if(_4c.view.hasCheckbox(_4a,row)){ -if(!ck.length){ -row.checkState=row.checkState||"unchecked"; -$("").insertBefore(tr.find(".tree-title")); -} -if(row.checkState=="checked"){ -_29(_4a,_4b,true,true); -}else{ -if(row.checkState=="unchecked"){ -_29(_4a,_4b,false,true); -}else{ -var _4d=_47(row); -if(_4d===0){ -_29(_4a,_4b,false,true); -}else{ -if(_4d===1){ -_29(_4a,_4b,true,true); -} -} -} -} -}else{ -ck.remove(); -row.checkState=undefined; -row.checked=undefined; -_39(_4a,row); -} -}; -function _4e(_4f,_50){ -var _51=$.data(_4f,"treegrid").options; -var tr1=_51.finder.getTr(_4f,_50,"body",1); -var tr2=_51.finder.getTr(_4f,_50,"body",2); -var _52=$(_4f).datagrid("getColumnFields",true).length+(_51.rownumbers?1:0); -var _53=$(_4f).datagrid("getColumnFields",false).length; -_54(tr1,_52); -_54(tr2,_53); -function _54(tr,_55){ -$(""+""+"
              "+""+"").insertAfter(tr); -}; -}; -function _56(_57,_58,_59,_5a,_5b){ -var _5c=$.data(_57,"treegrid"); -var _5d=_5c.options; -var dc=_5c.dc; -_59=_5d.loadFilter.call(_57,_59,_58); -var _5e=_37(_57,_58); -if(_5e){ -var _5f=_5d.finder.getTr(_57,_58,"body",1); -var _60=_5d.finder.getTr(_57,_58,"body",2); -var cc1=_5f.next("tr.treegrid-tr-tree").children("td").children("div"); -var cc2=_60.next("tr.treegrid-tr-tree").children("td").children("div"); -if(!_5a){ -_5e.children=[]; -} -}else{ -var cc1=dc.body1; -var cc2=dc.body2; -if(!_5a){ -_5c.data=[]; -} -} -if(!_5a){ -cc1.empty(); -cc2.empty(); -} -if(_5d.view.onBeforeRender){ -_5d.view.onBeforeRender.call(_5d.view,_57,_58,_59); -} -_5d.view.render.call(_5d.view,_57,cc1,true); -_5d.view.render.call(_5d.view,_57,cc2,false); -if(_5d.showFooter){ -_5d.view.renderFooter.call(_5d.view,_57,dc.footer1,true); -_5d.view.renderFooter.call(_5d.view,_57,dc.footer2,false); -} -if(_5d.view.onAfterRender){ -_5d.view.onAfterRender.call(_5d.view,_57); -} -if(!_58&&_5d.pagination){ -var _61=$.data(_57,"treegrid").total; -var _62=$(_57).datagrid("getPager"); -if(_62.pagination("options").total!=_61){ -_62.pagination({total:_61}); -} -} -_16(_57); -_1f(_57); -$(_57).treegrid("showLines"); -$(_57).treegrid("setSelectionState"); -$(_57).treegrid("autoSizeColumn"); -if(!_5b){ -_5d.onLoadSuccess.call(_57,_5e,_59); -} -}; -function _15(_63,_64,_65,_66,_67){ -var _68=$.data(_63,"treegrid").options; -var _69=$(_63).datagrid("getPanel").find("div.datagrid-body"); -if(_64==undefined&&_68.queryParams){ -_68.queryParams.id=undefined; -} -if(_65){ -_68.queryParams=_65; -} -var _6a=$.extend({},_68.queryParams); -if(_68.pagination){ -$.extend(_6a,{page:_68.pageNumber,rows:_68.pageSize}); -} -if(_68.sortName){ -$.extend(_6a,{sort:_68.sortName,order:_68.sortOrder}); -} -var row=_37(_63,_64); -if(_68.onBeforeLoad.call(_63,row,_6a)==false){ -return; -} -var _6b=_69.find("tr[node-id=\""+_64+"\"] span.tree-folder"); -_6b.addClass("tree-loading"); -$(_63).treegrid("loading"); -var _6c=_68.loader.call(_63,_6a,function(_6d){ -_6b.removeClass("tree-loading"); -$(_63).treegrid("loaded"); -_56(_63,_64,_6d,_66); -if(_67){ -_67(); -} -},function(){ -_6b.removeClass("tree-loading"); -$(_63).treegrid("loaded"); -_68.onLoadError.apply(_63,arguments); -if(_67){ -_67(); -} -}); -if(_6c==false){ -_6b.removeClass("tree-loading"); -$(_63).treegrid("loaded"); -} -}; -function _6e(_6f){ -var _70=_71(_6f); -return _70.length?_70[0]:null; -}; -function _71(_72){ -return $.data(_72,"treegrid").data; -}; -function _46(_73,_74){ -var row=_37(_73,_74); -if(row._parentId){ -return _37(_73,row._parentId); -}else{ -return null; -} -}; -function _1b(_75,_76){ -var _77=$.data(_75,"treegrid").data; -if(_76){ -var _78=_37(_75,_76); -_77=_78?(_78.children||[]):[]; -} -var _79=[]; -$.easyui.forEach(_77,true,function(_7a){ -_79.push(_7a); -}); -return _79; -}; -function _7b(_7c,_7d){ -var _7e=$.data(_7c,"treegrid").options; -var tr=_7e.finder.getTr(_7c,_7d); -var _7f=tr.children("td[field=\""+_7e.treeField+"\"]"); -return _7f.find("span.tree-indent,span.tree-hit").length; -}; -function _37(_80,_81){ -var _82=$.data(_80,"treegrid"); -var _83=_82.options; -var _84=null; -$.easyui.forEach(_82.data,true,function(_85){ -if(_85[_83.idField]==_81){ -_84=_85; -return false; -} -}); -return _84; -}; -function _86(_87,_88){ -var _89=$.data(_87,"treegrid").options; -var row=_37(_87,_88); -var tr=_89.finder.getTr(_87,_88); -var hit=tr.find("span.tree-hit"); -if(hit.length==0){ -return; -} -if(hit.hasClass("tree-collapsed")){ -return; -} -if(_89.onBeforeCollapse.call(_87,row)==false){ -return; -} -hit.removeClass("tree-expanded tree-expanded-hover").addClass("tree-collapsed"); -hit.next().removeClass("tree-folder-open"); -row.state="closed"; -tr=tr.next("tr.treegrid-tr-tree"); -var cc=tr.children("td").children("div"); -if(_89.animate){ -cc.slideUp("normal",function(){ -$(_87).treegrid("autoSizeColumn"); -_16(_87,_88); -_89.onCollapse.call(_87,row); -}); -}else{ -cc.hide(); -$(_87).treegrid("autoSizeColumn"); -_16(_87,_88); -_89.onCollapse.call(_87,row); -} -}; -function _8a(_8b,_8c){ -var _8d=$.data(_8b,"treegrid").options; -var tr=_8d.finder.getTr(_8b,_8c); -var hit=tr.find("span.tree-hit"); -var row=_37(_8b,_8c); -if(hit.length==0){ -return; -} -if(hit.hasClass("tree-expanded")){ -return; -} -if(_8d.onBeforeExpand.call(_8b,row)==false){ -return; -} -hit.removeClass("tree-collapsed tree-collapsed-hover").addClass("tree-expanded"); -hit.next().addClass("tree-folder-open"); -var _8e=tr.next("tr.treegrid-tr-tree"); -if(_8e.length){ -var cc=_8e.children("td").children("div"); -_8f(cc); -}else{ -_4e(_8b,row[_8d.idField]); -var _8e=tr.next("tr.treegrid-tr-tree"); -var cc=_8e.children("td").children("div"); -cc.hide(); -var _90=$.extend({},_8d.queryParams||{}); -_90.id=row[_8d.idField]; -_15(_8b,row[_8d.idField],_90,true,function(){ -if(cc.is(":empty")){ -_8e.remove(); -}else{ -_8f(cc); -} -}); -} -function _8f(cc){ -row.state="open"; -if(_8d.animate){ -cc.slideDown("normal",function(){ -$(_8b).treegrid("autoSizeColumn"); -_16(_8b,_8c); -_8d.onExpand.call(_8b,row); -}); -}else{ -cc.show(); -$(_8b).treegrid("autoSizeColumn"); -_16(_8b,_8c); -_8d.onExpand.call(_8b,row); -} -}; -}; -function _28(_91,_92){ -var _93=$.data(_91,"treegrid").options; -var tr=_93.finder.getTr(_91,_92); -var hit=tr.find("span.tree-hit"); -if(hit.hasClass("tree-expanded")){ -_86(_91,_92); -}else{ -_8a(_91,_92); -} -}; -function _94(_95,_96){ -var _97=$.data(_95,"treegrid").options; -var _98=_1b(_95,_96); -if(_96){ -_98.unshift(_37(_95,_96)); -} -for(var i=0;i<_98.length;i++){ -_86(_95,_98[i][_97.idField]); -} -}; -function _99(_9a,_9b){ -var _9c=$.data(_9a,"treegrid").options; -var _9d=_1b(_9a,_9b); -if(_9b){ -_9d.unshift(_37(_9a,_9b)); -} -for(var i=0;i<_9d.length;i++){ -_8a(_9a,_9d[i][_9c.idField]); -} -}; -function _9e(_9f,_a0){ -var _a1=$.data(_9f,"treegrid").options; -var ids=[]; -var p=_46(_9f,_a0); -while(p){ -var id=p[_a1.idField]; -ids.unshift(id); -p=_46(_9f,id); -} -for(var i=0;i").insertBefore(_a8); -if(hit.prev().length){ -hit.prev().remove(); -} -} -} -_56(_a3,_a4.parent,_a4.data,_a5.data.length>0,true); -}; -function _a9(_aa,_ab){ -var ref=_ab.before||_ab.after; -var _ac=$.data(_aa,"treegrid").options; -var _ad=_46(_aa,ref); -_a2(_aa,{parent:(_ad?_ad[_ac.idField]:null),data:[_ab.data]}); -var _ae=_ad?_ad.children:$(_aa).treegrid("getRoots"); -for(var i=0;i<_ae.length;i++){ -if(_ae[i][_ac.idField]==ref){ -var _af=_ae[_ae.length-1]; -_ae.splice(_ab.before?i:(i+1),0,_af); -_ae.splice(_ae.length-1,1); -break; -} -} -_b0(true); -_b0(false); -_1f(_aa); -$(_aa).treegrid("showLines"); -function _b0(_b1){ -var _b2=_b1?1:2; -var tr=_ac.finder.getTr(_aa,_ab.data[_ac.idField],"body",_b2); -var _b3=tr.closest("table.datagrid-btable"); -tr=tr.parent().children(); -var _b4=_ac.finder.getTr(_aa,ref,"body",_b2); -if(_ab.before){ -tr.insertBefore(_b4); -}else{ -var sub=_b4.next("tr.treegrid-tr-tree"); -tr.insertAfter(sub.length?sub:_b4); -} -_b3.remove(); -}; -}; -function _b5(_b6,_b7){ -var _b8=$.data(_b6,"treegrid"); -var _b9=_b8.options; -var _ba=_46(_b6,_b7); -$(_b6).datagrid("deleteRow",_b7); -$.easyui.removeArrayItem(_b8.checkedRows,_b9.idField,_b7); -_1f(_b6); -if(_ba){ -_49(_b6,_ba[_b9.idField]); -} -_b8.total-=1; -$(_b6).datagrid("getPager").pagination("refresh",{total:_b8.total}); -$(_b6).treegrid("showLines"); -}; -function _bb(_bc){ -var t=$(_bc); -var _bd=t.treegrid("options"); -if(_bd.lines){ -t.treegrid("getPanel").addClass("tree-lines"); -}else{ -t.treegrid("getPanel").removeClass("tree-lines"); -return; -} -t.treegrid("getPanel").find("span.tree-indent").removeClass("tree-line tree-join tree-joinbottom"); -t.treegrid("getPanel").find("div.datagrid-cell").removeClass("tree-node-last tree-root-first tree-root-one"); -var _be=t.treegrid("getRoots"); -if(_be.length>1){ -_bf(_be[0]).addClass("tree-root-first"); -}else{ -if(_be.length==1){ -_bf(_be[0]).addClass("tree-root-one"); -} -} -_c0(_be); -_c1(_be); -function _c0(_c2){ -$.map(_c2,function(_c3){ -if(_c3.children&&_c3.children.length){ -_c0(_c3.children); -}else{ -var _c4=_bf(_c3); -_c4.find(".tree-icon").prev().addClass("tree-join"); -} -}); -if(_c2.length){ -var _c5=_bf(_c2[_c2.length-1]); -_c5.addClass("tree-node-last"); -_c5.find(".tree-join").removeClass("tree-join").addClass("tree-joinbottom"); -} -}; -function _c1(_c6){ -$.map(_c6,function(_c7){ -if(_c7.children&&_c7.children.length){ -_c1(_c7.children); -} -}); -for(var i=0;i<_c6.length-1;i++){ -var _c8=_c6[i]; -var _c9=t.treegrid("getLevel",_c8[_bd.idField]); -var tr=_bd.finder.getTr(_bc,_c8[_bd.idField]); -var cc=tr.next().find("tr.datagrid-row td[field=\""+_bd.treeField+"\"] div.datagrid-cell"); -cc.find("span:eq("+(_c9-1)+")").addClass("tree-line"); -} -}; -function _bf(_ca){ -var tr=_bd.finder.getTr(_bc,_ca[_bd.idField]); -var _cb=tr.find("td[field=\""+_bd.treeField+"\"] div.datagrid-cell"); -return _cb; -}; -}; -$.fn.treegrid=function(_cc,_cd){ -if(typeof _cc=="string"){ -var _ce=$.fn.treegrid.methods[_cc]; -if(_ce){ -return _ce(this,_cd); -}else{ -return this.datagrid(_cc,_cd); -} -} -_cc=_cc||{}; -return this.each(function(){ -var _cf=$.data(this,"treegrid"); -if(_cf){ -$.extend(_cf.options,_cc); -}else{ -_cf=$.data(this,"treegrid",{options:$.extend({},$.fn.treegrid.defaults,$.fn.treegrid.parseOptions(this),_cc),data:[],checkedRows:[],tmpIds:[]}); -} -_1(this); -if(_cf.options.data){ -$(this).treegrid("loadData",_cf.options.data); -} -_15(this); -}); -}; -$.fn.treegrid.methods={options:function(jq){ -return $.data(jq[0],"treegrid").options; -},resize:function(jq,_d0){ -return jq.each(function(){ -$(this).datagrid("resize",_d0); -}); -},fixRowHeight:function(jq,_d1){ -return jq.each(function(){ -_16(this,_d1); -}); -},loadData:function(jq,_d2){ -return jq.each(function(){ -_56(this,_d2.parent,_d2); -}); -},load:function(jq,_d3){ -return jq.each(function(){ -$(this).treegrid("options").pageNumber=1; -$(this).treegrid("getPager").pagination({pageNumber:1}); -$(this).treegrid("reload",_d3); -}); -},reload:function(jq,id){ -return jq.each(function(){ -var _d4=$(this).treegrid("options"); -var _d5={}; -if(typeof id=="object"){ -_d5=id; -}else{ -_d5=$.extend({},_d4.queryParams); -_d5.id=id; -} -if(_d5.id){ -var _d6=$(this).treegrid("find",_d5.id); -if(_d6.children){ -_d6.children.splice(0,_d6.children.length); -} -_d4.queryParams=_d5; -var tr=_d4.finder.getTr(this,_d5.id); -tr.next("tr.treegrid-tr-tree").remove(); -tr.find("span.tree-hit").removeClass("tree-expanded tree-expanded-hover").addClass("tree-collapsed"); -_8a(this,_d5.id); -}else{ -_15(this,null,_d5); -} -}); -},reloadFooter:function(jq,_d7){ -return jq.each(function(){ -var _d8=$.data(this,"treegrid").options; -var dc=$.data(this,"datagrid").dc; -if(_d7){ -$.data(this,"treegrid").footer=_d7; -} -if(_d8.showFooter){ -_d8.view.renderFooter.call(_d8.view,this,dc.footer1,true); -_d8.view.renderFooter.call(_d8.view,this,dc.footer2,false); -if(_d8.view.onAfterRender){ -_d8.view.onAfterRender.call(_d8.view,this); -} -$(this).treegrid("fixRowHeight"); -} -}); -},getData:function(jq){ -return $.data(jq[0],"treegrid").data; -},getFooterRows:function(jq){ -return $.data(jq[0],"treegrid").footer; -},getRoot:function(jq){ -return _6e(jq[0]); -},getRoots:function(jq){ -return _71(jq[0]); -},getParent:function(jq,id){ -return _46(jq[0],id); -},getChildren:function(jq,id){ -return _1b(jq[0],id); -},getLevel:function(jq,id){ -return _7b(jq[0],id); -},find:function(jq,id){ -return _37(jq[0],id); -},isLeaf:function(jq,id){ -var _d9=$.data(jq[0],"treegrid").options; -var tr=_d9.finder.getTr(jq[0],id); -var hit=tr.find("span.tree-hit"); -return hit.length==0; -},select:function(jq,id){ -return jq.each(function(){ -$(this).datagrid("selectRow",id); -}); -},unselect:function(jq,id){ -return jq.each(function(){ -$(this).datagrid("unselectRow",id); -}); -},collapse:function(jq,id){ -return jq.each(function(){ -_86(this,id); -}); -},expand:function(jq,id){ -return jq.each(function(){ -_8a(this,id); -}); -},toggle:function(jq,id){ -return jq.each(function(){ -_28(this,id); -}); -},collapseAll:function(jq,id){ -return jq.each(function(){ -_94(this,id); -}); -},expandAll:function(jq,id){ -return jq.each(function(){ -_99(this,id); -}); -},expandTo:function(jq,id){ -return jq.each(function(){ -_9e(this,id); -}); -},append:function(jq,_da){ -return jq.each(function(){ -_a2(this,_da); -}); -},insert:function(jq,_db){ -return jq.each(function(){ -_a9(this,_db); -}); -},remove:function(jq,id){ -return jq.each(function(){ -_b5(this,id); -}); -},pop:function(jq,id){ -var row=jq.treegrid("find",id); -jq.treegrid("remove",id); -return row; -},refresh:function(jq,id){ -return jq.each(function(){ -var _dc=$.data(this,"treegrid").options; -_dc.view.refreshRow.call(_dc.view,this,id); -}); -},update:function(jq,_dd){ -return jq.each(function(){ -var _de=$.data(this,"treegrid").options; -var row=_dd.row; -_de.view.updateRow.call(_de.view,this,_dd.id,row); -if(row.checked!=undefined){ -row=_37(this,_dd.id); -$.extend(row,{checkState:row.checked?"checked":(row.checked===false?"unchecked":undefined)}); -_49(this,_dd.id); -} -}); -},beginEdit:function(jq,id){ -return jq.each(function(){ -$(this).datagrid("beginEdit",id); -$(this).treegrid("fixRowHeight",id); -}); -},endEdit:function(jq,id){ -return jq.each(function(){ -$(this).datagrid("endEdit",id); -}); -},cancelEdit:function(jq,id){ -return jq.each(function(){ -$(this).datagrid("cancelEdit",id); -}); -},showLines:function(jq){ -return jq.each(function(){ -_bb(this); -}); -},setSelectionState:function(jq){ -return jq.each(function(){ -$(this).datagrid("setSelectionState"); -var _df=$(this).data("treegrid"); -for(var i=0;i<_df.tmpIds.length;i++){ -_29(this,_df.tmpIds[i],true,true); -} -_df.tmpIds=[]; -}); -},getCheckedNodes:function(jq,_e0){ -_e0=_e0||"checked"; -var _e1=[]; -$.easyui.forEach(jq.data("treegrid").checkedRows,false,function(row){ -if(row.checkState==_e0){ -_e1.push(row); -} -}); -return _e1; -},checkNode:function(jq,id){ -return jq.each(function(){ -_29(this,id,true); -}); -},uncheckNode:function(jq,id){ -return jq.each(function(){ -_29(this,id,false); -}); -},clearChecked:function(jq){ -return jq.each(function(){ -var _e2=this; -var _e3=$(_e2).treegrid("options"); -$(_e2).datagrid("clearChecked"); -$.map($(_e2).treegrid("getCheckedNodes"),function(row){ -_29(_e2,row[_e3.idField],false,true); -}); -}); -}}; -$.fn.treegrid.parseOptions=function(_e4){ -return $.extend({},$.fn.datagrid.parseOptions(_e4),$.parser.parseOptions(_e4,["treeField",{checkbox:"boolean",cascadeCheck:"boolean",onlyLeafCheck:"boolean"},{animate:"boolean"}])); -}; -var _e5=$.extend({},$.fn.datagrid.defaults.view,{render:function(_e6,_e7,_e8){ -var _e9=$.data(_e6,"treegrid").options; -var _ea=$(_e6).datagrid("getColumnFields",_e8); -var _eb=$.data(_e6,"datagrid").rowIdPrefix; -if(_e8){ -if(!(_e9.rownumbers||(_e9.frozenColumns&&_e9.frozenColumns.length))){ -return; -} -} -var _ec=this; -if(this.treeNodes&&this.treeNodes.length){ -var _ed=_ee.call(this,_e8,this.treeLevel,this.treeNodes); -$(_e7).append(_ed.join("")); -} -function _ee(_ef,_f0,_f1){ -var _f2=$(_e6).treegrid("getParent",_f1[0][_e9.idField]); -var _f3=(_f2?_f2.children.length:$(_e6).treegrid("getRoots").length)-_f1.length; -var _f4=[""]; -for(var i=0;i<_f1.length;i++){ -var row=_f1[i]; -if(row.state!="open"&&row.state!="closed"){ -row.state="open"; -} -var css=_e9.rowStyler?_e9.rowStyler.call(_e6,row):""; -var cs=this.getStyleValue(css); -var cls="class=\"datagrid-row "+(_f3++%2&&_e9.striped?"datagrid-row-alt ":" ")+cs.c+"\""; -var _f5=cs.s?"style=\""+cs.s+"\"":""; -var _f6=_eb+"-"+(_ef?1:2)+"-"+row[_e9.idField]; -_f4.push(""); -_f4=_f4.concat(_ec.renderRow.call(_ec,_e6,_ea,_ef,_f0,row)); -_f4.push(""); -if(row.children&&row.children.length){ -var tt=_ee.call(this,_ef,_f0+1,row.children); -var v=row.state=="closed"?"none":"block"; -_f4.push(""); -} -} -_f4.push("
              "); -_f4=_f4.concat(tt); -_f4.push("
              "); -return _f4; -}; -},renderFooter:function(_f7,_f8,_f9){ -var _fa=$.data(_f7,"treegrid").options; -var _fb=$.data(_f7,"treegrid").footer||[]; -var _fc=$(_f7).datagrid("getColumnFields",_f9); -var _fd=[""]; -for(var i=0;i<_fb.length;i++){ -var row=_fb[i]; -row[_fa.idField]=row[_fa.idField]||("foot-row-id"+i); -_fd.push(""); -_fd.push(this.renderRow.call(this,_f7,_fc,_f9,0,row)); -_fd.push(""); -} -_fd.push("
              "); -$(_f8).html(_fd.join("")); -},renderRow:function(_fe,_ff,_100,_101,row){ -var _102=$.data(_fe,"treegrid"); -var opts=_102.options; -var cc=[]; -if(_100&&opts.rownumbers){ -cc.push("
              0
              "); -} -for(var i=0;i<_ff.length;i++){ -var _103=_ff[i]; -var col=$(_fe).datagrid("getColumnOption",_103); -if(col){ -var css=col.styler?(col.styler(row[_103],row)||""):""; -var cs=this.getStyleValue(css); -var cls=cs.c?"class=\""+cs.c+"\"":""; -var _104=col.hidden?"style=\"display:none;"+cs.s+"\"":(cs.s?"style=\""+cs.s+"\"":""); -cc.push(""); -var _104=""; -if(!col.checkbox){ -if(col.align){ -_104+="text-align:"+col.align+";"; -} -if(!opts.nowrap){ -_104+="white-space:normal;height:auto;"; -}else{ -if(opts.autoRowHeight){ -_104+="height:auto;"; -} -} -} -cc.push("
              "); -if(col.checkbox){ -if(row.checked){ -cc.push(""); -}else{ -var val=null; -if(col.formatter){ -val=col.formatter(row[_103],row); -}else{ -val=row[_103]; -} -if(_103==opts.treeField){ -for(var j=0;j<_101;j++){ -cc.push(""); -} -if(row.state=="closed"){ -cc.push(""); -cc.push(""); -}else{ -if(row.children&&row.children.length){ -cc.push(""); -cc.push(""); -}else{ -cc.push(""); -cc.push(""); -} -} -if(this.hasCheckbox(_fe,row)){ -var flag=0; -var crow=$.easyui.getArrayItem(_102.checkedRows,opts.idField,row[opts.idField]); -if(crow){ -flag=crow.checkState=="checked"?1:2; -row.checkState=crow.checkState; -row.checked=crow.checked; -$.easyui.addArrayItem(_102.checkedRows,opts.idField,row); -}else{ -var prow=$.easyui.getArrayItem(_102.checkedRows,opts.idField,row._parentId); -if(prow&&prow.checkState=="checked"&&opts.cascadeCheck){ -flag=1; -row.checked=true; -$.easyui.addArrayItem(_102.checkedRows,opts.idField,row); -}else{ -if(row.checked){ -$.easyui.addArrayItem(_102.tmpIds,row[opts.idField]); -} -} -row.checkState=flag?"checked":"unchecked"; -} -cc.push(""); -}else{ -row.checkState=undefined; -row.checked=undefined; -} -cc.push(""+val+""); -}else{ -cc.push(val); -} -} -cc.push("
              "); -cc.push(""); -} -} -return cc.join(""); -},hasCheckbox:function(_105,row){ -var opts=$.data(_105,"treegrid").options; -if(opts.checkbox){ -if($.isFunction(opts.checkbox)){ -if(opts.checkbox.call(_105,row)){ -return true; -}else{ -return false; -} -}else{ -if(opts.onlyLeafCheck){ -if(row.state=="open"&&!(row.children&&row.children.length)){ -return true; -} -}else{ -return true; -} -} -} -return false; -},refreshRow:function(_106,id){ -this.updateRow.call(this,_106,id,{}); -},updateRow:function(_107,id,row){ -var opts=$.data(_107,"treegrid").options; -var _108=$(_107).treegrid("find",id); -$.extend(_108,row); -var _109=$(_107).treegrid("getLevel",id)-1; -var _10a=opts.rowStyler?opts.rowStyler.call(_107,_108):""; -var _10b=$.data(_107,"datagrid").rowIdPrefix; -var _10c=_108[opts.idField]; -function _10d(_10e){ -var _10f=$(_107).treegrid("getColumnFields",_10e); -var tr=opts.finder.getTr(_107,id,"body",(_10e?1:2)); -var _110=tr.find("div.datagrid-cell-rownumber").html(); -var _111=tr.find("div.datagrid-cell-check input[type=checkbox]").is(":checked"); -tr.html(this.renderRow(_107,_10f,_10e,_109,_108)); -tr.attr("style",_10a||""); -tr.find("div.datagrid-cell-rownumber").html(_110); -if(_111){ -tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked",true); -} -if(_10c!=id){ -tr.attr("id",_10b+"-"+(_10e?1:2)+"-"+_10c); -tr.attr("node-id",_10c); -} -}; -_10d.call(this,true); -_10d.call(this,false); -$(_107).treegrid("fixRowHeight",id); -},deleteRow:function(_112,id){ -var opts=$.data(_112,"treegrid").options; -var tr=opts.finder.getTr(_112,id); -tr.next("tr.treegrid-tr-tree").remove(); -tr.remove(); -var _113=del(id); -if(_113){ -if(_113.children.length==0){ -tr=opts.finder.getTr(_112,_113[opts.idField]); -tr.next("tr.treegrid-tr-tree").remove(); -var cell=tr.children("td[field=\""+opts.treeField+"\"]").children("div.datagrid-cell"); -cell.find(".tree-icon").removeClass("tree-folder").addClass("tree-file"); -cell.find(".tree-hit").remove(); -$("").prependTo(cell); -} -} -this.setEmptyMsg(_112); -function del(id){ -var cc; -var _114=$(_112).treegrid("getParent",id); -if(_114){ -cc=_114.children; -}else{ -cc=$(_112).treegrid("getData"); -} -for(var i=0;ib?1:-1); -}; -r=_11f(r1[sn],r2[sn])*(so=="asc"?1:-1); -if(r!=0){ -return r; -} -} -return r; -}); -for(var i=0;i").insertBefore(tr.find(".tree-title")); +} +if(row.checkState=="checked"){ +_29(_4a,_4b,true,true); +}else{ +if(row.checkState=="unchecked"){ +_29(_4a,_4b,false,true); +}else{ +var _4d=_47(row); +if(_4d===0){ +_29(_4a,_4b,false,true); +}else{ +if(_4d===1){ +_29(_4a,_4b,true,true); +} +} +} +} +}else{ +ck.remove(); +row.checkState=undefined; +row.checked=undefined; +_39(_4a,row); +} +}; +function _4e(_4f,_50){ +var _51=$.data(_4f,"treegrid").options; +var tr1=_51.finder.getTr(_4f,_50,"body",1); +var tr2=_51.finder.getTr(_4f,_50,"body",2); +var _52=$(_4f).datagrid("getColumnFields",true).length+(_51.rownumbers?1:0); +var _53=$(_4f).datagrid("getColumnFields",false).length; +_54(tr1,_52); +_54(tr2,_53); +function _54(tr,_55){ +$(""+""+"
              "+""+"").insertAfter(tr); +}; +}; +function _56(_57,_58,_59,_5a,_5b){ +var _5c=$.data(_57,"treegrid"); +var _5d=_5c.options; +var dc=_5c.dc; +_59=_5d.loadFilter.call(_57,_59,_58); +var _5e=_37(_57,_58); +if(_5e){ +var _5f=_5d.finder.getTr(_57,_58,"body",1); +var _60=_5d.finder.getTr(_57,_58,"body",2); +var cc1=_5f.next("tr.treegrid-tr-tree").children("td").children("div"); +var cc2=_60.next("tr.treegrid-tr-tree").children("td").children("div"); +if(!_5a){ +_5e.children=[]; +} +}else{ +var cc1=dc.body1; +var cc2=dc.body2; +if(!_5a){ +_5c.data=[]; +} +} +if(!_5a){ +cc1.empty(); +cc2.empty(); +} +if(_5d.view.onBeforeRender){ +_5d.view.onBeforeRender.call(_5d.view,_57,_58,_59); +} +_5d.view.render.call(_5d.view,_57,cc1,true); +_5d.view.render.call(_5d.view,_57,cc2,false); +if(_5d.showFooter){ +_5d.view.renderFooter.call(_5d.view,_57,dc.footer1,true); +_5d.view.renderFooter.call(_5d.view,_57,dc.footer2,false); +} +if(_5d.view.onAfterRender){ +_5d.view.onAfterRender.call(_5d.view,_57); +} +if(!_58&&_5d.pagination){ +var _61=$.data(_57,"treegrid").total; +var _62=$(_57).datagrid("getPager"); +if(_62.pagination("options").total!=_61){ +_62.pagination({total:_61}); +} +} +_16(_57); +_1f(_57); +$(_57).treegrid("showLines"); +$(_57).treegrid("setSelectionState"); +$(_57).treegrid("autoSizeColumn"); +if(!_5b){ +_5d.onLoadSuccess.call(_57,_5e,_59); +} +}; +function _15(_63,_64,_65,_66,_67){ +var _68=$.data(_63,"treegrid").options; +var _69=$(_63).datagrid("getPanel").find("div.datagrid-body"); +if(_64==undefined&&_68.queryParams){ +_68.queryParams.id=undefined; +} +if(_65){ +_68.queryParams=_65; +} +var _6a=$.extend({},_68.queryParams); +if(_68.pagination){ +$.extend(_6a,{page:_68.pageNumber,rows:_68.pageSize}); +} +if(_68.sortName){ +$.extend(_6a,{sort:_68.sortName,order:_68.sortOrder}); +} +var row=_37(_63,_64); +if(_68.onBeforeLoad.call(_63,row,_6a)==false){ +return; +} +var _6b=_69.find("tr[node-id=\""+_64+"\"] span.tree-folder"); +_6b.addClass("tree-loading"); +$(_63).treegrid("loading"); +var _6c=_68.loader.call(_63,_6a,function(_6d){ +_6b.removeClass("tree-loading"); +$(_63).treegrid("loaded"); +_56(_63,_64,_6d,_66); +if(_67){ +_67(); +} +},function(){ +_6b.removeClass("tree-loading"); +$(_63).treegrid("loaded"); +_68.onLoadError.apply(_63,arguments); +if(_67){ +_67(); +} +}); +if(_6c==false){ +_6b.removeClass("tree-loading"); +$(_63).treegrid("loaded"); +} +}; +function _6e(_6f){ +var _70=_71(_6f); +return _70.length?_70[0]:null; +}; +function _71(_72){ +return $.data(_72,"treegrid").data; +}; +function _46(_73,_74){ +var row=_37(_73,_74); +if(row._parentId){ +return _37(_73,row._parentId); +}else{ +return null; +} +}; +function _1b(_75,_76){ +var _77=$.data(_75,"treegrid").data; +if(_76){ +var _78=_37(_75,_76); +_77=_78?(_78.children||[]):[]; +} +var _79=[]; +$.easyui.forEach(_77,true,function(_7a){ +_79.push(_7a); +}); +return _79; +}; +function _7b(_7c,_7d){ +var _7e=$.data(_7c,"treegrid").options; +var tr=_7e.finder.getTr(_7c,_7d); +var _7f=tr.children("td[field=\""+_7e.treeField+"\"]"); +return _7f.find("span.tree-indent,span.tree-hit").length; +}; +function _37(_80,_81){ +var _82=$.data(_80,"treegrid"); +var _83=_82.options; +var _84=null; +$.easyui.forEach(_82.data,true,function(_85){ +if(_85[_83.idField]==_81){ +_84=_85; +return false; +} +}); +return _84; +}; +function _86(_87,_88){ +var _89=$.data(_87,"treegrid").options; +var row=_37(_87,_88); +var tr=_89.finder.getTr(_87,_88); +var hit=tr.find("span.tree-hit"); +if(hit.length==0){ +return; +} +if(hit.hasClass("tree-collapsed")){ +return; +} +if(_89.onBeforeCollapse.call(_87,row)==false){ +return; +} +hit.removeClass("tree-expanded tree-expanded-hover").addClass("tree-collapsed"); +hit.next().removeClass("tree-folder-open"); +row.state="closed"; +tr=tr.next("tr.treegrid-tr-tree"); +var cc=tr.children("td").children("div"); +if(_89.animate){ +cc.slideUp("normal",function(){ +$(_87).treegrid("autoSizeColumn"); +_16(_87,_88); +_89.onCollapse.call(_87,row); +}); +}else{ +cc.hide(); +$(_87).treegrid("autoSizeColumn"); +_16(_87,_88); +_89.onCollapse.call(_87,row); +} +}; +function _8a(_8b,_8c){ +var _8d=$.data(_8b,"treegrid").options; +var tr=_8d.finder.getTr(_8b,_8c); +var hit=tr.find("span.tree-hit"); +var row=_37(_8b,_8c); +if(hit.length==0){ +return; +} +if(hit.hasClass("tree-expanded")){ +return; +} +if(_8d.onBeforeExpand.call(_8b,row)==false){ +return; +} +hit.removeClass("tree-collapsed tree-collapsed-hover").addClass("tree-expanded"); +hit.next().addClass("tree-folder-open"); +var _8e=tr.next("tr.treegrid-tr-tree"); +if(_8e.length){ +var cc=_8e.children("td").children("div"); +_8f(cc); +}else{ +_4e(_8b,row[_8d.idField]); +var _8e=tr.next("tr.treegrid-tr-tree"); +var cc=_8e.children("td").children("div"); +cc.hide(); +var _90=$.extend({},_8d.queryParams||{}); +_90.id=row[_8d.idField]; +_15(_8b,row[_8d.idField],_90,true,function(){ +if(cc.is(":empty")){ +_8e.remove(); +}else{ +_8f(cc); +} +}); +} +function _8f(cc){ +row.state="open"; +if(_8d.animate){ +cc.slideDown("normal",function(){ +$(_8b).treegrid("autoSizeColumn"); +_16(_8b,_8c); +_8d.onExpand.call(_8b,row); +}); +}else{ +cc.show(); +$(_8b).treegrid("autoSizeColumn"); +_16(_8b,_8c); +_8d.onExpand.call(_8b,row); +} +}; +}; +function _28(_91,_92){ +var _93=$.data(_91,"treegrid").options; +var tr=_93.finder.getTr(_91,_92); +var hit=tr.find("span.tree-hit"); +if(hit.hasClass("tree-expanded")){ +_86(_91,_92); +}else{ +_8a(_91,_92); +} +}; +function _94(_95,_96){ +var _97=$.data(_95,"treegrid").options; +var _98=_1b(_95,_96); +if(_96){ +_98.unshift(_37(_95,_96)); +} +for(var i=0;i<_98.length;i++){ +_86(_95,_98[i][_97.idField]); +} +}; +function _99(_9a,_9b){ +var _9c=$.data(_9a,"treegrid").options; +var _9d=_1b(_9a,_9b); +if(_9b){ +_9d.unshift(_37(_9a,_9b)); +} +for(var i=0;i<_9d.length;i++){ +_8a(_9a,_9d[i][_9c.idField]); +} +}; +function _9e(_9f,_a0){ +var _a1=$.data(_9f,"treegrid").options; +var ids=[]; +var p=_46(_9f,_a0); +while(p){ +var id=p[_a1.idField]; +ids.unshift(id); +p=_46(_9f,id); +} +for(var i=0;i").insertBefore(_a8); +if(hit.prev().length){ +hit.prev().remove(); +} +} +} +_56(_a3,_a4.parent,_a4.data,_a5.data.length>0,true); +}; +function _a9(_aa,_ab){ +var ref=_ab.before||_ab.after; +var _ac=$.data(_aa,"treegrid").options; +var _ad=_46(_aa,ref); +_a2(_aa,{parent:(_ad?_ad[_ac.idField]:null),data:[_ab.data]}); +var _ae=_ad?_ad.children:$(_aa).treegrid("getRoots"); +for(var i=0;i<_ae.length;i++){ +if(_ae[i][_ac.idField]==ref){ +var _af=_ae[_ae.length-1]; +_ae.splice(_ab.before?i:(i+1),0,_af); +_ae.splice(_ae.length-1,1); +break; +} +} +_b0(true); +_b0(false); +_1f(_aa); +$(_aa).treegrid("showLines"); +function _b0(_b1){ +var _b2=_b1?1:2; +var tr=_ac.finder.getTr(_aa,_ab.data[_ac.idField],"body",_b2); +var _b3=tr.closest("table.datagrid-btable"); +tr=tr.parent().children(); +var _b4=_ac.finder.getTr(_aa,ref,"body",_b2); +if(_ab.before){ +tr.insertBefore(_b4); +}else{ +var sub=_b4.next("tr.treegrid-tr-tree"); +tr.insertAfter(sub.length?sub:_b4); +} +_b3.remove(); +}; +}; +function _b5(_b6,_b7){ +var _b8=$.data(_b6,"treegrid"); +var _b9=_b8.options; +var _ba=_46(_b6,_b7); +$(_b6).datagrid("deleteRow",_b7); +$.easyui.removeArrayItem(_b8.checkedRows,_b9.idField,_b7); +_1f(_b6); +if(_ba){ +_49(_b6,_ba[_b9.idField]); +} +_b8.total-=1; +$(_b6).datagrid("getPager").pagination("refresh",{total:_b8.total}); +$(_b6).treegrid("showLines"); +}; +function _bb(_bc){ +var t=$(_bc); +var _bd=t.treegrid("options"); +if(_bd.lines){ +t.treegrid("getPanel").addClass("tree-lines"); +}else{ +t.treegrid("getPanel").removeClass("tree-lines"); +return; +} +t.treegrid("getPanel").find("span.tree-indent").removeClass("tree-line tree-join tree-joinbottom"); +t.treegrid("getPanel").find("div.datagrid-cell").removeClass("tree-node-last tree-root-first tree-root-one"); +var _be=t.treegrid("getRoots"); +if(_be.length>1){ +_bf(_be[0]).addClass("tree-root-first"); +}else{ +if(_be.length==1){ +_bf(_be[0]).addClass("tree-root-one"); +} +} +_c0(_be); +_c1(_be); +function _c0(_c2){ +$.map(_c2,function(_c3){ +if(_c3.children&&_c3.children.length){ +_c0(_c3.children); +}else{ +var _c4=_bf(_c3); +_c4.find(".tree-icon").prev().addClass("tree-join"); +} +}); +if(_c2.length){ +var _c5=_bf(_c2[_c2.length-1]); +_c5.addClass("tree-node-last"); +_c5.find(".tree-join").removeClass("tree-join").addClass("tree-joinbottom"); +} +}; +function _c1(_c6){ +$.map(_c6,function(_c7){ +if(_c7.children&&_c7.children.length){ +_c1(_c7.children); +} +}); +for(var i=0;i<_c6.length-1;i++){ +var _c8=_c6[i]; +var _c9=t.treegrid("getLevel",_c8[_bd.idField]); +var tr=_bd.finder.getTr(_bc,_c8[_bd.idField]); +var cc=tr.next().find("tr.datagrid-row td[field=\""+_bd.treeField+"\"] div.datagrid-cell"); +cc.find("span:eq("+(_c9-1)+")").addClass("tree-line"); +} +}; +function _bf(_ca){ +var tr=_bd.finder.getTr(_bc,_ca[_bd.idField]); +var _cb=tr.find("td[field=\""+_bd.treeField+"\"] div.datagrid-cell"); +return _cb; +}; +}; +$.fn.treegrid=function(_cc,_cd){ +if(typeof _cc=="string"){ +var _ce=$.fn.treegrid.methods[_cc]; +if(_ce){ +return _ce(this,_cd); +}else{ +return this.datagrid(_cc,_cd); +} +} +_cc=_cc||{}; +return this.each(function(){ +var _cf=$.data(this,"treegrid"); +if(_cf){ +$.extend(_cf.options,_cc); +}else{ +_cf=$.data(this,"treegrid",{options:$.extend({},$.fn.treegrid.defaults,$.fn.treegrid.parseOptions(this),_cc),data:[],checkedRows:[],tmpIds:[]}); +} +_1(this); +if(_cf.options.data){ +$(this).treegrid("loadData",_cf.options.data); +} +_15(this); +}); +}; +$.fn.treegrid.methods={options:function(jq){ +return $.data(jq[0],"treegrid").options; +},resize:function(jq,_d0){ +return jq.each(function(){ +$(this).datagrid("resize",_d0); +}); +},fixRowHeight:function(jq,_d1){ +return jq.each(function(){ +_16(this,_d1); +}); +},loadData:function(jq,_d2){ +return jq.each(function(){ +_56(this,_d2.parent,_d2); +}); +},load:function(jq,_d3){ +return jq.each(function(){ +$(this).treegrid("options").pageNumber=1; +$(this).treegrid("getPager").pagination({pageNumber:1}); +$(this).treegrid("reload",_d3); +}); +},reload:function(jq,id){ +return jq.each(function(){ +var _d4=$(this).treegrid("options"); +var _d5={}; +if(typeof id=="object"){ +_d5=id; +}else{ +_d5=$.extend({},_d4.queryParams); +_d5.id=id; +} +if(_d5.id){ +var _d6=$(this).treegrid("find",_d5.id); +if(_d6.children){ +_d6.children.splice(0,_d6.children.length); +} +_d4.queryParams=_d5; +var tr=_d4.finder.getTr(this,_d5.id); +tr.next("tr.treegrid-tr-tree").remove(); +tr.find("span.tree-hit").removeClass("tree-expanded tree-expanded-hover").addClass("tree-collapsed"); +_8a(this,_d5.id); +}else{ +_15(this,null,_d5); +} +}); +},reloadFooter:function(jq,_d7){ +return jq.each(function(){ +var _d8=$.data(this,"treegrid").options; +var dc=$.data(this,"datagrid").dc; +if(_d7){ +$.data(this,"treegrid").footer=_d7; +} +if(_d8.showFooter){ +_d8.view.renderFooter.call(_d8.view,this,dc.footer1,true); +_d8.view.renderFooter.call(_d8.view,this,dc.footer2,false); +if(_d8.view.onAfterRender){ +_d8.view.onAfterRender.call(_d8.view,this); +} +$(this).treegrid("fixRowHeight"); +} +}); +},getData:function(jq){ +return $.data(jq[0],"treegrid").data; +},getFooterRows:function(jq){ +return $.data(jq[0],"treegrid").footer; +},getRoot:function(jq){ +return _6e(jq[0]); +},getRoots:function(jq){ +return _71(jq[0]); +},getParent:function(jq,id){ +return _46(jq[0],id); +},getChildren:function(jq,id){ +return _1b(jq[0],id); +},getLevel:function(jq,id){ +return _7b(jq[0],id); +},find:function(jq,id){ +return _37(jq[0],id); +},isLeaf:function(jq,id){ +var _d9=$.data(jq[0],"treegrid").options; +var tr=_d9.finder.getTr(jq[0],id); +var hit=tr.find("span.tree-hit"); +return hit.length==0; +},select:function(jq,id){ +return jq.each(function(){ +$(this).datagrid("selectRow",id); +}); +},unselect:function(jq,id){ +return jq.each(function(){ +$(this).datagrid("unselectRow",id); +}); +},collapse:function(jq,id){ +return jq.each(function(){ +_86(this,id); +}); +},expand:function(jq,id){ +return jq.each(function(){ +_8a(this,id); +}); +},toggle:function(jq,id){ +return jq.each(function(){ +_28(this,id); +}); +},collapseAll:function(jq,id){ +return jq.each(function(){ +_94(this,id); +}); +},expandAll:function(jq,id){ +return jq.each(function(){ +_99(this,id); +}); +},expandTo:function(jq,id){ +return jq.each(function(){ +_9e(this,id); +}); +},append:function(jq,_da){ +return jq.each(function(){ +_a2(this,_da); +}); +},insert:function(jq,_db){ +return jq.each(function(){ +_a9(this,_db); +}); +},remove:function(jq,id){ +return jq.each(function(){ +_b5(this,id); +}); +},pop:function(jq,id){ +var row=jq.treegrid("find",id); +jq.treegrid("remove",id); +return row; +},refresh:function(jq,id){ +return jq.each(function(){ +var _dc=$.data(this,"treegrid").options; +_dc.view.refreshRow.call(_dc.view,this,id); +}); +},update:function(jq,_dd){ +return jq.each(function(){ +var _de=$.data(this,"treegrid").options; +var row=_dd.row; +_de.view.updateRow.call(_de.view,this,_dd.id,row); +if(row.checked!=undefined){ +row=_37(this,_dd.id); +$.extend(row,{checkState:row.checked?"checked":(row.checked===false?"unchecked":undefined)}); +_49(this,_dd.id); +} +}); +},beginEdit:function(jq,id){ +return jq.each(function(){ +$(this).datagrid("beginEdit",id); +$(this).treegrid("fixRowHeight",id); +}); +},endEdit:function(jq,id){ +return jq.each(function(){ +$(this).datagrid("endEdit",id); +}); +},cancelEdit:function(jq,id){ +return jq.each(function(){ +$(this).datagrid("cancelEdit",id); +}); +},showLines:function(jq){ +return jq.each(function(){ +_bb(this); +}); +},setSelectionState:function(jq){ +return jq.each(function(){ +$(this).datagrid("setSelectionState"); +var _df=$(this).data("treegrid"); +for(var i=0;i<_df.tmpIds.length;i++){ +_29(this,_df.tmpIds[i],true,true); +} +_df.tmpIds=[]; +}); +},getCheckedNodes:function(jq,_e0){ +_e0=_e0||"checked"; +var _e1=[]; +$.easyui.forEach(jq.data("treegrid").checkedRows,false,function(row){ +if(row.checkState==_e0){ +_e1.push(row); +} +}); +return _e1; +},checkNode:function(jq,id){ +return jq.each(function(){ +_29(this,id,true); +}); +},uncheckNode:function(jq,id){ +return jq.each(function(){ +_29(this,id,false); +}); +},clearChecked:function(jq){ +return jq.each(function(){ +var _e2=this; +var _e3=$(_e2).treegrid("options"); +$(_e2).datagrid("clearChecked"); +$.map($(_e2).treegrid("getCheckedNodes"),function(row){ +_29(_e2,row[_e3.idField],false,true); +}); +}); +}}; +$.fn.treegrid.parseOptions=function(_e4){ +return $.extend({},$.fn.datagrid.parseOptions(_e4),$.parser.parseOptions(_e4,["treeField",{checkbox:"boolean",cascadeCheck:"boolean",onlyLeafCheck:"boolean"},{animate:"boolean"}])); +}; +var _e5=$.extend({},$.fn.datagrid.defaults.view,{render:function(_e6,_e7,_e8){ +var _e9=$.data(_e6,"treegrid").options; +var _ea=$(_e6).datagrid("getColumnFields",_e8); +var _eb=$.data(_e6,"datagrid").rowIdPrefix; +if(_e8){ +if(!(_e9.rownumbers||(_e9.frozenColumns&&_e9.frozenColumns.length))){ +return; +} +} +var _ec=this; +if(this.treeNodes&&this.treeNodes.length){ +var _ed=_ee.call(this,_e8,this.treeLevel,this.treeNodes); +$(_e7).append(_ed.join("")); +} +function _ee(_ef,_f0,_f1){ +var _f2=$(_e6).treegrid("getParent",_f1[0][_e9.idField]); +var _f3=(_f2?_f2.children.length:$(_e6).treegrid("getRoots").length)-_f1.length; +var _f4=[""]; +for(var i=0;i<_f1.length;i++){ +var row=_f1[i]; +if(row.state!="open"&&row.state!="closed"){ +row.state="open"; +} +var css=_e9.rowStyler?_e9.rowStyler.call(_e6,row):""; +var cs=this.getStyleValue(css); +var cls="class=\"datagrid-row "+(_f3++%2&&_e9.striped?"datagrid-row-alt ":" ")+cs.c+"\""; +var _f5=cs.s?"style=\""+cs.s+"\"":""; +var _f6=_eb+"-"+(_ef?1:2)+"-"+row[_e9.idField]; +_f4.push(""); +_f4=_f4.concat(_ec.renderRow.call(_ec,_e6,_ea,_ef,_f0,row)); +_f4.push(""); +if(row.children&&row.children.length){ +var tt=_ee.call(this,_ef,_f0+1,row.children); +var v=row.state=="closed"?"none":"block"; +_f4.push(""); +} +} +_f4.push("
              "); +_f4=_f4.concat(tt); +_f4.push("
              "); +return _f4; +}; +},renderFooter:function(_f7,_f8,_f9){ +var _fa=$.data(_f7,"treegrid").options; +var _fb=$.data(_f7,"treegrid").footer||[]; +var _fc=$(_f7).datagrid("getColumnFields",_f9); +var _fd=[""]; +for(var i=0;i<_fb.length;i++){ +var row=_fb[i]; +row[_fa.idField]=row[_fa.idField]||("foot-row-id"+i); +_fd.push(""); +_fd.push(this.renderRow.call(this,_f7,_fc,_f9,0,row)); +_fd.push(""); +} +_fd.push("
              "); +$(_f8).html(_fd.join("")); +},renderRow:function(_fe,_ff,_100,_101,row){ +var _102=$.data(_fe,"treegrid"); +var opts=_102.options; +var cc=[]; +if(_100&&opts.rownumbers){ +cc.push("
              0
              "); +} +for(var i=0;i<_ff.length;i++){ +var _103=_ff[i]; +var col=$(_fe).datagrid("getColumnOption",_103); +if(col){ +var css=col.styler?(col.styler(row[_103],row)||""):""; +var cs=this.getStyleValue(css); +var cls=cs.c?"class=\""+cs.c+"\"":""; +var _104=col.hidden?"style=\"display:none;"+cs.s+"\"":(cs.s?"style=\""+cs.s+"\"":""); +cc.push(""); +var _104=""; +if(!col.checkbox){ +if(col.align){ +_104+="text-align:"+col.align+";"; +} +if(!opts.nowrap){ +_104+="white-space:normal;height:auto;"; +}else{ +if(opts.autoRowHeight){ +_104+="height:auto;"; +} +} +} +cc.push("
              "); +if(col.checkbox){ +if(row.checked){ +cc.push(""); +}else{ +var val=null; +if(col.formatter){ +val=col.formatter(row[_103],row); +}else{ +val=row[_103]; +} +if(_103==opts.treeField){ +for(var j=0;j<_101;j++){ +cc.push(""); +} +if(row.state=="closed"){ +cc.push(""); +cc.push(""); +}else{ +if(row.children&&row.children.length){ +cc.push(""); +cc.push(""); +}else{ +cc.push(""); +cc.push(""); +} +} +if(this.hasCheckbox(_fe,row)){ +var flag=0; +var crow=$.easyui.getArrayItem(_102.checkedRows,opts.idField,row[opts.idField]); +if(crow){ +flag=crow.checkState=="checked"?1:2; +row.checkState=crow.checkState; +row.checked=crow.checked; +$.easyui.addArrayItem(_102.checkedRows,opts.idField,row); +}else{ +var prow=$.easyui.getArrayItem(_102.checkedRows,opts.idField,row._parentId); +if(prow&&prow.checkState=="checked"&&opts.cascadeCheck){ +flag=1; +row.checked=true; +$.easyui.addArrayItem(_102.checkedRows,opts.idField,row); +}else{ +if(row.checked){ +$.easyui.addArrayItem(_102.tmpIds,row[opts.idField]); +} +} +row.checkState=flag?"checked":"unchecked"; +} +cc.push(""); +}else{ +row.checkState=undefined; +row.checked=undefined; +} +cc.push(""+val+""); +}else{ +cc.push(val); +} +} +cc.push("
              "); +cc.push(""); +} +} +return cc.join(""); +},hasCheckbox:function(_105,row){ +var opts=$.data(_105,"treegrid").options; +if(opts.checkbox){ +if($.isFunction(opts.checkbox)){ +if(opts.checkbox.call(_105,row)){ +return true; +}else{ +return false; +} +}else{ +if(opts.onlyLeafCheck){ +if(row.state=="open"&&!(row.children&&row.children.length)){ +return true; +} +}else{ +return true; +} +} +} +return false; +},refreshRow:function(_106,id){ +this.updateRow.call(this,_106,id,{}); +},updateRow:function(_107,id,row){ +var opts=$.data(_107,"treegrid").options; +var _108=$(_107).treegrid("find",id); +$.extend(_108,row); +var _109=$(_107).treegrid("getLevel",id)-1; +var _10a=opts.rowStyler?opts.rowStyler.call(_107,_108):""; +var _10b=$.data(_107,"datagrid").rowIdPrefix; +var _10c=_108[opts.idField]; +function _10d(_10e){ +var _10f=$(_107).treegrid("getColumnFields",_10e); +var tr=opts.finder.getTr(_107,id,"body",(_10e?1:2)); +var _110=tr.find("div.datagrid-cell-rownumber").html(); +var _111=tr.find("div.datagrid-cell-check input[type=checkbox]").is(":checked"); +tr.html(this.renderRow(_107,_10f,_10e,_109,_108)); +tr.attr("style",_10a||""); +tr.find("div.datagrid-cell-rownumber").html(_110); +if(_111){ +tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked",true); +} +if(_10c!=id){ +tr.attr("id",_10b+"-"+(_10e?1:2)+"-"+_10c); +tr.attr("node-id",_10c); +} +}; +_10d.call(this,true); +_10d.call(this,false); +$(_107).treegrid("fixRowHeight",id); +},deleteRow:function(_112,id){ +var opts=$.data(_112,"treegrid").options; +var tr=opts.finder.getTr(_112,id); +tr.next("tr.treegrid-tr-tree").remove(); +tr.remove(); +var _113=del(id); +if(_113){ +if(_113.children.length==0){ +tr=opts.finder.getTr(_112,_113[opts.idField]); +tr.next("tr.treegrid-tr-tree").remove(); +var cell=tr.children("td[field=\""+opts.treeField+"\"]").children("div.datagrid-cell"); +cell.find(".tree-icon").removeClass("tree-folder").addClass("tree-file"); +cell.find(".tree-hit").remove(); +$("").prependTo(cell); +} +} +this.setEmptyMsg(_112); +function del(id){ +var cc; +var _114=$(_112).treegrid("getParent",id); +if(_114){ +cc=_114.children; +}else{ +cc=$(_112).treegrid("getData"); +} +for(var i=0;ib?1:-1); +}; +r=_11f(r1[sn],r2[sn])*(so=="asc"?1:-1); +if(r!=0){ +return r; +} +} +return r; +}); +for(var i=0;i=_45[0]&&len<=_45[1]; -},message:"Please enter a value between {0} and {1}."},remote:{validator:function(_46,_47){ -var _48={}; -_48[_47[1]]=_46; -var _49=$.ajax({url:_47[0],dataType:"json",data:_48,async:false,cache:false,type:"post"}).responseText; -return _49=="true"; -},message:"Please fix this field."}},onBeforeValidate:function(){ -},onValidate:function(_4a){ -}}; -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(_2){ +$(_2).addClass("validatebox-text"); +}; +function _3(_4){ +var _5=$.data(_4,"validatebox"); +_5.validating=false; +if(_5.vtimer){ +clearTimeout(_5.vtimer); +} +if(_5.ftimer){ +clearTimeout(_5.ftimer); +} +$(_4).tooltip("destroy"); +$(_4).unbind(); +$(_4).remove(); +}; +function _6(_7){ +var _8=$.data(_7,"validatebox").options; +$(_7).unbind(".validatebox"); +if(_8.novalidate||_8.disabled){ +return; +} +for(var _9 in _8.events){ +$(_7).bind(_9+".validatebox",{target:_7},_8.events[_9]); +} +}; +function _a(e){ +var _b=e.data.target; +var _c=$.data(_b,"validatebox"); +var _d=_c.options; +if($(_b).attr("readonly")){ +return; +} +_c.validating=true; +_c.value=_d.val(_b); +(function(){ +if(!$(_b).is(":visible")){ +_c.validating=false; +} +if(_c.validating){ +var _e=_d.val(_b); +if(_c.value!=_e){ +_c.value=_e; +if(_c.vtimer){ +clearTimeout(_c.vtimer); +} +_c.vtimer=setTimeout(function(){ +$(_b).validatebox("validate"); +},_d.delay); +}else{ +if(_c.message){ +_d.err(_b,_c.message); +} +} +_c.ftimer=setTimeout(arguments.callee,_d.interval); +} +})(); +}; +function _f(e){ +var _10=e.data.target; +var _11=$.data(_10,"validatebox"); +var _12=_11.options; +_11.validating=false; +if(_11.vtimer){ +clearTimeout(_11.vtimer); +_11.vtimer=undefined; +} +if(_11.ftimer){ +clearTimeout(_11.ftimer); +_11.ftimer=undefined; +} +if(_12.validateOnBlur){ +setTimeout(function(){ +$(_10).validatebox("validate"); +},0); +} +_12.err(_10,_11.message,"hide"); +}; +function _13(e){ +var _14=e.data.target; +var _15=$.data(_14,"validatebox"); +_15.options.err(_14,_15.message,"show"); +}; +function _16(e){ +var _17=e.data.target; +var _18=$.data(_17,"validatebox"); +if(!_18.validating){ +_18.options.err(_17,_18.message,"hide"); +} +}; +function _19(_1a,_1b,_1c){ +var _1d=$.data(_1a,"validatebox"); +var _1e=_1d.options; +var t=$(_1a); +if(_1c=="hide"||!_1b){ +t.tooltip("hide"); +}else{ +if((t.is(":focus")&&_1d.validating)||_1c=="show"){ +t.tooltip($.extend({},_1e.tipOptions,{content:_1b,position:_1e.tipPosition,deltaX:_1e.deltaX,deltaY:_1e.deltaY})).tooltip("show"); +} +} +}; +function _1f(_20){ +var _21=$.data(_20,"validatebox"); +var _22=_21.options; +var box=$(_20); +_22.onBeforeValidate.call(_20); +var _23=_24(); +_23?box.removeClass("validatebox-invalid"):box.addClass("validatebox-invalid"); +_22.err(_20,_21.message); +_22.onValidate.call(_20,_23); +return _23; +function _25(msg){ +_21.message=msg; +}; +function _26(_27,_28){ +var _29=_22.val(_20); +var _2a=/([a-zA-Z_]+)(.*)/.exec(_27); +var _2b=_22.rules[_2a[1]]; +if(_2b&&_29){ +var _2c=_28||_22.validParams||eval(_2a[2]); +if(!_2b["validator"].call(_20,_29,_2c)){ +var _2d=_2b["message"]; +if(_2c){ +for(var i=0;i<_2c.length;i++){ +_2d=_2d.replace(new RegExp("\\{"+i+"\\}","g"),_2c[i]); +} +} +_25(_22.invalidMessage||_2d); +return false; +} +} +return true; +}; +function _24(){ +_25(""); +if(!_22._validateOnCreate){ +setTimeout(function(){ +_22._validateOnCreate=true; +},0); +return true; +} +if(_22.novalidate||_22.disabled){ +return true; +} +if(_22.required){ +if(_22.val(_20)==""){ +_25(_22.missingMessage); +return false; +} +} +if(_22.validType){ +if($.isArray(_22.validType)){ +for(var i=0;i<_22.validType.length;i++){ +if(!_26(_22.validType[i])){ +return false; +} +} +}else{ +if(typeof _22.validType=="string"){ +if(!_26(_22.validType)){ +return false; +} +}else{ +for(var _2e in _22.validType){ +var _2f=_22.validType[_2e]; +if(!_26(_2e,_2f)){ +return false; +} +} +} +} +} +return true; +}; +}; +function _30(_31,_32){ +var _33=$.data(_31,"validatebox").options; +if(_32!=undefined){ +_33.disabled=_32; +} +if(_33.disabled){ +$(_31).addClass("validatebox-disabled").attr("disabled","disabled"); +}else{ +$(_31).removeClass("validatebox-disabled").removeAttr("disabled"); +} +}; +function _34(_35,_36){ +var _37=$.data(_35,"validatebox").options; +_37.readonly=_36==undefined?true:_36; +if(_37.readonly||!_37.editable){ +$(_35).triggerHandler("blur.validatebox"); +$(_35).addClass("validatebox-readonly").attr("readonly","readonly"); +}else{ +$(_35).removeClass("validatebox-readonly").removeAttr("readonly"); +} +}; +$.fn.validatebox=function(_38,_39){ +if(typeof _38=="string"){ +return $.fn.validatebox.methods[_38](this,_39); +} +_38=_38||{}; +return this.each(function(){ +var _3a=$.data(this,"validatebox"); +if(_3a){ +$.extend(_3a.options,_38); +}else{ +_1(this); +_3a=$.data(this,"validatebox",{options:$.extend({},$.fn.validatebox.defaults,$.fn.validatebox.parseOptions(this),_38)}); +} +_3a.options._validateOnCreate=_3a.options.validateOnCreate; +_30(this,_3a.options.disabled); +_34(this,_3a.options.readonly); +_6(this); +_1f(this); +}); +}; +$.fn.validatebox.methods={options:function(jq){ +return $.data(jq[0],"validatebox").options; +},destroy:function(jq){ +return jq.each(function(){ +_3(this); +}); +},validate:function(jq){ +return jq.each(function(){ +_1f(this); +}); +},isValid:function(jq){ +return _1f(jq[0]); +},enableValidation:function(jq){ +return jq.each(function(){ +$(this).validatebox("options").novalidate=false; +_6(this); +_1f(this); +}); +},disableValidation:function(jq){ +return jq.each(function(){ +$(this).validatebox("options").novalidate=true; +_6(this); +_1f(this); +}); +},resetValidation:function(jq){ +return jq.each(function(){ +var _3b=$(this).validatebox("options"); +_3b._validateOnCreate=_3b.validateOnCreate; +_1f(this); +}); +},enable:function(jq){ +return jq.each(function(){ +_30(this,false); +_6(this); +_1f(this); +}); +},disable:function(jq){ +return jq.each(function(){ +_30(this,true); +_6(this); +_1f(this); +}); +},readonly:function(jq,_3c){ +return jq.each(function(){ +_34(this,_3c); +_6(this); +_1f(this); +}); +}}; +$.fn.validatebox.parseOptions=function(_3d){ +var t=$(_3d); +return $.extend({},$.parser.parseOptions(_3d,["validType","missingMessage","invalidMessage","tipPosition",{delay:"number",interval:"number",deltaX:"number"},{editable:"boolean",validateOnCreate:"boolean",validateOnBlur:"boolean"}]),{required:(t.attr("required")?true:undefined),disabled:(t.attr("disabled")?true:undefined),readonly:(t.attr("readonly")?true:undefined),novalidate:(t.attr("novalidate")!=undefined?true:undefined)}); +}; +$.fn.validatebox.defaults={required:false,validType:null,validParams:null,delay:200,interval:200,missingMessage:"This field is required.",invalidMessage:null,tipPosition:"right",deltaX:0,deltaY:0,novalidate:false,editable:true,disabled:false,readonly:false,validateOnCreate:true,validateOnBlur:false,events:{focus:_a,blur:_f,mouseenter:_13,mouseleave:_16,click:function(e){ +var t=$(e.data.target); +if(t.attr("type")=="checkbox"||t.attr("type")=="radio"){ +t.focus().validatebox("validate"); +} +}},val:function(_3e){ +return $(_3e).val(); +},err:function(_3f,_40,_41){ +_19(_3f,_40,_41); +},tipOptions:{showEvent:"none",hideEvent:"none",showDelay:0,hideDelay:0,zIndex:"",onShow:function(){ +$(this).tooltip("tip").css({color:"#000",borderColor:"#CC9933",backgroundColor:"#FFFFCC"}); +},onHide:function(){ +$(this).tooltip("destroy"); +}},rules:{email:{validator:function(_42){ +return /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(_42); +},message:"Please enter a valid email address."},url:{validator:function(_43){ +return /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(_43); +},message:"Please enter a valid URL."},length:{validator:function(_44,_45){ +var len=$.trim(_44).length; +return len>=_45[0]&&len<=_45[1]; +},message:"Please enter a value between {0} and {1}."},remote:{validator:function(_46,_47){ +var _48={}; +_48[_47[1]]=_46; +var _49=$.ajax({url:_47[0],dataType:"json",data:_48,async:false,cache:false,type:"post"}).responseText; +return _49=="true"; +},message:"Please fix this field."}},onBeforeValidate:function(){ +},onValidate:function(_4a){ +}}; +})(jQuery); + diff --git a/assets/js/easy-ui/plugins/jquery.window.js b/assets/js/easy-ui/plugins/jquery.window.js index dc179ec82b..77f7b4dfaa 100755 --- a/assets/js/easy-ui/plugins/jquery.window.js +++ b/assets/js/easy-ui/plugins/jquery.window.js @@ -1,311 +1,311 @@ -/** - * jQuery EasyUI 1.5.2 - * - * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. - * - * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php - * To use it on other terms please contact us: info@jeasyui.com - * - */ -(function($){ -function _1(_2,_3){ -var _4=$.data(_2,"window"); -if(_3){ -if(_3.left!=null){ -_4.options.left=_3.left; -} -if(_3.top!=null){ -_4.options.top=_3.top; -} -} -$(_2).panel("move",_4.options); -if(_4.shadow){ -_4.shadow.css({left:_4.options.left,top:_4.options.top}); -} -}; -function _5(_6,_7){ -var _8=$.data(_6,"window").options; -var pp=$(_6).window("panel"); -var _9=pp._outerWidth(); -if(_8.inline){ -var _a=pp.parent(); -_8.left=Math.ceil((_a.width()-_9)/2+_a.scrollLeft()); -}else{ -_8.left=Math.ceil(($(window)._outerWidth()-_9)/2+$(document).scrollLeft()); -} -if(_7){ -_1(_6); -} -}; -function _b(_c,_d){ -var _e=$.data(_c,"window").options; -var pp=$(_c).window("panel"); -var _f=pp._outerHeight(); -if(_e.inline){ -var _10=pp.parent(); -_e.top=Math.ceil((_10.height()-_f)/2+_10.scrollTop()); -}else{ -_e.top=Math.ceil(($(window)._outerHeight()-_f)/2+$(document).scrollTop()); -} -if(_d){ -_1(_c); -} -}; -function _11(_12){ -var _13=$.data(_12,"window"); -var _14=_13.options; -var win=$(_12).panel($.extend({},_13.options,{border:false,doSize:true,closed:true,cls:"window "+(!_14.border?"window-thinborder window-noborder ":(_14.border=="thin"?"window-thinborder ":""))+(_14.cls||""),headerCls:"window-header "+(_14.headerCls||""),bodyCls:"window-body "+(_14.noheader?"window-body-noheader ":" ")+(_14.bodyCls||""),onBeforeDestroy:function(){ -if(_14.onBeforeDestroy.call(_12)==false){ -return false; -} -if(_13.shadow){ -_13.shadow.remove(); -} -if(_13.mask){ -_13.mask.remove(); -} -},onClose:function(){ -if(_13.shadow){ -_13.shadow.hide(); -} -if(_13.mask){ -_13.mask.hide(); -} -_14.onClose.call(_12); -},onOpen:function(){ -if(_13.mask){ -_13.mask.css($.extend({display:"block",zIndex:$.fn.window.defaults.zIndex++},$.fn.window.getMaskSize(_12))); -} -if(_13.shadow){ -_13.shadow.css({display:"block",zIndex:$.fn.window.defaults.zIndex++,left:_14.left,top:_14.top,width:_13.window._outerWidth(),height:_13.window._outerHeight()}); -} -_13.window.css("z-index",$.fn.window.defaults.zIndex++); -_14.onOpen.call(_12); -},onResize:function(_15,_16){ -var _17=$(this).panel("options"); -$.extend(_14,{width:_17.width,height:_17.height,left:_17.left,top:_17.top}); -if(_13.shadow){ -_13.shadow.css({left:_14.left,top:_14.top,width:_13.window._outerWidth(),height:_13.window._outerHeight()}); -} -_14.onResize.call(_12,_15,_16); -},onMinimize:function(){ -if(_13.shadow){ -_13.shadow.hide(); -} -if(_13.mask){ -_13.mask.hide(); -} -_13.options.onMinimize.call(_12); -},onBeforeCollapse:function(){ -if(_14.onBeforeCollapse.call(_12)==false){ -return false; -} -if(_13.shadow){ -_13.shadow.hide(); -} -},onExpand:function(){ -if(_13.shadow){ -_13.shadow.show(); -} -_14.onExpand.call(_12); -}})); -_13.window=win.panel("panel"); -if(_13.mask){ -_13.mask.remove(); -} -if(_14.modal){ -_13.mask=$("
              ").insertAfter(_13.window); -} -if(_13.shadow){ -_13.shadow.remove(); -} -if(_14.shadow){ -_13.shadow=$("
              ").insertAfter(_13.window); -} -var _18=_14.closed; -if(_14.left==null){ -_5(_12); -} -if(_14.top==null){ -_b(_12); -} -_1(_12); -if(!_18){ -win.window("open"); -} -}; -function _19(_1a,top,_1b,_1c){ -var _1d=this; -var _1e=$.data(_1d,"window"); -var _1f=_1e.options; -if(!_1f.constrain){ -return {}; -} -if($.isFunction(_1f.constrain)){ -return _1f.constrain.call(_1d,_1a,top,_1b,_1c); -} -var win=$(_1d).window("window"); -var _20=_1f.inline?win.parent():$(window); -if(_1a<0){ -_1a=0; -} -if(top<_20.scrollTop()){ -top=_20.scrollTop(); -} -if(_1a+_1b>_20.width()){ -if(_1b==win.outerWidth()){ -_1a=_20.width()-_1b; -}else{ -_1b=_20.width()-_1a; -} -} -if(top-_20.scrollTop()+_1c>_20.height()){ -if(_1c==win.outerHeight()){ -top=_20.height()-_1c+_20.scrollTop(); -}else{ -_1c=_20.height()-top+_20.scrollTop(); -} -} -return {left:_1a,top:top,width:_1b,height:_1c}; -}; -function _21(_22){ -var _23=$.data(_22,"window"); -_23.window.draggable({handle:">div.panel-header>div.panel-title",disabled:_23.options.draggable==false,onBeforeDrag:function(e){ -if(_23.mask){ -_23.mask.css("z-index",$.fn.window.defaults.zIndex++); -} -if(_23.shadow){ -_23.shadow.css("z-index",$.fn.window.defaults.zIndex++); -} -_23.window.css("z-index",$.fn.window.defaults.zIndex++); -},onStartDrag:function(e){ -_24(e); -},onDrag:function(e){ -_25(e); -return false; -},onStopDrag:function(e){ -_26(e,"move"); -}}); -_23.window.resizable({disabled:_23.options.resizable==false,onStartResize:function(e){ -_24(e); -},onResize:function(e){ -_25(e); -return false; -},onStopResize:function(e){ -_26(e,"resize"); -}}); -function _24(e){ -if(_23.pmask){ -_23.pmask.remove(); -} -_23.pmask=$("
              ").insertAfter(_23.window); -_23.pmask.css({display:"none",zIndex:$.fn.window.defaults.zIndex++,left:e.data.left,top:e.data.top,width:_23.window._outerWidth(),height:_23.window._outerHeight()}); -if(_23.proxy){ -_23.proxy.remove(); -} -_23.proxy=$("
              ").insertAfter(_23.window); -_23.proxy.css({display:"none",zIndex:$.fn.window.defaults.zIndex++,left:e.data.left,top:e.data.top}); -_23.proxy._outerWidth(e.data.width)._outerHeight(e.data.height); -_23.proxy.hide(); -setTimeout(function(){ -if(_23.pmask){ -_23.pmask.show(); -} -if(_23.proxy){ -_23.proxy.show(); -} -},500); -}; -function _25(e){ -$.extend(e.data,_19.call(_22,e.data.left,e.data.top,e.data.width,e.data.height)); -_23.pmask.show(); -_23.proxy.css({display:"block",left:e.data.left,top:e.data.top}); -_23.proxy._outerWidth(e.data.width); -_23.proxy._outerHeight(e.data.height); -}; -function _26(e,_27){ -$.extend(e.data,_19.call(_22,e.data.left,e.data.top,e.data.width+0.1,e.data.height+0.1)); -$(_22).window(_27,e.data); -_23.pmask.remove(); -_23.pmask=null; -_23.proxy.remove(); -_23.proxy=null; -}; -}; -$(function(){ -if(!$._positionFixed){ -$(window).resize(function(){ -$("body>div.window-mask:visible").css({width:"",height:""}); -setTimeout(function(){ -$("body>div.window-mask:visible").css($.fn.window.getMaskSize()); -},50); -}); -} -}); -$.fn.window=function(_28,_29){ -if(typeof _28=="string"){ -var _2a=$.fn.window.methods[_28]; -if(_2a){ -return _2a(this,_29); -}else{ -return this.panel(_28,_29); -} -} -_28=_28||{}; -return this.each(function(){ -var _2b=$.data(this,"window"); -if(_2b){ -$.extend(_2b.options,_28); -}else{ -_2b=$.data(this,"window",{options:$.extend({},$.fn.window.defaults,$.fn.window.parseOptions(this),_28)}); -if(!_2b.options.inline){ -document.body.appendChild(this); -} -} -_11(this); -_21(this); -}); -}; -$.fn.window.methods={options:function(jq){ -var _2c=jq.panel("options"); -var _2d=$.data(jq[0],"window").options; -return $.extend(_2d,{closed:_2c.closed,collapsed:_2c.collapsed,minimized:_2c.minimized,maximized:_2c.maximized}); -},window:function(jq){ -return $.data(jq[0],"window").window; -},move:function(jq,_2e){ -return jq.each(function(){ -_1(this,_2e); -}); -},hcenter:function(jq){ -return jq.each(function(){ -_5(this,true); -}); -},vcenter:function(jq){ -return jq.each(function(){ -_b(this,true); -}); -},center:function(jq){ -return jq.each(function(){ -_5(this); -_b(this); -_1(this); -}); -}}; -$.fn.window.getMaskSize=function(_2f){ -var _30=$(_2f).data("window"); -if(_30&&_30.options.inline){ -return {}; -}else{ -if($._positionFixed){ -return {position:"fixed"}; -}else{ -return {width:$(document).width(),height:$(document).height()}; -} -} -}; -$.fn.window.parseOptions=function(_31){ -return $.extend({},$.fn.panel.parseOptions(_31),$.parser.parseOptions(_31,[{draggable:"boolean",resizable:"boolean",shadow:"boolean",modal:"boolean",inline:"boolean"}])); -}; -$.fn.window.defaults=$.extend({},$.fn.panel.defaults,{zIndex:9000,draggable:true,resizable:true,shadow:true,modal:false,border:true,inline:false,title:"New Window",collapsible:true,minimizable:true,maximizable:true,closable:true,closed:false,constrain:false}); -})(jQuery); - +/** + * jQuery EasyUI 1.5.2 + * + * Copyright (c) 2009-2017 www.jeasyui.com. All rights reserved. + * + * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php + * To use it on other terms please contact us: info@jeasyui.com + * + */ +(function($){ +function _1(_2,_3){ +var _4=$.data(_2,"window"); +if(_3){ +if(_3.left!=null){ +_4.options.left=_3.left; +} +if(_3.top!=null){ +_4.options.top=_3.top; +} +} +$(_2).panel("move",_4.options); +if(_4.shadow){ +_4.shadow.css({left:_4.options.left,top:_4.options.top}); +} +}; +function _5(_6,_7){ +var _8=$.data(_6,"window").options; +var pp=$(_6).window("panel"); +var _9=pp._outerWidth(); +if(_8.inline){ +var _a=pp.parent(); +_8.left=Math.ceil((_a.width()-_9)/2+_a.scrollLeft()); +}else{ +_8.left=Math.ceil(($(window)._outerWidth()-_9)/2+$(document).scrollLeft()); +} +if(_7){ +_1(_6); +} +}; +function _b(_c,_d){ +var _e=$.data(_c,"window").options; +var pp=$(_c).window("panel"); +var _f=pp._outerHeight(); +if(_e.inline){ +var _10=pp.parent(); +_e.top=Math.ceil((_10.height()-_f)/2+_10.scrollTop()); +}else{ +_e.top=Math.ceil(($(window)._outerHeight()-_f)/2+$(document).scrollTop()); +} +if(_d){ +_1(_c); +} +}; +function _11(_12){ +var _13=$.data(_12,"window"); +var _14=_13.options; +var win=$(_12).panel($.extend({},_13.options,{border:false,doSize:true,closed:true,cls:"window "+(!_14.border?"window-thinborder window-noborder ":(_14.border=="thin"?"window-thinborder ":""))+(_14.cls||""),headerCls:"window-header "+(_14.headerCls||""),bodyCls:"window-body "+(_14.noheader?"window-body-noheader ":" ")+(_14.bodyCls||""),onBeforeDestroy:function(){ +if(_14.onBeforeDestroy.call(_12)==false){ +return false; +} +if(_13.shadow){ +_13.shadow.remove(); +} +if(_13.mask){ +_13.mask.remove(); +} +},onClose:function(){ +if(_13.shadow){ +_13.shadow.hide(); +} +if(_13.mask){ +_13.mask.hide(); +} +_14.onClose.call(_12); +},onOpen:function(){ +if(_13.mask){ +_13.mask.css($.extend({display:"block",zIndex:$.fn.window.defaults.zIndex++},$.fn.window.getMaskSize(_12))); +} +if(_13.shadow){ +_13.shadow.css({display:"block",zIndex:$.fn.window.defaults.zIndex++,left:_14.left,top:_14.top,width:_13.window._outerWidth(),height:_13.window._outerHeight()}); +} +_13.window.css("z-index",$.fn.window.defaults.zIndex++); +_14.onOpen.call(_12); +},onResize:function(_15,_16){ +var _17=$(this).panel("options"); +$.extend(_14,{width:_17.width,height:_17.height,left:_17.left,top:_17.top}); +if(_13.shadow){ +_13.shadow.css({left:_14.left,top:_14.top,width:_13.window._outerWidth(),height:_13.window._outerHeight()}); +} +_14.onResize.call(_12,_15,_16); +},onMinimize:function(){ +if(_13.shadow){ +_13.shadow.hide(); +} +if(_13.mask){ +_13.mask.hide(); +} +_13.options.onMinimize.call(_12); +},onBeforeCollapse:function(){ +if(_14.onBeforeCollapse.call(_12)==false){ +return false; +} +if(_13.shadow){ +_13.shadow.hide(); +} +},onExpand:function(){ +if(_13.shadow){ +_13.shadow.show(); +} +_14.onExpand.call(_12); +}})); +_13.window=win.panel("panel"); +if(_13.mask){ +_13.mask.remove(); +} +if(_14.modal){ +_13.mask=$("
              ").insertAfter(_13.window); +} +if(_13.shadow){ +_13.shadow.remove(); +} +if(_14.shadow){ +_13.shadow=$("
              ").insertAfter(_13.window); +} +var _18=_14.closed; +if(_14.left==null){ +_5(_12); +} +if(_14.top==null){ +_b(_12); +} +_1(_12); +if(!_18){ +win.window("open"); +} +}; +function _19(_1a,top,_1b,_1c){ +var _1d=this; +var _1e=$.data(_1d,"window"); +var _1f=_1e.options; +if(!_1f.constrain){ +return {}; +} +if($.isFunction(_1f.constrain)){ +return _1f.constrain.call(_1d,_1a,top,_1b,_1c); +} +var win=$(_1d).window("window"); +var _20=_1f.inline?win.parent():$(window); +if(_1a<0){ +_1a=0; +} +if(top<_20.scrollTop()){ +top=_20.scrollTop(); +} +if(_1a+_1b>_20.width()){ +if(_1b==win.outerWidth()){ +_1a=_20.width()-_1b; +}else{ +_1b=_20.width()-_1a; +} +} +if(top-_20.scrollTop()+_1c>_20.height()){ +if(_1c==win.outerHeight()){ +top=_20.height()-_1c+_20.scrollTop(); +}else{ +_1c=_20.height()-top+_20.scrollTop(); +} +} +return {left:_1a,top:top,width:_1b,height:_1c}; +}; +function _21(_22){ +var _23=$.data(_22,"window"); +_23.window.draggable({handle:">div.panel-header>div.panel-title",disabled:_23.options.draggable==false,onBeforeDrag:function(e){ +if(_23.mask){ +_23.mask.css("z-index",$.fn.window.defaults.zIndex++); +} +if(_23.shadow){ +_23.shadow.css("z-index",$.fn.window.defaults.zIndex++); +} +_23.window.css("z-index",$.fn.window.defaults.zIndex++); +},onStartDrag:function(e){ +_24(e); +},onDrag:function(e){ +_25(e); +return false; +},onStopDrag:function(e){ +_26(e,"move"); +}}); +_23.window.resizable({disabled:_23.options.resizable==false,onStartResize:function(e){ +_24(e); +},onResize:function(e){ +_25(e); +return false; +},onStopResize:function(e){ +_26(e,"resize"); +}}); +function _24(e){ +if(_23.pmask){ +_23.pmask.remove(); +} +_23.pmask=$("
              ").insertAfter(_23.window); +_23.pmask.css({display:"none",zIndex:$.fn.window.defaults.zIndex++,left:e.data.left,top:e.data.top,width:_23.window._outerWidth(),height:_23.window._outerHeight()}); +if(_23.proxy){ +_23.proxy.remove(); +} +_23.proxy=$("
              ").insertAfter(_23.window); +_23.proxy.css({display:"none",zIndex:$.fn.window.defaults.zIndex++,left:e.data.left,top:e.data.top}); +_23.proxy._outerWidth(e.data.width)._outerHeight(e.data.height); +_23.proxy.hide(); +setTimeout(function(){ +if(_23.pmask){ +_23.pmask.show(); +} +if(_23.proxy){ +_23.proxy.show(); +} +},500); +}; +function _25(e){ +$.extend(e.data,_19.call(_22,e.data.left,e.data.top,e.data.width,e.data.height)); +_23.pmask.show(); +_23.proxy.css({display:"block",left:e.data.left,top:e.data.top}); +_23.proxy._outerWidth(e.data.width); +_23.proxy._outerHeight(e.data.height); +}; +function _26(e,_27){ +$.extend(e.data,_19.call(_22,e.data.left,e.data.top,e.data.width+0.1,e.data.height+0.1)); +$(_22).window(_27,e.data); +_23.pmask.remove(); +_23.pmask=null; +_23.proxy.remove(); +_23.proxy=null; +}; +}; +$(function(){ +if(!$._positionFixed){ +$(window).resize(function(){ +$("body>div.window-mask:visible").css({width:"",height:""}); +setTimeout(function(){ +$("body>div.window-mask:visible").css($.fn.window.getMaskSize()); +},50); +}); +} +}); +$.fn.window=function(_28,_29){ +if(typeof _28=="string"){ +var _2a=$.fn.window.methods[_28]; +if(_2a){ +return _2a(this,_29); +}else{ +return this.panel(_28,_29); +} +} +_28=_28||{}; +return this.each(function(){ +var _2b=$.data(this,"window"); +if(_2b){ +$.extend(_2b.options,_28); +}else{ +_2b=$.data(this,"window",{options:$.extend({},$.fn.window.defaults,$.fn.window.parseOptions(this),_28)}); +if(!_2b.options.inline){ +document.body.appendChild(this); +} +} +_11(this); +_21(this); +}); +}; +$.fn.window.methods={options:function(jq){ +var _2c=jq.panel("options"); +var _2d=$.data(jq[0],"window").options; +return $.extend(_2d,{closed:_2c.closed,collapsed:_2c.collapsed,minimized:_2c.minimized,maximized:_2c.maximized}); +},window:function(jq){ +return $.data(jq[0],"window").window; +},move:function(jq,_2e){ +return jq.each(function(){ +_1(this,_2e); +}); +},hcenter:function(jq){ +return jq.each(function(){ +_5(this,true); +}); +},vcenter:function(jq){ +return jq.each(function(){ +_b(this,true); +}); +},center:function(jq){ +return jq.each(function(){ +_5(this); +_b(this); +_1(this); +}); +}}; +$.fn.window.getMaskSize=function(_2f){ +var _30=$(_2f).data("window"); +if(_30&&_30.options.inline){ +return {}; +}else{ +if($._positionFixed){ +return {position:"fixed"}; +}else{ +return {width:$(document).width(),height:$(document).height()}; +} +} +}; +$.fn.window.parseOptions=function(_31){ +return $.extend({},$.fn.panel.parseOptions(_31),$.parser.parseOptions(_31,[{draggable:"boolean",resizable:"boolean",shadow:"boolean",modal:"boolean",inline:"boolean"}])); +}; +$.fn.window.defaults=$.extend({},$.fn.panel.defaults,{zIndex:9000,draggable:true,resizable:true,shadow:true,modal:false,border:true,inline:false,title:"New Window",collapsible:true,minimizable:true,maximizable:true,closable:true,closed:false,constrain:false}); +})(jQuery); + diff --git a/assets/js/fileapi/FileAPI/FileAPI.exif.js b/assets/js/fileapi/FileAPI/FileAPI.exif.js index 4dd678ce0f..0dd92d00c2 100755 --- a/assets/js/fileapi/FileAPI/FileAPI.exif.js +++ b/assets/js/fileapi/FileAPI/FileAPI.exif.js @@ -1,69 +1,69 @@ -(function (){ -/**! - * Binary Ajax 0.1.10 - * Copyright (c) 2008 Jacob Seidelin, cupboy@gmail.com, http://blog.nihilogic.dk/ - * Licensed under the MPL License [http://www.nihilogic.dk/licenses/mpl-license.txt] - * - * - * Javascript EXIF Reader 0.1.4 - * Copyright (c) 2008 Jacob Seidelin, cupboy@gmail.com, http://blog.nihilogic.dk/ - * Licensed under the MPL License [http://www.nihilogic.dk/licenses/mpl-license.txt] - */ - - -var BinaryFile=function(j,k,l){var h=j,i=k||0,b=0;this.getRawData=function(){return h};"string"==typeof j&&(b=l||h.length,this.getByteAt=function(a){return h.charCodeAt(a+i)&255},this.getBytesAt=function(a,b){for(var c=[],f=0;fc&&(c+=65536);return c};this.getSShortAt=function(a,b){var c=this.getShortAt(a,b);return 32767c&&(c+=4294967296);return c};this.getSLongAt=function(a,b){var c=this.getLongAt(a,b);return 2147483647 128*1024) { - try { - var size = Math.min(blob.size, 128 * 1024); - blob = (blob.slice || blob.mozSlice || blob.webkitSlice).call(blob, 0, size); - } catch (e) { - FileAPI.log("exception "+ e); - } - } - - FileAPI.readAsBinaryString(blob, function (evt){ - if( evt.type == 'load' ){ - var binaryString = evt.result; - var oFile = new BinaryFile(binaryString, 0, blob.size); - var exif = EXIF.readFromBinaryFile(oFile); - - defer.resolve(false, { 'exif': exif || {} }); - } - else if( evt.type == 'error' ){ - defer.resolve('read_as_binary_string_exif'); - } - }); - } - - file.__exif.then(callback); -}); -})(); +(function (){ +/**! + * Binary Ajax 0.1.10 + * Copyright (c) 2008 Jacob Seidelin, cupboy@gmail.com, http://blog.nihilogic.dk/ + * Licensed under the MPL License [http://www.nihilogic.dk/licenses/mpl-license.txt] + * + * + * Javascript EXIF Reader 0.1.4 + * Copyright (c) 2008 Jacob Seidelin, cupboy@gmail.com, http://blog.nihilogic.dk/ + * Licensed under the MPL License [http://www.nihilogic.dk/licenses/mpl-license.txt] + */ + + +var BinaryFile=function(j,k,l){var h=j,i=k||0,b=0;this.getRawData=function(){return h};"string"==typeof j&&(b=l||h.length,this.getByteAt=function(a){return h.charCodeAt(a+i)&255},this.getBytesAt=function(a,b){for(var c=[],f=0;fc&&(c+=65536);return c};this.getSShortAt=function(a,b){var c=this.getShortAt(a,b);return 32767c&&(c+=4294967296);return c};this.getSLongAt=function(a,b){var c=this.getLongAt(a,b);return 2147483647 128*1024) { + try { + var size = Math.min(blob.size, 128 * 1024); + blob = (blob.slice || blob.mozSlice || blob.webkitSlice).call(blob, 0, size); + } catch (e) { + FileAPI.log("exception "+ e); + } + } + + FileAPI.readAsBinaryString(blob, function (evt){ + if( evt.type == 'load' ){ + var binaryString = evt.result; + var oFile = new BinaryFile(binaryString, 0, blob.size); + var exif = EXIF.readFromBinaryFile(oFile); + + defer.resolve(false, { 'exif': exif || {} }); + } + else if( evt.type == 'error' ){ + defer.resolve('read_as_binary_string_exif'); + } + }); + } + + file.__exif.then(callback); +}); +})(); diff --git a/assets/modules/store/installer/action.load.php b/assets/modules/store/installer/action.load.php index 69b0346507..c58e9b5819 100755 --- a/assets/modules/store/installer/action.load.php +++ b/assets/modules/store/installer/action.load.php @@ -1,10 +1,10 @@ - - - diff --git a/assets/modules/store/installer/action.options.php b/assets/modules/store/installer/action.options.php index 6b3cd9e8ce..8b83a979a4 100755 --- a/assets/modules/store/installer/action.options.php +++ b/assets/modules/store/installer/action.options.php @@ -1,180 +1,180 @@ - - -
              -
              - -
              - -hasPermission('exec_module')) { - die('INCLUDE_ORDERING_ERROR

              Please use the EVO Content Manager instead of accessing this file directly.'); -} - -# load setup information file -$setupPath = $modulePath; -include "{$setupPath}/setup.info.php"; - -echo "

              " . $_lang['optional_items'] . "

              " . $_lang['optional_items_note'] . "

              "; - -if (is_file( EVO_BASE_PATH . 'assets/cache/store/install/install/setup.data.sql')) { -$chk = isset ($_POST['installdata']) && $_POST['installdata'] == "1" ? 'checked="checked"' : ""; -echo 'Sample Data'; -echo "

              " . $_lang['sample_web_site'] . "

              "; -echo "

               

               " . $_lang['sample_web_site_note'] . "


              "; -} - -// toggle options -echo "

              " . $_lang['checkbox_select_options'] . "

              -

              " . $_lang['all'] . " " . $_lang['none'] . " " . $_lang['toggle'] . "

              -
              -
              "; - -$options_selected = isset ($_POST['options_selected']); - -// display templates -$templates = isset ($_POST['template']) ? $_POST['template'] : array (); -$limit = count($moduleTemplates); -if ($limit > 0) { - $tplOutput = ''; - for ($i = 0; $i < $limit; $i++) { - $class = !in_array('sample', $moduleTemplates[$i][6]) ? 'toggle' : 'toggle demo'; - $chk = in_array($i, $templates) || (!$options_selected) ? 'checked="checked"' : ""; - $tplOutput .= "" . $_lang['install_update'] . " " . $moduleTemplates[$i][0] . " - " . $moduleTemplates[$i][1] . "
              \n"; - } - if($tplOutput !== '') { - echo "

              " . $_lang['templates'] . "


              "; - echo $tplOutput; - } -} - -// display template variables -$tvs = isset ($_POST['tv']) ? $_POST['tv'] : array (); -$limit = count($moduleTVs); -if ($limit > 0) { - $tvOutput = ''; - for ($i = 0; $i < $limit; $i++) { - $class = !in_array('sample', $moduleTVs[$i][12]) ? "toggle" : "toggle demo"; - $chk = in_array($i, $tvs) || (!$options_selected) ? 'checked="checked"' : ""; - $tvOutput .= "" . $_lang['install_update'] . " " . $moduleTVs[$i][0] . " - " . $moduleTVs[$i][2] . "
              \n"; - } - if($tvOutput != '') { - echo "

              " . $_lang['tvs'] . "


              \n"; - echo $tvOutput; - } -} - -// display chunks -$chunks = isset ($_POST['chunk']) ? $_POST['chunk'] : array (); -$limit = count($moduleChunks); -if ($limit > 0) { - $chunkOutput = ''; - for ($i = 0; $i < $limit; $i++) { - $class = !in_array('sample', $moduleChunks[$i][5]) ? "toggle" : "toggle demo"; - $chk = in_array($i, $chunks) || (!$options_selected) ? 'checked="checked"' : ""; - $chunkOutput .= "" . $_lang['install_update'] . " " . $moduleChunks[$i][0] . " - " . $moduleChunks[$i][1] . "
              "; - } - if($chunkOutput != '') { - echo "

              " . $_lang['chunks'] . "

              "; - echo $chunkOutput; - } -} - -// display modules -$modules = isset ($_POST['module']) ? $_POST['module'] : array (); -$limit = count($moduleModules); -if ($limit > 0) { - $moduleOutput = ''; - for ($i = 0; $i < $limit; $i++) { - $class = !in_array('sample', $moduleModules[$i][7]) ? "toggle" : "toggle demo"; - $chk = in_array($i, $modules) || (!$options_selected) ? 'checked="checked"' : ""; - $moduleOutput .= "" . $_lang['install_update'] . " " . $moduleModules[$i][0] . " - " . $moduleModules[$i][1] . "
              "; - } - if($moduleOutput != '') { - echo "

              " . $_lang['modules'] . "

              "; - echo $moduleOutput; - } -} - -// display plugins -$plugins = isset ($_POST['plugin']) ? $_POST['plugin'] : array (); -$limit = count($modulePlugins); -if ($limit > 0) { - $pluginOutput = ''; - for ($i = 0; $i < $limit; $i++) { - $class = !in_array('sample', (array) $modulePlugins[$i][8]) ? "toggle" : "toggle demo"; - $chk = in_array($i, $plugins) || (!$options_selected) ? 'checked="checked"' : ""; - $pluginOutput .= "" . $_lang['install_update'] . " " . $modulePlugins[$i][0] . " - " . $modulePlugins[$i][1] . "
              "; - } - if($pluginOutput != '') { - echo "

              " . $_lang['plugins'] . "

              "; - echo $pluginOutput; - } -} - -// display snippets -$snippets = isset ($_POST['snippet']) ? $_POST['snippet'] : array (); -$limit = count($moduleSnippets); -if ($limit > 0) { - $snippetOutput = ''; - for ($i = 0; $i < $limit; $i++) { - $class = !in_array('sample', (array) $moduleSnippets[$i][5]) ? "toggle" : "toggle demo"; - $chk = in_array($i, $snippets) || (!$options_selected) ? 'checked="checked"' : ""; - $snippetOutput .= "" . $_lang['install_update'] . " " . $moduleSnippets[$i][0] . " - " . $moduleSnippets[$i][1] . "
              "; - } - if($snippetOutput != '') { - echo "

              " . $_lang['snippets'] . "

              "; - echo $snippetOutput; - } -} -?> -
              - - -
              - - + + +
              +
              + +
              + +hasPermission('exec_module')) { + die('INCLUDE_ORDERING_ERROR

              Please use the EVO Content Manager instead of accessing this file directly.'); +} + +# load setup information file +$setupPath = $modulePath; +include "{$setupPath}/setup.info.php"; + +echo "

              " . $_lang['optional_items'] . "

              " . $_lang['optional_items_note'] . "

              "; + +if (is_file( EVO_BASE_PATH . 'assets/cache/store/install/install/setup.data.sql')) { +$chk = isset ($_POST['installdata']) && $_POST['installdata'] == "1" ? 'checked="checked"' : ""; +echo 'Sample Data'; +echo "

              " . $_lang['sample_web_site'] . "

              "; +echo "

               

               " . $_lang['sample_web_site_note'] . "


              "; +} + +// toggle options +echo "

              " . $_lang['checkbox_select_options'] . "

              +

              " . $_lang['all'] . " " . $_lang['none'] . " " . $_lang['toggle'] . "

              +
              +
              "; + +$options_selected = isset ($_POST['options_selected']); + +// display templates +$templates = isset ($_POST['template']) ? $_POST['template'] : array (); +$limit = count($moduleTemplates); +if ($limit > 0) { + $tplOutput = ''; + for ($i = 0; $i < $limit; $i++) { + $class = !in_array('sample', $moduleTemplates[$i][6]) ? 'toggle' : 'toggle demo'; + $chk = in_array($i, $templates) || (!$options_selected) ? 'checked="checked"' : ""; + $tplOutput .= "" . $_lang['install_update'] . " " . $moduleTemplates[$i][0] . " - " . $moduleTemplates[$i][1] . "
              \n"; + } + if($tplOutput !== '') { + echo "

              " . $_lang['templates'] . "


              "; + echo $tplOutput; + } +} + +// display template variables +$tvs = isset ($_POST['tv']) ? $_POST['tv'] : array (); +$limit = count($moduleTVs); +if ($limit > 0) { + $tvOutput = ''; + for ($i = 0; $i < $limit; $i++) { + $class = !in_array('sample', $moduleTVs[$i][12]) ? "toggle" : "toggle demo"; + $chk = in_array($i, $tvs) || (!$options_selected) ? 'checked="checked"' : ""; + $tvOutput .= "" . $_lang['install_update'] . " " . $moduleTVs[$i][0] . " - " . $moduleTVs[$i][2] . "
              \n"; + } + if($tvOutput != '') { + echo "

              " . $_lang['tvs'] . "


              \n"; + echo $tvOutput; + } +} + +// display chunks +$chunks = isset ($_POST['chunk']) ? $_POST['chunk'] : array (); +$limit = count($moduleChunks); +if ($limit > 0) { + $chunkOutput = ''; + for ($i = 0; $i < $limit; $i++) { + $class = !in_array('sample', $moduleChunks[$i][5]) ? "toggle" : "toggle demo"; + $chk = in_array($i, $chunks) || (!$options_selected) ? 'checked="checked"' : ""; + $chunkOutput .= "" . $_lang['install_update'] . " " . $moduleChunks[$i][0] . " - " . $moduleChunks[$i][1] . "
              "; + } + if($chunkOutput != '') { + echo "

              " . $_lang['chunks'] . "

              "; + echo $chunkOutput; + } +} + +// display modules +$modules = isset ($_POST['module']) ? $_POST['module'] : array (); +$limit = count($moduleModules); +if ($limit > 0) { + $moduleOutput = ''; + for ($i = 0; $i < $limit; $i++) { + $class = !in_array('sample', $moduleModules[$i][7]) ? "toggle" : "toggle demo"; + $chk = in_array($i, $modules) || (!$options_selected) ? 'checked="checked"' : ""; + $moduleOutput .= "" . $_lang['install_update'] . " " . $moduleModules[$i][0] . " - " . $moduleModules[$i][1] . "
              "; + } + if($moduleOutput != '') { + echo "

              " . $_lang['modules'] . "

              "; + echo $moduleOutput; + } +} + +// display plugins +$plugins = isset ($_POST['plugin']) ? $_POST['plugin'] : array (); +$limit = count($modulePlugins); +if ($limit > 0) { + $pluginOutput = ''; + for ($i = 0; $i < $limit; $i++) { + $class = !in_array('sample', (array) $modulePlugins[$i][8]) ? "toggle" : "toggle demo"; + $chk = in_array($i, $plugins) || (!$options_selected) ? 'checked="checked"' : ""; + $pluginOutput .= "" . $_lang['install_update'] . " " . $modulePlugins[$i][0] . " - " . $modulePlugins[$i][1] . "
              "; + } + if($pluginOutput != '') { + echo "

              " . $_lang['plugins'] . "

              "; + echo $pluginOutput; + } +} + +// display snippets +$snippets = isset ($_POST['snippet']) ? $_POST['snippet'] : array (); +$limit = count($moduleSnippets); +if ($limit > 0) { + $snippetOutput = ''; + for ($i = 0; $i < $limit; $i++) { + $class = !in_array('sample', (array) $moduleSnippets[$i][5]) ? "toggle" : "toggle demo"; + $chk = in_array($i, $snippets) || (!$options_selected) ? 'checked="checked"' : ""; + $snippetOutput .= "" . $_lang['install_update'] . " " . $moduleSnippets[$i][0] . " - " . $moduleSnippets[$i][1] . "
              "; + } + if($snippetOutput != '') { + echo "

              " . $_lang['snippets'] . "

              "; + echo $snippetOutput; + } +} +?> +
              + + +
              + + diff --git a/assets/modules/store/installer/functions.php b/assets/modules/store/installer/functions.php index 204383f713..2e42f6fb53 100755 --- a/assets/modules/store/installer/functions.php +++ b/assets/modules/store/installer/functions.php @@ -1,33 +1,33 @@ - - - Install Problem - - - -
              -

              ' . $_lang["session_problem"] . '

              -

              ' .$_lang["session_problem_try_again"] . '

              -
              - -'; - exit; - } - } -} + + + Install Problem + + + +
              +

              ' . $_lang["session_problem"] . '

              +

              ' .$_lang["session_problem_try_again"] . '

              +
              + +'; + exit; + } + } +} diff --git a/assets/modules/store/installer/index.php b/assets/modules/store/installer/index.php index a47faac8fa..a8b2f856ce 100644 --- a/assets/modules/store/installer/index.php +++ b/assets/modules/store/installer/index.php @@ -5,56 +5,56 @@ evo()->invokeEvent('OnManagerPageInit'); if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true || !evo()->hasPermission('exec_module')) { - die('INCLUDE_ORDERING_ERROR

              Please use the EVO Content Manager instead of accessing this file directly.'); -} - -$moduleurl = EVO_SITE_URL . 'assets/modules/store/installer/index.php'; -$modulePath = EVO_BASE_PATH . 'assets/modules/store/installer/'; -$self = $modulePath . '/index.php'; -require_once($modulePath . "/functions.php"); - -$_lang = array(); -$_params = array(); -$lang = evo()->config['manager_language']; -if (file_exists($modulePath . '/lang/' . $lang . '.inc.php')){ - include_once($modulePath . '/lang/' . $lang . '.inc.php'); -} else { - include_once($modulePath . '/lang/en.inc.php'); -} + die('INCLUDE_ORDERING_ERROR

              Please use the EVO Content Manager instead of accessing this file directly.'); +} + +$moduleurl = EVO_SITE_URL . 'assets/modules/store/installer/index.php'; +$modulePath = EVO_BASE_PATH . 'assets/modules/store/installer/'; +$self = $modulePath . '/index.php'; +require_once($modulePath . "/functions.php"); + +$_lang = array(); +$_params = array(); +$lang = evo()->config['manager_language']; +if (file_exists($modulePath . '/lang/' . $lang . '.inc.php')){ + include_once($modulePath . '/lang/' . $lang . '.inc.php'); +} else { + include_once($modulePath . '/lang/en.inc.php'); +} require_once(EVO_MANAGER_PATH . 'includes/version.inc.php'); - -$_SESSION['test'] = 1; -install_sessionCheck(); - -$moduleName = "Evolution CMS"; -$moduleVersion = $evo_branch . ' ' . $evo_version; -$moduleRelease = $evo_release_date; -$moduleSQLBaseFile = "setup.sql"; -$moduleSQLDataFile = "setup.data.sql"; - -$moduleChunks = array (); // chunks - array : name, description, type - 0:file or 1:content, file or content -$moduleTemplates = array (); // templates - array : name, description, type - 0:file or 1:content, file or content -$moduleSnippets = array (); // snippets - array : name, description, type - 0:file or 1:content, file or content,properties -$modulePlugins = array (); // plugins - array : name, description, type - 0:file or 1:content, file or content,properties, events,guid -$moduleModules = array (); // modules - array : name, description, type - 0:file or 1:content, file or content, properties, guid, icon -$moduleTemplates = array (); // templates - array : name, description, type - 0:file or 1:content, file or content,properties -$moduleTVs = array (); // template variables - array : name, description, type - 0:file or 1:content, file or content,properties - -$errors= 0; - -// get post back status -$isPostBack = (count($_POST)); -$action = isset($_GET['action']) && in_array($_GET['action'], ['load', 'options', 'install']) ? $_GET['action'] : 'load'; - -ob_start(); -echo ' -Install - - -

              '; - -include($modulePath . '/action.' . $action . '.php'); - -echo "

              "; -ob_end_flush(); -?> + +$_SESSION['test'] = 1; +install_sessionCheck(); + +$moduleName = "Evolution CMS"; +$moduleVersion = $evo_branch . ' ' . $evo_version; +$moduleRelease = $evo_release_date; +$moduleSQLBaseFile = "setup.sql"; +$moduleSQLDataFile = "setup.data.sql"; + +$moduleChunks = array (); // chunks - array : name, description, type - 0:file or 1:content, file or content +$moduleTemplates = array (); // templates - array : name, description, type - 0:file or 1:content, file or content +$moduleSnippets = array (); // snippets - array : name, description, type - 0:file or 1:content, file or content,properties +$modulePlugins = array (); // plugins - array : name, description, type - 0:file or 1:content, file or content,properties, events,guid +$moduleModules = array (); // modules - array : name, description, type - 0:file or 1:content, file or content, properties, guid, icon +$moduleTemplates = array (); // templates - array : name, description, type - 0:file or 1:content, file or content,properties +$moduleTVs = array (); // template variables - array : name, description, type - 0:file or 1:content, file or content,properties + +$errors= 0; + +// get post back status +$isPostBack = (count($_POST)); +$action = isset($_GET['action']) && in_array($_GET['action'], ['load', 'options', 'install']) ? $_GET['action'] : 'load'; + +ob_start(); +echo ' +Install + + +

              '; + +include($modulePath . '/action.' . $action . '.php'); + +echo "

              "; +ob_end_flush(); +?> diff --git a/assets/modules/store/installer/instprocessor-fast.php b/assets/modules/store/installer/instprocessor-fast.php index e56ae28d7d..af83984d64 100644 --- a/assets/modules/store/installer/instprocessor-fast.php +++ b/assets/modules/store/installer/instprocessor-fast.php @@ -1,135 +1,135 @@ -hasPermission('exec_module')) { - die('INCLUDE_ORDERING_ERROR

              Please use the EVO Content Manager instead of accessing this file directly.'); -} - +hasPermission('exec_module')) { + die('INCLUDE_ORDERING_ERROR

              Please use the EVO Content Manager instead of accessing this file directly.'); +} + error_reporting(E_ALL & ~E_NOTICE); $moduleurl = 'assets/modules/store/installer/index.php'; -$modulePath = __DIR__; -$self = $modulePath . '/index.php'; -require_once($modulePath . "/functions.php"); -$_lang = array(); -$_params = array(); -require_once($modulePath . "/lang/en.inc.php"); -if (!isset($evo_branch)) { - $evo_branch = ''; -} -if (!isset($evo_version)) { - $evo_version = ''; -} -if (!isset($evo_release_date)) { - $evo_release_date = ''; -} -if (!isset($installPath)) { - $installPath = EVO_BASE_PATH . 'assets/cache/store/install/install'; -} - -$_SESSION['test'] = 1; -install_sessionCheck(); -$moduleName = "Evolution CMS"; -$moduleVersion = $evo_branch . ' ' . $evo_version; -$moduleRelease = $evo_release_date; -$moduleSQLBaseFile = "setup.sql"; -$moduleSQLDataFile = "setup.data.sql"; - -if (!empty($installPath) && is_file($installPath . '/' . $moduleSQLBaseFile)) { - $moduleSQLDataFile = $moduleSQLBaseFile; -} - -$moduleChunks = array(); // chunks - array : name, description, type - 0:file or 1:content, file or content -$moduleTemplates = array(); // templates - array : name, description, type - 0:file or 1:content, file or content -$moduleSnippets = array(); // snippets - array : name, description, type - 0:file or 1:content, file or content,properties -$modulePlugins = array(); // plugins - array : name, description, type - 0:file or 1:content, file or content,properties, events,guid -$moduleModules = array(); // modules - array : name, description, type - 0:file or 1:content, file or content, properties, guid, icon -$moduleTemplates = array(); // templates - array : name, description, type - 0:file or 1:content, file or content,properties -$moduleTVs = array(); // template variables - array : name, description, type - 0:file or 1:content, file or content,properties - -$errors = 0; - -// get post back status -$isPostBack = (count($_POST)); - -$_POST['installmode'] = 1; -//$_POST['installdata'] = 0; -$sqlParser = ''; -$create = false; - -// set timout limit -@set_time_limit(120); // used @ to prevent warning when using safe mode? - +$modulePath = __DIR__; +$self = $modulePath . '/index.php'; +require_once($modulePath . "/functions.php"); +$_lang = array(); +$_params = array(); +require_once($modulePath . "/lang/en.inc.php"); +if (!isset($evo_branch)) { + $evo_branch = ''; +} +if (!isset($evo_version)) { + $evo_version = ''; +} +if (!isset($evo_release_date)) { + $evo_release_date = ''; +} +if (!isset($installPath)) { + $installPath = EVO_BASE_PATH . 'assets/cache/store/install/install'; +} + +$_SESSION['test'] = 1; +install_sessionCheck(); +$moduleName = "Evolution CMS"; +$moduleVersion = $evo_branch . ' ' . $evo_version; +$moduleRelease = $evo_release_date; +$moduleSQLBaseFile = "setup.sql"; +$moduleSQLDataFile = "setup.data.sql"; + +if (!empty($installPath) && is_file($installPath . '/' . $moduleSQLBaseFile)) { + $moduleSQLDataFile = $moduleSQLBaseFile; +} + +$moduleChunks = array(); // chunks - array : name, description, type - 0:file or 1:content, file or content +$moduleTemplates = array(); // templates - array : name, description, type - 0:file or 1:content, file or content +$moduleSnippets = array(); // snippets - array : name, description, type - 0:file or 1:content, file or content,properties +$modulePlugins = array(); // plugins - array : name, description, type - 0:file or 1:content, file or content,properties, events,guid +$moduleModules = array(); // modules - array : name, description, type - 0:file or 1:content, file or content, properties, guid, icon +$moduleTemplates = array(); // templates - array : name, description, type - 0:file or 1:content, file or content,properties +$moduleTVs = array(); // template variables - array : name, description, type - 0:file or 1:content, file or content,properties + +$errors = 0; + +// get post back status +$isPostBack = (count($_POST)); + +$_POST['installmode'] = 1; +//$_POST['installdata'] = 0; +$sqlParser = ''; +$create = false; + +// set timout limit +@set_time_limit(120); // used @ to prevent warning when using safe mode? + $installMode = (int)$_POST['installmode']; $optionsSelected = isset($_POST['options_selected']); $fastInstallAll = !$optionsSelected; $installData = isset($_POST['installdata']) && $_POST['installdata'] == "1" ? 1 : 0; - -// set session name variable -if (!isset ($site_sessionname)) { - $site_sessionname = 'SN' . uniqid(''); -} - -// get base path and url -$a = explode("install", str_replace("\\", "/", dirname($_SERVER["PHP_SELF"]))); -if (count($a) > 1) { - array_pop($a); -} -$url = implode("install", $a); -reset($a); -$a = explode("install", str_replace("\\", "/", realpath(__DIR__))); -if (count($a) > 1) { - array_pop($a); -} -$pth = implode("install", $a); -unset ($a); -$base_url = $url . (substr($url, -1) != "/" ? "/" : ""); -$base_path = $pth . (substr($pth, -1) != "/" ? "/" : ""); - -if (!function_exists('propertiesNameValue')) { - // parses a resource property string and returns the result as an array - // duplicate of method in documentParser class - function propertiesNameValue($propertyString) - { - $parameter = array(); - if (!empty($propertyString)) { - $tmpParams = explode("&", $propertyString); - for ($x = 0; $x < count($tmpParams); $x++) { - if (strpos($tmpParams[$x], '=', 0)) { - $pTmp = explode("=", $tmpParams[$x]); - $pvTmp = explode(";", trim($pTmp[1])); - if ($pvTmp[1] == 'list' && $pvTmp[3] != "") { - $parameter[trim($pTmp[0])] = $pvTmp[3]; //list default - } else { - if ($pvTmp[1] != 'list' && $pvTmp[2] != "") { - $parameter[trim($pTmp[0])] = $pvTmp[2]; - } - } - } - } - } - return $parameter; - } -} - -$setupPath = $modulePath; - -include "{$setupPath}/setup.info.php"; -include "sqlParser.class.php"; - -$databaseConfig = evo()->app['config']['database']['connections']['default']; -$sqlParser = new SqlParser(); -$sqlParser->mode = "upd"; -$sqlParser->ignoreDuplicateErrors = true; - + +// set session name variable +if (!isset ($site_sessionname)) { + $site_sessionname = 'SN' . uniqid(''); +} + +// get base path and url +$a = explode("install", str_replace("\\", "/", dirname($_SERVER["PHP_SELF"]))); +if (count($a) > 1) { + array_pop($a); +} +$url = implode("install", $a); +reset($a); +$a = explode("install", str_replace("\\", "/", realpath(__DIR__))); +if (count($a) > 1) { + array_pop($a); +} +$pth = implode("install", $a); +unset ($a); +$base_url = $url . (substr($url, -1) != "/" ? "/" : ""); +$base_path = $pth . (substr($pth, -1) != "/" ? "/" : ""); + +if (!function_exists('propertiesNameValue')) { + // parses a resource property string and returns the result as an array + // duplicate of method in documentParser class + function propertiesNameValue($propertyString) + { + $parameter = array(); + if (!empty($propertyString)) { + $tmpParams = explode("&", $propertyString); + for ($x = 0; $x < count($tmpParams); $x++) { + if (strpos($tmpParams[$x], '=', 0)) { + $pTmp = explode("=", $tmpParams[$x]); + $pvTmp = explode(";", trim($pTmp[1])); + if ($pvTmp[1] == 'list' && $pvTmp[3] != "") { + $parameter[trim($pTmp[0])] = $pvTmp[3]; //list default + } else { + if ($pvTmp[1] != 'list' && $pvTmp[2] != "") { + $parameter[trim($pTmp[0])] = $pvTmp[2]; + } + } + } + } + } + return $parameter; + } +} + +$setupPath = $modulePath; + +include "{$setupPath}/setup.info.php"; +include "sqlParser.class.php"; + +$databaseConfig = evo()->app['config']['database']['connections']['default']; +$sqlParser = new SqlParser(); +$sqlParser->mode = "upd"; +$sqlParser->ignoreDuplicateErrors = true; + // Install Templates $selTemplates = isset($_POST['template']) && is_array($_POST['template']) ? $_POST['template'] : array(); if (count($moduleTemplates) > 0 && ($fastInstallAll || isset($_POST['template']) || $installData)) { @@ -230,11 +230,11 @@ function propertiesNameValue($propertyString) } } } - } - } - } -} - + } + } + } +} + // Install Chunks $selChunks = isset($_POST['chunk']) && is_array($_POST['chunk']) ? $_POST['chunk'] : array(); if (count($moduleChunks) > 0 && ($fastInstallAll || isset($_POST['chunk']) || $installData)) { @@ -331,108 +331,108 @@ function propertiesNameValue($propertyString) continue; } $name = $modulePlugin[0]; - $desc = $modulePlugin[1]; - $filecontent = $modulePlugin[2]; - $properties = $modulePlugin[3]; - $events = explode(",", $modulePlugin[4]); - $guid = $modulePlugin[5]; - $category = $modulePlugin[6]; - $leg_names = []; - $disabled = $modulePlugin[9]; - if (array_key_exists(7, $modulePlugin)) { - // parse comma-separated legacy names and prepare them for sql IN clause - $leg_names = preg_split('/\s*,\s*/', $modulePlugin[7]); - } - if (!file_exists($filecontent)) { - echo "

                $name: " . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".

              "; - } else { - // disable legacy versions based on legacy_names provided - if (count($leg_names)) { - \EvolutionCMS\Models\SitePlugin::query()->whereIn('name', $leg_names)->update(['disabled' => 1]); - } - - // Create the category if it does not already exist - $category = getCreateDbCategory($category, $sqlParser); - $tmp = preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2); - $plugin = end($tmp); - // remove installer docblock - $plugin = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $plugin, 1); - $pluginDbRecord = \EvolutionCMS\Models\SitePlugin::where('name', $name)->orderBy('id'); - $prev_id = null; - - if ($pluginDbRecord->count() > 0) { - $insert = true; - foreach ($pluginDbRecord->get()->toArray() as $row) { - $properties = propUpdate($properties, $row['properties']); - if ($row['description'] == $desc) { - \EvolutionCMS\Models\SitePlugin::query()->where('id', $row['id'])->update(['plugincode' => $plugin, 'description' => $desc, 'properties' => $properties]); - - $insert = false; - } else { - \EvolutionCMS\Models\SitePlugin::query()->where('id', $row['id'])->update(['disabled' => 1]); - } - $prev_id = $row['id']; - } - if ($insert === true) { - $properties = propUpdate($properties, $row['properties']); - - \EvolutionCMS\Models\SitePlugin::query()->create(['name' => $name, 'plugincode' => $plugin, 'description' => $desc, 'properties' => $properties, 'moduleguid' => $guid, 'disabled' => 0, 'category' => $category]); - } - echo "

                $name: " . $_lang['upgraded'] . "

              "; - } else { - $properties = parseProperties($properties, true); - \EvolutionCMS\Models\SitePlugin::query()->create(['name' => $name, 'plugincode' => $plugin, 'description' => $desc, 'properties' => $properties, 'moduleguid' => $guid, 'disabled' => $disabled, 'category' => $category]); - echo "

                $name: " . $_lang['installed'] . "

              "; - } - // add system events - if (count($events) > 0) { - $sitePlugin = \EvolutionCMS\Models\SitePlugin::where('name', $name)->where('description', $desc)->first(); - if (!is_null($sitePlugin)) { - $id = $sitePlugin->id; - - // add new events - foreach ($events as $event) { - $eventName = \EvolutionCMS\Models\SystemEventname::where('name', $event)->first(); - if (!is_null($eventName)) { - $prev_priority = null; - if ($prev_id) { - $pluginEvent = \EvolutionCMS\Models\SitePluginEvent::query() - ->where('pluginid', $prev_id) - ->where('evtid', $eventName->getKey())->first(); - if (!is_null($pluginEvent)) { - $prev_priority = $pluginEvent->priority; - } - } - if (is_null($prev_priority)) { - $pluginEvent = \EvolutionCMS\Models\SitePluginEvent::query() - ->where('evtid', $eventName->getKey()) - ->orderBy('priority', 'DESC')->first(); - if (!is_null($pluginEvent)) { - $prev_priority = $pluginEvent->priority; - $prev_priority++; - } - } - if (is_null($prev_priority)) { - $prev_priority = 0; - } - $arrInsert = ['pluginid' => $id, 'evtid' => $eventName->getKey(), 'priority' => $prev_priority]; - \EvolutionCMS\Models\SitePluginEvent::query() - ->firstOrCreate($arrInsert); - } - } - - // remove absent events - \EvolutionCMS\Models\SitePluginEvent::query()->join('system_eventnames', function ($join) use ($events) { - $join->on('site_plugin_events.evtid', '=', 'system_eventnames.id') - ->whereIn('name', $events); - })->whereNull('name') - ->where('pluginid', $id)->delete(); - } - } - } - } -} - + $desc = $modulePlugin[1]; + $filecontent = $modulePlugin[2]; + $properties = $modulePlugin[3]; + $events = explode(",", $modulePlugin[4]); + $guid = $modulePlugin[5]; + $category = $modulePlugin[6]; + $leg_names = []; + $disabled = $modulePlugin[9]; + if (array_key_exists(7, $modulePlugin)) { + // parse comma-separated legacy names and prepare them for sql IN clause + $leg_names = preg_split('/\s*,\s*/', $modulePlugin[7]); + } + if (!file_exists($filecontent)) { + echo "

                $name: " . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".

              "; + } else { + // disable legacy versions based on legacy_names provided + if (count($leg_names)) { + \EvolutionCMS\Models\SitePlugin::query()->whereIn('name', $leg_names)->update(['disabled' => 1]); + } + + // Create the category if it does not already exist + $category = getCreateDbCategory($category, $sqlParser); + $tmp = preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2); + $plugin = end($tmp); + // remove installer docblock + $plugin = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $plugin, 1); + $pluginDbRecord = \EvolutionCMS\Models\SitePlugin::where('name', $name)->orderBy('id'); + $prev_id = null; + + if ($pluginDbRecord->count() > 0) { + $insert = true; + foreach ($pluginDbRecord->get()->toArray() as $row) { + $properties = propUpdate($properties, $row['properties']); + if ($row['description'] == $desc) { + \EvolutionCMS\Models\SitePlugin::query()->where('id', $row['id'])->update(['plugincode' => $plugin, 'description' => $desc, 'properties' => $properties]); + + $insert = false; + } else { + \EvolutionCMS\Models\SitePlugin::query()->where('id', $row['id'])->update(['disabled' => 1]); + } + $prev_id = $row['id']; + } + if ($insert === true) { + $properties = propUpdate($properties, $row['properties']); + + \EvolutionCMS\Models\SitePlugin::query()->create(['name' => $name, 'plugincode' => $plugin, 'description' => $desc, 'properties' => $properties, 'moduleguid' => $guid, 'disabled' => 0, 'category' => $category]); + } + echo "

                $name: " . $_lang['upgraded'] . "

              "; + } else { + $properties = parseProperties($properties, true); + \EvolutionCMS\Models\SitePlugin::query()->create(['name' => $name, 'plugincode' => $plugin, 'description' => $desc, 'properties' => $properties, 'moduleguid' => $guid, 'disabled' => $disabled, 'category' => $category]); + echo "

                $name: " . $_lang['installed'] . "

              "; + } + // add system events + if (count($events) > 0) { + $sitePlugin = \EvolutionCMS\Models\SitePlugin::where('name', $name)->where('description', $desc)->first(); + if (!is_null($sitePlugin)) { + $id = $sitePlugin->id; + + // add new events + foreach ($events as $event) { + $eventName = \EvolutionCMS\Models\SystemEventname::where('name', $event)->first(); + if (!is_null($eventName)) { + $prev_priority = null; + if ($prev_id) { + $pluginEvent = \EvolutionCMS\Models\SitePluginEvent::query() + ->where('pluginid', $prev_id) + ->where('evtid', $eventName->getKey())->first(); + if (!is_null($pluginEvent)) { + $prev_priority = $pluginEvent->priority; + } + } + if (is_null($prev_priority)) { + $pluginEvent = \EvolutionCMS\Models\SitePluginEvent::query() + ->where('evtid', $eventName->getKey()) + ->orderBy('priority', 'DESC')->first(); + if (!is_null($pluginEvent)) { + $prev_priority = $pluginEvent->priority; + $prev_priority++; + } + } + if (is_null($prev_priority)) { + $prev_priority = 0; + } + $arrInsert = ['pluginid' => $id, 'evtid' => $eventName->getKey(), 'priority' => $prev_priority]; + \EvolutionCMS\Models\SitePluginEvent::query() + ->firstOrCreate($arrInsert); + } + } + + // remove absent events + \EvolutionCMS\Models\SitePluginEvent::query()->join('system_eventnames', function ($join) use ($events) { + $join->on('site_plugin_events.evtid', '=', 'system_eventnames.id') + ->whereIn('name', $events); + })->whereNull('name') + ->where('pluginid', $id)->delete(); + } + } + } + } +} + // Install Snippets $selSnips = isset($_POST['snippet']) && is_array($_POST['snippet']) ? $_POST['snippet'] : array(); if (count($moduleSnippets) > 0 && ($fastInstallAll || isset($_POST['snippet']) || $installData)) { @@ -444,144 +444,144 @@ function propertiesNameValue($propertyString) continue; } $name = $moduleSnippet[0]; - $desc = $moduleSnippet[1]; - $filecontent = $moduleSnippet[2]; - $properties = $moduleSnippet[3]; - $category = $moduleSnippet[4]; - if (!file_exists($filecontent)) { - echo "

                $name: " . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".

              "; - } else { - // Create the category if it does not already exist - $category = getCreateDbCategory($category, $sqlParser); - $tmp = preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2); - $snippet = end($tmp); - // remove installer docblock - $snippet = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $snippet, 1); - $snippetDbRecord = \EvolutionCMS\Models\SiteSnippet::query()->where('name', $name)->first(); - - if (!is_null($snippetDbRecord)) { - $properties = propUpdate($properties, $snippetDbRecord->properties); - \EvolutionCMS\Models\SiteSnippet::query()->where('name', $name)->update(['snippet' => $snippet, 'description' => $desc, 'properties' => $properties]); - - echo "

                $name: " . $_lang['upgraded'] . "

              "; - } else { - $properties = parseProperties($properties, true); - \EvolutionCMS\Models\SiteSnippet::query()->insert(['name' => $name, 'snippet' => $snippet, 'description' => $desc, 'properties' => $properties, 'category' => $category]); - echo "

                $name: " . $_lang['installed'] . "

              "; - } - } - } -} - -// install data -if (is_file($installPath . '/' . $moduleSQLDataFile)) { - echo "

              " . $_lang['installing_demo_site']; - $sqlParser->process($installPath . '/' . $moduleSQLDataFile); - // display database results - if ($sqlParser->installFailed == true) { - $errors += 1; - echo "" . $_lang['database_alerts'] . "

              "; - echo "

              " . $_lang['setup_couldnt_install'] . "

              "; - echo "

              " . $_lang['installation_error_occured'] . "

              "; - for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { - echo "" . $sqlParser->mysqlErrors[$i]["error"] . "" . $_lang['during_execution_of_sql'] . "" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . ".


              "; - } - echo "

              "; - echo "

              " . $_lang['some_tables_not_updated'] . "

              "; - return; - } else { - echo "" . $_lang['ok'] . "

              "; - } -} - -// always empty cache after install -evo()->clearCache('full'); - -// setup completed! -echo "

              " . $_lang['installation_successful'] . "

              "; - -// Property Update function -function propUpdate($new, $old) -{ - $newArr = parseProperties($new); - $oldArr = parseProperties($old); - foreach ($oldArr as $k => $v) { - if (isset($v['0']['options']) && isset($newArr[$k]['0']['options'])) { - $oldArr[$k]['0']['options'] = $newArr[$k]['0']['options']; - } - } - $return = $oldArr + $newArr; - $return = json_encode($return, JSON_UNESCAPED_UNICODE); - $return = ($return != '[]') ? $return : ''; - return $return; -} - -function parseProperties($propertyString, $json = false) -{ - $propertyString = str_replace('{}', '', $propertyString); - $propertyString = str_replace('} {', ',', $propertyString); - - if (empty($propertyString) || $propertyString == '{}' || $propertyString == '[]') { - $propertyString = ''; - } - - $jsonFormat = isJson($propertyString, true); - $property = array(); - // old format - if ($jsonFormat === false) { - $props = explode('&', $propertyString); - $arr = array(); - $key = array(); - foreach ($props as $prop) { - if ($prop != '') { - $arr = explode(';', $prop); - $key = explode('=', $arr['0']); - $property[$key['0']]['0']['label'] = trim($key['1']); - $property[$key['0']]['0']['type'] = trim($arr['1']); - switch ($arr['1']) { - case 'list': - case 'list-multi': - case 'checkbox': - case 'radio': - case 'menu': - $property[$key['0']]['0']['value'] = trim($arr['3']); - $property[$key['0']]['0']['options'] = trim($arr['2']); - $property[$key['0']]['0']['default'] = trim($arr['3']); - break; - default: - $property[$key['0']]['0']['value'] = trim($arr['2']); - $property[$key['0']]['0']['default'] = trim($arr['2']); - } - $property[$key['0']]['0']['desc'] = ''; - } - } - // new json-format - } else if (!empty($jsonFormat)) { - $property = $jsonFormat; - } - if ($json) { - $property = json_encode($property, JSON_UNESCAPED_UNICODE); - } - $property = ($property != '[]') ? $property : ''; - return $property; -} - -function isJson($string, $returnData = false) -{ - $data = json_decode($string, true); - return (json_last_error() == JSON_ERROR_NONE) ? ($returnData ? $data : true) : false; -} - -function getCreateDbCategory($category) -{ - $category_id = 0; - if (!empty($category)) { - $categoryDbRecord = \EvolutionCMS\Models\Category::query()->where('category', $category)->first(); - if (!is_null($categoryDbRecord)) { - $category_id = $categoryDbRecord->getKey(); - } else { - $category_id = \EvolutionCMS\Models\Category::query()->insertGetId(['category' => $category]); - } - } - return $category_id; -} + $desc = $moduleSnippet[1]; + $filecontent = $moduleSnippet[2]; + $properties = $moduleSnippet[3]; + $category = $moduleSnippet[4]; + if (!file_exists($filecontent)) { + echo "

                $name: " . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".

              "; + } else { + // Create the category if it does not already exist + $category = getCreateDbCategory($category, $sqlParser); + $tmp = preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2); + $snippet = end($tmp); + // remove installer docblock + $snippet = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $snippet, 1); + $snippetDbRecord = \EvolutionCMS\Models\SiteSnippet::query()->where('name', $name)->first(); + + if (!is_null($snippetDbRecord)) { + $properties = propUpdate($properties, $snippetDbRecord->properties); + \EvolutionCMS\Models\SiteSnippet::query()->where('name', $name)->update(['snippet' => $snippet, 'description' => $desc, 'properties' => $properties]); + + echo "

                $name: " . $_lang['upgraded'] . "

              "; + } else { + $properties = parseProperties($properties, true); + \EvolutionCMS\Models\SiteSnippet::query()->insert(['name' => $name, 'snippet' => $snippet, 'description' => $desc, 'properties' => $properties, 'category' => $category]); + echo "

                $name: " . $_lang['installed'] . "

              "; + } + } + } +} + +// install data +if (is_file($installPath . '/' . $moduleSQLDataFile)) { + echo "

              " . $_lang['installing_demo_site']; + $sqlParser->process($installPath . '/' . $moduleSQLDataFile); + // display database results + if ($sqlParser->installFailed == true) { + $errors += 1; + echo "" . $_lang['database_alerts'] . "

              "; + echo "

              " . $_lang['setup_couldnt_install'] . "

              "; + echo "

              " . $_lang['installation_error_occured'] . "

              "; + for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { + echo "" . $sqlParser->mysqlErrors[$i]["error"] . "" . $_lang['during_execution_of_sql'] . "" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . ".


              "; + } + echo "

              "; + echo "

              " . $_lang['some_tables_not_updated'] . "

              "; + return; + } else { + echo "" . $_lang['ok'] . "

              "; + } +} + +// always empty cache after install +evo()->clearCache('full'); + +// setup completed! +echo "

              " . $_lang['installation_successful'] . "

              "; + +// Property Update function +function propUpdate($new, $old) +{ + $newArr = parseProperties($new); + $oldArr = parseProperties($old); + foreach ($oldArr as $k => $v) { + if (isset($v['0']['options']) && isset($newArr[$k]['0']['options'])) { + $oldArr[$k]['0']['options'] = $newArr[$k]['0']['options']; + } + } + $return = $oldArr + $newArr; + $return = json_encode($return, JSON_UNESCAPED_UNICODE); + $return = ($return != '[]') ? $return : ''; + return $return; +} + +function parseProperties($propertyString, $json = false) +{ + $propertyString = str_replace('{}', '', $propertyString); + $propertyString = str_replace('} {', ',', $propertyString); + + if (empty($propertyString) || $propertyString == '{}' || $propertyString == '[]') { + $propertyString = ''; + } + + $jsonFormat = isJson($propertyString, true); + $property = array(); + // old format + if ($jsonFormat === false) { + $props = explode('&', $propertyString); + $arr = array(); + $key = array(); + foreach ($props as $prop) { + if ($prop != '') { + $arr = explode(';', $prop); + $key = explode('=', $arr['0']); + $property[$key['0']]['0']['label'] = trim($key['1']); + $property[$key['0']]['0']['type'] = trim($arr['1']); + switch ($arr['1']) { + case 'list': + case 'list-multi': + case 'checkbox': + case 'radio': + case 'menu': + $property[$key['0']]['0']['value'] = trim($arr['3']); + $property[$key['0']]['0']['options'] = trim($arr['2']); + $property[$key['0']]['0']['default'] = trim($arr['3']); + break; + default: + $property[$key['0']]['0']['value'] = trim($arr['2']); + $property[$key['0']]['0']['default'] = trim($arr['2']); + } + $property[$key['0']]['0']['desc'] = ''; + } + } + // new json-format + } else if (!empty($jsonFormat)) { + $property = $jsonFormat; + } + if ($json) { + $property = json_encode($property, JSON_UNESCAPED_UNICODE); + } + $property = ($property != '[]') ? $property : ''; + return $property; +} + +function isJson($string, $returnData = false) +{ + $data = json_decode($string, true); + return (json_last_error() == JSON_ERROR_NONE) ? ($returnData ? $data : true) : false; +} + +function getCreateDbCategory($category) +{ + $category_id = 0; + if (!empty($category)) { + $categoryDbRecord = \EvolutionCMS\Models\Category::query()->where('category', $category)->first(); + if (!is_null($categoryDbRecord)) { + $category_id = $categoryDbRecord->getKey(); + } else { + $category_id = \EvolutionCMS\Models\Category::query()->insertGetId(['category' => $category]); + } + } + return $category_id; +} diff --git a/assets/modules/store/installer/instprocessor.php b/assets/modules/store/installer/instprocessor.php index c9907d437f..f5d9574d8a 100644 --- a/assets/modules/store/installer/instprocessor.php +++ b/assets/modules/store/installer/instprocessor.php @@ -1,566 +1,566 @@ -hasPermission('exec_module')) { - die('INCLUDE_ORDERING_ERROR

              Please use the EVO Content Manager instead of accessing this file directly.'); -} - -$_POST['installmode'] = 1; -//$_POST['installdata'] = 0; -$sqlParser = ''; -$create = false; - -// set timout limit -@set_time_limit(120); // used @ to prevent warning when using safe mode? - -$installMode= (int)$_POST['installmode']; -$installData = $_POST['installdata'] == "1" ? 1 : 0; - -// set session name variable -if (!isset ($site_sessionname)) { - $site_sessionname = 'SN' . uniqid(''); -} - -// get base path and url -$a = explode("install", str_replace("\\", "/", dirname($_SERVER["PHP_SELF"]))); -if (count($a) > 1) { - array_pop($a); -} -$url = implode("install", $a); -reset($a); -$a = explode("install", str_replace("\\", "/", realpath(__DIR__))); -if (count($a) > 1) { - array_pop($a); -} -$pth = implode("install", $a); -unset ($a); -$base_url = $url . (substr($url, -1) != "/" ? "/" : ""); -$base_path = $pth . (substr($pth, -1) != "/" ? "/" : ""); - -if (!function_exists('propertiesNameValue')) { - // parses a resource property string and returns the result as an array - // duplicate of method in documentParser class - function propertiesNameValue($propertyString) { - $parameter= array (); - if (!empty ($propertyString)) { - $tmpParams= explode("&", $propertyString); - for ($x= 0; $x < count($tmpParams); $x++) { - if (strpos($tmpParams[$x], '=', 0)) { - $pTmp= explode("=", $tmpParams[$x]); - $pvTmp= explode(";", trim($pTmp[1])); - if ($pvTmp[1] == 'list' && $pvTmp[3] != "") { - $parameter[trim($pTmp[0])] = $pvTmp[3]; //list default - } else { - if ($pvTmp[1] != 'list' && $pvTmp[2] != "") { - $parameter[trim($pTmp[0])] = $pvTmp[2]; - } - } - } - } - } - return $parameter; - } -} -$table_prefix = evo()->getDatabase()->getConfig('prefix'); -$setupPath = $modulePath; -include "{$setupPath}/setup.info.php"; -include "{$setupPath}/sqlParser.class.php"; -$sqlParser = new SqlParser(); - -// Install Templates -if (isset ($_POST['template']) || $installData) { - echo "

              " . $_lang['templates'] . ":

              "; - $selTemplates = $_POST['template']; - foreach ($moduleTemplates as $k => $moduleTemplate) { - $installSample = in_array('sample', $moduleTemplate[6]) && $installData == 1; - if($installSample || in_array($k, $selTemplates)) { - $name = EvolutionCms()->getDatabase()->escape($moduleTemplate[0]); - $desc = EvolutionCms()->getDatabase()->escape($moduleTemplate[1]); - $category = EvolutionCms()->getDatabase()->escape($moduleTemplate[4]); - $locked = EvolutionCms()->getDatabase()->escape($moduleTemplate[5]); - $filecontent = $moduleTemplate[3]; - if (!file_exists($filecontent)) { - echo "

                $name: " . $_lang['unable_install_template'] . " '$filecontent' " . $_lang['not_found'] . ".

              "; - } else { - // Create the category if it does not already exist - $category_id = getCreateDbCategory($category, $sqlParser); - - // Strip the first comment up top - $template = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', file_get_contents($filecontent), 1); - $template = EvolutionCms()->getDatabase()->escape($template); - - // See if the template already exists - $rs = evo()->getDatabase()->query("SELECT * FROM `" . $table_prefix . "site_templates` WHERE templatename='$name'"); - - if (evo()->getDatabase()->getRecordCount($rs)) { - if (!@evo()->getDatabase()->query("UPDATE `" . $table_prefix . "site_templates` SET content='$template', description='$desc', category='$category_id', locked='$locked' WHERE templatename='$name';")) { - $errors += 1; - echo "

              " . mysql_error() . "

              "; - return; - } - echo "

                $name: " . $_lang['upgraded'] . "

              "; - } else { - if (!@evo()->getDatabase()->query("INSERT INTO `" . $table_prefix . "site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template','$category_id','$locked');")) { - $errors += 1; - echo "

              " . mysql_error() . "

              "; - return; - } - echo "

                $name: " . $_lang['installed'] . "

              "; - } - } - } - } -} - -// Install Template Variables -if (isset ($_POST['tv']) || $installData) { - echo "

              " . $_lang['tvs'] . ":

              "; - $selTVs = $_POST['tv']; - foreach ($moduleTVs as $k=>$moduleTV) { - $installSample = in_array('sample', $moduleTV[12]) && $installData == 1; - if($installSample || in_array($k, $selTVs)) { - $name = evo()->getDatabase()->escape($moduleTV[0]); - $caption = evo()->getDatabase()->escape($moduleTV[1]); - $desc = evo()->getDatabase()->escape($moduleTV[2]); - $input_type = evo()->getDatabase()->escape($moduleTV[3]); - $input_options = evo()->getDatabase()->escape($moduleTV[4]); - $input_default = evo()->getDatabase()->escape($moduleTV[5]); - $output_widget = evo()->getDatabase()->escape($moduleTV[6]); - $output_widget_params = evo()->getDatabase()->escape($moduleTV[7]); - $filecontent = $moduleTV[8]; - $assignments = $moduleTV[9]; - $category = evo()->getDatabase()->escape($moduleTV[10]); - $locked = evo()->getDatabase()->escape($moduleTV[11]); - - // Create the category if it does not already exist - $category = getCreateDbCategory($category, $sqlParser); - - $rs = evo()->getDatabase()->query("SELECT * FROM `" . $table_prefix . "site_tmplvars` WHERE name='$name'"); - if (evo()->getDatabase()->getRecordCount($rs)) { - $insert = true; - while($row = evo()->getDatabase()->getRow($rs,'assoc')) { - if (!@evo()->getDatabase()->query("UPDATE `" . $table_prefix . "site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category='$category', locked='$locked', elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id='{$row['id']}';")) { - echo "

              " . mysql_error() . "

              "; - return; - } - $insert = false; - } - echo "

                $name: " . $_lang['upgraded'] . "

              "; - } else { - //$q = "INSERT INTO `" . $table_prefix . "site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',(SELECT (CASE COUNT(*) WHEN 0 THEN 0 ELSE `id` END) `id` FROM `" . $table_prefix . "categories` WHERE `category` = '$category'),$locked,'$input_options','$output_widget','$output_widget_params','$input_default');"; - $q = "INSERT INTO `" . $table_prefix . "site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc','$category','$locked','$input_options','$output_widget','$output_widget_params','$input_default');"; - if (!@evo()->getDatabase()->query($q)) { - echo "

              " . mysql_error() . "

              "; - return; - } - echo "

                $name: " . $_lang['installed'] . "

              "; - } - - // add template assignments - if (trim($assignments) != ''){ - $assignments = explode(',', $assignments); - - if (count($assignments) > 0) { - - // remove existing tv -> template assignments - $ds = evo()->getDatabase()->query("SELECT id FROM `".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';" ); - $row = evo()->getDatabase()->getRow($ds,'assoc'); - $id = $row["id"]; - evo()->getDatabase()->query("DELETE FROM $dbase.`" . $table_prefix . "site_tmplvar_templates` WHERE tmplvarid = '$id';"); - - // add tv -> template assignments - foreach ($assignments as $assignment) { - $template = evo()->getDatabase()->escape($assignment); - $where = "WHERE templatename='$template'"; - if ($template=='*') $where =''; - $ts = evo()->getDatabase()->query("SELECT id FROM `".$table_prefix."site_templates` $where;" ); - if ($ds && $ts) { - $tRow = evo()->getDatabase()->getRow($ts,'assoc'); - $templateId = $tRow['id']; - evo()->getDatabase()->query("INSERT INTO `" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES('$id', '$templateId');"); - } - } - } - } - } - } -} - -// Install Chunks -if (isset ($_POST['chunk']) || $installData) { - echo "

              " . $_lang['chunks'] . ":

              "; - $selChunks = $_POST['chunk']; - foreach ($moduleChunks as $k => $moduleChunk) { - $installSample = in_array('sample', $moduleChunk[5]) && $installData == 1; - if ($installSample || in_array($k, $selChunks)) { - $name = evo()->getDatabase()->escape($moduleChunk[0]); - $desc = evo()->getDatabase()->escape($moduleChunk[1]); - $category = evo()->getDatabase()->escape($moduleChunk[3]); - $overwrite = evo()->getDatabase()->escape($moduleChunk[4]); - $filecontent = $moduleChunk[2]; - - if (!file_exists($filecontent)) { - echo "

                $name: " . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".

              "; - } else { - // Create the category if it does not already exist - $category_id = getCreateDbCategory($category, $sqlParser); - - $chunk = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', file_get_contents($filecontent), 1); - $chunk = evo()->getDatabase()->escape($chunk); - $rs = evo()->getDatabase()->query("SELECT * FROM `" . $table_prefix . "site_htmlsnippets` WHERE name='$name'"); - $count_original_name = evo()->getDatabase()->getRecordCount($rs); - if ($overwrite == 'false') { - $newname = $name . '-' . str_replace('.', '_', $evo_version); - $rs = evo()->getDatabase()->query("SELECT * FROM `" . $table_prefix . "site_htmlsnippets` WHERE name='$newname'"); - $count_new_name = evo()->getDatabase()->getRecordCount($rs); - } - $update = $count_original_name > 0 && $overwrite == 'true'; - if ($update) { - if (!@evo()->getDatabase()->query("UPDATE `" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category='$category_id' WHERE name='$name';")) { - $errors += 1; - echo "

              " . mysql_error() . "

              "; - return; - } - echo "

                $name: " . $_lang['upgraded'] . "

              "; - } elseif ($count_new_name == 0) { - if ($count_original_name > 0 && $overwrite == 'false') { - $name = $newname; - } - if (!@evo()->getDatabase()->query("INSERT INTO `" . $table_prefix . "site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk','$category_id');")) { - $errors += 1; - echo "

              " . mysql_error() . "

              "; - return; - } - echo "

                $name: " . $_lang['installed'] . "

              "; - } - } - } - } -} - -// Install Modules -if (isset($_POST['module']) || $installData) { - echo "

              " . $_lang['modules'] . ":

              "; - $selModules = $_POST['module']; - foreach ($moduleModules as $k => $moduleModule) { - $installSample = in_array('sample', $moduleModule[7]) && $installData == 1; - if ($installSample || in_array($k, $selModules)) { - $name = evo()->getDatabase()->escape($moduleModule[0]); - $desc = evo()->getDatabase()->escape($moduleModule[1]); - $filecontent = $moduleModule[2]; - $properties = $moduleModule[3]; - $guid = evo()->getDatabase()->escape($moduleModule[4]); - $shared = evo()->getDatabase()->escape($moduleModule[5]); - $category = evo()->getDatabase()->escape($moduleModule[6]); - $icon = evo()->getDatabase()->escape($moduleModule[8]); - if (!file_exists($filecontent)) { - echo "

                $name: " . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".

              "; - } else { - // Create the category if it does not already exist - $category = getCreateDbCategory($category, $sqlParser); - $tmp = preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2); - $module = end($tmp); - // remove installer docblock - $module = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $module, 1); - $module = evo()->getDatabase()->escape($module); - $rs = evo()->getDatabase()->query("SELECT * FROM `" . $table_prefix . "site_modules` WHERE name='$name'"); - if (evo()->getDatabase()->getRecordCount($rs)) { - $row = evo()->getDatabase()->getRow($rs,'assoc'); - $props = evo()->getDatabase()->escape(propUpdate($properties,$row['properties'])); - if (!@evo()->getDatabase()->query("UPDATE `" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared', icon='$icon' WHERE name='$name';")) { - echo "

              " . mysql_error() . "

              "; - return; - } - echo "

                $name: " . $_lang['upgraded'] . "

              "; - } else { - $properties = evo()->getDatabase()->escape(parseProperties($properties, true)); - if (!@evo()->getDatabase()->query("INSERT INTO `" . $table_prefix . "site_modules` (name, description, modulecode, properties, guid, enable_sharedparams, category, icon) VALUES('$name', '$desc', '$module', '$properties', '$guid', '$shared', '$category', '$icon');")) { - echo "

              " . mysql_error() . "

              "; - return; - } - echo "

                $name: " . $_lang['installed'] . "

              "; - } - } - } - } -} - -// Install Plugins -if (isset ($_POST['plugin']) || $installData) { - echo "

              " . $_lang['plugins'] . ":

              "; - $selPlugs = $_POST['plugin']; - foreach ($modulePlugins as $k=>$modulePlugin) { - $installSample = in_array('sample', $modulePlugin[8]) && $installData == 1; - if($installSample || in_array($k, $selPlugs)) { - $name = evo()->getDatabase()->escape($modulePlugin[0]); - $desc = evo()->getDatabase()->escape($modulePlugin[1]); - $filecontent = $modulePlugin[2]; - $properties = $modulePlugin[3]; - $events = explode(",", $modulePlugin[4]); - $guid = evo()->getDatabase()->escape($modulePlugin[5]); - $category = evo()->getDatabase()->escape($modulePlugin[6]); - $leg_names = ''; - $disabled = $modulePlugin[9]; - if (array_key_exists(7, $modulePlugin)) { - // parse comma-separated legacy names and prepare them for sql IN clause - $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', evo()->getDatabase()->escape($modulePlugin[7]))) . "'"; - } - if (!file_exists($filecontent)) { - echo "

                $name: " . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".

              "; - } else { - // disable legacy versions based on legacy_names provided - if (!empty($leg_names)) { - $update_query = "UPDATE `" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);"; - $rs = evo()->getDatabase()->query($update_query); - } - - // Create the category if it does not already exist - $category = getCreateDbCategory($category, $sqlParser); - $tmp = preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2); - $plugin = end($tmp); - // remove installer docblock - $plugin = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $plugin, 1); - $plugin = evo()->getDatabase()->escape($plugin); - $rs = evo()->getDatabase()->query("SELECT * FROM `" . $table_prefix . "site_plugins` WHERE name='$name' ORDER BY id"); - $prev_id = null; - if (evo()->getDatabase()->getRecordCount($rs)) { - $insert = true; - while($row = evo()->getDatabase()->getRow($rs,'assoc')) { - $props = evo()->getDatabase()->escape(propUpdate($properties,$row['properties'])); - if ($row['description'] == $desc) { - if (!@evo()->getDatabase()->query("UPDATE `" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id='{$row['id']}';")) { - echo "

              " . mysql_error() . "

              "; - return; - } - $insert = false; - } else { - if (!@evo()->getDatabase()->query("UPDATE `" . $table_prefix . "site_plugins` SET disabled='1' WHERE id='{$row['id']}';")) { - echo "

              ".mysql_error()."

              "; - return; - } - } - $prev_id = $row['id']; - } - if ($insert === true) { - if(!@evo()->getDatabase()->query("INSERT INTO `".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$props','$guid','0','$category');" )) { - echo "

              ".mysql_error()."

              "; - return; - } - } - echo "

                $name: " . $_lang['upgraded'] . "

              "; - } else { - $properties = evo()->getDatabase()->escape(parseProperties($properties, true)); - if (!@evo()->getDatabase()->query("INSERT INTO `" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','$disabled','$category');")) { - echo "

              " . mysql_error() . "

              "; - return; - } - echo "

                $name: " . $_lang['installed'] . "

              "; - } - // add system events - if (count($events) > 0) { - $ds = evo()->getDatabase()->query("SELECT id FROM `".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc' ORDER BY id DESC LIMIT 1;" ); - if ($ds) { - $row = evo()->getDatabase()->getRow($ds,'assoc'); - $id = $row["id"]; - $_events = implode("','", $events); - - // add new events - if ($prev_id) { - $prev_id = EvolutionCms()->getDatabase()->escape($prev_id); - - evo()->getDatabase()->query("INSERT OR IGNORE INTO `{$table_prefix}site_plugin_events` (`pluginid`, `evtid`, `priority`) - SELECT {$id} as 'pluginid', `se`.`id` AS `evtid`, COALESCE(`spe`.`priority`, MAX(`spe2`.`priority`) + 1, 0) AS `priority` - FROM `{$table_prefix}system_eventnames` `se` - LEFT JOIN `{$table_prefix}site_plugin_events` `spe` ON `spe`.`evtid` = `se`.`id` AND `spe`.`pluginid` = {$prev_id} - LEFT JOIN `{$table_prefix}site_plugin_events` `spe2` ON `spe2`.`evtid` = `se`.`id` - WHERE name IN ('{$_events}') - GROUP BY `se`.`id` - "); - } else { - evo()->getDatabase()->query("INSERT OR IGNORE INTO `{$table_prefix}site_plugin_events` (`pluginid`, `evtid`, `priority`) - SELECT {$id} as `pluginid`, `se`.`id` as `evtid`, COALESCE(MAX(`spe`.`priority`) + 1, 0) as `priority` - FROM `{$table_prefix}system_eventnames` `se` - LEFT JOIN `{$table_prefix}site_plugin_events` `spe` ON `spe`.`evtid` = `se`.`id` - WHERE `name` IN ('{$_events}') GROUP BY `se`.`id` - "); - } - - // remove existing events - evo()->getDatabase()->query("DELETE `pe` FROM `{$table_prefix}site_plugin_events` `pe` LEFT JOIN `{$table_prefix}system_eventnames` `se` ON `pe`.`evtid`=`se`.`id` AND `name` IN ('{$_events}') WHERE `name` IS NULL AND `pluginid` = {$id}"); - } - } - } - } - } -} - -// Install Snippets -if (isset ($_POST['snippet']) || $installData) { - echo "

              " . $_lang['snippets'] . ":

              "; - $selSnips = $_POST['snippet']; - foreach ($moduleSnippets as $k => $moduleSnippet) { - if (!is_array($moduleSnippet) || !isset($moduleSnippet[5]) || !is_array($moduleSnippet[5])) continue; - $installSample = in_array('sample', $moduleSnippet[5]) && $installData == 1; - if($installSample || in_array($k, $selSnips)) { - $name = evo()->getDatabase()->escape($moduleSnippet[0]); - $desc = evo()->getDatabase()->escape($moduleSnippet[1]); - $filecontent = $moduleSnippet[2]; - $properties = $moduleSnippet[3]; - $category = evo()->getDatabase()->escape($moduleSnippet[4]); - if (!file_exists($filecontent)) { - echo "

                $name: " . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".

              "; - } else { - // Create the category if it does not already exist - $category = getCreateDbCategory($category, $sqlParser); - $tmp = preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2); - $snippet = end($tmp); - // remove installer docblock - $snippet = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $snippet, 1); - $snippet = evo()->getDatabase()->escape($snippet); - $rs = evo()->getDatabase()->query("SELECT * FROM `" . $table_prefix . "site_snippets` WHERE name='$name'"); - - if (evo()->getDatabase()->getRecordCount($rs)) { - $row = evo()->getDatabase()->getRow($rs,'assoc'); - $props = evo()->getDatabase()->escape(propUpdate($properties,$row['properties'])); - if (!evo()->getDatabase()->query("UPDATE `" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { - echo "

              " . mysql_error() . "

              "; - return; - } - echo "

                $name: " . $_lang['upgraded'] . "

              "; - } else { - $properties = evo()->getDatabase()->escape(parseProperties($properties, true)); - if (!evo()->getDatabase()->query("INSERT INTO `" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties','$category');")) { - echo "

              " . mysql_error() . "

              "; - return; - } - echo "

                $name: " . $_lang['installed'] . "

              "; - } - } - } - } -} - -// install data -if ($installData && $moduleSQLDataFile) { - echo "

              " . $_lang['installing_demo_site']; - $sqlParser->process($installPath.'/'.$moduleSQLDataFile); - // display database results - if ($sqlParser->installFailed == true) { - $errors += 1; - echo "" . $_lang['database_alerts'] . "

              "; - echo "

              " . $_lang['setup_couldnt_install'] . "

              "; - echo "

              " . $_lang['installation_error_occured'] . "

              "; - for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { - echo "" . $sqlParser->mysqlErrors[$i]["error"] . "" . $_lang['during_execution_of_sql'] . "" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . ".


              "; - } - echo "

              "; - echo "

              " . $_lang['some_tables_not_updated'] . "

              "; - return; - } else { - echo "".$_lang['ok']."

              "; - } -} - -// always empty cache after install -evo()->clearCache('full'); - -// setup completed! -echo "

              " . $_lang['installation_successful'] . "

              "; - -// Property Update function -function propUpdate($new,$old) { - $newArr = parseProperties($new); - $oldArr = parseProperties($old); - foreach ($oldArr as $k => $v) { - if (isset($v['0']['options'])){ - $oldArr[$k]['0']['options'] = $newArr[$k]['0']['options']; - } - } - $return = $oldArr + $newArr; - $return = json_encode($return, JSON_UNESCAPED_UNICODE); - $return = ($return != '[]') ? $return : ''; - return $return; -} - -function parseProperties($propertyString, $json=false) { - $propertyString = str_replace('{}', '', $propertyString ); - $propertyString = str_replace('} {', ',', $propertyString ); - - if (empty($propertyString) || $propertyString == '{}' || $propertyString == '[]') { - $propertyString = ''; - } - - $jsonFormat = isJson($propertyString, true); - $property = array(); - // old format - if ($jsonFormat === false) { - $props= explode('&', $propertyString); - $arr = array(); - $key = array(); - foreach ($props as $prop) { - if ($prop != '') { - $arr = explode(';', $prop); - $key = explode('=', $arr['0']); - $property[$key['0']]['0']['label'] = trim($key['1']); - $property[$key['0']]['0']['type'] = trim($arr['1']); - switch ($arr['1']) { - case 'list': - case 'list-multi': - case 'checkbox': - case 'radio': - case 'menu': - $property[$key['0']]['0']['value'] = trim($arr['3']); - $property[$key['0']]['0']['options'] = trim($arr['2']); - $property[$key['0']]['0']['default'] = trim($arr['3']); - break; - default: - $property[$key['0']]['0']['value'] = trim($arr['2']); - $property[$key['0']]['0']['default'] = trim($arr['2']); - } - $property[$key['0']]['0']['desc'] = ''; - } - } - // new json-format - } else if(!empty($jsonFormat)) { - $property = $jsonFormat; - } - if ($json) { - $property = json_encode($property, JSON_UNESCAPED_UNICODE); - } - $property = ($property != '[]') ? $property : ''; - return $property; -} - -function isJson($string, $returnData = false) { - $data = json_decode($string, true); - return (json_last_error() == JSON_ERROR_NONE) ? ($returnData ? $data : true) : false; -} - -function getCreateDbCategory($category, $sqlParser) { - $table_prefix = evo()->getDatabase()->getConfig('prefix'); - $category_id = 0; - if (!empty($category)) { - $category = evo()->getDatabase()->escape($category); - $rs = evo()->getDatabase()->query("SELECT id FROM `".$table_prefix."categories` WHERE category = '".$category."'"); - if(evo()->getDatabase()->getRecordCount($rs) && ($row = evo()->getDatabase()->getRow($rs,'assoc'))) { - $category_id = $row['id']; - } else { - $q = "INSERT INTO `".$table_prefix."categories` (`category`) VALUES ('{$category}');"; - $rs = evo()->getDatabase()->query($q); - if($rs) { - $category_id = evo()->getDatabase()->getInsertId($sqlParser->conn); - } - } - } - return $category_id; -} +hasPermission('exec_module')) { + die('INCLUDE_ORDERING_ERROR

              Please use the EVO Content Manager instead of accessing this file directly.'); +} + +$_POST['installmode'] = 1; +//$_POST['installdata'] = 0; +$sqlParser = ''; +$create = false; + +// set timout limit +@set_time_limit(120); // used @ to prevent warning when using safe mode? + +$installMode= (int)$_POST['installmode']; +$installData = $_POST['installdata'] == "1" ? 1 : 0; + +// set session name variable +if (!isset ($site_sessionname)) { + $site_sessionname = 'SN' . uniqid(''); +} + +// get base path and url +$a = explode("install", str_replace("\\", "/", dirname($_SERVER["PHP_SELF"]))); +if (count($a) > 1) { + array_pop($a); +} +$url = implode("install", $a); +reset($a); +$a = explode("install", str_replace("\\", "/", realpath(__DIR__))); +if (count($a) > 1) { + array_pop($a); +} +$pth = implode("install", $a); +unset ($a); +$base_url = $url . (substr($url, -1) != "/" ? "/" : ""); +$base_path = $pth . (substr($pth, -1) != "/" ? "/" : ""); + +if (!function_exists('propertiesNameValue')) { + // parses a resource property string and returns the result as an array + // duplicate of method in documentParser class + function propertiesNameValue($propertyString) { + $parameter= array (); + if (!empty ($propertyString)) { + $tmpParams= explode("&", $propertyString); + for ($x= 0; $x < count($tmpParams); $x++) { + if (strpos($tmpParams[$x], '=', 0)) { + $pTmp= explode("=", $tmpParams[$x]); + $pvTmp= explode(";", trim($pTmp[1])); + if ($pvTmp[1] == 'list' && $pvTmp[3] != "") { + $parameter[trim($pTmp[0])] = $pvTmp[3]; //list default + } else { + if ($pvTmp[1] != 'list' && $pvTmp[2] != "") { + $parameter[trim($pTmp[0])] = $pvTmp[2]; + } + } + } + } + } + return $parameter; + } +} +$table_prefix = evo()->getDatabase()->getConfig('prefix'); +$setupPath = $modulePath; +include "{$setupPath}/setup.info.php"; +include "{$setupPath}/sqlParser.class.php"; +$sqlParser = new SqlParser(); + +// Install Templates +if (isset ($_POST['template']) || $installData) { + echo "

              " . $_lang['templates'] . ":

              "; + $selTemplates = $_POST['template']; + foreach ($moduleTemplates as $k => $moduleTemplate) { + $installSample = in_array('sample', $moduleTemplate[6]) && $installData == 1; + if($installSample || in_array($k, $selTemplates)) { + $name = EvolutionCms()->getDatabase()->escape($moduleTemplate[0]); + $desc = EvolutionCms()->getDatabase()->escape($moduleTemplate[1]); + $category = EvolutionCms()->getDatabase()->escape($moduleTemplate[4]); + $locked = EvolutionCms()->getDatabase()->escape($moduleTemplate[5]); + $filecontent = $moduleTemplate[3]; + if (!file_exists($filecontent)) { + echo "

                $name: " . $_lang['unable_install_template'] . " '$filecontent' " . $_lang['not_found'] . ".

              "; + } else { + // Create the category if it does not already exist + $category_id = getCreateDbCategory($category, $sqlParser); + + // Strip the first comment up top + $template = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', file_get_contents($filecontent), 1); + $template = EvolutionCms()->getDatabase()->escape($template); + + // See if the template already exists + $rs = evo()->getDatabase()->query("SELECT * FROM `" . $table_prefix . "site_templates` WHERE templatename='$name'"); + + if (evo()->getDatabase()->getRecordCount($rs)) { + if (!@evo()->getDatabase()->query("UPDATE `" . $table_prefix . "site_templates` SET content='$template', description='$desc', category='$category_id', locked='$locked' WHERE templatename='$name';")) { + $errors += 1; + echo "

              " . mysql_error() . "

              "; + return; + } + echo "

                $name: " . $_lang['upgraded'] . "

              "; + } else { + if (!@evo()->getDatabase()->query("INSERT INTO `" . $table_prefix . "site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template','$category_id','$locked');")) { + $errors += 1; + echo "

              " . mysql_error() . "

              "; + return; + } + echo "

                $name: " . $_lang['installed'] . "

              "; + } + } + } + } +} + +// Install Template Variables +if (isset ($_POST['tv']) || $installData) { + echo "

              " . $_lang['tvs'] . ":

              "; + $selTVs = $_POST['tv']; + foreach ($moduleTVs as $k=>$moduleTV) { + $installSample = in_array('sample', $moduleTV[12]) && $installData == 1; + if($installSample || in_array($k, $selTVs)) { + $name = evo()->getDatabase()->escape($moduleTV[0]); + $caption = evo()->getDatabase()->escape($moduleTV[1]); + $desc = evo()->getDatabase()->escape($moduleTV[2]); + $input_type = evo()->getDatabase()->escape($moduleTV[3]); + $input_options = evo()->getDatabase()->escape($moduleTV[4]); + $input_default = evo()->getDatabase()->escape($moduleTV[5]); + $output_widget = evo()->getDatabase()->escape($moduleTV[6]); + $output_widget_params = evo()->getDatabase()->escape($moduleTV[7]); + $filecontent = $moduleTV[8]; + $assignments = $moduleTV[9]; + $category = evo()->getDatabase()->escape($moduleTV[10]); + $locked = evo()->getDatabase()->escape($moduleTV[11]); + + // Create the category if it does not already exist + $category = getCreateDbCategory($category, $sqlParser); + + $rs = evo()->getDatabase()->query("SELECT * FROM `" . $table_prefix . "site_tmplvars` WHERE name='$name'"); + if (evo()->getDatabase()->getRecordCount($rs)) { + $insert = true; + while($row = evo()->getDatabase()->getRow($rs,'assoc')) { + if (!@evo()->getDatabase()->query("UPDATE `" . $table_prefix . "site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category='$category', locked='$locked', elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id='{$row['id']}';")) { + echo "

              " . mysql_error() . "

              "; + return; + } + $insert = false; + } + echo "

                $name: " . $_lang['upgraded'] . "

              "; + } else { + //$q = "INSERT INTO `" . $table_prefix . "site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',(SELECT (CASE COUNT(*) WHEN 0 THEN 0 ELSE `id` END) `id` FROM `" . $table_prefix . "categories` WHERE `category` = '$category'),$locked,'$input_options','$output_widget','$output_widget_params','$input_default');"; + $q = "INSERT INTO `" . $table_prefix . "site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc','$category','$locked','$input_options','$output_widget','$output_widget_params','$input_default');"; + if (!@evo()->getDatabase()->query($q)) { + echo "

              " . mysql_error() . "

              "; + return; + } + echo "

                $name: " . $_lang['installed'] . "

              "; + } + + // add template assignments + if (trim($assignments) != ''){ + $assignments = explode(',', $assignments); + + if (count($assignments) > 0) { + + // remove existing tv -> template assignments + $ds = evo()->getDatabase()->query("SELECT id FROM `".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';" ); + $row = evo()->getDatabase()->getRow($ds,'assoc'); + $id = $row["id"]; + evo()->getDatabase()->query("DELETE FROM $dbase.`" . $table_prefix . "site_tmplvar_templates` WHERE tmplvarid = '$id';"); + + // add tv -> template assignments + foreach ($assignments as $assignment) { + $template = evo()->getDatabase()->escape($assignment); + $where = "WHERE templatename='$template'"; + if ($template=='*') $where =''; + $ts = evo()->getDatabase()->query("SELECT id FROM `".$table_prefix."site_templates` $where;" ); + if ($ds && $ts) { + $tRow = evo()->getDatabase()->getRow($ts,'assoc'); + $templateId = $tRow['id']; + evo()->getDatabase()->query("INSERT INTO `" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES('$id', '$templateId');"); + } + } + } + } + } + } +} + +// Install Chunks +if (isset ($_POST['chunk']) || $installData) { + echo "

              " . $_lang['chunks'] . ":

              "; + $selChunks = $_POST['chunk']; + foreach ($moduleChunks as $k => $moduleChunk) { + $installSample = in_array('sample', $moduleChunk[5]) && $installData == 1; + if ($installSample || in_array($k, $selChunks)) { + $name = evo()->getDatabase()->escape($moduleChunk[0]); + $desc = evo()->getDatabase()->escape($moduleChunk[1]); + $category = evo()->getDatabase()->escape($moduleChunk[3]); + $overwrite = evo()->getDatabase()->escape($moduleChunk[4]); + $filecontent = $moduleChunk[2]; + + if (!file_exists($filecontent)) { + echo "

                $name: " . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".

              "; + } else { + // Create the category if it does not already exist + $category_id = getCreateDbCategory($category, $sqlParser); + + $chunk = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', file_get_contents($filecontent), 1); + $chunk = evo()->getDatabase()->escape($chunk); + $rs = evo()->getDatabase()->query("SELECT * FROM `" . $table_prefix . "site_htmlsnippets` WHERE name='$name'"); + $count_original_name = evo()->getDatabase()->getRecordCount($rs); + if ($overwrite == 'false') { + $newname = $name . '-' . str_replace('.', '_', $evo_version); + $rs = evo()->getDatabase()->query("SELECT * FROM `" . $table_prefix . "site_htmlsnippets` WHERE name='$newname'"); + $count_new_name = evo()->getDatabase()->getRecordCount($rs); + } + $update = $count_original_name > 0 && $overwrite == 'true'; + if ($update) { + if (!@evo()->getDatabase()->query("UPDATE `" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category='$category_id' WHERE name='$name';")) { + $errors += 1; + echo "

              " . mysql_error() . "

              "; + return; + } + echo "

                $name: " . $_lang['upgraded'] . "

              "; + } elseif ($count_new_name == 0) { + if ($count_original_name > 0 && $overwrite == 'false') { + $name = $newname; + } + if (!@evo()->getDatabase()->query("INSERT INTO `" . $table_prefix . "site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk','$category_id');")) { + $errors += 1; + echo "

              " . mysql_error() . "

              "; + return; + } + echo "

                $name: " . $_lang['installed'] . "

              "; + } + } + } + } +} + +// Install Modules +if (isset($_POST['module']) || $installData) { + echo "

              " . $_lang['modules'] . ":

              "; + $selModules = $_POST['module']; + foreach ($moduleModules as $k => $moduleModule) { + $installSample = in_array('sample', $moduleModule[7]) && $installData == 1; + if ($installSample || in_array($k, $selModules)) { + $name = evo()->getDatabase()->escape($moduleModule[0]); + $desc = evo()->getDatabase()->escape($moduleModule[1]); + $filecontent = $moduleModule[2]; + $properties = $moduleModule[3]; + $guid = evo()->getDatabase()->escape($moduleModule[4]); + $shared = evo()->getDatabase()->escape($moduleModule[5]); + $category = evo()->getDatabase()->escape($moduleModule[6]); + $icon = evo()->getDatabase()->escape($moduleModule[8]); + if (!file_exists($filecontent)) { + echo "

                $name: " . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".

              "; + } else { + // Create the category if it does not already exist + $category = getCreateDbCategory($category, $sqlParser); + $tmp = preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2); + $module = end($tmp); + // remove installer docblock + $module = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $module, 1); + $module = evo()->getDatabase()->escape($module); + $rs = evo()->getDatabase()->query("SELECT * FROM `" . $table_prefix . "site_modules` WHERE name='$name'"); + if (evo()->getDatabase()->getRecordCount($rs)) { + $row = evo()->getDatabase()->getRow($rs,'assoc'); + $props = evo()->getDatabase()->escape(propUpdate($properties,$row['properties'])); + if (!@evo()->getDatabase()->query("UPDATE `" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared', icon='$icon' WHERE name='$name';")) { + echo "

              " . mysql_error() . "

              "; + return; + } + echo "

                $name: " . $_lang['upgraded'] . "

              "; + } else { + $properties = evo()->getDatabase()->escape(parseProperties($properties, true)); + if (!@evo()->getDatabase()->query("INSERT INTO `" . $table_prefix . "site_modules` (name, description, modulecode, properties, guid, enable_sharedparams, category, icon) VALUES('$name', '$desc', '$module', '$properties', '$guid', '$shared', '$category', '$icon');")) { + echo "

              " . mysql_error() . "

              "; + return; + } + echo "

                $name: " . $_lang['installed'] . "

              "; + } + } + } + } +} + +// Install Plugins +if (isset ($_POST['plugin']) || $installData) { + echo "

              " . $_lang['plugins'] . ":

              "; + $selPlugs = $_POST['plugin']; + foreach ($modulePlugins as $k=>$modulePlugin) { + $installSample = in_array('sample', $modulePlugin[8]) && $installData == 1; + if($installSample || in_array($k, $selPlugs)) { + $name = evo()->getDatabase()->escape($modulePlugin[0]); + $desc = evo()->getDatabase()->escape($modulePlugin[1]); + $filecontent = $modulePlugin[2]; + $properties = $modulePlugin[3]; + $events = explode(",", $modulePlugin[4]); + $guid = evo()->getDatabase()->escape($modulePlugin[5]); + $category = evo()->getDatabase()->escape($modulePlugin[6]); + $leg_names = ''; + $disabled = $modulePlugin[9]; + if (array_key_exists(7, $modulePlugin)) { + // parse comma-separated legacy names and prepare them for sql IN clause + $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', evo()->getDatabase()->escape($modulePlugin[7]))) . "'"; + } + if (!file_exists($filecontent)) { + echo "

                $name: " . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".

              "; + } else { + // disable legacy versions based on legacy_names provided + if (!empty($leg_names)) { + $update_query = "UPDATE `" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);"; + $rs = evo()->getDatabase()->query($update_query); + } + + // Create the category if it does not already exist + $category = getCreateDbCategory($category, $sqlParser); + $tmp = preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2); + $plugin = end($tmp); + // remove installer docblock + $plugin = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $plugin, 1); + $plugin = evo()->getDatabase()->escape($plugin); + $rs = evo()->getDatabase()->query("SELECT * FROM `" . $table_prefix . "site_plugins` WHERE name='$name' ORDER BY id"); + $prev_id = null; + if (evo()->getDatabase()->getRecordCount($rs)) { + $insert = true; + while($row = evo()->getDatabase()->getRow($rs,'assoc')) { + $props = evo()->getDatabase()->escape(propUpdate($properties,$row['properties'])); + if ($row['description'] == $desc) { + if (!@evo()->getDatabase()->query("UPDATE `" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id='{$row['id']}';")) { + echo "

              " . mysql_error() . "

              "; + return; + } + $insert = false; + } else { + if (!@evo()->getDatabase()->query("UPDATE `" . $table_prefix . "site_plugins` SET disabled='1' WHERE id='{$row['id']}';")) { + echo "

              ".mysql_error()."

              "; + return; + } + } + $prev_id = $row['id']; + } + if ($insert === true) { + if(!@evo()->getDatabase()->query("INSERT INTO `".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$props','$guid','0','$category');" )) { + echo "

              ".mysql_error()."

              "; + return; + } + } + echo "

                $name: " . $_lang['upgraded'] . "

              "; + } else { + $properties = evo()->getDatabase()->escape(parseProperties($properties, true)); + if (!@evo()->getDatabase()->query("INSERT INTO `" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','$disabled','$category');")) { + echo "

              " . mysql_error() . "

              "; + return; + } + echo "

                $name: " . $_lang['installed'] . "

              "; + } + // add system events + if (count($events) > 0) { + $ds = evo()->getDatabase()->query("SELECT id FROM `".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc' ORDER BY id DESC LIMIT 1;" ); + if ($ds) { + $row = evo()->getDatabase()->getRow($ds,'assoc'); + $id = $row["id"]; + $_events = implode("','", $events); + + // add new events + if ($prev_id) { + $prev_id = EvolutionCms()->getDatabase()->escape($prev_id); + + evo()->getDatabase()->query("INSERT OR IGNORE INTO `{$table_prefix}site_plugin_events` (`pluginid`, `evtid`, `priority`) + SELECT {$id} as 'pluginid', `se`.`id` AS `evtid`, COALESCE(`spe`.`priority`, MAX(`spe2`.`priority`) + 1, 0) AS `priority` + FROM `{$table_prefix}system_eventnames` `se` + LEFT JOIN `{$table_prefix}site_plugin_events` `spe` ON `spe`.`evtid` = `se`.`id` AND `spe`.`pluginid` = {$prev_id} + LEFT JOIN `{$table_prefix}site_plugin_events` `spe2` ON `spe2`.`evtid` = `se`.`id` + WHERE name IN ('{$_events}') + GROUP BY `se`.`id` + "); + } else { + evo()->getDatabase()->query("INSERT OR IGNORE INTO `{$table_prefix}site_plugin_events` (`pluginid`, `evtid`, `priority`) + SELECT {$id} as `pluginid`, `se`.`id` as `evtid`, COALESCE(MAX(`spe`.`priority`) + 1, 0) as `priority` + FROM `{$table_prefix}system_eventnames` `se` + LEFT JOIN `{$table_prefix}site_plugin_events` `spe` ON `spe`.`evtid` = `se`.`id` + WHERE `name` IN ('{$_events}') GROUP BY `se`.`id` + "); + } + + // remove existing events + evo()->getDatabase()->query("DELETE `pe` FROM `{$table_prefix}site_plugin_events` `pe` LEFT JOIN `{$table_prefix}system_eventnames` `se` ON `pe`.`evtid`=`se`.`id` AND `name` IN ('{$_events}') WHERE `name` IS NULL AND `pluginid` = {$id}"); + } + } + } + } + } +} + +// Install Snippets +if (isset ($_POST['snippet']) || $installData) { + echo "

              " . $_lang['snippets'] . ":

              "; + $selSnips = $_POST['snippet']; + foreach ($moduleSnippets as $k => $moduleSnippet) { + if (!is_array($moduleSnippet) || !isset($moduleSnippet[5]) || !is_array($moduleSnippet[5])) continue; + $installSample = in_array('sample', $moduleSnippet[5]) && $installData == 1; + if($installSample || in_array($k, $selSnips)) { + $name = evo()->getDatabase()->escape($moduleSnippet[0]); + $desc = evo()->getDatabase()->escape($moduleSnippet[1]); + $filecontent = $moduleSnippet[2]; + $properties = $moduleSnippet[3]; + $category = evo()->getDatabase()->escape($moduleSnippet[4]); + if (!file_exists($filecontent)) { + echo "

                $name: " . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".

              "; + } else { + // Create the category if it does not already exist + $category = getCreateDbCategory($category, $sqlParser); + $tmp = preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2); + $snippet = end($tmp); + // remove installer docblock + $snippet = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $snippet, 1); + $snippet = evo()->getDatabase()->escape($snippet); + $rs = evo()->getDatabase()->query("SELECT * FROM `" . $table_prefix . "site_snippets` WHERE name='$name'"); + + if (evo()->getDatabase()->getRecordCount($rs)) { + $row = evo()->getDatabase()->getRow($rs,'assoc'); + $props = evo()->getDatabase()->escape(propUpdate($properties,$row['properties'])); + if (!evo()->getDatabase()->query("UPDATE `" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { + echo "

              " . mysql_error() . "

              "; + return; + } + echo "

                $name: " . $_lang['upgraded'] . "

              "; + } else { + $properties = evo()->getDatabase()->escape(parseProperties($properties, true)); + if (!evo()->getDatabase()->query("INSERT INTO `" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties','$category');")) { + echo "

              " . mysql_error() . "

              "; + return; + } + echo "

                $name: " . $_lang['installed'] . "

              "; + } + } + } + } +} + +// install data +if ($installData && $moduleSQLDataFile) { + echo "

              " . $_lang['installing_demo_site']; + $sqlParser->process($installPath.'/'.$moduleSQLDataFile); + // display database results + if ($sqlParser->installFailed == true) { + $errors += 1; + echo "" . $_lang['database_alerts'] . "

              "; + echo "

              " . $_lang['setup_couldnt_install'] . "

              "; + echo "

              " . $_lang['installation_error_occured'] . "

              "; + for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { + echo "" . $sqlParser->mysqlErrors[$i]["error"] . "" . $_lang['during_execution_of_sql'] . "" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . ".


              "; + } + echo "

              "; + echo "

              " . $_lang['some_tables_not_updated'] . "

              "; + return; + } else { + echo "".$_lang['ok']."

              "; + } +} + +// always empty cache after install +evo()->clearCache('full'); + +// setup completed! +echo "

              " . $_lang['installation_successful'] . "

              "; + +// Property Update function +function propUpdate($new,$old) { + $newArr = parseProperties($new); + $oldArr = parseProperties($old); + foreach ($oldArr as $k => $v) { + if (isset($v['0']['options'])){ + $oldArr[$k]['0']['options'] = $newArr[$k]['0']['options']; + } + } + $return = $oldArr + $newArr; + $return = json_encode($return, JSON_UNESCAPED_UNICODE); + $return = ($return != '[]') ? $return : ''; + return $return; +} + +function parseProperties($propertyString, $json=false) { + $propertyString = str_replace('{}', '', $propertyString ); + $propertyString = str_replace('} {', ',', $propertyString ); + + if (empty($propertyString) || $propertyString == '{}' || $propertyString == '[]') { + $propertyString = ''; + } + + $jsonFormat = isJson($propertyString, true); + $property = array(); + // old format + if ($jsonFormat === false) { + $props= explode('&', $propertyString); + $arr = array(); + $key = array(); + foreach ($props as $prop) { + if ($prop != '') { + $arr = explode(';', $prop); + $key = explode('=', $arr['0']); + $property[$key['0']]['0']['label'] = trim($key['1']); + $property[$key['0']]['0']['type'] = trim($arr['1']); + switch ($arr['1']) { + case 'list': + case 'list-multi': + case 'checkbox': + case 'radio': + case 'menu': + $property[$key['0']]['0']['value'] = trim($arr['3']); + $property[$key['0']]['0']['options'] = trim($arr['2']); + $property[$key['0']]['0']['default'] = trim($arr['3']); + break; + default: + $property[$key['0']]['0']['value'] = trim($arr['2']); + $property[$key['0']]['0']['default'] = trim($arr['2']); + } + $property[$key['0']]['0']['desc'] = ''; + } + } + // new json-format + } else if(!empty($jsonFormat)) { + $property = $jsonFormat; + } + if ($json) { + $property = json_encode($property, JSON_UNESCAPED_UNICODE); + } + $property = ($property != '[]') ? $property : ''; + return $property; +} + +function isJson($string, $returnData = false) { + $data = json_decode($string, true); + return (json_last_error() == JSON_ERROR_NONE) ? ($returnData ? $data : true) : false; +} + +function getCreateDbCategory($category, $sqlParser) { + $table_prefix = evo()->getDatabase()->getConfig('prefix'); + $category_id = 0; + if (!empty($category)) { + $category = evo()->getDatabase()->escape($category); + $rs = evo()->getDatabase()->query("SELECT id FROM `".$table_prefix."categories` WHERE category = '".$category."'"); + if(evo()->getDatabase()->getRecordCount($rs) && ($row = evo()->getDatabase()->getRow($rs,'assoc'))) { + $category_id = $row['id']; + } else { + $q = "INSERT INTO `".$table_prefix."categories` (`category`) VALUES ('{$category}');"; + $rs = evo()->getDatabase()->query($q); + if($rs) { + $category_id = evo()->getDatabase()->getInsertId($sqlParser->conn); + } + } + } + return $category_id; +} diff --git a/assets/modules/store/installer/jquery-1.4.4.min.js b/assets/modules/store/installer/jquery-1.4.4.min.js index c2dcfe7bfa..8f3ca2e2da 100755 --- a/assets/modules/store/installer/jquery-1.4.4.min.js +++ b/assets/modules/store/installer/jquery-1.4.4.min.js @@ -1,167 +1,167 @@ -/*! - * jQuery JavaScript Library v1.4.4 - * http://jquery.com/ - * - * Copyright 2010, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2010, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Thu Nov 11 19:04:53 2010 -0500 - */ -(function(E,B){function ka(a,b,d){if(d===B&&a.nodeType===1){d=a.getAttribute("data-"+b);if(typeof d==="string"){try{d=d==="true"?true:d==="false"?false:d==="null"?null:!c.isNaN(d)?parseFloat(d):Ja.test(d)?c.parseJSON(d):d}catch(e){}c.data(a,b,d)}else d=B}return d}function U(){return false}function ca(){return true}function la(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function Ka(a){var b,d,e,f,h,l,k,o,x,r,A,C=[];f=[];h=c.data(this,this.nodeType?"events":"__events__");if(typeof h==="function")h= -h.events;if(!(a.liveFired===this||!h||!h.live||a.button&&a.type==="click")){if(a.namespace)A=RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var J=h.live.slice(0);for(k=0;kd)break;a.currentTarget=f.elem;a.data=f.handleObj.data;a.handleObj=f.handleObj;A=f.handleObj.origHandler.apply(f.elem,arguments);if(A===false||a.isPropagationStopped()){d=f.level;if(A===false)b=false;if(a.isImmediatePropagationStopped())break}}return b}}function Y(a,b){return(a&&a!=="*"?a+".":"")+b.replace(La, -"`").replace(Ma,"&")}function ma(a,b,d){if(c.isFunction(b))return c.grep(a,function(f,h){return!!b.call(f,h,f)===d});else if(b.nodeType)return c.grep(a,function(f){return f===b===d});else if(typeof b==="string"){var e=c.grep(a,function(f){return f.nodeType===1});if(Na.test(b))return c.filter(b,e,!d);else b=c.filter(b,e)}return c.grep(a,function(f){return c.inArray(f,b)>=0===d})}function na(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),f=c.data(this, -e);if(e=e&&e.events){delete f.handle;f.events={};for(var h in e)for(var l in e[h])c.event.add(this,h,e[h][l],e[h][l].data)}}})}function Oa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function oa(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?Pa:Qa,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a, -"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function da(a,b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(f,h){d||Ra.test(a)?e(a,h):da(a+"["+(typeof h==="object"||c.isArray(h)?f:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)?e(a,""):c.each(b,function(f,h){da(a+"["+f+"]",h,d,e)});else e(a,b)}function S(a,b){var d={};c.each(pa.concat.apply([],pa.slice(0,b)),function(){d[this]=a});return d}function qa(a){if(!ea[a]){var b=c("<"+ -a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";ea[a]=d}return ea[a]}function fa(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var t=E.document,c=function(){function a(){if(!b.isReady){try{t.documentElement.doScroll("left")}catch(j){setTimeout(a,1);return}b.ready()}}var b=function(j,s){return new b.fn.init(j,s)},d=E.jQuery,e=E.$,f,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,l=/\S/,k=/^\s+/,o=/\s+$/,x=/\W/,r=/\d/,A=/^<(\w+)\s*\/?>(?:<\/\1>)?$/, -C=/^[\],:{}\s]*$/,J=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,w=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,I=/(?:^|:|,)(?:\s*\[)+/g,L=/(webkit)[ \/]([\w.]+)/,g=/(opera)(?:.*version)?[ \/]([\w.]+)/,i=/(msie) ([\w.]+)/,n=/(mozilla)(?:.*? rv:([\w.]+))?/,m=navigator.userAgent,p=false,q=[],u,y=Object.prototype.toString,F=Object.prototype.hasOwnProperty,M=Array.prototype.push,N=Array.prototype.slice,O=String.prototype.trim,D=Array.prototype.indexOf,R={};b.fn=b.prototype={init:function(j, -s){var v,z,H;if(!j)return this;if(j.nodeType){this.context=this[0]=j;this.length=1;return this}if(j==="body"&&!s&&t.body){this.context=t;this[0]=t.body;this.selector="body";this.length=1;return this}if(typeof j==="string")if((v=h.exec(j))&&(v[1]||!s))if(v[1]){H=s?s.ownerDocument||s:t;if(z=A.exec(j))if(b.isPlainObject(s)){j=[t.createElement(z[1])];b.fn.attr.call(j,s,true)}else j=[H.createElement(z[1])];else{z=b.buildFragment([v[1]],[H]);j=(z.cacheable?z.fragment.cloneNode(true):z.fragment).childNodes}return b.merge(this, -j)}else{if((z=t.getElementById(v[2]))&&z.parentNode){if(z.id!==v[2])return f.find(j);this.length=1;this[0]=z}this.context=t;this.selector=j;return this}else if(!s&&!x.test(j)){this.selector=j;this.context=t;j=t.getElementsByTagName(j);return b.merge(this,j)}else return!s||s.jquery?(s||f).find(j):b(s).find(j);else if(b.isFunction(j))return f.ready(j);if(j.selector!==B){this.selector=j.selector;this.context=j.context}return b.makeArray(j,this)},selector:"",jquery:"1.4.4",length:0,size:function(){return this.length}, -toArray:function(){return N.call(this,0)},get:function(j){return j==null?this.toArray():j<0?this.slice(j)[0]:this[j]},pushStack:function(j,s,v){var z=b();b.isArray(j)?M.apply(z,j):b.merge(z,j);z.prevObject=this;z.context=this.context;if(s==="find")z.selector=this.selector+(this.selector?" ":"")+v;else if(s)z.selector=this.selector+"."+s+"("+v+")";return z},each:function(j,s){return b.each(this,j,s)},ready:function(j){b.bindReady();if(b.isReady)j.call(t,b);else q&&q.push(j);return this},eq:function(j){return j=== --1?this.slice(j):this.slice(j,+j+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(N.apply(this,arguments),"slice",N.call(arguments).join(","))},map:function(j){return this.pushStack(b.map(this,function(s,v){return j.call(s,v,s)}))},end:function(){return this.prevObject||b(null)},push:M,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var j,s,v,z,H,G=arguments[0]||{},K=1,Q=arguments.length,ga=false; -if(typeof G==="boolean"){ga=G;G=arguments[1]||{};K=2}if(typeof G!=="object"&&!b.isFunction(G))G={};if(Q===K){G=this;--K}for(;K0))if(q){var s=0,v=q;for(q=null;j=v[s++];)j.call(t,b);b.fn.trigger&&b(t).trigger("ready").unbind("ready")}}},bindReady:function(){if(!p){p=true;if(t.readyState==="complete")return setTimeout(b.ready,1);if(t.addEventListener){t.addEventListener("DOMContentLoaded",u,false);E.addEventListener("load",b.ready,false)}else if(t.attachEvent){t.attachEvent("onreadystatechange",u);E.attachEvent("onload", -b.ready);var j=false;try{j=E.frameElement==null}catch(s){}t.documentElement.doScroll&&j&&a()}}},isFunction:function(j){return b.type(j)==="function"},isArray:Array.isArray||function(j){return b.type(j)==="array"},isWindow:function(j){return j&&typeof j==="object"&&"setInterval"in j},isNaN:function(j){return j==null||!r.test(j)||isNaN(j)},type:function(j){return j==null?String(j):R[y.call(j)]||"object"},isPlainObject:function(j){if(!j||b.type(j)!=="object"||j.nodeType||b.isWindow(j))return false;if(j.constructor&& -!F.call(j,"constructor")&&!F.call(j.constructor.prototype,"isPrototypeOf"))return false;for(var s in j);return s===B||F.call(j,s)},isEmptyObject:function(j){for(var s in j)return false;return true},error:function(j){throw j;},parseJSON:function(j){if(typeof j!=="string"||!j)return null;j=b.trim(j);if(C.test(j.replace(J,"@").replace(w,"]").replace(I,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(j):(new Function("return "+j))();else b.error("Invalid JSON: "+j)},noop:function(){},globalEval:function(j){if(j&& -l.test(j)){var s=t.getElementsByTagName("head")[0]||t.documentElement,v=t.createElement("script");v.type="text/javascript";if(b.support.scriptEval)v.appendChild(t.createTextNode(j));else v.text=j;s.insertBefore(v,s.firstChild);s.removeChild(v)}},nodeName:function(j,s){return j.nodeName&&j.nodeName.toUpperCase()===s.toUpperCase()},each:function(j,s,v){var z,H=0,G=j.length,K=G===B||b.isFunction(j);if(v)if(K)for(z in j){if(s.apply(j[z],v)===false)break}else for(;H
              a";var f=d.getElementsByTagName("*"),h=d.getElementsByTagName("a")[0],l=t.createElement("select"), -k=l.appendChild(t.createElement("option"));if(!(!f||!f.length||!h)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(h.getAttribute("style")),hrefNormalized:h.getAttribute("href")==="/a",opacity:/^0.55$/.test(h.style.opacity),cssFloat:!!h.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:k.selected,deleteExpando:true,optDisabled:false,checkClone:false, -scriptEval:false,noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};l.disabled=true;c.support.optDisabled=!k.disabled;b.type="text/javascript";try{b.appendChild(t.createTextNode("window."+e+"=1;"))}catch(o){}a.insertBefore(b,a.firstChild);if(E[e]){c.support.scriptEval=true;delete E[e]}try{delete b.test}catch(x){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function r(){c.support.noCloneEvent= -false;d.detachEvent("onclick",r)});d.cloneNode(true).fireEvent("onclick")}d=t.createElement("div");d.innerHTML="";a=t.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var r=t.createElement("div");r.style.width=r.style.paddingLeft="1px";t.body.appendChild(r);c.boxModel=c.support.boxModel=r.offsetWidth===2;if("zoom"in r.style){r.style.display="inline";r.style.zoom= -1;c.support.inlineBlockNeedsLayout=r.offsetWidth===2;r.style.display="";r.innerHTML="
              ";c.support.shrinkWrapBlocks=r.offsetWidth!==2}r.innerHTML="
              t
              ";var A=r.getElementsByTagName("td");c.support.reliableHiddenOffsets=A[0].offsetHeight===0;A[0].style.display="";A[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&A[0].offsetHeight===0;r.innerHTML="";t.body.removeChild(r).style.display= -"none"});a=function(r){var A=t.createElement("div");r="on"+r;var C=r in A;if(!C){A.setAttribute(r,"return;");C=typeof A[r]==="function"}return C};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=f=h=null}})();var ra={},Ja=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==E?ra:a;var e=a.nodeType,f=e?a[c.expando]:null,h= -c.cache;if(!(e&&!f&&typeof b==="string"&&d===B)){if(e)f||(a[c.expando]=f=++c.uuid);else h=a;if(typeof b==="object")if(e)h[f]=c.extend(h[f],b);else c.extend(h,b);else if(e&&!h[f])h[f]={};a=e?h[f]:h;if(d!==B)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==E?ra:a;var d=a.nodeType,e=d?a[c.expando]:a,f=c.cache,h=d?f[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando); -else if(d)delete f[e];else for(var l in a)delete a[l]}},acceptData:function(a){if(a.nodeName){var b=c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){var d=null;if(typeof a==="undefined"){if(this.length){var e=this[0].attributes,f;d=c.data(this[0]);for(var h=0,l=e.length;h-1)return true;return false},val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value:b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var f=b.options;b=b.type==="select-one"; -if(e<0)return null;var h=b?e:0;for(e=b?e+1:f.length;h=0;else if(c.nodeName(this,"select")){var A=c.makeArray(r);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),A)>=0});if(!A.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true}, -attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return B;if(e&&b in c.attrFn)return c(a)[b](d);e=a.nodeType!==1||!c.isXMLDoc(a);var f=d!==B;b=e&&c.props[b]||b;var h=Ta.test(b);if((b in a||a[b]!==B)&&e&&!h){if(f){b==="type"&&Ua.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");if(d===null)a.nodeType===1&&a.removeAttribute(b);else a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&& -b.specified?b.value:Va.test(a.nodeName)||Wa.test(a.nodeName)&&a.href?0:B;return a[b]}if(!c.support.style&&e&&b==="style"){if(f)a.style.cssText=""+d;return a.style.cssText}f&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return B;a=!c.support.hrefNormalized&&e&&h?a.getAttribute(b,2):a.getAttribute(b);return a===null?B:a}});var X=/\.(.*)$/,ia=/^(?:textarea|input|select)$/i,La=/\./g,Ma=/ /g,Xa=/[^\w\s.|`]/g,Ya=function(a){return a.replace(Xa,"\\$&")},ua={focusin:0,focusout:0}; -c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==E&&!a.frameElement)a=E;if(d===false)d=U;else if(!d)return;var f,h;if(d.handler){f=d;d=f.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var l=a.nodeType?"events":"__events__",k=h[l],o=h.handle;if(typeof k==="function"){o=k.handle;k=k.events}else if(!k){a.nodeType||(h[l]=h=function(){});h.events=k={}}if(!o)h.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem, -arguments):B};o.elem=a;b=b.split(" ");for(var x=0,r;l=b[x++];){h=f?c.extend({},f):{handler:d,data:e};if(l.indexOf(".")>-1){r=l.split(".");l=r.shift();h.namespace=r.slice(0).sort().join(".")}else{r=[];h.namespace=""}h.type=l;if(!h.guid)h.guid=d.guid;var A=k[l],C=c.event.special[l]||{};if(!A){A=k[l]=[];if(!C.setup||C.setup.call(a,e,r,o)===false)if(a.addEventListener)a.addEventListener(l,o,false);else a.attachEvent&&a.attachEvent("on"+l,o)}if(C.add){C.add.call(a,h);if(!h.handler.guid)h.handler.guid= -d.guid}A.push(h);c.event.global[l]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(d===false)d=U;var f,h,l=0,k,o,x,r,A,C,J=a.nodeType?"events":"__events__",w=c.data(a),I=w&&w[J];if(w&&I){if(typeof I==="function"){w=I;I=I.events}if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(f in I)c.event.remove(a,f+b)}else{for(b=b.split(" ");f=b[l++];){r=f;k=f.indexOf(".")<0;o=[];if(!k){o=f.split(".");f=o.shift();x=RegExp("(^|\\.)"+ -c.map(o.slice(0).sort(),Ya).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(A=I[f])if(d){r=c.event.special[f]||{};for(h=e||0;h=0){a.type=f=f.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[f]&&c.each(c.cache,function(){this.events&&this.events[f]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType=== -8)return B;a.result=B;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+f]&&d["on"+f].apply(d,b)===false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&&e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){var l;e=a.target;var k=f.replace(X,""),o=c.nodeName(e,"a")&&k=== -"click",x=c.event.special[k]||{};if((!x._default||x._default.call(d,a)===false)&&!o&&!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()])){try{if(e[k]){if(l=e["on"+k])e["on"+k]=null;c.event.triggered=true;e[k]()}}catch(r){}if(l)e["on"+k]=l;c.event.triggered=false}}},handle:function(a){var b,d,e,f;d=[];var h=c.makeArray(arguments);a=h[0]=c.event.fix(a||E.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type=e.shift();d=e.slice(0).sort();e=RegExp("(^|\\.)"+ -d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");f=c.data(this,this.nodeType?"events":"__events__");if(typeof f==="function")f=f.events;d=(f||{})[a.type];if(f&&d){d=d.slice(0);f=0;for(var l=d.length;f-1?c.map(a.options,function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},Z=function(a,b){var d=a.target,e,f;if(!(!ia.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");f=xa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",f);if(!(e===B||f===e))if(e!=null||f){a.type="change";a.liveFired= -B;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:Z,beforedeactivate:Z,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return Z.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return Z.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",xa(a))}},setup:function(){if(this.type=== -"file")return false;for(var a in V)c.event.add(this,a+".specialChange",V[a]);return ia.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return ia.test(this.nodeName)}};V=c.event.special.change.filters;V.focus=V.beforeactivate}t.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){ua[b]++===0&&t.addEventListener(a,d,true)},teardown:function(){--ua[b]=== -0&&t.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,f){if(typeof d==="object"){for(var h in d)this[b](h,e,d[h],f);return this}if(c.isFunction(e)||e===false){f=e;e=B}var l=b==="one"?c.proxy(f,function(o){c(this).unbind(o,l);return f.apply(this,arguments)}):f;if(d==="unload"&&b!=="one")this.one(d,e,f);else{h=0;for(var k=this.length;h0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});E.attachEvent&&!E.addEventListener&&c(E).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}}); -(function(){function a(g,i,n,m,p,q){p=0;for(var u=m.length;p0){F=y;break}}y=y[g]}m[p]=F}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,h=false,l=true;[0,0].sort(function(){l=false;return 0});var k=function(g,i,n,m){n=n||[];var p=i=i||t;if(i.nodeType!==1&&i.nodeType!==9)return[];if(!g||typeof g!=="string")return n;var q,u,y,F,M,N=true,O=k.isXML(i),D=[],R=g;do{d.exec("");if(q=d.exec(R)){R=q[3];D.push(q[1]);if(q[2]){F=q[3]; -break}}}while(q);if(D.length>1&&x.exec(g))if(D.length===2&&o.relative[D[0]])u=L(D[0]+D[1],i);else for(u=o.relative[D[0]]?[i]:k(D.shift(),i);D.length;){g=D.shift();if(o.relative[g])g+=D.shift();u=L(g,u)}else{if(!m&&D.length>1&&i.nodeType===9&&!O&&o.match.ID.test(D[0])&&!o.match.ID.test(D[D.length-1])){q=k.find(D.shift(),i,O);i=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]}if(i){q=m?{expr:D.pop(),set:C(m)}:k.find(D.pop(),D.length===1&&(D[0]==="~"||D[0]==="+")&&i.parentNode?i.parentNode:i,O);u=q.expr?k.filter(q.expr, -q.set):q.set;if(D.length>0)y=C(u);else N=false;for(;D.length;){q=M=D.pop();if(o.relative[M])q=D.pop();else M="";if(q==null)q=i;o.relative[M](y,q,O)}}else y=[]}y||(y=u);y||k.error(M||g);if(f.call(y)==="[object Array]")if(N)if(i&&i.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&k.contains(i,y[g])))n.push(u[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&n.push(u[g]);else n.push.apply(n,y);else C(y,n);if(F){k(F,p,n,m);k.uniqueSort(n)}return n};k.uniqueSort=function(g){if(w){h= -l;g.sort(w);if(h)for(var i=1;i0};k.find=function(g,i,n){var m;if(!g)return[];for(var p=0,q=o.order.length;p":function(g,i){var n,m=typeof i==="string",p=0,q=g.length;if(m&&!/\W/.test(i))for(i=i.toLowerCase();p=0))n||m.push(u);else if(n)i[q]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var i=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=i[1]+(i[2]||1)-0;g[3]=i[3]-0}g[0]=e++;return g},ATTR:function(g,i,n, -m,p,q){i=g[1].replace(/\\/g,"");if(!q&&o.attrMap[i])g[1]=o.attrMap[i];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,i,n,m,p){if(g[1]==="not")if((d.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,i);else{g=k.filter(g[3],i,n,true^p);n||m.push.apply(m,g);return false}else if(o.match.POS.test(g[0])||o.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled=== -true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,i,n){return!!k(n[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"=== -g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,i){return i===0},last:function(g,i,n,m){return i===m.length-1},even:function(g,i){return i%2===0},odd:function(g,i){return i%2===1},lt:function(g,i,n){return in[3]-0},nth:function(g,i,n){return n[3]- -0===i},eq:function(g,i,n){return n[3]-0===i}},filter:{PSEUDO:function(g,i,n,m){var p=i[1],q=o.filters[p];if(q)return q(g,n,i,m);else if(p==="contains")return(g.textContent||g.innerText||k.getText([g])||"").indexOf(i[3])>=0;else if(p==="not"){i=i[3];n=0;for(m=i.length;n=0}},ID:function(g,i){return g.nodeType===1&&g.getAttribute("id")===i},TAG:function(g,i){return i==="*"&&g.nodeType===1||g.nodeName.toLowerCase()=== -i},CLASS:function(g,i){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(i)>-1},ATTR:function(g,i){var n=i[1];n=o.attrHandle[n]?o.attrHandle[n](g):g[n]!=null?g[n]:g.getAttribute(n);var m=n+"",p=i[2],q=i[4];return n==null?p==="!=":p==="="?m===q:p==="*="?m.indexOf(q)>=0:p==="~="?(" "+m+" ").indexOf(q)>=0:!q?m&&n!==false:p==="!="?m!==q:p==="^="?m.indexOf(q)===0:p==="$="?m.substr(m.length-q.length)===q:p==="|="?m===q||m.substr(0,q.length+1)===q+"-":false},POS:function(g,i,n,m){var p=o.setFilters[i[2]]; -if(p)return p(g,n,i,m)}}},x=o.match.POS,r=function(g,i){return"\\"+(i-0+1)},A;for(A in o.match){o.match[A]=RegExp(o.match[A].source+/(?![^\[]*\])(?![^\(]*\))/.source);o.leftMatch[A]=RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[A].source.replace(/\\(\d+)/g,r))}var C=function(g,i){g=Array.prototype.slice.call(g,0);if(i){i.push.apply(i,g);return i}return g};try{Array.prototype.slice.call(t.documentElement.childNodes,0)}catch(J){C=function(g,i){var n=0,m=i||[];if(f.call(g)==="[object Array]")Array.prototype.push.apply(m, -g);else if(typeof g.length==="number")for(var p=g.length;n";n.insertBefore(g,n.firstChild);if(t.getElementById(i)){o.find.ID=function(m,p,q){if(typeof p.getElementById!=="undefined"&&!q)return(p=p.getElementById(m[1]))?p.id===m[1]||typeof p.getAttributeNode!=="undefined"&&p.getAttributeNode("id").nodeValue===m[1]?[p]:B:[]};o.filter.ID=function(m,p){var q=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&q&&q.nodeValue===p}}n.removeChild(g); -n=g=null})();(function(){var g=t.createElement("div");g.appendChild(t.createComment(""));if(g.getElementsByTagName("*").length>0)o.find.TAG=function(i,n){var m=n.getElementsByTagName(i[1]);if(i[1]==="*"){for(var p=[],q=0;m[q];q++)m[q].nodeType===1&&p.push(m[q]);m=p}return m};g.innerHTML="";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")o.attrHandle.href=function(i){return i.getAttribute("href",2)};g=null})();t.querySelectorAll&& -function(){var g=k,i=t.createElement("div");i.innerHTML="

              ";if(!(i.querySelectorAll&&i.querySelectorAll(".TEST").length===0)){k=function(m,p,q,u){p=p||t;m=m.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!u&&!k.isXML(p))if(p.nodeType===9)try{return C(p.querySelectorAll(m),q)}catch(y){}else if(p.nodeType===1&&p.nodeName.toLowerCase()!=="object"){var F=p.getAttribute("id"),M=F||"__sizzle__";F||p.setAttribute("id",M);try{return C(p.querySelectorAll("#"+M+" "+m),q)}catch(N){}finally{F|| -p.removeAttribute("id")}}return g(m,p,q,u)};for(var n in g)k[n]=g[n];i=null}}();(function(){var g=t.documentElement,i=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.msMatchesSelector,n=false;try{i.call(t.documentElement,"[test!='']:sizzle")}catch(m){n=true}if(i)k.matchesSelector=function(p,q){q=q.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(p))try{if(n||!o.match.PSEUDO.test(q)&&!/!=/.test(q))return i.call(p,q)}catch(u){}return k(q,null,null,[p]).length>0}})();(function(){var g= -t.createElement("div");g.innerHTML="
              ";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){o.order.splice(1,0,"CLASS");o.find.CLASS=function(i,n,m){if(typeof n.getElementsByClassName!=="undefined"&&!m)return n.getElementsByClassName(i[1])};g=null}}})();k.contains=t.documentElement.contains?function(g,i){return g!==i&&(g.contains?g.contains(i):true)}:t.documentElement.compareDocumentPosition? -function(g,i){return!!(g.compareDocumentPosition(i)&16)}:function(){return false};k.isXML=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false};var L=function(g,i){for(var n,m=[],p="",q=i.nodeType?[i]:i;n=o.match.PSEUDO.exec(g);){p+=n[0];g=g.replace(o.match.PSEUDO,"")}g=o.relative[g]?g+"*":g;n=0;for(var u=q.length;n0)for(var h=d;h0},closest:function(a,b){var d=[],e,f,h=this[0];if(c.isArray(a)){var l,k={},o=1;if(h&&a.length){e=0;for(f=a.length;e-1:c(h).is(e))d.push({selector:l,elem:h,level:o})}h= -h.parentNode;o++}}return d}l=cb.test(a)?c(a,b||this.context):null;e=0;for(f=this.length;e-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h||!h.ownerDocument||h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",a)},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var d=typeof a==="string"?c(a,b||this.context): -c.makeArray(a),e=c.merge(this.get(),d);return this.pushStack(!d[0]||!d[0].parentNode||d[0].parentNode.nodeType===11||!e[0]||!e[0].parentNode||e[0].parentNode.nodeType===11?e:c.unique(e))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a, -2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a, -b){c.fn[a]=function(d,e){var f=c.map(this,b,d);Za.test(a)||(e=d);if(e&&typeof e==="string")f=c.filter(e,f);f=this.length>1?c.unique(f):f;if((this.length>1||ab.test(e))&&$a.test(a))f=f.reverse();return this.pushStack(f,a,bb.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length===1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&a.nodeType!==9&&(d===B||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&& -e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var za=/ jQuery\d+="(?:\d+|null)"/g,$=/^\s+/,Aa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Ba=/<([\w:]+)/,db=/\s]+\/)>/g,P={option:[1, -""],legend:[1,"
              ","
              "],thead:[1,"","
              "],tr:[2,"","
              "],td:[3,"","
              "],col:[2,"","
              "],area:[1,"",""],_default:[0,"",""]};P.optgroup=P.option;P.tbody=P.tfoot=P.colgroup=P.caption=P.thead;P.th=P.td;if(!c.support.htmlSerialize)P._default=[1,"div
              ","
              "];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= -c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==B)return this.empty().append((this[0]&&this[0].ownerDocument||t).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, -wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, -prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, -this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,e;(e=this[d])!=null;d++)if(!a||c.filter(a,[e]).length){if(!b&&e.nodeType===1){c.cleanData(e.getElementsByTagName("*"));c.cleanData([e])}e.parentNode&&e.parentNode.removeChild(e)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); -return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,e=this.ownerDocument;if(!d){d=e.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(za,"").replace(fb,'="$1">').replace($,"")],e)[0]}else return this.cloneNode(true)});if(a===true){na(this,b);na(this.find("*"),b.find("*"))}return b},html:function(a){if(a===B)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(za,""):null; -else if(typeof a==="string"&&!Ca.test(a)&&(c.support.leadingWhitespace||!$.test(a))&&!P[(Ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Aa,"<$1>");try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?h.cloneNode(true):h)}k.length&&c.each(k,Oa)}return this}});c.buildFragment=function(a,b,d){var e,f,h;b=b&&b[0]?b[0].ownerDocument||b[0]:t;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===t&&!Ca.test(a[0])&&(c.support.checkClone||!Da.test(a[0]))){f=true;if(h=c.fragments[a[0]])if(h!==1)e=h}if(!e){e=b.createDocumentFragment();c.clean(a,b,e,d)}if(f)c.fragments[a[0]]=h?e:1;return{fragment:e,cacheable:f}};c.fragments={};c.each({appendTo:"append", -prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var e=[];d=c(d);var f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{f=0;for(var h=d.length;f0?this.clone(true):this).get();c(d[f])[b](l);e=e.concat(l)}return this.pushStack(e,a,d.selector)}}});c.extend({clean:function(a,b,d,e){b=b||t;if(typeof b.createElement==="undefined")b=b.ownerDocument|| -b[0]&&b[0].ownerDocument||t;for(var f=[],h=0,l;(l=a[h])!=null;h++){if(typeof l==="number")l+="";if(l){if(typeof l==="string"&&!eb.test(l))l=b.createTextNode(l);else if(typeof l==="string"){l=l.replace(Aa,"<$1>");var k=(Ba.exec(l)||["",""])[1].toLowerCase(),o=P[k]||P._default,x=o[0],r=b.createElement("div");for(r.innerHTML=o[1]+l+o[2];x--;)r=r.lastChild;if(!c.support.tbody){x=db.test(l);k=k==="table"&&!x?r.firstChild&&r.firstChild.childNodes:o[1]===""&&!x?r.childNodes:[];for(o=k.length- -1;o>=0;--o)c.nodeName(k[o],"tbody")&&!k[o].childNodes.length&&k[o].parentNode.removeChild(k[o])}!c.support.leadingWhitespace&&$.test(l)&&r.insertBefore(b.createTextNode($.exec(l)[0]),r.firstChild);l=r.childNodes}if(l.nodeType)f.push(l);else f=c.merge(f,l)}}if(d)for(h=0;f[h];h++)if(e&&c.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))e.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{f[h].nodeType===1&&f.splice.apply(f,[h+1,0].concat(c.makeArray(f[h].getElementsByTagName("script")))); -d.appendChild(f[h])}return f},cleanData:function(a){for(var b,d,e=c.cache,f=c.event.special,h=c.support.deleteExpando,l=0,k;(k=a[l])!=null;l++)if(!(k.nodeName&&c.noData[k.nodeName.toLowerCase()]))if(d=k[c.expando]){if((b=e[d])&&b.events)for(var o in b.events)f[o]?c.event.remove(k,o):c.removeEvent(k,o,b.handle);if(h)delete k[c.expando];else k.removeAttribute&&k.removeAttribute(c.expando);delete e[d]}}});var Ea=/alpha\([^)]*\)/i,gb=/opacity=([^)]*)/,hb=/-([a-z])/ig,ib=/([A-Z])/g,Fa=/^-?\d+(?:px)?$/i, -jb=/^-?\d/,kb={position:"absolute",visibility:"hidden",display:"block"},Pa=["Left","Right"],Qa=["Top","Bottom"],W,Ga,aa,lb=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){if(arguments.length===2&&b===B)return this;return c.access(this,a,b,true,function(d,e,f){return f!==B?c.style(d,e,f):c.css(d,e)})};c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var d=W(a,"opacity","opacity");return d===""?"1":d}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true, -zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var f,h=c.camelCase(b),l=a.style,k=c.cssHooks[h];b=c.cssProps[h]||h;if(d!==B){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!k||!("set"in k)||(d=k.set(a,d))!==B)try{l[b]=d}catch(o){}}}else{if(k&&"get"in k&&(f=k.get(a,false,e))!==B)return f;return l[b]}}},css:function(a,b,d){var e,f=c.camelCase(b), -h=c.cssHooks[f];b=c.cssProps[f]||f;if(h&&"get"in h&&(e=h.get(a,true,d))!==B)return e;else if(W)return W(a,b,f)},swap:function(a,b,d){var e={},f;for(f in b){e[f]=a.style[f];a.style[f]=b[f]}d.call(a);for(f in b)a.style[f]=e[f]},camelCase:function(a){return a.replace(hb,lb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(d,e,f){var h;if(e){if(d.offsetWidth!==0)h=oa(d,b,f);else c.swap(d,kb,function(){h=oa(d,b,f)});if(h<=0){h=W(d,b,b);if(h==="0px"&&aa)h=aa(d,b,b); -if(h!=null)return h===""||h==="auto"?"0px":h}if(h<0||h==null){h=d.style[b];return h===""||h==="auto"?"0px":h}return typeof h==="string"?h:h+"px"}},set:function(d,e){if(Fa.test(e)){e=parseFloat(e);if(e>=0)return e+"px"}else return e}}});if(!c.support.opacity)c.cssHooks.opacity={get:function(a,b){return gb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var d=a.style;d.zoom=1;var e=c.isNaN(b)?"":"alpha(opacity="+b*100+")",f= -d.filter||"";d.filter=Ea.test(f)?f.replace(Ea,e):d.filter+" "+e}};if(t.defaultView&&t.defaultView.getComputedStyle)Ga=function(a,b,d){var e;d=d.replace(ib,"-$1").toLowerCase();if(!(b=a.ownerDocument.defaultView))return B;if(b=b.getComputedStyle(a,null)){e=b.getPropertyValue(d);if(e===""&&!c.contains(a.ownerDocument.documentElement,a))e=c.style(a,d)}return e};if(t.documentElement.currentStyle)aa=function(a,b){var d,e,f=a.currentStyle&&a.currentStyle[b],h=a.style;if(!Fa.test(f)&&jb.test(f)){d=h.left; -e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=b==="fontSize"?"1em":f||0;f=h.pixelLeft+"px";h.left=d;a.runtimeStyle.left=e}return f===""?"auto":f};W=Ga||aa;if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var mb=c.now(),nb=/)<[^<]*)*<\/script>/gi, -ob=/^(?:select|textarea)/i,pb=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,qb=/^(?:GET|HEAD)$/,Ra=/\[\]$/,T=/\=\?(&|$)/,ja=/\?/,rb=/([?&])_=[^&]*/,sb=/^(\w+:)?\/\/([^\/?#]+)/,tb=/%20/g,ub=/#.*$/,Ha=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!=="string"&&Ha)return Ha.apply(this,arguments);else if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}e="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b=== -"object"){b=c.param(b,c.ajaxSettings.traditional);e="POST"}var h=this;c.ajax({url:a,type:e,dataType:"html",data:b,complete:function(l,k){if(k==="success"||k==="notmodified")h.html(f?c("
              ").append(l.responseText.replace(nb,"")).find(f):l.responseText);d&&h.each(d,[l.responseText,k,l])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&& -!this.disabled&&(this.checked||ob.test(this.nodeName)||pb.test(this.type))}).map(function(a,b){var d=c(this).val();return d==null?null:c.isArray(d)?c.map(d,function(e){return{name:b.name,value:e}}):{name:b.name,value:d}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:e})}, -getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:e})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return new E.XMLHttpRequest},accepts:{xml:"application/xml, text/xml",html:"text/html", -script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},ajax:function(a){var b=c.extend(true,{},c.ajaxSettings,a),d,e,f,h=b.type.toUpperCase(),l=qb.test(h);b.url=b.url.replace(ub,"");b.context=a&&a.context!=null?a.context:b;if(b.data&&b.processData&&typeof b.data!=="string")b.data=c.param(b.data,b.traditional);if(b.dataType==="jsonp"){if(h==="GET")T.test(b.url)||(b.url+=(ja.test(b.url)?"&":"?")+(b.jsonp||"callback")+"=?");else if(!b.data|| -!T.test(b.data))b.data=(b.data?b.data+"&":"")+(b.jsonp||"callback")+"=?";b.dataType="json"}if(b.dataType==="json"&&(b.data&&T.test(b.data)||T.test(b.url))){d=b.jsonpCallback||"jsonp"+mb++;if(b.data)b.data=(b.data+"").replace(T,"="+d+"$1");b.url=b.url.replace(T,"="+d+"$1");b.dataType="script";var k=E[d];E[d]=function(m){if(c.isFunction(k))k(m);else{E[d]=B;try{delete E[d]}catch(p){}}f=m;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);r&&r.removeChild(A)}}if(b.dataType==="script"&&b.cache===null)b.cache= -false;if(b.cache===false&&l){var o=c.now(),x=b.url.replace(rb,"$1_="+o);b.url=x+(x===b.url?(ja.test(b.url)?"&":"?")+"_="+o:"")}if(b.data&&l)b.url+=(ja.test(b.url)?"&":"?")+b.data;b.global&&c.active++===0&&c.event.trigger("ajaxStart");o=(o=sb.exec(b.url))&&(o[1]&&o[1].toLowerCase()!==location.protocol||o[2].toLowerCase()!==location.host);if(b.dataType==="script"&&h==="GET"&&o){var r=t.getElementsByTagName("head")[0]||t.documentElement,A=t.createElement("script");if(b.scriptCharset)A.charset=b.scriptCharset; -A.src=b.url;if(!d){var C=false;A.onload=A.onreadystatechange=function(){if(!C&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){C=true;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);A.onload=A.onreadystatechange=null;r&&A.parentNode&&r.removeChild(A)}}}r.insertBefore(A,r.firstChild);return B}var J=false,w=b.xhr();if(w){b.username?w.open(h,b.url,b.async,b.username,b.password):w.open(h,b.url,b.async);try{if(b.data!=null&&!l||a&&a.contentType)w.setRequestHeader("Content-Type", -b.contentType);if(b.ifModified){c.lastModified[b.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[b.url]);c.etag[b.url]&&w.setRequestHeader("If-None-Match",c.etag[b.url])}o||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?b.accepts[b.dataType]+", */*; q=0.01":b.accepts._default)}catch(I){}if(b.beforeSend&&b.beforeSend.call(b.context,w,b)===false){b.global&&c.active--===1&&c.event.trigger("ajaxStop");w.abort();return false}b.global&& -c.triggerGlobal(b,"ajaxSend",[w,b]);var L=w.onreadystatechange=function(m){if(!w||w.readyState===0||m==="abort"){J||c.handleComplete(b,w,e,f);J=true;if(w)w.onreadystatechange=c.noop}else if(!J&&w&&(w.readyState===4||m==="timeout")){J=true;w.onreadystatechange=c.noop;e=m==="timeout"?"timeout":!c.httpSuccess(w)?"error":b.ifModified&&c.httpNotModified(w,b.url)?"notmodified":"success";var p;if(e==="success")try{f=c.httpData(w,b.dataType,b)}catch(q){e="parsererror";p=q}if(e==="success"||e==="notmodified")d|| -c.handleSuccess(b,w,e,f);else c.handleError(b,w,e,p);d||c.handleComplete(b,w,e,f);m==="timeout"&&w.abort();if(b.async)w=null}};try{var g=w.abort;w.abort=function(){w&&Function.prototype.call.call(g,w);L("abort")}}catch(i){}b.async&&b.timeout>0&&setTimeout(function(){w&&!J&&L("timeout")},b.timeout);try{w.send(l||b.data==null?null:b.data)}catch(n){c.handleError(b,w,null,n);c.handleComplete(b,w,e,f)}b.async||L();return w}},param:function(a,b){var d=[],e=function(h,l){l=c.isFunction(l)?l():l;d[d.length]= -encodeURIComponent(h)+"="+encodeURIComponent(l)};if(b===B)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){e(this.name,this.value)});else for(var f in a)da(f,a[f],b,e);return d.join("&").replace(tb,"+")}});c.extend({active:0,lastModified:{},etag:{},handleError:function(a,b,d,e){a.error&&a.error.call(a.context,b,d,e);a.global&&c.triggerGlobal(a,"ajaxError",[b,a,e])},handleSuccess:function(a,b,d,e){a.success&&a.success.call(a.context,e,d,b);a.global&&c.triggerGlobal(a,"ajaxSuccess", -[b,a])},handleComplete:function(a,b,d){a.complete&&a.complete.call(a.context,b,d);a.global&&c.triggerGlobal(a,"ajaxComplete",[b,a]);a.global&&c.active--===1&&c.event.trigger("ajaxStop")},triggerGlobal:function(a,b,d){(a.context&&a.context.url==null?c(a.context):c.event).trigger(b,d)},httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"), -e=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(e)c.etag[b]=e;return a.status===304},httpData:function(a,b,d){var e=a.getResponseHeader("content-type")||"",f=b==="xml"||!b&&e.indexOf("xml")>=0;a=f?a.responseXML:a.responseText;f&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&e.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&e.indexOf("javascript")>=0)c.globalEval(a);return a}}); -if(E.ActiveXObject)c.ajaxSettings.xhr=function(){if(E.location.protocol!=="file:")try{return new E.XMLHttpRequest}catch(a){}try{return new E.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}};c.support.ajax=!!c.ajaxSettings.xhr();var ea={},vb=/^(?:toggle|show|hide)$/,wb=/^([+\-]=)?([\d+.\-]+)(.*)$/,ba,pa=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b,d){if(a||a===0)return this.animate(S("show", -3),a,b,d);else{d=0;for(var e=this.length;d=0;e--)if(d[e].elem===this){b&&d[e](true);d.splice(e,1)}});b||this.dequeue();return this}});c.each({slideDown:S("show",1),slideUp:S("hide",1),slideToggle:S("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){c.fn[a]=function(d,e,f){return this.animate(b, -d,e,f)}});c.extend({speed:function(a,b,d){var e=a&&typeof a==="object"?c.extend({},a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};e.duration=c.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default;e.old=e.complete;e.complete=function(){e.queue!==false&&c(this).dequeue();c.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,d,e){return d+e*a},swing:function(a,b,d,e){return(-Math.cos(a* -Math.PI)/2+0.5)*e+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a=parseFloat(c.css(this.elem,this.prop));return a&&a>-1E4?a:0},custom:function(a,b,d){function e(l){return f.step(l)} -var f=this,h=c.fx;this.startTime=c.now();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;e.elem=this.elem;if(e()&&c.timers.push(e)&&!ba)ba=setInterval(h.tick,h.interval)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true; -this.custom(this.cur(),0)},step:function(a){var b=c.now(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var e in this.options.curAnim)if(this.options.curAnim[e]!==true)d=false;if(d){if(this.options.overflow!=null&&!c.support.shrinkWrapBlocks){var f=this.elem,h=this.options;c.each(["","X","Y"],function(k,o){f.style["overflow"+o]=h.overflow[k]})}this.options.hide&&c(this.elem).hide();if(this.options.hide|| -this.options.show)for(var l in this.options.curAnim)c.style(this.elem,l,this.options.orig[l]);this.options.complete.call(this.elem)}return false}else{a=b-this.startTime;this.state=a/this.options.duration;b=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||b](this.state,a,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a= -c.timers,b=0;b-1;e={};var x={};if(o)x=f.position();l=o?x.top:parseInt(l,10)||0;k=o?x.left:parseInt(k,10)||0;if(c.isFunction(b))b=b.call(a,d,h);if(b.top!=null)e.top=b.top-h.top+l;if(b.left!=null)e.left=b.left-h.left+k;"using"in b?b.using.call(a, -e):f.css(e)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),e=Ia.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.css(a,"marginTop"))||0;d.left-=parseFloat(c.css(a,"marginLeft"))||0;e.top+=parseFloat(c.css(b[0],"borderTopWidth"))||0;e.left+=parseFloat(c.css(b[0],"borderLeftWidth"))||0;return{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||t.body;a&&!Ia.test(a.nodeName)&& -c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(e){var f=this[0],h;if(!f)return null;if(e!==B)return this.each(function(){if(h=fa(this))h.scrollTo(!a?e:c(h).scrollLeft(),a?e:c(h).scrollTop());else this[d]=e});else return(h=fa(f))?"pageXOffset"in h?h[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&h.document.documentElement[d]||h.document.body[d]:f[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase(); -c.fn["inner"+b]=function(){return this[0]?parseFloat(c.css(this[0],d,"padding")):null};c.fn["outer"+b]=function(e){return this[0]?parseFloat(c.css(this[0],d,e?"margin":"border")):null};c.fn[d]=function(e){var f=this[0];if(!f)return e==null?null:this;if(c.isFunction(e))return this.each(function(l){var k=c(this);k[d](e.call(this,l,k[d]()))});if(c.isWindow(f))return f.document.compatMode==="CSS1Compat"&&f.document.documentElement["client"+b]||f.document.body["client"+b];else if(f.nodeType===9)return Math.max(f.documentElement["client"+ -b],f.body["scroll"+b],f.documentElement["scroll"+b],f.body["offset"+b],f.documentElement["offset"+b]);else if(e===B){f=c.css(f,d);var h=parseFloat(f);return c.isNaN(h)?f:h}else return this.css(d,typeof e==="string"?e:e+"px")}})})(window); +/*! + * jQuery JavaScript Library v1.4.4 + * http://jquery.com/ + * + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2010, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Thu Nov 11 19:04:53 2010 -0500 + */ +(function(E,B){function ka(a,b,d){if(d===B&&a.nodeType===1){d=a.getAttribute("data-"+b);if(typeof d==="string"){try{d=d==="true"?true:d==="false"?false:d==="null"?null:!c.isNaN(d)?parseFloat(d):Ja.test(d)?c.parseJSON(d):d}catch(e){}c.data(a,b,d)}else d=B}return d}function U(){return false}function ca(){return true}function la(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function Ka(a){var b,d,e,f,h,l,k,o,x,r,A,C=[];f=[];h=c.data(this,this.nodeType?"events":"__events__");if(typeof h==="function")h= +h.events;if(!(a.liveFired===this||!h||!h.live||a.button&&a.type==="click")){if(a.namespace)A=RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var J=h.live.slice(0);for(k=0;kd)break;a.currentTarget=f.elem;a.data=f.handleObj.data;a.handleObj=f.handleObj;A=f.handleObj.origHandler.apply(f.elem,arguments);if(A===false||a.isPropagationStopped()){d=f.level;if(A===false)b=false;if(a.isImmediatePropagationStopped())break}}return b}}function Y(a,b){return(a&&a!=="*"?a+".":"")+b.replace(La, +"`").replace(Ma,"&")}function ma(a,b,d){if(c.isFunction(b))return c.grep(a,function(f,h){return!!b.call(f,h,f)===d});else if(b.nodeType)return c.grep(a,function(f){return f===b===d});else if(typeof b==="string"){var e=c.grep(a,function(f){return f.nodeType===1});if(Na.test(b))return c.filter(b,e,!d);else b=c.filter(b,e)}return c.grep(a,function(f){return c.inArray(f,b)>=0===d})}function na(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),f=c.data(this, +e);if(e=e&&e.events){delete f.handle;f.events={};for(var h in e)for(var l in e[h])c.event.add(this,h,e[h][l],e[h][l].data)}}})}function Oa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function oa(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?Pa:Qa,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a, +"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function da(a,b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(f,h){d||Ra.test(a)?e(a,h):da(a+"["+(typeof h==="object"||c.isArray(h)?f:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)?e(a,""):c.each(b,function(f,h){da(a+"["+f+"]",h,d,e)});else e(a,b)}function S(a,b){var d={};c.each(pa.concat.apply([],pa.slice(0,b)),function(){d[this]=a});return d}function qa(a){if(!ea[a]){var b=c("<"+ +a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";ea[a]=d}return ea[a]}function fa(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var t=E.document,c=function(){function a(){if(!b.isReady){try{t.documentElement.doScroll("left")}catch(j){setTimeout(a,1);return}b.ready()}}var b=function(j,s){return new b.fn.init(j,s)},d=E.jQuery,e=E.$,f,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,l=/\S/,k=/^\s+/,o=/\s+$/,x=/\W/,r=/\d/,A=/^<(\w+)\s*\/?>(?:<\/\1>)?$/, +C=/^[\],:{}\s]*$/,J=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,w=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,I=/(?:^|:|,)(?:\s*\[)+/g,L=/(webkit)[ \/]([\w.]+)/,g=/(opera)(?:.*version)?[ \/]([\w.]+)/,i=/(msie) ([\w.]+)/,n=/(mozilla)(?:.*? rv:([\w.]+))?/,m=navigator.userAgent,p=false,q=[],u,y=Object.prototype.toString,F=Object.prototype.hasOwnProperty,M=Array.prototype.push,N=Array.prototype.slice,O=String.prototype.trim,D=Array.prototype.indexOf,R={};b.fn=b.prototype={init:function(j, +s){var v,z,H;if(!j)return this;if(j.nodeType){this.context=this[0]=j;this.length=1;return this}if(j==="body"&&!s&&t.body){this.context=t;this[0]=t.body;this.selector="body";this.length=1;return this}if(typeof j==="string")if((v=h.exec(j))&&(v[1]||!s))if(v[1]){H=s?s.ownerDocument||s:t;if(z=A.exec(j))if(b.isPlainObject(s)){j=[t.createElement(z[1])];b.fn.attr.call(j,s,true)}else j=[H.createElement(z[1])];else{z=b.buildFragment([v[1]],[H]);j=(z.cacheable?z.fragment.cloneNode(true):z.fragment).childNodes}return b.merge(this, +j)}else{if((z=t.getElementById(v[2]))&&z.parentNode){if(z.id!==v[2])return f.find(j);this.length=1;this[0]=z}this.context=t;this.selector=j;return this}else if(!s&&!x.test(j)){this.selector=j;this.context=t;j=t.getElementsByTagName(j);return b.merge(this,j)}else return!s||s.jquery?(s||f).find(j):b(s).find(j);else if(b.isFunction(j))return f.ready(j);if(j.selector!==B){this.selector=j.selector;this.context=j.context}return b.makeArray(j,this)},selector:"",jquery:"1.4.4",length:0,size:function(){return this.length}, +toArray:function(){return N.call(this,0)},get:function(j){return j==null?this.toArray():j<0?this.slice(j)[0]:this[j]},pushStack:function(j,s,v){var z=b();b.isArray(j)?M.apply(z,j):b.merge(z,j);z.prevObject=this;z.context=this.context;if(s==="find")z.selector=this.selector+(this.selector?" ":"")+v;else if(s)z.selector=this.selector+"."+s+"("+v+")";return z},each:function(j,s){return b.each(this,j,s)},ready:function(j){b.bindReady();if(b.isReady)j.call(t,b);else q&&q.push(j);return this},eq:function(j){return j=== +-1?this.slice(j):this.slice(j,+j+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(N.apply(this,arguments),"slice",N.call(arguments).join(","))},map:function(j){return this.pushStack(b.map(this,function(s,v){return j.call(s,v,s)}))},end:function(){return this.prevObject||b(null)},push:M,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var j,s,v,z,H,G=arguments[0]||{},K=1,Q=arguments.length,ga=false; +if(typeof G==="boolean"){ga=G;G=arguments[1]||{};K=2}if(typeof G!=="object"&&!b.isFunction(G))G={};if(Q===K){G=this;--K}for(;K0))if(q){var s=0,v=q;for(q=null;j=v[s++];)j.call(t,b);b.fn.trigger&&b(t).trigger("ready").unbind("ready")}}},bindReady:function(){if(!p){p=true;if(t.readyState==="complete")return setTimeout(b.ready,1);if(t.addEventListener){t.addEventListener("DOMContentLoaded",u,false);E.addEventListener("load",b.ready,false)}else if(t.attachEvent){t.attachEvent("onreadystatechange",u);E.attachEvent("onload", +b.ready);var j=false;try{j=E.frameElement==null}catch(s){}t.documentElement.doScroll&&j&&a()}}},isFunction:function(j){return b.type(j)==="function"},isArray:Array.isArray||function(j){return b.type(j)==="array"},isWindow:function(j){return j&&typeof j==="object"&&"setInterval"in j},isNaN:function(j){return j==null||!r.test(j)||isNaN(j)},type:function(j){return j==null?String(j):R[y.call(j)]||"object"},isPlainObject:function(j){if(!j||b.type(j)!=="object"||j.nodeType||b.isWindow(j))return false;if(j.constructor&& +!F.call(j,"constructor")&&!F.call(j.constructor.prototype,"isPrototypeOf"))return false;for(var s in j);return s===B||F.call(j,s)},isEmptyObject:function(j){for(var s in j)return false;return true},error:function(j){throw j;},parseJSON:function(j){if(typeof j!=="string"||!j)return null;j=b.trim(j);if(C.test(j.replace(J,"@").replace(w,"]").replace(I,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(j):(new Function("return "+j))();else b.error("Invalid JSON: "+j)},noop:function(){},globalEval:function(j){if(j&& +l.test(j)){var s=t.getElementsByTagName("head")[0]||t.documentElement,v=t.createElement("script");v.type="text/javascript";if(b.support.scriptEval)v.appendChild(t.createTextNode(j));else v.text=j;s.insertBefore(v,s.firstChild);s.removeChild(v)}},nodeName:function(j,s){return j.nodeName&&j.nodeName.toUpperCase()===s.toUpperCase()},each:function(j,s,v){var z,H=0,G=j.length,K=G===B||b.isFunction(j);if(v)if(K)for(z in j){if(s.apply(j[z],v)===false)break}else for(;H
              a";var f=d.getElementsByTagName("*"),h=d.getElementsByTagName("a")[0],l=t.createElement("select"), +k=l.appendChild(t.createElement("option"));if(!(!f||!f.length||!h)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(h.getAttribute("style")),hrefNormalized:h.getAttribute("href")==="/a",opacity:/^0.55$/.test(h.style.opacity),cssFloat:!!h.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:k.selected,deleteExpando:true,optDisabled:false,checkClone:false, +scriptEval:false,noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};l.disabled=true;c.support.optDisabled=!k.disabled;b.type="text/javascript";try{b.appendChild(t.createTextNode("window."+e+"=1;"))}catch(o){}a.insertBefore(b,a.firstChild);if(E[e]){c.support.scriptEval=true;delete E[e]}try{delete b.test}catch(x){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function r(){c.support.noCloneEvent= +false;d.detachEvent("onclick",r)});d.cloneNode(true).fireEvent("onclick")}d=t.createElement("div");d.innerHTML="";a=t.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var r=t.createElement("div");r.style.width=r.style.paddingLeft="1px";t.body.appendChild(r);c.boxModel=c.support.boxModel=r.offsetWidth===2;if("zoom"in r.style){r.style.display="inline";r.style.zoom= +1;c.support.inlineBlockNeedsLayout=r.offsetWidth===2;r.style.display="";r.innerHTML="
              ";c.support.shrinkWrapBlocks=r.offsetWidth!==2}r.innerHTML="
              t
              ";var A=r.getElementsByTagName("td");c.support.reliableHiddenOffsets=A[0].offsetHeight===0;A[0].style.display="";A[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&A[0].offsetHeight===0;r.innerHTML="";t.body.removeChild(r).style.display= +"none"});a=function(r){var A=t.createElement("div");r="on"+r;var C=r in A;if(!C){A.setAttribute(r,"return;");C=typeof A[r]==="function"}return C};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=f=h=null}})();var ra={},Ja=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==E?ra:a;var e=a.nodeType,f=e?a[c.expando]:null,h= +c.cache;if(!(e&&!f&&typeof b==="string"&&d===B)){if(e)f||(a[c.expando]=f=++c.uuid);else h=a;if(typeof b==="object")if(e)h[f]=c.extend(h[f],b);else c.extend(h,b);else if(e&&!h[f])h[f]={};a=e?h[f]:h;if(d!==B)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==E?ra:a;var d=a.nodeType,e=d?a[c.expando]:a,f=c.cache,h=d?f[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando); +else if(d)delete f[e];else for(var l in a)delete a[l]}},acceptData:function(a){if(a.nodeName){var b=c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){var d=null;if(typeof a==="undefined"){if(this.length){var e=this[0].attributes,f;d=c.data(this[0]);for(var h=0,l=e.length;h-1)return true;return false},val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value:b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var f=b.options;b=b.type==="select-one"; +if(e<0)return null;var h=b?e:0;for(e=b?e+1:f.length;h=0;else if(c.nodeName(this,"select")){var A=c.makeArray(r);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),A)>=0});if(!A.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true}, +attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return B;if(e&&b in c.attrFn)return c(a)[b](d);e=a.nodeType!==1||!c.isXMLDoc(a);var f=d!==B;b=e&&c.props[b]||b;var h=Ta.test(b);if((b in a||a[b]!==B)&&e&&!h){if(f){b==="type"&&Ua.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");if(d===null)a.nodeType===1&&a.removeAttribute(b);else a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&& +b.specified?b.value:Va.test(a.nodeName)||Wa.test(a.nodeName)&&a.href?0:B;return a[b]}if(!c.support.style&&e&&b==="style"){if(f)a.style.cssText=""+d;return a.style.cssText}f&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return B;a=!c.support.hrefNormalized&&e&&h?a.getAttribute(b,2):a.getAttribute(b);return a===null?B:a}});var X=/\.(.*)$/,ia=/^(?:textarea|input|select)$/i,La=/\./g,Ma=/ /g,Xa=/[^\w\s.|`]/g,Ya=function(a){return a.replace(Xa,"\\$&")},ua={focusin:0,focusout:0}; +c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==E&&!a.frameElement)a=E;if(d===false)d=U;else if(!d)return;var f,h;if(d.handler){f=d;d=f.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var l=a.nodeType?"events":"__events__",k=h[l],o=h.handle;if(typeof k==="function"){o=k.handle;k=k.events}else if(!k){a.nodeType||(h[l]=h=function(){});h.events=k={}}if(!o)h.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem, +arguments):B};o.elem=a;b=b.split(" ");for(var x=0,r;l=b[x++];){h=f?c.extend({},f):{handler:d,data:e};if(l.indexOf(".")>-1){r=l.split(".");l=r.shift();h.namespace=r.slice(0).sort().join(".")}else{r=[];h.namespace=""}h.type=l;if(!h.guid)h.guid=d.guid;var A=k[l],C=c.event.special[l]||{};if(!A){A=k[l]=[];if(!C.setup||C.setup.call(a,e,r,o)===false)if(a.addEventListener)a.addEventListener(l,o,false);else a.attachEvent&&a.attachEvent("on"+l,o)}if(C.add){C.add.call(a,h);if(!h.handler.guid)h.handler.guid= +d.guid}A.push(h);c.event.global[l]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(d===false)d=U;var f,h,l=0,k,o,x,r,A,C,J=a.nodeType?"events":"__events__",w=c.data(a),I=w&&w[J];if(w&&I){if(typeof I==="function"){w=I;I=I.events}if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(f in I)c.event.remove(a,f+b)}else{for(b=b.split(" ");f=b[l++];){r=f;k=f.indexOf(".")<0;o=[];if(!k){o=f.split(".");f=o.shift();x=RegExp("(^|\\.)"+ +c.map(o.slice(0).sort(),Ya).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(A=I[f])if(d){r=c.event.special[f]||{};for(h=e||0;h=0){a.type=f=f.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[f]&&c.each(c.cache,function(){this.events&&this.events[f]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType=== +8)return B;a.result=B;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+f]&&d["on"+f].apply(d,b)===false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&&e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){var l;e=a.target;var k=f.replace(X,""),o=c.nodeName(e,"a")&&k=== +"click",x=c.event.special[k]||{};if((!x._default||x._default.call(d,a)===false)&&!o&&!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()])){try{if(e[k]){if(l=e["on"+k])e["on"+k]=null;c.event.triggered=true;e[k]()}}catch(r){}if(l)e["on"+k]=l;c.event.triggered=false}}},handle:function(a){var b,d,e,f;d=[];var h=c.makeArray(arguments);a=h[0]=c.event.fix(a||E.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type=e.shift();d=e.slice(0).sort();e=RegExp("(^|\\.)"+ +d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");f=c.data(this,this.nodeType?"events":"__events__");if(typeof f==="function")f=f.events;d=(f||{})[a.type];if(f&&d){d=d.slice(0);f=0;for(var l=d.length;f-1?c.map(a.options,function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},Z=function(a,b){var d=a.target,e,f;if(!(!ia.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");f=xa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",f);if(!(e===B||f===e))if(e!=null||f){a.type="change";a.liveFired= +B;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:Z,beforedeactivate:Z,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return Z.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return Z.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",xa(a))}},setup:function(){if(this.type=== +"file")return false;for(var a in V)c.event.add(this,a+".specialChange",V[a]);return ia.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return ia.test(this.nodeName)}};V=c.event.special.change.filters;V.focus=V.beforeactivate}t.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){ua[b]++===0&&t.addEventListener(a,d,true)},teardown:function(){--ua[b]=== +0&&t.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,f){if(typeof d==="object"){for(var h in d)this[b](h,e,d[h],f);return this}if(c.isFunction(e)||e===false){f=e;e=B}var l=b==="one"?c.proxy(f,function(o){c(this).unbind(o,l);return f.apply(this,arguments)}):f;if(d==="unload"&&b!=="one")this.one(d,e,f);else{h=0;for(var k=this.length;h0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});E.attachEvent&&!E.addEventListener&&c(E).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}}); +(function(){function a(g,i,n,m,p,q){p=0;for(var u=m.length;p0){F=y;break}}y=y[g]}m[p]=F}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,h=false,l=true;[0,0].sort(function(){l=false;return 0});var k=function(g,i,n,m){n=n||[];var p=i=i||t;if(i.nodeType!==1&&i.nodeType!==9)return[];if(!g||typeof g!=="string")return n;var q,u,y,F,M,N=true,O=k.isXML(i),D=[],R=g;do{d.exec("");if(q=d.exec(R)){R=q[3];D.push(q[1]);if(q[2]){F=q[3]; +break}}}while(q);if(D.length>1&&x.exec(g))if(D.length===2&&o.relative[D[0]])u=L(D[0]+D[1],i);else for(u=o.relative[D[0]]?[i]:k(D.shift(),i);D.length;){g=D.shift();if(o.relative[g])g+=D.shift();u=L(g,u)}else{if(!m&&D.length>1&&i.nodeType===9&&!O&&o.match.ID.test(D[0])&&!o.match.ID.test(D[D.length-1])){q=k.find(D.shift(),i,O);i=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]}if(i){q=m?{expr:D.pop(),set:C(m)}:k.find(D.pop(),D.length===1&&(D[0]==="~"||D[0]==="+")&&i.parentNode?i.parentNode:i,O);u=q.expr?k.filter(q.expr, +q.set):q.set;if(D.length>0)y=C(u);else N=false;for(;D.length;){q=M=D.pop();if(o.relative[M])q=D.pop();else M="";if(q==null)q=i;o.relative[M](y,q,O)}}else y=[]}y||(y=u);y||k.error(M||g);if(f.call(y)==="[object Array]")if(N)if(i&&i.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&k.contains(i,y[g])))n.push(u[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&n.push(u[g]);else n.push.apply(n,y);else C(y,n);if(F){k(F,p,n,m);k.uniqueSort(n)}return n};k.uniqueSort=function(g){if(w){h= +l;g.sort(w);if(h)for(var i=1;i0};k.find=function(g,i,n){var m;if(!g)return[];for(var p=0,q=o.order.length;p":function(g,i){var n,m=typeof i==="string",p=0,q=g.length;if(m&&!/\W/.test(i))for(i=i.toLowerCase();p=0))n||m.push(u);else if(n)i[q]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var i=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=i[1]+(i[2]||1)-0;g[3]=i[3]-0}g[0]=e++;return g},ATTR:function(g,i,n, +m,p,q){i=g[1].replace(/\\/g,"");if(!q&&o.attrMap[i])g[1]=o.attrMap[i];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,i,n,m,p){if(g[1]==="not")if((d.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,i);else{g=k.filter(g[3],i,n,true^p);n||m.push.apply(m,g);return false}else if(o.match.POS.test(g[0])||o.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled=== +true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,i,n){return!!k(n[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"=== +g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,i){return i===0},last:function(g,i,n,m){return i===m.length-1},even:function(g,i){return i%2===0},odd:function(g,i){return i%2===1},lt:function(g,i,n){return in[3]-0},nth:function(g,i,n){return n[3]- +0===i},eq:function(g,i,n){return n[3]-0===i}},filter:{PSEUDO:function(g,i,n,m){var p=i[1],q=o.filters[p];if(q)return q(g,n,i,m);else if(p==="contains")return(g.textContent||g.innerText||k.getText([g])||"").indexOf(i[3])>=0;else if(p==="not"){i=i[3];n=0;for(m=i.length;n=0}},ID:function(g,i){return g.nodeType===1&&g.getAttribute("id")===i},TAG:function(g,i){return i==="*"&&g.nodeType===1||g.nodeName.toLowerCase()=== +i},CLASS:function(g,i){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(i)>-1},ATTR:function(g,i){var n=i[1];n=o.attrHandle[n]?o.attrHandle[n](g):g[n]!=null?g[n]:g.getAttribute(n);var m=n+"",p=i[2],q=i[4];return n==null?p==="!=":p==="="?m===q:p==="*="?m.indexOf(q)>=0:p==="~="?(" "+m+" ").indexOf(q)>=0:!q?m&&n!==false:p==="!="?m!==q:p==="^="?m.indexOf(q)===0:p==="$="?m.substr(m.length-q.length)===q:p==="|="?m===q||m.substr(0,q.length+1)===q+"-":false},POS:function(g,i,n,m){var p=o.setFilters[i[2]]; +if(p)return p(g,n,i,m)}}},x=o.match.POS,r=function(g,i){return"\\"+(i-0+1)},A;for(A in o.match){o.match[A]=RegExp(o.match[A].source+/(?![^\[]*\])(?![^\(]*\))/.source);o.leftMatch[A]=RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[A].source.replace(/\\(\d+)/g,r))}var C=function(g,i){g=Array.prototype.slice.call(g,0);if(i){i.push.apply(i,g);return i}return g};try{Array.prototype.slice.call(t.documentElement.childNodes,0)}catch(J){C=function(g,i){var n=0,m=i||[];if(f.call(g)==="[object Array]")Array.prototype.push.apply(m, +g);else if(typeof g.length==="number")for(var p=g.length;n";n.insertBefore(g,n.firstChild);if(t.getElementById(i)){o.find.ID=function(m,p,q){if(typeof p.getElementById!=="undefined"&&!q)return(p=p.getElementById(m[1]))?p.id===m[1]||typeof p.getAttributeNode!=="undefined"&&p.getAttributeNode("id").nodeValue===m[1]?[p]:B:[]};o.filter.ID=function(m,p){var q=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&q&&q.nodeValue===p}}n.removeChild(g); +n=g=null})();(function(){var g=t.createElement("div");g.appendChild(t.createComment(""));if(g.getElementsByTagName("*").length>0)o.find.TAG=function(i,n){var m=n.getElementsByTagName(i[1]);if(i[1]==="*"){for(var p=[],q=0;m[q];q++)m[q].nodeType===1&&p.push(m[q]);m=p}return m};g.innerHTML="";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")o.attrHandle.href=function(i){return i.getAttribute("href",2)};g=null})();t.querySelectorAll&& +function(){var g=k,i=t.createElement("div");i.innerHTML="

              ";if(!(i.querySelectorAll&&i.querySelectorAll(".TEST").length===0)){k=function(m,p,q,u){p=p||t;m=m.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!u&&!k.isXML(p))if(p.nodeType===9)try{return C(p.querySelectorAll(m),q)}catch(y){}else if(p.nodeType===1&&p.nodeName.toLowerCase()!=="object"){var F=p.getAttribute("id"),M=F||"__sizzle__";F||p.setAttribute("id",M);try{return C(p.querySelectorAll("#"+M+" "+m),q)}catch(N){}finally{F|| +p.removeAttribute("id")}}return g(m,p,q,u)};for(var n in g)k[n]=g[n];i=null}}();(function(){var g=t.documentElement,i=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.msMatchesSelector,n=false;try{i.call(t.documentElement,"[test!='']:sizzle")}catch(m){n=true}if(i)k.matchesSelector=function(p,q){q=q.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(p))try{if(n||!o.match.PSEUDO.test(q)&&!/!=/.test(q))return i.call(p,q)}catch(u){}return k(q,null,null,[p]).length>0}})();(function(){var g= +t.createElement("div");g.innerHTML="
              ";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){o.order.splice(1,0,"CLASS");o.find.CLASS=function(i,n,m){if(typeof n.getElementsByClassName!=="undefined"&&!m)return n.getElementsByClassName(i[1])};g=null}}})();k.contains=t.documentElement.contains?function(g,i){return g!==i&&(g.contains?g.contains(i):true)}:t.documentElement.compareDocumentPosition? +function(g,i){return!!(g.compareDocumentPosition(i)&16)}:function(){return false};k.isXML=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false};var L=function(g,i){for(var n,m=[],p="",q=i.nodeType?[i]:i;n=o.match.PSEUDO.exec(g);){p+=n[0];g=g.replace(o.match.PSEUDO,"")}g=o.relative[g]?g+"*":g;n=0;for(var u=q.length;n0)for(var h=d;h0},closest:function(a,b){var d=[],e,f,h=this[0];if(c.isArray(a)){var l,k={},o=1;if(h&&a.length){e=0;for(f=a.length;e-1:c(h).is(e))d.push({selector:l,elem:h,level:o})}h= +h.parentNode;o++}}return d}l=cb.test(a)?c(a,b||this.context):null;e=0;for(f=this.length;e-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h||!h.ownerDocument||h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",a)},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var d=typeof a==="string"?c(a,b||this.context): +c.makeArray(a),e=c.merge(this.get(),d);return this.pushStack(!d[0]||!d[0].parentNode||d[0].parentNode.nodeType===11||!e[0]||!e[0].parentNode||e[0].parentNode.nodeType===11?e:c.unique(e))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a, +2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a, +b){c.fn[a]=function(d,e){var f=c.map(this,b,d);Za.test(a)||(e=d);if(e&&typeof e==="string")f=c.filter(e,f);f=this.length>1?c.unique(f):f;if((this.length>1||ab.test(e))&&$a.test(a))f=f.reverse();return this.pushStack(f,a,bb.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length===1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&a.nodeType!==9&&(d===B||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&& +e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var za=/ jQuery\d+="(?:\d+|null)"/g,$=/^\s+/,Aa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Ba=/<([\w:]+)/,db=/\s]+\/)>/g,P={option:[1, +""],legend:[1,"
              ","
              "],thead:[1,"","
              "],tr:[2,"","
              "],td:[3,"","
              "],col:[2,"","
              "],area:[1,"",""],_default:[0,"",""]};P.optgroup=P.option;P.tbody=P.tfoot=P.colgroup=P.caption=P.thead;P.th=P.td;if(!c.support.htmlSerialize)P._default=[1,"div
              ","
              "];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= +c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==B)return this.empty().append((this[0]&&this[0].ownerDocument||t).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, +wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, +prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, +this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,e;(e=this[d])!=null;d++)if(!a||c.filter(a,[e]).length){if(!b&&e.nodeType===1){c.cleanData(e.getElementsByTagName("*"));c.cleanData([e])}e.parentNode&&e.parentNode.removeChild(e)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); +return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,e=this.ownerDocument;if(!d){d=e.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(za,"").replace(fb,'="$1">').replace($,"")],e)[0]}else return this.cloneNode(true)});if(a===true){na(this,b);na(this.find("*"),b.find("*"))}return b},html:function(a){if(a===B)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(za,""):null; +else if(typeof a==="string"&&!Ca.test(a)&&(c.support.leadingWhitespace||!$.test(a))&&!P[(Ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Aa,"<$1>");try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?h.cloneNode(true):h)}k.length&&c.each(k,Oa)}return this}});c.buildFragment=function(a,b,d){var e,f,h;b=b&&b[0]?b[0].ownerDocument||b[0]:t;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===t&&!Ca.test(a[0])&&(c.support.checkClone||!Da.test(a[0]))){f=true;if(h=c.fragments[a[0]])if(h!==1)e=h}if(!e){e=b.createDocumentFragment();c.clean(a,b,e,d)}if(f)c.fragments[a[0]]=h?e:1;return{fragment:e,cacheable:f}};c.fragments={};c.each({appendTo:"append", +prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var e=[];d=c(d);var f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{f=0;for(var h=d.length;f0?this.clone(true):this).get();c(d[f])[b](l);e=e.concat(l)}return this.pushStack(e,a,d.selector)}}});c.extend({clean:function(a,b,d,e){b=b||t;if(typeof b.createElement==="undefined")b=b.ownerDocument|| +b[0]&&b[0].ownerDocument||t;for(var f=[],h=0,l;(l=a[h])!=null;h++){if(typeof l==="number")l+="";if(l){if(typeof l==="string"&&!eb.test(l))l=b.createTextNode(l);else if(typeof l==="string"){l=l.replace(Aa,"<$1>");var k=(Ba.exec(l)||["",""])[1].toLowerCase(),o=P[k]||P._default,x=o[0],r=b.createElement("div");for(r.innerHTML=o[1]+l+o[2];x--;)r=r.lastChild;if(!c.support.tbody){x=db.test(l);k=k==="table"&&!x?r.firstChild&&r.firstChild.childNodes:o[1]===""&&!x?r.childNodes:[];for(o=k.length- +1;o>=0;--o)c.nodeName(k[o],"tbody")&&!k[o].childNodes.length&&k[o].parentNode.removeChild(k[o])}!c.support.leadingWhitespace&&$.test(l)&&r.insertBefore(b.createTextNode($.exec(l)[0]),r.firstChild);l=r.childNodes}if(l.nodeType)f.push(l);else f=c.merge(f,l)}}if(d)for(h=0;f[h];h++)if(e&&c.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))e.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{f[h].nodeType===1&&f.splice.apply(f,[h+1,0].concat(c.makeArray(f[h].getElementsByTagName("script")))); +d.appendChild(f[h])}return f},cleanData:function(a){for(var b,d,e=c.cache,f=c.event.special,h=c.support.deleteExpando,l=0,k;(k=a[l])!=null;l++)if(!(k.nodeName&&c.noData[k.nodeName.toLowerCase()]))if(d=k[c.expando]){if((b=e[d])&&b.events)for(var o in b.events)f[o]?c.event.remove(k,o):c.removeEvent(k,o,b.handle);if(h)delete k[c.expando];else k.removeAttribute&&k.removeAttribute(c.expando);delete e[d]}}});var Ea=/alpha\([^)]*\)/i,gb=/opacity=([^)]*)/,hb=/-([a-z])/ig,ib=/([A-Z])/g,Fa=/^-?\d+(?:px)?$/i, +jb=/^-?\d/,kb={position:"absolute",visibility:"hidden",display:"block"},Pa=["Left","Right"],Qa=["Top","Bottom"],W,Ga,aa,lb=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){if(arguments.length===2&&b===B)return this;return c.access(this,a,b,true,function(d,e,f){return f!==B?c.style(d,e,f):c.css(d,e)})};c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var d=W(a,"opacity","opacity");return d===""?"1":d}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true, +zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var f,h=c.camelCase(b),l=a.style,k=c.cssHooks[h];b=c.cssProps[h]||h;if(d!==B){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!k||!("set"in k)||(d=k.set(a,d))!==B)try{l[b]=d}catch(o){}}}else{if(k&&"get"in k&&(f=k.get(a,false,e))!==B)return f;return l[b]}}},css:function(a,b,d){var e,f=c.camelCase(b), +h=c.cssHooks[f];b=c.cssProps[f]||f;if(h&&"get"in h&&(e=h.get(a,true,d))!==B)return e;else if(W)return W(a,b,f)},swap:function(a,b,d){var e={},f;for(f in b){e[f]=a.style[f];a.style[f]=b[f]}d.call(a);for(f in b)a.style[f]=e[f]},camelCase:function(a){return a.replace(hb,lb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(d,e,f){var h;if(e){if(d.offsetWidth!==0)h=oa(d,b,f);else c.swap(d,kb,function(){h=oa(d,b,f)});if(h<=0){h=W(d,b,b);if(h==="0px"&&aa)h=aa(d,b,b); +if(h!=null)return h===""||h==="auto"?"0px":h}if(h<0||h==null){h=d.style[b];return h===""||h==="auto"?"0px":h}return typeof h==="string"?h:h+"px"}},set:function(d,e){if(Fa.test(e)){e=parseFloat(e);if(e>=0)return e+"px"}else return e}}});if(!c.support.opacity)c.cssHooks.opacity={get:function(a,b){return gb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var d=a.style;d.zoom=1;var e=c.isNaN(b)?"":"alpha(opacity="+b*100+")",f= +d.filter||"";d.filter=Ea.test(f)?f.replace(Ea,e):d.filter+" "+e}};if(t.defaultView&&t.defaultView.getComputedStyle)Ga=function(a,b,d){var e;d=d.replace(ib,"-$1").toLowerCase();if(!(b=a.ownerDocument.defaultView))return B;if(b=b.getComputedStyle(a,null)){e=b.getPropertyValue(d);if(e===""&&!c.contains(a.ownerDocument.documentElement,a))e=c.style(a,d)}return e};if(t.documentElement.currentStyle)aa=function(a,b){var d,e,f=a.currentStyle&&a.currentStyle[b],h=a.style;if(!Fa.test(f)&&jb.test(f)){d=h.left; +e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=b==="fontSize"?"1em":f||0;f=h.pixelLeft+"px";h.left=d;a.runtimeStyle.left=e}return f===""?"auto":f};W=Ga||aa;if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var mb=c.now(),nb=/)<[^<]*)*<\/script>/gi, +ob=/^(?:select|textarea)/i,pb=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,qb=/^(?:GET|HEAD)$/,Ra=/\[\]$/,T=/\=\?(&|$)/,ja=/\?/,rb=/([?&])_=[^&]*/,sb=/^(\w+:)?\/\/([^\/?#]+)/,tb=/%20/g,ub=/#.*$/,Ha=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!=="string"&&Ha)return Ha.apply(this,arguments);else if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}e="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b=== +"object"){b=c.param(b,c.ajaxSettings.traditional);e="POST"}var h=this;c.ajax({url:a,type:e,dataType:"html",data:b,complete:function(l,k){if(k==="success"||k==="notmodified")h.html(f?c("
              ").append(l.responseText.replace(nb,"")).find(f):l.responseText);d&&h.each(d,[l.responseText,k,l])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&& +!this.disabled&&(this.checked||ob.test(this.nodeName)||pb.test(this.type))}).map(function(a,b){var d=c(this).val();return d==null?null:c.isArray(d)?c.map(d,function(e){return{name:b.name,value:e}}):{name:b.name,value:d}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:e})}, +getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:e})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return new E.XMLHttpRequest},accepts:{xml:"application/xml, text/xml",html:"text/html", +script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},ajax:function(a){var b=c.extend(true,{},c.ajaxSettings,a),d,e,f,h=b.type.toUpperCase(),l=qb.test(h);b.url=b.url.replace(ub,"");b.context=a&&a.context!=null?a.context:b;if(b.data&&b.processData&&typeof b.data!=="string")b.data=c.param(b.data,b.traditional);if(b.dataType==="jsonp"){if(h==="GET")T.test(b.url)||(b.url+=(ja.test(b.url)?"&":"?")+(b.jsonp||"callback")+"=?");else if(!b.data|| +!T.test(b.data))b.data=(b.data?b.data+"&":"")+(b.jsonp||"callback")+"=?";b.dataType="json"}if(b.dataType==="json"&&(b.data&&T.test(b.data)||T.test(b.url))){d=b.jsonpCallback||"jsonp"+mb++;if(b.data)b.data=(b.data+"").replace(T,"="+d+"$1");b.url=b.url.replace(T,"="+d+"$1");b.dataType="script";var k=E[d];E[d]=function(m){if(c.isFunction(k))k(m);else{E[d]=B;try{delete E[d]}catch(p){}}f=m;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);r&&r.removeChild(A)}}if(b.dataType==="script"&&b.cache===null)b.cache= +false;if(b.cache===false&&l){var o=c.now(),x=b.url.replace(rb,"$1_="+o);b.url=x+(x===b.url?(ja.test(b.url)?"&":"?")+"_="+o:"")}if(b.data&&l)b.url+=(ja.test(b.url)?"&":"?")+b.data;b.global&&c.active++===0&&c.event.trigger("ajaxStart");o=(o=sb.exec(b.url))&&(o[1]&&o[1].toLowerCase()!==location.protocol||o[2].toLowerCase()!==location.host);if(b.dataType==="script"&&h==="GET"&&o){var r=t.getElementsByTagName("head")[0]||t.documentElement,A=t.createElement("script");if(b.scriptCharset)A.charset=b.scriptCharset; +A.src=b.url;if(!d){var C=false;A.onload=A.onreadystatechange=function(){if(!C&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){C=true;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);A.onload=A.onreadystatechange=null;r&&A.parentNode&&r.removeChild(A)}}}r.insertBefore(A,r.firstChild);return B}var J=false,w=b.xhr();if(w){b.username?w.open(h,b.url,b.async,b.username,b.password):w.open(h,b.url,b.async);try{if(b.data!=null&&!l||a&&a.contentType)w.setRequestHeader("Content-Type", +b.contentType);if(b.ifModified){c.lastModified[b.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[b.url]);c.etag[b.url]&&w.setRequestHeader("If-None-Match",c.etag[b.url])}o||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?b.accepts[b.dataType]+", */*; q=0.01":b.accepts._default)}catch(I){}if(b.beforeSend&&b.beforeSend.call(b.context,w,b)===false){b.global&&c.active--===1&&c.event.trigger("ajaxStop");w.abort();return false}b.global&& +c.triggerGlobal(b,"ajaxSend",[w,b]);var L=w.onreadystatechange=function(m){if(!w||w.readyState===0||m==="abort"){J||c.handleComplete(b,w,e,f);J=true;if(w)w.onreadystatechange=c.noop}else if(!J&&w&&(w.readyState===4||m==="timeout")){J=true;w.onreadystatechange=c.noop;e=m==="timeout"?"timeout":!c.httpSuccess(w)?"error":b.ifModified&&c.httpNotModified(w,b.url)?"notmodified":"success";var p;if(e==="success")try{f=c.httpData(w,b.dataType,b)}catch(q){e="parsererror";p=q}if(e==="success"||e==="notmodified")d|| +c.handleSuccess(b,w,e,f);else c.handleError(b,w,e,p);d||c.handleComplete(b,w,e,f);m==="timeout"&&w.abort();if(b.async)w=null}};try{var g=w.abort;w.abort=function(){w&&Function.prototype.call.call(g,w);L("abort")}}catch(i){}b.async&&b.timeout>0&&setTimeout(function(){w&&!J&&L("timeout")},b.timeout);try{w.send(l||b.data==null?null:b.data)}catch(n){c.handleError(b,w,null,n);c.handleComplete(b,w,e,f)}b.async||L();return w}},param:function(a,b){var d=[],e=function(h,l){l=c.isFunction(l)?l():l;d[d.length]= +encodeURIComponent(h)+"="+encodeURIComponent(l)};if(b===B)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){e(this.name,this.value)});else for(var f in a)da(f,a[f],b,e);return d.join("&").replace(tb,"+")}});c.extend({active:0,lastModified:{},etag:{},handleError:function(a,b,d,e){a.error&&a.error.call(a.context,b,d,e);a.global&&c.triggerGlobal(a,"ajaxError",[b,a,e])},handleSuccess:function(a,b,d,e){a.success&&a.success.call(a.context,e,d,b);a.global&&c.triggerGlobal(a,"ajaxSuccess", +[b,a])},handleComplete:function(a,b,d){a.complete&&a.complete.call(a.context,b,d);a.global&&c.triggerGlobal(a,"ajaxComplete",[b,a]);a.global&&c.active--===1&&c.event.trigger("ajaxStop")},triggerGlobal:function(a,b,d){(a.context&&a.context.url==null?c(a.context):c.event).trigger(b,d)},httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"), +e=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(e)c.etag[b]=e;return a.status===304},httpData:function(a,b,d){var e=a.getResponseHeader("content-type")||"",f=b==="xml"||!b&&e.indexOf("xml")>=0;a=f?a.responseXML:a.responseText;f&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&e.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&e.indexOf("javascript")>=0)c.globalEval(a);return a}}); +if(E.ActiveXObject)c.ajaxSettings.xhr=function(){if(E.location.protocol!=="file:")try{return new E.XMLHttpRequest}catch(a){}try{return new E.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}};c.support.ajax=!!c.ajaxSettings.xhr();var ea={},vb=/^(?:toggle|show|hide)$/,wb=/^([+\-]=)?([\d+.\-]+)(.*)$/,ba,pa=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b,d){if(a||a===0)return this.animate(S("show", +3),a,b,d);else{d=0;for(var e=this.length;d=0;e--)if(d[e].elem===this){b&&d[e](true);d.splice(e,1)}});b||this.dequeue();return this}});c.each({slideDown:S("show",1),slideUp:S("hide",1),slideToggle:S("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){c.fn[a]=function(d,e,f){return this.animate(b, +d,e,f)}});c.extend({speed:function(a,b,d){var e=a&&typeof a==="object"?c.extend({},a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};e.duration=c.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default;e.old=e.complete;e.complete=function(){e.queue!==false&&c(this).dequeue();c.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,d,e){return d+e*a},swing:function(a,b,d,e){return(-Math.cos(a* +Math.PI)/2+0.5)*e+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a=parseFloat(c.css(this.elem,this.prop));return a&&a>-1E4?a:0},custom:function(a,b,d){function e(l){return f.step(l)} +var f=this,h=c.fx;this.startTime=c.now();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;e.elem=this.elem;if(e()&&c.timers.push(e)&&!ba)ba=setInterval(h.tick,h.interval)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true; +this.custom(this.cur(),0)},step:function(a){var b=c.now(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var e in this.options.curAnim)if(this.options.curAnim[e]!==true)d=false;if(d){if(this.options.overflow!=null&&!c.support.shrinkWrapBlocks){var f=this.elem,h=this.options;c.each(["","X","Y"],function(k,o){f.style["overflow"+o]=h.overflow[k]})}this.options.hide&&c(this.elem).hide();if(this.options.hide|| +this.options.show)for(var l in this.options.curAnim)c.style(this.elem,l,this.options.orig[l]);this.options.complete.call(this.elem)}return false}else{a=b-this.startTime;this.state=a/this.options.duration;b=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||b](this.state,a,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a= +c.timers,b=0;b-1;e={};var x={};if(o)x=f.position();l=o?x.top:parseInt(l,10)||0;k=o?x.left:parseInt(k,10)||0;if(c.isFunction(b))b=b.call(a,d,h);if(b.top!=null)e.top=b.top-h.top+l;if(b.left!=null)e.left=b.left-h.left+k;"using"in b?b.using.call(a, +e):f.css(e)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),e=Ia.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.css(a,"marginTop"))||0;d.left-=parseFloat(c.css(a,"marginLeft"))||0;e.top+=parseFloat(c.css(b[0],"borderTopWidth"))||0;e.left+=parseFloat(c.css(b[0],"borderLeftWidth"))||0;return{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||t.body;a&&!Ia.test(a.nodeName)&& +c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(e){var f=this[0],h;if(!f)return null;if(e!==B)return this.each(function(){if(h=fa(this))h.scrollTo(!a?e:c(h).scrollLeft(),a?e:c(h).scrollTop());else this[d]=e});else return(h=fa(f))?"pageXOffset"in h?h[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&h.document.documentElement[d]||h.document.body[d]:f[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase(); +c.fn["inner"+b]=function(){return this[0]?parseFloat(c.css(this[0],d,"padding")):null};c.fn["outer"+b]=function(e){return this[0]?parseFloat(c.css(this[0],d,e?"margin":"border")):null};c.fn[d]=function(e){var f=this[0];if(!f)return e==null?null:this;if(c.isFunction(e))return this.each(function(l){var k=c(this);k[d](e.call(this,l,k[d]()))});if(c.isWindow(f))return f.document.compatMode==="CSS1Compat"&&f.document.documentElement["client"+b]||f.document.body["client"+b];else if(f.nodeType===9)return Math.max(f.documentElement["client"+ +b],f.body["scroll"+b],f.documentElement["scroll"+b],f.body["offset"+b],f.documentElement["offset"+b]);else if(e===B){f=c.css(f,d);var h=parseFloat(f);return c.isNaN(h)?f:h}else return this.css(d,typeof e==="string"?e:e+"px")}})})(window); diff --git a/assets/modules/store/installer/setup.info.php b/assets/modules/store/installer/setup.info.php index e138658371..12957db151 100644 --- a/assets/modules/store/installer/setup.info.php +++ b/assets/modules/store/installer/setup.info.php @@ -1,306 +1,306 @@ -hasPermission('exec_module')) { - die('INCLUDE_ORDERING_ERROR

              Please use the EVO Content Manager instead of accessing this file directly.'); -} - +hasPermission('exec_module')) { + die('INCLUDE_ORDERING_ERROR

              Please use the EVO Content Manager instead of accessing this file directly.'); +} + //:: Evolution CMS Installer Setup file //::::::::::::::::::::::::::::::::::::::::: require_once(EVO_MANAGER_PATH . 'includes/version.inc.php'); -$installPath = EVO_BASE_PATH . 'assets/cache/store/install'; -if (!isset($evo_branch)) { - $evo_branch = ''; -} -if (!isset($evo_version)) { - $evo_version = ''; -} -if (!isset($evo_release_date)) { - $evo_release_date = ''; -} -$moduleName = "Evolution CMS"; -$moduleVersion = $evo_branch . ' ' . $evo_version; -$moduleRelease = $evo_release_date; -$moduleSQLBaseFile = "setup.sql"; -$moduleSQLDataFile = "install/setup.data.sql"; -$chunkPath = $installPath . '/install/assets/chunks'; -$snippetPath = $installPath . '/install/assets/snippets'; -$pluginPath = $installPath . '/install/assets/plugins'; -$modulePath = $installPath . '/install/assets/modules'; -$templatePath = $installPath . '/install/assets/templates'; -$tvPath = $installPath . '/install/assets/tvs'; - -// setup Template template files - array : name, description, type - 0:file or 1:content, parameters, category -$mt = &$moduleTemplates; -if (is_dir($templatePath) && is_readable($templatePath)) { - $d = dir($templatePath); - while (false !== ($tplfile = $d->read())) { - if (substr($tplfile, -4) != '.tpl') continue; - $params = parse_docblock($templatePath, $tplfile); - if (is_array($params) && (count($params) > 0)) { - $description = empty($params['version']) ? $params['description'] : "{$params['version']} {$params['description']}"; - $mt[] = array - ( - $params['name'], - $description, - // Don't think this is gonna be used ... but adding it just in case 'type' - $params['type'], - "$templatePath/{$params['filename']}", - $params['modx_category'], - $params['lock_template'], - array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false - ); - } - } - $d->close(); -} - -// setup Template Variable template files -$mtv = &$moduleTVs; -if (is_dir($tvPath) && is_readable($tvPath)) { - $d = dir($tvPath); - while (false !== ($tplfile = $d->read())) { - if (substr($tplfile, -4) != '.tpl') continue; - $params = parse_docblock($tvPath, $tplfile); - if (is_array($params) && (count($params) > 0)) { - $description = empty($params['version']) ? $params['description'] : "{$params['version']} {$params['description']}"; - $mtv[] = array( - $params['name'], - $params['caption'], - $description, - $params['input_type'], - $params['input_options'] ?? '', - $params['input_default'] ?? '', - $params['output_widget'] ?? '', - $params['output_widget_params'] ?? '', - "$templatePath/{$params['filename']}", /* not currently used */ - $params['template_assignments'] ?? '', /* comma-separated list of template names */ - $params['modx_category'] ?? '', - $params['lock_tv'] ?? 0, /* value should be 1 or 0 */ - array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false - ); - } - } - $d->close(); -} - -// setup chunks template files - array : name, description, type - 0:file or 1:content, file or content -$mc = &$moduleChunks; -if (is_dir($chunkPath) && is_readable($chunkPath)) { - $d = dir($chunkPath); - while (false !== ($tplfile = $d->read())) { - if (substr($tplfile, -4) != '.tpl') { - continue; - } - $params = parse_docblock($chunkPath, $tplfile); - if (is_array($params) && count($params) > 0) { - $description = empty($params['version']) ? $params['description'] : "{$params['version']} {$params['description']}"; - $mc[] = array( - $params['name'], - $description, - "$chunkPath/{$params['filename']}", - $params['modx_category'] ?? '', - array_key_exists('overwrite', $params) ? $params['overwrite'] : 'true', - array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false - ); - } - } - $d->close(); -} - -// setup snippets template files - array : name, description, type - 0:file or 1:content, file or content,properties -$ms = &$moduleSnippets; - -if (is_dir($snippetPath) && is_readable($snippetPath)) { - $d = dir($snippetPath); - while (false !== ($tplfile = $d->read())) { - if (substr($tplfile, -4) != '.tpl') { - continue; - } - $params = parse_docblock($snippetPath, $tplfile); - - if (is_array($params) && count($params) > 0) { - $description = empty($params['version']) ? $params['description'] : "{$params['version']} {$params['description']}"; - $ms[] = array( - $params['name'], - $description, - "$snippetPath/{$params['filename']}", - $params['properties'] ?? '', - $params['modx_category'] ?? '', - array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false - ); - } - } - $d->close(); -} - -// setup plugins template files - array : name, description, type - 0:file or 1:content, file or content,properties -$mp = &$modulePlugins; -if (is_dir($pluginPath) && is_readable($pluginPath)) { - $d = dir($pluginPath); - while (false !== ($tplfile = $d->read())) { - if (substr($tplfile, -4) != '.tpl') { - continue; - } - $params = parse_docblock($pluginPath, $tplfile); - if (is_array($params) && count($params) > 0) { - $description = empty($params['version']) ? $params['description'] : "{$params['version']} {$params['description']}"; - $mp[] = array( - $params['name'], - $description, - "$pluginPath/{$params['filename']}", - $params['properties'] ?? '', - $params['events'] ?? '', - $params['guid'] ?? '', - $params['modx_category'] ?? '', - $params['legacy_names'] ?? '', - array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false, - $params['disabled'] ?? 0 - ); - } - } - $d->close(); -} - -// setup modules - array : name, description, type - 0:file or 1:content, file or content, properties, guid, enable_sharedparams, icon -$mm = &$moduleModules; -if (is_dir($modulePath) && is_readable($modulePath)) { - $d = dir($modulePath); - while (false !== ($tplfile = $d->read())) { - if (substr($tplfile, -4) != '.tpl') { - continue; - } - $params = parse_docblock($modulePath, $tplfile); - if (is_array($params) && count($params) > 0) { - $description = empty($params['version']) ? $params['description'] : "{$params['version']} {$params['description']}"; - $mm[] = array( - $params['name'], - $description, - "$modulePath/{$params['filename']}", - $params['properties'] ?? '', - $params['guid'] ?? '', - (int)($params['shareparams'] ?? 0), - $params['modx_category'] ?? '', - array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false, - $params['icon'] ?? '' - ); - } - } - $d->close(); -} - -// setup callback function -$callBackFnc = "clean_up"; - -function clean_up($sqlParser) -{ - $ids = array(); - $mysqlVerOk = -1; - $table_prefix = evo()->getDatabase()->getConfig('prefix'); - - if (function_exists("mysql_get_server_info")) { - $mysqlVerOk = (version_compare(mysql_get_server_info(), "4.0.2") >= 0); - } - - // secure web documents - privateweb - mysql_query("UPDATE `" . $table_prefix . "site_content` SET privateweb = 0 WHERE privateweb = 1", $sqlParser->conn); - $sql = "SELECT DISTINCT sc.id - FROM `" . $table_prefix . "site_content` sc - LEFT JOIN `" . $table_prefix . "document_groups` dg ON dg.document = sc.id - LEFT JOIN `" . $table_prefix . "webgroup_access` wga ON wga.documentgroup = dg.document_group - WHERE wga.id>0"; - $ds = evo()->getDatabase()->query($sql); - if (!$ds) { - echo "An error occurred while executing a query: " . mysql_error(); - } else { - while ($r = evo()->getDatabase()->GetRow($ds, 'assoc')) $ids[] = $r["id"]; - if (count($ids) > 0) { - mysql_query("UPDATE `" . $table_prefix . "site_content` SET privateweb = 1 WHERE id IN (" . implode(", ", $ids) . ")"); - unset($ids); - } - } - - // secure manager documents privatemgr - mysql_query("UPDATE `" . $table_prefix . "site_content` SET privatemgr = 0 WHERE privatemgr = 1"); - $sql = "SELECT DISTINCT sc.id - FROM `" . $table_prefix . "site_content` sc - LEFT JOIN `" . $table_prefix . "document_groups` dg ON dg.document = sc.id - LEFT JOIN `" . $table_prefix . "membergroup_access` mga ON mga.documentgroup = dg.document_group - WHERE mga.id>0"; - $ds = evo()->getDatabase()->query($sql); - if (!$ds) { - echo "An error occurred while executing a query: " . mysql_error(); - } else { - while ($r = evo()->getDatabase()->GetRow($ds, 'assoc')) $ids[] = $r["id"]; - if (count($ids) > 0) { - evo()->getDatabase()->query("UPDATE `" . $table_prefix . "site_content` SET privatemgr = 1 WHERE id IN (" . implode(", ", $ids) . ")"); - unset($ids); - } - } -} - -function parse_docblock($element_dir, $filename) -{ - $params = array(); - $fullpath = $element_dir . '/' . $filename; - if (is_readable($fullpath)) { - $tpl = @fopen($fullpath, "r"); - if ($tpl) { - $params['filename'] = $filename; - $docblock_start_found = false; - $name_found = false; - $description_found = false; - $docblock_end_found = false; - - while (!feof($tpl)) { - $line = fgets($tpl); - if (!$docblock_start_found) { - // find docblock start - if (strpos($line, '/**') !== false) { - $docblock_start_found = true; - } - continue; - } elseif (!$name_found) { - // find name - $ma = null; - if (preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { - $params['name'] = trim($ma[1]); - $name_found = !empty($params['name']); - } - continue; - } elseif (!$description_found) { - // find description - $ma = null; - if (preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { - $params['description'] = trim($ma[1]); - $description_found = !empty($params['description']); - } - continue; - } else { - $ma = null; - if (preg_match("/^\s+\*\s+\@([^\s]+)\s+(.+)/", $line, $ma)) { - $param = trim($ma[1]); - $val = trim($ma[2]); - if (!empty($param) && !empty($val)) { - if ($param == 'internal') { - $ma = null; - if (preg_match("/\@([^\s]+)\s+(.+)/", $val, $ma)) { - $param = trim($ma[1]); - $val = trim($ma[2]); - } - if (empty($param)) { - continue; - } - } - $params[$param] = $val; - } - } elseif (preg_match("/^\s*\*\/\s*$/", $line)) { - $docblock_end_found = true; - break; - } - } - } - @fclose($tpl); - } - } - return $params; -} +$installPath = EVO_BASE_PATH . 'assets/cache/store/install'; +if (!isset($evo_branch)) { + $evo_branch = ''; +} +if (!isset($evo_version)) { + $evo_version = ''; +} +if (!isset($evo_release_date)) { + $evo_release_date = ''; +} +$moduleName = "Evolution CMS"; +$moduleVersion = $evo_branch . ' ' . $evo_version; +$moduleRelease = $evo_release_date; +$moduleSQLBaseFile = "setup.sql"; +$moduleSQLDataFile = "install/setup.data.sql"; +$chunkPath = $installPath . '/install/assets/chunks'; +$snippetPath = $installPath . '/install/assets/snippets'; +$pluginPath = $installPath . '/install/assets/plugins'; +$modulePath = $installPath . '/install/assets/modules'; +$templatePath = $installPath . '/install/assets/templates'; +$tvPath = $installPath . '/install/assets/tvs'; + +// setup Template template files - array : name, description, type - 0:file or 1:content, parameters, category +$mt = &$moduleTemplates; +if (is_dir($templatePath) && is_readable($templatePath)) { + $d = dir($templatePath); + while (false !== ($tplfile = $d->read())) { + if (substr($tplfile, -4) != '.tpl') continue; + $params = parse_docblock($templatePath, $tplfile); + if (is_array($params) && (count($params) > 0)) { + $description = empty($params['version']) ? $params['description'] : "{$params['version']} {$params['description']}"; + $mt[] = array + ( + $params['name'], + $description, + // Don't think this is gonna be used ... but adding it just in case 'type' + $params['type'], + "$templatePath/{$params['filename']}", + $params['modx_category'], + $params['lock_template'], + array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false + ); + } + } + $d->close(); +} + +// setup Template Variable template files +$mtv = &$moduleTVs; +if (is_dir($tvPath) && is_readable($tvPath)) { + $d = dir($tvPath); + while (false !== ($tplfile = $d->read())) { + if (substr($tplfile, -4) != '.tpl') continue; + $params = parse_docblock($tvPath, $tplfile); + if (is_array($params) && (count($params) > 0)) { + $description = empty($params['version']) ? $params['description'] : "{$params['version']} {$params['description']}"; + $mtv[] = array( + $params['name'], + $params['caption'], + $description, + $params['input_type'], + $params['input_options'] ?? '', + $params['input_default'] ?? '', + $params['output_widget'] ?? '', + $params['output_widget_params'] ?? '', + "$templatePath/{$params['filename']}", /* not currently used */ + $params['template_assignments'] ?? '', /* comma-separated list of template names */ + $params['modx_category'] ?? '', + $params['lock_tv'] ?? 0, /* value should be 1 or 0 */ + array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false + ); + } + } + $d->close(); +} + +// setup chunks template files - array : name, description, type - 0:file or 1:content, file or content +$mc = &$moduleChunks; +if (is_dir($chunkPath) && is_readable($chunkPath)) { + $d = dir($chunkPath); + while (false !== ($tplfile = $d->read())) { + if (substr($tplfile, -4) != '.tpl') { + continue; + } + $params = parse_docblock($chunkPath, $tplfile); + if (is_array($params) && count($params) > 0) { + $description = empty($params['version']) ? $params['description'] : "{$params['version']} {$params['description']}"; + $mc[] = array( + $params['name'], + $description, + "$chunkPath/{$params['filename']}", + $params['modx_category'] ?? '', + array_key_exists('overwrite', $params) ? $params['overwrite'] : 'true', + array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false + ); + } + } + $d->close(); +} + +// setup snippets template files - array : name, description, type - 0:file or 1:content, file or content,properties +$ms = &$moduleSnippets; + +if (is_dir($snippetPath) && is_readable($snippetPath)) { + $d = dir($snippetPath); + while (false !== ($tplfile = $d->read())) { + if (substr($tplfile, -4) != '.tpl') { + continue; + } + $params = parse_docblock($snippetPath, $tplfile); + + if (is_array($params) && count($params) > 0) { + $description = empty($params['version']) ? $params['description'] : "{$params['version']} {$params['description']}"; + $ms[] = array( + $params['name'], + $description, + "$snippetPath/{$params['filename']}", + $params['properties'] ?? '', + $params['modx_category'] ?? '', + array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false + ); + } + } + $d->close(); +} + +// setup plugins template files - array : name, description, type - 0:file or 1:content, file or content,properties +$mp = &$modulePlugins; +if (is_dir($pluginPath) && is_readable($pluginPath)) { + $d = dir($pluginPath); + while (false !== ($tplfile = $d->read())) { + if (substr($tplfile, -4) != '.tpl') { + continue; + } + $params = parse_docblock($pluginPath, $tplfile); + if (is_array($params) && count($params) > 0) { + $description = empty($params['version']) ? $params['description'] : "{$params['version']} {$params['description']}"; + $mp[] = array( + $params['name'], + $description, + "$pluginPath/{$params['filename']}", + $params['properties'] ?? '', + $params['events'] ?? '', + $params['guid'] ?? '', + $params['modx_category'] ?? '', + $params['legacy_names'] ?? '', + array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false, + $params['disabled'] ?? 0 + ); + } + } + $d->close(); +} + +// setup modules - array : name, description, type - 0:file or 1:content, file or content, properties, guid, enable_sharedparams, icon +$mm = &$moduleModules; +if (is_dir($modulePath) && is_readable($modulePath)) { + $d = dir($modulePath); + while (false !== ($tplfile = $d->read())) { + if (substr($tplfile, -4) != '.tpl') { + continue; + } + $params = parse_docblock($modulePath, $tplfile); + if (is_array($params) && count($params) > 0) { + $description = empty($params['version']) ? $params['description'] : "{$params['version']} {$params['description']}"; + $mm[] = array( + $params['name'], + $description, + "$modulePath/{$params['filename']}", + $params['properties'] ?? '', + $params['guid'] ?? '', + (int)($params['shareparams'] ?? 0), + $params['modx_category'] ?? '', + array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false, + $params['icon'] ?? '' + ); + } + } + $d->close(); +} + +// setup callback function +$callBackFnc = "clean_up"; + +function clean_up($sqlParser) +{ + $ids = array(); + $mysqlVerOk = -1; + $table_prefix = evo()->getDatabase()->getConfig('prefix'); + + if (function_exists("mysql_get_server_info")) { + $mysqlVerOk = (version_compare(mysql_get_server_info(), "4.0.2") >= 0); + } + + // secure web documents - privateweb + mysql_query("UPDATE `" . $table_prefix . "site_content` SET privateweb = 0 WHERE privateweb = 1", $sqlParser->conn); + $sql = "SELECT DISTINCT sc.id + FROM `" . $table_prefix . "site_content` sc + LEFT JOIN `" . $table_prefix . "document_groups` dg ON dg.document = sc.id + LEFT JOIN `" . $table_prefix . "webgroup_access` wga ON wga.documentgroup = dg.document_group + WHERE wga.id>0"; + $ds = evo()->getDatabase()->query($sql); + if (!$ds) { + echo "An error occurred while executing a query: " . mysql_error(); + } else { + while ($r = evo()->getDatabase()->GetRow($ds, 'assoc')) $ids[] = $r["id"]; + if (count($ids) > 0) { + mysql_query("UPDATE `" . $table_prefix . "site_content` SET privateweb = 1 WHERE id IN (" . implode(", ", $ids) . ")"); + unset($ids); + } + } + + // secure manager documents privatemgr + mysql_query("UPDATE `" . $table_prefix . "site_content` SET privatemgr = 0 WHERE privatemgr = 1"); + $sql = "SELECT DISTINCT sc.id + FROM `" . $table_prefix . "site_content` sc + LEFT JOIN `" . $table_prefix . "document_groups` dg ON dg.document = sc.id + LEFT JOIN `" . $table_prefix . "membergroup_access` mga ON mga.documentgroup = dg.document_group + WHERE mga.id>0"; + $ds = evo()->getDatabase()->query($sql); + if (!$ds) { + echo "An error occurred while executing a query: " . mysql_error(); + } else { + while ($r = evo()->getDatabase()->GetRow($ds, 'assoc')) $ids[] = $r["id"]; + if (count($ids) > 0) { + evo()->getDatabase()->query("UPDATE `" . $table_prefix . "site_content` SET privatemgr = 1 WHERE id IN (" . implode(", ", $ids) . ")"); + unset($ids); + } + } +} + +function parse_docblock($element_dir, $filename) +{ + $params = array(); + $fullpath = $element_dir . '/' . $filename; + if (is_readable($fullpath)) { + $tpl = @fopen($fullpath, "r"); + if ($tpl) { + $params['filename'] = $filename; + $docblock_start_found = false; + $name_found = false; + $description_found = false; + $docblock_end_found = false; + + while (!feof($tpl)) { + $line = fgets($tpl); + if (!$docblock_start_found) { + // find docblock start + if (strpos($line, '/**') !== false) { + $docblock_start_found = true; + } + continue; + } elseif (!$name_found) { + // find name + $ma = null; + if (preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { + $params['name'] = trim($ma[1]); + $name_found = !empty($params['name']); + } + continue; + } elseif (!$description_found) { + // find description + $ma = null; + if (preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { + $params['description'] = trim($ma[1]); + $description_found = !empty($params['description']); + } + continue; + } else { + $ma = null; + if (preg_match("/^\s+\*\s+\@([^\s]+)\s+(.+)/", $line, $ma)) { + $param = trim($ma[1]); + $val = trim($ma[2]); + if (!empty($param) && !empty($val)) { + if ($param == 'internal') { + $ma = null; + if (preg_match("/\@([^\s]+)\s+(.+)/", $val, $ma)) { + $param = trim($ma[1]); + $val = trim($ma[2]); + } + if (empty($param)) { + continue; + } + } + $params[$param] = $val; + } + } elseif (preg_match("/^\s*\*\/\s*$/", $line)) { + $docblock_end_found = true; + break; + } + } + } + @fclose($tpl); + } + } + return $params; +} diff --git a/assets/modules/store/installer/style.css b/assets/modules/store/installer/style.css index 4a3848adf9..0fd8d5dcda 100755 --- a/assets/modules/store/installer/style.css +++ b/assets/modules/store/installer/style.css @@ -1,611 +1,611 @@ -html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, -html body * span.clear, html body * div.clear, html body * li.clear, html body * dd.clear { -background:transparent none repeat scroll 0 0; -border:0 none; -font-size:100%; -margin:0; -outline-color:-moz-use-text-color; -outline-style:none; -outline-width:0; -padding:0; -vertical-align:baseline; -} - -body { --x-system-font:none; -font-family:Helvetica,Arial,'Liberation Sans',FreeSans,sans-serif; -font-size:75%; -font-size-adjust:none; -font-stretch:normal; -font-style:normal; -font-variant:normal; -font-weight:normal; -line-height:1.5; -background: #F4F4F4 none repeat scroll 0 0; -} - -html > body { -font-size:13px; -} -body { -background-color: #FFFFFF; -font-family: "Lucida Grande","Lucida Sans Unicode",Verdana,Arial,Helvetica,sans-serif; -} - -ol, ul { -list-style-image:none; -list-style-position:outside; -list-style-type:none; -} -ins { -text-decoration:none; -} -del { -text-decoration:line-through; -} -table { -border-collapse:collapse; -border-spacing:0; -} -a:focus { -} -h1, h2, h3, h4, h5, h6 { -font-weight:normal; -} -h1 { -font-size:216.667%; -line-height:0.692308; -margin:0.461538em 0 0.230769em; -} -h2 { -font-size:166.667%; -line-height:0.9; -margin:0.6em 0 0.3em; -} -h3 { -font-size:141.667%; -line-height:0.823529; -margin:0.54902em 0 0.27451em; -font-weight: bold; -} -h4 { -font-size:116.667%; -line-height:1; -margin:0.666667em 0 0.333333em; -} -h3, h4 { -color:#585858; -font-size:1.1em; -line-height:1.3em; -margin-bottom:0.75em; -} - - -h5 { -font-size:100%; -font-weight:bold; -line-height:1.5; -margin:1em 0 0.5em; -} -h6 { -font-size:83.3333%; -font-weight:bold; -line-height:1.8; -margin:1.8em 0 0; -} -ol { -list-style-image:none; -list-style-position:outside; -list-style-type:decimal; -} -ul { -list-style-image:none; -list-style-position:outside; -list-style-type:square; -} -li { -margin-left:30px; -} -p, dl, hr, ol, ul, dl pre, table, address, fieldset { -margin-bottom:1.5em; -} -.container_12 { -margin-left:auto; -margin-right:auto; -width:700px; -} - -#rtl { - direction: rtl; - text-align: right; -} - -.alpha { -margin-left:0; -} -.omega { -margin-right:0; -} - -.clearfix:after { -clear:both; -content:'.'; -display:block; -height:0; -visibility:hidden; -} -.clearfix { -display:inline-block; -} -* html .clearfix { -height:1%; -} -.clearfix { -display:block; -} -strong, em, b, i { -} -h1, h2, h3, h4, h5, h6, address { -margin-top:0; -} -p, td, th, dt, dd, li { -color:#6A6A6A; -} -#footer p { -color:#FFFFFF; -} -code, pre { -margin-bottom:1em; -} -dt { -display:inline; -font-weight:bold; -} -dd { -margin-bottom:20px; -} -.left { -float:left; -} -.right { -float:right; -} -img.left { -float:left; -margin-right:10px; -} -img.right { -float:right; -margin-left:10px; -} -a { -color:#0066CC; -} -a img { -border:0 none; -} -sup { -font-size:smaller; -vertical-align:super; -} -.hidden { -display:none; -} -hr { -clear:both; -border-bottom: 1px solid #FFFFFF; -border-top: 1px solid #E6E6E6; -color:#E6E6E6; -height:0; -} -.clear, .cls { -background-color:transparent; -border:0 none; -clear:both !important; -height:1px; -margin-top:-1px; -visibility:hidden; -} -.center { -margin:0 auto; -text-align:center; -} - -.inputtip { -color:#888888; -} - -.help { - float: right; -} -.help a { - color: #fff; - text-decoration: none !important; - text-transform: uppercase; - -moz-border-radius: 3x; - -webkit-border-radius: 3px; - border-radius: 3px; - border: 1px solid #ffbc6c; - border-right-color: #db831a; - border-bottom-color: #db831a; - background: #f2901d; - font-size: 86%; - padding: 2px 4px; - letter-spacing: 1px; -} -.help a:hover { - background: #f8a440; -} -.help a:active { - border: 1px solid #db831a; - border-right-color: #ffbc6c; - border-bottom-color: #ffbc6c; -} -.version { - color: #fff; -} -span.mono { - font-family: Courier, monospace; -} -.buttonlinks { - display:block; - height:26px; - line-height:26px; - margin-bottom:20px; - float:right; - clear: left; -} -#rtl .buttonlinks { - float: left; -} - -.info .buttonlinks { -margin:0; -} -.buttonlinks a { --x-system-font:none; -background:transparent url(img/site-ui-gfx.png) no-repeat scroll -54px -353px; -color:#5A5A5A; -display:block; -float:left; -font: bold 11px/23px "Lucida Grande",Lucida,Verdana,sans-serif; -height:26px; -margin:0 20px 0 0; -padding:0; -max-width:250px; -text-decoration:none; -text-transform:uppercase; -} -#rtl .buttonlinks a { - margin: 0 0 0 20px; -} -.buttonlinks a span { -background:#FFFFFF url(img/site-ui-gfx.png) no-repeat scroll 100% -353px; -display:block; -float:left; -height:26px; -margin:0 0 0 10px; -padding:0 22px 0 0; -} - -.buttonlinks a:hover { -background-position:-54px -379px; -cursor:pointer; -} -.buttonlinks a:hover span { -background-position:100% -379px; -cursor:pointer; -} -.buttonlinks a:hover { -background-position:-54px -379px; -} -.buttonlinks a:hover span { -background-position:100% -379px; -} -#header .buttonlinks a:hover { -text-decoration:none; -} -.buttonlinks a.prev { -background:transparent url(img/link_button_prev.jpg) no-repeat scroll right 0; -float:left; -margin:0 20px 0 0; -} -.buttonlinks a.prev span { -background:transparent url(img/link_button_prev.jpg) no-repeat scroll left 0; -float:left; -margin:0 10px 0 0; -padding:0 0 0 22px; -} -.buttonlinks a.prev:hover { -background-position:right -26px; -} -.buttonlinks a.prev:hover span { -background-position:left -26px; -} - -#header { -background:transparent url(img/site-ui-gfx.png) repeat-x scroll -23px -23px; - margin-bottom:25px; - padding-top:16px; -} -#header a:hover { -text-decoration:underline; -} -#mainheader { -position:relative; - height:116px; - margin-top:25px; -} - -#contentarea h2 { -color:#5A8F34; -font-size:1.7em; -font-weight:bold; -line-height:1em; -margin-bottom:0.5em; -} - -#downloadbar { -background:transparent url(img/installbar.png) no-repeat scroll 0 0; -height:93px; -margin-bottom:20px; -position:relative; -width:940px; -} -#downloadinfo { - color:#FFFFFF; - font-size:26px; - font-weight:bold; - line-height:66px; - padding: 0 20px; - text-transform:lowercase; - background:none; -} - -#footer { -background:#64AB24 url(img/site-ui-gfx.png) repeat-x scroll 0 -198px; -color:#FFFFFF; -margin-top:20px; -padding-top:23px; -} -#footer-inner { - background: #64AB24 none repeat scroll 0 0; - padding: 15px 0; -} -#footer h6 { -font-size:1.7em; -margin-bottom:10px; -} -#footer a { -color:#FFFFFF; -} - -#bottom { -background:#64AB24 url(img/site-ui-gfx.png) repeat-x scroll 0 0; -clear:both; -height:23px; -margin:0; -overflow:hidden; -padding:0; -} -#content ul, #content ol { -margin-left:15px; -} -#content li { -color:#6A6A6A; -margin:0 0 5px 20px; -padding-left:5px; -} -.box_6, .box_12 { -padding-top:20px; -} -.box_6 .box-inner, .box_12 .box-inner { -margin-bottom:2px; -padding:0 20px; -} -.box_6 .box-bottom { -height:20px; -line-height:20px; -} -.notes { -background-color:#FEFFCB; -} -.info { -background-color:#F3F3F3; -} -#contentarea .notes h3 { -font-size:1.3em; -} - -.installImg { - float: left; - width: 120px; - min-height: 100px; - text-align: center; -} -#rtl .installImg { - float: right; -} -#installChoices { - margin:2em 0; -} -#installChoices h3 { - padding: 0 20px; - background: url(img/elements.gif) no-repeat top left; -} -#rtl #installChoices h3 { - background-position: top right; -} -#installChoices hr { - height: 1px; - border-width: 1px 0 0; - border-top: 1px dotted #ddd; -} -#installChoices input { - margin: 0 10px 10px 0; - float: left; - display: block; -} -#rtl #installChoices input { - margin: 0 0 10px 10px; - float: right; -} - -table { -color:#8C8C8C; -font-size:95%; -width:100%; -} -caption { -text-align:center; -} -thead th { -background:#333333 none repeat scroll 0 0; -border-right:1px solid #E4E4E4; -border-top:1px solid #E4E4E4; -color:#FFFFFF; -padding:6px 6px 6px 12px; -text-align:center; -width:10%; -} -thead th.nobg { -background:transparent none repeat scroll 0 0; -border-left:0 none; -border-right:1px solid #E4E4E4; -border-top:0 none; -color:#8C8C8C; -font-style:normal; -font-weight:normal; -text-align:left; -width:auto; -} -td, th { -background:#FFFFFF none repeat scroll 0 0; -border-bottom:1px solid #E4E4E4; -border-right:1px solid #E4E4E4; -color:#8C8C8C; -height:24px; -line-height:24px; -padding:0 6px 0 12px; -} -td.alt { -background:#F5FAFA none repeat scroll 0 0; -} -tbody th { -border-left:1px solid #E4E4E4; -border-top:0 none; -font-weight:normal; -text-align:left; -} -tbody td { -padding:3px 6px; -text-align:center; -} -tr.alt td, tr.alt th { -background:#F3F3F3 none repeat scroll 0 0; -} -tr.highlight td, tr.highlight th { -background-color:#78AE20; -background-image:none; -color:#fff; -font-size:1.1em; -font-weight:bold; -padding-bottom:5px; -padding-top:5px; -} -td del { -color:#aaa; -} -p.labelHolder { - clear: left; - margin-bottom:5px; -} - -#content ul li { background: none; list-style: none; } - -#downloadbar ul { - margin:0 0 1.5em 15px; -} -#downloadbar li { - list-style-type:none; - margin:0; -} - - -#setCollation, #AUH { - background-color:#fff; - display:none; -} - -#collationMask, #AUHMask { - background-color:#fff; - opacity:0; -} - -tbody td { - text-align:left; -} -.labelHolder label { - float: left; - margin-bottom: 5px; - width: 200px; -} -#rtl .labelHolder label { - float: right; -} -.status { - margin: 1em 0 2em; - padding: .25em .5em; - background: #eee; -} -p.actions { - line-height: 1; - margin-top: 3px; -} -p.actions a { - margin: 0 5px 1px; - padding: 2px 6px 3px; - border-bottom: 1px solid #039; - display: block; - float: left; - color: navy; - text-decoration: none; -} -#rtl p.actions a { - float: right; -} -p.actions a:hover { - background: #039; - color: #fff; -} -p.actions a:active { - background-color: #ccc; -} -img.options { - float:left; - margin: 0 10px 0 0; -} -#rtl img.options { - float:right; - margin: 0 0 0 10px; -} -span.ok { - font-weight:bold; - color:green; -} -span.notok { - font-weight:bold; - color:red; -} -#logo { -background:transparent url(img/site-ui-gfx.png) repeat -10px -289px; -display:block; -height:63px; -left:0; -line-height:63px; -margin:20px 0 0; -position:absolute; -text-indent:-9999px; -top:0; -width:228px; +html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, +html body * span.clear, html body * div.clear, html body * li.clear, html body * dd.clear { +background:transparent none repeat scroll 0 0; +border:0 none; +font-size:100%; +margin:0; +outline-color:-moz-use-text-color; +outline-style:none; +outline-width:0; +padding:0; +vertical-align:baseline; +} + +body { +-x-system-font:none; +font-family:Helvetica,Arial,'Liberation Sans',FreeSans,sans-serif; +font-size:75%; +font-size-adjust:none; +font-stretch:normal; +font-style:normal; +font-variant:normal; +font-weight:normal; +line-height:1.5; +background: #F4F4F4 none repeat scroll 0 0; +} + +html > body { +font-size:13px; +} +body { +background-color: #FFFFFF; +font-family: "Lucida Grande","Lucida Sans Unicode",Verdana,Arial,Helvetica,sans-serif; +} + +ol, ul { +list-style-image:none; +list-style-position:outside; +list-style-type:none; +} +ins { +text-decoration:none; +} +del { +text-decoration:line-through; +} +table { +border-collapse:collapse; +border-spacing:0; +} +a:focus { +} +h1, h2, h3, h4, h5, h6 { +font-weight:normal; +} +h1 { +font-size:216.667%; +line-height:0.692308; +margin:0.461538em 0 0.230769em; +} +h2 { +font-size:166.667%; +line-height:0.9; +margin:0.6em 0 0.3em; +} +h3 { +font-size:141.667%; +line-height:0.823529; +margin:0.54902em 0 0.27451em; +font-weight: bold; +} +h4 { +font-size:116.667%; +line-height:1; +margin:0.666667em 0 0.333333em; +} +h3, h4 { +color:#585858; +font-size:1.1em; +line-height:1.3em; +margin-bottom:0.75em; +} + + +h5 { +font-size:100%; +font-weight:bold; +line-height:1.5; +margin:1em 0 0.5em; +} +h6 { +font-size:83.3333%; +font-weight:bold; +line-height:1.8; +margin:1.8em 0 0; +} +ol { +list-style-image:none; +list-style-position:outside; +list-style-type:decimal; +} +ul { +list-style-image:none; +list-style-position:outside; +list-style-type:square; +} +li { +margin-left:30px; +} +p, dl, hr, ol, ul, dl pre, table, address, fieldset { +margin-bottom:1.5em; +} +.container_12 { +margin-left:auto; +margin-right:auto; +width:700px; +} + +#rtl { + direction: rtl; + text-align: right; +} + +.alpha { +margin-left:0; +} +.omega { +margin-right:0; +} + +.clearfix:after { +clear:both; +content:'.'; +display:block; +height:0; +visibility:hidden; +} +.clearfix { +display:inline-block; +} +* html .clearfix { +height:1%; +} +.clearfix { +display:block; +} +strong, em, b, i { +} +h1, h2, h3, h4, h5, h6, address { +margin-top:0; +} +p, td, th, dt, dd, li { +color:#6A6A6A; +} +#footer p { +color:#FFFFFF; +} +code, pre { +margin-bottom:1em; +} +dt { +display:inline; +font-weight:bold; +} +dd { +margin-bottom:20px; +} +.left { +float:left; +} +.right { +float:right; +} +img.left { +float:left; +margin-right:10px; +} +img.right { +float:right; +margin-left:10px; +} +a { +color:#0066CC; +} +a img { +border:0 none; +} +sup { +font-size:smaller; +vertical-align:super; +} +.hidden { +display:none; +} +hr { +clear:both; +border-bottom: 1px solid #FFFFFF; +border-top: 1px solid #E6E6E6; +color:#E6E6E6; +height:0; +} +.clear, .cls { +background-color:transparent; +border:0 none; +clear:both !important; +height:1px; +margin-top:-1px; +visibility:hidden; +} +.center { +margin:0 auto; +text-align:center; +} + +.inputtip { +color:#888888; +} + +.help { + float: right; +} +.help a { + color: #fff; + text-decoration: none !important; + text-transform: uppercase; + -moz-border-radius: 3x; + -webkit-border-radius: 3px; + border-radius: 3px; + border: 1px solid #ffbc6c; + border-right-color: #db831a; + border-bottom-color: #db831a; + background: #f2901d; + font-size: 86%; + padding: 2px 4px; + letter-spacing: 1px; +} +.help a:hover { + background: #f8a440; +} +.help a:active { + border: 1px solid #db831a; + border-right-color: #ffbc6c; + border-bottom-color: #ffbc6c; +} +.version { + color: #fff; +} +span.mono { + font-family: Courier, monospace; +} +.buttonlinks { + display:block; + height:26px; + line-height:26px; + margin-bottom:20px; + float:right; + clear: left; +} +#rtl .buttonlinks { + float: left; +} + +.info .buttonlinks { +margin:0; +} +.buttonlinks a { +-x-system-font:none; +background:transparent url(img/site-ui-gfx.png) no-repeat scroll -54px -353px; +color:#5A5A5A; +display:block; +float:left; +font: bold 11px/23px "Lucida Grande",Lucida,Verdana,sans-serif; +height:26px; +margin:0 20px 0 0; +padding:0; +max-width:250px; +text-decoration:none; +text-transform:uppercase; +} +#rtl .buttonlinks a { + margin: 0 0 0 20px; +} +.buttonlinks a span { +background:#FFFFFF url(img/site-ui-gfx.png) no-repeat scroll 100% -353px; +display:block; +float:left; +height:26px; +margin:0 0 0 10px; +padding:0 22px 0 0; +} + +.buttonlinks a:hover { +background-position:-54px -379px; +cursor:pointer; +} +.buttonlinks a:hover span { +background-position:100% -379px; +cursor:pointer; +} +.buttonlinks a:hover { +background-position:-54px -379px; +} +.buttonlinks a:hover span { +background-position:100% -379px; +} +#header .buttonlinks a:hover { +text-decoration:none; +} +.buttonlinks a.prev { +background:transparent url(img/link_button_prev.jpg) no-repeat scroll right 0; +float:left; +margin:0 20px 0 0; +} +.buttonlinks a.prev span { +background:transparent url(img/link_button_prev.jpg) no-repeat scroll left 0; +float:left; +margin:0 10px 0 0; +padding:0 0 0 22px; +} +.buttonlinks a.prev:hover { +background-position:right -26px; +} +.buttonlinks a.prev:hover span { +background-position:left -26px; +} + +#header { +background:transparent url(img/site-ui-gfx.png) repeat-x scroll -23px -23px; + margin-bottom:25px; + padding-top:16px; +} +#header a:hover { +text-decoration:underline; +} +#mainheader { +position:relative; + height:116px; + margin-top:25px; +} + +#contentarea h2 { +color:#5A8F34; +font-size:1.7em; +font-weight:bold; +line-height:1em; +margin-bottom:0.5em; +} + +#downloadbar { +background:transparent url(img/installbar.png) no-repeat scroll 0 0; +height:93px; +margin-bottom:20px; +position:relative; +width:940px; +} +#downloadinfo { + color:#FFFFFF; + font-size:26px; + font-weight:bold; + line-height:66px; + padding: 0 20px; + text-transform:lowercase; + background:none; +} + +#footer { +background:#64AB24 url(img/site-ui-gfx.png) repeat-x scroll 0 -198px; +color:#FFFFFF; +margin-top:20px; +padding-top:23px; +} +#footer-inner { + background: #64AB24 none repeat scroll 0 0; + padding: 15px 0; +} +#footer h6 { +font-size:1.7em; +margin-bottom:10px; +} +#footer a { +color:#FFFFFF; +} + +#bottom { +background:#64AB24 url(img/site-ui-gfx.png) repeat-x scroll 0 0; +clear:both; +height:23px; +margin:0; +overflow:hidden; +padding:0; +} +#content ul, #content ol { +margin-left:15px; +} +#content li { +color:#6A6A6A; +margin:0 0 5px 20px; +padding-left:5px; +} +.box_6, .box_12 { +padding-top:20px; +} +.box_6 .box-inner, .box_12 .box-inner { +margin-bottom:2px; +padding:0 20px; +} +.box_6 .box-bottom { +height:20px; +line-height:20px; +} +.notes { +background-color:#FEFFCB; +} +.info { +background-color:#F3F3F3; +} +#contentarea .notes h3 { +font-size:1.3em; +} + +.installImg { + float: left; + width: 120px; + min-height: 100px; + text-align: center; +} +#rtl .installImg { + float: right; +} +#installChoices { + margin:2em 0; +} +#installChoices h3 { + padding: 0 20px; + background: url(img/elements.gif) no-repeat top left; +} +#rtl #installChoices h3 { + background-position: top right; +} +#installChoices hr { + height: 1px; + border-width: 1px 0 0; + border-top: 1px dotted #ddd; +} +#installChoices input { + margin: 0 10px 10px 0; + float: left; + display: block; +} +#rtl #installChoices input { + margin: 0 0 10px 10px; + float: right; +} + +table { +color:#8C8C8C; +font-size:95%; +width:100%; +} +caption { +text-align:center; +} +thead th { +background:#333333 none repeat scroll 0 0; +border-right:1px solid #E4E4E4; +border-top:1px solid #E4E4E4; +color:#FFFFFF; +padding:6px 6px 6px 12px; +text-align:center; +width:10%; +} +thead th.nobg { +background:transparent none repeat scroll 0 0; +border-left:0 none; +border-right:1px solid #E4E4E4; +border-top:0 none; +color:#8C8C8C; +font-style:normal; +font-weight:normal; +text-align:left; +width:auto; +} +td, th { +background:#FFFFFF none repeat scroll 0 0; +border-bottom:1px solid #E4E4E4; +border-right:1px solid #E4E4E4; +color:#8C8C8C; +height:24px; +line-height:24px; +padding:0 6px 0 12px; +} +td.alt { +background:#F5FAFA none repeat scroll 0 0; +} +tbody th { +border-left:1px solid #E4E4E4; +border-top:0 none; +font-weight:normal; +text-align:left; +} +tbody td { +padding:3px 6px; +text-align:center; +} +tr.alt td, tr.alt th { +background:#F3F3F3 none repeat scroll 0 0; +} +tr.highlight td, tr.highlight th { +background-color:#78AE20; +background-image:none; +color:#fff; +font-size:1.1em; +font-weight:bold; +padding-bottom:5px; +padding-top:5px; +} +td del { +color:#aaa; +} +p.labelHolder { + clear: left; + margin-bottom:5px; +} + +#content ul li { background: none; list-style: none; } + +#downloadbar ul { + margin:0 0 1.5em 15px; +} +#downloadbar li { + list-style-type:none; + margin:0; +} + + +#setCollation, #AUH { + background-color:#fff; + display:none; +} + +#collationMask, #AUHMask { + background-color:#fff; + opacity:0; +} + +tbody td { + text-align:left; +} +.labelHolder label { + float: left; + margin-bottom: 5px; + width: 200px; +} +#rtl .labelHolder label { + float: right; +} +.status { + margin: 1em 0 2em; + padding: .25em .5em; + background: #eee; +} +p.actions { + line-height: 1; + margin-top: 3px; +} +p.actions a { + margin: 0 5px 1px; + padding: 2px 6px 3px; + border-bottom: 1px solid #039; + display: block; + float: left; + color: navy; + text-decoration: none; +} +#rtl p.actions a { + float: right; +} +p.actions a:hover { + background: #039; + color: #fff; +} +p.actions a:active { + background-color: #ccc; +} +img.options { + float:left; + margin: 0 10px 0 0; +} +#rtl img.options { + float:right; + margin: 0 0 0 10px; +} +span.ok { + font-weight:bold; + color:green; +} +span.notok { + font-weight:bold; + color:red; +} +#logo { +background:transparent url(img/site-ui-gfx.png) repeat -10px -289px; +display:block; +height:63px; +left:0; +line-height:63px; +margin:20px 0 0; +position:absolute; +text-indent:-9999px; +top:0; +width:228px; } \ No newline at end of file diff --git a/assets/modules/store/js/fancybox/helpers/jquery.fancybox-buttons.css b/assets/modules/store/js/fancybox/helpers/jquery.fancybox-buttons.css index c0a81df164..f80dbed27a 100755 --- a/assets/modules/store/js/fancybox/helpers/jquery.fancybox-buttons.css +++ b/assets/modules/store/js/fancybox/helpers/jquery.fancybox-buttons.css @@ -1,96 +1,96 @@ -#fancybox-buttons { - position: fixed; - left: 0; - width: 100%; - z-index: 8050; -} - -#fancybox-buttons.top { - top: 10px; -} - -#fancybox-buttons.bottom { - bottom: 10px; -} - -#fancybox-buttons ul { - display: block; - width: 166px; - height: 30px; - margin: 0 auto; - padding: 0; - list-style: none; - border: 1px solid #111; - border-radius: 3px; - -webkit-box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); - -moz-box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); - box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); - background: rgb(50,50,50); - background: -moz-linear-gradient(top, rgb(68,68,68) 0%, rgb(52,52,52) 50%, rgb(41,41,41) 50%, rgb(51,51,51) 100%); - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgb(68,68,68)), color-stop(50%,rgb(52,52,52)), color-stop(50%,rgb(41,41,41)), color-stop(100%,rgb(51,51,51))); - background: -webkit-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); - background: -o-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); - background: -ms-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); - background: linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#444444', endColorstr='#222222',GradientType=0 ); -} - -#fancybox-buttons ul li { - float: left; - margin: 0; - padding: 0; -} - -#fancybox-buttons a { - display: block; - width: 30px; - height: 30px; - text-indent: -9999px; - background-image: url('fancybox_buttons.png'); - background-repeat: no-repeat; - outline: none; - opacity: 0.8; -} - -#fancybox-buttons a:hover { - opacity: 1; -} - -#fancybox-buttons a.btnPrev { - background-position: 5px 0; -} - -#fancybox-buttons a.btnNext { - background-position: -33px 0; - border-right: 1px solid #3e3e3e; -} - -#fancybox-buttons a.btnPlay { - background-position: 0 -30px; -} - -#fancybox-buttons a.btnPlayOn { - background-position: -30px -30px; -} - -#fancybox-buttons a.btnToggle { - background-position: 3px -60px; - border-left: 1px solid #111; - border-right: 1px solid #3e3e3e; - width: 35px -} - -#fancybox-buttons a.btnToggleOn { - background-position: -27px -60px; -} - -#fancybox-buttons a.btnClose { - border-left: 1px solid #111; - width: 35px; - background-position: -56px 0px; -} - -#fancybox-buttons a.btnDisabled { - opacity : 0.4; - cursor: default; -} +#fancybox-buttons { + position: fixed; + left: 0; + width: 100%; + z-index: 8050; +} + +#fancybox-buttons.top { + top: 10px; +} + +#fancybox-buttons.bottom { + bottom: 10px; +} + +#fancybox-buttons ul { + display: block; + width: 166px; + height: 30px; + margin: 0 auto; + padding: 0; + list-style: none; + border: 1px solid #111; + border-radius: 3px; + -webkit-box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); + -moz-box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); + box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); + background: rgb(50,50,50); + background: -moz-linear-gradient(top, rgb(68,68,68) 0%, rgb(52,52,52) 50%, rgb(41,41,41) 50%, rgb(51,51,51) 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgb(68,68,68)), color-stop(50%,rgb(52,52,52)), color-stop(50%,rgb(41,41,41)), color-stop(100%,rgb(51,51,51))); + background: -webkit-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); + background: -o-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); + background: -ms-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); + background: linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#444444', endColorstr='#222222',GradientType=0 ); +} + +#fancybox-buttons ul li { + float: left; + margin: 0; + padding: 0; +} + +#fancybox-buttons a { + display: block; + width: 30px; + height: 30px; + text-indent: -9999px; + background-image: url('fancybox_buttons.png'); + background-repeat: no-repeat; + outline: none; + opacity: 0.8; +} + +#fancybox-buttons a:hover { + opacity: 1; +} + +#fancybox-buttons a.btnPrev { + background-position: 5px 0; +} + +#fancybox-buttons a.btnNext { + background-position: -33px 0; + border-right: 1px solid #3e3e3e; +} + +#fancybox-buttons a.btnPlay { + background-position: 0 -30px; +} + +#fancybox-buttons a.btnPlayOn { + background-position: -30px -30px; +} + +#fancybox-buttons a.btnToggle { + background-position: 3px -60px; + border-left: 1px solid #111; + border-right: 1px solid #3e3e3e; + width: 35px +} + +#fancybox-buttons a.btnToggleOn { + background-position: -27px -60px; +} + +#fancybox-buttons a.btnClose { + border-left: 1px solid #111; + width: 35px; + background-position: -56px 0px; +} + +#fancybox-buttons a.btnDisabled { + opacity : 0.4; + cursor: default; +} diff --git a/assets/modules/store/js/fancybox/helpers/jquery.fancybox-buttons.js b/assets/modules/store/js/fancybox/helpers/jquery.fancybox-buttons.js index a31a4932c6..ff5acc93b0 100755 --- a/assets/modules/store/js/fancybox/helpers/jquery.fancybox-buttons.js +++ b/assets/modules/store/js/fancybox/helpers/jquery.fancybox-buttons.js @@ -1,121 +1,121 @@ - /*! - * Buttons helper for fancyBox - * version: 1.0.5 (Mon, 15 Oct 2012) - * @requires fancyBox v2.0 or later - * - * Usage: - * $(".fancybox").fancybox({ - * helpers : { - * buttons: { - * position : 'top' - * } - * } - * }); - * - */ -(function ($) { - //Shortcut for fancyBox object - var F = $.fancybox; - - //Add helper object - F.helpers.buttons = { - defaults : { - skipSingle : false, // disables if gallery contains single image - position : 'top', // 'top' or 'bottom' - tpl : '
              ' - }, - - list : null, - buttons: null, - - beforeLoad: function (opts, obj) { - //Remove self if gallery do not have at least two items - - if (opts.skipSingle && obj.group.length < 2) { - obj.helpers.buttons = false; - obj.closeBtn = true; - - return; - } - - //Increase top margin to give space for buttons - obj.margin[ opts.position === 'bottom' ? 2 : 0 ] += 30; - }, - - onPlayStart: function () { - if (this.buttons) { - this.buttons.play.attr('title', 'Pause slideshow').addClass('btnPlayOn'); - } - }, - - onPlayEnd: function () { - if (this.buttons) { - this.buttons.play.attr('title', 'Start slideshow').removeClass('btnPlayOn'); - } - }, - - afterShow: function (opts, obj) { - var buttons = this.buttons; - - if (!buttons) { - this.list = $(opts.tpl).addClass(opts.position).appendTo('body'); - - buttons = { - prev : this.list.find('.btnPrev').click( F.prev ), - next : this.list.find('.btnNext').click( F.next ), - play : this.list.find('.btnPlay').click( F.play ), - toggle : this.list.find('.btnToggle').click( F.toggle ) - } - } - - //Prev - if (obj.index > 0 || obj.loop) { - buttons.prev.removeClass('btnDisabled'); - } else { - buttons.prev.addClass('btnDisabled'); - } - - //Next / Play - if (obj.loop || obj.index < obj.group.length - 1) { - buttons.next.removeClass('btnDisabled'); - buttons.play.removeClass('btnDisabled'); - - } else { - buttons.next.addClass('btnDisabled'); - buttons.play.addClass('btnDisabled'); - } - - this.buttons = buttons; - - this.onUpdate(opts, obj); - }, - - onUpdate: function (opts, obj) { - var toggle; - - if (!this.buttons) { - return; - } - - toggle = this.buttons.toggle.removeClass('btnDisabled btnToggleOn'); - - //Size toggle button - if (obj.canShrink) { - toggle.addClass('btnToggleOn'); - - } else if (!obj.canExpand) { - toggle.addClass('btnDisabled'); - } - }, - - beforeClose: function () { - if (this.list) { - this.list.remove(); - } - - this.list = null; - this.buttons = null; - } - }; - -}(jQuery)); + /*! + * Buttons helper for fancyBox + * version: 1.0.5 (Mon, 15 Oct 2012) + * @requires fancyBox v2.0 or later + * + * Usage: + * $(".fancybox").fancybox({ + * helpers : { + * buttons: { + * position : 'top' + * } + * } + * }); + * + */ +(function ($) { + //Shortcut for fancyBox object + var F = $.fancybox; + + //Add helper object + F.helpers.buttons = { + defaults : { + skipSingle : false, // disables if gallery contains single image + position : 'top', // 'top' or 'bottom' + tpl : '
              ' + }, + + list : null, + buttons: null, + + beforeLoad: function (opts, obj) { + //Remove self if gallery do not have at least two items + + if (opts.skipSingle && obj.group.length < 2) { + obj.helpers.buttons = false; + obj.closeBtn = true; + + return; + } + + //Increase top margin to give space for buttons + obj.margin[ opts.position === 'bottom' ? 2 : 0 ] += 30; + }, + + onPlayStart: function () { + if (this.buttons) { + this.buttons.play.attr('title', 'Pause slideshow').addClass('btnPlayOn'); + } + }, + + onPlayEnd: function () { + if (this.buttons) { + this.buttons.play.attr('title', 'Start slideshow').removeClass('btnPlayOn'); + } + }, + + afterShow: function (opts, obj) { + var buttons = this.buttons; + + if (!buttons) { + this.list = $(opts.tpl).addClass(opts.position).appendTo('body'); + + buttons = { + prev : this.list.find('.btnPrev').click( F.prev ), + next : this.list.find('.btnNext').click( F.next ), + play : this.list.find('.btnPlay').click( F.play ), + toggle : this.list.find('.btnToggle').click( F.toggle ) + } + } + + //Prev + if (obj.index > 0 || obj.loop) { + buttons.prev.removeClass('btnDisabled'); + } else { + buttons.prev.addClass('btnDisabled'); + } + + //Next / Play + if (obj.loop || obj.index < obj.group.length - 1) { + buttons.next.removeClass('btnDisabled'); + buttons.play.removeClass('btnDisabled'); + + } else { + buttons.next.addClass('btnDisabled'); + buttons.play.addClass('btnDisabled'); + } + + this.buttons = buttons; + + this.onUpdate(opts, obj); + }, + + onUpdate: function (opts, obj) { + var toggle; + + if (!this.buttons) { + return; + } + + toggle = this.buttons.toggle.removeClass('btnDisabled btnToggleOn'); + + //Size toggle button + if (obj.canShrink) { + toggle.addClass('btnToggleOn'); + + } else if (!obj.canExpand) { + toggle.addClass('btnDisabled'); + } + }, + + beforeClose: function () { + if (this.list) { + this.list.remove(); + } + + this.list = null; + this.buttons = null; + } + }; + +}(jQuery)); diff --git a/assets/modules/store/js/fancybox/helpers/jquery.fancybox-media.js b/assets/modules/store/js/fancybox/helpers/jquery.fancybox-media.js index 2ec984d18f..88cc165c7e 100755 --- a/assets/modules/store/js/fancybox/helpers/jquery.fancybox-media.js +++ b/assets/modules/store/js/fancybox/helpers/jquery.fancybox-media.js @@ -1,196 +1,196 @@ -/*! - * Media helper for fancyBox - * version: 1.0.5 (Tue, 23 Oct 2012) - * @requires fancyBox v2.0 or later - * - * Usage: - * $(".fancybox").fancybox({ - * helpers : { - * media: true - * } - * }); - * - * Set custom URL parameters: - * $(".fancybox").fancybox({ - * helpers : { - * media: { - * youtube : { - * params : { - * autoplay : 0 - * } - * } - * } - * } - * }); - * - * Or: - * $(".fancybox").fancybox({, - * helpers : { - * media: true - * }, - * youtube : { - * autoplay: 0 - * } - * }); - * - * Supports: - * - * Youtube - * http://www.youtube.com/watch?v=opj24KnzrWo - * http://www.youtube.com/embed/opj24KnzrWo - * http://youtu.be/opj24KnzrWo - * Vimeo - * http://vimeo.com/40648169 - * http://vimeo.com/channels/staffpicks/38843628 - * http://vimeo.com/groups/surrealism/videos/36516384 - * http://player.vimeo.com/video/45074303 - * Metacafe - * http://www.metacafe.com/watch/7635964/dr_seuss_the_lorax_movie_trailer/ - * http://www.metacafe.com/watch/7635964/ - * Dailymotion - * http://www.dailymotion.com/video/xoytqh_dr-seuss-the-lorax-premiere_people - * Twitvid - * http://twitvid.com/QY7MD - * Twitpic - * http://twitpic.com/7p93st - * Instagram - * http://instagr.am/p/IejkuUGxQn/ - * http://instagram.com/p/IejkuUGxQn/ - * Google maps - * http://maps.google.com/maps?q=Eiffel+Tower,+Avenue+Gustave+Eiffel,+Paris,+France&t=h&z=17 - * http://maps.google.com/?ll=48.857995,2.294297&spn=0.007666,0.021136&t=m&z=16 - * http://maps.google.com/?ll=48.859463,2.292626&spn=0.000965,0.002642&t=m&z=19&layer=c&cbll=48.859524,2.292532&panoid=YJ0lq28OOy3VT2IqIuVY0g&cbp=12,151.58,,0,-15.56 - */ -(function ($) { - "use strict"; - - //Shortcut for fancyBox object - var F = $.fancybox, - format = function( url, rez, params ) { - params = params || ''; - - if ( $.type( params ) === "object" ) { - params = $.param(params, true); - } - - $.each(rez, function(key, value) { - url = url.replace( '$' + key, value || '' ); - }); - - if (params.length) { - url += ( url.indexOf('?') > 0 ? '&' : '?' ) + params; - } - - return url; - }; - - //Add helper object - F.helpers.media = { - defaults : { - youtube : { - matcher : /(youtube\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*)).*/i, - params : { - autoplay : 1, - autohide : 1, - fs : 1, - rel : 0, - hd : 1, - wmode : 'opaque', - enablejsapi : 1 - }, - type : 'iframe', - url : '//www.youtube.com/embed/$3' - }, - vimeo : { - matcher : /(?:vimeo(?:pro)?.com)\/(?:[^\d]+)?(\d+)(?:.*)/, - params : { - autoplay : 1, - hd : 1, - show_title : 1, - show_byline : 1, - show_portrait : 0, - fullscreen : 1 - }, - type : 'iframe', - url : '//player.vimeo.com/video/$1' - }, - metacafe : { - matcher : /metacafe.com\/(?:watch|fplayer)\/([\w\-]{1,10})/, - params : { - autoPlay : 'yes' - }, - type : 'swf', - url : function( rez, params, obj ) { - obj.swf.flashVars = 'playerVars=' + $.param( params, true ); - - return '//www.metacafe.com/fplayer/' + rez[1] + '/.swf'; - } - }, - dailymotion : { - matcher : /dailymotion.com\/video\/(.*)\/?(.*)/, - params : { - additionalInfos : 0, - autoStart : 1 - }, - type : 'swf', - url : '//www.dailymotion.com/swf/video/$1' - }, - twitvid : { - matcher : /twitvid\.com\/([a-zA-Z0-9_\-\?\=]+)/i, - params : { - autoplay : 0 - }, - type : 'iframe', - url : '//www.twitvid.com/embed.php?guid=$1' - }, - twitpic : { - matcher : /twitpic\.com\/(?!(?:place|photos|events)\/)([a-zA-Z0-9\?\=\-]+)/i, - type : 'image', - url : '//twitpic.com/show/full/$1/' - }, - instagram : { - matcher : /(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i, - type : 'image', - url : '//$1/p/$2/media/' - }, - google_maps : { - matcher : /maps\.google\.([a-z]{2,3}(\.[a-z]{2})?)\/(\?ll=|maps\?)(.*)/i, - type : 'iframe', - url : function( rez ) { - return '//maps.google.' + rez[1] + '/' + rez[3] + '' + rez[4] + '&output=' + (rez[4].indexOf('layer=c') > 0 ? 'svembed' : 'embed'); - } - } - }, - - beforeLoad : function(opts, obj) { - var url = obj.href || '', - type = false, - what, - item, - rez, - params; - - for (what in opts) { - item = opts[ what ]; - rez = url.match( item.matcher ); - - if (rez) { - type = item.type; - params = $.extend(true, {}, item.params, obj[ what ] || ($.isPlainObject(opts[ what ]) ? opts[ what ].params : null)); - - url = $.type( item.url ) === "function" ? item.url.call( this, rez, params, obj ) : format( item.url, rez, params ); - - break; - } - } - - if (type) { - obj.href = url; - obj.type = type; - - obj.autoHeight = false; - } - } - }; - -}(jQuery)); +/*! + * Media helper for fancyBox + * version: 1.0.5 (Tue, 23 Oct 2012) + * @requires fancyBox v2.0 or later + * + * Usage: + * $(".fancybox").fancybox({ + * helpers : { + * media: true + * } + * }); + * + * Set custom URL parameters: + * $(".fancybox").fancybox({ + * helpers : { + * media: { + * youtube : { + * params : { + * autoplay : 0 + * } + * } + * } + * } + * }); + * + * Or: + * $(".fancybox").fancybox({, + * helpers : { + * media: true + * }, + * youtube : { + * autoplay: 0 + * } + * }); + * + * Supports: + * + * Youtube + * http://www.youtube.com/watch?v=opj24KnzrWo + * http://www.youtube.com/embed/opj24KnzrWo + * http://youtu.be/opj24KnzrWo + * Vimeo + * http://vimeo.com/40648169 + * http://vimeo.com/channels/staffpicks/38843628 + * http://vimeo.com/groups/surrealism/videos/36516384 + * http://player.vimeo.com/video/45074303 + * Metacafe + * http://www.metacafe.com/watch/7635964/dr_seuss_the_lorax_movie_trailer/ + * http://www.metacafe.com/watch/7635964/ + * Dailymotion + * http://www.dailymotion.com/video/xoytqh_dr-seuss-the-lorax-premiere_people + * Twitvid + * http://twitvid.com/QY7MD + * Twitpic + * http://twitpic.com/7p93st + * Instagram + * http://instagr.am/p/IejkuUGxQn/ + * http://instagram.com/p/IejkuUGxQn/ + * Google maps + * http://maps.google.com/maps?q=Eiffel+Tower,+Avenue+Gustave+Eiffel,+Paris,+France&t=h&z=17 + * http://maps.google.com/?ll=48.857995,2.294297&spn=0.007666,0.021136&t=m&z=16 + * http://maps.google.com/?ll=48.859463,2.292626&spn=0.000965,0.002642&t=m&z=19&layer=c&cbll=48.859524,2.292532&panoid=YJ0lq28OOy3VT2IqIuVY0g&cbp=12,151.58,,0,-15.56 + */ +(function ($) { + "use strict"; + + //Shortcut for fancyBox object + var F = $.fancybox, + format = function( url, rez, params ) { + params = params || ''; + + if ( $.type( params ) === "object" ) { + params = $.param(params, true); + } + + $.each(rez, function(key, value) { + url = url.replace( '$' + key, value || '' ); + }); + + if (params.length) { + url += ( url.indexOf('?') > 0 ? '&' : '?' ) + params; + } + + return url; + }; + + //Add helper object + F.helpers.media = { + defaults : { + youtube : { + matcher : /(youtube\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*)).*/i, + params : { + autoplay : 1, + autohide : 1, + fs : 1, + rel : 0, + hd : 1, + wmode : 'opaque', + enablejsapi : 1 + }, + type : 'iframe', + url : '//www.youtube.com/embed/$3' + }, + vimeo : { + matcher : /(?:vimeo(?:pro)?.com)\/(?:[^\d]+)?(\d+)(?:.*)/, + params : { + autoplay : 1, + hd : 1, + show_title : 1, + show_byline : 1, + show_portrait : 0, + fullscreen : 1 + }, + type : 'iframe', + url : '//player.vimeo.com/video/$1' + }, + metacafe : { + matcher : /metacafe.com\/(?:watch|fplayer)\/([\w\-]{1,10})/, + params : { + autoPlay : 'yes' + }, + type : 'swf', + url : function( rez, params, obj ) { + obj.swf.flashVars = 'playerVars=' + $.param( params, true ); + + return '//www.metacafe.com/fplayer/' + rez[1] + '/.swf'; + } + }, + dailymotion : { + matcher : /dailymotion.com\/video\/(.*)\/?(.*)/, + params : { + additionalInfos : 0, + autoStart : 1 + }, + type : 'swf', + url : '//www.dailymotion.com/swf/video/$1' + }, + twitvid : { + matcher : /twitvid\.com\/([a-zA-Z0-9_\-\?\=]+)/i, + params : { + autoplay : 0 + }, + type : 'iframe', + url : '//www.twitvid.com/embed.php?guid=$1' + }, + twitpic : { + matcher : /twitpic\.com\/(?!(?:place|photos|events)\/)([a-zA-Z0-9\?\=\-]+)/i, + type : 'image', + url : '//twitpic.com/show/full/$1/' + }, + instagram : { + matcher : /(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i, + type : 'image', + url : '//$1/p/$2/media/' + }, + google_maps : { + matcher : /maps\.google\.([a-z]{2,3}(\.[a-z]{2})?)\/(\?ll=|maps\?)(.*)/i, + type : 'iframe', + url : function( rez ) { + return '//maps.google.' + rez[1] + '/' + rez[3] + '' + rez[4] + '&output=' + (rez[4].indexOf('layer=c') > 0 ? 'svembed' : 'embed'); + } + } + }, + + beforeLoad : function(opts, obj) { + var url = obj.href || '', + type = false, + what, + item, + rez, + params; + + for (what in opts) { + item = opts[ what ]; + rez = url.match( item.matcher ); + + if (rez) { + type = item.type; + params = $.extend(true, {}, item.params, obj[ what ] || ($.isPlainObject(opts[ what ]) ? opts[ what ].params : null)); + + url = $.type( item.url ) === "function" ? item.url.call( this, rez, params, obj ) : format( item.url, rez, params ); + + break; + } + } + + if (type) { + obj.href = url; + obj.type = type; + + obj.autoHeight = false; + } + } + }; + +}(jQuery)); diff --git a/assets/modules/store/js/fancybox/helpers/jquery.fancybox-thumbs.css b/assets/modules/store/js/fancybox/helpers/jquery.fancybox-thumbs.css index 7cc3e016d1..a53272057d 100755 --- a/assets/modules/store/js/fancybox/helpers/jquery.fancybox-thumbs.css +++ b/assets/modules/store/js/fancybox/helpers/jquery.fancybox-thumbs.css @@ -1,54 +1,54 @@ -#fancybox-thumbs { - position: fixed; - left: 0; - width: 100%; - overflow: hidden; - z-index: 8050; -} - -#fancybox-thumbs.bottom { - bottom: 2px; -} - -#fancybox-thumbs.top { - top: 2px; -} - -#fancybox-thumbs ul { - position: relative; - list-style: none; - margin: 0; - padding: 0; -} - -#fancybox-thumbs ul li { - float: left; - padding: 1px; - opacity: 0.5; -} - -#fancybox-thumbs ul li.active { - opacity: 0.75; - padding: 0; - border: 1px solid #fff; -} - -#fancybox-thumbs ul li:hover { - opacity: 1; -} - -#fancybox-thumbs ul li a { - display: block; - position: relative; - overflow: hidden; - border: 1px solid #222; - background: #111; - outline: none; -} - -#fancybox-thumbs ul li img { - display: block; - position: relative; - border: 0; - padding: 0; -} +#fancybox-thumbs { + position: fixed; + left: 0; + width: 100%; + overflow: hidden; + z-index: 8050; +} + +#fancybox-thumbs.bottom { + bottom: 2px; +} + +#fancybox-thumbs.top { + top: 2px; +} + +#fancybox-thumbs ul { + position: relative; + list-style: none; + margin: 0; + padding: 0; +} + +#fancybox-thumbs ul li { + float: left; + padding: 1px; + opacity: 0.5; +} + +#fancybox-thumbs ul li.active { + opacity: 0.75; + padding: 0; + border: 1px solid #fff; +} + +#fancybox-thumbs ul li:hover { + opacity: 1; +} + +#fancybox-thumbs ul li a { + display: block; + position: relative; + overflow: hidden; + border: 1px solid #222; + background: #111; + outline: none; +} + +#fancybox-thumbs ul li img { + display: block; + position: relative; + border: 0; + padding: 0; +} diff --git a/assets/modules/store/js/fancybox/helpers/jquery.fancybox-thumbs.js b/assets/modules/store/js/fancybox/helpers/jquery.fancybox-thumbs.js index c7a7c7904a..81744578b9 100755 --- a/assets/modules/store/js/fancybox/helpers/jquery.fancybox-thumbs.js +++ b/assets/modules/store/js/fancybox/helpers/jquery.fancybox-thumbs.js @@ -1,162 +1,162 @@ - /*! - * Thumbnail helper for fancyBox - * version: 1.0.7 (Mon, 01 Oct 2012) - * @requires fancyBox v2.0 or later - * - * Usage: - * $(".fancybox").fancybox({ - * helpers : { - * thumbs: { - * width : 50, - * height : 50 - * } - * } - * }); - * - */ -(function ($) { - //Shortcut for fancyBox object - var F = $.fancybox; - - //Add helper object - F.helpers.thumbs = { - defaults : { - width : 50, // thumbnail width - height : 50, // thumbnail height - position : 'bottom', // 'top' or 'bottom' - source : function ( item ) { // function to obtain the URL of the thumbnail image - var href; - - if (item.element) { - href = $(item.element).find('img').attr('src'); - } - - if (!href && item.type === 'image' && item.href) { - href = item.href; - } - - return href; - } - }, - - wrap : null, - list : null, - width : 0, - - init: function (opts, obj) { - var that = this, - list, - thumbWidth = opts.width, - thumbHeight = opts.height, - thumbSource = opts.source; - - //Build list structure - list = ''; - - for (var n = 0; n < obj.group.length; n++) { - list += '
            • '; - } - - this.wrap = $('
              ').addClass(opts.position).appendTo('body'); - this.list = $('
                ' + list + '
              ').appendTo(this.wrap); - - //Load each thumbnail - $.each(obj.group, function (i) { - var href = thumbSource( obj.group[ i ] ); - - if (!href) { - return; - } - - $("").load(function () { - var width = this.width, - height = this.height, - widthRatio, heightRatio, parent; - - if (!that.list || !width || !height) { - return; - } - - //Calculate thumbnail width/height and center it - widthRatio = width / thumbWidth; - heightRatio = height / thumbHeight; - - parent = that.list.children().eq(i).find('a'); - - if (widthRatio >= 1 && heightRatio >= 1) { - if (widthRatio > heightRatio) { - width = Math.floor(width / heightRatio); - height = thumbHeight; - - } else { - width = thumbWidth; - height = Math.floor(height / widthRatio); - } - } - - $(this).css({ - width : width, - height : height, - top : Math.floor(thumbHeight / 2 - height / 2), - left : Math.floor(thumbWidth / 2 - width / 2) - }); - - parent.width(thumbWidth).height(thumbHeight); - - $(this).hide().appendTo(parent).fadeIn(300); - - }).attr('src', href); - }); - - //Set initial width - this.width = this.list.children().eq(0).outerWidth(true); - - this.list.width(this.width * (obj.group.length + 1)).css('left', Math.floor($(window).width() * 0.5 - (obj.index * this.width + this.width * 0.5))); - }, - - beforeLoad: function (opts, obj) { - //Remove self if gallery do not have at least two items - if (obj.group.length < 2) { - obj.helpers.thumbs = false; - - return; - } - - //Increase bottom margin to give space for thumbs - obj.margin[ opts.position === 'top' ? 0 : 2 ] += ((opts.height) + 15); - }, - - afterShow: function (opts, obj) { - //Check if exists and create or update list - if (this.list) { - this.onUpdate(opts, obj); - - } else { - this.init(opts, obj); - } - - //Set active element - this.list.children().removeClass('active').eq(obj.index).addClass('active'); - }, - - //Center list - onUpdate: function (opts, obj) { - if (this.list) { - this.list.stop(true).animate({ - 'left': Math.floor($(window).width() * 0.5 - (obj.index * this.width + this.width * 0.5)) - }, 150); - } - }, - - beforeClose: function () { - if (this.wrap) { - this.wrap.remove(); - } - - this.wrap = null; - this.list = null; - this.width = 0; - } - } - -}(jQuery)); + /*! + * Thumbnail helper for fancyBox + * version: 1.0.7 (Mon, 01 Oct 2012) + * @requires fancyBox v2.0 or later + * + * Usage: + * $(".fancybox").fancybox({ + * helpers : { + * thumbs: { + * width : 50, + * height : 50 + * } + * } + * }); + * + */ +(function ($) { + //Shortcut for fancyBox object + var F = $.fancybox; + + //Add helper object + F.helpers.thumbs = { + defaults : { + width : 50, // thumbnail width + height : 50, // thumbnail height + position : 'bottom', // 'top' or 'bottom' + source : function ( item ) { // function to obtain the URL of the thumbnail image + var href; + + if (item.element) { + href = $(item.element).find('img').attr('src'); + } + + if (!href && item.type === 'image' && item.href) { + href = item.href; + } + + return href; + } + }, + + wrap : null, + list : null, + width : 0, + + init: function (opts, obj) { + var that = this, + list, + thumbWidth = opts.width, + thumbHeight = opts.height, + thumbSource = opts.source; + + //Build list structure + list = ''; + + for (var n = 0; n < obj.group.length; n++) { + list += '
            • '; + } + + this.wrap = $('
              ').addClass(opts.position).appendTo('body'); + this.list = $('
                ' + list + '
              ').appendTo(this.wrap); + + //Load each thumbnail + $.each(obj.group, function (i) { + var href = thumbSource( obj.group[ i ] ); + + if (!href) { + return; + } + + $("").load(function () { + var width = this.width, + height = this.height, + widthRatio, heightRatio, parent; + + if (!that.list || !width || !height) { + return; + } + + //Calculate thumbnail width/height and center it + widthRatio = width / thumbWidth; + heightRatio = height / thumbHeight; + + parent = that.list.children().eq(i).find('a'); + + if (widthRatio >= 1 && heightRatio >= 1) { + if (widthRatio > heightRatio) { + width = Math.floor(width / heightRatio); + height = thumbHeight; + + } else { + width = thumbWidth; + height = Math.floor(height / widthRatio); + } + } + + $(this).css({ + width : width, + height : height, + top : Math.floor(thumbHeight / 2 - height / 2), + left : Math.floor(thumbWidth / 2 - width / 2) + }); + + parent.width(thumbWidth).height(thumbHeight); + + $(this).hide().appendTo(parent).fadeIn(300); + + }).attr('src', href); + }); + + //Set initial width + this.width = this.list.children().eq(0).outerWidth(true); + + this.list.width(this.width * (obj.group.length + 1)).css('left', Math.floor($(window).width() * 0.5 - (obj.index * this.width + this.width * 0.5))); + }, + + beforeLoad: function (opts, obj) { + //Remove self if gallery do not have at least two items + if (obj.group.length < 2) { + obj.helpers.thumbs = false; + + return; + } + + //Increase bottom margin to give space for thumbs + obj.margin[ opts.position === 'top' ? 0 : 2 ] += ((opts.height) + 15); + }, + + afterShow: function (opts, obj) { + //Check if exists and create or update list + if (this.list) { + this.onUpdate(opts, obj); + + } else { + this.init(opts, obj); + } + + //Set active element + this.list.children().removeClass('active').eq(obj.index).addClass('active'); + }, + + //Center list + onUpdate: function (opts, obj) { + if (this.list) { + this.list.stop(true).animate({ + 'left': Math.floor($(window).width() * 0.5 - (obj.index * this.width + this.width * 0.5)) + }, 150); + } + }, + + beforeClose: function () { + if (this.wrap) { + this.wrap.remove(); + } + + this.wrap = null; + this.list = null; + this.width = 0; + } + } + +}(jQuery)); diff --git a/assets/modules/store/js/fancybox/jquery.fancybox.css b/assets/modules/store/js/fancybox/jquery.fancybox.css index 37e921b4c6..11e14e7c3d 100755 --- a/assets/modules/store/js/fancybox/jquery.fancybox.css +++ b/assets/modules/store/js/fancybox/jquery.fancybox.css @@ -1,249 +1,249 @@ -/*! fancyBox v2.1.4 fancyapps.com | fancyapps.com/fancybox/#license */ -.fancybox-wrap, -.fancybox-skin, -.fancybox-outer, -.fancybox-inner, -.fancybox-image, -.fancybox-wrap iframe, -.fancybox-wrap object, -.fancybox-nav, -.fancybox-nav span, -.fancybox-tmp -{ - padding: 0; - margin: 0; - border: 0; - outline: none; - vertical-align: top; -} - -.fancybox-wrap { - position: absolute; - top: 0; - left: 0; - z-index: 8020; -} - -.fancybox-skin { - position: relative; - background: #fff; - color: #444; - text-shadow: none; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; -} - -.fancybox-opened { - z-index: 8030; -} - -.fancybox-opened .fancybox-skin { - -webkit-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); - -moz-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); - box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); -} - -.fancybox-outer, .fancybox-inner { - position: relative; -} - -.fancybox-inner { - overflow: hidden; -} - -.fancybox-type-iframe .fancybox-inner { - -webkit-overflow-scrolling: touch; -} - -.fancybox-error { - color: #444; - font: 14px/20px "Helvetica Neue",Helvetica,Arial,sans-serif; - margin: 0; - padding: 15px; - white-space: nowrap; -} - -.fancybox-image, .fancybox-iframe { - display: block; - width: 100%; - height: 100%; -} - -.fancybox-image { - max-width: 100%; - max-height: 100%; -} - -#fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span { - background-image: url('fancybox_sprite.png'); -} - -#fancybox-loading { - position: fixed; - top: 50%; - left: 50%; - margin-top: -22px; - margin-left: -22px; - background-position: 0 -108px; - opacity: 0.8; - cursor: pointer; - z-index: 8060; -} - -#fancybox-loading div { - width: 44px; - height: 44px; - background: url('fancybox_loading.gif') center center no-repeat; -} - -.fancybox-close { - position: absolute; - top: -18px; - right: -18px; - width: 36px; - height: 36px; - cursor: pointer; - z-index: 8040; -} - -.fancybox-nav { - position: absolute; - top: 0; - width: 40%; - height: 100%; - cursor: pointer; - text-decoration: none; - background: transparent url('blank.gif'); /* helps IE */ - -webkit-tap-highlight-color: rgba(0,0,0,0); - z-index: 8040; -} - -.fancybox-prev { - left: 0; -} - -.fancybox-next { - right: 0; -} - -.fancybox-nav span { - position: absolute; - top: 50%; - width: 36px; - height: 34px; - margin-top: -18px; - cursor: pointer; - z-index: 8040; - visibility: hidden; -} - -.fancybox-prev span { - left: 10px; - background-position: 0 -36px; -} - -.fancybox-next span { - right: 10px; - background-position: 0 -72px; -} - -.fancybox-nav:hover span { - visibility: visible; -} - -.fancybox-tmp { - position: absolute; - top: -99999px; - left: -99999px; - visibility: hidden; - max-width: 99999px; - max-height: 99999px; - overflow: visible !important; -} - -/* Overlay helper */ - -.fancybox-lock { - overflow: hidden; -} - -.fancybox-overlay { - position: absolute; - top: 0; - left: 0; - overflow: hidden; - display: none; - z-index: 8010; - background: url('fancybox_overlay.png'); -} - -.fancybox-overlay-fixed { - position: fixed; - bottom: 0; - right: 0; -} - -.fancybox-lock .fancybox-overlay { - overflow: auto; - overflow-y: scroll; -} - -/* Title helper */ - -.fancybox-title { - visibility: hidden; - font: normal 13px/20px "Helvetica Neue",Helvetica,Arial,sans-serif; - position: relative; - text-shadow: none; - z-index: 8050; -} - -.fancybox-opened .fancybox-title { - visibility: visible; -} - -.fancybox-title-float-wrap { - position: absolute; - bottom: 0; - right: 50%; - margin-bottom: -35px; - z-index: 8050; - text-align: center; -} - -.fancybox-title-float-wrap .child { - display: inline-block; - margin-right: -100%; - padding: 2px 20px; - background: transparent; /* Fallback for web browsers that doesn't support RGBa */ - background: rgba(0, 0, 0, 0.8); - -webkit-border-radius: 15px; - -moz-border-radius: 15px; - border-radius: 15px; - text-shadow: 0 1px 2px #222; - color: #FFF; - font-weight: bold; - line-height: 24px; - white-space: nowrap; -} - -.fancybox-title-outside-wrap { - position: relative; - margin-top: 10px; - color: #fff; -} - -.fancybox-title-inside-wrap { - padding-top: 10px; -} - -.fancybox-title-over-wrap { - position: absolute; - bottom: 0; - left: 0; - color: #fff; - padding: 10px; - background: #000; - background: rgba(0, 0, 0, .8); -} +/*! fancyBox v2.1.4 fancyapps.com | fancyapps.com/fancybox/#license */ +.fancybox-wrap, +.fancybox-skin, +.fancybox-outer, +.fancybox-inner, +.fancybox-image, +.fancybox-wrap iframe, +.fancybox-wrap object, +.fancybox-nav, +.fancybox-nav span, +.fancybox-tmp +{ + padding: 0; + margin: 0; + border: 0; + outline: none; + vertical-align: top; +} + +.fancybox-wrap { + position: absolute; + top: 0; + left: 0; + z-index: 8020; +} + +.fancybox-skin { + position: relative; + background: #fff; + color: #444; + text-shadow: none; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} + +.fancybox-opened { + z-index: 8030; +} + +.fancybox-opened .fancybox-skin { + -webkit-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); + -moz-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); + box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); +} + +.fancybox-outer, .fancybox-inner { + position: relative; +} + +.fancybox-inner { + overflow: hidden; +} + +.fancybox-type-iframe .fancybox-inner { + -webkit-overflow-scrolling: touch; +} + +.fancybox-error { + color: #444; + font: 14px/20px "Helvetica Neue",Helvetica,Arial,sans-serif; + margin: 0; + padding: 15px; + white-space: nowrap; +} + +.fancybox-image, .fancybox-iframe { + display: block; + width: 100%; + height: 100%; +} + +.fancybox-image { + max-width: 100%; + max-height: 100%; +} + +#fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span { + background-image: url('fancybox_sprite.png'); +} + +#fancybox-loading { + position: fixed; + top: 50%; + left: 50%; + margin-top: -22px; + margin-left: -22px; + background-position: 0 -108px; + opacity: 0.8; + cursor: pointer; + z-index: 8060; +} + +#fancybox-loading div { + width: 44px; + height: 44px; + background: url('fancybox_loading.gif') center center no-repeat; +} + +.fancybox-close { + position: absolute; + top: -18px; + right: -18px; + width: 36px; + height: 36px; + cursor: pointer; + z-index: 8040; +} + +.fancybox-nav { + position: absolute; + top: 0; + width: 40%; + height: 100%; + cursor: pointer; + text-decoration: none; + background: transparent url('blank.gif'); /* helps IE */ + -webkit-tap-highlight-color: rgba(0,0,0,0); + z-index: 8040; +} + +.fancybox-prev { + left: 0; +} + +.fancybox-next { + right: 0; +} + +.fancybox-nav span { + position: absolute; + top: 50%; + width: 36px; + height: 34px; + margin-top: -18px; + cursor: pointer; + z-index: 8040; + visibility: hidden; +} + +.fancybox-prev span { + left: 10px; + background-position: 0 -36px; +} + +.fancybox-next span { + right: 10px; + background-position: 0 -72px; +} + +.fancybox-nav:hover span { + visibility: visible; +} + +.fancybox-tmp { + position: absolute; + top: -99999px; + left: -99999px; + visibility: hidden; + max-width: 99999px; + max-height: 99999px; + overflow: visible !important; +} + +/* Overlay helper */ + +.fancybox-lock { + overflow: hidden; +} + +.fancybox-overlay { + position: absolute; + top: 0; + left: 0; + overflow: hidden; + display: none; + z-index: 8010; + background: url('fancybox_overlay.png'); +} + +.fancybox-overlay-fixed { + position: fixed; + bottom: 0; + right: 0; +} + +.fancybox-lock .fancybox-overlay { + overflow: auto; + overflow-y: scroll; +} + +/* Title helper */ + +.fancybox-title { + visibility: hidden; + font: normal 13px/20px "Helvetica Neue",Helvetica,Arial,sans-serif; + position: relative; + text-shadow: none; + z-index: 8050; +} + +.fancybox-opened .fancybox-title { + visibility: visible; +} + +.fancybox-title-float-wrap { + position: absolute; + bottom: 0; + right: 50%; + margin-bottom: -35px; + z-index: 8050; + text-align: center; +} + +.fancybox-title-float-wrap .child { + display: inline-block; + margin-right: -100%; + padding: 2px 20px; + background: transparent; /* Fallback for web browsers that doesn't support RGBa */ + background: rgba(0, 0, 0, 0.8); + -webkit-border-radius: 15px; + -moz-border-radius: 15px; + border-radius: 15px; + text-shadow: 0 1px 2px #222; + color: #FFF; + font-weight: bold; + line-height: 24px; + white-space: nowrap; +} + +.fancybox-title-outside-wrap { + position: relative; + margin-top: 10px; + color: #fff; +} + +.fancybox-title-inside-wrap { + padding-top: 10px; +} + +.fancybox-title-over-wrap { + position: absolute; + bottom: 0; + left: 0; + color: #fff; + padding: 10px; + background: #000; + background: rgba(0, 0, 0, .8); +} diff --git a/assets/modules/store/js/fancybox/jquery.fancybox.pack.js b/assets/modules/store/js/fancybox/jquery.fancybox.pack.js index 95ce8050af..f1d24f5197 100755 --- a/assets/modules/store/js/fancybox/jquery.fancybox.pack.js +++ b/assets/modules/store/js/fancybox/jquery.fancybox.pack.js @@ -1,45 +1,45 @@ -/*! fancyBox v2.1.4 fancyapps.com | fancyapps.com/fancybox/#license */ -(function(C,z,f,r){var q=f(C),n=f(z),b=f.fancybox=function(){b.open.apply(this,arguments)},H=navigator.userAgent.match(/msie/),w=null,s=z.createTouch!==r,t=function(a){return a&&a.hasOwnProperty&&a instanceof f},p=function(a){return a&&"string"===f.type(a)},F=function(a){return p(a)&&0
              ',image:'',iframe:'",error:'

              The requested content cannot be loaded.
              Please try again later.

              ',closeBtn:'',next:'',prev:''},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:!0, -openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:!0,title:!0},onCancel:f.noop,beforeLoad:f.noop,afterLoad:f.noop,beforeShow:f.noop,afterShow:f.noop,beforeChange:f.noop,beforeClose:f.noop,afterClose:f.noop},group:{},opts:{},previous:null,coming:null,current:null,isActive:!1, -isOpen:!1,isOpened:!1,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(a,d){if(a&&(f.isPlainObject(d)||(d={}),!1!==b.close(!0)))return f.isArray(a)||(a=t(a)?f(a).get():[a]),f.each(a,function(e,c){var k={},g,h,j,m,l;"object"===f.type(c)&&(c.nodeType&&(c=f(c)),t(c)?(k={href:c.data("fancybox-href")||c.attr("href"),title:c.data("fancybox-title")||c.attr("title"),isDom:!0,element:c},f.metadata&&f.extend(!0,k, -c.metadata())):k=c);g=d.href||k.href||(p(c)?c:null);h=d.title!==r?d.title:k.title||"";m=(j=d.content||k.content)?"html":d.type||k.type;!m&&k.isDom&&(m=c.data("fancybox-type"),m||(m=(m=c.prop("class").match(/fancybox\.(\w+)/))?m[1]:null));p(g)&&(m||(b.isImage(g)?m="image":b.isSWF(g)?m="swf":"#"===g.charAt(0)?m="inline":p(c)&&(m="html",j=c)),"ajax"===m&&(l=g.split(/\s+/,2),g=l.shift(),l=l.shift()));j||("inline"===m?g?j=f(p(g)?g.replace(/.*(?=#[^\s]+$)/,""):g):k.isDom&&(j=c):"html"===m?j=g:!m&&(!g&& -k.isDom)&&(m="inline",j=c));f.extend(k,{href:g,type:m,content:j,title:h,selector:l});a[e]=k}),b.opts=f.extend(!0,{},b.defaults,d),d.keys!==r&&(b.opts.keys=d.keys?f.extend({},b.defaults.keys,d.keys):!1),b.group=a,b._start(b.opts.index)},cancel:function(){var a=b.coming;a&&!1!==b.trigger("onCancel")&&(b.hideLoading(),b.ajaxLoad&&b.ajaxLoad.abort(),b.ajaxLoad=null,b.imgPreload&&(b.imgPreload.onload=b.imgPreload.onerror=null),a.wrap&&a.wrap.stop(!0,!0).trigger("onReset").remove(),b.coming=null,b.current|| -b._afterZoomOut(a))},close:function(a){b.cancel();!1!==b.trigger("beforeClose")&&(b.unbindEvents(),b.isActive&&(!b.isOpen||!0===a?(f(".fancybox-wrap").stop(!0).trigger("onReset").remove(),b._afterZoomOut()):(b.isOpen=b.isOpened=!1,b.isClosing=!0,f(".fancybox-item, .fancybox-nav").remove(),b.wrap.stop(!0,!0).removeClass("fancybox-opened"),b.transitions[b.current.closeMethod]())))},play:function(a){var d=function(){clearTimeout(b.player.timer)},e=function(){d();b.current&&b.player.isActive&&(b.player.timer= -setTimeout(b.next,b.current.playSpeed))},c=function(){d();f("body").unbind(".player");b.player.isActive=!1;b.trigger("onPlayEnd")};if(!0===a||!b.player.isActive&&!1!==a){if(b.current&&(b.current.loop||b.current.index=c.index?"next":"prev"],b.router=e||"jumpto",c.loop&&(0>a&&(a=c.group.length+a%c.group.length),a%=c.group.length),c.group[a]!==r&&(b.cancel(),b._start(a)))},reposition:function(a,d){var e=b.current,c=e?e.wrap:null,k;c&&(k=b._getPosition(d),a&&"scroll"===a.type?(delete k.position,c.stop(!0,!0).animate(k,200)):(c.css(k),e.pos=f.extend({}, -e.dim,k)))},update:function(a){var d=a&&a.type,e=!d||"orientationchange"===d;e&&(clearTimeout(w),w=null);b.isOpen&&!w&&(w=setTimeout(function(){var c=b.current;c&&!b.isClosing&&(b.wrap.removeClass("fancybox-tmp"),(e||"load"===d||"resize"===d&&c.autoResize)&&b._setDimension(),"scroll"===d&&c.canShrink||b.reposition(a),b.trigger("onUpdate"),w=null)},e&&!s?0:300))},toggle:function(a){b.isOpen&&(b.current.fitToView="boolean"===f.type(a)?a:!b.current.fitToView,s&&(b.wrap.removeAttr("style").addClass("fancybox-tmp"), -b.trigger("onUpdate")),b.update())},hideLoading:function(){n.unbind(".loading");f("#fancybox-loading").remove()},showLoading:function(){var a,d;b.hideLoading();a=f('
              ').click(b.cancel).appendTo("body");n.bind("keydown.loading",function(a){if(27===(a.which||a.keyCode))a.preventDefault(),b.cancel()});b.defaults.fixed||(d=b.getViewport(),a.css({position:"absolute",top:0.5*d.h+d.y,left:0.5*d.w+d.x}))},getViewport:function(){var a=b.current&&b.current.locked|| -!1,d={x:q.scrollLeft(),y:q.scrollTop()};a?(d.w=a[0].clientWidth,d.h=a[0].clientHeight):(d.w=s&&C.innerWidth?C.innerWidth:q.width(),d.h=s&&C.innerHeight?C.innerHeight:q.height());return d},unbindEvents:function(){b.wrap&&t(b.wrap)&&b.wrap.unbind(".fb");n.unbind(".fb");q.unbind(".fb")},bindEvents:function(){var a=b.current,d;a&&(q.bind("orientationchange.fb"+(s?"":" resize.fb")+(a.autoCenter&&!a.locked?" scroll.fb":""),b.update),(d=a.keys)&&n.bind("keydown.fb",function(e){var c=e.which||e.keyCode,k= -e.target||e.srcElement;if(27===c&&b.coming)return!1;!e.ctrlKey&&(!e.altKey&&!e.shiftKey&&!e.metaKey&&(!k||!k.type&&!f(k).is("[contenteditable]")))&&f.each(d,function(d,k){if(1h[0].clientWidth||h[0].clientHeight&&h[0].scrollHeight>h[0].clientHeight),h=f(h).parent();if(0!==c&&!j&&1g||0>k)b.next(0>g?"up":"right");d.preventDefault()}}))},trigger:function(a,d){var e,c=d||b.coming||b.current;if(c){f.isFunction(c[a])&&(e=c[a].apply(c,Array.prototype.slice.call(arguments,1)));if(!1===e)return!1;c.helpers&&f.each(c.helpers,function(d, -e){e&&(b.helpers[d]&&f.isFunction(b.helpers[d][a]))&&(e=f.extend(!0,{},b.helpers[d].defaults,e),b.helpers[d][a](e,c))});f.event.trigger(a+".fb")}},isImage:function(a){return p(a)&&a.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp)((\?|#).*)?$)/i)},isSWF:function(a){return p(a)&&a.match(/\.(swf)((\?|#).*)?$/i)},_start:function(a){var d={},e,c;a=l(a);e=b.group[a]||null;if(!e)return!1;d=f.extend(!0,{},b.opts,e);e=d.margin;c=d.padding;"number"===f.type(e)&&(d.margin=[e,e,e,e]);"number"===f.type(c)&& -(d.padding=[c,c,c,c]);d.modal&&f.extend(!0,d,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1,mouseWheel:!1,keys:null,helpers:{overlay:{closeClick:!1}}});d.autoSize&&(d.autoWidth=d.autoHeight=!0);"auto"===d.width&&(d.autoWidth=!0);"auto"===d.height&&(d.autoHeight=!0);d.group=b.group;d.index=a;b.coming=d;if(!1===b.trigger("beforeLoad"))b.coming=null;else{c=d.type;e=d.href;if(!c)return b.coming=null,b.current&&b.router&&"jumpto"!==b.router?(b.current.index=a,b[b.router](b.direction)):!1;b.isActive= -!0;if("image"===c||"swf"===c)d.autoHeight=d.autoWidth=!1,d.scrolling="visible";"image"===c&&(d.aspectRatio=!0);"iframe"===c&&s&&(d.scrolling="scroll");d.wrap=f(d.tpl.wrap).addClass("fancybox-"+(s?"mobile":"desktop")+" fancybox-type-"+c+" fancybox-tmp "+d.wrapCSS).appendTo(d.parent||"body");f.extend(d,{skin:f(".fancybox-skin",d.wrap),outer:f(".fancybox-outer",d.wrap),inner:f(".fancybox-inner",d.wrap)});f.each(["Top","Right","Bottom","Left"],function(a,b){d.skin.css("padding"+b,x(d.padding[a]))});b.trigger("onReady"); -if("inline"===c||"html"===c){if(!d.content||!d.content.length)return b._error("content")}else if(!e)return b._error("href");"image"===c?b._loadImage():"ajax"===c?b._loadAjax():"iframe"===c?b._loadIframe():b._afterLoad()}},_error:function(a){f.extend(b.coming,{type:"html",autoWidth:!0,autoHeight:!0,minWidth:0,minHeight:0,scrolling:"no",hasError:a,content:b.coming.tpl.error});b._afterLoad()},_loadImage:function(){var a=b.imgPreload=new Image;a.onload=function(){this.onload=this.onerror=null;b.coming.width= -this.width;b.coming.height=this.height;b._afterLoad()};a.onerror=function(){this.onload=this.onerror=null;b._error("image")};a.src=b.coming.href;!0!==a.complete&&b.showLoading()},_loadAjax:function(){var a=b.coming;b.showLoading();b.ajaxLoad=f.ajax(f.extend({},a.ajax,{url:a.href,error:function(a,e){b.coming&&"abort"!==e?b._error("ajax",a):b.hideLoading()},success:function(d,e){"success"===e&&(a.content=d,b._afterLoad())}}))},_loadIframe:function(){var a=b.coming,d=f(a.tpl.iframe.replace(/\{rnd\}/g, -(new Date).getTime())).attr("scrolling",s?"auto":a.iframe.scrolling).attr("src",a.href);f(a.wrap).bind("onReset",function(){try{f(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(a){}});a.iframe.preload&&(b.showLoading(),d.one("load",function(){f(this).data("ready",1);s||f(this).bind("load.fb",b.update);f(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();b._afterLoad()}));a.content=d.appendTo(a.inner);a.iframe.preload||b._afterLoad()},_preloadImages:function(){var a= -b.group,d=b.current,e=a.length,c=d.preload?Math.min(d.preload,e-1):0,f,g;for(g=1;g<=c;g+=1)f=a[(d.index+g)%e],"image"===f.type&&f.href&&((new Image).src=f.href)},_afterLoad:function(){var a=b.coming,d=b.current,e,c,k,g,h;b.hideLoading();if(a&&!1!==b.isActive)if(!1===b.trigger("afterLoad",a,d))a.wrap.stop(!0).trigger("onReset").remove(),b.coming=null;else{d&&(b.trigger("beforeChange",d),d.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove());b.unbindEvents(); -e=a.content;c=a.type;k=a.scrolling;f.extend(b,{wrap:a.wrap,skin:a.skin,outer:a.outer,inner:a.inner,current:a,previous:d});g=a.href;switch(c){case "inline":case "ajax":case "html":a.selector?e=f("
              ").html(e).find(a.selector):t(e)&&(e.data("fancybox-placeholder")||e.data("fancybox-placeholder",f('
              ').insertAfter(e).hide()),e=e.show().detach(),a.wrap.bind("onReset",function(){f(this).find(e).length&&e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder", -!1)}));break;case "image":e=a.tpl.image.replace("{href}",g);break;case "swf":e='',h="",f.each(a.swf,function(a,b){e+='';h+=" "+a+'="'+b+'"'}),e+='"}(!t(e)||!e.parent().is(a.inner))&&a.inner.append(e);b.trigger("beforeShow"); -a.inner.css("overflow","yes"===k?"scroll":"no"===k?"hidden":k);b._setDimension();b.reposition();b.isOpen=!1;b.coming=null;b.bindEvents();if(b.isOpened){if(d.prevMethod)b.transitions[d.prevMethod]()}else f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();b.transitions[b.isOpened?a.nextMethod:a.openMethod]();b._preloadImages()}},_setDimension:function(){var a=b.getViewport(),d=0,e=!1,c=!1,e=b.wrap,k=b.skin,g=b.inner,h=b.current,c=h.width,j=h.height,m=h.minWidth,u=h.minHeight,n=h.maxWidth, -v=h.maxHeight,s=h.scrolling,q=h.scrollOutside?h.scrollbarWidth:0,y=h.margin,p=l(y[1]+y[3]),r=l(y[0]+y[2]),z,A,t,D,B,G,C,E,w;e.add(k).add(g).width("auto").height("auto").removeClass("fancybox-tmp");y=l(k.outerWidth(!0)-k.width());z=l(k.outerHeight(!0)-k.height());A=p+y;t=r+z;D=F(c)?(a.w-A)*l(c)/100:c;B=F(j)?(a.h-t)*l(j)/100:j;if("iframe"===h.type){if(w=h.content,h.autoHeight&&1===w.data("ready"))try{w[0].contentWindow.document.location&&(g.width(D).height(9999),G=w.contents().find("body"),q&&G.css("overflow-x", -"hidden"),B=G.height())}catch(H){}}else if(h.autoWidth||h.autoHeight)g.addClass("fancybox-tmp"),h.autoWidth||g.width(D),h.autoHeight||g.height(B),h.autoWidth&&(D=g.width()),h.autoHeight&&(B=g.height()),g.removeClass("fancybox-tmp");c=l(D);j=l(B);E=D/B;m=l(F(m)?l(m,"w")-A:m);n=l(F(n)?l(n,"w")-A:n);u=l(F(u)?l(u,"h")-t:u);v=l(F(v)?l(v,"h")-t:v);G=n;C=v;h.fitToView&&(n=Math.min(a.w-A,n),v=Math.min(a.h-t,v));A=a.w-p;r=a.h-r;h.aspectRatio?(c>n&&(c=n,j=l(c/E)),j>v&&(j=v,c=l(j*E)),cA||p>r)&&(c>m&&j>u)&&!(19n&&(c=n,j=l(c/E)),g.width(c).height(j),e.width(c+y),a=e.width(),p=e.height();else c=Math.max(m,Math.min(c,c-(a-A))),j=Math.max(u,Math.min(j,j-(p-r)));q&&("auto"===s&&jA||p>r)&&c>m&&j>u;c=h.aspectRatio?cu&&j
              ').appendTo("body"); -this.fixed=!1;a.fixed&&b.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(a){var d=this;a=f.extend({},this.defaults,a);this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(a);this.fixed||(q.bind("resize.overlay",f.proxy(this.update,this)),this.update());a.closeClick&&this.overlay.bind("click.overlay",function(a){f(a.target).hasClass("fancybox-overlay")&&(b.isActive?b.close():d.close())});this.overlay.css(a.css).show()}, -close:function(){f(".fancybox-overlay").remove();q.unbind("resize.overlay");this.overlay=null;!1!==this.margin&&(f("body").css("margin-right",this.margin),this.margin=!1);this.el&&this.el.removeClass("fancybox-lock")},update:function(){var a="100%",b;this.overlay.width(a).height("100%");H?(b=Math.max(z.documentElement.offsetWidth,z.body.offsetWidth),n.width()>b&&(a=n.width())):n.width()>q.width()&&(a=n.width());this.overlay.width(a).height(n.height())},onReady:function(a,b){f(".fancybox-overlay").stop(!0, -!0);this.overlay||(this.margin=n.height()>q.height()||"scroll"===f("body").css("overflow-y")?f("body").css("margin-right"):!1,this.el=z.all&&!z.querySelector?f("html"):f("body"),this.create(a));a.locked&&this.fixed&&(b.locked=this.overlay.append(b.wrap),b.fixed=!1);!0===a.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(a,b){b.locked&&(this.el.addClass("fancybox-lock"),!1!==this.margin&&f("body").css("margin-right",l(this.margin)+b.scrollbarWidth));this.open(a)},onUpdate:function(){this.fixed|| -this.update()},afterClose:function(a){this.overlay&&!b.isActive&&this.overlay.fadeOut(a.speedOut,f.proxy(this.close,this))}};b.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(a){var d=b.current,e=d.title,c=a.type;f.isFunction(e)&&(e=e.call(d.element,d));if(p(e)&&""!==f.trim(e)){d=f('
              '+e+"
              ");switch(c){case "inside":c=b.skin;break;case "outside":c=b.wrap;break;case "over":c=b.inner;break;default:c=b.skin,d.appendTo("body"), -H&&d.width(d.width()),d.wrapInner(''),b.current.margin[2]+=Math.abs(l(d.css("margin-bottom")))}d["top"===a.position?"prependTo":"appendTo"](c)}}};f.fn.fancybox=function(a){var d,e=f(this),c=this.selector||"",k=function(g){var h=f(this).blur(),j=d,k,l;!g.ctrlKey&&(!g.altKey&&!g.shiftKey&&!g.metaKey)&&!h.is(".fancybox-wrap")&&(k=a.groupAttr||"data-fancybox-group",l=h.attr(k),l||(k="rel",l=h.get(0)[k]),l&&(""!==l&&"nofollow"!==l)&&(h=c.length?f(c):e,h=h.filter("["+k+'="'+l+ -'"]'),j=h.index(this)),a.index=j,!1!==b.open(h,a)&&g.preventDefault())};a=a||{};d=a.index||0;!c||!1===a.live?e.unbind("click.fb-start").bind("click.fb-start",k):n.undelegate(c,"click.fb-start").delegate(c+":not('.fancybox-item, .fancybox-nav')","click.fb-start",k);this.filter("[data-fancybox-start=1]").trigger("click");return this};n.ready(function(){f.scrollbarWidth===r&&(f.scrollbarWidth=function(){var a=f('
              ').appendTo("body"),b=a.children(), -b=b.innerWidth()-b.height(99).innerWidth();a.remove();return b});if(f.support.fixedPosition===r){var a=f.support,d=f('
              ').appendTo("body"),e=20===d[0].offsetTop||15===d[0].offsetTop;d.remove();a.fixedPosition=e}f.extend(b.defaults,{scrollbarWidth:f.scrollbarWidth(),fixed:f.support.fixedPosition,parent:f("body")})})})(window,document,jQuery); +/*! fancyBox v2.1.4 fancyapps.com | fancyapps.com/fancybox/#license */ +(function(C,z,f,r){var q=f(C),n=f(z),b=f.fancybox=function(){b.open.apply(this,arguments)},H=navigator.userAgent.match(/msie/),w=null,s=z.createTouch!==r,t=function(a){return a&&a.hasOwnProperty&&a instanceof f},p=function(a){return a&&"string"===f.type(a)},F=function(a){return p(a)&&0
              ',image:'',iframe:'",error:'

              The requested content cannot be loaded.
              Please try again later.

              ',closeBtn:'',next:'',prev:''},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:!0, +openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:!0,title:!0},onCancel:f.noop,beforeLoad:f.noop,afterLoad:f.noop,beforeShow:f.noop,afterShow:f.noop,beforeChange:f.noop,beforeClose:f.noop,afterClose:f.noop},group:{},opts:{},previous:null,coming:null,current:null,isActive:!1, +isOpen:!1,isOpened:!1,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(a,d){if(a&&(f.isPlainObject(d)||(d={}),!1!==b.close(!0)))return f.isArray(a)||(a=t(a)?f(a).get():[a]),f.each(a,function(e,c){var k={},g,h,j,m,l;"object"===f.type(c)&&(c.nodeType&&(c=f(c)),t(c)?(k={href:c.data("fancybox-href")||c.attr("href"),title:c.data("fancybox-title")||c.attr("title"),isDom:!0,element:c},f.metadata&&f.extend(!0,k, +c.metadata())):k=c);g=d.href||k.href||(p(c)?c:null);h=d.title!==r?d.title:k.title||"";m=(j=d.content||k.content)?"html":d.type||k.type;!m&&k.isDom&&(m=c.data("fancybox-type"),m||(m=(m=c.prop("class").match(/fancybox\.(\w+)/))?m[1]:null));p(g)&&(m||(b.isImage(g)?m="image":b.isSWF(g)?m="swf":"#"===g.charAt(0)?m="inline":p(c)&&(m="html",j=c)),"ajax"===m&&(l=g.split(/\s+/,2),g=l.shift(),l=l.shift()));j||("inline"===m?g?j=f(p(g)?g.replace(/.*(?=#[^\s]+$)/,""):g):k.isDom&&(j=c):"html"===m?j=g:!m&&(!g&& +k.isDom)&&(m="inline",j=c));f.extend(k,{href:g,type:m,content:j,title:h,selector:l});a[e]=k}),b.opts=f.extend(!0,{},b.defaults,d),d.keys!==r&&(b.opts.keys=d.keys?f.extend({},b.defaults.keys,d.keys):!1),b.group=a,b._start(b.opts.index)},cancel:function(){var a=b.coming;a&&!1!==b.trigger("onCancel")&&(b.hideLoading(),b.ajaxLoad&&b.ajaxLoad.abort(),b.ajaxLoad=null,b.imgPreload&&(b.imgPreload.onload=b.imgPreload.onerror=null),a.wrap&&a.wrap.stop(!0,!0).trigger("onReset").remove(),b.coming=null,b.current|| +b._afterZoomOut(a))},close:function(a){b.cancel();!1!==b.trigger("beforeClose")&&(b.unbindEvents(),b.isActive&&(!b.isOpen||!0===a?(f(".fancybox-wrap").stop(!0).trigger("onReset").remove(),b._afterZoomOut()):(b.isOpen=b.isOpened=!1,b.isClosing=!0,f(".fancybox-item, .fancybox-nav").remove(),b.wrap.stop(!0,!0).removeClass("fancybox-opened"),b.transitions[b.current.closeMethod]())))},play:function(a){var d=function(){clearTimeout(b.player.timer)},e=function(){d();b.current&&b.player.isActive&&(b.player.timer= +setTimeout(b.next,b.current.playSpeed))},c=function(){d();f("body").unbind(".player");b.player.isActive=!1;b.trigger("onPlayEnd")};if(!0===a||!b.player.isActive&&!1!==a){if(b.current&&(b.current.loop||b.current.index=c.index?"next":"prev"],b.router=e||"jumpto",c.loop&&(0>a&&(a=c.group.length+a%c.group.length),a%=c.group.length),c.group[a]!==r&&(b.cancel(),b._start(a)))},reposition:function(a,d){var e=b.current,c=e?e.wrap:null,k;c&&(k=b._getPosition(d),a&&"scroll"===a.type?(delete k.position,c.stop(!0,!0).animate(k,200)):(c.css(k),e.pos=f.extend({}, +e.dim,k)))},update:function(a){var d=a&&a.type,e=!d||"orientationchange"===d;e&&(clearTimeout(w),w=null);b.isOpen&&!w&&(w=setTimeout(function(){var c=b.current;c&&!b.isClosing&&(b.wrap.removeClass("fancybox-tmp"),(e||"load"===d||"resize"===d&&c.autoResize)&&b._setDimension(),"scroll"===d&&c.canShrink||b.reposition(a),b.trigger("onUpdate"),w=null)},e&&!s?0:300))},toggle:function(a){b.isOpen&&(b.current.fitToView="boolean"===f.type(a)?a:!b.current.fitToView,s&&(b.wrap.removeAttr("style").addClass("fancybox-tmp"), +b.trigger("onUpdate")),b.update())},hideLoading:function(){n.unbind(".loading");f("#fancybox-loading").remove()},showLoading:function(){var a,d;b.hideLoading();a=f('
              ').click(b.cancel).appendTo("body");n.bind("keydown.loading",function(a){if(27===(a.which||a.keyCode))a.preventDefault(),b.cancel()});b.defaults.fixed||(d=b.getViewport(),a.css({position:"absolute",top:0.5*d.h+d.y,left:0.5*d.w+d.x}))},getViewport:function(){var a=b.current&&b.current.locked|| +!1,d={x:q.scrollLeft(),y:q.scrollTop()};a?(d.w=a[0].clientWidth,d.h=a[0].clientHeight):(d.w=s&&C.innerWidth?C.innerWidth:q.width(),d.h=s&&C.innerHeight?C.innerHeight:q.height());return d},unbindEvents:function(){b.wrap&&t(b.wrap)&&b.wrap.unbind(".fb");n.unbind(".fb");q.unbind(".fb")},bindEvents:function(){var a=b.current,d;a&&(q.bind("orientationchange.fb"+(s?"":" resize.fb")+(a.autoCenter&&!a.locked?" scroll.fb":""),b.update),(d=a.keys)&&n.bind("keydown.fb",function(e){var c=e.which||e.keyCode,k= +e.target||e.srcElement;if(27===c&&b.coming)return!1;!e.ctrlKey&&(!e.altKey&&!e.shiftKey&&!e.metaKey&&(!k||!k.type&&!f(k).is("[contenteditable]")))&&f.each(d,function(d,k){if(1h[0].clientWidth||h[0].clientHeight&&h[0].scrollHeight>h[0].clientHeight),h=f(h).parent();if(0!==c&&!j&&1g||0>k)b.next(0>g?"up":"right");d.preventDefault()}}))},trigger:function(a,d){var e,c=d||b.coming||b.current;if(c){f.isFunction(c[a])&&(e=c[a].apply(c,Array.prototype.slice.call(arguments,1)));if(!1===e)return!1;c.helpers&&f.each(c.helpers,function(d, +e){e&&(b.helpers[d]&&f.isFunction(b.helpers[d][a]))&&(e=f.extend(!0,{},b.helpers[d].defaults,e),b.helpers[d][a](e,c))});f.event.trigger(a+".fb")}},isImage:function(a){return p(a)&&a.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp)((\?|#).*)?$)/i)},isSWF:function(a){return p(a)&&a.match(/\.(swf)((\?|#).*)?$/i)},_start:function(a){var d={},e,c;a=l(a);e=b.group[a]||null;if(!e)return!1;d=f.extend(!0,{},b.opts,e);e=d.margin;c=d.padding;"number"===f.type(e)&&(d.margin=[e,e,e,e]);"number"===f.type(c)&& +(d.padding=[c,c,c,c]);d.modal&&f.extend(!0,d,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1,mouseWheel:!1,keys:null,helpers:{overlay:{closeClick:!1}}});d.autoSize&&(d.autoWidth=d.autoHeight=!0);"auto"===d.width&&(d.autoWidth=!0);"auto"===d.height&&(d.autoHeight=!0);d.group=b.group;d.index=a;b.coming=d;if(!1===b.trigger("beforeLoad"))b.coming=null;else{c=d.type;e=d.href;if(!c)return b.coming=null,b.current&&b.router&&"jumpto"!==b.router?(b.current.index=a,b[b.router](b.direction)):!1;b.isActive= +!0;if("image"===c||"swf"===c)d.autoHeight=d.autoWidth=!1,d.scrolling="visible";"image"===c&&(d.aspectRatio=!0);"iframe"===c&&s&&(d.scrolling="scroll");d.wrap=f(d.tpl.wrap).addClass("fancybox-"+(s?"mobile":"desktop")+" fancybox-type-"+c+" fancybox-tmp "+d.wrapCSS).appendTo(d.parent||"body");f.extend(d,{skin:f(".fancybox-skin",d.wrap),outer:f(".fancybox-outer",d.wrap),inner:f(".fancybox-inner",d.wrap)});f.each(["Top","Right","Bottom","Left"],function(a,b){d.skin.css("padding"+b,x(d.padding[a]))});b.trigger("onReady"); +if("inline"===c||"html"===c){if(!d.content||!d.content.length)return b._error("content")}else if(!e)return b._error("href");"image"===c?b._loadImage():"ajax"===c?b._loadAjax():"iframe"===c?b._loadIframe():b._afterLoad()}},_error:function(a){f.extend(b.coming,{type:"html",autoWidth:!0,autoHeight:!0,minWidth:0,minHeight:0,scrolling:"no",hasError:a,content:b.coming.tpl.error});b._afterLoad()},_loadImage:function(){var a=b.imgPreload=new Image;a.onload=function(){this.onload=this.onerror=null;b.coming.width= +this.width;b.coming.height=this.height;b._afterLoad()};a.onerror=function(){this.onload=this.onerror=null;b._error("image")};a.src=b.coming.href;!0!==a.complete&&b.showLoading()},_loadAjax:function(){var a=b.coming;b.showLoading();b.ajaxLoad=f.ajax(f.extend({},a.ajax,{url:a.href,error:function(a,e){b.coming&&"abort"!==e?b._error("ajax",a):b.hideLoading()},success:function(d,e){"success"===e&&(a.content=d,b._afterLoad())}}))},_loadIframe:function(){var a=b.coming,d=f(a.tpl.iframe.replace(/\{rnd\}/g, +(new Date).getTime())).attr("scrolling",s?"auto":a.iframe.scrolling).attr("src",a.href);f(a.wrap).bind("onReset",function(){try{f(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(a){}});a.iframe.preload&&(b.showLoading(),d.one("load",function(){f(this).data("ready",1);s||f(this).bind("load.fb",b.update);f(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();b._afterLoad()}));a.content=d.appendTo(a.inner);a.iframe.preload||b._afterLoad()},_preloadImages:function(){var a= +b.group,d=b.current,e=a.length,c=d.preload?Math.min(d.preload,e-1):0,f,g;for(g=1;g<=c;g+=1)f=a[(d.index+g)%e],"image"===f.type&&f.href&&((new Image).src=f.href)},_afterLoad:function(){var a=b.coming,d=b.current,e,c,k,g,h;b.hideLoading();if(a&&!1!==b.isActive)if(!1===b.trigger("afterLoad",a,d))a.wrap.stop(!0).trigger("onReset").remove(),b.coming=null;else{d&&(b.trigger("beforeChange",d),d.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove());b.unbindEvents(); +e=a.content;c=a.type;k=a.scrolling;f.extend(b,{wrap:a.wrap,skin:a.skin,outer:a.outer,inner:a.inner,current:a,previous:d});g=a.href;switch(c){case "inline":case "ajax":case "html":a.selector?e=f("
              ").html(e).find(a.selector):t(e)&&(e.data("fancybox-placeholder")||e.data("fancybox-placeholder",f('
              ').insertAfter(e).hide()),e=e.show().detach(),a.wrap.bind("onReset",function(){f(this).find(e).length&&e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder", +!1)}));break;case "image":e=a.tpl.image.replace("{href}",g);break;case "swf":e='',h="",f.each(a.swf,function(a,b){e+='';h+=" "+a+'="'+b+'"'}),e+='"}(!t(e)||!e.parent().is(a.inner))&&a.inner.append(e);b.trigger("beforeShow"); +a.inner.css("overflow","yes"===k?"scroll":"no"===k?"hidden":k);b._setDimension();b.reposition();b.isOpen=!1;b.coming=null;b.bindEvents();if(b.isOpened){if(d.prevMethod)b.transitions[d.prevMethod]()}else f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();b.transitions[b.isOpened?a.nextMethod:a.openMethod]();b._preloadImages()}},_setDimension:function(){var a=b.getViewport(),d=0,e=!1,c=!1,e=b.wrap,k=b.skin,g=b.inner,h=b.current,c=h.width,j=h.height,m=h.minWidth,u=h.minHeight,n=h.maxWidth, +v=h.maxHeight,s=h.scrolling,q=h.scrollOutside?h.scrollbarWidth:0,y=h.margin,p=l(y[1]+y[3]),r=l(y[0]+y[2]),z,A,t,D,B,G,C,E,w;e.add(k).add(g).width("auto").height("auto").removeClass("fancybox-tmp");y=l(k.outerWidth(!0)-k.width());z=l(k.outerHeight(!0)-k.height());A=p+y;t=r+z;D=F(c)?(a.w-A)*l(c)/100:c;B=F(j)?(a.h-t)*l(j)/100:j;if("iframe"===h.type){if(w=h.content,h.autoHeight&&1===w.data("ready"))try{w[0].contentWindow.document.location&&(g.width(D).height(9999),G=w.contents().find("body"),q&&G.css("overflow-x", +"hidden"),B=G.height())}catch(H){}}else if(h.autoWidth||h.autoHeight)g.addClass("fancybox-tmp"),h.autoWidth||g.width(D),h.autoHeight||g.height(B),h.autoWidth&&(D=g.width()),h.autoHeight&&(B=g.height()),g.removeClass("fancybox-tmp");c=l(D);j=l(B);E=D/B;m=l(F(m)?l(m,"w")-A:m);n=l(F(n)?l(n,"w")-A:n);u=l(F(u)?l(u,"h")-t:u);v=l(F(v)?l(v,"h")-t:v);G=n;C=v;h.fitToView&&(n=Math.min(a.w-A,n),v=Math.min(a.h-t,v));A=a.w-p;r=a.h-r;h.aspectRatio?(c>n&&(c=n,j=l(c/E)),j>v&&(j=v,c=l(j*E)),cA||p>r)&&(c>m&&j>u)&&!(19n&&(c=n,j=l(c/E)),g.width(c).height(j),e.width(c+y),a=e.width(),p=e.height();else c=Math.max(m,Math.min(c,c-(a-A))),j=Math.max(u,Math.min(j,j-(p-r)));q&&("auto"===s&&jA||p>r)&&c>m&&j>u;c=h.aspectRatio?cu&&j
              ').appendTo("body"); +this.fixed=!1;a.fixed&&b.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(a){var d=this;a=f.extend({},this.defaults,a);this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(a);this.fixed||(q.bind("resize.overlay",f.proxy(this.update,this)),this.update());a.closeClick&&this.overlay.bind("click.overlay",function(a){f(a.target).hasClass("fancybox-overlay")&&(b.isActive?b.close():d.close())});this.overlay.css(a.css).show()}, +close:function(){f(".fancybox-overlay").remove();q.unbind("resize.overlay");this.overlay=null;!1!==this.margin&&(f("body").css("margin-right",this.margin),this.margin=!1);this.el&&this.el.removeClass("fancybox-lock")},update:function(){var a="100%",b;this.overlay.width(a).height("100%");H?(b=Math.max(z.documentElement.offsetWidth,z.body.offsetWidth),n.width()>b&&(a=n.width())):n.width()>q.width()&&(a=n.width());this.overlay.width(a).height(n.height())},onReady:function(a,b){f(".fancybox-overlay").stop(!0, +!0);this.overlay||(this.margin=n.height()>q.height()||"scroll"===f("body").css("overflow-y")?f("body").css("margin-right"):!1,this.el=z.all&&!z.querySelector?f("html"):f("body"),this.create(a));a.locked&&this.fixed&&(b.locked=this.overlay.append(b.wrap),b.fixed=!1);!0===a.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(a,b){b.locked&&(this.el.addClass("fancybox-lock"),!1!==this.margin&&f("body").css("margin-right",l(this.margin)+b.scrollbarWidth));this.open(a)},onUpdate:function(){this.fixed|| +this.update()},afterClose:function(a){this.overlay&&!b.isActive&&this.overlay.fadeOut(a.speedOut,f.proxy(this.close,this))}};b.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(a){var d=b.current,e=d.title,c=a.type;f.isFunction(e)&&(e=e.call(d.element,d));if(p(e)&&""!==f.trim(e)){d=f('
              '+e+"
              ");switch(c){case "inside":c=b.skin;break;case "outside":c=b.wrap;break;case "over":c=b.inner;break;default:c=b.skin,d.appendTo("body"), +H&&d.width(d.width()),d.wrapInner(''),b.current.margin[2]+=Math.abs(l(d.css("margin-bottom")))}d["top"===a.position?"prependTo":"appendTo"](c)}}};f.fn.fancybox=function(a){var d,e=f(this),c=this.selector||"",k=function(g){var h=f(this).blur(),j=d,k,l;!g.ctrlKey&&(!g.altKey&&!g.shiftKey&&!g.metaKey)&&!h.is(".fancybox-wrap")&&(k=a.groupAttr||"data-fancybox-group",l=h.attr(k),l||(k="rel",l=h.get(0)[k]),l&&(""!==l&&"nofollow"!==l)&&(h=c.length?f(c):e,h=h.filter("["+k+'="'+l+ +'"]'),j=h.index(this)),a.index=j,!1!==b.open(h,a)&&g.preventDefault())};a=a||{};d=a.index||0;!c||!1===a.live?e.unbind("click.fb-start").bind("click.fb-start",k):n.undelegate(c,"click.fb-start").delegate(c+":not('.fancybox-item, .fancybox-nav')","click.fb-start",k);this.filter("[data-fancybox-start=1]").trigger("click");return this};n.ready(function(){f.scrollbarWidth===r&&(f.scrollbarWidth=function(){var a=f('
              ').appendTo("body"),b=a.children(), +b=b.innerWidth()-b.height(99).innerWidth();a.remove();return b});if(f.support.fixedPosition===r){var a=f.support,d=f('
              ').appendTo("body"),e=20===d[0].offsetTop||15===d[0].offsetTop;d.remove();a.fixedPosition=e}f.extend(b.defaults,{scrollbarWidth:f.scrollbarWidth(),fixed:f.support.fixedPosition,parent:f("body")})})})(window,document,jQuery); diff --git a/assets/modules/store/js/fancybox/jquery.mousewheel-3.0.6.pack.js b/assets/modules/store/js/fancybox/jquery.mousewheel-3.0.6.pack.js index 8adf44dc8b..e39a83adae 100755 --- a/assets/modules/store/js/fancybox/jquery.mousewheel-3.0.6.pack.js +++ b/assets/modules/store/js/fancybox/jquery.mousewheel-3.0.6.pack.js @@ -1,13 +1,13 @@ -/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net) - * Licensed under the MIT License (LICENSE.txt). - * - * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. - * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. - * Thanks to: Seamus Leahy for adding deltaX and deltaY - * - * Version: 3.0.6 - * - * Requires: 1.2.2+ - */ -(function(d){function e(a){var b=a||window.event,c=[].slice.call(arguments,1),f=0,e=0,g=0,a=d.event.fix(b);a.type="mousewheel";b.wheelDelta&&(f=b.wheelDelta/120);b.detail&&(f=-b.detail/3);g=f;b.axis!==void 0&&b.axis===b.HORIZONTAL_AXIS&&(g=0,e=-1*f);b.wheelDeltaY!==void 0&&(g=b.wheelDeltaY/120);b.wheelDeltaX!==void 0&&(e=-1*b.wheelDeltaX/120);c.unshift(a,f,e,g);return(d.event.dispatch||d.event.handle).apply(this,c)}var c=["DOMMouseScroll","mousewheel"];if(d.event.fixHooks)for(var h=c.length;h;)d.event.fixHooks[c[--h]]= +/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net) + * Licensed under the MIT License (LICENSE.txt). + * + * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. + * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. + * Thanks to: Seamus Leahy for adding deltaX and deltaY + * + * Version: 3.0.6 + * + * Requires: 1.2.2+ + */ +(function(d){function e(a){var b=a||window.event,c=[].slice.call(arguments,1),f=0,e=0,g=0,a=d.event.fix(b);a.type="mousewheel";b.wheelDelta&&(f=b.wheelDelta/120);b.detail&&(f=-b.detail/3);g=f;b.axis!==void 0&&b.axis===b.HORIZONTAL_AXIS&&(g=0,e=-1*f);b.wheelDeltaY!==void 0&&(g=b.wheelDeltaY/120);b.wheelDeltaX!==void 0&&(e=-1*b.wheelDeltaX/120);c.unshift(a,f,e,g);return(d.event.dispatch||d.event.handle).apply(this,c)}var c=["DOMMouseScroll","mousewheel"];if(d.event.fixHooks)for(var h=c.length;h;)d.event.fixHooks[c[--h]]= d.event.mouseHooks;d.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=c.length;a;)this.addEventListener(c[--a],e,false);else this.onmousewheel=e},teardown:function(){if(this.removeEventListener)for(var a=c.length;a;)this.removeEventListener(c[--a],e,false);else this.onmousewheel=null}};d.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery); \ No newline at end of file diff --git a/assets/modules/store/js/jquery.min.js b/assets/modules/store/js/jquery.min.js index 83589daa70..3883779527 100755 --- a/assets/modules/store/js/jquery.min.js +++ b/assets/modules/store/js/jquery.min.js @@ -1,2 +1,2 @@ -/*! jQuery v1.8.3 jquery.com | jquery.org/license */ +/*! jQuery v1.8.3 jquery.com | jquery.org/license */ (function(e,t){function _(e){var t=M[e]={};return v.each(e.split(y),function(e,n){t[n]=!0}),t}function H(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(P,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:D.test(r)?v.parseJSON(r):r}catch(s){}v.data(e,n,r)}else r=t}return r}function B(e){var t;for(t in e){if(t==="data"&&v.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function et(){return!1}function tt(){return!0}function ut(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function at(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function ft(e,t,n){t=t||0;if(v.isFunction(t))return v.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return v.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=v.grep(e,function(e){return e.nodeType===1});if(it.test(t))return v.filter(t,r,!n);t=v.filter(t,r)}return v.grep(e,function(e,r){return v.inArray(e,t)>=0===n})}function lt(e){var t=ct.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function At(e,t){if(t.nodeType!==1||!v.hasData(e))return;var n,r,i,s=v._data(e),o=v._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r").appendTo(i.body),n=t.css("display");t.remove();if(n==="none"||n===""){Pt=i.body.appendChild(Pt||v.extend(i.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!Ht||!Pt.createElement)Ht=(Pt.contentWindow||Pt.contentDocument).document,Ht.write(""),Ht.close();t=Ht.body.appendChild(Ht.createElement(e)),n=Dt(t,"display"),i.body.removeChild(Pt)}return Wt[e]=n,n}function fn(e,t,n,r){var i;if(v.isArray(t))v.each(t,function(t,i){n||sn.test(e)?r(e,i):fn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&v.type(t)==="object")for(i in t)fn(e+"["+i+"]",t[i],n,r);else r(e,t)}function Cn(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i,s,o=t.toLowerCase().split(y),u=0,a=o.length;if(v.isFunction(n))for(;u)[^>]*$|#([\w\-]*)$)/,E=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,S=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,T=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,N=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,C=/^-ms-/,k=/-([\da-z])/gi,L=function(e,t){return(t+"").toUpperCase()},A=function(){i.addEventListener?(i.removeEventListener("DOMContentLoaded",A,!1),v.ready()):i.readyState==="complete"&&(i.detachEvent("onreadystatechange",A),v.ready())},O={};v.fn=v.prototype={constructor:v,init:function(e,n,r){var s,o,u,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?s=[null,e,null]:s=w.exec(e);if(s&&(s[1]||!n)){if(s[1])return n=n instanceof v?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:i,e=v.parseHTML(s[1],a,!0),E.test(s[1])&&v.isPlainObject(n)&&this.attr.call(e,n,!0),v.merge(this,e);o=i.getElementById(s[2]);if(o&&o.parentNode){if(o.id!==s[2])return r.find(e);this.length=1,this[0]=o}return this.context=i,this.selector=e,this}return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}return v.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),v.makeArray(e,this))},selector:"",jquery:"1.8.3",length:0,size:function(){return this.length},toArray:function(){return l.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=v.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return v.each(this,e,t)},ready:function(e){return v.ready.promise().done(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(l.apply(this,arguments),"slice",l.call(arguments).join(","))},map:function(e){return this.pushStack(v.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:[].sort,splice:[].splice},v.fn.init.prototype=v.fn,v.extend=v.fn.extend=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;typeof u=="boolean"&&(l=u,u=arguments[1]||{},a=2),typeof u!="object"&&!v.isFunction(u)&&(u={}),f===a&&(u=this,--a);for(;a0)return;r.resolveWith(i,[v]),v.fn.trigger&&v(i).trigger("ready").off("ready")},isFunction:function(e){return v.type(e)==="function"},isArray:Array.isArray||function(e){return v.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):O[h.call(e)]||"object"},isPlainObject:function(e){if(!e||v.type(e)!=="object"||e.nodeType||v.isWindow(e))return!1;try{if(e.constructor&&!p.call(e,"constructor")&&!p.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||p.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){var r;return!e||typeof e!="string"?null:(typeof t=="boolean"&&(n=t,t=0),t=t||i,(r=E.exec(e))?[t.createElement(r[1])]:(r=v.buildFragment([e],t,n?null:[]),v.merge([],(r.cacheable?v.clone(r.fragment):r.fragment).childNodes)))},parseJSON:function(t){if(!t||typeof t!="string")return null;t=v.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(S.test(t.replace(T,"@").replace(N,"]").replace(x,"")))return(new Function("return "+t))();v.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!="string")return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(s){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&v.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&g.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(C,"ms-").replace(k,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,n,r){var i,s=0,o=e.length,u=o===t||v.isFunction(e);if(r){if(u){for(i in e)if(n.apply(e[i],r)===!1)break}else for(;s0&&e[0]&&e[a-1]||a===0||v.isArray(e));if(f)for(;u-1)a.splice(n,1),i&&(n<=o&&o--,n<=u&&u--)}),this},has:function(e){return v.inArray(e,a)>-1},empty:function(){return a=[],this},disable:function(){return a=f=n=t,this},disabled:function(){return!a},lock:function(){return f=t,n||c.disable(),this},locked:function(){return!f},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],a&&(!r||f)&&(i?f.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},v.extend({Deferred:function(e){var t=[["resolve","done",v.Callbacks("once memory"),"resolved"],["reject","fail",v.Callbacks("once memory"),"rejected"],["notify","progress",v.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return v.Deferred(function(n){v.each(t,function(t,r){var s=r[0],o=e[t];i[r[1]](v.isFunction(o)?function(){var e=o.apply(this,arguments);e&&v.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===i?n:this,[e])}:n[s])}),e=null}).promise()},promise:function(e){return e!=null?v.extend(e,r):r}},i={};return r.pipe=r.then,v.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=o.fire,i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=l.call(arguments),r=n.length,i=r!==1||e&&v.isFunction(e.promise)?r:0,s=i===1?e:v.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?l.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t
              a",n=p.getElementsByTagName("*"),r=p.getElementsByTagName("a")[0];if(!n||!r||!n.length)return{};s=i.createElement("select"),o=s.appendChild(i.createElement("option")),u=p.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:r.getAttribute("href")==="/a",opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:u.value==="on",optSelected:o.selected,getSetAttribute:p.className!=="t",enctype:!!i.createElement("form").enctype,html5Clone:i.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",boxModel:i.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},u.checked=!0,t.noCloneChecked=u.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!o.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",h=function(){t.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick"),p.detachEvent("onclick",h)),u=i.createElement("input"),u.value="t",u.setAttribute("type","radio"),t.radioValue=u.value==="t",u.setAttribute("checked","checked"),u.setAttribute("name","t"),p.appendChild(u),a=i.createDocumentFragment(),a.appendChild(p.lastChild),t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=u.checked,a.removeChild(u),a.appendChild(p);if(p.attachEvent)for(l in{submit:!0,change:!0,focusin:!0})f="on"+l,c=f in p,c||(p.setAttribute(f,"return;"),c=typeof p[f]=="function"),t[l+"Bubbles"]=c;return v(function(){var n,r,s,o,u="padding:0;margin:0;border:0;display:block;overflow:hidden;",a=i.getElementsByTagName("body")[0];if(!a)return;n=i.createElement("div"),n.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",a.insertBefore(n,a.firstChild),r=i.createElement("div"),n.appendChild(r),r.innerHTML="
              t
              ",s=r.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",c=s[0].offsetHeight===0,s[0].style.display="",s[1].style.display="none",t.reliableHiddenOffsets=c&&s[0].offsetHeight===0,r.innerHTML="",r.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=r.offsetWidth===4,t.doesNotIncludeMarginInBodyOffset=a.offsetTop!==1,e.getComputedStyle&&(t.pixelPosition=(e.getComputedStyle(r,null)||{}).top!=="1%",t.boxSizingReliable=(e.getComputedStyle(r,null)||{width:"4px"}).width==="4px",o=i.createElement("div"),o.style.cssText=r.style.cssText=u,o.style.marginRight=o.style.width="0",r.style.width="1px",r.appendChild(o),t.reliableMarginRight=!parseFloat((e.getComputedStyle(o,null)||{}).marginRight)),typeof r.style.zoom!="undefined"&&(r.innerHTML="",r.style.cssText=u+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=r.offsetWidth===3,r.style.display="block",r.style.overflow="visible",r.innerHTML="
              ",r.firstChild.style.width="5px",t.shrinkWrapBlocks=r.offsetWidth!==3,n.style.zoom=1),a.removeChild(n),n=r=s=o=null}),a.removeChild(p),n=r=s=o=u=a=p=null,t}();var D=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;v.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(v.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?v.cache[e[v.expando]]:e[v.expando],!!e&&!B(e)},data:function(e,n,r,i){if(!v.acceptData(e))return;var s,o,u=v.expando,a=typeof n=="string",f=e.nodeType,l=f?v.cache:e,c=f?e[u]:e[u]&&u;if((!c||!l[c]||!i&&!l[c].data)&&a&&r===t)return;c||(f?e[u]=c=v.deletedIds.pop()||v.guid++:c=u),l[c]||(l[c]={},f||(l[c].toJSON=v.noop));if(typeof n=="object"||typeof n=="function")i?l[c]=v.extend(l[c],n):l[c].data=v.extend(l[c].data,n);return s=l[c],i||(s.data||(s.data={}),s=s.data),r!==t&&(s[v.camelCase(n)]=r),a?(o=s[n],o==null&&(o=s[v.camelCase(n)])):o=s,o},removeData:function(e,t,n){if(!v.acceptData(e))return;var r,i,s,o=e.nodeType,u=o?v.cache:e,a=o?e[v.expando]:v.expando;if(!u[a])return;if(t){r=n?u[a]:u[a].data;if(r){v.isArray(t)||(t in r?t=[t]:(t=v.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,s=t.length;i1,null,!1))},removeData:function(e){return this.each(function(){v.removeData(this,e)})}}),v.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=v._data(e,t),n&&(!r||v.isArray(n)?r=v._data(e,t,v.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=v.queue(e,t),r=n.length,i=n.shift(),s=v._queueHooks(e,t),o=function(){v.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return v._data(e,n)||v._data(e,n,{empty:v.Callbacks("once memory").add(function(){v.removeData(e,t+"queue",!0),v.removeData(e,n,!0)})})}}),v.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length1)},removeAttr:function(e){return this.each(function(){v.removeAttr(this,e)})},prop:function(e,t){return v.access(this,v.prop,e,t,arguments.length>1)},removeProp:function(e){return e=v.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,s,o,u;if(v.isFunction(e))return this.each(function(t){v(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(y);for(n=0,r=this.length;n=0)r=r.replace(" "+n[s]+" "," ");i.className=e?v.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return v.isFunction(e)?this.each(function(n){v(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,s=0,o=v(this),u=t,a=e.split(y);while(i=a[s++])u=r?u:!o.hasClass(i),o[u?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&v._data(this,"__className__",this.className),this.className=this.className||e===!1?"":v._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n=0)return!0;return!1},val:function(e){var n,r,i,s=this[0];if(!arguments.length){if(s)return n=v.valHooks[s.type]||v.valHooks[s.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(s,"value"))!==t?r:(r=s.value,typeof r=="string"?r.replace(R,""):r==null?"":r);return}return i=v.isFunction(e),this.each(function(r){var s,o=v(this);if(this.nodeType!==1)return;i?s=e.call(this,r,o.val()):s=e,s==null?s="":typeof s=="number"?s+="":v.isArray(s)&&(s=v.map(s,function(e){return e==null?"":e+""})),n=v.valHooks[this.type]||v.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,s,"value")===t)this.value=s})}}),v.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,i){var s,o,u,a=e.nodeType;if(!e||a===3||a===8||a===2)return;if(i&&v.isFunction(v.fn[n]))return v(e)[n](r);if(typeof e.getAttribute=="undefined")return v.prop(e,n,r);u=a!==1||!v.isXMLDoc(e),u&&(n=n.toLowerCase(),o=v.attrHooks[n]||(X.test(n)?F:j));if(r!==t){if(r===null){v.removeAttr(e,n);return}return o&&"set"in o&&u&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r)}return o&&"get"in o&&u&&(s=o.get(e,n))!==null?s:(s=e.getAttribute(n),s===null?t:s)},removeAttr:function(e,t){var n,r,i,s,o=0;if(t&&e.nodeType===1){r=t.split(y);for(;o=0}})});var $=/^(?:textarea|input|select)$/i,J=/^([^\.]*|)(?:\.(.+)|)$/,K=/(?:^|\s)hover(\.\S+|)\b/,Q=/^key/,G=/^(?:mouse|contextmenu)|click/,Y=/^(?:focusinfocus|focusoutblur)$/,Z=function(e){return v.event.special.hover?e:e.replace(K,"mouseenter$1 mouseleave$1")};v.event={add:function(e,n,r,i,s){var o,u,a,f,l,c,h,p,d,m,g;if(e.nodeType===3||e.nodeType===8||!n||!r||!(o=v._data(e)))return;r.handler&&(d=r,r=d.handler,s=d.selector),r.guid||(r.guid=v.guid++),a=o.events,a||(o.events=a={}),u=o.handle,u||(o.handle=u=function(e){return typeof v=="undefined"||!!e&&v.event.triggered===e.type?t:v.event.dispatch.apply(u.elem,arguments)},u.elem=e),n=v.trim(Z(n)).split(" ");for(f=0;f=0&&(y=y.slice(0,-1),a=!0),y.indexOf(".")>=0&&(b=y.split("."),y=b.shift(),b.sort());if((!s||v.event.customEvent[y])&&!v.event.global[y])return;n=typeof n=="object"?n[v.expando]?n:new v.Event(y,n):new v.Event(y),n.type=y,n.isTrigger=!0,n.exclusive=a,n.namespace=b.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+b.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,h=y.indexOf(":")<0?"on"+y:"";if(!s){u=v.cache;for(f in u)u[f].events&&u[f].events[y]&&v.event.trigger(n,r,u[f].handle.elem,!0);return}n.result=t,n.target||(n.target=s),r=r!=null?v.makeArray(r):[],r.unshift(n),p=v.event.special[y]||{};if(p.trigger&&p.trigger.apply(s,r)===!1)return;m=[[s,p.bindType||y]];if(!o&&!p.noBubble&&!v.isWindow(s)){g=p.delegateType||y,l=Y.test(g+y)?s:s.parentNode;for(c=s;l;l=l.parentNode)m.push([l,g]),c=l;c===(s.ownerDocument||i)&&m.push([c.defaultView||c.parentWindow||e,g])}for(f=0;f=0:v.find(h,this,null,[s]).length),u[h]&&f.push(c);f.length&&w.push({elem:s,matches:f})}d.length>m&&w.push({elem:this,matches:d.slice(m)});for(r=0;r0?this.on(t,null,e,n):this.trigger(t)},Q.test(t)&&(v.event.fixHooks[t]=v.event.keyHooks),G.test(t)&&(v.event.fixHooks[t]=v.event.mouseHooks)}),function(e,t){function nt(e,t,n,r){n=n||[],t=t||g;var i,s,a,f,l=t.nodeType;if(!e||typeof e!="string")return n;if(l!==1&&l!==9)return[];a=o(t);if(!a&&!r)if(i=R.exec(e))if(f=i[1]){if(l===9){s=t.getElementById(f);if(!s||!s.parentNode)return n;if(s.id===f)return n.push(s),n}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(f))&&u(t,s)&&s.id===f)return n.push(s),n}else{if(i[2])return S.apply(n,x.call(t.getElementsByTagName(e),0)),n;if((f=i[3])&&Z&&t.getElementsByClassName)return S.apply(n,x.call(t.getElementsByClassName(f),0)),n}return vt(e.replace(j,"$1"),t,n,r,a)}function rt(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function it(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function st(e){return N(function(t){return t=+t,N(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function ot(e,t,n){if(e===t)return n;var r=e.nextSibling;while(r){if(r===t)return-1;r=r.nextSibling}return 1}function ut(e,t){var n,r,s,o,u,a,f,l=L[d][e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=i.preFilter;while(u){if(!n||(r=F.exec(u)))r&&(u=u.slice(r[0].length)||u),a.push(s=[]);n=!1;if(r=I.exec(u))s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=r[0].replace(j," ");for(o in i.filter)(r=J[o].exec(u))&&(!f[o]||(r=f[o](r)))&&(s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=o,n.matches=r);if(!n)break}return t?u.length:u?nt.error(e):L(e,a).slice(0)}function at(e,t,r){var i=t.dir,s=r&&t.dir==="parentNode",o=w++;return t.first?function(t,n,r){while(t=t[i])if(s||t.nodeType===1)return e(t,n,r)}:function(t,r,u){if(!u){var a,f=b+" "+o+" ",l=f+n;while(t=t[i])if(s||t.nodeType===1){if((a=t[d])===l)return t.sizset;if(typeof a=="string"&&a.indexOf(f)===0){if(t.sizset)return t}else{t[d]=l;if(e(t,r,u))return t.sizset=!0,t;t.sizset=!1}}}else while(t=t[i])if(s||t.nodeType===1)if(e(t,r,u))return t}}function ft(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function lt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u-1&&(s[f]=!(o[f]=c))}}else g=lt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):S.apply(o,g)})}function ht(e){var t,n,r,s=e.length,o=i.relative[e[0].type],u=o||i.relative[" "],a=o?1:0,f=at(function(e){return e===t},u,!0),l=at(function(e){return T.call(t,e)>-1},u,!0),h=[function(e,n,r){return!o&&(r||n!==c)||((t=n).nodeType?f(e,n,r):l(e,n,r))}];for(;a1&&ft(h),a>1&&e.slice(0,a-1).join("").replace(j,"$1"),n,a0,s=e.length>0,o=function(u,a,f,l,h){var p,d,v,m=[],y=0,w="0",x=u&&[],T=h!=null,N=c,C=u||s&&i.find.TAG("*",h&&a.parentNode||a),k=b+=N==null?1:Math.E;T&&(c=a!==g&&a,n=o.el);for(;(p=C[w])!=null;w++){if(s&&p){for(d=0;v=e[d];d++)if(v(p,a,f)){l.push(p);break}T&&(b=k,n=++o.el)}r&&((p=!v&&p)&&y--,u&&x.push(p))}y+=w;if(r&&w!==y){for(d=0;v=t[d];d++)v(x,m,a,f);if(u){if(y>0)while(w--)!x[w]&&!m[w]&&(m[w]=E.call(l));m=lt(m)}S.apply(l,m),T&&!u&&m.length>0&&y+t.length>1&&nt.uniqueSort(l)}return T&&(b=k,c=N),x};return o.el=0,r?N(o):o}function dt(e,t,n){var r=0,i=t.length;for(;r2&&(f=u[0]).type==="ID"&&t.nodeType===9&&!s&&i.relative[u[1].type]){t=i.find.ID(f.matches[0].replace($,""),t,s)[0];if(!t)return n;e=e.slice(u.shift().length)}for(o=J.POS.test(e)?-1:u.length-1;o>=0;o--){f=u[o];if(i.relative[l=f.type])break;if(c=i.find[l])if(r=c(f.matches[0].replace($,""),z.test(u[0].type)&&t.parentNode||t,s)){u.splice(o,1),e=r.length&&u.join("");if(!e)return S.apply(n,x.call(r,0)),n;break}}}return a(e,h)(r,t,s,n,z.test(e)),n}function mt(){}var n,r,i,s,o,u,a,f,l,c,h=!0,p="undefined",d=("sizcache"+Math.random()).replace(".",""),m=String,g=e.document,y=g.documentElement,b=0,w=0,E=[].pop,S=[].push,x=[].slice,T=[].indexOf||function(e){var t=0,n=this.length;for(;ti.cacheLength&&delete e[t.shift()],e[n+" "]=r},e)},k=C(),L=C(),A=C(),O="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",_=M.replace("w","w#"),D="([*^$|!~]?=)",P="\\["+O+"*("+M+")"+O+"*(?:"+D+O+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+_+")|)|)"+O+"*\\]",H=":("+M+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+P+")|[^:]|\\\\.)*|.*))\\)|)",B=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+O+"*((?:-\\d)?\\d*)"+O+"*\\)|)(?=[^-]|$)",j=new RegExp("^"+O+"+|((?:^|[^\\\\])(?:\\\\.)*)"+O+"+$","g"),F=new RegExp("^"+O+"*,"+O+"*"),I=new RegExp("^"+O+"*([\\x20\\t\\r\\n\\f>+~])"+O+"*"),q=new RegExp(H),R=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,U=/^:not/,z=/[\x20\t\r\n\f]*[+~]/,W=/:not\($/,X=/h\d/i,V=/input|select|textarea|button/i,$=/\\(?!\\)/g,J={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),NAME:new RegExp("^\\[name=['\"]?("+M+")['\"]?\\]"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+H),POS:new RegExp(B,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+O+"*(even|odd|(([+-]|)(\\d*)n|)"+O+"*(?:([+-]|)"+O+"*(\\d+)|))"+O+"*\\)|)","i"),needsContext:new RegExp("^"+O+"*[>+~]|"+B,"i")},K=function(e){var t=g.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},Q=K(function(e){return e.appendChild(g.createComment("")),!e.getElementsByTagName("*").length}),G=K(function(e){return e.innerHTML="",e.firstChild&&typeof e.firstChild.getAttribute!==p&&e.firstChild.getAttribute("href")==="#"}),Y=K(function(e){e.innerHTML="";var t=typeof e.lastChild.getAttribute("multiple");return t!=="boolean"&&t!=="string"}),Z=K(function(e){return e.innerHTML="",!e.getElementsByClassName||!e.getElementsByClassName("e").length?!1:(e.lastChild.className="e",e.getElementsByClassName("e").length===2)}),et=K(function(e){e.id=d+0,e.innerHTML="
              ",y.insertBefore(e,y.firstChild);var t=g.getElementsByName&&g.getElementsByName(d).length===2+g.getElementsByName(d+0).length;return r=!g.getElementById(d),y.removeChild(e),t});try{x.call(y.childNodes,0)[0].nodeType}catch(tt){x=function(e){var t,n=[];for(;t=this[e];e++)n.push(t);return n}}nt.matches=function(e,t){return nt(e,null,null,t)},nt.matchesSelector=function(e,t){return nt(t,null,null,[e]).length>0},s=nt.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(i===1||i===9||i===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=s(e)}else if(i===3||i===4)return e.nodeValue}else for(;t=e[r];r++)n+=s(t);return n},o=nt.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},u=nt.contains=y.contains?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&r.nodeType===1&&n.contains&&n.contains(r))}:y.compareDocumentPosition?function(e,t){return t&&!!(e.compareDocumentPosition(t)&16)}:function(e,t){while(t=t.parentNode)if(t===e)return!0;return!1},nt.attr=function(e,t){var n,r=o(e);return r||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):r||Y?e.getAttribute(t):(n=e.getAttributeNode(t),n?typeof e[t]=="boolean"?e[t]?t:null:n.specified?n.value:null:null)},i=nt.selectors={cacheLength:50,createPseudo:N,match:J,attrHandle:G?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:r?function(e,t,n){if(typeof t.getElementById!==p&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==p&&!r){var i=n.getElementById(e);return i?i.id===e||typeof i.getAttributeNode!==p&&i.getAttributeNode("id").value===e?[i]:t:[]}},TAG:Q?function(e,t){if(typeof t.getElementsByTagName!==p)return t.getElementsByTagName(e)}:function(e,t){var n=t.getElementsByTagName(e);if(e==="*"){var r,i=[],s=0;for(;r=n[s];s++)r.nodeType===1&&i.push(r);return i}return n},NAME:et&&function(e,t){if(typeof t.getElementsByName!==p)return t.getElementsByName(name)},CLASS:Z&&function(e,t,n){if(typeof t.getElementsByClassName!==p&&!n)return t.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace($,""),e[3]=(e[4]||e[5]||"").replace($,""),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1]==="nth"?(e[2]||nt.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*(e[2]==="even"||e[2]==="odd")),e[4]=+(e[6]+e[7]||e[2]==="odd")):e[2]&&nt.error(e[0]),e},PSEUDO:function(e){var t,n;if(J.CHILD.test(e[0]))return null;if(e[3])e[2]=e[3];else if(t=e[4])q.test(t)&&(n=ut(t,!0))&&(n=t.indexOf(")",t.length-n)-t.length)&&(t=t.slice(0,n),e[0]=e[0].slice(0,n)),e[2]=t;return e.slice(0,3)}},filter:{ID:r?function(e){return e=e.replace($,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace($,""),function(t){var n=typeof t.getAttributeNode!==p&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return e==="*"?function(){return!0}:(e=e.replace($,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[d][e+" "];return t||(t=new RegExp("(^|"+O+")"+e+"("+O+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==p&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r,i){var s=nt.attr(r,e);return s==null?t==="!=":t?(s+="",t==="="?s===n:t==="!="?s!==n:t==="^="?n&&s.indexOf(n)===0:t==="*="?n&&s.indexOf(n)>-1:t==="$="?n&&s.substr(s.length-n.length)===n:t==="~="?(" "+s+" ").indexOf(n)>-1:t==="|="?s===n||s.substr(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r){return e==="nth"?function(e){var t,i,s=e.parentNode;if(n===1&&r===0)return!0;if(s){i=0;for(t=s.firstChild;t;t=t.nextSibling)if(t.nodeType===1){i++;if(e===t)break}}return i-=r,i===n||i%n===0&&i/n>=0}:function(t){var n=t;switch(e){case"only":case"first":while(n=n.previousSibling)if(n.nodeType===1)return!1;if(e==="first")return!0;n=t;case"last":while(n=n.nextSibling)if(n.nodeType===1)return!1;return!0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||nt.error("unsupported pseudo: "+e);return r[d]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?N(function(e,n){var i,s=r(e,t),o=s.length;while(o--)i=T.call(e,s[o]),e[i]=!(n[i]=s[o])}):function(e){return r(e,0,n)}):r}},pseudos:{not:N(function(e){var t=[],n=[],r=a(e.replace(j,"$1"));return r[d]?N(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),!n.pop()}}),has:N(function(e){return function(t){return nt(e,t).length>0}}),contains:N(function(e){return function(t){return(t.textContent||t.innerText||s(t)).indexOf(e)>-1}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!i.pseudos.empty(e)},empty:function(e){var t;e=e.firstChild;while(e){if(e.nodeName>"@"||(t=e.nodeType)===3||t===4)return!1;e=e.nextSibling}return!0},header:function(e){return X.test(e.nodeName)},text:function(e){var t,n;return e.nodeName.toLowerCase()==="input"&&(t=e.type)==="text"&&((n=e.getAttribute("type"))==null||n.toLowerCase()===t)},radio:rt("radio"),checkbox:rt("checkbox"),file:rt("file"),password:rt("password"),image:rt("image"),submit:it("submit"),reset:it("reset"),button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},input:function(e){return V.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},active:function(e){return e===e.ownerDocument.activeElement},first:st(function(){return[0]}),last:st(function(e,t){return[t-1]}),eq:st(function(e,t,n){return[n<0?n+t:n]}),even:st(function(e,t){for(var n=0;n=0;)e.push(r);return e}),gt:st(function(e,t,n){for(var r=n<0?n+t:n;++r",e.querySelectorAll("[selected]").length||i.push("\\["+O+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||i.push(":checked")}),K(function(e){e.innerHTML="

              ",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+O+"*(?:\"\"|'')"),e.innerHTML="",e.querySelectorAll(":enabled").length||i.push(":enabled",":disabled")}),i=new RegExp(i.join("|")),vt=function(e,r,s,o,u){if(!o&&!u&&!i.test(e)){var a,f,l=!0,c=d,h=r,p=r.nodeType===9&&e;if(r.nodeType===1&&r.nodeName.toLowerCase()!=="object"){a=ut(e),(l=r.getAttribute("id"))?c=l.replace(n,"\\$&"):r.setAttribute("id",c),c="[id='"+c+"'] ",f=a.length;while(f--)a[f]=c+a[f].join("");h=z.test(e)&&r.parentNode||r,p=a.join(",")}if(p)try{return S.apply(s,x.call(h.querySelectorAll(p),0)),s}catch(v){}finally{l||r.removeAttribute("id")}}return t(e,r,s,o,u)},u&&(K(function(t){e=u.call(t,"div");try{u.call(t,"[test!='']:sizzle"),s.push("!=",H)}catch(n){}}),s=new RegExp(s.join("|")),nt.matchesSelector=function(t,n){n=n.replace(r,"='$1']");if(!o(t)&&!s.test(n)&&!i.test(n))try{var a=u.call(t,n);if(a||e||t.document&&t.document.nodeType!==11)return a}catch(f){}return nt(n,null,null,[t]).length>0})}(),i.pseudos.nth=i.pseudos.eq,i.filters=mt.prototype=i.pseudos,i.setFilters=new mt,nt.attr=v.attr,v.find=nt,v.expr=nt.selectors,v.expr[":"]=v.expr.pseudos,v.unique=nt.uniqueSort,v.text=nt.getText,v.isXMLDoc=nt.isXML,v.contains=nt.contains}(e);var nt=/Until$/,rt=/^(?:parents|prev(?:Until|All))/,it=/^.[^:#\[\.,]*$/,st=v.expr.match.needsContext,ot={children:!0,contents:!0,next:!0,prev:!0};v.fn.extend({find:function(e){var t,n,r,i,s,o,u=this;if(typeof e!="string")return v(e).filter(function(){for(t=0,n=u.length;t0)for(i=r;i=0:v.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,s=[],o=st.test(e)||typeof e!="string"?v(e,t||this.context):0;for(;r-1:v.find.matchesSelector(n,e)){s.push(n);break}n=n.parentNode}}return s=s.length>1?v.unique(s):s,this.pushStack(s,"closest",e)},index:function(e){return e?typeof e=="string"?v.inArray(this[0],v(e)):v.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?v(e,t):v.makeArray(e&&e.nodeType?[e]:e),r=v.merge(this.get(),n);return this.pushStack(ut(n[0])||ut(r[0])?r:v.unique(r))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),v.fn.andSelf=v.fn.addBack,v.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return v.dir(e,"parentNode")},parentsUntil:function(e,t,n){return v.dir(e,"parentNode",n)},next:function(e){return at(e,"nextSibling")},prev:function(e){return at(e,"previousSibling")},nextAll:function(e){return v.dir(e,"nextSibling")},prevAll:function(e){return v.dir(e,"previousSibling")},nextUntil:function(e,t,n){return v.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return v.dir(e,"previousSibling",n)},siblings:function(e){return v.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return v.sibling(e.firstChild)},contents:function(e){return v.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:v.merge([],e.childNodes)}},function(e,t){v.fn[e]=function(n,r){var i=v.map(this,t,n);return nt.test(e)||(r=n),r&&typeof r=="string"&&(i=v.filter(r,i)),i=this.length>1&&!ot[e]?v.unique(i):i,this.length>1&&rt.test(e)&&(i=i.reverse()),this.pushStack(i,e,l.call(arguments).join(","))}}),v.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?v.find.matchesSelector(t[0],e)?[t[0]]:[]:v.find.matches(e,t)},dir:function(e,n,r){var i=[],s=e[n];while(s&&s.nodeType!==9&&(r===t||s.nodeType!==1||!v(s).is(r)))s.nodeType===1&&i.push(s),s=s[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var ct="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ht=/ jQuery\d+="(?:null|\d+)"/g,pt=/^\s+/,dt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,vt=/<([\w:]+)/,mt=/]","i"),Et=/^(?:checkbox|radio)$/,St=/checked\s*(?:[^=]|=\s*.checked.)/i,xt=/\/(java|ecma)script/i,Tt=/^\s*\s*$/g,Nt={option:[1,""],legend:[1,"
              ","
              "],thead:[1,"","
              "],tr:[2,"","
              "],td:[3,"","
              "],col:[2,"","
              "],area:[1,"",""],_default:[0,"",""]},Ct=lt(i),kt=Ct.appendChild(i.createElement("div"));Nt.optgroup=Nt.option,Nt.tbody=Nt.tfoot=Nt.colgroup=Nt.caption=Nt.thead,Nt.th=Nt.td,v.support.htmlSerialize||(Nt._default=[1,"X
              ","
              "]),v.fn.extend({text:function(e){return v.access(this,function(e){return e===t?v.text(this):this.empty().append((this[0]&&this[0].ownerDocument||i).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(v.isFunction(e))return this.each(function(t){v(this).wrapAll(e.call(this,t))});if(this[0]){var t=v(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return v.isFunction(e)?this.each(function(t){v(this).wrapInner(e.call(this,t))}):this.each(function(){var t=v(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=v.isFunction(e);return this.each(function(n){v(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){v.nodeName(this,"body")||v(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(e,this),"before",this.selector)}},after:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(this,e),"after",this.selector)}},remove:function(e,t){var n,r=0;for(;(n=this[r])!=null;r++)if(!e||v.filter(e,[n]).length)!t&&n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),v.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n);return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){e.nodeType===1&&v.cleanData(e.getElementsByTagName("*"));while(e.firstChild)e.removeChild(e.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return v.clone(this,e,t)})},html:function(e){return v.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(ht,""):t;if(typeof e=="string"&&!yt.test(e)&&(v.support.htmlSerialize||!wt.test(e))&&(v.support.leadingWhitespace||!pt.test(e))&&!Nt[(vt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(dt,"<$1>");try{for(;r1&&typeof f=="string"&&St.test(f))return this.each(function(){v(this).domManip(e,n,r)});if(v.isFunction(f))return this.each(function(i){var s=v(this);e[0]=f.call(this,i,n?s.html():t),s.domManip(e,n,r)});if(this[0]){i=v.buildFragment(e,this,l),o=i.fragment,s=o.firstChild,o.childNodes.length===1&&(o=s);if(s){n=n&&v.nodeName(s,"tr");for(u=i.cacheable||c-1;a0?this.clone(!0):this).get(),v(o[i])[t](r),s=s.concat(r);return this.pushStack(s,e,o.selector)}}),v.extend({clone:function(e,t,n){var r,i,s,o;v.support.html5Clone||v.isXMLDoc(e)||!wt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(kt.innerHTML=e.outerHTML,kt.removeChild(o=kt.firstChild));if((!v.support.noCloneEvent||!v.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!v.isXMLDoc(e)){Ot(e,o),r=Mt(e),i=Mt(o);for(s=0;r[s];++s)i[s]&&Ot(r[s],i[s])}if(t){At(e,o);if(n){r=Mt(e),i=Mt(o);for(s=0;r[s];++s)At(r[s],i[s])}}return r=i=null,o},clean:function(e,t,n,r){var s,o,u,a,f,l,c,h,p,d,m,g,y=t===i&&Ct,b=[];if(!t||typeof t.createDocumentFragment=="undefined")t=i;for(s=0;(u=e[s])!=null;s++){typeof u=="number"&&(u+="");if(!u)continue;if(typeof u=="string")if(!gt.test(u))u=t.createTextNode(u);else{y=y||lt(t),c=t.createElement("div"),y.appendChild(c),u=u.replace(dt,"<$1>"),a=(vt.exec(u)||["",""])[1].toLowerCase(),f=Nt[a]||Nt._default,l=f[0],c.innerHTML=f[1]+u+f[2];while(l--)c=c.lastChild;if(!v.support.tbody){h=mt.test(u),p=a==="table"&&!h?c.firstChild&&c.firstChild.childNodes:f[1]===""&&!h?c.childNodes:[];for(o=p.length-1;o>=0;--o)v.nodeName(p[o],"tbody")&&!p[o].childNodes.length&&p[o].parentNode.removeChild(p[o])}!v.support.leadingWhitespace&&pt.test(u)&&c.insertBefore(t.createTextNode(pt.exec(u)[0]),c.firstChild),u=c.childNodes,c.parentNode.removeChild(c)}u.nodeType?b.push(u):v.merge(b,u)}c&&(u=c=y=null);if(!v.support.appendChecked)for(s=0;(u=b[s])!=null;s++)v.nodeName(u,"input")?_t(u):typeof u.getElementsByTagName!="undefined"&&v.grep(u.getElementsByTagName("input"),_t);if(n){m=function(e){if(!e.type||xt.test(e.type))return r?r.push(e.parentNode?e.parentNode.removeChild(e):e):n.appendChild(e)};for(s=0;(u=b[s])!=null;s++)if(!v.nodeName(u,"script")||!m(u))n.appendChild(u),typeof u.getElementsByTagName!="undefined"&&(g=v.grep(v.merge([],u.getElementsByTagName("script")),m),b.splice.apply(b,[s+1,0].concat(g)),s+=g.length)}return b},cleanData:function(e,t){var n,r,i,s,o=0,u=v.expando,a=v.cache,f=v.support.deleteExpando,l=v.event.special;for(;(i=e[o])!=null;o++)if(t||v.acceptData(i)){r=i[u],n=r&&a[r];if(n){if(n.events)for(s in n.events)l[s]?v.event.remove(i,s):v.removeEvent(i,s,n.handle);a[r]&&(delete a[r],f?delete i[u]:i.removeAttribute?i.removeAttribute(u):i[u]=null,v.deletedIds.push(r))}}}}),function(){var e,t;v.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=v.uaMatch(o.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),v.browser=t,v.sub=function(){function e(t,n){return new e.fn.init(t,n)}v.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(r,i){return i&&i instanceof v&&!(i instanceof e)&&(i=e(i)),v.fn.init.call(this,r,i,t)},e.fn.init.prototype=e.fn;var t=e(i);return e}}();var Dt,Pt,Ht,Bt=/alpha\([^)]*\)/i,jt=/opacity=([^)]*)/,Ft=/^(top|right|bottom|left)$/,It=/^(none|table(?!-c[ea]).+)/,qt=/^margin/,Rt=new RegExp("^("+m+")(.*)$","i"),Ut=new RegExp("^("+m+")(?!px)[a-z%]+$","i"),zt=new RegExp("^([-+])=("+m+")","i"),Wt={BODY:"block"},Xt={position:"absolute",visibility:"hidden",display:"block"},Vt={letterSpacing:0,fontWeight:400},$t=["Top","Right","Bottom","Left"],Jt=["Webkit","O","Moz","ms"],Kt=v.fn.toggle;v.fn.extend({css:function(e,n){return v.access(this,function(e,n,r){return r!==t?v.style(e,n,r):v.css(e,n)},e,n,arguments.length>1)},show:function(){return Yt(this,!0)},hide:function(){return Yt(this)},toggle:function(e,t){var n=typeof e=="boolean";return v.isFunction(e)&&v.isFunction(t)?Kt.apply(this,arguments):this.each(function(){(n?e:Gt(this))?v(this).show():v(this).hide()})}}),v.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Dt(e,"opacity");return n===""?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":v.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var s,o,u,a=v.camelCase(n),f=e.style;n=v.cssProps[a]||(v.cssProps[a]=Qt(f,a)),u=v.cssHooks[n]||v.cssHooks[a];if(r===t)return u&&"get"in u&&(s=u.get(e,!1,i))!==t?s:f[n];o=typeof r,o==="string"&&(s=zt.exec(r))&&(r=(s[1]+1)*s[2]+parseFloat(v.css(e,n)),o="number");if(r==null||o==="number"&&isNaN(r))return;o==="number"&&!v.cssNumber[a]&&(r+="px");if(!u||!("set"in u)||(r=u.set(e,r,i))!==t)try{f[n]=r}catch(l){}},css:function(e,n,r,i){var s,o,u,a=v.camelCase(n);return n=v.cssProps[a]||(v.cssProps[a]=Qt(e.style,a)),u=v.cssHooks[n]||v.cssHooks[a],u&&"get"in u&&(s=u.get(e,!0,i)),s===t&&(s=Dt(e,n)),s==="normal"&&n in Vt&&(s=Vt[n]),r||i!==t?(o=parseFloat(s),r||v.isNumeric(o)?o||0:s):s},swap:function(e,t,n){var r,i,s={};for(i in t)s[i]=e.style[i],e.style[i]=t[i];r=n.call(e);for(i in t)e.style[i]=s[i];return r}}),e.getComputedStyle?Dt=function(t,n){var r,i,s,o,u=e.getComputedStyle(t,null),a=t.style;return u&&(r=u.getPropertyValue(n)||u[n],r===""&&!v.contains(t.ownerDocument,t)&&(r=v.style(t,n)),Ut.test(r)&&qt.test(n)&&(i=a.width,s=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=r,r=u.width,a.width=i,a.minWidth=s,a.maxWidth=o)),r}:i.documentElement.currentStyle&&(Dt=function(e,t){var n,r,i=e.currentStyle&&e.currentStyle[t],s=e.style;return i==null&&s&&s[t]&&(i=s[t]),Ut.test(i)&&!Ft.test(t)&&(n=s.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),s.left=t==="fontSize"?"1em":i,i=s.pixelLeft+"px",s.left=n,r&&(e.runtimeStyle.left=r)),i===""?"auto":i}),v.each(["height","width"],function(e,t){v.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth===0&&It.test(Dt(e,"display"))?v.swap(e,Xt,function(){return tn(e,t,r)}):tn(e,t,r)},set:function(e,n,r){return Zt(e,n,r?en(e,t,r,v.support.boxSizing&&v.css(e,"boxSizing")==="border-box"):0)}}}),v.support.opacity||(v.cssHooks.opacity={get:function(e,t){return jt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=v.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&v.trim(s.replace(Bt,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=Bt.test(s)?s.replace(Bt,i):s+" "+i}}),v(function(){v.support.reliableMarginRight||(v.cssHooks.marginRight={get:function(e,t){return v.swap(e,{display:"inline-block"},function(){if(t)return Dt(e,"marginRight")})}}),!v.support.pixelPosition&&v.fn.position&&v.each(["top","left"],function(e,t){v.cssHooks[t]={get:function(e,n){if(n){var r=Dt(e,t);return Ut.test(r)?v(e).position()[t]+"px":r}}}})}),v.expr&&v.expr.filters&&(v.expr.filters.hidden=function(e){return e.offsetWidth===0&&e.offsetHeight===0||!v.support.reliableHiddenOffsets&&(e.style&&e.style.display||Dt(e,"display"))==="none"},v.expr.filters.visible=function(e){return!v.expr.filters.hidden(e)}),v.each({margin:"",padding:"",border:"Width"},function(e,t){v.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+$t[r]+t]=i[r]||i[r-2]||i[0];return s}},qt.test(e)||(v.cssHooks[e+t].set=Zt)});var rn=/%20/g,sn=/\[\]$/,on=/\r?\n/g,un=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,an=/^(?:select|textarea)/i;v.fn.extend({serialize:function(){return v.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?v.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||an.test(this.nodeName)||un.test(this.type))}).map(function(e,t){var n=v(this).val();return n==null?null:v.isArray(n)?v.map(n,function(e,n){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),v.param=function(e,n){var r,i=[],s=function(e,t){t=v.isFunction(t)?t():t==null?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=v.ajaxSettings&&v.ajaxSettings.traditional);if(v.isArray(e)||e.jquery&&!v.isPlainObject(e))v.each(e,function(){s(this.name,this.value)});else for(r in e)fn(r,e[r],n,s);return i.join("&").replace(rn,"+")};var ln,cn,hn=/#.*$/,pn=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,dn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,vn=/^(?:GET|HEAD)$/,mn=/^\/\//,gn=/\?/,yn=/)<[^<]*)*<\/script>/gi,bn=/([?&])_=[^&]*/,wn=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,En=v.fn.load,Sn={},xn={},Tn=["*/"]+["*"];try{cn=s.href}catch(Nn){cn=i.createElement("a"),cn.href="",cn=cn.href}ln=wn.exec(cn.toLowerCase())||[],v.fn.load=function(e,n,r){if(typeof e!="string"&&En)return En.apply(this,arguments);if(!this.length)return this;var i,s,o,u=this,a=e.indexOf(" ");return a>=0&&(i=e.slice(a,e.length),e=e.slice(0,a)),v.isFunction(n)?(r=n,n=t):n&&typeof n=="object"&&(s="POST"),v.ajax({url:e,type:s,dataType:"html",data:n,complete:function(e,t){r&&u.each(r,o||[e.responseText,t,e])}}).done(function(e){o=arguments,u.html(i?v("
              ").append(e.replace(yn,"")).find(i):e)}),this},v.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){v.fn[t]=function(e){return this.on(t,e)}}),v.each(["get","post"],function(e,n){v[n]=function(e,r,i,s){return v.isFunction(r)&&(s=s||i,i=r,r=t),v.ajax({type:n,url:e,data:r,success:i,dataType:s})}}),v.extend({getScript:function(e,n){return v.get(e,t,n,"script")},getJSON:function(e,t,n){return v.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?Ln(e,v.ajaxSettings):(t=e,e=v.ajaxSettings),Ln(e,t),e},ajaxSettings:{url:cn,isLocal:dn.test(ln[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Tn},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":v.parseJSON,"text xml":v.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:Cn(Sn),ajaxTransport:Cn(xn),ajax:function(e,n){function T(e,n,s,a){var l,y,b,w,S,T=n;if(E===2)return;E=2,u&&clearTimeout(u),o=t,i=a||"",x.readyState=e>0?4:0,s&&(w=An(c,x,s));if(e>=200&&e<300||e===304)c.ifModified&&(S=x.getResponseHeader("Last-Modified"),S&&(v.lastModified[r]=S),S=x.getResponseHeader("Etag"),S&&(v.etag[r]=S)),e===304?(T="notmodified",l=!0):(l=On(c,w),T=l.state,y=l.data,b=l.error,l=!b);else{b=T;if(!T||e)T="error",e<0&&(e=0)}x.status=e,x.statusText=(n||T)+"",l?d.resolveWith(h,[y,T,x]):d.rejectWith(h,[x,T,b]),x.statusCode(g),g=t,f&&p.trigger("ajax"+(l?"Success":"Error"),[x,c,l?y:b]),m.fireWith(h,[x,T]),f&&(p.trigger("ajaxComplete",[x,c]),--v.active||v.event.trigger("ajaxStop"))}typeof e=="object"&&(n=e,e=t),n=n||{};var r,i,s,o,u,a,f,l,c=v.ajaxSetup({},n),h=c.context||c,p=h!==c&&(h.nodeType||h instanceof v)?v(h):v.event,d=v.Deferred(),m=v.Callbacks("once memory"),g=c.statusCode||{},b={},w={},E=0,S="canceled",x={readyState:0,setRequestHeader:function(e,t){if(!E){var n=e.toLowerCase();e=w[n]=w[n]||e,b[e]=t}return this},getAllResponseHeaders:function(){return E===2?i:null},getResponseHeader:function(e){var n;if(E===2){if(!s){s={};while(n=pn.exec(i))s[n[1].toLowerCase()]=n[2]}n=s[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return E||(c.mimeType=e),this},abort:function(e){return e=e||S,o&&o.abort(e),T(0,e),this}};d.promise(x),x.success=x.done,x.error=x.fail,x.complete=m.add,x.statusCode=function(e){if(e){var t;if(E<2)for(t in e)g[t]=[g[t],e[t]];else t=e[x.status],x.always(t)}return this},c.url=((e||c.url)+"").replace(hn,"").replace(mn,ln[1]+"//"),c.dataTypes=v.trim(c.dataType||"*").toLowerCase().split(y),c.crossDomain==null&&(a=wn.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===ln[1]&&a[2]===ln[2]&&(a[3]||(a[1]==="http:"?80:443))==(ln[3]||(ln[1]==="http:"?80:443)))),c.data&&c.processData&&typeof c.data!="string"&&(c.data=v.param(c.data,c.traditional)),kn(Sn,c,n,x);if(E===2)return x;f=c.global,c.type=c.type.toUpperCase(),c.hasContent=!vn.test(c.type),f&&v.active++===0&&v.event.trigger("ajaxStart");if(!c.hasContent){c.data&&(c.url+=(gn.test(c.url)?"&":"?")+c.data,delete c.data),r=c.url;if(c.cache===!1){var N=v.now(),C=c.url.replace(bn,"$1_="+N);c.url=C+(C===c.url?(gn.test(c.url)?"&":"?")+"_="+N:"")}}(c.data&&c.hasContent&&c.contentType!==!1||n.contentType)&&x.setRequestHeader("Content-Type",c.contentType),c.ifModified&&(r=r||c.url,v.lastModified[r]&&x.setRequestHeader("If-Modified-Since",v.lastModified[r]),v.etag[r]&&x.setRequestHeader("If-None-Match",v.etag[r])),x.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+(c.dataTypes[0]!=="*"?", "+Tn+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)x.setRequestHeader(l,c.headers[l]);if(!c.beforeSend||c.beforeSend.call(h,x,c)!==!1&&E!==2){S="abort";for(l in{success:1,error:1,complete:1})x[l](c[l]);o=kn(xn,c,n,x);if(!o)T(-1,"No Transport");else{x.readyState=1,f&&p.trigger("ajaxSend",[x,c]),c.async&&c.timeout>0&&(u=setTimeout(function(){x.abort("timeout")},c.timeout));try{E=1,o.send(b,T)}catch(k){if(!(E<2))throw k;T(-1,k)}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var Mn=[],_n=/\?/,Dn=/(=)\?(?=&|$)|\?\?/,Pn=v.now();v.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Mn.pop()||v.expando+"_"+Pn++;return this[e]=!0,e}}),v.ajaxPrefilter("json jsonp",function(n,r,i){var s,o,u,a=n.data,f=n.url,l=n.jsonp!==!1,c=l&&Dn.test(f),h=l&&!c&&typeof a=="string"&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Dn.test(a);if(n.dataTypes[0]==="jsonp"||c||h)return s=n.jsonpCallback=v.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,o=e[s],c?n.url=f.replace(Dn,"$1"+s):h?n.data=a.replace(Dn,"$1"+s):l&&(n.url+=(_n.test(f)?"&":"?")+n.jsonp+"="+s),n.converters["script json"]=function(){return u||v.error(s+" was not called"),u[0]},n.dataTypes[0]="json",e[s]=function(){u=arguments},i.always(function(){e[s]=o,n[s]&&(n.jsonpCallback=r.jsonpCallback,Mn.push(s)),u&&v.isFunction(o)&&o(u[0]),u=o=t}),"script"}),v.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return v.globalEval(e),e}}}),v.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),v.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=i.head||i.getElementsByTagName("head")[0]||i.documentElement;return{send:function(s,o){n=i.createElement("script"),n.async="async",e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,i){if(i||!n.readyState||/loaded|complete/.test(n.readyState))n.onload=n.onreadystatechange=null,r&&n.parentNode&&r.removeChild(n),n=t,i||o(200,"success")},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(0,1)}}}});var Hn,Bn=e.ActiveXObject?function(){for(var e in Hn)Hn[e](0,1)}:!1,jn=0;v.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&Fn()||In()}:Fn,function(e){v.extend(v.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(v.ajaxSettings.xhr()),v.support.ajax&&v.ajaxTransport(function(n){if(!n.crossDomain||v.support.cors){var r;return{send:function(i,s){var o,u,a=n.xhr();n.username?a.open(n.type,n.url,n.async,n.username,n.password):a.open(n.type,n.url,n.async);if(n.xhrFields)for(u in n.xhrFields)a[u]=n.xhrFields[u];n.mimeType&&a.overrideMimeType&&a.overrideMimeType(n.mimeType),!n.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(u in i)a.setRequestHeader(u,i[u])}catch(f){}a.send(n.hasContent&&n.data||null),r=function(e,i){var u,f,l,c,h;try{if(r&&(i||a.readyState===4)){r=t,o&&(a.onreadystatechange=v.noop,Bn&&delete Hn[o]);if(i)a.readyState!==4&&a.abort();else{u=a.status,l=a.getAllResponseHeaders(),c={},h=a.responseXML,h&&h.documentElement&&(c.xml=h);try{c.text=a.responseText}catch(p){}try{f=a.statusText}catch(p){f=""}!u&&n.isLocal&&!n.crossDomain?u=c.text?200:404:u===1223&&(u=204)}}}catch(d){i||s(-1,d)}c&&s(u,f,c,l)},n.async?a.readyState===4?setTimeout(r,0):(o=++jn,Bn&&(Hn||(Hn={},v(e).unload(Bn)),Hn[o]=r),a.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var qn,Rn,Un=/^(?:toggle|show|hide)$/,zn=new RegExp("^(?:([-+])=|)("+m+")([a-z%]*)$","i"),Wn=/queueHooks$/,Xn=[Gn],Vn={"*":[function(e,t){var n,r,i=this.createTween(e,t),s=zn.exec(t),o=i.cur(),u=+o||0,a=1,f=20;if(s){n=+s[2],r=s[3]||(v.cssNumber[e]?"":"px");if(r!=="px"&&u){u=v.css(i.elem,e,!0)||n||1;do a=a||".5",u/=a,v.style(i.elem,e,u+r);while(a!==(a=i.cur()/o)&&a!==1&&--f)}i.unit=r,i.start=u,i.end=s[1]?u+(s[1]+1)*n:n}return i}]};v.Animation=v.extend(Kn,{tweener:function(e,t){v.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;r-1,f={},l={},c,h;a?(l=i.position(),c=l.top,h=l.left):(c=parseFloat(o)||0,h=parseFloat(u)||0),v.isFunction(t)&&(t=t.call(e,n,s)),t.top!=null&&(f.top=t.top-s.top+c),t.left!=null&&(f.left=t.left-s.left+h),"using"in t?t.using.call(e,f):i.css(f)}},v.fn.extend({position:function(){if(!this[0])return;var e=this[0],t=this.offsetParent(),n=this.offset(),r=er.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(v.css(e,"marginTop"))||0,n.left-=parseFloat(v.css(e,"marginLeft"))||0,r.top+=parseFloat(v.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(v.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||i.body;while(e&&!er.test(e.nodeName)&&v.css(e,"position")==="static")e=e.offsetParent;return e||i.body})}}),v.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);v.fn[e]=function(i){return v.access(this,function(e,i,s){var o=tr(e);if(s===t)return o?n in o?o[n]:o.document.documentElement[i]:e[i];o?o.scrollTo(r?v(o).scrollLeft():s,r?s:v(o).scrollTop()):e[i]=s},e,i,arguments.length,null)}}),v.each({Height:"height",Width:"width"},function(e,n){v.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){v.fn[i]=function(i,s){var o=arguments.length&&(r||typeof i!="boolean"),u=r||(i===!0||s===!0?"margin":"border");return v.access(this,function(n,r,i){var s;return v.isWindow(n)?n.document.documentElement["client"+e]:n.nodeType===9?(s=n.documentElement,Math.max(n.body["scroll"+e],s["scroll"+e],n.body["offset"+e],s["offset"+e],s["client"+e])):i===t?v.css(n,r,i,u):v.style(n,r,i,u)},n,o?i:t,o,null)}})}),e.jQuery=e.$=v,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return v})})(window); \ No newline at end of file diff --git a/assets/plugins/codemirror/cm/theme/one-dark.css b/assets/plugins/codemirror/cm/theme/one-dark.css index d7aa0a3d56..307689322e 100755 --- a/assets/plugins/codemirror/cm/theme/one-dark.css +++ b/assets/plugins/codemirror/cm/theme/one-dark.css @@ -1,161 +1,161 @@ -/* - Name: one-dark - Author: Török Ádám (http://github.com/Aerobird98) - - Original Atom One Dark Theme (https://github.com/atom/one-dark-syntax & https://github.com/atom/one-dark-ui) -*/ - -/* UI Theme /----------------------------------------------------------------------------------- */ -.cm-s-one-dark.CodeMirror { -border-color: transparent; -font-size: 1em; -} -.cm-s-one-dark.CodeMirror pre { -line-height: 1.3; -} -.cm-s-one-dark.CodeMirror .CodeMirror-activeline-background { -background: #23272f !important; -} -.cm-s-one-dark.CodeMirror .cm-tab::before { -content: ""; -position: absolute; -border-left: 1px solid #353b46; -height: 100%; -} -.cm-s-one-dark.CodeMirror .cm-tab:first-child::before { -display: none; -} -.cm-s-one-dark.CodeMirror, .cm-s-one-dark .CodeMirror-scroll { -font-family: 'Inconsolata', 'Monaco', 'Consolas', 'Courier New', 'Courier', monospace; -font-weight: 300; -font-size: 1em; -background-color: #282c34; -color: #abb2bf; -} -.cm-s-one-dark div.CodeMirror-selected { -background: #343c4a; -} -.cm-s-one-dark .CodeMirror-focused div.CodeMirror-selected { -background: #485263; -} -.cm-s-one-dark .CodeMirror-lines { -padding: 4px 0; /* Vertical padding around content */ -} -.cm-s-one-dark .CodeMirror pre { -padding: 0 4px; /* Horizontal padding of content */ -} -/* Gutter & Folding */ -.cm-s-one-dark .CodeMirror-gutters { -border-color: #3c4048; -} -.cm-s-one-dark .CodeMirror .CodeMirror-gutters, .cm-s-one-dark .CodeMirror-gutter { -white-space: nowrap; -border: none; -background: #282c34; -} -.cm-s-one-dark .CodeMirror-linenumber { -padding: 0 10px; -min-width: 20px; -text-align: right; -font-size: 0.8em; -white-space: nowrap; -color: #5f6b82; -} -/* ...folding addon: fold/... */ -.cm-s-one-dark .CodeMirror-foldmarker { -line-height: .3; -cursor: pointer; -color: #abb2bf; -background: #343c4a; -} -.cm-s-one-dark .CodeMirror-foldgutter { -width: 15px; -border: none; -} -.cm-s-one-dark .CodeMirror-foldgutter-open, .cm-s-one-dark .CodeMirror-foldgutter-folded { -cursor: pointer; -} -.cm-s-one-dark .CodeMirror-foldgutter-open:after { -content: "\25BE"; -color: #393e46; -} -.cm-s-one-dark .CodeMirror.over-gutter, .cm-s-one-dark .CodeMirror-activeline .CodeMirror-foldgutter-open:after { -color: #5c6370; -} -.cm-s-one-dark .CodeMirror-foldgutter-folded:after { -content: "\25B8"; -color: #5c6370; -} -/* ...misc */ -.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { -background-color: #ccc; /* The little square between H and V scrollbars */ -} -/* Cursor */ - -.cm-s-one-dark .CodeMirror-cursor { -border-left: 2px solid hsl(220, 100%, 66%) !important; -} -.cm-s-one-dark .CodeMirror-overwrite .CodeMirror-cursor { -border-left: none !important; -border-bottom: 1px solid #fff; -} -/* Popular addons */ - -/* addon: adit/machingbrackets.js & addon: edit/matchtags.js */ -.cm-s-one-dark .CodeMirror-matchingbracket, .cm-s-one-dark .CodeMirror-matchingtag { -/* Ensure visibility against gray inline editor background */ -background-color: rgba(204, 217, 255, 0.09); -color: #abb2bf !important; -border-bottom: 1px solid #528bff; -} -/* Syntax Theme /---------------------------------------------------------------------------------- */ - -/* markdown */ -.cm-s-one-dark .cm-header { color: #e06c75; } -.cm-s-one-dark .cm-quote { color: #5c6370; font-style: italic; } -.cm-s-one-dark .cm-negative { color: #e06c75; } -.cm-s-one-dark .cm-positive { color: #e06c75; } -.cm-s-one-dark .cm-strong { color: #d19a66; font-weight: bold; } -.cm-s-one-dark .cm-header .cm-strong { color: #d19a66; font-weight: bold; } -.cm-s-one-dark .cm-em { color: #c678dd; font-style: italic; } -.cm-s-one-dark .cm-header .cm-em { color: #c678dd; font-style: italic; } -/* xml, html, ... */ -.cm-s-one-dark .cm-tag { color: #e06c75; } -.cm-s-one-dark .cm-attribute { color: #d19a66; } -.cm-s-one-dark .cm-link { color: #98c379; border-bottom: solid 1px #98c379; } -/* other ... (for example javascript) */ -.cm-s-one-dark .cm-builtin { color: #e06c75; } -.cm-s-one-dark .cm-keyword { color: #c678dd; } -.cm-s-one-dark .cm-def { color: #e5c07b; } -/* original: #d19a66; */ - -.cm-s-one-dark .cm-atom { color: #d19a66; } -.cm-s-one-dark .cm-number { color: #d19a66; } -.cm-s-one-dark .cm-property { color: #61afef; } -/* original: #abb2bf */ -.cm-s-one-dark .cm-qualifier { color: #d19a66; } -.cm-s-one-dark .cm-variable { color: #e06c75; } -.cm-s-one-dark .cm-variable-2 { color: #abb2bf; } -.cm-s-one-dark .cm-variable-3 { color: #e5c07b; } -.cm-s-one-dark .cm-string { color: #98c379; } -.cm-s-one-dark .cm-string-2 { color: #98c379; } -.cm-s-one-dark .cm-punctuation { color: #abb2bf; } -.cm-s-one-dark .cm-operator { color: #abb2bf; } -.cm-s-one-dark .cm-meta { color: #abb2bf; } -.cm-s-one-dark .cm-bracket { color: #abb2bf; } -.cm-s-one-dark .cm-comment { color: #5c6370; font-style: italic; } -.cm-s-one-dark .cm-modxChunk, .cm-s-one-dark .cm-modxSnippet, .cm-s-one-dark .cm-modxTv, .cm-s-one-dark .cm-modxPlaceholder, .cm-s-one-dark .cm-modxSnippetNoCache, .cm-s-one-dark .cm-modxVariable, .cm-s-one-dark .cm-modxUrl, .cm-s-one-dark .cm-modxConfig { -color: #00d4c0; -font-weight: 100; -} -.cm-s-one-dark .cm-modxAttribute { -color: #009688; -} -.cm-s-one-dark .cm-modxAttributeValue { -font-weight: 100; -color: #ababab; -} -.cm-s-one-dark .cm-modxBinding { -color: #a859b5; -font-weight: 100; -} +/* + Name: one-dark + Author: Török Ádám (http://github.com/Aerobird98) + + Original Atom One Dark Theme (https://github.com/atom/one-dark-syntax & https://github.com/atom/one-dark-ui) +*/ + +/* UI Theme /----------------------------------------------------------------------------------- */ +.cm-s-one-dark.CodeMirror { +border-color: transparent; +font-size: 1em; +} +.cm-s-one-dark.CodeMirror pre { +line-height: 1.3; +} +.cm-s-one-dark.CodeMirror .CodeMirror-activeline-background { +background: #23272f !important; +} +.cm-s-one-dark.CodeMirror .cm-tab::before { +content: ""; +position: absolute; +border-left: 1px solid #353b46; +height: 100%; +} +.cm-s-one-dark.CodeMirror .cm-tab:first-child::before { +display: none; +} +.cm-s-one-dark.CodeMirror, .cm-s-one-dark .CodeMirror-scroll { +font-family: 'Inconsolata', 'Monaco', 'Consolas', 'Courier New', 'Courier', monospace; +font-weight: 300; +font-size: 1em; +background-color: #282c34; +color: #abb2bf; +} +.cm-s-one-dark div.CodeMirror-selected { +background: #343c4a; +} +.cm-s-one-dark .CodeMirror-focused div.CodeMirror-selected { +background: #485263; +} +.cm-s-one-dark .CodeMirror-lines { +padding: 4px 0; /* Vertical padding around content */ +} +.cm-s-one-dark .CodeMirror pre { +padding: 0 4px; /* Horizontal padding of content */ +} +/* Gutter & Folding */ +.cm-s-one-dark .CodeMirror-gutters { +border-color: #3c4048; +} +.cm-s-one-dark .CodeMirror .CodeMirror-gutters, .cm-s-one-dark .CodeMirror-gutter { +white-space: nowrap; +border: none; +background: #282c34; +} +.cm-s-one-dark .CodeMirror-linenumber { +padding: 0 10px; +min-width: 20px; +text-align: right; +font-size: 0.8em; +white-space: nowrap; +color: #5f6b82; +} +/* ...folding addon: fold/... */ +.cm-s-one-dark .CodeMirror-foldmarker { +line-height: .3; +cursor: pointer; +color: #abb2bf; +background: #343c4a; +} +.cm-s-one-dark .CodeMirror-foldgutter { +width: 15px; +border: none; +} +.cm-s-one-dark .CodeMirror-foldgutter-open, .cm-s-one-dark .CodeMirror-foldgutter-folded { +cursor: pointer; +} +.cm-s-one-dark .CodeMirror-foldgutter-open:after { +content: "\25BE"; +color: #393e46; +} +.cm-s-one-dark .CodeMirror.over-gutter, .cm-s-one-dark .CodeMirror-activeline .CodeMirror-foldgutter-open:after { +color: #5c6370; +} +.cm-s-one-dark .CodeMirror-foldgutter-folded:after { +content: "\25B8"; +color: #5c6370; +} +/* ...misc */ +.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { +background-color: #ccc; /* The little square between H and V scrollbars */ +} +/* Cursor */ + +.cm-s-one-dark .CodeMirror-cursor { +border-left: 2px solid hsl(220, 100%, 66%) !important; +} +.cm-s-one-dark .CodeMirror-overwrite .CodeMirror-cursor { +border-left: none !important; +border-bottom: 1px solid #fff; +} +/* Popular addons */ + +/* addon: adit/machingbrackets.js & addon: edit/matchtags.js */ +.cm-s-one-dark .CodeMirror-matchingbracket, .cm-s-one-dark .CodeMirror-matchingtag { +/* Ensure visibility against gray inline editor background */ +background-color: rgba(204, 217, 255, 0.09); +color: #abb2bf !important; +border-bottom: 1px solid #528bff; +} +/* Syntax Theme /---------------------------------------------------------------------------------- */ + +/* markdown */ +.cm-s-one-dark .cm-header { color: #e06c75; } +.cm-s-one-dark .cm-quote { color: #5c6370; font-style: italic; } +.cm-s-one-dark .cm-negative { color: #e06c75; } +.cm-s-one-dark .cm-positive { color: #e06c75; } +.cm-s-one-dark .cm-strong { color: #d19a66; font-weight: bold; } +.cm-s-one-dark .cm-header .cm-strong { color: #d19a66; font-weight: bold; } +.cm-s-one-dark .cm-em { color: #c678dd; font-style: italic; } +.cm-s-one-dark .cm-header .cm-em { color: #c678dd; font-style: italic; } +/* xml, html, ... */ +.cm-s-one-dark .cm-tag { color: #e06c75; } +.cm-s-one-dark .cm-attribute { color: #d19a66; } +.cm-s-one-dark .cm-link { color: #98c379; border-bottom: solid 1px #98c379; } +/* other ... (for example javascript) */ +.cm-s-one-dark .cm-builtin { color: #e06c75; } +.cm-s-one-dark .cm-keyword { color: #c678dd; } +.cm-s-one-dark .cm-def { color: #e5c07b; } +/* original: #d19a66; */ + +.cm-s-one-dark .cm-atom { color: #d19a66; } +.cm-s-one-dark .cm-number { color: #d19a66; } +.cm-s-one-dark .cm-property { color: #61afef; } +/* original: #abb2bf */ +.cm-s-one-dark .cm-qualifier { color: #d19a66; } +.cm-s-one-dark .cm-variable { color: #e06c75; } +.cm-s-one-dark .cm-variable-2 { color: #abb2bf; } +.cm-s-one-dark .cm-variable-3 { color: #e5c07b; } +.cm-s-one-dark .cm-string { color: #98c379; } +.cm-s-one-dark .cm-string-2 { color: #98c379; } +.cm-s-one-dark .cm-punctuation { color: #abb2bf; } +.cm-s-one-dark .cm-operator { color: #abb2bf; } +.cm-s-one-dark .cm-meta { color: #abb2bf; } +.cm-s-one-dark .cm-bracket { color: #abb2bf; } +.cm-s-one-dark .cm-comment { color: #5c6370; font-style: italic; } +.cm-s-one-dark .cm-modxChunk, .cm-s-one-dark .cm-modxSnippet, .cm-s-one-dark .cm-modxTv, .cm-s-one-dark .cm-modxPlaceholder, .cm-s-one-dark .cm-modxSnippetNoCache, .cm-s-one-dark .cm-modxVariable, .cm-s-one-dark .cm-modxUrl, .cm-s-one-dark .cm-modxConfig { +color: #00d4c0; +font-weight: 100; +} +.cm-s-one-dark .cm-modxAttribute { +color: #009688; +} +.cm-s-one-dark .cm-modxAttributeValue { +font-weight: 100; +color: #ababab; +} +.cm-s-one-dark .cm-modxBinding { +color: #a859b5; +font-weight: 100; +} diff --git a/assets/plugins/extrascheck/CheckOutdated.class.php b/assets/plugins/extrascheck/CheckOutdated.class.php index 521c6cab6a..038f54931a 100644 --- a/assets/plugins/extrascheck/CheckOutdated.class.php +++ b/assets/plugins/extrascheck/CheckOutdated.class.php @@ -1,468 +1,468 @@ -modx = $modx; - $this->pluginName = $pluginName; - $this->pluginId = $this->findPluginId(); - $this->extrasId = $this->findExtrasId(); - - $this->tpl = DLTemplate::getInstance($this->modx); - - $this->setLang($lang); - } - - /** - * @param string $source - * @return array - */ - public function load($source) - { - if (0 === strpos($source, 'http')) { - $data = Cache::remember('users', 24 * 60, function () use($source) { - return json_decode(file_get_contents($source), true); - }); - } else { - $data = file_get_contents($source); - $data = json_decode($data, true); - } - - return \is_array($data) ? $data : []; - } - - /** - * @param string $name - * @param array $options - * @return string - */ - public function snippet($name, $options) - { - $out = ''; - //search the snippet by name - - $snippet = \EvolutionCMS\Models\SiteSnippet::select('id', 'name', 'description') - ->where('name', $name)->where('disabled', 0)->first(); - - if (!is_null($snippet)) { - $tpl = isset($options['template']) ? $options['template'] : - '@CODE:
              ' . - ' ' . - '[+snippet+] [+name+] (version [+currentVersion+]) ' . - ' [+isSecurity:empty:then=`[+isoutdated+] Evolution [+evo_cms_version+]`:else=`[+security_reason+].`+]' . - '
              [+please_update+] [+name+] [+to_latest+]' . - ' ([+min_required+] [+minVersion+]) [+from+]' . - ' [+extras_module+] ' . - ' [+replaced:isnotempty=`[+or_move_to+]: [+replaced+]`+]' . - '
              '; - - $minVersion = isset($options['version']) ? $options['version'] : 0; - $replaced = isset($options['replaced']) ? implode(', ', $options['replaced']) : ''; - $isSecurity = !empty($options['security']); - - //extract snippet version from description tags - $currentVersion = $this->getver($snippet->description, 'strong'); - //check snippet version and return an alert if outdated - if (version_compare($currentVersion, $minVersion, 'lt')) { - $out .= $this->parseTemplate( - $tpl, - [ - 'name' => $snippet->name, - 'replaced' => $replaced, - 'isSecurity' => $isSecurity, - 'minVersion' => $minVersion, - 'currentVersion' => $currentVersion, - 'extrasID' => $this->getExtrasId(), - 'extrasURL' => $this->getExtrasUrl($snippet->name) - ] - ); - } - - } - - return $out; - } - - /** - * @param string $name - * @param array $options - * @return string - */ - public function plugin($name, $options) - { - $out = ''; - //search the plugin by name - - $plugin = \EvolutionCMS\Models\SitePlugin::select('id', 'name', 'description') - ->where('name', $name)->where('disabled', 0)->first(); - if (!is_null($plugin)) { - $tpl = isset($options['template']) ? $options['template'] : - '@CODE:
              ' . - ' ' . - '[+plugin+] [+name+] (version [+currentVersion+]) ' . - ' [+isSecurity:empty:then=`[+isoutdated+] Evolution [+evo_cms_version+]`:else=`[+security_reason+].`+]' . - '
              [+please_update+] [+name+] [+to_latest+]' . - ' ([+min_required+] [+minVersion+]) [+from+]' . - ' [+extras_module+] ' . - ' [+replaced:isnotempty=`[+or_move_to+]: [+replaced+]`+]' . - '
              '; - - $minVersion = isset($options['version']) ? $options['version'] : 0; - $replaced = isset($options['replaced']) ? implode(', ', $options['replaced']) : ''; - $isSecurity = !empty($options['security']); - - - //extract snippet version from description tags - $currentVersion = $this->getver($plugin->description, 'strong'); - //check snippet version and return an alert if outdated - if (version_compare($currentVersion, $minVersion, 'lt')) { - $out .= $this->parseTemplate( - $tpl, - [ - 'name' => $plugin->name, - 'replaced' => $replaced, - 'isSecurity' => $isSecurity, - 'minVersion' => $minVersion, - 'currentVersion' => $currentVersion, - 'extrasID' => $this->getExtrasId(), - 'extrasURL' => $this->getExtrasUrl($plugin->name) - ] - ); - } - } - - return $out; - } - - /** - * @param string $name - * @param array $options - * @return string - */ - public function module($name, $options) - { - $out = ''; - //search the module by name - $module = \EvolutionCMS\Models\SiteModule::select('id', 'name', 'description') - ->where('name', $name)->where('disabled', 0)->first(); - if (!is_null($module)) { - $tpl = isset($options['template']) ? $options['template'] : - '@CODE:
              ' . - ' ' . - '[+lock_element_type_6+] [+name+] (version [+currentVersion+]) ' . - ' [+isSecurity:empty:then=`[+isoutdated+] Evolution [+evo_cms_version+]`:else=`[+security_reason+].`+]' . - '
              [+please_update+] [+name+] [+to_latest+]' . - ' ([+min_required+] [+minVersion+]) [+from+]' . - ' [+extras_module+] ' . - ' [+replaced:isnotempty=`[+or_move_to+]: [+replaced+]`+]' . - '
              '; - - $minVersion = isset($options['version']) ? $options['version'] : 0; - $replaced = isset($options['replaced']) ? implode(', ', $options['replaced']) : ''; - $isSecurity = !empty($options['security']); - - while ($row = $this->modx->db->getRow($query)) { - //extract snippet version from description tags - $currentVersion = $this->getver($module->description, 'strong'); - //check snippet version and return an alert if outdated - if (version_compare($currentVersion, $minVersion, 'lt')) { - $out .= $this->parseTemplate( - $tpl, - [ - 'name' => $module->name, - 'replaced' => $replaced, - 'isSecurity' => $isSecurity, - 'minVersion' => $minVersion, - 'currentVersion' => $currentVersion, - 'extrasID' => $this->getExtrasId(), - 'extrasURL' => $this->getExtrasUrl($module->name) - ] - ); - } - } - } - - return $out; - } - - /** - * @param string $path - * @param array $options - * @return string - */ - public function file($path, $options = []) - { - $out = ''; - if (file_exists(EVO_BASE_PATH . $path)) { - $isSecurity = !empty($options['security']); - - $tpl = isset($options['template']) ? $options['template'] : - '@CODE:
              ' . - ' ' . - '[+path+] ' . - ' [+isSecurity:empty:then=`[+isoutdated+] Evolution [+evo_cms_version+]`:else=`[+security_reason+].`+]' . - '
              [+please_delete+]. [+if_dont_use+]' . - '
              '; - - $out = $this->parseTemplate($tpl, compact('path', 'isSecurity')); - } - - return $out; - } - - /** - * @param string $theme - * @param array $options - * @return string - */ - public function theme($theme, $options = []) - { - $out = ''; - if (file_exists(EVO_MANAGER_PATH . 'media/style/' . $theme)) { - $isSecurity = !empty($options['security']); - - $tpl = isset($options['template']) ? $options['template'] : - '@CODE:
              ' . - ' ' . - '[+manager_theme+] [+theme+] ' . - '[+isSecurity:empty:then=`[+isoutdated+] Evolution [+evo_cms_version+]`:else=`- [+security_reason+].`+]' . - '
              [+please_delete+] [+from_folder+] [+path+]. [+if_dont_use+]' . - '
              '; - - $out = $this->parseTemplate( - $tpl, - [ - 'theme' => $theme, - 'isSecurity' => $isSecurity, - 'path' => EVO_MANAGER_PATH . 'media/style/' - ] - ); - } - - return $out; - } - - /** - * @param string $key - * @param array $options - * @return string - */ - public function rss($key, $options) - { - $out = ''; - if (isset($options['old']) && $this->modx->getConfig($key) === $options['old']) { - $tpl = isset($options['template']) ? $options['template'] : - '@CODE:
              ' . - ' ' . - '[+settings_config+] > [+' . $key . '_title+] ' . - '([+oldUrl+]) [+outdated+]. ' . - '[+please_download_and_install+] UpdateEvosRss [+from+]' . - ' [+extras_module+]' . - '
              '; - - $out = $this->parseTemplate( - $tpl, - [ - 'extrasID' => $this->getExtrasId(), - 'oldUrl' => $options['old'] - ] - ); - } - - return $out; - } - - /** - * @return int - */ - public function getExtrasId() - { - return $this->extrasId; - } - - /** - * @param null $package - * @return string - */ - public function getExtrasUrl($package = null) - { - if ($this->getExtrasId() === 0) { - $url = 'https://extras.evo.im/find/' . $package; - } else { - $url = 'index.php?a=112&id=' . $this->getExtrasId(); - } - - return $url; - } - - /** - * @return int - */ - public function findExtrasId() - { - $moduleId = \EvolutionCMS\Models\SiteModule::select('id')->where('name', 'Extras')->where('disabled', 0)->first(); - if (!is_null($moduleId)) { - return (int)$moduleId->id; - } - return 0; - } - - /** - * @return int - */ - public function getPluginId() - { - return $this->pluginId; - } - - /** - * @return int - */ - public function findPluginId() - { - $pluginId = \EvolutionCMS\Models\SitePlugin::select('id')->where('name', $this->pluginName)->where('disabled', 0)->first(); - if (!is_null($pluginId)) { - return (int)$pluginId->id; - } - return 0; - } - - /** - * @param string $title - * @return string - */ - public function makeConfigButton($title) - { - $button = ''; - if ($this->modx->hasPermission('edit_plugin')) { - $popup = [ - 'url' => EVO_MANAGER_URL . '?a=102&id=' . $this->getPluginId() . '&tab=1', - 'title1' => $title, - 'icon' => 'fa-cog', - 'iframe' => 'iframe', - 'selector2' => '#tabConfig', - 'position' => 'center', - 'width' => '80%', - 'height' => '80%', - 'hide' => 0, - 'hover' => 0, - 'overlay' => 1, - 'overlayclose' => 1 - ]; - - $button = '' . - ' ' . - ''; - } - - return $button; - } - - /** - * @param array $lexicon - */ - public function setLang($lexicon = []) - { - $lang = $this->modx->getConfig('manager_language'); - if (file_exists( __DIR__ . '/lang/'.$lang.'/core.inc.php')){ - include_once(__DIR__ . '/lang/'.$lang.'/core.inc.php'); - } else { - include_once(__DIR__ . '/lang/english/core.inc.php'); - } - $this->lang = $_lang; - /* - $this->lang = new Helpers\Lexicon($this->modx, array( - 'lang' => $lang, - 'langDir' => 'assets/plugins/extrascheck/lang/' - )); - - if (!empty($lang)) { - $this->lang->fromArray(array($lang => $lexicon)); - } - $this->lang->loadLang();*/ - } - - /** - * @param string $type - * @param string $item - * @param array $options - * @return mixed - */ - public function process($type, $item, $options) - { - $available = ['rss', 'file', 'theme', 'snippet', 'plugin', 'module']; - - if (\in_array($type, $available) && method_exists($this, $type)) { - $out = $this->{$type}($item, $options); - } - return $out; - } - - /** - * @param string $tpl - * @param array $data - * @return string - */ - public function parseTemplate($tpl, $data = []) - { - return $this->tpl->parseChunk( - ($tpl), - array_merge( - ['evo_cms_version' => $this->modx->getVersionData('version')], - $data, - $this->lang - ), - true, - false - ); - } - - /** - * function to extract snippet version from description tags - * @param $string - * @param $tag - * @return mixed - */ - protected function getver($string, $tag) - { - $content = "/<$tag>(.*?)<\/$tag>/"; - preg_match($content, $string, $text); - if(isset($text[1])) - return $text[1]; - else return false; - } -} +modx = $modx; + $this->pluginName = $pluginName; + $this->pluginId = $this->findPluginId(); + $this->extrasId = $this->findExtrasId(); + + $this->tpl = DLTemplate::getInstance($this->modx); + + $this->setLang($lang); + } + + /** + * @param string $source + * @return array + */ + public function load($source) + { + if (0 === strpos($source, 'http')) { + $data = Cache::remember('users', 24 * 60, function () use($source) { + return json_decode(file_get_contents($source), true); + }); + } else { + $data = file_get_contents($source); + $data = json_decode($data, true); + } + + return \is_array($data) ? $data : []; + } + + /** + * @param string $name + * @param array $options + * @return string + */ + public function snippet($name, $options) + { + $out = ''; + //search the snippet by name + + $snippet = \EvolutionCMS\Models\SiteSnippet::select('id', 'name', 'description') + ->where('name', $name)->where('disabled', 0)->first(); + + if (!is_null($snippet)) { + $tpl = isset($options['template']) ? $options['template'] : + '@CODE:
              ' . + ' ' . + '[+snippet+] [+name+] (version [+currentVersion+]) ' . + ' [+isSecurity:empty:then=`[+isoutdated+] Evolution [+evo_cms_version+]`:else=`[+security_reason+].`+]' . + '
              [+please_update+] [+name+] [+to_latest+]' . + ' ([+min_required+] [+minVersion+]) [+from+]' . + ' [+extras_module+] ' . + ' [+replaced:isnotempty=`[+or_move_to+]: [+replaced+]`+]' . + '
              '; + + $minVersion = isset($options['version']) ? $options['version'] : 0; + $replaced = isset($options['replaced']) ? implode(', ', $options['replaced']) : ''; + $isSecurity = !empty($options['security']); + + //extract snippet version from description tags + $currentVersion = $this->getver($snippet->description, 'strong'); + //check snippet version and return an alert if outdated + if (version_compare($currentVersion, $minVersion, 'lt')) { + $out .= $this->parseTemplate( + $tpl, + [ + 'name' => $snippet->name, + 'replaced' => $replaced, + 'isSecurity' => $isSecurity, + 'minVersion' => $minVersion, + 'currentVersion' => $currentVersion, + 'extrasID' => $this->getExtrasId(), + 'extrasURL' => $this->getExtrasUrl($snippet->name) + ] + ); + } + + } + + return $out; + } + + /** + * @param string $name + * @param array $options + * @return string + */ + public function plugin($name, $options) + { + $out = ''; + //search the plugin by name + + $plugin = \EvolutionCMS\Models\SitePlugin::select('id', 'name', 'description') + ->where('name', $name)->where('disabled', 0)->first(); + if (!is_null($plugin)) { + $tpl = isset($options['template']) ? $options['template'] : + '@CODE:
              ' . + ' ' . + '[+plugin+] [+name+] (version [+currentVersion+]) ' . + ' [+isSecurity:empty:then=`[+isoutdated+] Evolution [+evo_cms_version+]`:else=`[+security_reason+].`+]' . + '
              [+please_update+] [+name+] [+to_latest+]' . + ' ([+min_required+] [+minVersion+]) [+from+]' . + ' [+extras_module+] ' . + ' [+replaced:isnotempty=`[+or_move_to+]: [+replaced+]`+]' . + '
              '; + + $minVersion = isset($options['version']) ? $options['version'] : 0; + $replaced = isset($options['replaced']) ? implode(', ', $options['replaced']) : ''; + $isSecurity = !empty($options['security']); + + + //extract snippet version from description tags + $currentVersion = $this->getver($plugin->description, 'strong'); + //check snippet version and return an alert if outdated + if (version_compare($currentVersion, $minVersion, 'lt')) { + $out .= $this->parseTemplate( + $tpl, + [ + 'name' => $plugin->name, + 'replaced' => $replaced, + 'isSecurity' => $isSecurity, + 'minVersion' => $minVersion, + 'currentVersion' => $currentVersion, + 'extrasID' => $this->getExtrasId(), + 'extrasURL' => $this->getExtrasUrl($plugin->name) + ] + ); + } + } + + return $out; + } + + /** + * @param string $name + * @param array $options + * @return string + */ + public function module($name, $options) + { + $out = ''; + //search the module by name + $module = \EvolutionCMS\Models\SiteModule::select('id', 'name', 'description') + ->where('name', $name)->where('disabled', 0)->first(); + if (!is_null($module)) { + $tpl = isset($options['template']) ? $options['template'] : + '@CODE:
              ' . + ' ' . + '[+lock_element_type_6+] [+name+] (version [+currentVersion+]) ' . + ' [+isSecurity:empty:then=`[+isoutdated+] Evolution [+evo_cms_version+]`:else=`[+security_reason+].`+]' . + '
              [+please_update+] [+name+] [+to_latest+]' . + ' ([+min_required+] [+minVersion+]) [+from+]' . + ' [+extras_module+] ' . + ' [+replaced:isnotempty=`[+or_move_to+]: [+replaced+]`+]' . + '
              '; + + $minVersion = isset($options['version']) ? $options['version'] : 0; + $replaced = isset($options['replaced']) ? implode(', ', $options['replaced']) : ''; + $isSecurity = !empty($options['security']); + + while ($row = $this->modx->db->getRow($query)) { + //extract snippet version from description tags + $currentVersion = $this->getver($module->description, 'strong'); + //check snippet version and return an alert if outdated + if (version_compare($currentVersion, $minVersion, 'lt')) { + $out .= $this->parseTemplate( + $tpl, + [ + 'name' => $module->name, + 'replaced' => $replaced, + 'isSecurity' => $isSecurity, + 'minVersion' => $minVersion, + 'currentVersion' => $currentVersion, + 'extrasID' => $this->getExtrasId(), + 'extrasURL' => $this->getExtrasUrl($module->name) + ] + ); + } + } + } + + return $out; + } + + /** + * @param string $path + * @param array $options + * @return string + */ + public function file($path, $options = []) + { + $out = ''; + if (file_exists(EVO_BASE_PATH . $path)) { + $isSecurity = !empty($options['security']); + + $tpl = isset($options['template']) ? $options['template'] : + '@CODE:
              ' . + ' ' . + '[+path+] ' . + ' [+isSecurity:empty:then=`[+isoutdated+] Evolution [+evo_cms_version+]`:else=`[+security_reason+].`+]' . + '
              [+please_delete+]. [+if_dont_use+]' . + '
              '; + + $out = $this->parseTemplate($tpl, compact('path', 'isSecurity')); + } + + return $out; + } + + /** + * @param string $theme + * @param array $options + * @return string + */ + public function theme($theme, $options = []) + { + $out = ''; + if (file_exists(EVO_MANAGER_PATH . 'media/style/' . $theme)) { + $isSecurity = !empty($options['security']); + + $tpl = isset($options['template']) ? $options['template'] : + '@CODE:
              ' . + ' ' . + '[+manager_theme+] [+theme+] ' . + '[+isSecurity:empty:then=`[+isoutdated+] Evolution [+evo_cms_version+]`:else=`- [+security_reason+].`+]' . + '
              [+please_delete+] [+from_folder+] [+path+]. [+if_dont_use+]' . + '
              '; + + $out = $this->parseTemplate( + $tpl, + [ + 'theme' => $theme, + 'isSecurity' => $isSecurity, + 'path' => EVO_MANAGER_PATH . 'media/style/' + ] + ); + } + + return $out; + } + + /** + * @param string $key + * @param array $options + * @return string + */ + public function rss($key, $options) + { + $out = ''; + if (isset($options['old']) && $this->modx->getConfig($key) === $options['old']) { + $tpl = isset($options['template']) ? $options['template'] : + '@CODE:
              ' . + ' ' . + '[+settings_config+] > [+' . $key . '_title+] ' . + '([+oldUrl+]) [+outdated+]. ' . + '[+please_download_and_install+] UpdateEvosRss [+from+]' . + ' [+extras_module+]' . + '
              '; + + $out = $this->parseTemplate( + $tpl, + [ + 'extrasID' => $this->getExtrasId(), + 'oldUrl' => $options['old'] + ] + ); + } + + return $out; + } + + /** + * @return int + */ + public function getExtrasId() + { + return $this->extrasId; + } + + /** + * @param null $package + * @return string + */ + public function getExtrasUrl($package = null) + { + if ($this->getExtrasId() === 0) { + $url = 'https://extras.evo.im/find/' . $package; + } else { + $url = 'index.php?a=112&id=' . $this->getExtrasId(); + } + + return $url; + } + + /** + * @return int + */ + public function findExtrasId() + { + $moduleId = \EvolutionCMS\Models\SiteModule::select('id')->where('name', 'Extras')->where('disabled', 0)->first(); + if (!is_null($moduleId)) { + return (int)$moduleId->id; + } + return 0; + } + + /** + * @return int + */ + public function getPluginId() + { + return $this->pluginId; + } + + /** + * @return int + */ + public function findPluginId() + { + $pluginId = \EvolutionCMS\Models\SitePlugin::select('id')->where('name', $this->pluginName)->where('disabled', 0)->first(); + if (!is_null($pluginId)) { + return (int)$pluginId->id; + } + return 0; + } + + /** + * @param string $title + * @return string + */ + public function makeConfigButton($title) + { + $button = ''; + if ($this->modx->hasPermission('edit_plugin')) { + $popup = [ + 'url' => EVO_MANAGER_URL . '?a=102&id=' . $this->getPluginId() . '&tab=1', + 'title1' => $title, + 'icon' => 'fa-cog', + 'iframe' => 'iframe', + 'selector2' => '#tabConfig', + 'position' => 'center', + 'width' => '80%', + 'height' => '80%', + 'hide' => 0, + 'hover' => 0, + 'overlay' => 1, + 'overlayclose' => 1 + ]; + + $button = '' . + ' ' . + ''; + } + + return $button; + } + + /** + * @param array $lexicon + */ + public function setLang($lexicon = []) + { + $lang = $this->modx->getConfig('manager_language'); + if (file_exists( __DIR__ . '/lang/'.$lang.'/core.inc.php')){ + include_once(__DIR__ . '/lang/'.$lang.'/core.inc.php'); + } else { + include_once(__DIR__ . '/lang/english/core.inc.php'); + } + $this->lang = $_lang; + /* + $this->lang = new Helpers\Lexicon($this->modx, array( + 'lang' => $lang, + 'langDir' => 'assets/plugins/extrascheck/lang/' + )); + + if (!empty($lang)) { + $this->lang->fromArray(array($lang => $lexicon)); + } + $this->lang->loadLang();*/ + } + + /** + * @param string $type + * @param string $item + * @param array $options + * @return mixed + */ + public function process($type, $item, $options) + { + $available = ['rss', 'file', 'theme', 'snippet', 'plugin', 'module']; + + if (\in_array($type, $available) && method_exists($this, $type)) { + $out = $this->{$type}($item, $options); + } + return $out; + } + + /** + * @param string $tpl + * @param array $data + * @return string + */ + public function parseTemplate($tpl, $data = []) + { + return $this->tpl->parseChunk( + ($tpl), + array_merge( + ['evo_cms_version' => $this->modx->getVersionData('version')], + $data, + $this->lang + ), + true, + false + ); + } + + /** + * function to extract snippet version from description tags + * @param $string + * @param $tag + * @return mixed + */ + protected function getver($string, $tag) + { + $content = "/<$tag>(.*?)<\/$tag>/"; + preg_match($content, $string, $text); + if(isset($text[1])) + return $text[1]; + else return false; + } +} diff --git a/assets/plugins/extrascheck/OutdatedExtrasCheck.plugin.php b/assets/plugins/extrascheck/OutdatedExtrasCheck.plugin.php index 65509fcb25..7fb3bbd2fa 100644 --- a/assets/plugins/extrascheck/OutdatedExtrasCheck.plugin.php +++ b/assets/plugins/extrascheck/OutdatedExtrasCheck.plugin.php @@ -1,64 +1,64 @@ -getLoginUserID(); -$sid = $modx->sid; -$role = (int)$_SESSION['mgrRole']; -$user = $_SESSION['mgrShortname']; - -switch (true) -{ - case ($role !== 1 && $wdgVisibility === 'AdminOnly'): - // show widget only to Admin role 1 - break; - case ($role === 1 && $wdgVisibility === 'AdminExcluded'): - // show widget to all manager users excluded Admin role 1 - break; - case (isset($ThisRole) && $role != $ThisRole && $wdgVisibility === 'ThisRoleOnly'): - // show widget only to "this" role id - break; - case (isset($ThisUser) && $user != $ThisUser && $wdgVisibility === 'ThisUserOnly'): - // show widget only to "this" username - break; - default: // get plugin id and setting button - global $_lang; - $plugin_path = __DIR__; - if (!class_exists('CheckOutdated')) { - include_once __DIR__ . '/CheckOutdated.class.php'; - } - $checkOutdated = new CheckOutdated($modx, $modx->event->activePlugin, $_lang); - $outdated = $checkOutdated->load( - 'https://raw.githubusercontent.com/evolution-cms/OutdatedExtrasCheck/master/outdated.json' - ); - - $out = ''; - foreach ($outdated as $type => $elements) { - foreach ($elements as $item => $options) { - $out .= $checkOutdated->process($type, $item, $options); - } - } - - if ($out !== '' && $modx->event->name === 'OnManagerWelcomeHome') { - $button = $checkOutdated->makeConfigButton($_lang['settings_config']); - $modx->setPlaceholder('button_pl_config', $button); - - $wdgTitle = $checkOutdated->parseTemplate('@CODE:EVO [+evo_cms_version+] - [+title+]'); - $widgets['xtraCheck'] = [ - 'menuindex' => '0', - 'id' => 'xtraCheck' . $checkOutdated->getPluginId() . '', - 'cols' => 'col-lg-12', - 'headAttr' => 'style="color:#E84B39;"', - 'bodyAttr' => '', - 'icon' => 'fa-warning', - 'title' => '' . $wdgTitle . ' ' . $button . '', - 'body' => '
              ' . $out . '
              ', - 'hide' => '0' - ]; - $modx->event->setOutput(serialize($widgets)); - } - break; -} +getLoginUserID(); +$sid = $modx->sid; +$role = (int)$_SESSION['mgrRole']; +$user = $_SESSION['mgrShortname']; + +switch (true) +{ + case ($role !== 1 && $wdgVisibility === 'AdminOnly'): + // show widget only to Admin role 1 + break; + case ($role === 1 && $wdgVisibility === 'AdminExcluded'): + // show widget to all manager users excluded Admin role 1 + break; + case (isset($ThisRole) && $role != $ThisRole && $wdgVisibility === 'ThisRoleOnly'): + // show widget only to "this" role id + break; + case (isset($ThisUser) && $user != $ThisUser && $wdgVisibility === 'ThisUserOnly'): + // show widget only to "this" username + break; + default: // get plugin id and setting button + global $_lang; + $plugin_path = __DIR__; + if (!class_exists('CheckOutdated')) { + include_once __DIR__ . '/CheckOutdated.class.php'; + } + $checkOutdated = new CheckOutdated($modx, $modx->event->activePlugin, $_lang); + $outdated = $checkOutdated->load( + 'https://raw.githubusercontent.com/evolution-cms/OutdatedExtrasCheck/master/outdated.json' + ); + + $out = ''; + foreach ($outdated as $type => $elements) { + foreach ($elements as $item => $options) { + $out .= $checkOutdated->process($type, $item, $options); + } + } + + if ($out !== '' && $modx->event->name === 'OnManagerWelcomeHome') { + $button = $checkOutdated->makeConfigButton($_lang['settings_config']); + $modx->setPlaceholder('button_pl_config', $button); + + $wdgTitle = $checkOutdated->parseTemplate('@CODE:EVO [+evo_cms_version+] - [+title+]'); + $widgets['xtraCheck'] = [ + 'menuindex' => '0', + 'id' => 'xtraCheck' . $checkOutdated->getPluginId() . '', + 'cols' => 'col-lg-12', + 'headAttr' => 'style="color:#E84B39;"', + 'bodyAttr' => '', + 'icon' => 'fa-warning', + 'title' => '' . $wdgTitle . ' ' . $button . '', + 'body' => '
              ' . $out . '
              ', + 'hide' => '0' + ]; + $modx->event->setOutput(serialize($widgets)); + } + break; +} diff --git a/assets/plugins/extrascheck/lang/english/core.inc.php b/assets/plugins/extrascheck/lang/english/core.inc.php index 34463d6d41..cadc60ed08 100644 --- a/assets/plugins/extrascheck/lang/english/core.inc.php +++ b/assets/plugins/extrascheck/lang/english/core.inc.php @@ -1,33 +1,33 @@ -outdated'; -$_lang['isoutdated'] = 'is outdated and no longer compatible with'; -$_lang['no'] = 'is outdated and no longer compatible with'; -$_lang['please_update'] = 'Please update'; -$_lang['please_delete'] = 'Please delete'; -$_lang['please_download_and_install'] = 'Please download and install'; -$_lang["to_latest"] = 'to the latest version'; -$_lang['min_required'] = 'min required'; -$_lang['from'] = 'from'; -$_lang['extras_module'] = 'Extras Module'; -$_lang['or_move_to'] = 'or move to'; -$_lang['not_used'] = 'is no longer used by'; -$_lang['from_folder'] = 'from folder'; -$_lang['if_dont_use'] = 'If you don\'t use for other purpose'; -$_lang['security_reason'] = 'is vulnerable'; - -return $_lang; +outdated'; +$_lang['isoutdated'] = 'is outdated and no longer compatible with'; +$_lang['no'] = 'is outdated and no longer compatible with'; +$_lang['please_update'] = 'Please update'; +$_lang['please_delete'] = 'Please delete'; +$_lang['please_download_and_install'] = 'Please download and install'; +$_lang["to_latest"] = 'to the latest version'; +$_lang['min_required'] = 'min required'; +$_lang['from'] = 'from'; +$_lang['extras_module'] = 'Extras Module'; +$_lang['or_move_to'] = 'or move to'; +$_lang['not_used'] = 'is no longer used by'; +$_lang['from_folder'] = 'from folder'; +$_lang['if_dont_use'] = 'If you don\'t use for other purpose'; +$_lang['security_reason'] = 'is vulnerable'; + +return $_lang; diff --git a/assets/plugins/extrascheck/lang/italian/core.inc.php b/assets/plugins/extrascheck/lang/italian/core.inc.php index 870fc038c7..e60e0fcb45 100644 --- a/assets/plugins/extrascheck/lang/italian/core.inc.php +++ b/assets/plugins/extrascheck/lang/italian/core.inc.php @@ -1,32 +1,32 @@ -obsoleto'; -$_lang['isoutdated'] = 'è obsoleto e non compatibile con'; -$_lang['please_update'] = 'Aggiorna'; -$_lang['please_delete'] = 'Per favore cancellalo'; -$_lang['please_download_and_install'] = 'Per favore scarica e installa'; -$_lang["to_latest"] = 'all\'ultima versione'; -$_lang['min_required'] = 'minima richiesta '; -$_lang['from'] = 'dal'; -$_lang['extras_module'] = 'Modulo Extras'; -$_lang['or_move_to'] = 'o passa a'; -$_lang['not_used'] = 'non è più utilizzato da'; -$_lang['from_folder'] = 'dalla cartella'; -$_lang['if_dont_use'] = 'Se non lo usi per altri scopi'; -$_lang['security_reason'] = 'vulnerabile'; - -return $_lang; +obsoleto'; +$_lang['isoutdated'] = 'è obsoleto e non compatibile con'; +$_lang['please_update'] = 'Aggiorna'; +$_lang['please_delete'] = 'Per favore cancellalo'; +$_lang['please_download_and_install'] = 'Per favore scarica e installa'; +$_lang["to_latest"] = 'all\'ultima versione'; +$_lang['min_required'] = 'minima richiesta '; +$_lang['from'] = 'dal'; +$_lang['extras_module'] = 'Modulo Extras'; +$_lang['or_move_to'] = 'o passa a'; +$_lang['not_used'] = 'non è più utilizzato da'; +$_lang['from_folder'] = 'dalla cartella'; +$_lang['if_dont_use'] = 'Se non lo usi per altri scopi'; +$_lang['security_reason'] = 'vulnerabile'; + +return $_lang; diff --git a/core/composer.lock b/core/composer.lock index 2b6b3615a2..45d63520ff 100644 --- a/core/composer.lock +++ b/core/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b52e2e83b0bbc059cf72183cd8044b7e", + "content-hash": "395bff4947dbc25a681102a9047000ec", "packages": [ { "name": "blade-ui-kit/blade-icons", @@ -149,16 +149,16 @@ }, { "name": "carbonphp/carbon-doctrine-types", - "version": "3.2.0", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/CarbonPHP/carbon-doctrine-types.git", - "reference": "18ba5ddfec8976260ead6e866180bd5d2f71aa1d" + "reference": "5fa5eacafd9ef47c8c6ab9143fc901ba0194d3dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/CarbonPHP/carbon-doctrine-types/zipball/18ba5ddfec8976260ead6e866180bd5d2f71aa1d", - "reference": "18ba5ddfec8976260ead6e866180bd5d2f71aa1d", + "url": "https://api.github.com/repos/CarbonPHP/carbon-doctrine-types/zipball/5fa5eacafd9ef47c8c6ab9143fc901ba0194d3dc", + "reference": "5fa5eacafd9ef47c8c6ab9143fc901ba0194d3dc", "shasum": "" }, "require": { @@ -173,6 +173,11 @@ "phpunit/phpunit": "^10.3" }, "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, "autoload": { "psr-4": { "Carbon\\Doctrine\\": "src/Carbon/Doctrine/" @@ -198,7 +203,7 @@ ], "support": { "issues": "https://github.com/CarbonPHP/carbon-doctrine-types/issues", - "source": "https://github.com/CarbonPHP/carbon-doctrine-types/tree/3.2.0" + "source": "https://github.com/CarbonPHP/carbon-doctrine-types/tree/3.2.1" }, "funding": [ { @@ -214,20 +219,20 @@ "type": "tidelift" } ], - "time": "2024-02-09T16:56:22+00:00" + "time": "2026-09-06T14:11:38+00:00" }, { "name": "composer/ca-bundle", - "version": "1.5.13", + "version": "1.5.14", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "c008272789979f709f7fcb32c2ecf1d2db5e84e5" + "reference": "0c8abba0634f637bd78c4e451981da368d403463" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/c008272789979f709f7fcb32c2ecf1d2db5e84e5", - "reference": "c008272789979f709f7fcb32c2ecf1d2db5e84e5", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/0c8abba0634f637bd78c4e451981da368d403463", + "reference": "0c8abba0634f637bd78c4e451981da368d403463", "shasum": "" }, "require": { @@ -274,7 +279,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/ca-bundle/issues", - "source": "https://github.com/composer/ca-bundle/tree/1.5.13" + "source": "https://github.com/composer/ca-bundle/tree/1.5.14" }, "funding": [ { @@ -286,7 +291,7 @@ "type": "github" } ], - "time": "2026-07-18T12:35:13+00:00" + "time": "2026-08-21T14:57:29+00:00" }, { "name": "composer/class-map-generator", @@ -1114,27 +1119,25 @@ }, { "name": "doctrine/lexer", - "version": "3.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd" + "reference": "e96fe45e92a54233726014a7cc7340abf29bb14c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd", - "reference": "31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/e96fe45e92a54233726014a7cc7340abf29bb14c", + "reference": "e96fe45e92a54233726014a7cc7340abf29bb14c", "shasum": "" }, "require": { "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^12", - "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^10.5", - "psalm/plugin-phpunit": "^0.18.3", - "vimeo/psalm": "^5.21" + "doctrine/coding-standard": "^14", + "phpstan/phpstan": "^2", + "phpunit/phpunit": "^10.5.58 || ^12.5.4" }, "type": "library", "autoload": { @@ -1171,7 +1174,7 @@ ], "support": { "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/3.0.1" + "source": "https://github.com/doctrine/lexer/tree/3.0.2" }, "funding": [ { @@ -1187,7 +1190,7 @@ "type": "tidelift" } ], - "time": "2024-02-05T11:56:58+00:00" + "time": "2026-06-14T20:44:06+00:00" }, { "name": "dragonmantank/cron-expression", @@ -1465,24 +1468,24 @@ }, { "name": "graham-campbell/result-type", - "version": "v1.1.4", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/GrahamCampbell/Result-Type.git", - "reference": "e01f4a821471308ba86aa202fed6698b6b695e3b" + "reference": "adccca3324eece92ca35463648c12b9e6293c05b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/e01f4a821471308ba86aa202fed6698b6b695e3b", - "reference": "e01f4a821471308ba86aa202fed6698b6b695e3b", + "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/adccca3324eece92ca35463648c12b9e6293c05b", + "reference": "adccca3324eece92ca35463648c12b9e6293c05b", "shasum": "" }, "require": { "php": "^7.2.5 || ^8.0", - "phpoption/phpoption": "^1.9.5" + "phpoption/phpoption": "^1.10" }, "require-dev": { - "phpunit/phpunit": "^8.5.41 || ^9.6.22 || ^10.5.45 || ^11.5.7" + "phpunit/phpunit": "^8.5.52 || ^9.6.34 || ^10.5.63 || ^11.5.55 || ^12.5.14" }, "type": "library", "autoload": { @@ -1511,7 +1514,7 @@ ], "support": { "issues": "https://github.com/GrahamCampbell/Result-Type/issues", - "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.4" + "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.2.0" }, "funding": [ { @@ -1523,26 +1526,26 @@ "type": "tidelift" } ], - "time": "2025-12-27T19:43:20+00:00" + "time": "2026-08-24T09:06:52+00:00" }, { "name": "guzzlehttp/guzzle", - "version": "7.15.3", + "version": "7.15.5", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "ae311b8f045ea93ce7b1c9cdb7cec06c53f944bc" + "reference": "ee80339fd9177ba44c49cdb653ff02a4d1106b9a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ae311b8f045ea93ce7b1c9cdb7cec06c53f944bc", - "reference": "ae311b8f045ea93ce7b1c9cdb7cec06c53f944bc", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ee80339fd9177ba44c49cdb653ff02a4d1106b9a", + "reference": "ee80339fd9177ba44c49cdb653ff02a4d1106b9a", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^2.5.2", - "guzzlehttp/psr7": "^2.13", + "guzzlehttp/promises": "^2.5.3", + "guzzlehttp/psr7": "^2.13.1", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.5 || ^3.0", @@ -1635,7 +1638,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.15.3" + "source": "https://github.com/guzzle/guzzle/tree/7.15.5" }, "funding": [ { @@ -1651,20 +1654,20 @@ "type": "tidelift" } ], - "time": "2026-08-05T19:48:21+00:00" + "time": "2026-08-24T09:21:06+00:00" }, { "name": "guzzlehttp/promises", - "version": "2.5.2", + "version": "2.5.3", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "2823687acff28b2dbe67b2508a6b300e2c3fa4ce" + "reference": "cde49999552d185d64715fe9c1f77a2aadd2f9f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/2823687acff28b2dbe67b2508a6b300e2c3fa4ce", - "reference": "2823687acff28b2dbe67b2508a6b300e2c3fa4ce", + "url": "https://api.github.com/repos/guzzle/promises/zipball/cde49999552d185d64715fe9c1f77a2aadd2f9f1", + "reference": "cde49999552d185d64715fe9c1f77a2aadd2f9f1", "shasum": "" }, "require": { @@ -1719,7 +1722,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.5.2" + "source": "https://github.com/guzzle/promises/tree/2.5.3" }, "funding": [ { @@ -1735,20 +1738,20 @@ "type": "tidelift" } ], - "time": "2026-08-05T19:30:54+00:00" + "time": "2026-08-24T09:11:28+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.13.0", + "version": "2.13.1", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "dad89620b7a6edb60c15858442eb2e408b45d8f4" + "reference": "95e7828100de18b4e269fb1703be530082d5166d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/dad89620b7a6edb60c15858442eb2e408b45d8f4", - "reference": "dad89620b7a6edb60c15858442eb2e408b45d8f4", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/95e7828100de18b4e269fb1703be530082d5166d", + "reference": "95e7828100de18b4e269fb1703be530082d5166d", "shasum": "" }, "require": { @@ -1838,7 +1841,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.13.0" + "source": "https://github.com/guzzle/psr7/tree/2.13.1" }, "funding": [ { @@ -1854,20 +1857,20 @@ "type": "tidelift" } ], - "time": "2026-07-16T22:23:49+00:00" + "time": "2026-08-24T09:13:11+00:00" }, { "name": "guzzlehttp/uri-template", - "version": "v1.0.10", + "version": "v1.0.11", "source": { "type": "git", "url": "https://github.com/guzzle/uri-template.git", - "reference": "f6c24c21f42b990e9a58912b332d0874df6ba839" + "reference": "d0058dccf4299d70c3d9da3378b8908b32780368" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/uri-template/zipball/f6c24c21f42b990e9a58912b332d0874df6ba839", - "reference": "f6c24c21f42b990e9a58912b332d0874df6ba839", + "url": "https://api.github.com/repos/guzzle/uri-template/zipball/d0058dccf4299d70c3d9da3378b8908b32780368", + "reference": "d0058dccf4299d70c3d9da3378b8908b32780368", "shasum": "" }, "require": { @@ -1924,7 +1927,7 @@ ], "support": { "issues": "https://github.com/guzzle/uri-template/issues", - "source": "https://github.com/guzzle/uri-template/tree/v1.0.10" + "source": "https://github.com/guzzle/uri-template/tree/v1.0.11" }, "funding": [ { @@ -1940,11 +1943,11 @@ "type": "tidelift" } ], - "time": "2026-07-17T13:53:03+00:00" + "time": "2026-08-24T09:15:32+00:00" }, { "name": "illuminate/bus", - "version": "v12.67.0", + "version": "v12.69.2", "source": { "type": "git", "url": "https://github.com/illuminate/bus.git", @@ -1997,7 +2000,7 @@ }, { "name": "illuminate/cache", - "version": "v12.67.0", + "version": "v12.69.2", "source": { "type": "git", "url": "https://github.com/illuminate/cache.git", @@ -2059,7 +2062,7 @@ }, { "name": "illuminate/collections", - "version": "v12.67.0", + "version": "v12.69.2", "source": { "type": "git", "url": "https://github.com/illuminate/collections.git", @@ -2119,7 +2122,7 @@ }, { "name": "illuminate/conditionable", - "version": "v12.67.0", + "version": "v12.69.2", "source": { "type": "git", "url": "https://github.com/illuminate/conditionable.git", @@ -2165,7 +2168,7 @@ }, { "name": "illuminate/config", - "version": "v12.67.0", + "version": "v12.69.2", "source": { "type": "git", "url": "https://github.com/illuminate/config.git", @@ -2213,16 +2216,16 @@ }, { "name": "illuminate/console", - "version": "v12.67.0", + "version": "v12.69.2", "source": { "type": "git", "url": "https://github.com/illuminate/console.git", - "reference": "ce37b63fb90f036dbd34263d84725f79c6d6f221" + "reference": "29f41bd7e07c14c04cb5acfaf9dc103adf2084aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/console/zipball/ce37b63fb90f036dbd34263d84725f79c6d6f221", - "reference": "ce37b63fb90f036dbd34263d84725f79c6d6f221", + "url": "https://api.github.com/repos/illuminate/console/zipball/29f41bd7e07c14c04cb5acfaf9dc103adf2084aa", + "reference": "29f41bd7e07c14c04cb5acfaf9dc103adf2084aa", "shasum": "" }, "require": { @@ -2275,11 +2278,11 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2026-07-29T14:35:23+00:00" + "time": "2026-09-08T13:37:54+00:00" }, { "name": "illuminate/container", - "version": "v12.67.0", + "version": "v12.69.2", "source": { "type": "git", "url": "https://github.com/illuminate/container.git", @@ -2341,7 +2344,7 @@ }, { "name": "illuminate/contracts", - "version": "v12.67.0", + "version": "v12.69.2", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", @@ -2389,16 +2392,16 @@ }, { "name": "illuminate/database", - "version": "v12.67.0", + "version": "v12.69.2", "source": { "type": "git", "url": "https://github.com/illuminate/database.git", - "reference": "6d539459fb55732a13e7f962afeffa9dca2a1cce" + "reference": "499f5112164d5bc4b744e0ac259b44e0a4c8aacc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/database/zipball/6d539459fb55732a13e7f962afeffa9dca2a1cce", - "reference": "6d539459fb55732a13e7f962afeffa9dca2a1cce", + "url": "https://api.github.com/repos/illuminate/database/zipball/499f5112164d5bc4b744e0ac259b44e0a4c8aacc", + "reference": "499f5112164d5bc4b744e0ac259b44e0a4c8aacc", "shasum": "" }, "require": { @@ -2458,11 +2461,11 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2026-08-14T15:00:48+00:00" + "time": "2026-09-06T21:11:25+00:00" }, { "name": "illuminate/events", - "version": "v12.67.0", + "version": "v12.69.2", "source": { "type": "git", "url": "https://github.com/illuminate/events.git", @@ -2517,7 +2520,7 @@ }, { "name": "illuminate/filesystem", - "version": "v12.67.0", + "version": "v12.69.2", "source": { "type": "git", "url": "https://github.com/illuminate/filesystem.git", @@ -2584,16 +2587,16 @@ }, { "name": "illuminate/http", - "version": "v12.67.0", + "version": "v12.69.2", "source": { "type": "git", "url": "https://github.com/illuminate/http.git", - "reference": "5f4f82ed0ed550a01f5d95c4ddbbad409fb0d560" + "reference": "a91f70083082bd6d466ea229dbbdfc48c553621c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/http/zipball/5f4f82ed0ed550a01f5d95c4ddbbad409fb0d560", - "reference": "5f4f82ed0ed550a01f5d95c4ddbbad409fb0d560", + "url": "https://api.github.com/repos/illuminate/http/zipball/a91f70083082bd6d466ea229dbbdfc48c553621c", + "reference": "a91f70083082bd6d466ea229dbbdfc48c553621c", "shasum": "" }, "require": { @@ -2642,11 +2645,11 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2026-08-06T14:28:07+00:00" + "time": "2026-08-24T22:07:52+00:00" }, { "name": "illuminate/log", - "version": "v12.67.0", + "version": "v12.69.2", "source": { "type": "git", "url": "https://github.com/illuminate/log.git", @@ -2699,7 +2702,7 @@ }, { "name": "illuminate/macroable", - "version": "v12.67.0", + "version": "v12.69.2", "source": { "type": "git", "url": "https://github.com/illuminate/macroable.git", @@ -2745,7 +2748,7 @@ }, { "name": "illuminate/pagination", - "version": "v12.67.0", + "version": "v12.69.2", "source": { "type": "git", "url": "https://github.com/illuminate/pagination.git", @@ -2795,7 +2798,7 @@ }, { "name": "illuminate/pipeline", - "version": "v12.67.0", + "version": "v12.69.2", "source": { "type": "git", "url": "https://github.com/illuminate/pipeline.git", @@ -2847,7 +2850,7 @@ }, { "name": "illuminate/queue", - "version": "v12.67.0", + "version": "v12.69.2", "source": { "type": "git", "url": "https://github.com/illuminate/queue.git", @@ -2914,7 +2917,7 @@ }, { "name": "illuminate/redis", - "version": "v12.67.0", + "version": "v12.69.2", "source": { "type": "git", "url": "https://github.com/illuminate/redis.git", @@ -2968,7 +2971,7 @@ }, { "name": "illuminate/reflection", - "version": "v12.67.0", + "version": "v12.69.2", "source": { "type": "git", "url": "https://github.com/illuminate/reflection.git", @@ -3019,7 +3022,7 @@ }, { "name": "illuminate/routing", - "version": "v12.67.0", + "version": "v12.69.2", "source": { "type": "git", "url": "https://github.com/illuminate/routing.git", @@ -3085,7 +3088,7 @@ }, { "name": "illuminate/session", - "version": "v12.67.0", + "version": "v12.69.2", "source": { "type": "git", "url": "https://github.com/illuminate/session.git", @@ -3142,7 +3145,7 @@ }, { "name": "illuminate/support", - "version": "v12.67.0", + "version": "v12.69.2", "source": { "type": "git", "url": "https://github.com/illuminate/support.git", @@ -3222,7 +3225,7 @@ }, { "name": "illuminate/translation", - "version": "v12.67.0", + "version": "v12.69.2", "source": { "type": "git", "url": "https://github.com/illuminate/translation.git", @@ -3273,7 +3276,7 @@ }, { "name": "illuminate/validation", - "version": "v12.67.0", + "version": "v12.69.2", "source": { "type": "git", "url": "https://github.com/illuminate/validation.git", @@ -3336,7 +3339,7 @@ }, { "name": "illuminate/view", - "version": "v12.67.0", + "version": "v12.69.2", "source": { "type": "git", "url": "https://github.com/illuminate/view.git", @@ -3447,19 +3450,20 @@ }, { "name": "justinrainbow/json-schema", - "version": "6.10.0", + "version": "6.12.0", "source": { "type": "git", "url": "https://github.com/jsonrainbow/json-schema.git", - "reference": "8b1308a9d7bdbdb20ce87ef920f82b4564bb2d33" + "reference": "8ef236a1a37df364b518b7411a4b5bb95b040d79" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jsonrainbow/json-schema/zipball/8b1308a9d7bdbdb20ce87ef920f82b4564bb2d33", - "reference": "8b1308a9d7bdbdb20ce87ef920f82b4564bb2d33", + "url": "https://api.github.com/repos/jsonrainbow/json-schema/zipball/8ef236a1a37df364b518b7411a4b5bb95b040d79", + "reference": "8ef236a1a37df364b518b7411a4b5bb95b040d79", "shasum": "" }, "require": { + "ext-filter": "*", "ext-json": "*", "marc-mabe/php-enum": "^4.4", "php": "^7.2 || ^8.0" @@ -3492,20 +3496,9 @@ ], "authors": [ { - "name": "Bruno Prieto Reis", - "email": "bruno.p.reis@gmail.com" - }, - { - "name": "Justin Rainbow", - "email": "justin.rainbow@gmail.com" - }, - { - "name": "Igor Wiedler", - "email": "igor@wiedler.ch" - }, - { - "name": "Robert Schönthal", - "email": "seroscho@googlemail.com" + "name": "Danny van der Sluijs", + "email": "danny.vandersluijs@icloud.com", + "role": "Maintainer" } ], "description": "A library to validate a json schema.", @@ -3516,22 +3509,22 @@ ], "support": { "issues": "https://github.com/jsonrainbow/json-schema/issues", - "source": "https://github.com/jsonrainbow/json-schema/tree/6.10.0" + "source": "https://github.com/jsonrainbow/json-schema/tree/6.12.0" }, - "time": "2026-06-16T20:50:26+00:00" + "time": "2026-09-04T12:54:20+00:00" }, { "name": "laravel/prompts", - "version": "v0.3.23", + "version": "v0.3.24", "source": { "type": "git", "url": "https://github.com/laravel/prompts.git", - "reference": "b7b4c35e5bc47450f6b6238c6cc9c47ba19b2221" + "reference": "5d3cdef29e93ca3b62b1871359db3078cd99908b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/prompts/zipball/b7b4c35e5bc47450f6b6238c6cc9c47ba19b2221", - "reference": "b7b4c35e5bc47450f6b6238c6cc9c47ba19b2221", + "url": "https://api.github.com/repos/laravel/prompts/zipball/5d3cdef29e93ca3b62b1871359db3078cd99908b", + "reference": "5d3cdef29e93ca3b62b1871359db3078cd99908b", "shasum": "" }, "require": { @@ -3575,22 +3568,22 @@ "description": "Add beautiful and user-friendly forms to your command-line applications.", "support": { "issues": "https://github.com/laravel/prompts/issues", - "source": "https://github.com/laravel/prompts/tree/v0.3.23" + "source": "https://github.com/laravel/prompts/tree/v0.3.24" }, - "time": "2026-08-11T18:58:24+00:00" + "time": "2026-08-20T12:55:36+00:00" }, { "name": "laravel/serializable-closure", - "version": "v2.0.15", + "version": "v2.0.16", "source": { "type": "git", "url": "https://github.com/laravel/serializable-closure.git", - "reference": "dccd8bcb851bb03fcc005df650b708b57cc52661" + "reference": "7cfc24e4fa2cca045fb8dd2a797a2b2b13b655ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/dccd8bcb851bb03fcc005df650b708b57cc52661", - "reference": "dccd8bcb851bb03fcc005df650b708b57cc52661", + "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/7cfc24e4fa2cca045fb8dd2a797a2b2b13b655ed", + "reference": "7cfc24e4fa2cca045fb8dd2a797a2b2b13b655ed", "shasum": "" }, "require": { @@ -3638,20 +3631,20 @@ "issues": "https://github.com/laravel/serializable-closure/issues", "source": "https://github.com/laravel/serializable-closure" }, - "time": "2026-07-21T16:49:22+00:00" + "time": "2026-08-18T20:28:54+00:00" }, { "name": "league/flysystem", - "version": "3.35.2", + "version": "3.36.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "b277b5dc3d56650b68904117124e79c851e12376" + "reference": "f7fb152932f30072d573510cbd4dd657d6475b25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/b277b5dc3d56650b68904117124e79c851e12376", - "reference": "b277b5dc3d56650b68904117124e79c851e12376", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/f7fb152932f30072d573510cbd4dd657d6475b25", + "reference": "f7fb152932f30072d573510cbd4dd657d6475b25", "shasum": "" }, "require": { @@ -3719,22 +3712,22 @@ ], "support": { "issues": "https://github.com/thephpleague/flysystem/issues", - "source": "https://github.com/thephpleague/flysystem/tree/3.35.2" + "source": "https://github.com/thephpleague/flysystem/tree/3.36.0" }, - "time": "2026-07-06T14:42:07+00:00" + "time": "2026-09-02T08:00:27+00:00" }, { "name": "league/flysystem-local", - "version": "3.31.0", + "version": "3.35.3", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem-local.git", - "reference": "2f669db18a4c20c755c2bb7d3a7b0b2340488079" + "reference": "a099b24dce160f3b2239043d13d47c4a1a214ea4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/2f669db18a4c20c755c2bb7d3a7b0b2340488079", - "reference": "2f669db18a4c20c755c2bb7d3a7b0b2340488079", + "url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/a099b24dce160f3b2239043d13d47c4a1a214ea4", + "reference": "a099b24dce160f3b2239043d13d47c4a1a214ea4", "shasum": "" }, "require": { @@ -3768,9 +3761,9 @@ "local" ], "support": { - "source": "https://github.com/thephpleague/flysystem-local/tree/3.31.0" + "source": "https://github.com/thephpleague/flysystem-local/tree/3.35.3" }, - "time": "2026-01-23T15:30:45+00:00" + "time": "2026-08-12T13:29:21+00:00" }, { "name": "league/mime-type-detection", @@ -3903,16 +3896,16 @@ }, { "name": "monolog/monolog", - "version": "3.10.0", + "version": "3.12.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "b321dd6749f0bf7189444158a3ce785cc16d69b0" + "reference": "72c534fc0ab181ef52d92a68382318631e301608" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/b321dd6749f0bf7189444158a3ce785cc16d69b0", - "reference": "b321dd6749f0bf7189444158a3ce785cc16d69b0", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/72c534fc0ab181ef52d92a68382318631e301608", + "reference": "72c534fc0ab181ef52d92a68382318631e301608", "shasum": "" }, "require": { @@ -3938,6 +3931,7 @@ "phpstan/phpstan-strict-rules": "^2", "phpunit/phpunit": "^10.5.17 || ^11.0.7", "predis/predis": "^1.1 || ^2", + "psr/clock": "^1.0", "rollbar/rollbar": "^4.0", "ruflin/elastica": "^7 || ^8", "symfony/mailer": "^5.4 || ^6", @@ -3956,6 +3950,7 @@ "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "psr/clock": "Required to pass a clock to the Logger and control the timestamp of log records", "rollbar/rollbar": "Allow sending log messages to Rollbar", "ruflin/elastica": "Allow sending log messages to an Elastic Search server" }, @@ -3990,7 +3985,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/3.10.0" + "source": "https://github.com/Seldaek/monolog/tree/3.12.0" }, "funding": [ { @@ -4002,20 +3997,20 @@ "type": "tidelift" } ], - "time": "2026-01-02T08:56:05+00:00" + "time": "2026-09-09T08:34:20+00:00" }, { "name": "nesbot/carbon", - "version": "3.13.2", + "version": "3.14.0", "source": { "type": "git", "url": "https://github.com/CarbonPHP/carbon.git", - "reference": "a1c54919f5fff9800cd03c32bd01defd5a4061cb" + "reference": "0023eaa2c9110e47446dd512a263c69c40cd41f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/CarbonPHP/carbon/zipball/a1c54919f5fff9800cd03c32bd01defd5a4061cb", - "reference": "a1c54919f5fff9800cd03c32bd01defd5a4061cb", + "url": "https://api.github.com/repos/CarbonPHP/carbon/zipball/0023eaa2c9110e47446dd512a263c69c40cd41f2", + "reference": "0023eaa2c9110e47446dd512a263c69c40cd41f2", "shasum": "" }, "require": { @@ -4107,7 +4102,7 @@ "type": "tidelift" } ], - "time": "2026-08-08T11:40:35+00:00" + "time": "2026-09-12T20:45:19+00:00" }, { "name": "nunomaduro/termwind", @@ -4280,16 +4275,16 @@ }, { "name": "phpoption/phpoption", - "version": "1.9.5", + "version": "1.10.0", "source": { "type": "git", "url": "https://github.com/schmittjoh/php-option.git", - "reference": "75365b91986c2405cf5e1e012c5595cd487a98be" + "reference": "67b192b6a42ec03944b972d6e633ddec78ad2c6d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/75365b91986c2405cf5e1e012c5595cd487a98be", - "reference": "75365b91986c2405cf5e1e012c5595cd487a98be", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/67b192b6a42ec03944b972d6e633ddec78ad2c6d", + "reference": "67b192b6a42ec03944b972d6e633ddec78ad2c6d", "shasum": "" }, "require": { @@ -4297,7 +4292,7 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.44 || ^9.6.25 || ^10.5.53 || ^11.5.34" + "phpunit/phpunit": "^8.5.54 || ^9.6.36 || ^10.5.64 || ^11.5.56 || ^12.5.33" }, "type": "library", "extra": { @@ -4339,7 +4334,7 @@ ], "support": { "issues": "https://github.com/schmittjoh/php-option/issues", - "source": "https://github.com/schmittjoh/php-option/tree/1.9.5" + "source": "https://github.com/schmittjoh/php-option/tree/1.10.0" }, "funding": [ { @@ -4351,20 +4346,20 @@ "type": "tidelift" } ], - "time": "2025-12-27T19:41:33+00:00" + "time": "2026-08-24T00:54:40+00:00" }, { "name": "predis/predis", - "version": "v3.6.0", + "version": "v3.6.1", "source": { "type": "git", "url": "https://github.com/predis/predis.git", - "reference": "2ff20c08bb63697245ffee3f198d1673086c302d" + "reference": "e2db96312ecf57a01a3477bf192d1ebc0ad7e9fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/predis/predis/zipball/2ff20c08bb63697245ffee3f198d1673086c302d", - "reference": "2ff20c08bb63697245ffee3f198d1673086c302d", + "url": "https://api.github.com/repos/predis/predis/zipball/e2db96312ecf57a01a3477bf192d1ebc0ad7e9fb", + "reference": "e2db96312ecf57a01a3477bf192d1ebc0ad7e9fb", "shasum": "" }, "require": { @@ -4406,7 +4401,7 @@ ], "support": { "issues": "https://github.com/predis/predis/issues", - "source": "https://github.com/predis/predis/tree/v3.6.0" + "source": "https://github.com/predis/predis/tree/v3.6.1" }, "funding": [ { @@ -4414,7 +4409,7 @@ "type": "github" } ], - "time": "2026-08-14T23:07:56+00:00" + "time": "2026-09-17T20:41:00+00:00" }, { "name": "psr/cache", @@ -4999,20 +4994,20 @@ }, { "name": "ramsey/uuid", - "version": "4.9.3", + "version": "4.9.4", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "1df15849d00943a67d677dc9cfd80795f038c9f8" + "reference": "75d73f48d02797c2c285a7e9f348fadc0102ffe2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/1df15849d00943a67d677dc9cfd80795f038c9f8", - "reference": "1df15849d00943a67d677dc9cfd80795f038c9f8", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/75d73f48d02797c2c285a7e9f348fadc0102ffe2", + "reference": "75d73f48d02797c2c285a7e9f348fadc0102ffe2", "shasum": "" }, "require": { - "brick/math": ">=0.8.16 <=0.18", + "brick/math": "^0.8.16 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13 || ^0.14 || ^0.15 || ^0.16 || ^0.17 || ^0.18 || ^0.19 || ^0.20 || ^1.0", "php": "^8.0", "ramsey/collection": "^1.2 || ^2.0" }, @@ -5071,9 +5066,9 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.9.3" + "source": "https://github.com/ramsey/uuid/tree/4.9.4" }, - "time": "2026-06-18T03:57:49+00:00" + "time": "2026-09-16T11:39:30+00:00" }, { "name": "react/promise", @@ -6007,16 +6002,16 @@ }, { "name": "symfony/console", - "version": "v7.4.16", + "version": "v7.4.19", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "f4c69c9aed03abf933b294257d618bdd9b30a06d" + "reference": "3a1973458b153f566a8d7499bc06ece323d60063" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/f4c69c9aed03abf933b294257d618bdd9b30a06d", - "reference": "f4c69c9aed03abf933b294257d618bdd9b30a06d", + "url": "https://api.github.com/repos/symfony/console/zipball/3a1973458b153f566a8d7499bc06ece323d60063", + "reference": "3a1973458b153f566a8d7499bc06ece323d60063", "shasum": "" }, "require": { @@ -6081,7 +6076,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.4.16" + "source": "https://github.com/symfony/console/tree/v7.4.19" }, "funding": [ { @@ -6101,7 +6096,7 @@ "type": "tidelift" } ], - "time": "2026-07-31T12:37:14+00:00" + "time": "2026-09-13T10:38:41+00:00" }, { "name": "symfony/deprecation-contracts", @@ -6176,16 +6171,16 @@ }, { "name": "symfony/error-handler", - "version": "v7.4.15", + "version": "v7.4.17", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "d49f6a19f326db41ae7103bdc38e3eb35a791261" + "reference": "8373921e231e190a88e2ad526951bbaa791576fa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/d49f6a19f326db41ae7103bdc38e3eb35a791261", - "reference": "d49f6a19f326db41ae7103bdc38e3eb35a791261", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/8373921e231e190a88e2ad526951bbaa791576fa", + "reference": "8373921e231e190a88e2ad526951bbaa791576fa", "shasum": "" }, "require": { @@ -6234,7 +6229,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v7.4.15" + "source": "https://github.com/symfony/error-handler/tree/v7.4.17" }, "funding": [ { @@ -6254,20 +6249,20 @@ "type": "tidelift" } ], - "time": "2026-07-21T15:13:06+00:00" + "time": "2026-08-21T17:40:08+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v7.4.15", + "version": "v7.4.17", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "336e7f3b9e95aba04f93ea9143920c2186abfbb9" + "reference": "d269974ee93c61d03620ffee358355bfdb471d66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/336e7f3b9e95aba04f93ea9143920c2186abfbb9", - "reference": "336e7f3b9e95aba04f93ea9143920c2186abfbb9", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d269974ee93c61d03620ffee358355bfdb471d66", + "reference": "d269974ee93c61d03620ffee358355bfdb471d66", "shasum": "" }, "require": { @@ -6319,7 +6314,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v7.4.15" + "source": "https://github.com/symfony/event-dispatcher/tree/v7.4.17" }, "funding": [ { @@ -6339,7 +6334,7 @@ "type": "tidelift" } ], - "time": "2026-07-21T15:13:06+00:00" + "time": "2026-08-21T17:40:08+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -6423,16 +6418,16 @@ }, { "name": "symfony/filesystem", - "version": "v7.4.15", + "version": "v7.4.18", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "ff16a16bf87fdf264638b8f6995b3515975e3c79" + "reference": "90d412aa5277c6819db39e7605aa46b1019e3232" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/ff16a16bf87fdf264638b8f6995b3515975e3c79", - "reference": "ff16a16bf87fdf264638b8f6995b3515975e3c79", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/90d412aa5277c6819db39e7605aa46b1019e3232", + "reference": "90d412aa5277c6819db39e7605aa46b1019e3232", "shasum": "" }, "require": { @@ -6469,7 +6464,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v7.4.15" + "source": "https://github.com/symfony/filesystem/tree/v7.4.18" }, "funding": [ { @@ -6489,20 +6484,20 @@ "type": "tidelift" } ], - "time": "2026-07-22T07:36:05+00:00" + "time": "2026-08-23T10:03:40+00:00" }, { "name": "symfony/finder", - "version": "v7.4.14", + "version": "v7.4.19", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "13b38720174286f55d1761152b575a8d1436fc25" + "reference": "1b900bc6ae5ba60c5eee69c11ba44566190576fe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/13b38720174286f55d1761152b575a8d1436fc25", - "reference": "13b38720174286f55d1761152b575a8d1436fc25", + "url": "https://api.github.com/repos/symfony/finder/zipball/1b900bc6ae5ba60c5eee69c11ba44566190576fe", + "reference": "1b900bc6ae5ba60c5eee69c11ba44566190576fe", "shasum": "" }, "require": { @@ -6537,7 +6532,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v7.4.14" + "source": "https://github.com/symfony/finder/tree/v7.4.19" }, "funding": [ { @@ -6557,20 +6552,20 @@ "type": "tidelift" } ], - "time": "2026-06-27T08:31:18+00:00" + "time": "2026-09-10T19:14:10+00:00" }, { "name": "symfony/http-foundation", - "version": "v7.4.16", + "version": "v7.4.19", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "b676451bb638e99a7d34d8a2be90406822e301eb" + "reference": "f7b953be7801974a5a0685e1228bbc3b12b35936" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/b676451bb638e99a7d34d8a2be90406822e301eb", - "reference": "b676451bb638e99a7d34d8a2be90406822e301eb", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/f7b953be7801974a5a0685e1228bbc3b12b35936", + "reference": "f7b953be7801974a5a0685e1228bbc3b12b35936", "shasum": "" }, "require": { @@ -6619,7 +6614,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v7.4.16" + "source": "https://github.com/symfony/http-foundation/tree/v7.4.19" }, "funding": [ { @@ -6639,20 +6634,20 @@ "type": "tidelift" } ], - "time": "2026-08-07T11:50:27+00:00" + "time": "2026-09-14T17:41:17+00:00" }, { "name": "symfony/http-kernel", - "version": "v7.4.16", + "version": "v7.4.19", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "f5e728670fa2218ae8be8ea91f2b44b7d6e5304c" + "reference": "683507424cc84ca85ac1551adb609b6b98216667" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/f5e728670fa2218ae8be8ea91f2b44b7d6e5304c", - "reference": "f5e728670fa2218ae8be8ea91f2b44b7d6e5304c", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/683507424cc84ca85ac1551adb609b6b98216667", + "reference": "683507424cc84ca85ac1551adb609b6b98216667", "shasum": "" }, "require": { @@ -6738,7 +6733,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v7.4.16" + "source": "https://github.com/symfony/http-kernel/tree/v7.4.19" }, "funding": [ { @@ -6758,20 +6753,20 @@ "type": "tidelift" } ], - "time": "2026-08-07T18:00:13+00:00" + "time": "2026-09-15T07:09:35+00:00" }, { "name": "symfony/mime", - "version": "v7.4.16", + "version": "v7.4.19", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "20094b76a7106dbe978d31cd3bd7aa1ed248d0e5" + "reference": "f8ac7d0a800bcabbcd1f7de56594cf05e6cd5693" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/20094b76a7106dbe978d31cd3bd7aa1ed248d0e5", - "reference": "20094b76a7106dbe978d31cd3bd7aa1ed248d0e5", + "url": "https://api.github.com/repos/symfony/mime/zipball/f8ac7d0a800bcabbcd1f7de56594cf05e6cd5693", + "reference": "f8ac7d0a800bcabbcd1f7de56594cf05e6cd5693", "shasum": "" }, "require": { @@ -6795,7 +6790,7 @@ "symfony/process": "^6.4|^7.0|^8.0", "symfony/property-access": "^6.4|^7.0|^8.0", "symfony/property-info": "^6.4|^7.0|^8.0", - "symfony/serializer": "^6.4.3|^7.0.3|^8.0" + "symfony/serializer": "^6.4.44|^7.4.17|^8.1.5" }, "type": "library", "autoload": { @@ -6827,7 +6822,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v7.4.16" + "source": "https://github.com/symfony/mime/tree/v7.4.19" }, "funding": [ { @@ -6847,7 +6842,7 @@ "type": "tidelift" } ], - "time": "2026-08-07T14:56:57+00:00" + "time": "2026-09-04T10:45:44+00:00" }, { "name": "symfony/polyfill-ctype", @@ -7016,16 +7011,16 @@ }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.38.1", + "version": "v1.42.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "dc21118016c039a66235cf93d96b435ffb282412" + "reference": "51b5ff5ba85452b31ec6f55490b08148612339d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/dc21118016c039a66235cf93d96b435ffb282412", - "reference": "dc21118016c039a66235cf93d96b435ffb282412", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/51b5ff5ba85452b31ec6f55490b08148612339d9", + "reference": "51b5ff5ba85452b31ec6f55490b08148612339d9", "shasum": "" }, "require": { @@ -7079,7 +7074,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.38.1" + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.42.0" }, "funding": [ { @@ -7099,20 +7094,20 @@ "type": "tidelift" } ], - "time": "2026-05-25T15:22:23+00:00" + "time": "2026-08-24T10:51:20+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.38.0", + "version": "v1.42.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "2d446c214bdbe5b71bde5011b060a05fece3ae6b" + "reference": "aa20edea75bd9c48cfecc8360922e5a6e5c44502" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/2d446c214bdbe5b71bde5011b060a05fece3ae6b", - "reference": "2d446c214bdbe5b71bde5011b060a05fece3ae6b", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/aa20edea75bd9c48cfecc8360922e5a6e5c44502", + "reference": "aa20edea75bd9c48cfecc8360922e5a6e5c44502", "shasum": "" }, "require": { @@ -7164,7 +7159,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.38.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.42.0" }, "funding": [ { @@ -7184,7 +7179,7 @@ "type": "tidelift" } ], - "time": "2026-05-25T13:48:31+00:00" + "time": "2026-08-07T06:33:24+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -7433,16 +7428,16 @@ }, { "name": "symfony/process", - "version": "v7.4.13", + "version": "v7.4.19", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "f5804be144caceb570f6747519999636b664f24c" + "reference": "ed0ae095b86994d370d5791612e55984f15aa30e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/f5804be144caceb570f6747519999636b664f24c", - "reference": "f5804be144caceb570f6747519999636b664f24c", + "url": "https://api.github.com/repos/symfony/process/zipball/ed0ae095b86994d370d5791612e55984f15aa30e", + "reference": "ed0ae095b86994d370d5791612e55984f15aa30e", "shasum": "" }, "require": { @@ -7474,7 +7469,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.4.13" + "source": "https://github.com/symfony/process/tree/v7.4.19" }, "funding": [ { @@ -7494,20 +7489,20 @@ "type": "tidelift" } ], - "time": "2026-05-23T16:05:06+00:00" + "time": "2026-09-02T12:38:34+00:00" }, { "name": "symfony/routing", - "version": "v7.4.15", + "version": "v7.4.18", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "80c0a93d3f8e7499f716204a1fb38ead942a7a2b" + "reference": "ddd558991e98f693ae6bf5063cc1b0362c6bbec3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/80c0a93d3f8e7499f716204a1fb38ead942a7a2b", - "reference": "80c0a93d3f8e7499f716204a1fb38ead942a7a2b", + "url": "https://api.github.com/repos/symfony/routing/zipball/ddd558991e98f693ae6bf5063cc1b0362c6bbec3", + "reference": "ddd558991e98f693ae6bf5063cc1b0362c6bbec3", "shasum": "" }, "require": { @@ -7559,7 +7554,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v7.4.15" + "source": "https://github.com/symfony/routing/tree/v7.4.18" }, "funding": [ { @@ -7579,20 +7574,20 @@ "type": "tidelift" } ], - "time": "2026-07-21T15:13:06+00:00" + "time": "2026-08-17T13:12:36+00:00" }, { "name": "symfony/service-contracts", - "version": "v3.7.1", + "version": "v3.7.3", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "c0a284bab1ed8aa0417e3d69250ab437739563a0" + "reference": "15e6a07ec2a2c75ceb1b21dd98105ee8456d2257" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/c0a284bab1ed8aa0417e3d69250ab437739563a0", - "reference": "c0a284bab1ed8aa0417e3d69250ab437739563a0", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/15e6a07ec2a2c75ceb1b21dd98105ee8456d2257", + "reference": "15e6a07ec2a2c75ceb1b21dd98105ee8456d2257", "shasum": "" }, "require": { @@ -7646,7 +7641,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.7.1" + "source": "https://github.com/symfony/service-contracts/tree/v3.7.3" }, "funding": [ { @@ -7666,20 +7661,20 @@ "type": "tidelift" } ], - "time": "2026-06-16T09:55:08+00:00" + "time": "2026-07-27T15:39:01+00:00" }, { "name": "symfony/string", - "version": "v7.4.15", + "version": "v7.4.19", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "e394af32256bf9e7bf80849d95e589167c10097b" + "reference": "02731ce2bd26514bec9efc0baef2cd0b0cf67f46" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/e394af32256bf9e7bf80849d95e589167c10097b", - "reference": "e394af32256bf9e7bf80849d95e589167c10097b", + "url": "https://api.github.com/repos/symfony/string/zipball/02731ce2bd26514bec9efc0baef2cd0b0cf67f46", + "reference": "02731ce2bd26514bec9efc0baef2cd0b0cf67f46", "shasum": "" }, "require": { @@ -7737,7 +7732,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.4.15" + "source": "https://github.com/symfony/string/tree/v7.4.19" }, "funding": [ { @@ -7757,20 +7752,20 @@ "type": "tidelift" } ], - "time": "2026-07-28T07:33:02+00:00" + "time": "2026-09-11T14:46:58+00:00" }, { "name": "symfony/translation", - "version": "v7.4.16", + "version": "v7.4.17", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "501e0ff4553c744209ca1a68790d8a4541563710" + "reference": "2ee1e4a3b32a528a642babe041ff7c440b213b4b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/501e0ff4553c744209ca1a68790d8a4541563710", - "reference": "501e0ff4553c744209ca1a68790d8a4541563710", + "url": "https://api.github.com/repos/symfony/translation/zipball/2ee1e4a3b32a528a642babe041ff7c440b213b4b", + "reference": "2ee1e4a3b32a528a642babe041ff7c440b213b4b", "shasum": "" }, "require": { @@ -7837,7 +7832,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v7.4.16" + "source": "https://github.com/symfony/translation/tree/v7.4.17" }, "funding": [ { @@ -7857,7 +7852,7 @@ "type": "tidelift" } ], - "time": "2026-07-30T12:37:26+00:00" + "time": "2026-08-21T17:40:08+00:00" }, { "name": "symfony/translation-contracts", @@ -7943,16 +7938,16 @@ }, { "name": "symfony/var-dumper", - "version": "v7.4.15", + "version": "v7.4.18", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "04ba4add636a95ff437af3a5a9499bb1d6c6d4bd" + "reference": "e088da50b813f32473a76871616cbb8fa54653a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/04ba4add636a95ff437af3a5a9499bb1d6c6d4bd", - "reference": "04ba4add636a95ff437af3a5a9499bb1d6c6d4bd", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/e088da50b813f32473a76871616cbb8fa54653a8", + "reference": "e088da50b813f32473a76871616cbb8fa54653a8", "shasum": "" }, "require": { @@ -8006,7 +8001,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v7.4.15" + "source": "https://github.com/symfony/var-dumper/tree/v7.4.18" }, "funding": [ { @@ -8026,7 +8021,7 @@ "type": "tidelift" } ], - "time": "2026-07-21T15:13:06+00:00" + "time": "2026-08-30T20:10:52+00:00" }, { "name": "tracy/tracy", @@ -8110,23 +8105,23 @@ }, { "name": "vlucas/phpdotenv", - "version": "v5.6.4", + "version": "v5.7.0", "source": { "type": "git", "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "416df702837983f8d5ff48c9c3fee4f5f57b980b" + "reference": "301c07936b16d88628b126b01d082ba153cf4c40" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/416df702837983f8d5ff48c9c3fee4f5f57b980b", - "reference": "416df702837983f8d5ff48c9c3fee4f5f57b980b", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/301c07936b16d88628b126b01d082ba153cf4c40", + "reference": "301c07936b16d88628b126b01d082ba153cf4c40", "shasum": "" }, "require": { "ext-pcre": "*", - "graham-campbell/result-type": "^1.1.4", + "graham-campbell/result-type": "^1.2", "php": "^7.2.5 || ^8.0", - "phpoption/phpoption": "^1.9.5", + "phpoption/phpoption": "^1.10", "symfony/polyfill-ctype": "^1.26", "symfony/polyfill-mbstring": "^1.26", "symfony/polyfill-php80": "^1.26" @@ -8170,7 +8165,7 @@ "homepage": "https://github.com/vlucas" } ], - "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", + "description": "Loads environment variables from `.env` to `$_ENV` and `$_SERVER` automagically, and optionally to `getenv()`.", "keywords": [ "dotenv", "env", @@ -8178,7 +8173,7 @@ ], "support": { "issues": "https://github.com/vlucas/phpdotenv/issues", - "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.4" + "source": "https://github.com/vlucas/phpdotenv/tree/v5.7.0" }, "funding": [ { @@ -8190,7 +8185,7 @@ "type": "tidelift" } ], - "time": "2026-07-06T19:11:50+00:00" + "time": "2026-08-24T18:07:49+00:00" }, { "name": "voku/portable-ascii", @@ -8480,16 +8475,16 @@ }, { "name": "filp/whoops", - "version": "2.18.4", + "version": "2.18.5", "source": { "type": "git", "url": "https://github.com/filp/whoops.git", - "reference": "d2102955e48b9fd9ab24280a7ad12ed552752c4d" + "reference": "baec851ad6ae00db8bd0fdd30d208afc1b71c56e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/d2102955e48b9fd9ab24280a7ad12ed552752c4d", - "reference": "d2102955e48b9fd9ab24280a7ad12ed552752c4d", + "url": "https://api.github.com/repos/filp/whoops/zipball/baec851ad6ae00db8bd0fdd30d208afc1b71c56e", + "reference": "baec851ad6ae00db8bd0fdd30d208afc1b71c56e", "shasum": "" }, "require": { @@ -8498,8 +8493,8 @@ }, "require-dev": { "mockery/mockery": "^1.0", - "phpunit/phpunit": "^7.5.20 || ^8.5.8 || ^9.3.3", - "symfony/var-dumper": "^4.0 || ^5.0" + "phpunit/phpunit": "^7.5.20 || ^8.5.8 || ^9.3.3 || ^10.5.58", + "symfony/var-dumper": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0" }, "suggest": { "symfony/var-dumper": "Pretty print complex values better with var-dumper available", @@ -8539,7 +8534,7 @@ ], "support": { "issues": "https://github.com/filp/whoops/issues", - "source": "https://github.com/filp/whoops/tree/2.18.4" + "source": "https://github.com/filp/whoops/tree/2.18.5" }, "funding": [ { @@ -8547,7 +8542,7 @@ "type": "github" } ], - "time": "2025-08-08T12:00:00+00:00" + "time": "2026-09-18T12:00:00+00:00" }, { "name": "hamcrest/hamcrest-php", @@ -8808,16 +8803,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.8.0", + "version": "v5.9.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "044a6a392ff8ad0d61f14370a5fbbd0a0107152f" + "reference": "9e33da9553fe7786f0962b35f4e4ecf01be89def" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/044a6a392ff8ad0d61f14370a5fbbd0a0107152f", - "reference": "044a6a392ff8ad0d61f14370a5fbbd0a0107152f", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/9e33da9553fe7786f0962b35f4e4ecf01be89def", + "reference": "9e33da9553fe7786f0962b35f4e4ecf01be89def", "shasum": "" }, "require": { @@ -8859,9 +8854,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.8.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.9.0" }, - "time": "2026-07-04T14:30:18+00:00" + "time": "2026-09-13T18:51:52+00:00" }, { "name": "nunomaduro/collision", @@ -9645,16 +9640,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "2.3.3", + "version": "2.3.5", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "fb19eedd2bb67ff8cf7a5502ad329e701d6398a3" + "reference": "148cefffaf0233e4c08cc13db8a195a56dd6dfe9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/fb19eedd2bb67ff8cf7a5502ad329e701d6398a3", - "reference": "fb19eedd2bb67ff8cf7a5502ad329e701d6398a3", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/148cefffaf0233e4c08cc13db8a195a56dd6dfe9", + "reference": "148cefffaf0233e4c08cc13db8a195a56dd6dfe9", "shasum": "" }, "require": { @@ -9686,9 +9681,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/2.3.3" + "source": "https://github.com/phpstan/phpdoc-parser/tree/2.3.5" }, - "time": "2026-07-08T07:01:06+00:00" + "time": "2026-08-31T16:05:28+00:00" }, { "name": "phpunit/php-code-coverage", @@ -9780,23 +9775,23 @@ }, { "name": "phpunit/php-file-iterator", - "version": "6.0.1", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "3d1cd096ef6bea4bf2762ba586e35dbd317cbfd5" + "reference": "a248d1640ab059b075f53a2ef0f9856e864e06b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3d1cd096ef6bea4bf2762ba586e35dbd317cbfd5", - "reference": "3d1cd096ef6bea4bf2762ba586e35dbd317cbfd5", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a248d1640ab059b075f53a2ef0f9856e864e06b5", + "reference": "a248d1640ab059b075f53a2ef0f9856e864e06b5", "shasum": "" }, "require": { "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^12.0" + "phpunit/phpunit": "^12.5.33" }, "type": "library", "extra": { @@ -9829,7 +9824,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/6.0.1" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/6.0.2" }, "funding": [ { @@ -9849,7 +9844,7 @@ "type": "tidelift" } ], - "time": "2026-02-02T14:04:18+00:00" + "time": "2026-08-25T14:40:53+00:00" }, { "name": "phpunit/php-invoker", @@ -10131,12 +10126,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "bffbcefd4888dc8e04690bfb04bcdf4a62ab26da" + "reference": "f1dd47da8977aa9dcb913f443ed6c26042da059f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/bffbcefd4888dc8e04690bfb04bcdf4a62ab26da", - "reference": "bffbcefd4888dc8e04690bfb04bcdf4a62ab26da", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/f1dd47da8977aa9dcb913f443ed6c26042da059f", + "reference": "f1dd47da8977aa9dcb913f443ed6c26042da059f", "shasum": "" }, "conflict": { @@ -10175,7 +10170,8 @@ "andreapollastri/cipi": "<=3.1.15", "andrewhaine/silverstripe-form-capture": ">=0.2,<=0.2.3|>=1,<1.0.2|>=2,<2.2.5", "aoe/restler": "<1.7.1", - "apache-solr-for-typo3/solr": "<2.8.3", + "apache-solr-for-typo3/solr": "<11.6.6|>=12,<12.1.4|>=13,<13.1.4", + "apache/thrift": "<0.24", "apereo/phpcas": "<1.6", "api-platform/core": "<4.1.30|>=4.2,<4.2.26|>=4.3,<4.3.12", "api-platform/graphql": "<3.4.17|>=4,<4.0.22|>=4.1,<4.1.5", @@ -10242,8 +10238,10 @@ "cachethq/cachet": "<2.5.1", "cadmium-org/cadmium-cms": "<=0.4.9", "cakephp/authentication": "<2.11.1|>=3,<3.3.6|>=4,<4.1.1", - "cakephp/cakephp": "<4.5.11|>=4.6,<4.6.4|>=5,<5.1.7|>=5.2,<5.2.13|>=5.3,<5.3.6", - "cakephp/database": ">=4.2,<4.2.12|>=4.3,<4.3.11|>=4.4,<4.4.10", + "cakephp/cakephp": "<4.5.12|>=4.6,<4.6.5|>=5,<5.1.10|>=5.2,<5.2.15|>=5.3,<5.3.7", + "cakephp/database": "<4.5.12|>=4.6,<4.6.5|>=5,<5.1.10|>=5.2,<5.2.15|>=5.3,<5.3.7", + "cakephp/debug_kit": "<4.10.3|>=5,<5.2.4", + "cakephp/queue": ">=0.1.10,<2.3.1", "cardgate/magento2": "<2.0.33", "cardgate/woocommerce": "<=3.1.15", "cart2quote/module-quotation": ">=4.1.6,<4.4.6|>=5,<5.4.4", @@ -10255,6 +10253,7 @@ "centreon/centreon": "<22.10.15", "cesargb/laravel-magiclink": ">=2,<2.25.1", "cesnet/simplesamlphp-module-proxystatistics": "<3.1", + "chamilo/chamilo-lms": "<=2", "chriskacerguis/codeigniter-restserver": "<=2.7.1", "chrome-php/chrome": "<1.14", "ci4-cms-erp/ci4ms": "<=0.31.8", @@ -10270,19 +10269,21 @@ "codeigniter4/shield": "<1.0.0.0-beta8", "codiad/codiad": "<=2.8.4", "codingms/additional-tca": ">=1.7,<1.15.17|>=1.16,<1.16.9", - "codingms/modules": "<4.3.11|>=5,<5.7.4|>=6,<6.4.2|>=7,<7.5.5", + "codingms/modules": "<7.10.4|>=8,<8.1.4", "commerceteam/commerce": ">=0.9.6,<0.9.9", "components/jquery": ">=1.0.3,<3.5", - "composer/composer": "<2.2.29|>=2.3,<2.10.2", + "composer/composer": "<2.2.30|>=2.3,<2.10.3", "concrete5/concrete5": "<9.5.2", "concrete5/core": "<8.5.8|>=9,<9.1", + "contao-components/colorbox": ">=1,<1.6.4.3-dev", "contao-components/mediaelement": ">=2.14.2,<2.21.1", - "contao/comments-bundle": ">=2,<4.13.40|>=5.0.0.0-RC1-dev,<5.3.4", - "contao/contao": ">=3,<3.5.37|>=4,<4.4.56|>=4.5,<5.3.48|>=5.4,<5.7.9", + "contao/comments-bundle": ">=2,<5.3.50|>=5.4,<5.7.12", + "contao/contao": ">=3,<3.5.37|>=4,<5.3.50|>=5.4,<5.7.12", "contao/core": "<3.5.39", - "contao/core-bundle": "<5.3.48|>=5.4,<5.7.9", + "contao/core-bundle": "<5.3.50|>=5.4,<5.7.12", "contao/listing-bundle": ">=3,<=3.5.30|>=4,<4.4.8", "contao/managed-edition": "<=1.5", + "contao/newsletter-bundle": ">=5,<5.3.50|>=5.4,<5.7.12", "coreshop/core-shop": "<4.1.9|==5", "corveda/phpsandbox": "<1.3.5", "cosenary/instagram": "<=2.3", @@ -10312,7 +10313,7 @@ "dcat/laravel-admin": "<=2.1.3|==2.2.0.0-beta|==2.2.2.0-beta", "dedoc/scramble": ">=0.13.2,<0.13.22", "derhansen/fe_change_pwd": "<2.0.5|>=3,<3.0.3", - "derhansen/sf_event_mgt": "<4.3.1|>=5,<5.1.1|>=7,<7.4", + "derhansen/sf_event_mgt": "<5.9.3|>=6,<6.7.2|>=7,<7.9.3|>=8,<8.6.2|>=9,<9.0.3", "desperado/xml-bundle": "<=0.1.7", "dev-lancer/minecraft-motd-parser": "<=1.0.5", "devcode-it/openstamanager": "<=2.10.1", @@ -10419,7 +10420,7 @@ "feehi/feehicms": "<=2.1.1", "fenom/fenom": "<=2.12.1", "filament/actions": ">=3.2,<3.2.123|>=4,<=4.11.3|>=5,<=5.6.3", - "filament/filament": ">=3,<=3.3.51|>=4,<4.11.5|>=5,<5.6.5", + "filament/filament": ">=3,<=3.3.51|>=4,<4.12.6|>=5,<5.7.6", "filament/forms": ">=3,<=3.3.52", "filament/infolists": ">=3,<3.2.115|>=4,<=4.11.4|>=5,<=5.6.4", "filament/tables": ">=3,<=3.3.50|>=4,<=4.11.4|>=5,<=5.6.4", @@ -10448,7 +10449,7 @@ "forkcms/forkcms": "<5.11.1", "fossar/tcpdf-parser": "<6.2.22", "francoisjacquet/rosariosis": "<=11.5.1", - "frappant/frp-form-answers": "<3.1.2|>=4,<4.0.2", + "frappant/frp-form-answers": "<5.0.5|>=6,<6.1.3|>=7,<7.1.1", "friendsofsymfony/oauth2-php": "<1.3", "friendsofsymfony/rest-bundle": ">=1.2,<1.2.2", "friendsofsymfony/user-bundle": ">=1,<1.3.5", @@ -10468,10 +10469,10 @@ "georgringer/news": "<10.0.4|>=11,<11.4.4|>=12,<12.3.2|>=13,<13.0.2|>=14,<14.0.3", "geshi/geshi": "<=1.0.9.1", "getformwork/formwork": "<=2.3.3", - "getgrav/grav": "<2.0.4", + "getgrav/grav": "<=2.0.19", "getgrav/grav-plugin-api": "<1.0.0.0-beta15", "getgrav/grav-plugin-form": "<9.1", - "getkirby/cms": "<=4.9.3|>=5,<=5.4.3", + "getkirby/cms": "<4.9.5|>=5,<5.5.2", "getkirby/kirby": "<3.9.8.3-dev|>=3.10,<3.10.1.2-dev|>=4,<4.7.1", "getkirby/panel": "<2.5.14", "getkirby/starterkit": "<=3.7.0.2", @@ -10525,10 +10526,10 @@ "imdbphp/imdbphp": "<=5.1.1", "impresscms/impresscms": "<=1.4.5", "impresspages/impresspages": "<1.0.13", - "in2code/femanager": "<6.4.2|>=7,<7.5.3|>=8,<8.3.1", + "in2code/femanager": "<6.4.5|>=7,<7.5.5|>=8,<8.4.2|>=13,<13.3.5", "in2code/ipandlanguageredirect": "<5.1.2", "in2code/lux": "<17.6.1|>=18,<24.0.2", - "in2code/powermail": "<7.5.1|>=8,<8.5.1|>=9,<10.9.1|>=11,<12.5.3|==13", + "in2code/powermail": "<10.9.3|>=11,<12.6.1|>=13,<13.2.1", "innologi/typo3-appointments": "<2.0.6", "intelliants/subrion": "<4.2.2", "inter-mediator/inter-mediator": "==5.5", @@ -10565,8 +10566,12 @@ "jsdecena/laracom": "<2.0.9", "jsmitty12/phpwhois": "<5.1", "juzaweb/cms": "<=3.4.2", - "jweiland/events2": "<8.3.8|>=9,<9.0.6", + "jweiland/clubdirectory": "<6.0.2|>=7,<7.0.2|>=8,<8.1.3", + "jweiland/events2": "<8.6.3|>=9,<9.4.2|>=10,<10.2.12", "jweiland/kk-downloader": "<1.2.2", + "jweiland/pforum": "<4.0.4|>=5,<5.0.1|>=6,<6.2.4", + "jweiland/telephonedirectory": "<4.1.1|>=5,<5.0.1|>=6,<6.2", + "jweiland/yellowpages2": "<6.1.6|>=7,<7.0.3|>=8,<8.1.2", "kantorge/yaffa": "<=2", "kazist/phpwhois": "<=4.2.6", "kelvinmo/simplejwt": "<=1.1", @@ -10578,7 +10583,7 @@ "klaviyo/magento2-extension": ">=1,<3", "knplabs/knp-snappy": "<=1.7", "kohana/core": "<3.3.3", - "koillection/koillection": "<1.6.12", + "koillection/koillection": "<1.8.4", "krayin/laravel-crm": "<=2.2", "kreait/firebase-php": ">=3.2,<3.8.1", "kumbiaphp/kumbiapp": "<=1.1.1", @@ -10600,7 +10605,7 @@ "lavalite/cms": "<=10.1", "lavitto/typo3-form-to-database": "<2.2.5|>=3,<3.2.2|>=4,<4.2.3|>=5,<5.0.2", "lcobucci/jwt": ">=3.4,<3.4.6|>=4,<4.0.4|>=4.1,<4.1.5", - "league/commonmark": "<2.9", + "league/commonmark": "<2.10", "league/flysystem": "<1.1.4|>=2,<2.1.1", "league/oauth2-server": ">=8.3.2,<8.4.2|>=8.5,<8.5.3", "leantime/leantime": "<3.3", @@ -10612,13 +10617,15 @@ "limesurvey/limesurvey": "<=7.0.0.0-beta1", "livehelperchat/livehelperchat": "<=3.91", "livewire-filemanager/filemanager": "<=1.0.4", - "livewire/livewire": "<2.12.7|>=3.0.0.0-beta1,<3.6.4", + "livewire/livewire": "<2.12.7|>=3.0.0.0-beta1,<=3.8.2|>=4.0.0.0-beta1,<=4.3.3", "livewire/volt": "<1.7", "lms/routes": "<2.1.1", "localizationteam/l10nmgr": "<7.4|>=8,<8.7|>=9,<9.2", + "lochmueller/html5videoplayer-powermail": "<=0.2.1", "lomkit/laravel-rest-api": "<2.13", "luracast/restler": "<3.1", "luyadev/yii-helpers": "<1.2.1", + "maatwebsite/excel": ">=3.1.8,<3.1.70", "macropay-solutions/laravel-crud-wizard-free": "<3.4.17", "maestroerror/php-heic-to-jpg": "<1.0.5", "magento/community-edition": "<2.4.6.0-patch13|>=2.4.7.0-beta1,<2.4.7.0-patch8|>=2.4.8.0-beta1,<2.4.8.0-patch3|>=2.4.9.0-alpha1,<2.4.9.0-alpha3|==2.4.9", @@ -10636,6 +10643,7 @@ "marcwillmann/turn": "<0.3.3", "markhuot/craftql": "<=1.3.7", "marshmallow/nova-tiptap": "<5.7", + "mask/mask": "<8.3.12|>=9,<9.0.11", "matomo/matomo": "<1.11", "matyhtf/framework": "<3.0.6", "mautic/core": "<5.2.11|>=6,<6.0.9|>=7,<7.1.2", @@ -10651,7 +10659,7 @@ "mediawiki/data-transfer": ">=1.39,<1.39.11|>=1.41,<1.41.3|>=1.42,<1.42.2", "mediawiki/maps": "<12.1.3", "mediawiki/matomo": "<2.4.3", - "mediawiki/semantic-media-wiki": "<4.0.2", + "mediawiki/semantic-media-wiki": "<=7.2.1", "mehrwert/phpmyadmin": "<3.2", "melisplatform/melis-asset-manager": "<5.0.1", "melisplatform/melis-cms": "<5.3.4", @@ -10663,7 +10671,7 @@ "microsoft/microsoft-graph": ">=1.16,<1.109.1|>=2,<2.0.1", "microsoft/microsoft-graph-beta": "<2.0.1", "microsoft/microsoft-graph-core": "<2.0.2", - "microweber/microweber": "<2.0.20", + "microweber/microweber": "<=2.0.20", "mikehaertl/php-shellcommand": "<1.6.1", "mineadmin/mineadmin": "<3.2.0.0-alpha2", "miniorange/miniorange-saml": "<1.4.3", @@ -10674,7 +10682,7 @@ "mobiledetect/mobiledetectlib": "<2.8.32", "modx/revolution": "<=3.1", "mojo42/jirafeau": "<4.4", - "mongodb/mongodb": ">=1,<1.9.2", + "mongodb/mongodb": "<1.21.4|>=2,<2.4.1", "mongodb/mongodb-extension": "<1.21.2", "monolog/monolog": ">=1.8,<1.12", "moodle/moodle": "<4.5.9|>=5.0.0.0-beta,<5.0.5|>=5.1.0.0-beta,<5.1.2", @@ -10722,9 +10730,9 @@ "nzo/url-encryptor-bundle": ">=4,<4.3.2|>=5,<5.0.1", "october/backend": "<1.1.2", "october/cms": "<1.0.469|==1.0.469|==1.0.471|==1.1.1", - "october/october": "<3.7.14|>=4,<4.1.10", + "october/october": "<3.7.14|>=4,<4.1.10|>=4.3,<4.3.4", "october/rain": "<=3.7.13|>=4,<=4.1.9", - "october/system": "<3.7.16|>=4,<4.1.16", + "october/system": "<3.7.17|>=4,<4.2.23", "oliverklee/phpunit": "<3.5.15", "omeka/omeka-s": "<4.0.3", "onelogin/php-saml": "<2.21.1|>=3,<3.8.1|>=4,<4.3.1", @@ -10755,7 +10763,7 @@ "paragonie/random_compat": "<2", "paragonie/sodium_compat": "<1.24.1|>=2,<2.5.1", "passbolt/passbolt_api": "<4.6.2", - "paymenter/paymenter": "<=1.5.4", + "paymenter/paymenter": "<=1.5.6", "paypal/adaptivepayments-sdk-php": "<=3.9.2", "paypal/invoice-sdk-php": "<=3.9", "paypal/merchant-sdk-php": "<3.12", @@ -10768,6 +10776,7 @@ "pegasus/google-for-jobs": "<1.5.1|>=2,<2.1.1", "personnummer/personnummer": "<3.0.2", "ph7software/ph7builder": "<=17.9.1", + "phalcon/cphalcon": "<=5.15", "phanan/koel": "<=9.7", "pheditor/pheditor": "<2.0.8", "phenx/php-svg-lib": "<0.5.2", @@ -10782,7 +10791,7 @@ "phpmailer/phpmailer": "<6.5", "phpmussel/phpmussel": ">=1,<1.6", "phpmyadmin/phpmyadmin": "<5.2.2", - "phpmyfaq/phpmyfaq": "<4.1.4", + "phpmyfaq/phpmyfaq": "<=4.1.4", "phpoffice/common": "<0.2.9", "phpoffice/math": "<=0.2", "phpoffice/phpexcel": "<=1.8.2", @@ -10790,7 +10799,7 @@ "phppgadmin/phppgadmin": "<=7.13", "phpseclib/phpseclib": "<=2.0.54|>=3,<=3.0.53", "phpservermon/phpservermon": "<3.6", - "phpsysinfo/phpsysinfo": "<3.4.3", + "phpsysinfo/phpsysinfo": "<=3.4.5", "phpunit/phpunit": "<8.5.52|>=9,<9.6.33|>=10,<10.5.62|>=11,<11.5.50|>=12,<12.5.8|>=12.5.21,<12.5.22|>=13.1.5,<13.1.6", "phpwhois/phpwhois": "<=4.2.5", "phpxmlrpc/extras": "<0.6.1", @@ -10804,7 +10813,8 @@ "pimcore/demo": "<10.3", "pimcore/ecommerce-framework-bundle": "<1.0.10", "pimcore/perspective-editor": "<1.5.1", - "pimcore/pimcore": "<12.3.9|>=2026.1,<=2026.1.4", + "pimcore/pimcore": "<=12.3.9|>=2026.1,<=2026.1.5", + "pimcore/studio-backend-bundle": "<2025.4.6|>=2026.1,<2026.1.6", "pimcore/web2print-tools-bundle": "<=5.2.1|>=6.0.0.0-RC1-dev,<=6.1", "piwik/piwik": "<1.11", "pixelfed/pixelfed": "<0.12.5", @@ -10815,6 +10825,7 @@ "pocketmine/raklib": ">=0.14,<0.14.6|>=0.15,<0.15.1", "pontedilana/php-weasyprint": "<=2.5.1", "poweradmin/poweradmin": "<4.2.5|>=4.3,<4.3.4", + "predis/predis": ">=3.0.0.0-RC1-dev,<3.3", "pressbooks/pressbooks": "<5.18", "prestashop/autoupgrade": ">=4,<4.10.1", "prestashop/blockreassurance": "<=5.1.3", @@ -10828,7 +10839,7 @@ "prestashop/ps_emailsubscription": "<2.6.1", "prestashop/ps_facetedsearch": "<4.0.4", "prestashop/ps_linklist": "<3.1", - "privatebin/privatebin": "<1.4|>=1.5,<1.7.4|>=1.7.7,<2.0.3", + "privatebin/privatebin": "<=2.0.4", "processwire/processwire": "<=3.0.255", "propel/propel": ">=2.0.0.0-alpha1,<2.0.0.0-alpha8", "propel/propel1": ">=1,<1.7.2", @@ -10851,7 +10862,7 @@ "ralffreit/mfa-email": "<1.0.7|==2", "rankmath/seo-by-rank-math": "<=1.0.95", "rap2hpoutre/laravel-log-viewer": "<0.13", - "react/http": ">=0.7,<1.9", + "react/http": ">=0.6,<1.11.1", "really-simple-plugins/complianz-gdpr": "<6.4.2", "redaxo/source": "<5.21.1", "remdex/livehelperchat": "<4.29", @@ -10879,8 +10890,9 @@ "setasign/fpdi": "<2.6.7", "sfroemken/url_redirect": "<=1.2.1", "sheng/yiicms": "<1.2.1", + "shlinkio/shlink": "<=5.0.1", "shopper/cart": "<2.8", - "shopper/framework": "<2.8", + "shopper/framework": "<2.9.2", "shopware/core": "<6.6.10.18-dev|>=6.7,<6.7.10.1-dev", "shopware/platform": "<6.6.10.18-dev|>=6.7,<6.7.10.1-dev", "shopware/production": "<=6.3.5.2", @@ -10950,14 +10962,14 @@ "starcitizentools/short-description": ">=4,<4.0.1", "starcitizentools/tabber-neue": ">=1.9.1,<2.7.2|>=3,<3.1.1", "starcitizenwiki/embedvideo": "<=4", - "statamic/cms": "<5.74.3|>=6,<6.24.2", + "statamic/cms": "<5.74.3|>=6,<=6.30", "stormpath/sdk": "<9.9.99", - "studio-42/elfinder": "<=2.1.67", + "studio-42/elfinder": "<2.1.70", "studiomitte/friendlycaptcha": "<0.1.4", "subhh/libconnect": "<7.0.8|>=8,<8.1", "sukohi/surpass": "<1", "sulu/form-bundle": ">=2,<2.5.3", - "sulu/sulu": "<=2.6.22|>=3,<=3.0.5", + "sulu/sulu": "<=2.6.24|>=3,<3.0.8", "sumocoders/framework-user-bundle": "<1.4", "superbig/craft-audit": "<3.0.2", "svewap/a21glossary": "<=0.4.10", @@ -11027,6 +11039,7 @@ "symfony/webhook": ">=6.3,<6.3.8", "symfony/yaml": "<5.4.52|>=6,<6.4.40|>=7,<7.4.12|>=8,<8.0.12", "symphonycms/symphony-2": "<2.6.4", + "syssy/syssy-typo3-extension": "<3.0.6", "t3/dce": "<0.11.5|>=2.2,<2.6.2", "t3g/svg-sanitizer": "<1.0.3", "t3s/content-consent": "<1.0.3|>=2,<2.0.2", @@ -11063,7 +11076,7 @@ "twig/twig": "<3.27", "typicms/core": "<12.0.5|>=13,<13.0.9|>=14,<14.0.27|>=15,<15.0.29|>=16,<16.1.7", "typo3/cms": "<9.5.29|>=10,<10.4.35|>=11,<11.5.23|>=12,<12.2", - "typo3/cms-backend": "<10.4.57|>=11,<11.5.51|>=12,<12.4.46|>=13,<13.4.31|>=14,<14.3.3", + "typo3/cms-backend": "<10.4.60|>=11,<11.5.54|>=12,<12.4.49|>=13,<13.4.35|>=14,<14.3.7", "typo3/cms-belog": ">=10,<=10.4.47|>=11,<=11.5.41|>=12,<=12.4.24|>=13,<=13.4.2", "typo3/cms-beuser": ">=9,<9.5.55|>=10,<10.4.54|>=11,<11.5.48|>=12,<12.4.37|>=13,<13.4.18", "typo3/cms-core": "<10.4.57|>=11,<11.5.51|>=12,<12.4.46|>=13,<13.4.34|>=14,<14.3.6", @@ -11077,7 +11090,7 @@ "typo3/cms-frontend": "<4.3.9|>=4.4,<4.4.5", "typo3/cms-indexed-search": ">=10,<=10.4.47|>=11,<=11.5.41|>=12,<=12.4.24|>=13,<13.4.31|>=14,<14.3.3", "typo3/cms-install": "<4.1.14|>=4.2,<4.2.16|>=4.3,<4.3.9|>=4.4,<4.4.5|>=12.2,<12.4.8|==13.4.2", - "typo3/cms-lowlevel": ">=11,<=11.5.41", + "typo3/cms-lowlevel": ">=11,<=11.5.41|>=14.2,<14.3.7", "typo3/cms-recordlist": ">=11,<11.5.48", "typo3/cms-recycler": "<10.4.57|>=11,<11.5.51|>=12,<12.4.46|>=13,<13.4.31|>=14,<14.3.3", "typo3/cms-redirects": ">=10,<=10.4.54|>=11,<=11.5.48|>=12,<=12.4.40|>=13,<=13.4.22|>=14,<=14.0.1", @@ -11123,7 +11136,7 @@ "web-feet/coastercms": "==5.5", "web-token/jwt-bundle": "<3.4.10|>=4,<4.0.7|>=4.1,<4.1.7", "web-token/jwt-experimental": "<4.1.7", - "web-token/jwt-framework": "<4.1.7", + "web-token/jwt-framework": "<3.4.10|>=4,<4.0.7|>=4.1,<4.1.7", "web-token/jwt-library": "<3.4.10|>=4,<4.0.7|>=4.1,<4.1.7", "web-tp3/wec_map": "<3.0.3", "webbuilders-group/silverstripe-kapost-bridge": "<0.4", @@ -11173,7 +11186,7 @@ "yikesinc/yikes-inc-easy-mailchimp-extender": "<6.8.6", "yoast-seo-for-typo3/yoast_seo": "<7.2.3", "yoast/duplicate-post": "<=4.5", - "yourls/yourls": "<=1.10.2", + "yourls/yourls": "<=1.10.3", "yuan1994/tpadmin": "<=1.3.12", "yungifez/skuul": "<=2.6.5", "z-push/z-push-dev": "<2.7.6", @@ -11251,7 +11264,7 @@ "type": "tidelift" } ], - "time": "2026-08-20T19:30:24+00:00" + "time": "2026-09-18T20:28:15+00:00" }, { "name": "sebastian/cli-parser", @@ -11474,24 +11487,24 @@ }, { "name": "sebastian/diff", - "version": "7.0.0", + "version": "7.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "7ab1ea946c012266ca32390913653d844ecd085f" + "reference": "cd4cabe39f8a4e8ee6818ba99f10a05561ea4ad6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7ab1ea946c012266ca32390913653d844ecd085f", - "reference": "7ab1ea946c012266ca32390913653d844ecd085f", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/cd4cabe39f8a4e8ee6818ba99f10a05561ea4ad6", + "reference": "cd4cabe39f8a4e8ee6818ba99f10a05561ea4ad6", "shasum": "" }, "require": { "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^12.0", - "symfony/process": "^7.2" + "phpunit/phpunit": "^12.5.33", + "symfony/process": "^7.4.17" }, "type": "library", "extra": { @@ -11529,15 +11542,27 @@ "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", "security": "https://github.com/sebastianbergmann/diff/security/policy", - "source": "https://github.com/sebastianbergmann/diff/tree/7.0.0" + "source": "https://github.com/sebastianbergmann/diff/tree/7.0.1" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/diff", + "type": "tidelift" } ], - "time": "2025-02-07T04:55:46+00:00" + "time": "2026-08-25T15:35:54+00:00" }, { "name": "sebastian/environment", diff --git a/core/config/cms/observers.php b/core/config/cms/observers.php index 31520c023b..c6e6ddc052 100644 --- a/core/config/cms/observers.php +++ b/core/config/cms/observers.php @@ -1,4 +1,4 @@ - EvolutionCMS\Observers\SiteContentObserver::class -]; + EvolutionCMS\Observers\SiteContentObserver::class +]; diff --git a/core/src/Controllers/EventLogDetails.php b/core/src/Controllers/EventLogDetails.php index 796046d250..7b2bdb0c5d 100644 --- a/core/src/Controllers/EventLogDetails.php +++ b/core/src/Controllers/EventLogDetails.php @@ -1,32 +1,32 @@ -managerTheme->getCore()->hasPermission('view_eventlog'); - } - - public function process() : bool - { - $this->parameters['log'] = Models\EventLog::findOrNew($this->getElementId()); - - return true; - } -} +managerTheme->getCore()->hasPermission('view_eventlog'); + } + + public function process() : bool + { + $this->parameters['log'] = Models\EventLog::findOrNew($this->getElementId()); + + return true; + } +} diff --git a/core/src/Controllers/MoveDocument.php b/core/src/Controllers/MoveDocument.php index 8416c3e6a8..0bdd9c1743 100644 --- a/core/src/Controllers/MoveDocument.php +++ b/core/src/Controllers/MoveDocument.php @@ -5,81 +5,81 @@ use EvolutionCMS\Legacy\Permissions; use EvolutionCMS\Support\MoveDocumentTargetGuard; use Exception; - -class MoveDocument extends AbstractController implements ManagerTheme\PageControllerInterface -{ - protected $view = 'page.move_document'; - - /** - * {@inheritdoc} - */ - public function checkLocked(): ?string - { - return null; - } - - /** - * {@inheritdoc} - */ - public function canView(): bool - { - return $this->managerTheme->getCore()->hasPermission('save_document'); - } - - public function process() : bool - { - if ((int)$this->getIndex() === 52) { - $this->handle(); - return false; - } - - $this->processDisplay(); - return true; - } - - protected function handle() - { - $newParentID = (int)get_by_key($_REQUEST, 'new_parent', 0, 'is_scalar'); - $documentID = $this->getElementId(); - - // ok, two things to check. - // first, document cannot be moved to itself - // second, new parent must be a folder. If not, set it to folder. - if ($documentID === $newParentID) { - $this->managerTheme->alertAndQuit('error_movedocument1'); - } - - if ($documentID <= 0 || $newParentID < 0) { - $this->managerTheme->alertAndQuit('error_movedocument2'); - } - - $document = $this->getDocument($documentID); - + +class MoveDocument extends AbstractController implements ManagerTheme\PageControllerInterface +{ + protected $view = 'page.move_document'; + + /** + * {@inheritdoc} + */ + public function checkLocked(): ?string + { + return null; + } + + /** + * {@inheritdoc} + */ + public function canView(): bool + { + return $this->managerTheme->getCore()->hasPermission('save_document'); + } + + public function process() : bool + { + if ((int)$this->getIndex() === 52) { + $this->handle(); + return false; + } + + $this->processDisplay(); + return true; + } + + protected function handle() + { + $newParentID = (int)get_by_key($_REQUEST, 'new_parent', 0, 'is_scalar'); + $documentID = $this->getElementId(); + + // ok, two things to check. + // first, document cannot be moved to itself + // second, new parent must be a folder. If not, set it to folder. + if ($documentID === $newParentID) { + $this->managerTheme->alertAndQuit('error_movedocument1'); + } + + if ($documentID <= 0 || $newParentID < 0) { + $this->managerTheme->alertAndQuit('error_movedocument2'); + } + + $document = $this->getDocument($documentID); + // the form (a=51) checks the source document; the action must too, or the check is bypassable $this->checkDocumentPermission($document->getKey(), 'access_permission_denied'); if (MoveDocumentTargetGuard::isInsideItself($document->getKey(), $newParentID)) { $this->managerTheme->alertAndQuit('error_movedocument1'); - } - - // check user has permission to move document to chosen location - if ($this->managerTheme->getCore()->getConfig('use_udperms') && $document->parent !== $newParentID) { - $this->checkNewParentPermission($newParentID); - } - - $evtOut = $this->managerTheme->getCore()->invokeEvent('onBeforeMoveDocument', [ - 'id_document' => $document->getKey(), - 'old_parent' => $document->parent, - 'new_parent' => $newParentID - ]); - - if (\is_array($evtOut) && count($evtOut) > 0) { - $newParent = (int)array_pop($evtOut); - if ($newParent === $document->parent) { - $this->managerTheme->alertAndQuit('error_movedocument2'); - } else { - $newParentID = $newParent; - } + } + + // check user has permission to move document to chosen location + if ($this->managerTheme->getCore()->getConfig('use_udperms') && $document->parent !== $newParentID) { + $this->checkNewParentPermission($newParentID); + } + + $evtOut = $this->managerTheme->getCore()->invokeEvent('onBeforeMoveDocument', [ + 'id_document' => $document->getKey(), + 'old_parent' => $document->parent, + 'new_parent' => $newParentID + ]); + + if (\is_array($evtOut) && count($evtOut) > 0) { + $newParent = (int)array_pop($evtOut); + if ($newParent === $document->parent) { + $this->managerTheme->alertAndQuit('error_movedocument2'); + } else { + $newParentID = $newParent; + } } if ($newParentID > 0) { $parentDocument = $this->getDocument($newParentID); @@ -89,88 +89,88 @@ protected function handle() if (MoveDocumentTargetGuard::isInsideItself($document->getKey(), $parentDocument->getKey())) { $this->managerTheme->alertAndQuit('error_movedocument1'); } - - $parentDocument->isfolder = true; - $parentDocument->save(); - if ($document->ancestor && $document->ancestor->children()->count() <= 1) { - $document->ancestor->isfolder = false; - $document->ancestor->save(); - } - $document->parent = $parentDocument->getKey(); - } else { - $document->parent = 0; - } - $document->save(); - - // Set the item name for logger - $_SESSION['itemname'] = $document->pagetitle; - - $this->managerTheme->getCore()->invokeEvent('onAfterMoveDocument', [ - 'id_document' => $document->getKey(), - 'old_parent' => $document->parent, - 'new_parent' => $newParentID - ]); - - // empty cache & sync site - $this->managerTheme->getCore()->clearCache('document'); - - header('Location: index.php?a=3&id=' . $document->getKey() . '&r=9'); - } - - protected function processDisplay() : bool - { - $id = $this->getElementId(); - $document = $this->getDocument($id); - - $this->checkDocumentPermission($document->getKey(), 'access_permission_denied'); - - // Set the item name for logger - $_SESSION['itemname'] = $document->pagetitle; - $this->parameters['document'] = $document; - - return true; - } - - /** - * @param string|int $id - * @return Models\SiteContent - */ - protected function getDocument($id) : Models\SiteContent - { - try { - if ($id <= 0) { - throw new Exception(); - } - /** @var Models\SiteContent $document */ - $document = Models\SiteContent::withTrashed()->findOrFail($id); - } catch (Exception $exception) { - $this->managerTheme->alertAndQuit('error_no_id'); - } - - return $document; - } - - protected function checkNewParentPermission($id) - { - $this->checkDocumentPermission($id, 'access_permission_parent_denied'); - } - - /** - * @param int $id - * @param string $lang lexicon key of the alert shown when access is denied - * @since 3.5.8 - */ - protected function checkDocumentPermission($id, string $lang): void - { - $udperms = new Permissions; - $udperms->user = $this->managerTheme->getCore()->getLoginUserID('mgr'); - $udperms->document = $id; - $udperms->role = $_SESSION['mgrRole']; - - if ($udperms->checkPermissions()) { - return; - } - - $this->managerTheme->alertAndQuit($lang); - } -} + + $parentDocument->isfolder = true; + $parentDocument->save(); + if ($document->ancestor && $document->ancestor->children()->count() <= 1) { + $document->ancestor->isfolder = false; + $document->ancestor->save(); + } + $document->parent = $parentDocument->getKey(); + } else { + $document->parent = 0; + } + $document->save(); + + // Set the item name for logger + $_SESSION['itemname'] = $document->pagetitle; + + $this->managerTheme->getCore()->invokeEvent('onAfterMoveDocument', [ + 'id_document' => $document->getKey(), + 'old_parent' => $document->parent, + 'new_parent' => $newParentID + ]); + + // empty cache & sync site + $this->managerTheme->getCore()->clearCache('document'); + + header('Location: index.php?a=3&id=' . $document->getKey() . '&r=9'); + } + + protected function processDisplay() : bool + { + $id = $this->getElementId(); + $document = $this->getDocument($id); + + $this->checkDocumentPermission($document->getKey(), 'access_permission_denied'); + + // Set the item name for logger + $_SESSION['itemname'] = $document->pagetitle; + $this->parameters['document'] = $document; + + return true; + } + + /** + * @param string|int $id + * @return Models\SiteContent + */ + protected function getDocument($id) : Models\SiteContent + { + try { + if ($id <= 0) { + throw new Exception(); + } + /** @var Models\SiteContent $document */ + $document = Models\SiteContent::withTrashed()->findOrFail($id); + } catch (Exception $exception) { + $this->managerTheme->alertAndQuit('error_no_id'); + } + + return $document; + } + + protected function checkNewParentPermission($id) + { + $this->checkDocumentPermission($id, 'access_permission_parent_denied'); + } + + /** + * @param int $id + * @param string $lang lexicon key of the alert shown when access is denied + * @since 3.5.8 + */ + protected function checkDocumentPermission($id, string $lang): void + { + $udperms = new Permissions; + $udperms->user = $this->managerTheme->getCore()->getLoginUserID('mgr'); + $udperms->document = $id; + $udperms->role = $_SESSION['mgrRole']; + + if ($udperms->checkPermissions()) { + return; + } + + $this->managerTheme->alertAndQuit($lang); + } +} diff --git a/core/src/Controllers/PluginPriority.php b/core/src/Controllers/PluginPriority.php index e7b22b4d3d..5de52b2576 100644 --- a/core/src/Controllers/PluginPriority.php +++ b/core/src/Controllers/PluginPriority.php @@ -1,81 +1,81 @@ -managerTheme->getCore()->hasPermission('save_plugin'); - } - - /** - * {@inheritdoc} - */ - public function getParameters(array $params = []): array - { - return parent::getParameters([ - 'events' => $this->getEventsParameter() - ]); - } - - protected function getEventsParameter() : Eloquent\Collection - { - return Models\SystemEventname::with( - [ - 'plugins' => function (Eloquent\Relations\BelongsToMany $query) { - $query->orderBy('priority'); - } - ] - )->whereHas('plugins')->orderBy('name')->get(); - } - - public function process() : bool - { - $updateMsg = false; - - if (isset($_POST['priority']) && is_array($_POST['priority'])) { - $updateMsg = true; - $db = $this->managerTheme->getCore()->getDatabase(); - $tableName = $db->getFullTableName('site_plugin_events'); - - foreach ($_POST['priority'] as $eventId => $pluginsOrder) { - if (!is_numeric($eventId) || !is_array($pluginsOrder)) { - continue; - } - - if (\count($pluginsOrder) > 0) { - foreach ($pluginsOrder as $priority => $pluginId) { - Models\SitePluginEvent::query() - ->where('pluginid', intval($pluginId)) - ->where('evtid', intval($eventId)) - ->update(['priority' => intval($priority)]); - } - } - } - - // empty cache - $this->managerTheme->getCore()->clearCache('full'); - } - - $this->parameters['updateMsg'] = $updateMsg; - - return true; - } -} +managerTheme->getCore()->hasPermission('save_plugin'); + } + + /** + * {@inheritdoc} + */ + public function getParameters(array $params = []): array + { + return parent::getParameters([ + 'events' => $this->getEventsParameter() + ]); + } + + protected function getEventsParameter() : Eloquent\Collection + { + return Models\SystemEventname::with( + [ + 'plugins' => function (Eloquent\Relations\BelongsToMany $query) { + $query->orderBy('priority'); + } + ] + )->whereHas('plugins')->orderBy('name')->get(); + } + + public function process() : bool + { + $updateMsg = false; + + if (isset($_POST['priority']) && is_array($_POST['priority'])) { + $updateMsg = true; + $db = $this->managerTheme->getCore()->getDatabase(); + $tableName = $db->getFullTableName('site_plugin_events'); + + foreach ($_POST['priority'] as $eventId => $pluginsOrder) { + if (!is_numeric($eventId) || !is_array($pluginsOrder)) { + continue; + } + + if (\count($pluginsOrder) > 0) { + foreach ($pluginsOrder as $priority => $pluginId) { + Models\SitePluginEvent::query() + ->where('pluginid', intval($pluginId)) + ->where('evtid', intval($eventId)) + ->update(['priority' => intval($priority)]); + } + } + } + + // empty cache + $this->managerTheme->getCore()->clearCache('full'); + } + + $this->parameters['updateMsg'] = $updateMsg; + + return true; + } +} diff --git a/core/src/Legacy/Phx.php b/core/src/Legacy/Phx.php index a5c8617a5e..d3df6b7e4f 100644 --- a/core/src/Legacy/Phx.php +++ b/core/src/Legacy/Phx.php @@ -1,838 +1,838 @@ - [], - 'ui' => [], - 'mo' => [] - ]; - public $safetags = [ - ['~(?modx = $modx; - $this->user["mgrid"] = isset($_SESSION['mgrInternalKey']) ? intval($_SESSION['mgrInternalKey']) : 0; - $this->user["usrid"] = isset($_SESSION['webInternalKey']) ? intval($_SESSION['webInternalKey']) : 0; - $this->user["id"] = ($this->user["usrid"] > 0) ? (-$this->user["usrid"]) : $this->user["mgrid"]; - - $this->debug = (bool)get_by_key($args, 1, false); - - $this->maxPasses = (int)get_by_key($args, 2, 50); - - $this->modx->setPlaceholder("phx", "&_PHX_INTERNAL_&"); - if (function_exists('mb_internal_encoding')) { - mb_internal_encoding($this->modx->config['evo_charset']); - } - } - - // Plugin event hook for MODx - public function OnParseDocument() - { - // Get document output from MODx - $template = $this->modx->documentOutput; - // To the parse cave .. let's go! *insert batman tune here* - $template = $this->Parse($template); - // Set processed document output in MODx - $this->modx->documentOutput = $template; - } - - // Parser: Preparation, cleaning and checkup - - /** - * @param string $template - * @return mixed|string - */ - public function Parse($template = '') - { - // If we already reached max passes don't get at it again. - if ($this->curPass == $this->maxPasses) { - return $template; - } - // Set template pre-process hash - $st = md5($template); - // Replace non-call characters in the template: [, ] - $template = preg_replace($this->safetags[0], $this->safetags[1], $template); - // To the parse mobile.. let's go! *insert batman tune here* - $template = $this->ParseValues($template); - // clean up unused placeholders that have modifiers attached (MODx can't clean them) - preg_match_all('~(?:=`[^`@]*?)(\[\+([^:\+\[\]]+)([^\[\]]*?)\+\])~s', $template, $matches); - if ($matches[0]) { - $template = str_replace($matches[1], '', $template); - $this->Log("Cleaning unsolved tags: \n" . implode("\n", $matches[2])); - } - // Restore non-call characters in the template: [, ] - $template = str_replace($this->safetags[1], $this->safetags[2], $template); - // Set template post-process hash - $et = md5($template); - // If template has changed, parse it once more... - if ($st != $et) { - $template = $this->Parse($template); - } - // Write an event log if debugging is enabled and there is something to log - if ($this->debug && $this->debugLog) { - $this->modx->logEvent($this->curPass, 1, $this->createEventLog(), $this->name . ' ' . $this->version); - $this->debugLog = false; - } - - // Return the processed template - return $template; - } - - // Parser: Tag detection and replacements - - /** - * @param string $template - * @return mixed|string - */ - public function ParseValues($template = '') - { - $this->curPass = $this->curPass + 1; - $st = md5($template); - - $this->LogPass(); - // MODX Chunks - if (preg_match_all('~(?Log('MODX Chunks -> Merging all chunk tags'); - $count = count($matches[0]); - $var_search = []; - $var_replace = []; - for ($i = 0; $i < $count; $i++) { - $var_search[] = $matches[0][$i]; - $input = $matches[1][$i]; - $this->Log('MODX Chunk: ' . $input); - $input = $this->modx->mergeChunkContent('{{' . $input . '}}'); - $var_replace[] = $this->Filter($input, $matches[2][$i]); - } - $template = str_replace($var_search, $var_replace, $template); - } - - // MODx Snippets - //if ( preg_match_all('~\[(\[|!)([^\[]*?)(!|\])\]~s',$template, $matches)) { - if (preg_match_all('~(?Log("MODx Snippet -> " . $snippet); - - // Let MODx evaluate snippet - $replace = $this->modx->evalSnippets("[[" . $snippet . "]]"); - $this->LogSnippet($replace); - - // Replace values - $var_search[] = $matches[0][$i]; - $var_replace[] = $replace; - } - $template = str_replace($var_search, $var_replace, $template); - } - - // PHx / MODx Tags - if (preg_match_all('~\[(\+|\*|\()([^:\+\[\]]+)([^\[\]]*?)(\1|\))\]~s', $template, $matches)) { - //$matches[0] // Complete string that's need to be replaced - //$matches[1] // Type - //$matches[2] // The placeholder(s) - //$matches[3] // The modifiers - //$matches[4] // Type (end character) - - $count = count($matches[0]); - $var_search = []; - $var_replace = []; - for ($i = 0; $i < $count; $i++) { - $input = $matches[2][$i]; - $modifiers = $matches[3][$i]; - $var_search[] = $matches[0][$i]; - switch ($matches[1][$i]) { - // Document / Template Variable eXtended - case "*": - $this->Log("MODx TV/DV: " . $input); - $input = $this->modx->mergeDocumentContent("[*" . $input . "*]"); - $replace = $this->Filter($input, $modifiers); - break; - // MODx Setting eXtended - case "(": - $this->Log("MODx Setting variable: " . $input); - $input = $this->modx->mergeSettingsContent("[(" . $input . ")]"); - $replace = $this->Filter($input, $modifiers); - break; - // MODx Placeholder eXtended - default: - $this->Log("MODx / PHx placeholder variable: " . $input); - // Check if placeholder is set - if (! array_key_exists($input, $this->placeholders) && - ! array_key_exists($input, $this->modx->placeholders) - ) { - // not set so try again later. - $input = ''; - } else { - // is set, get value and run filter - $input = $this->getPHxVariable($input); - } - $replace = $this->Filter($input, $modifiers); - break; - } - $var_replace[] = $replace; - } - $template = str_replace($var_search, $var_replace, $template); - } - $et = md5($template); // Post-process template hash - - // Log an event if this was the maximum pass - if ($this->curPass == $this->maxPasses) { - $this->Log("Max passes reached. infinite loop protection so exiting.\n If you need the extra passes set the max passes to the highest count of nested tags in your template."); - } - // If this pass is not at maximum passes and the template hash is not the same, get at it again. - if (($this->curPass < $this->maxPasses) && ($st != $et)) { - $template = $this->ParseValues($template); - } - - return $template; - } - - // Parser: modifier detection and eXtended processing if needed - - /** - * @param $input - * @param $modifiers - * @return mixed|null|string - */ - public function Filter($input, $modifiers) - { - $output = $input; - $this->Log(" |--- Input = '" . $output . "'"); - if (preg_match_all('~:([^:=]+)(?:=`(.*?)`(?=:[^:=]+|$))?~s', $modifiers, $matches)) { - $modifier_cmd = $matches[1]; // modifier command - $modifier_value = $matches[2]; // modifier value - $count = count($modifier_cmd); - $condition = []; - for ($i = 0; $i < $count; $i++) { - $output = trim($output); - $this->Log(" |--- Modifier = '" . $modifier_cmd[$i] . "'"); - if ($modifier_value[$i] != '') { - $this->Log(" |--- Options = '" . $modifier_value[$i] . "'"); - } - switch ($modifier_cmd[$i]) { - ##### Conditional Modifiers - case "input": - case "if": - $output = $modifier_value[$i]; - break; - case "equals": - case "is": - case "eq": - $condition[] = intval(($output == $modifier_value[$i])); - break; - case "empty": - $condition[] = intval(empty($output)); - break; - case "notequals": - case "isnot": - case "isnt": - case "ne": - $condition[] = intval(($output != $modifier_value[$i])); - break; - case "isgreaterthan": - case "isgt": - case "eg": - $condition[] = intval(($output >= $modifier_value[$i])); - break; - case "islowerthan": - case "islt": - case "el": - $condition[] = intval(($output <= $modifier_value[$i])); - break; - case "greaterthan": - case "gt": - $condition[] = intval(($output > $modifier_value[$i])); - break; - case "lowerthan": - case "lt": - $condition[] = intval(($output < $modifier_value[$i])); - break; - case "isinrole": - case "ir": - case "memberof": - case "mo": // Is Member Of (same as inrole but this one can be stringed as a conditional) - if ($output == "&_PHX_INTERNAL_&") { - $output = $this->user["id"]; - } - $grps = ($this->strlen($modifier_value[$i]) > 0) ? explode(",", $modifier_value[$i]) : []; - $condition[] = intval($this->isMemberOfWebGroupByUserId($output, $grps)); - break; - case "or": - $condition[] = "||"; - break; - case "and": - $condition[] = "&&"; - break; - case "show": - $conditional = implode(' ', $condition); - $isvalid = intval($this->runCode($conditional)); - if (!$isvalid) { - $output = null; - } - break; - case "then": - $conditional = implode(' ', $condition); - $isvalid = intval($this->runCode($conditional)); - if ($isvalid) { - $output = $modifier_value[$i]; - } else { - $output = null; - } - break; - case "else": - $conditional = implode(' ', $condition); - $isvalid = intval($this->runCode($conditional)); - if (!$isvalid) { - $output = $modifier_value[$i]; - } - break; - case "select": - $raw = explode("&", $modifier_value[$i]); - $map = []; - $count = count($raw); - for ($m = 0; $m < $count; $m++) { - $mi = explode("=", $raw[$m]); - $map[$mi[0]] = $mi[1]; - } - $output = $map[$output]; - break; - ##### End of Conditional Modifiers - - ##### String Modifiers - case "default": - $output = ($output === '') ? $modifier_value[0] : $output; - break; - case "lcase": - case "strtolower": - $output = $this->strtolower($output); - break; - case "ucase": - case "strtoupper": - $output = $this->strtoupper($output); - break; - case "ucfirst": - $output = $this->ucfirst($output); - break; - case "lcfirst": - $output = $this->lcfirst($output); - break; - case "ucwords": - $output = $this->ucwords($output); - break; - case "htmlent": - case "htmlentities": - $output = htmlentities($output, ENT_QUOTES, $this->modx->config['evo_charset']); - break; - case "html_entity_decode": - $output = html_entity_decode($output, ENT_QUOTES, $this->modx->config['evo_charset']); - break; - case "esc": - $output = preg_replace("/&(#[0-9]+|[a-z]+);/i", "&$1;", e($output)); - $output = str_replace(["[", "]", "`"], ["[", "]", "`"], $output); - break; - case "strip": - $output = preg_replace("~([\n\r\t\s]+)~", " ", $output); - break; - case "notags": - case "strip_tags": - $output = strip_tags($output); - break; - case "length": - case "len": - case "strlen": - $output = $this->strlen($output); - break; - case "reverse": - case "strrev": - $output = $this->strrev($output); - break; - case "wordwrap": // default: 70 - $wrapat = intval($modifier_value[$i]) ? intval($modifier_value[$i]) : 70; - $output = preg_replace_callback("@(\b\w+\b)@", function ($m) use ($wrapat) { - return wordwrap($m[1], $wrapat, ' ', 1); - }, $output); - break; - case "limit": // default: 100 - $limit = intval($modifier_value[$i]) ? intval($modifier_value[$i]) : 100; - $output = $this->substr($output, 0, $limit); - break; - case "str_shuffle": - case "shuffle": - $output = $this->str_shuffle($output); - break; - case "str_word_count": - case "word_count": - case "wordcount": - $output = $this->str_word_count($output); - break; - - ##### Special functions - case "math": - $filter = preg_replace("~([a-zA-Z\n\r\t\s])~", "", $modifier_value[$i]); - $filter = str_replace("?", $output, $filter); - // The letter strip above never made this safe: `$`, quotes and backslashes - // survive it, and octal escapes need no letters at all. - $output = ArithmeticExpression::evaluate($filter); - break; - case "isnotempty": - if (!empty($output)) { - $output = $modifier_value[$i]; - } - break; - case "isempty": - case "ifempty": - if (empty($output)) { - $output = $modifier_value[$i]; - } - break; - case "nl2br": - $output = nl2br($output); - break; - case "date": - $output = strftime($modifier_value[$i], (int)$output); - break; - case "set": - $c = $i + 1; - if ($count > $c && $modifier_cmd[$c] == "value") { - $output = preg_replace("~([^a-zA-Z0-9])~", "", $modifier_value[$i]); - } - break; - case "value": - if ($i > 0 && $modifier_cmd[$i - 1] == "set") { - $this->modx->SetPlaceholder("phx." . $output, $modifier_value[$i]); - } - $output = null; - break; - case "md5": - $output = md5($output); - break; - case 'inarray': - case 'in_array': - case 'in': - $modifier_value[$i] = explode(',', $modifier_value[$i]); - $condition[] = (int)(in_array($output, $modifier_value[$i]) !== false); - break; - case "userinfo": - if ($output == "&_PHX_INTERNAL_&") { - $output = $this->user["id"]; - } - $output = $this->ModUser($output, $modifier_value[$i]); - break; - case "inrole": // deprecated - if ($output == "&_PHX_INTERNAL_&") { - $output = $this->user["id"]; - } - $grps = ($this->strlen($modifier_value[$i]) > 0) ? explode(",", $modifier_value[$i]) : []; - $output = intval($this->isMemberOfWebGroupByUserId($output, $grps)); - break; - - // If we haven't yet found the modifier, let's look elsewhere - default: - $snippet = ''; - // modified by Anton Kuzmin (23.06.2010) // - $snippetName = 'phx:' . $modifier_cmd[$i]; - if (array_key_exists($snippetName, $this->modx->snippetCache)) { - $snippet = $this->modx->snippetCache[$snippetName]; - } else { -// not in cache so let's check the db - $snippetObject = $this->modx->getSnippetFromDatabase($snippetName); - $this->modx->snippetCache[$snippetObject['name']] = $snippetObject['content']; - $this->modx->snippetCache[$snippetObject['name'] . 'Props'] = $snippetObject['properties']; - if ($snippetObject['content'] !== null) { - $snippet = $snippetObject['content']; - $this->Log(" |--- DB -> Custom Modifier"); - } else { - // If snippet not found, look in the modifiers folder - $filename = $this->modx->getConfig('rb_base_dir') . 'plugins/phx/modifiers/' . $modifier_cmd[$i] . '.phx.php'; - if (@file_exists($filename)) { - $file_contents = @file_get_contents($filename); - $file_contents = str_replace('<' . '?php', '', $file_contents); - $file_contents = str_replace('?' . '>', '', $file_contents); - $file_contents = str_replace('modx->snippetCache[$snippetName] = $file_contents; - $this->modx->snippetCache[$snippetName . 'Props'] = ''; - $this->Log(" |--- File ($filename) -> Custom Modifier"); - } else { - $this->Log(" |--- PHX Error: {$modifier_cmd[$i]} could not be found"); - } - } - } - if (!empty($snippet)) { - $output = $this->modx->runSnippet($snippetName, [ - 'input' => $output, - 'output' => $output, - 'options' => $modifier_value[$i] - ]); - } else { - $output = ''; - } - break; - } - if (count($condition)) { - $this->Log(" |--- Condition = '" . $condition[count($condition) - 1] . "'"); - } - $this->Log(" |--- Output = '" . $output . "'"); - } - } - - return $output; - } - - /** - * @param string $code - * @return mixed - */ - private function runCode($code) - { - // $code is assembled from intval() results joined by `&&`/`||`, so the arithmetic - // evaluator covers it exactly and no eval() is needed to resolve it. - return ArithmeticExpression::evaluate($code); - } - - // Event logging (debug) - - /** - * @return string - */ - public function createEventLog() - { - $out = ''; - if (!empty($this->console)) { - $console = implode("\n", $this->console); - $this->console = []; - - $out = '
              ' . $console . '
              '; - } - - return $out; - } - - // Returns a cleaned string escaping the HTML and special MODx characters - - /** - * @param $string - * @return array|mixed|string - */ - public function LogClean($string) - { - $string = preg_replace("/&(#[0-9]+|[a-z]+);/i", "&$1;", $string); - $string = replace_array($string); - - return $string; - } - - // Simple log entry - - /** - * @param $string - */ - public function Log($string) - { - if ($this->debug) { - $this->debugLog = true; - $this->console[] = (count($this->console) + 1 - $this->curPass) . " [" . strftime( - "%H:%M:%S", - time() - ) . "] " . $this->LogClean($string); - } - } - - // Log snippet output - - /** - * @param $string - */ - public function LogSnippet($string) - { - if ($this->debug) { - $this->debugLog = true; - $this->console[] = (count($this->console) + 1 - $this->curPass) . " [" . strftime( - "%H:%M:%S", - time() - ) . "] " . " |--- Returns:
              " . $this->LogClean($string) . "
              "; - } - } - - // Log pass - public function LogPass() - { - $this->console[] = "
              Pass " . $this->curPass . "
              "; - } - - // Log pass - - /** - * @param $string - */ - public function LogSource($string) - { - $this->console[] = "
              Source:
              " . $this->LogClean($string); - } - - // Returns the specified field from the user record - // positive userid = manager, negative integer = webuser - - /** - * @param $userid - * @param $field - * @return mixed - */ - public function ModUser($userid, $field) - { - if (!array_key_exists($userid, $this->cache["ui"])) { - if (intval($userid) < 0) { - $user = $this->modx->getWebUserInfo(-($userid)); - } else { - $user = $this->modx->getUserInfo($userid); - } - $this->cache["ui"][$userid] = $user; - } else { - $user = $this->cache["ui"][$userid]; - } - - return $user[$field]; - } - - // Returns true if the user id is in one the specified webgroups - - /** - * @param int $userid - * @param array $groupNames - * @return bool - */ - public function isMemberOfWebGroupByUserId($userid = 0, $groupNames = []) - { - $userid = (int)$userid; - // if $groupNames is not an array return false - if (!is_array($groupNames)) { - return false; - } - - // if the user id is a negative number make it positive - if (intval($userid) < 0) { - $userid = -($userid); - } - - // Creates an array with all webgroups the user id is in - if (!array_key_exists($userid, $this->cache["mo"])) { - $tbl = $this->modx->getDatabase()->getFullTableName("webgroup_names"); - $tbl2 = $this->modx->getDatabase()->getFullTableName("web_groups"); - $sql = "SELECT `wgn`.`name` FROM {$tbl} `wgn` INNER JOIN {$tbl2} `wg` ON `wg`.`webgroup`=`wgn`.`id` AND `wg`.`webuser`={$userid}"; - $this->cache["mo"][$userid] = $grpNames = $this->modx->getDatabase()->getColumn("name", $sql); - } else { - $grpNames = $this->cache["mo"][$userid]; - } - // Check if a supplied group matches a webgroup from the array we just created - foreach ($groupNames as $k => $v) { - if (in_array(trim($v), $grpNames)) { - return true; - } - } - - // If we get here the above logic did not find a match, so return false - return false; - } - - // Returns the value of a PHx/MODx placeholder. - - /** - * @param $name - * @return mixed|string - */ - public function getPHxVariable($name) - { - // Check if this variable is created by PHx - if (array_key_exists($name, $this->placeholders)) { - // Return the value from PHx - return $this->placeholders[$name]; - } else { - // Return the value from MODx - return $this->modx->getPlaceholder($name); - } - } - - // Sets a placeholder variable which can only be access by PHx - - /** - * @param $name - * @param $value - */ - public function setPHxVariable($name, $value) - { - if ($name != "phx") { - $this->placeholders[$name] = $value; - } - } - - //mbstring - - /** - * @param $str - * @param $s - * @param null $l - * @return string - */ - public function substr($str, $s, $l = null) - { - if (function_exists('mb_substr')) { - return mb_substr($str, $s, $l); - } - - return substr($str, $s, $l); - } - - /** - * @param $str - * @return int - */ - public function strlen($str) - { - if (function_exists('mb_strlen')) { - return mb_strlen($str); - } - - return strlen($str); - } - - /** - * @param $str - * @return string - */ - public function strtolower($str) - { - if (function_exists('mb_strtolower')) { - return mb_strtolower($str); - } - - return strtolower($str); - } - - /** - * @param $str - * @return string - */ - public function strtoupper($str) - { - if (function_exists('mb_strtoupper')) { - return mb_strtoupper($str); - } - - return strtoupper($str); - } - - /** - * @param $str - * @return string - */ - public function ucfirst($str) - { - if (function_exists('mb_strtoupper') && function_exists('mb_substr') && function_exists('mb_strlen')) { - return mb_strtoupper(mb_substr($str, 0, 1)) . mb_substr($str, 1, mb_strlen($str)); - } - - return ucfirst($str); - } - - /** - * @param $str - * @return string - */ - public function lcfirst($str) - { - if (function_exists('mb_strtolower') && function_exists('mb_substr') && function_exists('mb_strlen')) { - return mb_strtolower(mb_substr($str, 0, 1)) . mb_substr($str, 1, mb_strlen($str)); - } - - return lcfirst($str); - } - - /** - * @param $str - * @return string - */ - public function ucwords($str) - { - if (function_exists('mb_convert_case')) { - return mb_convert_case($str, MB_CASE_TITLE); - } - - return ucwords($str); - } - - /** - * @param $str - * @return string - */ - public function strrev($str) - { - preg_match_all('/./us', $str, $ar); - - return implode(array_reverse($ar[0])); - } - - /** - * @param $str - * @return string - */ - public function str_shuffle($str) - { - preg_match_all('/./us', $str, $ar); - shuffle($ar[0]); - - return implode($ar[0]); - } - - /** - * @param $str - * @return int - */ - public function str_word_count($str) - { - return count(preg_split('~[^\p{L}\p{N}\']+~u', $str)); - } -} + [], + 'ui' => [], + 'mo' => [] + ]; + public $safetags = [ + ['~(?modx = $modx; + $this->user["mgrid"] = isset($_SESSION['mgrInternalKey']) ? intval($_SESSION['mgrInternalKey']) : 0; + $this->user["usrid"] = isset($_SESSION['webInternalKey']) ? intval($_SESSION['webInternalKey']) : 0; + $this->user["id"] = ($this->user["usrid"] > 0) ? (-$this->user["usrid"]) : $this->user["mgrid"]; + + $this->debug = (bool)get_by_key($args, 1, false); + + $this->maxPasses = (int)get_by_key($args, 2, 50); + + $this->modx->setPlaceholder("phx", "&_PHX_INTERNAL_&"); + if (function_exists('mb_internal_encoding')) { + mb_internal_encoding($this->modx->config['evo_charset']); + } + } + + // Plugin event hook for MODx + public function OnParseDocument() + { + // Get document output from MODx + $template = $this->modx->documentOutput; + // To the parse cave .. let's go! *insert batman tune here* + $template = $this->Parse($template); + // Set processed document output in MODx + $this->modx->documentOutput = $template; + } + + // Parser: Preparation, cleaning and checkup + + /** + * @param string $template + * @return mixed|string + */ + public function Parse($template = '') + { + // If we already reached max passes don't get at it again. + if ($this->curPass == $this->maxPasses) { + return $template; + } + // Set template pre-process hash + $st = md5($template); + // Replace non-call characters in the template: [, ] + $template = preg_replace($this->safetags[0], $this->safetags[1], $template); + // To the parse mobile.. let's go! *insert batman tune here* + $template = $this->ParseValues($template); + // clean up unused placeholders that have modifiers attached (MODx can't clean them) + preg_match_all('~(?:=`[^`@]*?)(\[\+([^:\+\[\]]+)([^\[\]]*?)\+\])~s', $template, $matches); + if ($matches[0]) { + $template = str_replace($matches[1], '', $template); + $this->Log("Cleaning unsolved tags: \n" . implode("\n", $matches[2])); + } + // Restore non-call characters in the template: [, ] + $template = str_replace($this->safetags[1], $this->safetags[2], $template); + // Set template post-process hash + $et = md5($template); + // If template has changed, parse it once more... + if ($st != $et) { + $template = $this->Parse($template); + } + // Write an event log if debugging is enabled and there is something to log + if ($this->debug && $this->debugLog) { + $this->modx->logEvent($this->curPass, 1, $this->createEventLog(), $this->name . ' ' . $this->version); + $this->debugLog = false; + } + + // Return the processed template + return $template; + } + + // Parser: Tag detection and replacements + + /** + * @param string $template + * @return mixed|string + */ + public function ParseValues($template = '') + { + $this->curPass = $this->curPass + 1; + $st = md5($template); + + $this->LogPass(); + // MODX Chunks + if (preg_match_all('~(?Log('MODX Chunks -> Merging all chunk tags'); + $count = count($matches[0]); + $var_search = []; + $var_replace = []; + for ($i = 0; $i < $count; $i++) { + $var_search[] = $matches[0][$i]; + $input = $matches[1][$i]; + $this->Log('MODX Chunk: ' . $input); + $input = $this->modx->mergeChunkContent('{{' . $input . '}}'); + $var_replace[] = $this->Filter($input, $matches[2][$i]); + } + $template = str_replace($var_search, $var_replace, $template); + } + + // MODx Snippets + //if ( preg_match_all('~\[(\[|!)([^\[]*?)(!|\])\]~s',$template, $matches)) { + if (preg_match_all('~(?Log("MODx Snippet -> " . $snippet); + + // Let MODx evaluate snippet + $replace = $this->modx->evalSnippets("[[" . $snippet . "]]"); + $this->LogSnippet($replace); + + // Replace values + $var_search[] = $matches[0][$i]; + $var_replace[] = $replace; + } + $template = str_replace($var_search, $var_replace, $template); + } + + // PHx / MODx Tags + if (preg_match_all('~\[(\+|\*|\()([^:\+\[\]]+)([^\[\]]*?)(\1|\))\]~s', $template, $matches)) { + //$matches[0] // Complete string that's need to be replaced + //$matches[1] // Type + //$matches[2] // The placeholder(s) + //$matches[3] // The modifiers + //$matches[4] // Type (end character) + + $count = count($matches[0]); + $var_search = []; + $var_replace = []; + for ($i = 0; $i < $count; $i++) { + $input = $matches[2][$i]; + $modifiers = $matches[3][$i]; + $var_search[] = $matches[0][$i]; + switch ($matches[1][$i]) { + // Document / Template Variable eXtended + case "*": + $this->Log("MODx TV/DV: " . $input); + $input = $this->modx->mergeDocumentContent("[*" . $input . "*]"); + $replace = $this->Filter($input, $modifiers); + break; + // MODx Setting eXtended + case "(": + $this->Log("MODx Setting variable: " . $input); + $input = $this->modx->mergeSettingsContent("[(" . $input . ")]"); + $replace = $this->Filter($input, $modifiers); + break; + // MODx Placeholder eXtended + default: + $this->Log("MODx / PHx placeholder variable: " . $input); + // Check if placeholder is set + if (! array_key_exists($input, $this->placeholders) && + ! array_key_exists($input, $this->modx->placeholders) + ) { + // not set so try again later. + $input = ''; + } else { + // is set, get value and run filter + $input = $this->getPHxVariable($input); + } + $replace = $this->Filter($input, $modifiers); + break; + } + $var_replace[] = $replace; + } + $template = str_replace($var_search, $var_replace, $template); + } + $et = md5($template); // Post-process template hash + + // Log an event if this was the maximum pass + if ($this->curPass == $this->maxPasses) { + $this->Log("Max passes reached. infinite loop protection so exiting.\n If you need the extra passes set the max passes to the highest count of nested tags in your template."); + } + // If this pass is not at maximum passes and the template hash is not the same, get at it again. + if (($this->curPass < $this->maxPasses) && ($st != $et)) { + $template = $this->ParseValues($template); + } + + return $template; + } + + // Parser: modifier detection and eXtended processing if needed + + /** + * @param $input + * @param $modifiers + * @return mixed|null|string + */ + public function Filter($input, $modifiers) + { + $output = $input; + $this->Log(" |--- Input = '" . $output . "'"); + if (preg_match_all('~:([^:=]+)(?:=`(.*?)`(?=:[^:=]+|$))?~s', $modifiers, $matches)) { + $modifier_cmd = $matches[1]; // modifier command + $modifier_value = $matches[2]; // modifier value + $count = count($modifier_cmd); + $condition = []; + for ($i = 0; $i < $count; $i++) { + $output = trim($output); + $this->Log(" |--- Modifier = '" . $modifier_cmd[$i] . "'"); + if ($modifier_value[$i] != '') { + $this->Log(" |--- Options = '" . $modifier_value[$i] . "'"); + } + switch ($modifier_cmd[$i]) { + ##### Conditional Modifiers + case "input": + case "if": + $output = $modifier_value[$i]; + break; + case "equals": + case "is": + case "eq": + $condition[] = intval(($output == $modifier_value[$i])); + break; + case "empty": + $condition[] = intval(empty($output)); + break; + case "notequals": + case "isnot": + case "isnt": + case "ne": + $condition[] = intval(($output != $modifier_value[$i])); + break; + case "isgreaterthan": + case "isgt": + case "eg": + $condition[] = intval(($output >= $modifier_value[$i])); + break; + case "islowerthan": + case "islt": + case "el": + $condition[] = intval(($output <= $modifier_value[$i])); + break; + case "greaterthan": + case "gt": + $condition[] = intval(($output > $modifier_value[$i])); + break; + case "lowerthan": + case "lt": + $condition[] = intval(($output < $modifier_value[$i])); + break; + case "isinrole": + case "ir": + case "memberof": + case "mo": // Is Member Of (same as inrole but this one can be stringed as a conditional) + if ($output == "&_PHX_INTERNAL_&") { + $output = $this->user["id"]; + } + $grps = ($this->strlen($modifier_value[$i]) > 0) ? explode(",", $modifier_value[$i]) : []; + $condition[] = intval($this->isMemberOfWebGroupByUserId($output, $grps)); + break; + case "or": + $condition[] = "||"; + break; + case "and": + $condition[] = "&&"; + break; + case "show": + $conditional = implode(' ', $condition); + $isvalid = intval($this->runCode($conditional)); + if (!$isvalid) { + $output = null; + } + break; + case "then": + $conditional = implode(' ', $condition); + $isvalid = intval($this->runCode($conditional)); + if ($isvalid) { + $output = $modifier_value[$i]; + } else { + $output = null; + } + break; + case "else": + $conditional = implode(' ', $condition); + $isvalid = intval($this->runCode($conditional)); + if (!$isvalid) { + $output = $modifier_value[$i]; + } + break; + case "select": + $raw = explode("&", $modifier_value[$i]); + $map = []; + $count = count($raw); + for ($m = 0; $m < $count; $m++) { + $mi = explode("=", $raw[$m]); + $map[$mi[0]] = $mi[1]; + } + $output = $map[$output]; + break; + ##### End of Conditional Modifiers + + ##### String Modifiers + case "default": + $output = ($output === '') ? $modifier_value[0] : $output; + break; + case "lcase": + case "strtolower": + $output = $this->strtolower($output); + break; + case "ucase": + case "strtoupper": + $output = $this->strtoupper($output); + break; + case "ucfirst": + $output = $this->ucfirst($output); + break; + case "lcfirst": + $output = $this->lcfirst($output); + break; + case "ucwords": + $output = $this->ucwords($output); + break; + case "htmlent": + case "htmlentities": + $output = htmlentities($output, ENT_QUOTES, $this->modx->config['evo_charset']); + break; + case "html_entity_decode": + $output = html_entity_decode($output, ENT_QUOTES, $this->modx->config['evo_charset']); + break; + case "esc": + $output = preg_replace("/&(#[0-9]+|[a-z]+);/i", "&$1;", e($output)); + $output = str_replace(["[", "]", "`"], ["[", "]", "`"], $output); + break; + case "strip": + $output = preg_replace("~([\n\r\t\s]+)~", " ", $output); + break; + case "notags": + case "strip_tags": + $output = strip_tags($output); + break; + case "length": + case "len": + case "strlen": + $output = $this->strlen($output); + break; + case "reverse": + case "strrev": + $output = $this->strrev($output); + break; + case "wordwrap": // default: 70 + $wrapat = intval($modifier_value[$i]) ? intval($modifier_value[$i]) : 70; + $output = preg_replace_callback("@(\b\w+\b)@", function ($m) use ($wrapat) { + return wordwrap($m[1], $wrapat, ' ', 1); + }, $output); + break; + case "limit": // default: 100 + $limit = intval($modifier_value[$i]) ? intval($modifier_value[$i]) : 100; + $output = $this->substr($output, 0, $limit); + break; + case "str_shuffle": + case "shuffle": + $output = $this->str_shuffle($output); + break; + case "str_word_count": + case "word_count": + case "wordcount": + $output = $this->str_word_count($output); + break; + + ##### Special functions + case "math": + $filter = preg_replace("~([a-zA-Z\n\r\t\s])~", "", $modifier_value[$i]); + $filter = str_replace("?", $output, $filter); + // The letter strip above never made this safe: `$`, quotes and backslashes + // survive it, and octal escapes need no letters at all. + $output = ArithmeticExpression::evaluate($filter); + break; + case "isnotempty": + if (!empty($output)) { + $output = $modifier_value[$i]; + } + break; + case "isempty": + case "ifempty": + if (empty($output)) { + $output = $modifier_value[$i]; + } + break; + case "nl2br": + $output = nl2br($output); + break; + case "date": + $output = strftime($modifier_value[$i], (int)$output); + break; + case "set": + $c = $i + 1; + if ($count > $c && $modifier_cmd[$c] == "value") { + $output = preg_replace("~([^a-zA-Z0-9])~", "", $modifier_value[$i]); + } + break; + case "value": + if ($i > 0 && $modifier_cmd[$i - 1] == "set") { + $this->modx->SetPlaceholder("phx." . $output, $modifier_value[$i]); + } + $output = null; + break; + case "md5": + $output = md5($output); + break; + case 'inarray': + case 'in_array': + case 'in': + $modifier_value[$i] = explode(',', $modifier_value[$i]); + $condition[] = (int)(in_array($output, $modifier_value[$i]) !== false); + break; + case "userinfo": + if ($output == "&_PHX_INTERNAL_&") { + $output = $this->user["id"]; + } + $output = $this->ModUser($output, $modifier_value[$i]); + break; + case "inrole": // deprecated + if ($output == "&_PHX_INTERNAL_&") { + $output = $this->user["id"]; + } + $grps = ($this->strlen($modifier_value[$i]) > 0) ? explode(",", $modifier_value[$i]) : []; + $output = intval($this->isMemberOfWebGroupByUserId($output, $grps)); + break; + + // If we haven't yet found the modifier, let's look elsewhere + default: + $snippet = ''; + // modified by Anton Kuzmin (23.06.2010) // + $snippetName = 'phx:' . $modifier_cmd[$i]; + if (array_key_exists($snippetName, $this->modx->snippetCache)) { + $snippet = $this->modx->snippetCache[$snippetName]; + } else { +// not in cache so let's check the db + $snippetObject = $this->modx->getSnippetFromDatabase($snippetName); + $this->modx->snippetCache[$snippetObject['name']] = $snippetObject['content']; + $this->modx->snippetCache[$snippetObject['name'] . 'Props'] = $snippetObject['properties']; + if ($snippetObject['content'] !== null) { + $snippet = $snippetObject['content']; + $this->Log(" |--- DB -> Custom Modifier"); + } else { + // If snippet not found, look in the modifiers folder + $filename = $this->modx->getConfig('rb_base_dir') . 'plugins/phx/modifiers/' . $modifier_cmd[$i] . '.phx.php'; + if (@file_exists($filename)) { + $file_contents = @file_get_contents($filename); + $file_contents = str_replace('<' . '?php', '', $file_contents); + $file_contents = str_replace('?' . '>', '', $file_contents); + $file_contents = str_replace('modx->snippetCache[$snippetName] = $file_contents; + $this->modx->snippetCache[$snippetName . 'Props'] = ''; + $this->Log(" |--- File ($filename) -> Custom Modifier"); + } else { + $this->Log(" |--- PHX Error: {$modifier_cmd[$i]} could not be found"); + } + } + } + if (!empty($snippet)) { + $output = $this->modx->runSnippet($snippetName, [ + 'input' => $output, + 'output' => $output, + 'options' => $modifier_value[$i] + ]); + } else { + $output = ''; + } + break; + } + if (count($condition)) { + $this->Log(" |--- Condition = '" . $condition[count($condition) - 1] . "'"); + } + $this->Log(" |--- Output = '" . $output . "'"); + } + } + + return $output; + } + + /** + * @param string $code + * @return mixed + */ + private function runCode($code) + { + // $code is assembled from intval() results joined by `&&`/`||`, so the arithmetic + // evaluator covers it exactly and no eval() is needed to resolve it. + return ArithmeticExpression::evaluate($code); + } + + // Event logging (debug) + + /** + * @return string + */ + public function createEventLog() + { + $out = ''; + if (!empty($this->console)) { + $console = implode("\n", $this->console); + $this->console = []; + + $out = '
              ' . $console . '
              '; + } + + return $out; + } + + // Returns a cleaned string escaping the HTML and special MODx characters + + /** + * @param $string + * @return array|mixed|string + */ + public function LogClean($string) + { + $string = preg_replace("/&(#[0-9]+|[a-z]+);/i", "&$1;", $string); + $string = replace_array($string); + + return $string; + } + + // Simple log entry + + /** + * @param $string + */ + public function Log($string) + { + if ($this->debug) { + $this->debugLog = true; + $this->console[] = (count($this->console) + 1 - $this->curPass) . " [" . strftime( + "%H:%M:%S", + time() + ) . "] " . $this->LogClean($string); + } + } + + // Log snippet output + + /** + * @param $string + */ + public function LogSnippet($string) + { + if ($this->debug) { + $this->debugLog = true; + $this->console[] = (count($this->console) + 1 - $this->curPass) . " [" . strftime( + "%H:%M:%S", + time() + ) . "] " . " |--- Returns:
              " . $this->LogClean($string) . "
              "; + } + } + + // Log pass + public function LogPass() + { + $this->console[] = "
              Pass " . $this->curPass . "
              "; + } + + // Log pass + + /** + * @param $string + */ + public function LogSource($string) + { + $this->console[] = "
              Source:
              " . $this->LogClean($string); + } + + // Returns the specified field from the user record + // positive userid = manager, negative integer = webuser + + /** + * @param $userid + * @param $field + * @return mixed + */ + public function ModUser($userid, $field) + { + if (!array_key_exists($userid, $this->cache["ui"])) { + if (intval($userid) < 0) { + $user = $this->modx->getWebUserInfo(-($userid)); + } else { + $user = $this->modx->getUserInfo($userid); + } + $this->cache["ui"][$userid] = $user; + } else { + $user = $this->cache["ui"][$userid]; + } + + return $user[$field]; + } + + // Returns true if the user id is in one the specified webgroups + + /** + * @param int $userid + * @param array $groupNames + * @return bool + */ + public function isMemberOfWebGroupByUserId($userid = 0, $groupNames = []) + { + $userid = (int)$userid; + // if $groupNames is not an array return false + if (!is_array($groupNames)) { + return false; + } + + // if the user id is a negative number make it positive + if (intval($userid) < 0) { + $userid = -($userid); + } + + // Creates an array with all webgroups the user id is in + if (!array_key_exists($userid, $this->cache["mo"])) { + $tbl = $this->modx->getDatabase()->getFullTableName("webgroup_names"); + $tbl2 = $this->modx->getDatabase()->getFullTableName("web_groups"); + $sql = "SELECT `wgn`.`name` FROM {$tbl} `wgn` INNER JOIN {$tbl2} `wg` ON `wg`.`webgroup`=`wgn`.`id` AND `wg`.`webuser`={$userid}"; + $this->cache["mo"][$userid] = $grpNames = $this->modx->getDatabase()->getColumn("name", $sql); + } else { + $grpNames = $this->cache["mo"][$userid]; + } + // Check if a supplied group matches a webgroup from the array we just created + foreach ($groupNames as $k => $v) { + if (in_array(trim($v), $grpNames)) { + return true; + } + } + + // If we get here the above logic did not find a match, so return false + return false; + } + + // Returns the value of a PHx/MODx placeholder. + + /** + * @param $name + * @return mixed|string + */ + public function getPHxVariable($name) + { + // Check if this variable is created by PHx + if (array_key_exists($name, $this->placeholders)) { + // Return the value from PHx + return $this->placeholders[$name]; + } else { + // Return the value from MODx + return $this->modx->getPlaceholder($name); + } + } + + // Sets a placeholder variable which can only be access by PHx + + /** + * @param $name + * @param $value + */ + public function setPHxVariable($name, $value) + { + if ($name != "phx") { + $this->placeholders[$name] = $value; + } + } + + //mbstring + + /** + * @param $str + * @param $s + * @param null $l + * @return string + */ + public function substr($str, $s, $l = null) + { + if (function_exists('mb_substr')) { + return mb_substr($str, $s, $l); + } + + return substr($str, $s, $l); + } + + /** + * @param $str + * @return int + */ + public function strlen($str) + { + if (function_exists('mb_strlen')) { + return mb_strlen($str); + } + + return strlen($str); + } + + /** + * @param $str + * @return string + */ + public function strtolower($str) + { + if (function_exists('mb_strtolower')) { + return mb_strtolower($str); + } + + return strtolower($str); + } + + /** + * @param $str + * @return string + */ + public function strtoupper($str) + { + if (function_exists('mb_strtoupper')) { + return mb_strtoupper($str); + } + + return strtoupper($str); + } + + /** + * @param $str + * @return string + */ + public function ucfirst($str) + { + if (function_exists('mb_strtoupper') && function_exists('mb_substr') && function_exists('mb_strlen')) { + return mb_strtoupper(mb_substr($str, 0, 1)) . mb_substr($str, 1, mb_strlen($str)); + } + + return ucfirst($str); + } + + /** + * @param $str + * @return string + */ + public function lcfirst($str) + { + if (function_exists('mb_strtolower') && function_exists('mb_substr') && function_exists('mb_strlen')) { + return mb_strtolower(mb_substr($str, 0, 1)) . mb_substr($str, 1, mb_strlen($str)); + } + + return lcfirst($str); + } + + /** + * @param $str + * @return string + */ + public function ucwords($str) + { + if (function_exists('mb_convert_case')) { + return mb_convert_case($str, MB_CASE_TITLE); + } + + return ucwords($str); + } + + /** + * @param $str + * @return string + */ + public function strrev($str) + { + preg_match_all('/./us', $str, $ar); + + return implode(array_reverse($ar[0])); + } + + /** + * @param $str + * @return string + */ + public function str_shuffle($str) + { + preg_match_all('/./us', $str, $ar); + shuffle($ar[0]); + + return implode($ar[0]); + } + + /** + * @param $str + * @return int + */ + public function str_word_count($str) + { + return count(preg_split('~[^\p{L}\p{N}\']+~u', $str)); + } +} diff --git a/core/src/Observers/SiteContentObserver.php b/core/src/Observers/SiteContentObserver.php index cdaecb1543..94b7f6ee3d 100644 --- a/core/src/Observers/SiteContentObserver.php +++ b/core/src/Observers/SiteContentObserver.php @@ -1,14 +1,14 @@ -editedby = evo()->getLoginUserID('mgr'); - $model->pagetitle = trim($model->pagetitle); - - return !empty($model->pagetitle); - } -} +editedby = evo()->getLoginUserID('mgr'); + $model->pagetitle = trim($model->pagetitle); + + return !empty($model->pagetitle); + } +} diff --git a/core/src/Parser.php b/core/src/Parser.php index 58bdbffb07..e687211c0c 100644 --- a/core/src/Parser.php +++ b/core/src/Parser.php @@ -1,572 +1,572 @@ -modx = $modx; - $this->loadBlade(); - } - - /** - * prevent the instance from being cloned - * - * @return void - */ - private function __clone () - { - } - - /** - * prevent from being unserialized - * - * @return void - */ - public function __wakeup () - { - } - - /** - * @return string - */ - public function getTemplatePath () - { - return $this->templatePath; - } - - /** - * Sets the relative path to the templates folder - * - * @param string $path - * @param bool $supRoot - * @return $this - */ - public function setTemplatePath ($path, $supRoot = false) - { - $path = trim($path); - if ($supRoot === false) { - $path = $this->cleanPath($path); - } - - if (!empty($path)) { - $this->templatePath = $path; - if ($this->blade) { - $filesystem = new Filesystem; - $viewFinder = new FileViewFinder($filesystem, [EVO_BASE_PATH . $path]); - $this->blade->setFinder($viewFinder); - } - } - - return $this; - } - - /** - * @param string $path - * @return string - */ - protected function cleanPath ($path) - { - return preg_replace(['/\.*[\/|\\\]/i', '/[\/|\\\]+/i'], ['/', '/'], $path); - } - - public function getTemplateExtension () - { - return $this->templateExtension; - } - - /** - * Sets the template file extension - * - * @param $ext - * @return $this - */ - public function setTemplateExtension ($ext) - { - $ext = $this->cleanPath(trim($ext, ". \t\n\r\0\x0B")); - - if (!empty($ext)) { - $this->templateExtension = $ext; - } - - return $this; - } - - /** - * Additional data for external templates - * - * @param array $data - * @return $this - */ - public function setTemplateData ($data = []) - { - if (is_array($data)) { - $this->templateData = $data; - } - - return $this; - } - - /** - * @param array $data - * @return array - */ - public function getTemplateData ($data = []) - { - $plh = array_merge($this->modx->getDataForView(), $this->templateData); - $plh['data'] = $data; - $plh['modx'] = $this->modx; - - return $plh; - } - - /** - * Stores data in the placeholders array - * - * @param mixed $data data - * @param int $set whether to set the global Evolution CMS placeholder as well - * @param string $key local placeholder key - * @param string $prefix prefix for the array keys - * @return string - */ - public function toPlaceholders ($data, $set = 0, $key = 'contentPlaceholder', $prefix = '') - { - $out = ''; - if ($set != 0) { - $this->modx->toPlaceholder($key, $data, $prefix); - } else { - $out = $data; - } - - return $out; - } - - /** - * refactor $modx->getChunk(); - * - * @param string $name Template: chunk name || @CODE: template || @FILE: file with template - * @return string html template with placeholders without data - */ - public function getChunk ($name) - { - $tpl = ''; - $ext = null; - $this->bladeEnabled = substr($name, 0, 3) == '@B_';//(0 === strpos($name, '@B_')); - if ($name != '' && !isset($this->modx->chunkCache[$name])) { - $mode = (preg_match( - '/^((@[A-Z_]+)[:]{0,1})(.*)/Asu', - trim($name), - $tmp - ) && isset($tmp[2], $tmp[3])) ? $tmp[2] : false; - $subTmp = (isset($tmp[3])) ? trim($tmp[3]) : null; - if ($this->bladeEnabled) { - $ext = $this->getTemplateExtension(); - $this->setTemplateExtension('blade.php'); - } - switch ($mode) { - case '@T_CODE': - case '@T_FILE': - break; - case '@B_FILE': - if ($subTmp != '' && $this->bladeEnabled) { - $tpl = $this->blade->make($this->cleanPath($subTmp)); - } - break; - case '@B_CODE': - $cache = md5($name) . '-' . sha1($subTmp); - $filesystem = $this->modx['filesystem']->drive('storage'); - if (!$filesystem->exists('blade/' . $cache . '.blade.php')) { - $filesystem->put('blade/' . $cache . '.blade.php', $subTmp); - } - $this->blade->addNamespace('cache', $filesystem->path('blade/')); - $tpl = $this->blade->make('cache::' . $cache); - break; - case '@FILE': - if ($subTmp != '') { - $real = realpath(EVO_BASE_PATH . $this->templatePath); - $path = realpath(EVO_BASE_PATH . $this->templatePath . $this->cleanPath($subTmp) . '.' . $this->templateExtension); - if (basename($path, '.' . $this->templateExtension) !== '' && - 0 === strpos($path, $real) && - file_exists($path) - ) { - $tpl = file_get_contents($path); - } - } - break; - case '@INLINE': - case '@TPL': - case '@CODE': - $tpl = $tmp[3]; //without trim - break; - case '@DOCUMENT': - case '@DOC': - switch (true) { - case ((int)$subTmp > 0): - $tpl = $this->modx->getPageInfo((int)$subTmp, 0, "content"); - $tpl = isset($tpl['content']) ? $tpl['content'] : ''; - break; - case ((int)$subTmp == 0): - $tpl = $this->modx->documentObject['content']; - break; - } - break; - case '@PLH': - case '@PLACEHOLDER': - if ($subTmp != '') { - $tpl = $this->modx->getPlaceholder($subTmp); - } - break; - case '@CFG': - case '@CONFIG': - case '@OPTIONS': - if ($subTmp != '') { - $tpl = $this->modx->getConfig($subTmp); - } - break; - case '@SNIPPET': - if ($subTmp != '') { - $tpl = $this->modx->runSnippet($subTmp, $this->modx->event->params); - } - break; - case '@RENDERPAGE': - $tpl = $this->renderDoc($subTmp, false); - break; - case '@LOADPAGE': - $tpl = $this->renderDoc($subTmp, true); - break; - case '@TEMPLATE': - $tpl = $this->getTemplate($subTmp); - break; - case '@CHUNK': - $tpl = $this->getBaseChunk($subTmp); - break; - default: - $tpl = $this->getBaseChunk($name); - } - $this->modx->chunkCache[$name] = $tpl; - } else { - $tpl = $this->getBaseChunk($name); - } - - if ($ext !== null) { - $this->setTemplateExtension($ext); - } - - return $tpl; - } - - /** - * @param string $name - * @return null|string - * - * @deprecated since 3.5.8 reading a chunk's code out of the database; the - * snippet column is only resolve()'s fallback for a chunk with no file - * @todo [remove@3.7] Remove in Evolution CMS 3.7 - */ - public function getBaseChunk ($name) - { - if (empty($name)) { - return null; - } - - if (array_key_exists($name, $this->modx->chunkCache)) { - $tpl = $this->modx->chunkCache[$name]; - } else { - /** @var \Illuminate\Database\Eloquent\Collection $chunk */ - $chunk = Models\SiteHtmlsnippet::where('name', '=', $name) - ->where('disabled', '=', 0) - ->get(); - - $row = $chunk->count() === 1 ? $chunk->first() : null; - $tpl = $row === null - ? null - : ChunkFileStore::make()->resolve((string) $row->name, $row->snippet); - $this->modx->chunkCache[$name] = $tpl; - } - - return $tpl; - } - - /** - * Renders a document, substituting placeholders and executing snippets - * - * @param int $id document ID - * @param bool $events whether to fire the OnLoadWebDocument and OnLoadDocumentObject events (inside getDocumentObject) while rendering - * @param mixed $tpl template to render the document with. Possible values: - * null - use the template assigned to the document - * int(0-n) - load the template with this ID from the database and apply it - * string - apply the template given in the string - * @return string - * - * The OnLoadWebDocument event additionally receives: - * - the source the event was fired from - * - the original Core instance - */ - public function renderDoc ($id, $events = false, $tpl = null) - { - $id = (int)$id; - if ($id <= 0) { - return ''; - } - - $m = clone $this->modx; // so that events can be fired - $m->documentIdentifier = $id; - $m->documentObject = $m->getDocumentObject('id', (int)$id, $events ? 'prepareResponse' : null); - if ($m->documentObject['type'] === 'reference') { - if (is_numeric($m->documentObject['content']) && $m->documentObject['content'] > 0) { - $m->documentObject['content'] = $this->renderDoc($m->documentObject['content'], $events); - } - } - switch (true) { - case is_integer($tpl): - $tpl = $this->getTemplate($tpl); - break; - case is_string($tpl): - break; - case $tpl === null: - default: - $tpl = $this->getTemplate($m->documentObject['template']); - } - $m->documentContent = $tpl; - if ($events) { - $m->invokeEvent("OnLoadWebDocument", [ - 'source' => 'DLTemplate', - 'mainModx' => $this->modx, - ]); - } - - return $this->parseDocumentSource($m->documentContent, $m); - } - - /** - * Returns the content of the template with the given ID - * @param int $id template ID - * @return string template HTML - */ - public function getTemplate ($id) - { - $tpl = null; - $id = (int)$id; - if ($id > 0) { - $tpl = $this->modx->db->getValue( - 'SELECT `content` FROM '.$this->modx->getFullTableName('site_templates').' WHERE `id` = '.$id - ); - } - if ($tpl === null) { - $tpl = '[*content*]'; - } - - return $tpl; - } - - /** - * refactor $modx->parseChunk(); - * - * @param string $name Template: chunk name || @CODE: template || @FILE: file with template - * @param array $data paceholder - * @param bool $parseDocumentSource render html template via Core::parseDocumentSource() - * @return string html template with data without placeholders - */ - public function parseChunk ($name, $data = [], $parseDocumentSource = false, $disablePHx = false) - { - $out = $this->getChunk($name); - $blade = strpos($name, '@B_') === 0 && $this->bladeEnabled; - switch (true) { - case $blade: - if (!empty($out)) { - $out = $out->with($this->getTemplateData($data))->render(); - } - break; - case is_array($data) && ($out != ''): - if (preg_match("/\[\+[A-Z0-9\.\_\-]+\+\]/is", $out)) { - $item = $this->renameKeyArr($data, '[', ']', '+'); - $out = str_replace(array_keys($item), array_values($item), $out); - } - if (!$disablePHx && preg_match("/:([^:=]+)(?:=`(.*?)`(?=:[^:=]+|$))?/is", $out)) { - if (is_null($this->phx) || !($this->phx instanceof Phx)) { - $this->phx = $this->createPHx(0, 1000); - } - $this->phx->placeholders = []; - $this->setPHxPlaceholders($data); - $out = $this->phx->Parse($out); - } - break; - } - if ($parseDocumentSource && !$blade) { - $out = $this->parseDocumentSource($out); - } - - return $out; - } - - /** - * - * @param string|array $value - * @param string $key - * @param string $path - */ - public function setPHxPlaceholders ($value = '', $key = '', $path = '') - { - $keypath = !empty($path) ? $path . "." . $key : $key; - $this->phx->curPass = 0; - if (is_array($value)) { - foreach ($value as $subkey => $subval) { - $this->setPHxPlaceholders($subval, $subkey, $keypath); - } - } else { - $this->phx->setPHxVariable($keypath, $value); - } - } - - /** - * - */ - protected function loadBlade () - { - try { - $this->blade = clone $this->modx['view']; - } catch (\Exception $exception) { - $this->modx->messageQuit($exception->getMessage()); - } - } - - /** - * - * @param string $string - * @return string - */ - public function cleanPHx ($string) - { - preg_match_all('~\[(\+|\*|\()([^:\+\[\]]+)([^\[\]]*?)(\1|\))\]~s', $string, $matches); - if ($matches[0]) { - $string = str_replace($matches[0], '', $string); - } - - return $string; - } - - /** - * @param int $debug - * @param int $maxpass - * @return Phx - */ - public function createPHx ($debug = 0, $maxpass = 50) - { - return new Phx($this->modx, $debug, $maxpass); - } - - /** - * Renames array keys - * - * @param array $data source array - * @param string $prefix key prefix - * @param string $suffix key suffix - * @param string $sep separator between prefix, key and suffix - * @return array array with renamed keys - */ - public function renameKeyArr ($data, $prefix = '', $suffix = '', $sep = '.') - { - return rename_key_arr($data, $prefix, $suffix, $sep); - } - - /** - * @param $out - * @param Core|null $modx - * @return mixed|string - */ - public function parseDocumentSource ($out, $modx = null) - { - if (!is_object($modx)) { - $modx = $this->modx; - } - $minParserPasses = $modx->minParserPasses; - $maxParserPasses = $modx->maxParserPasses; - - $modx->minParserPasses = 2; - $modx->maxParserPasses = 10; - - $site_status = $modx->getConfig('site_status'); - $modx->config['site_status'] = 0; - - for ($i = 1; $i <= $modx->maxParserPasses; $i++) { - $html = $out; - if (preg_match('/\[\!(.*)\!\]/us', $out)) { - $out = str_replace(['[!', '!]'], ['[[', ']]'], $out); - } - if ($i <= $modx->minParserPasses || $out != $html) { - $out = $modx->parseDocumentSource($out); - } else { - break; - } - } - - $out = $modx->rewriteUrls($out); - $out = $this->cleanPHx($out); - - $modx->config['site_status'] = $site_status; - - $modx->minParserPasses = $minParserPasses; - $modx->maxParserPasses = $maxParserPasses; - - return $out; - } -} +modx = $modx; + $this->loadBlade(); + } + + /** + * prevent the instance from being cloned + * + * @return void + */ + private function __clone () + { + } + + /** + * prevent from being unserialized + * + * @return void + */ + public function __wakeup () + { + } + + /** + * @return string + */ + public function getTemplatePath () + { + return $this->templatePath; + } + + /** + * Sets the relative path to the templates folder + * + * @param string $path + * @param bool $supRoot + * @return $this + */ + public function setTemplatePath ($path, $supRoot = false) + { + $path = trim($path); + if ($supRoot === false) { + $path = $this->cleanPath($path); + } + + if (!empty($path)) { + $this->templatePath = $path; + if ($this->blade) { + $filesystem = new Filesystem; + $viewFinder = new FileViewFinder($filesystem, [EVO_BASE_PATH . $path]); + $this->blade->setFinder($viewFinder); + } + } + + return $this; + } + + /** + * @param string $path + * @return string + */ + protected function cleanPath ($path) + { + return preg_replace(['/\.*[\/|\\\]/i', '/[\/|\\\]+/i'], ['/', '/'], $path); + } + + public function getTemplateExtension () + { + return $this->templateExtension; + } + + /** + * Sets the template file extension + * + * @param $ext + * @return $this + */ + public function setTemplateExtension ($ext) + { + $ext = $this->cleanPath(trim($ext, ". \t\n\r\0\x0B")); + + if (!empty($ext)) { + $this->templateExtension = $ext; + } + + return $this; + } + + /** + * Additional data for external templates + * + * @param array $data + * @return $this + */ + public function setTemplateData ($data = []) + { + if (is_array($data)) { + $this->templateData = $data; + } + + return $this; + } + + /** + * @param array $data + * @return array + */ + public function getTemplateData ($data = []) + { + $plh = array_merge($this->modx->getDataForView(), $this->templateData); + $plh['data'] = $data; + $plh['modx'] = $this->modx; + + return $plh; + } + + /** + * Stores data in the placeholders array + * + * @param mixed $data data + * @param int $set whether to set the global Evolution CMS placeholder as well + * @param string $key local placeholder key + * @param string $prefix prefix for the array keys + * @return string + */ + public function toPlaceholders ($data, $set = 0, $key = 'contentPlaceholder', $prefix = '') + { + $out = ''; + if ($set != 0) { + $this->modx->toPlaceholder($key, $data, $prefix); + } else { + $out = $data; + } + + return $out; + } + + /** + * refactor $modx->getChunk(); + * + * @param string $name Template: chunk name || @CODE: template || @FILE: file with template + * @return string html template with placeholders without data + */ + public function getChunk ($name) + { + $tpl = ''; + $ext = null; + $this->bladeEnabled = substr($name, 0, 3) == '@B_';//(0 === strpos($name, '@B_')); + if ($name != '' && !isset($this->modx->chunkCache[$name])) { + $mode = (preg_match( + '/^((@[A-Z_]+)[:]{0,1})(.*)/Asu', + trim($name), + $tmp + ) && isset($tmp[2], $tmp[3])) ? $tmp[2] : false; + $subTmp = (isset($tmp[3])) ? trim($tmp[3]) : null; + if ($this->bladeEnabled) { + $ext = $this->getTemplateExtension(); + $this->setTemplateExtension('blade.php'); + } + switch ($mode) { + case '@T_CODE': + case '@T_FILE': + break; + case '@B_FILE': + if ($subTmp != '' && $this->bladeEnabled) { + $tpl = $this->blade->make($this->cleanPath($subTmp)); + } + break; + case '@B_CODE': + $cache = md5($name) . '-' . sha1($subTmp); + $filesystem = $this->modx['filesystem']->drive('storage'); + if (!$filesystem->exists('blade/' . $cache . '.blade.php')) { + $filesystem->put('blade/' . $cache . '.blade.php', $subTmp); + } + $this->blade->addNamespace('cache', $filesystem->path('blade/')); + $tpl = $this->blade->make('cache::' . $cache); + break; + case '@FILE': + if ($subTmp != '') { + $real = realpath(EVO_BASE_PATH . $this->templatePath); + $path = realpath(EVO_BASE_PATH . $this->templatePath . $this->cleanPath($subTmp) . '.' . $this->templateExtension); + if (basename($path, '.' . $this->templateExtension) !== '' && + 0 === strpos($path, $real) && + file_exists($path) + ) { + $tpl = file_get_contents($path); + } + } + break; + case '@INLINE': + case '@TPL': + case '@CODE': + $tpl = $tmp[3]; //without trim + break; + case '@DOCUMENT': + case '@DOC': + switch (true) { + case ((int)$subTmp > 0): + $tpl = $this->modx->getPageInfo((int)$subTmp, 0, "content"); + $tpl = isset($tpl['content']) ? $tpl['content'] : ''; + break; + case ((int)$subTmp == 0): + $tpl = $this->modx->documentObject['content']; + break; + } + break; + case '@PLH': + case '@PLACEHOLDER': + if ($subTmp != '') { + $tpl = $this->modx->getPlaceholder($subTmp); + } + break; + case '@CFG': + case '@CONFIG': + case '@OPTIONS': + if ($subTmp != '') { + $tpl = $this->modx->getConfig($subTmp); + } + break; + case '@SNIPPET': + if ($subTmp != '') { + $tpl = $this->modx->runSnippet($subTmp, $this->modx->event->params); + } + break; + case '@RENDERPAGE': + $tpl = $this->renderDoc($subTmp, false); + break; + case '@LOADPAGE': + $tpl = $this->renderDoc($subTmp, true); + break; + case '@TEMPLATE': + $tpl = $this->getTemplate($subTmp); + break; + case '@CHUNK': + $tpl = $this->getBaseChunk($subTmp); + break; + default: + $tpl = $this->getBaseChunk($name); + } + $this->modx->chunkCache[$name] = $tpl; + } else { + $tpl = $this->getBaseChunk($name); + } + + if ($ext !== null) { + $this->setTemplateExtension($ext); + } + + return $tpl; + } + + /** + * @param string $name + * @return null|string + * + * @deprecated since 3.5.8 reading a chunk's code out of the database; the + * snippet column is only resolve()'s fallback for a chunk with no file + * @todo [remove@3.7] Remove in Evolution CMS 3.7 + */ + public function getBaseChunk ($name) + { + if (empty($name)) { + return null; + } + + if (array_key_exists($name, $this->modx->chunkCache)) { + $tpl = $this->modx->chunkCache[$name]; + } else { + /** @var \Illuminate\Database\Eloquent\Collection $chunk */ + $chunk = Models\SiteHtmlsnippet::where('name', '=', $name) + ->where('disabled', '=', 0) + ->get(); + + $row = $chunk->count() === 1 ? $chunk->first() : null; + $tpl = $row === null + ? null + : ChunkFileStore::make()->resolve((string) $row->name, $row->snippet); + $this->modx->chunkCache[$name] = $tpl; + } + + return $tpl; + } + + /** + * Renders a document, substituting placeholders and executing snippets + * + * @param int $id document ID + * @param bool $events whether to fire the OnLoadWebDocument and OnLoadDocumentObject events (inside getDocumentObject) while rendering + * @param mixed $tpl template to render the document with. Possible values: + * null - use the template assigned to the document + * int(0-n) - load the template with this ID from the database and apply it + * string - apply the template given in the string + * @return string + * + * The OnLoadWebDocument event additionally receives: + * - the source the event was fired from + * - the original Core instance + */ + public function renderDoc ($id, $events = false, $tpl = null) + { + $id = (int)$id; + if ($id <= 0) { + return ''; + } + + $m = clone $this->modx; // so that events can be fired + $m->documentIdentifier = $id; + $m->documentObject = $m->getDocumentObject('id', (int)$id, $events ? 'prepareResponse' : null); + if ($m->documentObject['type'] === 'reference') { + if (is_numeric($m->documentObject['content']) && $m->documentObject['content'] > 0) { + $m->documentObject['content'] = $this->renderDoc($m->documentObject['content'], $events); + } + } + switch (true) { + case is_integer($tpl): + $tpl = $this->getTemplate($tpl); + break; + case is_string($tpl): + break; + case $tpl === null: + default: + $tpl = $this->getTemplate($m->documentObject['template']); + } + $m->documentContent = $tpl; + if ($events) { + $m->invokeEvent("OnLoadWebDocument", [ + 'source' => 'DLTemplate', + 'mainModx' => $this->modx, + ]); + } + + return $this->parseDocumentSource($m->documentContent, $m); + } + + /** + * Returns the content of the template with the given ID + * @param int $id template ID + * @return string template HTML + */ + public function getTemplate ($id) + { + $tpl = null; + $id = (int)$id; + if ($id > 0) { + $tpl = $this->modx->db->getValue( + 'SELECT `content` FROM '.$this->modx->getFullTableName('site_templates').' WHERE `id` = '.$id + ); + } + if ($tpl === null) { + $tpl = '[*content*]'; + } + + return $tpl; + } + + /** + * refactor $modx->parseChunk(); + * + * @param string $name Template: chunk name || @CODE: template || @FILE: file with template + * @param array $data paceholder + * @param bool $parseDocumentSource render html template via Core::parseDocumentSource() + * @return string html template with data without placeholders + */ + public function parseChunk ($name, $data = [], $parseDocumentSource = false, $disablePHx = false) + { + $out = $this->getChunk($name); + $blade = strpos($name, '@B_') === 0 && $this->bladeEnabled; + switch (true) { + case $blade: + if (!empty($out)) { + $out = $out->with($this->getTemplateData($data))->render(); + } + break; + case is_array($data) && ($out != ''): + if (preg_match("/\[\+[A-Z0-9\.\_\-]+\+\]/is", $out)) { + $item = $this->renameKeyArr($data, '[', ']', '+'); + $out = str_replace(array_keys($item), array_values($item), $out); + } + if (!$disablePHx && preg_match("/:([^:=]+)(?:=`(.*?)`(?=:[^:=]+|$))?/is", $out)) { + if (is_null($this->phx) || !($this->phx instanceof Phx)) { + $this->phx = $this->createPHx(0, 1000); + } + $this->phx->placeholders = []; + $this->setPHxPlaceholders($data); + $out = $this->phx->Parse($out); + } + break; + } + if ($parseDocumentSource && !$blade) { + $out = $this->parseDocumentSource($out); + } + + return $out; + } + + /** + * + * @param string|array $value + * @param string $key + * @param string $path + */ + public function setPHxPlaceholders ($value = '', $key = '', $path = '') + { + $keypath = !empty($path) ? $path . "." . $key : $key; + $this->phx->curPass = 0; + if (is_array($value)) { + foreach ($value as $subkey => $subval) { + $this->setPHxPlaceholders($subval, $subkey, $keypath); + } + } else { + $this->phx->setPHxVariable($keypath, $value); + } + } + + /** + * + */ + protected function loadBlade () + { + try { + $this->blade = clone $this->modx['view']; + } catch (\Exception $exception) { + $this->modx->messageQuit($exception->getMessage()); + } + } + + /** + * + * @param string $string + * @return string + */ + public function cleanPHx ($string) + { + preg_match_all('~\[(\+|\*|\()([^:\+\[\]]+)([^\[\]]*?)(\1|\))\]~s', $string, $matches); + if ($matches[0]) { + $string = str_replace($matches[0], '', $string); + } + + return $string; + } + + /** + * @param int $debug + * @param int $maxpass + * @return Phx + */ + public function createPHx ($debug = 0, $maxpass = 50) + { + return new Phx($this->modx, $debug, $maxpass); + } + + /** + * Renames array keys + * + * @param array $data source array + * @param string $prefix key prefix + * @param string $suffix key suffix + * @param string $sep separator between prefix, key and suffix + * @return array array with renamed keys + */ + public function renameKeyArr ($data, $prefix = '', $suffix = '', $sep = '.') + { + return rename_key_arr($data, $prefix, $suffix, $sep); + } + + /** + * @param $out + * @param Core|null $modx + * @return mixed|string + */ + public function parseDocumentSource ($out, $modx = null) + { + if (!is_object($modx)) { + $modx = $this->modx; + } + $minParserPasses = $modx->minParserPasses; + $maxParserPasses = $modx->maxParserPasses; + + $modx->minParserPasses = 2; + $modx->maxParserPasses = 10; + + $site_status = $modx->getConfig('site_status'); + $modx->config['site_status'] = 0; + + for ($i = 1; $i <= $modx->maxParserPasses; $i++) { + $html = $out; + if (preg_match('/\[\!(.*)\!\]/us', $out)) { + $out = str_replace(['[!', '!]'], ['[[', ']]'], $out); + } + if ($i <= $modx->minParserPasses || $out != $html) { + $out = $modx->parseDocumentSource($out); + } else { + break; + } + } + + $out = $modx->rewriteUrls($out); + $out = $this->cleanPHx($out); + + $modx->config['site_status'] = $site_status; + + $modx->minParserPasses = $minParserPasses; + $modx->maxParserPasses = $maxParserPasses; + + return $out; + } +} diff --git a/core/src/Providers/BladeServiceProvider.php b/core/src/Providers/BladeServiceProvider.php index 3de98bfcaa..9ffebad782 100644 --- a/core/src/Providers/BladeServiceProvider.php +++ b/core/src/Providers/BladeServiceProvider.php @@ -1,67 +1,67 @@ -getConfig($expression)); ?>"; - }); - - Blade::directive('makeUrl', function ($expression) { - $expression = $expression ?: "''"; - return "makeUrlWithString($expression)); ?>"; - }); - - /** - * Render a public file URL with an mtime-based cache revision. - * - * @since 3.5.8 - */ - Blade::directive('revision', function ($expression) { - $expression = $expression ?: "''"; - return ""; - }); - - Blade::directive('evoParser', function ($expression) { - $expression = $expression ?: "''"; - return ""; - }); - - Blade::directive('evoRole', function ($expression) { - $expression = $expression ?: "''"; - return ""; - }); - - Blade::directive('evoElseRole', function ($expression) { - $expression = $expression ?: "''"; - return ""; - }); - - Blade::directive('evoEndRole', function () { - return ""; - }); - - Blade::if('auth', fn () => evo()->getLoginUserID() !== false); - Blade::if('guest', fn () => evo()->getLoginUserID() === false); - - /** - * @deprecated - * @since 3.5.3 - * - * It's not using anywhere. - * - * @todo [remove@3.7] Remove in Evolution CMS 3.7 - */ - $directives = $this->app['config']->get('view.directive'); - if (\is_array($directives)) { - foreach ($directives as $name => $callback) { - $this->app->get('blade.compiler')->directive($name, $callback); - } - } - } -} +getConfig($expression)); ?>"; + }); + + Blade::directive('makeUrl', function ($expression) { + $expression = $expression ?: "''"; + return "makeUrlWithString($expression)); ?>"; + }); + + /** + * Render a public file URL with an mtime-based cache revision. + * + * @since 3.5.8 + */ + Blade::directive('revision', function ($expression) { + $expression = $expression ?: "''"; + return ""; + }); + + Blade::directive('evoParser', function ($expression) { + $expression = $expression ?: "''"; + return ""; + }); + + Blade::directive('evoRole', function ($expression) { + $expression = $expression ?: "''"; + return ""; + }); + + Blade::directive('evoElseRole', function ($expression) { + $expression = $expression ?: "''"; + return ""; + }); + + Blade::directive('evoEndRole', function () { + return ""; + }); + + Blade::if('auth', fn () => evo()->getLoginUserID() !== false); + Blade::if('guest', fn () => evo()->getLoginUserID() === false); + + /** + * @deprecated + * @since 3.5.3 + * + * It's not using anywhere. + * + * @todo [remove@3.7] Remove in Evolution CMS 3.7 + */ + $directives = $this->app['config']->get('view.directive'); + if (\is_array($directives)) { + foreach ($directives as $name => $callback) { + $this->app->get('blade.compiler')->directive($name, $callback); + } + } + } +} diff --git a/core/src/Providers/ComposerServiceProvider.php b/core/src/Providers/ComposerServiceProvider.php index 22a3546959..6086ea6c38 100644 --- a/core/src/Providers/ComposerServiceProvider.php +++ b/core/src/Providers/ComposerServiceProvider.php @@ -1,37 +1,37 @@ -app->singleton('composer', function ($app) { - return new Composer($app['files'], $app->basePath()); - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return ['composer']; - } -} - +app->singleton('composer', function ($app) { + return new Composer($app['files'], $app->basePath()); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['composer']; + } +} + diff --git a/core/src/Providers/ObserversServiceProvider.php b/core/src/Providers/ObserversServiceProvider.php index 1fe1fbda16..cb85ce5027 100644 --- a/core/src/Providers/ObserversServiceProvider.php +++ b/core/src/Providers/ObserversServiceProvider.php @@ -1,20 +1,20 @@ -app['config']->get('cms.observers'); - - foreach ($observers as $model => $observer) { - $model::observe($observer); - } - } -} +app['config']->get('cms.observers'); + + foreach ($observers as $model => $observer) { + $model::observe($observer); + } + } +} diff --git a/core/src/Providers/PaginationServiceProvider.php b/core/src/Providers/PaginationServiceProvider.php index bd0d26e7d5..fa28bab46d 100644 --- a/core/src/Providers/PaginationServiceProvider.php +++ b/core/src/Providers/PaginationServiceProvider.php @@ -1,35 +1,35 @@ -app['view']; - }); - - Paginator::currentPathResolver(function () { - return parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); - }); - - Paginator::currentPageResolver(function ($pageName = 'page') { - $page = get_by_key($_REQUEST, $pageName, 1, 'is_scalar'); - - if (filter_var($page, FILTER_VALIDATE_INT) !== false && (int) $page >= 1) { - return (int) $page; - } - - return 1; - }); - } -} +app['view']; + }); + + Paginator::currentPathResolver(function () { + return parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); + }); + + Paginator::currentPageResolver(function ($pageName = 'page') { + $page = get_by_key($_REQUEST, $pageName, 1, 'is_scalar'); + + if (filter_var($page, FILTER_VALIDATE_INT) !== false && (int) $page >= 1) { + return (int) $page; + } + + return 1; + }); + } +} diff --git a/core/vendor/composer/LICENSE b/core/vendor/composer/LICENSE index f27399a042..62ecfd8d00 100644 --- a/core/vendor/composer/LICENSE +++ b/core/vendor/composer/LICENSE @@ -1,4 +1,3 @@ - Copyright (c) Nils Adermann, Jordi Boggiano Permission is hereby granted, free of charge, to any person obtaining a copy @@ -18,4 +17,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/core/vendor/composer/autoload_classmap.php b/core/vendor/composer/autoload_classmap.php index 912fecb677..cf73027e97 100644 --- a/core/vendor/composer/autoload_classmap.php +++ b/core/vendor/composer/autoload_classmap.php @@ -80,6 +80,7 @@ 'Carbon\\Exceptions\\NotLocaleAwareException' => $vendorDir . '/nesbot/carbon/src/Carbon/Exceptions/NotLocaleAwareException.php', 'Carbon\\Exceptions\\OutOfRangeException' => $vendorDir . '/nesbot/carbon/src/Carbon/Exceptions/OutOfRangeException.php', 'Carbon\\Exceptions\\ParseErrorException' => $vendorDir . '/nesbot/carbon/src/Carbon/Exceptions/ParseErrorException.php', + 'Carbon\\Exceptions\\PeriodFilterSafetyException' => $vendorDir . '/nesbot/carbon/src/Carbon/Exceptions/PeriodFilterSafetyException.php', 'Carbon\\Exceptions\\RuntimeException' => $vendorDir . '/nesbot/carbon/src/Carbon/Exceptions/RuntimeException.php', 'Carbon\\Exceptions\\UnitException' => $vendorDir . '/nesbot/carbon/src/Carbon/Exceptions/UnitException.php', 'Carbon\\Exceptions\\UnitNotConfiguredException' => $vendorDir . '/nesbot/carbon/src/Carbon/Exceptions/UnitNotConfiguredException.php', @@ -124,6 +125,7 @@ 'Carbon\\Traits\\Test' => $vendorDir . '/nesbot/carbon/src/Carbon/Traits/Test.php', 'Carbon\\Traits\\Timestamp' => $vendorDir . '/nesbot/carbon/src/Carbon/Traits/Timestamp.php', 'Carbon\\Traits\\ToStringFormat' => $vendorDir . '/nesbot/carbon/src/Carbon/Traits/ToStringFormat.php', + 'Carbon\\Traits\\TogglableDetection' => $vendorDir . '/nesbot/carbon/src/Carbon/Traits/TogglableDetection.php', 'Carbon\\Traits\\Units' => $vendorDir . '/nesbot/carbon/src/Carbon/Traits/Units.php', 'Carbon\\Traits\\Week' => $vendorDir . '/nesbot/carbon/src/Carbon/Traits/Week.php', 'Carbon\\Translator' => $vendorDir . '/nesbot/carbon/src/Carbon/Translator.php', @@ -1383,6 +1385,7 @@ 'EvolutionCMS\\Services\\SystemTasks\\ConsoleUninstall\\ConsoleUninstallPlan' => $baseDir . '/src/Services/SystemTasks/ConsoleUninstall/ConsoleUninstallPlan.php', 'EvolutionCMS\\Services\\SystemTasks\\ConsoleUninstall\\ConsoleUninstallRegistry' => $baseDir . '/src/Services/SystemTasks/ConsoleUninstall/ConsoleUninstallRegistry.php', 'EvolutionCMS\\Services\\SystemTasks\\ConsoleUninstall\\ConsoleUninstallResult' => $baseDir . '/src/Services/SystemTasks/ConsoleUninstall/ConsoleUninstallResult.php', + 'EvolutionCMS\\Services\\SystemTasks\\ReportsProcessFailure' => $baseDir . '/src/Services/SystemTasks/ReportsProcessFailure.php', 'EvolutionCMS\\Services\\SystemTasks\\SchedulerHealthService' => $baseDir . '/src/Services/SystemTasks/SchedulerHealthService.php', 'EvolutionCMS\\Services\\SystemTasks\\SiteUpdateFlowService' => $baseDir . '/src/Services/SystemTasks/SiteUpdateFlowService.php', 'EvolutionCMS\\Services\\SystemTasks\\SystemTaskRegistry' => $baseDir . '/src/Services/SystemTasks/SystemTaskRegistry.php', @@ -1402,6 +1405,7 @@ 'EvolutionCMS\\Support\\Formatter\\CSSMinify' => $baseDir . '/src/Support/Formatter/CSSMinify.php', 'EvolutionCMS\\Support\\Formatter\\HtmlFormatter' => $baseDir . '/src/Support/Formatter/HtmlFormatter.php', 'EvolutionCMS\\Support\\Formatter\\SqlFormatter' => $baseDir . '/src/Support/Formatter/SqlFormatter.php', + 'EvolutionCMS\\Support\\InstallerCompletion' => $baseDir . '/src/Support/InstallerCompletion.php', 'EvolutionCMS\\Support\\MailTestMailer' => $baseDir . '/src/Support/MailTestMailer.php', 'EvolutionCMS\\Support\\MailTestSmtp' => $baseDir . '/src/Support/MailTestSmtp.php', 'EvolutionCMS\\Support\\MakeTable' => $baseDir . '/src/Support/MakeTable.php', diff --git a/core/vendor/composer/autoload_real.php b/core/vendor/composer/autoload_real.php index 7cc20073ce..412b99c680 100644 --- a/core/vendor/composer/autoload_real.php +++ b/core/vendor/composer/autoload_real.php @@ -31,6 +31,7 @@ public static function getLoader() require __DIR__ . '/autoload_static.php'; call_user_func(\Composer\Autoload\ComposerStaticInit925fea465a58fa69f06ccf2629003e87::getInitializer($loader)); + $loader->setClassMapAuthoritative(true); $loader->register(true); $filesToLoad = \Composer\Autoload\ComposerStaticInit925fea465a58fa69f06ccf2629003e87::$files; diff --git a/core/vendor/composer/autoload_static.php b/core/vendor/composer/autoload_static.php index 3c656c57cc..e21a21ce48 100644 --- a/core/vendor/composer/autoload_static.php +++ b/core/vendor/composer/autoload_static.php @@ -757,6 +757,7 @@ class ComposerStaticInit925fea465a58fa69f06ccf2629003e87 'Carbon\\Exceptions\\NotLocaleAwareException' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Exceptions/NotLocaleAwareException.php', 'Carbon\\Exceptions\\OutOfRangeException' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Exceptions/OutOfRangeException.php', 'Carbon\\Exceptions\\ParseErrorException' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Exceptions/ParseErrorException.php', + 'Carbon\\Exceptions\\PeriodFilterSafetyException' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Exceptions/PeriodFilterSafetyException.php', 'Carbon\\Exceptions\\RuntimeException' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Exceptions/RuntimeException.php', 'Carbon\\Exceptions\\UnitException' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Exceptions/UnitException.php', 'Carbon\\Exceptions\\UnitNotConfiguredException' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Exceptions/UnitNotConfiguredException.php', @@ -801,6 +802,7 @@ class ComposerStaticInit925fea465a58fa69f06ccf2629003e87 'Carbon\\Traits\\Test' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Traits/Test.php', 'Carbon\\Traits\\Timestamp' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Traits/Timestamp.php', 'Carbon\\Traits\\ToStringFormat' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Traits/ToStringFormat.php', + 'Carbon\\Traits\\TogglableDetection' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Traits/TogglableDetection.php', 'Carbon\\Traits\\Units' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Traits/Units.php', 'Carbon\\Traits\\Week' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Traits/Week.php', 'Carbon\\Translator' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Translator.php', @@ -2060,6 +2062,7 @@ class ComposerStaticInit925fea465a58fa69f06ccf2629003e87 'EvolutionCMS\\Services\\SystemTasks\\ConsoleUninstall\\ConsoleUninstallPlan' => __DIR__ . '/../..' . '/src/Services/SystemTasks/ConsoleUninstall/ConsoleUninstallPlan.php', 'EvolutionCMS\\Services\\SystemTasks\\ConsoleUninstall\\ConsoleUninstallRegistry' => __DIR__ . '/../..' . '/src/Services/SystemTasks/ConsoleUninstall/ConsoleUninstallRegistry.php', 'EvolutionCMS\\Services\\SystemTasks\\ConsoleUninstall\\ConsoleUninstallResult' => __DIR__ . '/../..' . '/src/Services/SystemTasks/ConsoleUninstall/ConsoleUninstallResult.php', + 'EvolutionCMS\\Services\\SystemTasks\\ReportsProcessFailure' => __DIR__ . '/../..' . '/src/Services/SystemTasks/ReportsProcessFailure.php', 'EvolutionCMS\\Services\\SystemTasks\\SchedulerHealthService' => __DIR__ . '/../..' . '/src/Services/SystemTasks/SchedulerHealthService.php', 'EvolutionCMS\\Services\\SystemTasks\\SiteUpdateFlowService' => __DIR__ . '/../..' . '/src/Services/SystemTasks/SiteUpdateFlowService.php', 'EvolutionCMS\\Services\\SystemTasks\\SystemTaskRegistry' => __DIR__ . '/../..' . '/src/Services/SystemTasks/SystemTaskRegistry.php', @@ -2079,6 +2082,7 @@ class ComposerStaticInit925fea465a58fa69f06ccf2629003e87 'EvolutionCMS\\Support\\Formatter\\CSSMinify' => __DIR__ . '/../..' . '/src/Support/Formatter/CSSMinify.php', 'EvolutionCMS\\Support\\Formatter\\HtmlFormatter' => __DIR__ . '/../..' . '/src/Support/Formatter/HtmlFormatter.php', 'EvolutionCMS\\Support\\Formatter\\SqlFormatter' => __DIR__ . '/../..' . '/src/Support/Formatter/SqlFormatter.php', + 'EvolutionCMS\\Support\\InstallerCompletion' => __DIR__ . '/../..' . '/src/Support/InstallerCompletion.php', 'EvolutionCMS\\Support\\MailTestMailer' => __DIR__ . '/../..' . '/src/Support/MailTestMailer.php', 'EvolutionCMS\\Support\\MailTestSmtp' => __DIR__ . '/../..' . '/src/Support/MailTestSmtp.php', 'EvolutionCMS\\Support\\MakeTable' => __DIR__ . '/../..' . '/src/Support/MakeTable.php', diff --git a/core/vendor/composer/installed.json b/core/vendor/composer/installed.json index 7f5ee07026..fb3c31d9ff 100644 --- a/core/vendor/composer/installed.json +++ b/core/vendor/composer/installed.json @@ -1158,30 +1158,28 @@ }, { "name": "doctrine/lexer", - "version": "3.0.1", - "version_normalized": "3.0.1.0", + "version": "3.0.2", + "version_normalized": "3.0.2.0", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd" + "reference": "e96fe45e92a54233726014a7cc7340abf29bb14c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd", - "reference": "31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/e96fe45e92a54233726014a7cc7340abf29bb14c", + "reference": "e96fe45e92a54233726014a7cc7340abf29bb14c", "shasum": "" }, "require": { "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^12", - "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^10.5", - "psalm/plugin-phpunit": "^0.18.3", - "vimeo/psalm": "^5.21" + "doctrine/coding-standard": "^14", + "phpstan/phpstan": "^2", + "phpunit/phpunit": "^10.5.58 || ^12.5.4" }, - "time": "2024-02-05T11:56:58+00:00", + "time": "2026-06-14T20:44:06+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -1218,7 +1216,7 @@ ], "support": { "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/3.0.1" + "source": "https://github.com/doctrine/lexer/tree/3.0.2" }, "funding": [ { @@ -4177,17 +4175,17 @@ }, { "name": "nesbot/carbon", - "version": "3.13.2", - "version_normalized": "3.13.2.0", + "version": "3.14.0", + "version_normalized": "3.14.0.0", "source": { "type": "git", "url": "https://github.com/CarbonPHP/carbon.git", - "reference": "a1c54919f5fff9800cd03c32bd01defd5a4061cb" + "reference": "0023eaa2c9110e47446dd512a263c69c40cd41f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/CarbonPHP/carbon/zipball/a1c54919f5fff9800cd03c32bd01defd5a4061cb", - "reference": "a1c54919f5fff9800cd03c32bd01defd5a4061cb", + "url": "https://api.github.com/repos/CarbonPHP/carbon/zipball/0023eaa2c9110e47446dd512a263c69c40cd41f2", + "reference": "0023eaa2c9110e47446dd512a263c69c40cd41f2", "shasum": "" }, "require": { @@ -4213,7 +4211,7 @@ "phpunit/phpunit": "^10.5.53", "squizlabs/php_codesniffer": "^3.13.4 || ^4.0.0" }, - "time": "2026-08-08T11:40:35+00:00", + "time": "2026-09-12T20:45:19+00:00", "bin": [ "bin/carbon" ], @@ -4538,17 +4536,17 @@ }, { "name": "predis/predis", - "version": "v3.6.0", - "version_normalized": "3.6.0.0", + "version": "v3.6.1", + "version_normalized": "3.6.1.0", "source": { "type": "git", "url": "https://github.com/predis/predis.git", - "reference": "2ff20c08bb63697245ffee3f198d1673086c302d" + "reference": "e2db96312ecf57a01a3477bf192d1ebc0ad7e9fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/predis/predis/zipball/2ff20c08bb63697245ffee3f198d1673086c302d", - "reference": "2ff20c08bb63697245ffee3f198d1673086c302d", + "url": "https://api.github.com/repos/predis/predis/zipball/e2db96312ecf57a01a3477bf192d1ebc0ad7e9fb", + "reference": "e2db96312ecf57a01a3477bf192d1ebc0ad7e9fb", "shasum": "" }, "require": { @@ -4564,7 +4562,7 @@ "suggest": { "ext-relay": "Faster connection with in-memory caching (>=0.6.2)" }, - "time": "2026-08-14T23:07:56+00:00", + "time": "2026-09-17T20:41:00+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -4592,7 +4590,7 @@ ], "support": { "issues": "https://github.com/predis/predis/issues", - "source": "https://github.com/predis/predis/tree/v3.6.0" + "source": "https://github.com/predis/predis/tree/v3.6.1" }, "funding": [ { @@ -5218,21 +5216,21 @@ }, { "name": "ramsey/uuid", - "version": "4.9.3", - "version_normalized": "4.9.3.0", + "version": "4.9.4", + "version_normalized": "4.9.4.0", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "1df15849d00943a67d677dc9cfd80795f038c9f8" + "reference": "75d73f48d02797c2c285a7e9f348fadc0102ffe2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/1df15849d00943a67d677dc9cfd80795f038c9f8", - "reference": "1df15849d00943a67d677dc9cfd80795f038c9f8", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/75d73f48d02797c2c285a7e9f348fadc0102ffe2", + "reference": "75d73f48d02797c2c285a7e9f348fadc0102ffe2", "shasum": "" }, "require": { - "brick/math": ">=0.8.16 <=0.18", + "brick/math": "^0.8.16 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13 || ^0.14 || ^0.15 || ^0.16 || ^0.17 || ^0.18 || ^0.19 || ^0.20 || ^1.0", "php": "^8.0", "ramsey/collection": "^1.2 || ^2.0" }, @@ -5265,7 +5263,7 @@ "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter", "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." }, - "time": "2026-06-18T03:57:49+00:00", + "time": "2026-09-16T11:39:30+00:00", "type": "library", "extra": { "captainhook": { @@ -5293,7 +5291,7 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.9.3" + "source": "https://github.com/ramsey/uuid/tree/4.9.4" }, "install-path": "../ramsey/uuid" }, @@ -6268,17 +6266,17 @@ }, { "name": "symfony/console", - "version": "v7.4.18", - "version_normalized": "7.4.18.0", + "version": "v7.4.19", + "version_normalized": "7.4.19.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "23d6f88a29f6d0eac45bd77d70307adf83ba7ab0" + "reference": "3a1973458b153f566a8d7499bc06ece323d60063" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/23d6f88a29f6d0eac45bd77d70307adf83ba7ab0", - "reference": "23d6f88a29f6d0eac45bd77d70307adf83ba7ab0", + "url": "https://api.github.com/repos/symfony/console/zipball/3a1973458b153f566a8d7499bc06ece323d60063", + "reference": "3a1973458b153f566a8d7499bc06ece323d60063", "shasum": "" }, "require": { @@ -6311,7 +6309,7 @@ "symfony/stopwatch": "^6.4|^7.0|^8.0", "symfony/var-dumper": "^6.4|^7.0|^8.0" }, - "time": "2026-08-25T14:18:37+00:00", + "time": "2026-09-13T10:38:41+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -6345,7 +6343,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.4.18" + "source": "https://github.com/symfony/console/tree/v7.4.19" }, "funding": [ { @@ -6772,17 +6770,17 @@ }, { "name": "symfony/finder", - "version": "v7.4.17", - "version_normalized": "7.4.17.0", + "version": "v7.4.19", + "version_normalized": "7.4.19.0", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "5ce28827081f6d1f0c32eaf3882750f19cb5bbe6" + "reference": "1b900bc6ae5ba60c5eee69c11ba44566190576fe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/5ce28827081f6d1f0c32eaf3882750f19cb5bbe6", - "reference": "5ce28827081f6d1f0c32eaf3882750f19cb5bbe6", + "url": "https://api.github.com/repos/symfony/finder/zipball/1b900bc6ae5ba60c5eee69c11ba44566190576fe", + "reference": "1b900bc6ae5ba60c5eee69c11ba44566190576fe", "shasum": "" }, "require": { @@ -6791,7 +6789,7 @@ "require-dev": { "symfony/filesystem": "^6.4|^7.0|^8.0" }, - "time": "2026-08-21T12:09:28+00:00", + "time": "2026-09-10T19:14:10+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -6819,7 +6817,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v7.4.17" + "source": "https://github.com/symfony/finder/tree/v7.4.19" }, "funding": [ { @@ -6843,17 +6841,17 @@ }, { "name": "symfony/http-foundation", - "version": "v7.4.18", - "version_normalized": "7.4.18.0", + "version": "v7.4.19", + "version_normalized": "7.4.19.0", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "d070b716a32fbe3bf04204db0f58ace73b86d133" + "reference": "f7b953be7801974a5a0685e1228bbc3b12b35936" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/d070b716a32fbe3bf04204db0f58ace73b86d133", - "reference": "d070b716a32fbe3bf04204db0f58ace73b86d133", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/f7b953be7801974a5a0685e1228bbc3b12b35936", + "reference": "f7b953be7801974a5a0685e1228bbc3b12b35936", "shasum": "" }, "require": { @@ -6876,7 +6874,7 @@ "symfony/mime": "^6.4|^7.0|^8.0", "symfony/rate-limiter": "^6.4|^7.0|^8.0" }, - "time": "2026-08-30T20:10:52+00:00", + "time": "2026-09-14T17:41:17+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -6904,7 +6902,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v7.4.18" + "source": "https://github.com/symfony/http-foundation/tree/v7.4.19" }, "funding": [ { @@ -6928,17 +6926,17 @@ }, { "name": "symfony/http-kernel", - "version": "v7.4.18", - "version_normalized": "7.4.18.0", + "version": "v7.4.19", + "version_normalized": "7.4.19.0", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "275d2d2d24530f2a0eaf17704a3a93860a036351" + "reference": "683507424cc84ca85ac1551adb609b6b98216667" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/275d2d2d24530f2a0eaf17704a3a93860a036351", - "reference": "275d2d2d24530f2a0eaf17704a3a93860a036351", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/683507424cc84ca85ac1551adb609b6b98216667", + "reference": "683507424cc84ca85ac1551adb609b6b98216667", "shasum": "" }, "require": { @@ -6998,7 +6996,7 @@ "symfony/var-exporter": "^6.4|^7.0|^8.0", "twig/twig": "^3.12|^4.0" }, - "time": "2026-08-30T21:24:29+00:00", + "time": "2026-09-15T07:09:35+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -7026,7 +7024,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v7.4.18" + "source": "https://github.com/symfony/http-kernel/tree/v7.4.19" }, "funding": [ { @@ -7050,17 +7048,17 @@ }, { "name": "symfony/mime", - "version": "v7.4.18", - "version_normalized": "7.4.18.0", + "version": "v7.4.19", + "version_normalized": "7.4.19.0", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "bf328d82105831db3e409195db0540ff57f27c80" + "reference": "f8ac7d0a800bcabbcd1f7de56594cf05e6cd5693" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/bf328d82105831db3e409195db0540ff57f27c80", - "reference": "bf328d82105831db3e409195db0540ff57f27c80", + "url": "https://api.github.com/repos/symfony/mime/zipball/f8ac7d0a800bcabbcd1f7de56594cf05e6cd5693", + "reference": "f8ac7d0a800bcabbcd1f7de56594cf05e6cd5693", "shasum": "" }, "require": { @@ -7086,7 +7084,7 @@ "symfony/property-info": "^6.4|^7.0|^8.0", "symfony/serializer": "^6.4.44|^7.4.17|^8.1.5" }, - "time": "2026-08-22T09:04:42+00:00", + "time": "2026-09-04T10:45:44+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -7118,7 +7116,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v7.4.18" + "source": "https://github.com/symfony/mime/tree/v7.4.19" }, "funding": [ { @@ -7745,23 +7743,23 @@ }, { "name": "symfony/process", - "version": "v7.4.18", - "version_normalized": "7.4.18.0", + "version": "v7.4.19", + "version_normalized": "7.4.19.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "058d17fc284cce14efb2385783b55014a461b176" + "reference": "ed0ae095b86994d370d5791612e55984f15aa30e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/058d17fc284cce14efb2385783b55014a461b176", - "reference": "058d17fc284cce14efb2385783b55014a461b176", + "url": "https://api.github.com/repos/symfony/process/zipball/ed0ae095b86994d370d5791612e55984f15aa30e", + "reference": "ed0ae095b86994d370d5791612e55984f15aa30e", "shasum": "" }, "require": { "php": ">=8.2" }, - "time": "2026-08-21T17:40:08+00:00", + "time": "2026-09-02T12:38:34+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -7789,7 +7787,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.4.18" + "source": "https://github.com/symfony/process/tree/v7.4.19" }, "funding": [ { @@ -7991,17 +7989,17 @@ }, { "name": "symfony/string", - "version": "v7.4.15", - "version_normalized": "7.4.15.0", + "version": "v7.4.19", + "version_normalized": "7.4.19.0", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "e394af32256bf9e7bf80849d95e589167c10097b" + "reference": "02731ce2bd26514bec9efc0baef2cd0b0cf67f46" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/e394af32256bf9e7bf80849d95e589167c10097b", - "reference": "e394af32256bf9e7bf80849d95e589167c10097b", + "url": "https://api.github.com/repos/symfony/string/zipball/02731ce2bd26514bec9efc0baef2cd0b0cf67f46", + "reference": "02731ce2bd26514bec9efc0baef2cd0b0cf67f46", "shasum": "" }, "require": { @@ -8022,7 +8020,7 @@ "symfony/translation-contracts": "^2.5|^3.0", "symfony/var-exporter": "^6.4|^7.0|^8.0" }, - "time": "2026-07-28T07:33:02+00:00", + "time": "2026-09-11T14:46:58+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -8061,7 +8059,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.4.15" + "source": "https://github.com/symfony/string/tree/v7.4.19" }, "funding": [ { diff --git a/core/vendor/composer/installed.php b/core/vendor/composer/installed.php index 48d907d7f7..47c0ba5217 100644 --- a/core/vendor/composer/installed.php +++ b/core/vendor/composer/installed.php @@ -1,8 +1,8 @@ array( 'name' => 'evolution-cms/evolution', - 'pretty_version' => '3.5.8', - 'version' => '3.5.8.0', + 'pretty_version' => '3.5.9', + 'version' => '3.5.9.0', 'reference' => null, 'type' => 'project', 'install_path' => __DIR__ . '/../../', @@ -146,9 +146,9 @@ 'dev_requirement' => false, ), 'doctrine/lexer' => array( - 'pretty_version' => '3.0.1', - 'version' => '3.0.1.0', - 'reference' => '31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd', + 'pretty_version' => '3.0.2', + 'version' => '3.0.2.0', + 'reference' => 'e96fe45e92a54233726014a7cc7340abf29bb14c', 'type' => 'library', 'install_path' => __DIR__ . '/../doctrine/lexer', 'aliases' => array(), @@ -173,8 +173,8 @@ 'dev_requirement' => false, ), 'evolution-cms/evolution' => array( - 'pretty_version' => '3.5.8', - 'version' => '3.5.8.0', + 'pretty_version' => '3.5.9', + 'version' => '3.5.9.0', 'reference' => null, 'type' => 'project', 'install_path' => __DIR__ . '/../../', @@ -566,9 +566,9 @@ ), ), 'nesbot/carbon' => array( - 'pretty_version' => '3.13.2', - 'version' => '3.13.2.0', - 'reference' => 'a1c54919f5fff9800cd03c32bd01defd5a4061cb', + 'pretty_version' => '3.14.0', + 'version' => '3.14.0.0', + 'reference' => '0023eaa2c9110e47446dd512a263c69c40cd41f2', 'type' => 'library', 'install_path' => __DIR__ . '/../nesbot/carbon', 'aliases' => array(), @@ -602,9 +602,9 @@ 'dev_requirement' => false, ), 'predis/predis' => array( - 'pretty_version' => 'v3.6.0', - 'version' => '3.6.0.0', - 'reference' => '2ff20c08bb63697245ffee3f198d1673086c302d', + 'pretty_version' => 'v3.6.1', + 'version' => '3.6.1.0', + 'reference' => 'e2db96312ecf57a01a3477bf192d1ebc0ad7e9fb', 'type' => 'library', 'install_path' => __DIR__ . '/../predis/predis', 'aliases' => array(), @@ -759,9 +759,9 @@ 'dev_requirement' => false, ), 'ramsey/uuid' => array( - 'pretty_version' => '4.9.3', - 'version' => '4.9.3.0', - 'reference' => '1df15849d00943a67d677dc9cfd80795f038c9f8', + 'pretty_version' => '4.9.4', + 'version' => '4.9.4.0', + 'reference' => '75d73f48d02797c2c285a7e9f348fadc0102ffe2', 'type' => 'library', 'install_path' => __DIR__ . '/../ramsey/uuid', 'aliases' => array(), @@ -779,7 +779,7 @@ 'rhumsaa/uuid' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '4.9.3', + 0 => '4.9.4', ), ), 'rosell-dk/exec-with-fallback' => array( @@ -897,9 +897,9 @@ 'dev_requirement' => false, ), 'symfony/console' => array( - 'pretty_version' => 'v7.4.18', - 'version' => '7.4.18.0', - 'reference' => '23d6f88a29f6d0eac45bd77d70307adf83ba7ab0', + 'pretty_version' => 'v7.4.19', + 'version' => '7.4.19.0', + 'reference' => '3a1973458b153f566a8d7499bc06ece323d60063', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/console', 'aliases' => array(), @@ -957,36 +957,36 @@ 'dev_requirement' => false, ), 'symfony/finder' => array( - 'pretty_version' => 'v7.4.17', - 'version' => '7.4.17.0', - 'reference' => '5ce28827081f6d1f0c32eaf3882750f19cb5bbe6', + 'pretty_version' => 'v7.4.19', + 'version' => '7.4.19.0', + 'reference' => '1b900bc6ae5ba60c5eee69c11ba44566190576fe', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/finder', 'aliases' => array(), 'dev_requirement' => false, ), 'symfony/http-foundation' => array( - 'pretty_version' => 'v7.4.18', - 'version' => '7.4.18.0', - 'reference' => 'd070b716a32fbe3bf04204db0f58ace73b86d133', + 'pretty_version' => 'v7.4.19', + 'version' => '7.4.19.0', + 'reference' => 'f7b953be7801974a5a0685e1228bbc3b12b35936', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/http-foundation', 'aliases' => array(), 'dev_requirement' => false, ), 'symfony/http-kernel' => array( - 'pretty_version' => 'v7.4.18', - 'version' => '7.4.18.0', - 'reference' => '275d2d2d24530f2a0eaf17704a3a93860a036351', + 'pretty_version' => 'v7.4.19', + 'version' => '7.4.19.0', + 'reference' => '683507424cc84ca85ac1551adb609b6b98216667', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/http-kernel', 'aliases' => array(), 'dev_requirement' => false, ), 'symfony/mime' => array( - 'pretty_version' => 'v7.4.18', - 'version' => '7.4.18.0', - 'reference' => 'bf328d82105831db3e409195db0540ff57f27c80', + 'pretty_version' => 'v7.4.19', + 'version' => '7.4.19.0', + 'reference' => 'f8ac7d0a800bcabbcd1f7de56594cf05e6cd5693', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/mime', 'aliases' => array(), @@ -1086,9 +1086,9 @@ 'dev_requirement' => false, ), 'symfony/process' => array( - 'pretty_version' => 'v7.4.18', - 'version' => '7.4.18.0', - 'reference' => '058d17fc284cce14efb2385783b55014a461b176', + 'pretty_version' => 'v7.4.19', + 'version' => '7.4.19.0', + 'reference' => 'ed0ae095b86994d370d5791612e55984f15aa30e', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/process', 'aliases' => array(), @@ -1113,9 +1113,9 @@ 'dev_requirement' => false, ), 'symfony/string' => array( - 'pretty_version' => 'v7.4.15', - 'version' => '7.4.15.0', - 'reference' => 'e394af32256bf9e7bf80849d95e589167c10097b', + 'pretty_version' => 'v7.4.19', + 'version' => '7.4.19.0', + 'reference' => '02731ce2bd26514bec9efc0baef2cd0b0cf67f46', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/string', 'aliases' => array(), diff --git a/core/vendor/doctrine/lexer/SECURITY.md b/core/vendor/doctrine/lexer/SECURITY.md new file mode 100644 index 0000000000..4b4deb1137 --- /dev/null +++ b/core/vendor/doctrine/lexer/SECURITY.md @@ -0,0 +1,7 @@ +# Security + +If you find a Security bug in Doctrine, please follow our +[Security reporting guidelines](https://www.doctrine-project.org/policies/security.html#reporting). + +Security vulnerabilities should be reported to security@doctrine-project.org +and not posted on the GitHub issue tracker of the project. diff --git a/core/vendor/doctrine/lexer/composer.json b/core/vendor/doctrine/lexer/composer.json index 995dafa0d8..811f1041d9 100644 --- a/core/vendor/doctrine/lexer/composer.json +++ b/core/vendor/doctrine/lexer/composer.json @@ -29,11 +29,9 @@ "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^12", - "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^10.5", - "psalm/plugin-phpunit": "^0.18.3", - "vimeo/psalm": "^5.21" + "doctrine/coding-standard": "^14", + "phpstan/phpstan": "^2", + "phpunit/phpunit": "^10.5.58 || ^12.5.4" }, "autoload": { "psr-4": { diff --git a/core/vendor/doctrine/lexer/src/AbstractLexer.php b/core/vendor/doctrine/lexer/src/AbstractLexer.php index 2436885e48..260ace4780 100644 --- a/core/vendor/doctrine/lexer/src/AbstractLexer.php +++ b/core/vendor/doctrine/lexer/src/AbstractLexer.php @@ -20,7 +20,7 @@ * Base class for writing simple lexers, i.e. for creating small DSLs. * * @template T of UnitEnum|string|int - * @template V of string|int + * @template V of string|int|float|bool */ abstract class AbstractLexer { @@ -138,7 +138,7 @@ public function getInputUntilPosition(int $position) * * @return bool * - * @psalm-assert-if-true !=null $this->lookahead + * @phpstan-assert-if-true !=null $this->lookahead */ public function isNextToken(int|string|UnitEnum $type) { @@ -152,7 +152,7 @@ public function isNextToken(int|string|UnitEnum $type) * * @return bool * - * @psalm-assert-if-true !=null $this->lookahead + * @phpstan-assert-if-true !=null $this->lookahead */ public function isNextTokenAny(array $types) { @@ -164,7 +164,8 @@ public function isNextTokenAny(array $types) * * @return bool * - * @psalm-assert-if-true !null $this->lookahead + * @phpstan-impure + * @phpstan-assert-if-true !null $this->lookahead */ public function moveNext() { @@ -218,6 +219,8 @@ public function peek() * Peeks at the next token, returns it and immediately resets the peek. * * @return Token|null The next token or NULL if there are no more tokens ahead. + * + * @phpstan-impure */ public function glimpse() { diff --git a/core/vendor/doctrine/lexer/src/Token.php b/core/vendor/doctrine/lexer/src/Token.php index b6df694653..df09918089 100644 --- a/core/vendor/doctrine/lexer/src/Token.php +++ b/core/vendor/doctrine/lexer/src/Token.php @@ -10,7 +10,7 @@ /** * @template T of UnitEnum|string|int - * @template V of string|int + * @template-covariant V of string|int|float|bool */ final class Token { @@ -20,7 +20,7 @@ final class Token * @readonly * @var V */ - public string|int $value; + public string|int|float|bool $value; /** * The type of the token (identifier, numeric, string, input parameter, none) @@ -41,7 +41,7 @@ final class Token * @param V $value * @param T|null $type */ - public function __construct(string|int $value, $type, int $position) + public function __construct(string|int|float|bool $value, $type, int $position) { $this->value = $value; $this->type = $type; diff --git a/core/vendor/nesbot/carbon/readme.md b/core/vendor/nesbot/carbon/readme.md index eda7a87d47..e0ddbb2ff4 100644 --- a/core/vendor/nesbot/carbon/readme.md +++ b/core/vendor/nesbot/carbon/readme.md @@ -138,74 +138,64 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
              - - - - - - - - - -
              Best non Gamstop sites in the UK CasinoHex Canada
              Transparencia en Casinos Online
              See more - - + + + - - - + + - - - - + + - - - + + + + + - + + + - - - - + + - - + - + - - + - + + + diff --git a/core/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php b/core/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php index 0b407fb8ca..47e93293c5 100644 --- a/core/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php +++ b/core/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php @@ -21,6 +21,7 @@ use Carbon\Exceptions\InvalidPeriodParameterException; use Carbon\Exceptions\NotACarbonClassException; use Carbon\Exceptions\NotAPeriodException; +use Carbon\Exceptions\PeriodFilterSafetyException; use Carbon\Exceptions\UnknownGetterException; use Carbon\Exceptions\UnknownMethodException; use Carbon\Exceptions\UnreachableException; @@ -940,9 +941,7 @@ public function clone() */ public function setDateClass(string $dateClass) { - if (!is_a($dateClass, CarbonInterface::class, true)) { - throw new NotACarbonClassException($dateClass); - } + NotACarbonClassException::expectCarbonInterface($dateClass); $self = $this->copyIfImmutable(); $self->dateClass = $dateClass; @@ -2386,6 +2385,36 @@ public function __unserialize(array $data): void $data, ); + if (isset($values['dateClass'])) { + NotACarbonClassException::expectCarbonInterface($values['dateClass']); + } + + if ( + isset($values['filters']) + // Non-array filters are not an issue as they will be rejected before being read with: + // Cannot assign X to property Carbon\CarbonPeriod::$filters of type array + && \is_array($values['filters']) + && PeriodFilterSafetyException::isDetectionEnabled() + ) { + foreach ($values['filters'] as $tuple) { + if (\is_array($tuple[0])) { + $subject = $tuple[0][0]; + + if ( + is_a($subject, DatePeriod::class, true) + || is_a($subject, DateInterval::class, true) + || is_a($subject, DateTimeInterface::class, true) + ) { + continue; + } + + throw new PeriodFilterSafetyException('filters not referring to date method'); + } + + throw new PeriodFilterSafetyException('custom filters'); + } + } + $this->initializeSerialization($values); foreach ($values as $key => $value) { @@ -2443,7 +2472,11 @@ public function __unserialize(array $data): void } } catch (Throwable $e) { // @codeCoverageIgnoreStart - if (!method_exists(parent::class, '__unserialize')) { + if ( + $e instanceof PeriodFilterSafetyException + || $e instanceof NotACarbonClassException + || !method_exists(parent::class, '__unserialize') + ) { throw $e; } diff --git a/core/vendor/nesbot/carbon/src/Carbon/Exceptions/NotACarbonClassException.php b/core/vendor/nesbot/carbon/src/Carbon/Exceptions/NotACarbonClassException.php index fcc0c2c081..1491332e4a 100644 --- a/core/vendor/nesbot/carbon/src/Carbon/Exceptions/NotACarbonClassException.php +++ b/core/vendor/nesbot/carbon/src/Carbon/Exceptions/NotACarbonClassException.php @@ -14,11 +14,14 @@ namespace Carbon\Exceptions; use Carbon\CarbonInterface; +use Carbon\Traits\TogglableDetection; use InvalidArgumentException as BaseInvalidArgumentException; use Throwable; class NotACarbonClassException extends BaseInvalidArgumentException implements InvalidArgumentException { + use TogglableDetection; + /** * The className. * @@ -37,11 +40,33 @@ public function __construct($className, $code = 0, ?Throwable $previous = null) { $this->className = $className; - parent::__construct(\sprintf( - 'Given class does not implement %s: %s', - CarbonInterface::class, - $className, - ), $code, $previous); + parent::__construct( + \sprintf( + 'Given class does not implement %s: %s', + CarbonInterface::class, + $className, + )."\nBehavior can be unpredictable and unsecure ". + "(in particular if you are unserializing data from a source you can't fully trust)\n". + "But if you're sure you want to allow it use \$result = ". + 'NotACarbonClassException::allow(static fn () => ...)', + $code, + $previous, + ); + } + + public static function expectCarbonInterface(mixed $className): void + { + if (!self::$detectionEnabled) { + return; + } + + if (!\is_string($className)) { + throw new self(\gettype($className)); + } + + if (!is_a($className, CarbonInterface::class, true)) { + throw new self($className); + } } /** diff --git a/core/vendor/nesbot/carbon/src/Carbon/Exceptions/PeriodFilterSafetyException.php b/core/vendor/nesbot/carbon/src/Carbon/Exceptions/PeriodFilterSafetyException.php new file mode 100644 index 0000000000..95ffa1fd25 --- /dev/null +++ b/core/vendor/nesbot/carbon/src/Carbon/Exceptions/PeriodFilterSafetyException.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use Carbon\Traits\TogglableDetection; +use RuntimeException as BaseRuntimeException; +use Throwable; + +final class PeriodFilterSafetyException extends BaseRuntimeException implements RuntimeException +{ + use TogglableDetection; + + public function __construct( + public string $disallowedFilter, + int $code = 0, + ?Throwable $previous = null, + ) { + parent::__construct( + "For safety reason, unserializing CarbonPeriod objects with $disallowedFilter is disallowed.\n". + "If your serialized string is fully safe and you're sure you want to allow them, wrap the unseritalization". + ' into $result = PeriodFilterSafetyException::allow(static fn () => unserialize($data))', + $code, + $previous, + ); + } +} diff --git a/core/vendor/nesbot/carbon/src/Carbon/Factory.php b/core/vendor/nesbot/carbon/src/Carbon/Factory.php index b6058ee65c..e2408bd71f 100644 --- a/core/vendor/nesbot/carbon/src/Carbon/Factory.php +++ b/core/vendor/nesbot/carbon/src/Carbon/Factory.php @@ -815,20 +815,41 @@ protected function getMockedTestNow(DateTimeZone|string|int|null $timezone): ?Ca */ private function matchFormatPattern(string $date, string $format, array $replacements): bool { + // Null bytes would collide with the fragment sentinels used below. + $format = str_replace("\0", '', $format); // Preg quote, but remove escaped backslashes since we'll deal with escaped characters in the format string. $regex = str_replace('\\\\', '\\', $format); - // Replace not-escaped letters + // Replace not-escaped letters, wrapping each generated fragment between + // null-byte sentinels so the generic quoting below leaves them intact. $regex = preg_replace_callback( '/(? $match[1].strtr($match[2], $replacements), + static fn ($match) => "\0".$match[1].strtr($match[2], $replacements)."\0", $regex, ); // Replace escaped letters by the letter itself $regex = preg_replace('/(? $chunk) { + if ($index % 2) { + continue; + } + + // Quote every character that did not come from a format token: + // backslash escapes resolve to their quoted literal target, any + // other byte (including dangling backslashes) is quoted as-is. + $chunks[$index] = preg_replace_callback( + '/\\\\.|./s', + static fn ($match) => preg_quote( + $match[0][0] === '\\' && isset($match[0][1]) ? $match[0][1] : $match[0], + '/', + ), + $chunk, + ); + } + + return (bool) @preg_match('/^'.implode('', $chunks).'$/', $date); } private function setDefaultTimezone(string $timezone, ?DateTimeInterface $date = null): void diff --git a/core/vendor/nesbot/carbon/src/Carbon/Lang/yo.php b/core/vendor/nesbot/carbon/src/Carbon/Lang/yo.php index 0a829810a9..7c688a07cf 100644 --- a/core/vendor/nesbot/carbon/src/Carbon/Lang/yo.php +++ b/core/vendor/nesbot/carbon/src/Carbon/Lang/yo.php @@ -27,7 +27,7 @@ 'a_hour' => '{1}wákati kan|wákati :count', 'minute' => 'ìsẹjú :count', 'a_minute' => '{1}ìsẹjú kan|ìsẹjú :count', - 'second' => 'iaayá :count', + 'second' => 'aayá :count', 'a_second' => '{1}ìsẹjú aayá die|aayá :count', 'ago' => ':time kọjá', 'from_now' => 'ní :time', diff --git a/core/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php b/core/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php index 09852eba3b..7c54ddc6ee 100644 --- a/core/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php +++ b/core/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php @@ -102,7 +102,7 @@ public function __construct( throw new InvalidFormatException($exception->getMessage(), 0, $exception); } - $this->constructedObjectId = spl_object_hash($this); + $this->constructedObjectId = spl_object_id($this); self::setLastErrors(parent::getLastErrors()); } @@ -134,7 +134,7 @@ private function constructTimezoneFromDateTime( */ public function __clone(): void { - $this->constructedObjectId = spl_object_hash($this); + $this->constructedObjectId = spl_object_id($this); } /** diff --git a/core/vendor/nesbot/carbon/src/Carbon/Traits/Date.php b/core/vendor/nesbot/carbon/src/Carbon/Traits/Date.php index 782145b83a..27d5041688 100644 --- a/core/vendor/nesbot/carbon/src/Carbon/Traits/Date.php +++ b/core/vendor/nesbot/carbon/src/Carbon/Traits/Date.php @@ -1382,7 +1382,7 @@ public function __isset($name) */ public function __set($name, $value) { - if ($this->constructedObjectId === spl_object_hash($this)) { + if ($this->constructedObjectId === spl_object_id($this)) { if ($this->isImmutable()) { throw ImmutableException::fromClass(static::class); } @@ -2361,6 +2361,8 @@ public static function getFormatsToIsoReplacements(): array 't' => true, 'L' => true, 'o' => true, + 'X' => true, + 'x' => true, 'Y' => true, 'y' => true, 'a' => 'a', @@ -2375,9 +2377,11 @@ public static function getFormatsToIsoReplacements(): array 'u' => true, 'v' => true, 'E' => true, + 'e' => true, 'I' => true, 'O' => true, 'P' => true, + 'p' => true, 'Z' => true, 'c' => true, 'r' => true, diff --git a/core/vendor/nesbot/carbon/src/Carbon/Traits/Mixin.php b/core/vendor/nesbot/carbon/src/Carbon/Traits/Mixin.php index c930ca5c69..81d7e4118a 100644 --- a/core/vendor/nesbot/carbon/src/Carbon/Traits/Mixin.php +++ b/core/vendor/nesbot/carbon/src/Carbon/Traits/Mixin.php @@ -84,7 +84,7 @@ private static function loadMixinClass(object|string $mixin): void continue; } - $macro = $method->invoke($mixin); + $macro = $method->invoke($method->isStatic() ? null : $mixin); if (\is_callable($macro)) { static::macro($method->name, $macro); diff --git a/core/vendor/nesbot/carbon/src/Carbon/Traits/ObjectInitialisation.php b/core/vendor/nesbot/carbon/src/Carbon/Traits/ObjectInitialisation.php index 463a74db17..4b6e3d0352 100644 --- a/core/vendor/nesbot/carbon/src/Carbon/Traits/ObjectInitialisation.php +++ b/core/vendor/nesbot/carbon/src/Carbon/Traits/ObjectInitialisation.php @@ -18,7 +18,10 @@ trait ObjectInitialisation /** * True when parent::__construct has been called. * - * @var string + * Can be an int (starting from version 3.13.3, was a string in previous version, can come from unserializing + * objects serialized by an older version, but this property then get overwriten during __construct). + * + * @var string|int */ protected $constructedObjectId; } diff --git a/core/vendor/nesbot/carbon/src/Carbon/Traits/Serialization.php b/core/vendor/nesbot/carbon/src/Carbon/Traits/Serialization.php index 560a1693eb..0a129f9993 100644 --- a/core/vendor/nesbot/carbon/src/Carbon/Traits/Serialization.php +++ b/core/vendor/nesbot/carbon/src/Carbon/Traits/Serialization.php @@ -73,7 +73,18 @@ public function serialize(): string /** * Create an instance from a serialized string. * - * If $value is not from a trusted source, consider using the allowed_classes option to limit + * Unserializing object can lead to arbitrary execution of period filters, and assignation + * of unvalidated values to properties. + * + * You should never unserialize a value from not from a trusted source. Ensure you unserialize + * only strings coming from storage no unauthorized party can read nor write, prefer to exchange + * data with other systems via static formats such as JSON. + * + * If the data has to transit via untrusted systems before unserialization, then you should + * sign it cryptographically (with HMAC or OpenSSL for example), and verify the signature + * before unserializing it. + * + * If the content of $value is unknown, consider using the allowed_classes option to limit * the types of objects that can be built, for instance: * * @example diff --git a/core/vendor/nesbot/carbon/src/Carbon/Traits/TogglableDetection.php b/core/vendor/nesbot/carbon/src/Carbon/Traits/TogglableDetection.php new file mode 100644 index 0000000000..89fe8f5434 --- /dev/null +++ b/core/vendor/nesbot/carbon/src/Carbon/Traits/TogglableDetection.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +trait TogglableDetection +{ + private static bool $detectionEnabled = true; + + public static function isDetectionEnabled(): bool + { + return self::$detectionEnabled; + } + + public static function allow(callable $action): mixed + { + self::$detectionEnabled = false; + + try { + return $action(); + } finally { + self::$detectionEnabled = true; + } + } +} diff --git a/core/vendor/nesbot/carbon/src/Carbon/Traits/Units.php b/core/vendor/nesbot/carbon/src/Carbon/Traits/Units.php index 9ce35338b8..c61921c26e 100644 --- a/core/vendor/nesbot/carbon/src/Carbon/Traits/Units.php +++ b/core/vendor/nesbot/carbon/src/Carbon/Traits/Units.php @@ -161,7 +161,7 @@ public function addUTCUnit(string $unit, $value = 1): static $seconds = (int) $value; $microseconds = (int) round( - (abs($value) - abs($seconds)) * ($value < 0 ? -1 : 1) * static::MICROSECONDS_PER_SECOND, + (abs((float) $value) - abs($seconds)) * ($value < 0 ? -1 : 1) * static::MICROSECONDS_PER_SECOND, ); $date = $this->setTimestamp($this->getTimestamp() + $seconds); diff --git a/core/vendor/predis/predis/src/Client.php b/core/vendor/predis/predis/src/Client.php index c7c41275df..c0aa3117cc 100644 --- a/core/vendor/predis/predis/src/Client.php +++ b/core/vendor/predis/predis/src/Client.php @@ -56,7 +56,7 @@ */ class Client implements ClientInterface, IteratorAggregate { - public const VERSION = '3.6.0'; + public const VERSION = '3.6.1'; /** @var OptionsInterface */ private $options; diff --git a/core/vendor/predis/predis/src/Command/Command.php b/core/vendor/predis/predis/src/Command/Command.php index 5040147478..03f81e006f 100644 --- a/core/vendor/predis/predis/src/Command/Command.php +++ b/core/vendor/predis/predis/src/Command/Command.php @@ -158,15 +158,14 @@ public function serializeCommand(): string /** * {@inheritDoc} + * + * @deprecated Not binary-safe; see CommandInterface::deserializeCommand(). + * Scheduled for removal in the next major. */ public static function deserializeCommand(string $serializedCommand): CommandInterface { - if ($serializedCommand[0] !== '*') { - throw new UnexpectedValueException('Invalid serializing format'); - } - - $commandArray = explode("\r\n", $serializedCommand); - $commandId = $commandArray[2]; + $items = self::parseMultibulk($serializedCommand); + $commandId = $items[0]; $classPath = __NAMESPACE__ . '\Redis\\'; // Check if given command is a module command. @@ -186,15 +185,53 @@ static function ($module) use ($commandIdArray) { } $command = new $classPath(); - $arguments = []; + $command->setArguments(array_slice($items, 1)); + + return $command; + } + + /** + * Parses a RESP multibulk buffer into its individual bulk-string values + * (command ID followed by its arguments), walking each string by its own + * declared byte length instead of splitting the buffer on "\r\n" -- which + * a bulk string's payload may legitimately contain (see GHSA-w6f5-v2h6-g786). + * + * @param string $buffer + * @return string[] + */ + private static function parseMultibulk(string $buffer): array + { + if ($buffer[0] !== '*') { + throw new UnexpectedValueException('Invalid serializing format'); + } - for ($i = 4, $iMax = count($commandArray); $i < $iMax; $i++) { - $arguments[] = $commandArray[$i]; - ++$i; + $lineEnd = strpos($buffer, "\r\n"); + + if ($lineEnd === false) { + throw new UnexpectedValueException('Invalid serializing format'); } - $command->setArguments($arguments); + $count = (int) substr($buffer, 1, $lineEnd - 1); + $offset = $lineEnd + 2; + $items = []; - return $command; + for ($i = 0; $i < $count; ++$i) { + if (($buffer[$offset] ?? '') !== '$') { + throw new UnexpectedValueException('Invalid serializing format'); + } + + $lineEnd = strpos($buffer, "\r\n", $offset); + + if ($lineEnd === false) { + throw new UnexpectedValueException('Invalid serializing format'); + } + + $bulkLen = (int) substr($buffer, $offset + 1, $lineEnd - $offset - 1); + $dataStart = $lineEnd + 2; + $items[] = substr($buffer, $dataStart, $bulkLen); + $offset = $dataStart + $bulkLen + 2; + } + + return $items; } } diff --git a/core/vendor/predis/predis/src/Command/CommandInterface.php b/core/vendor/predis/predis/src/Command/CommandInterface.php index dd91082d38..915b90bc24 100644 --- a/core/vendor/predis/predis/src/Command/CommandInterface.php +++ b/core/vendor/predis/predis/src/Command/CommandInterface.php @@ -98,6 +98,12 @@ public function serializeCommand(): string; * * @param string $serializedCommand * @return static + * + * @deprecated Not binary-safe: it re-parses on "\r\n" and ignores RESP bulk-length + * prefixes, so any argument containing "\r\n" is corrupted, and it + * instantiates a command class from the parsed input. Never call it on + * untrusted or serialized data (see CVE GHSA-w6f5-v2h6-g786). Scheduled + * for removal in the next major. */ public static function deserializeCommand(string $serializedCommand): CommandInterface; } diff --git a/core/vendor/predis/predis/src/Command/RawCommand.php b/core/vendor/predis/predis/src/Command/RawCommand.php index 88893bf1be..ad8586001e 100644 --- a/core/vendor/predis/predis/src/Command/RawCommand.php +++ b/core/vendor/predis/predis/src/Command/RawCommand.php @@ -153,14 +153,16 @@ public function serializeCommand(): string return $buffer; } + /** + * {@inheritDoc} + * + * @deprecated Not binary-safe; see CommandInterface::deserializeCommand(). + * Scheduled for removal in the next major. + */ public static function deserializeCommand(string $serializedCommand): CommandInterface { - if ($serializedCommand[0] !== '*') { - throw new UnexpectedValueException('Invalid serializing format'); - } - - $commandArray = explode("\r\n", $serializedCommand); - $commandId = $commandArray[2]; + $items = self::parseMultibulk($serializedCommand); + $commandId = $items[0]; $classPath = __NAMESPACE__ . '\Redis\\'; // Check if given command is a module command. @@ -180,15 +182,53 @@ static function ($module) use ($commandIdArray) { } $command = new $classPath(); - $arguments = []; + $command->setArguments(array_slice($items, 1)); - for ($i = 4, $iMax = count($commandArray); $i < $iMax; $i++) { - $arguments[] = $commandArray[$i]; - ++$i; + return $command; + } + + /** + * Parses a RESP multibulk buffer into its individual bulk-string values + * (command ID followed by its arguments), walking each string by its own + * declared byte length instead of splitting the buffer on "\r\n" -- which + * a bulk string's payload may legitimately contain (see GHSA-w6f5-v2h6-g786). + * + * @param string $buffer + * @return string[] + */ + private static function parseMultibulk(string $buffer): array + { + if ($buffer[0] !== '*') { + throw new UnexpectedValueException('Invalid serializing format'); } - $command->setArguments($arguments); + $lineEnd = strpos($buffer, "\r\n"); - return $command; + if ($lineEnd === false) { + throw new UnexpectedValueException('Invalid serializing format'); + } + + $count = (int) substr($buffer, 1, $lineEnd - 1); + $offset = $lineEnd + 2; + $items = []; + + for ($i = 0; $i < $count; ++$i) { + if (($buffer[$offset] ?? '') !== '$') { + throw new UnexpectedValueException('Invalid serializing format'); + } + + $lineEnd = strpos($buffer, "\r\n", $offset); + + if ($lineEnd === false) { + throw new UnexpectedValueException('Invalid serializing format'); + } + + $bulkLen = (int) substr($buffer, $offset + 1, $lineEnd - $offset - 1); + $dataStart = $lineEnd + 2; + $items[] = substr($buffer, $dataStart, $bulkLen); + $offset = $dataStart + $bulkLen + 2; + } + + return $items; } } diff --git a/core/vendor/predis/predis/src/Connection/AbstractAggregateConnection.php b/core/vendor/predis/predis/src/Connection/AbstractAggregateConnection.php index 2658682893..58009d1dbe 100644 --- a/core/vendor/predis/predis/src/Connection/AbstractAggregateConnection.php +++ b/core/vendor/predis/predis/src/Connection/AbstractAggregateConnection.php @@ -77,17 +77,25 @@ abstract public function getParameters(); */ public function write(string $buffer): void { - $rawCommands = []; - $explodedBuffer = explode("\r\n", trim($buffer)); - - while (!empty($explodedBuffer)) { - $argsLen = (int) explode('*', $explodedBuffer[0])[1]; - $cmdLen = ($argsLen * 2) + 1; - $rawCommands[] = array_splice($explodedBuffer, 0, $cmdLen); - } - - foreach ($rawCommands as $command) { - $command = implode("\r\n", $command) . "\r\n"; + $offset = 0; + $length = strlen($buffer); + + while ($offset < $length) { + $start = $offset; + $lineEnd = strpos($buffer, "\r\n", $offset); + $argsCount = (int) substr($buffer, $offset + 1, $lineEnd - $offset - 1); + $offset = $lineEnd + 2; + + // Advance by each bulk string's own declared byte length rather than + // splitting on literal "\r\n", which a bulk string's value may legitimately + // contain (see GHSA-w6f5-v2h6-g786). + for ($i = 0; $i < $argsCount; ++$i) { + $lineEnd = strpos($buffer, "\r\n", $offset); + $bulkLen = (int) substr($buffer, $offset + 1, $lineEnd - $offset - 1); + $offset = $lineEnd + 2 + $bulkLen + 2; + } + + $command = substr($buffer, $start, $offset - $start); $commandObj = Command::deserializeCommand($command); $this->getConnectionByCommand($commandObj)->write($command); } diff --git a/core/vendor/predis/predis/src/Connection/Factory.php b/core/vendor/predis/predis/src/Connection/Factory.php index 5f1f568c06..c9c44b7c25 100644 --- a/core/vendor/predis/predis/src/Connection/Factory.php +++ b/core/vendor/predis/predis/src/Connection/Factory.php @@ -208,13 +208,15 @@ protected function prepareConnection(NodeConnectionInterface $connection) ); } - $connection->addConnectCommand( - new RawCommand('CLIENT', ['SETINFO', 'LIB-NAME', $this->buildLibraryName()]) - ); + if ($parameters->client_info ?? true) { + $connection->addConnectCommand( + new RawCommand('CLIENT', ['SETINFO', 'LIB-NAME', $this->buildLibraryName()]) + ); - $connection->addConnectCommand( - new RawCommand('CLIENT', ['SETINFO', 'LIB-VER', Client::VERSION]) - ); + $connection->addConnectCommand( + new RawCommand('CLIENT', ['SETINFO', 'LIB-VER', Client::VERSION]) + ); + } if (isset($parameters->database) && strlen($parameters->database)) { $connection->addConnectCommand( diff --git a/core/vendor/predis/predis/src/Connection/ParametersInterface.php b/core/vendor/predis/predis/src/Connection/ParametersInterface.php index 521418f110..7cbe634392 100644 --- a/core/vendor/predis/predis/src/Connection/ParametersInterface.php +++ b/core/vendor/predis/predis/src/Connection/ParametersInterface.php @@ -36,7 +36,7 @@ * @property string $database Database index (see the SELECT command). * @property bool $async_connect Performs the connect() operation asynchronously. * @property bool $tcp_nodelay Toggles the Nagle's algorithm for coalescing. - * @property bool $client_info Whether to set LIB-NAME and LIB-VER when connecting. + * @property bool $client_info Whether to set LIB-NAME and LIB-VER when connecting, enabled by default. * @property Retry $retry Retry configuration * @property bool $cache (Relay only) Whether to use in-memory caching. * @property string $serializer (Relay only) Serializer used for data serialization. diff --git a/core/vendor/predis/predis/src/Connection/Resource/Stream.php b/core/vendor/predis/predis/src/Connection/Resource/Stream.php index 36a504fdd9..1448dbd998 100644 --- a/core/vendor/predis/predis/src/Connection/Resource/Stream.php +++ b/core/vendor/predis/predis/src/Connection/Resource/Stream.php @@ -205,7 +205,10 @@ public function write(string $string): int throw new RuntimeException('Cannot write to a non-writable stream'); } - $result = fwrite($this->stream, $string); + // Suppressed: some error handlers (Laravel, Symfony, Laminas) convert engine + // notices/warnings into thrown exceptions, which would otherwise bypass the + // return-value handling below and leave a dead connection looking "connected". + $result = @fwrite($this->stream, $string); if ($result === false || $result === 0) { $metadata = $this->getMetadata(); @@ -265,10 +268,11 @@ public function read(int $length): string return ''; } + // Suppressed: see the note in write() above. if ($length === -1) { - $string = fgets($this->stream); + $string = @fgets($this->stream); } else { - $string = fread($this->stream, $length); + $string = @fread($this->stream, $length); } if (false === $string) { diff --git a/core/vendor/predis/predis/src/Protocol/Parser/Strategy/Resp3Strategy.php b/core/vendor/predis/predis/src/Protocol/Parser/Strategy/Resp3Strategy.php index 83a2bfe6c2..7549986a57 100644 --- a/core/vendor/predis/predis/src/Protocol/Parser/Strategy/Resp3Strategy.php +++ b/core/vendor/predis/predis/src/Protocol/Parser/Strategy/Resp3Strategy.php @@ -63,10 +63,14 @@ protected function parseNull(string $string) */ protected function parseDouble(string $string): float { - if ($string === 'inf' || $string === '-inf') { + if ($string === 'inf') { return INF; } + if ($string === '-inf') { + return -INF; + } + return (float) $string; } diff --git a/core/vendor/ramsey/uuid/composer.json b/core/vendor/ramsey/uuid/composer.json index 8bcb745e5e..9bd9d127f0 100644 --- a/core/vendor/ramsey/uuid/composer.json +++ b/core/vendor/ramsey/uuid/composer.json @@ -10,7 +10,7 @@ ], "require": { "php": "^8.0", - "brick/math": ">=0.8.16 <=0.18", + "brick/math": "^0.8.16 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13 || ^0.14 || ^0.15 || ^0.16 || ^0.17 || ^0.18 || ^0.19 || ^0.20 || ^1.0", "ramsey/collection": "^1.2 || ^2.0" }, "require-dev": { diff --git a/core/vendor/symfony/console/Attribute/Argument.php b/core/vendor/symfony/console/Attribute/Argument.php index 33b7a86b2f..7c5ba2029c 100644 --- a/core/vendor/symfony/console/Attribute/Argument.php +++ b/core/vendor/symfony/console/Attribute/Argument.php @@ -126,6 +126,10 @@ public function resolveValue(InputInterface $input): mixed return $this->typeName::tryFrom($value) ?? throw InvalidArgumentException::fromEnumValue($this->name, $value, $this->suggestedValues); } + if (\is_string($value) && \in_array($this->typeName, ['int', 'float'], true) && !is_numeric($value)) { + throw InvalidArgumentException::fromInvalidType($this->name, $value, $this->typeName); + } + return $value; } diff --git a/core/vendor/symfony/console/Attribute/Option.php b/core/vendor/symfony/console/Attribute/Option.php index 5f0f47610b..d1dbe48a98 100644 --- a/core/vendor/symfony/console/Attribute/Option.php +++ b/core/vendor/symfony/console/Attribute/Option.php @@ -153,6 +153,10 @@ public function resolveValue(InputInterface $input): mixed return $this->typeName::tryFrom($value) ?? throw InvalidOptionException::fromEnumValue($this->name, $value, $this->suggestedValues); } + if (\is_string($value) && \in_array($this->typeName, ['int', 'float'], true) && !is_numeric($value)) { + throw InvalidOptionException::fromInvalidType($this->name, $value, $this->typeName); + } + if ('array' === $this->typeName && $this->allowNull && [] === $value) { return null; } diff --git a/core/vendor/symfony/console/Exception/InvalidArgumentException.php b/core/vendor/symfony/console/Exception/InvalidArgumentException.php index 0482244f20..c81eb3aae8 100644 --- a/core/vendor/symfony/console/Exception/InvalidArgumentException.php +++ b/core/vendor/symfony/console/Exception/InvalidArgumentException.php @@ -29,4 +29,12 @@ public static function fromEnumValue(string $name, string $value, array|\Closure return new self($error); } + + /** + * @internal + */ + public static function fromInvalidType(string $name, string $value, string $type): self + { + return new self(\sprintf('The value "%s" is not valid for the "%s" argument. Expected a value of type "%s".', $value, $name, $type)); + } } diff --git a/core/vendor/symfony/console/Exception/InvalidOptionException.php b/core/vendor/symfony/console/Exception/InvalidOptionException.php index e59167df12..0d8bac3b70 100644 --- a/core/vendor/symfony/console/Exception/InvalidOptionException.php +++ b/core/vendor/symfony/console/Exception/InvalidOptionException.php @@ -31,4 +31,12 @@ public static function fromEnumValue(string $name, string $value, array|\Closure return new self($error); } + + /** + * @internal + */ + public static function fromInvalidType(string $name, string $value, string $type): self + { + return new self(\sprintf('The value "%s" is not valid for the "%s" option. Expected a value of type "%s".', $value, $name, $type)); + } } diff --git a/core/vendor/symfony/console/Helper/OutputWrapper.php b/core/vendor/symfony/console/Helper/OutputWrapper.php index a615ed2f92..1e3ac908db 100644 --- a/core/vendor/symfony/console/Helper/OutputWrapper.php +++ b/core/vendor/symfony/console/Helper/OutputWrapper.php @@ -68,7 +68,10 @@ public function wrap(string $text, int $width, string $break = "\n"): string $patternBlocks[] = '.'; $blocks = implode('|', $patternBlocks); $rowPattern = "(?:$blocks)$limitPattern"; - $pattern = \sprintf('#(?:((?>(%1$s)((?<=[^\S\r\n])[^\S\r\n]?|(?=\r?\n)|$|[^\S\r\n]))|(%1$s))(?:\r?\n)?|(?:\r?\n|$))#imux', $rowPattern); + // the u modifier counts characters instead of bytes, but preg_replace() returns null + // on malformed UTF-8, which would empty the text + $modifiers = preg_match('//u', $text) ? 'imux' : 'imx'; + $pattern = \sprintf('#(?:((?>(%1$s)((?<=[^\S\r\n])[^\S\r\n]?|(?=\r?\n)|$|[^\S\r\n]))|(%1$s))(?:\r?\n)?|(?:\r?\n|$))#%2$s', $rowPattern, $modifiers); $output = rtrim(preg_replace($pattern, '\\1'.$break, $text), $break); return str_replace(' '.$break, $break, $output); diff --git a/core/vendor/symfony/console/Helper/QuestionHelper.php b/core/vendor/symfony/console/Helper/QuestionHelper.php index 149c9652fb..ea82acc188 100644 --- a/core/vendor/symfony/console/Helper/QuestionHelper.php +++ b/core/vendor/symfony/console/Helper/QuestionHelper.php @@ -234,8 +234,8 @@ protected function writeError(OutputInterface $output, \Exception $error): void /** * Autocompletes a question. * - * @param resource $inputStream - * @param callable(string):string[] $autocomplete + * @param resource $inputStream + * @param callable(string):list $autocomplete */ private function autocomplete(OutputInterface $output, Question $question, $inputStream, callable $autocomplete): string { diff --git a/core/vendor/symfony/console/Question/Question.php b/core/vendor/symfony/console/Question/Question.php index 000c891640..11254ae5b8 100644 --- a/core/vendor/symfony/console/Question/Question.php +++ b/core/vendor/symfony/console/Question/Question.php @@ -25,7 +25,7 @@ class Question private bool $hidden = false; private bool $hiddenFallback = true; /** - * @var (\Closure(string):string[])|null + * @var (\Closure(string):list)|null */ private ?\Closure $autocompleterCallback = null; /** @@ -192,7 +192,7 @@ public function setAutocompleterValues(?iterable $values): static /** * Gets the callback function used for the autocompleter. * - * @return (callable(string):string[])|null + * @return (callable(string):list)|null */ public function getAutocompleterCallback(): ?callable { @@ -202,9 +202,9 @@ public function getAutocompleterCallback(): ?callable /** * Sets the callback function used for the autocompleter. * - * The callback is passed the user input as argument and should return an iterable of corresponding suggestions. + * The callback is passed the user input as argument and must return a list of corresponding suggestions. * - * @param (callable(string):string[])|null $callback + * @param (callable(string):list)|null $callback * * @return $this */ diff --git a/core/vendor/symfony/console/Resources/completion.bash b/core/vendor/symfony/console/Resources/completion.bash index a32338e189..283c068ba1 100644 --- a/core/vendor/symfony/console/Resources/completion.bash +++ b/core/vendor/symfony/console/Resources/completion.bash @@ -16,27 +16,45 @@ _sf_{{ COMMAND_NAME }}() { fi done - # Use newline as only separator to allow space in completion values - local IFS=$'\n' local sf_cmd="${COMP_WORDS[0]}" + local sf_cmd_parts - # for an alias, get the real script behind it + # for an alias, get the real command behind it, which may carry arguments sf_cmd_type=$(type -t $sf_cmd) if [[ $sf_cmd_type == "alias" ]]; then sf_cmd=$(alias $sf_cmd | sed -E "s/alias $sf_cmd='(.*)'/\1/") + read -ra sf_cmd_parts <<< "$sf_cmd" elif [[ $sf_cmd_type == "file" ]]; then - sf_cmd=$(type -p $sf_cmd) + sf_cmd_parts=("$(type -p $sf_cmd)") + else + sf_cmd_parts=("$sf_cmd") + fi + + # the command must be a function, an executable of the PATH or an executable file + if [[ $sf_cmd_type != "function" ]] \ + && ! type -P "${sf_cmd_parts[0]}" > /dev/null \ + && [[ ! -x ${sf_cmd_parts[0]} ]] \ + ; then + return 1 fi - if [[ $sf_cmd_type != "function" && ! -x $sf_cmd ]]; then + # The bash-completion package provides the parsing of the current command line + if ! declare -F _get_comp_words_by_ref > /dev/null; then + >&2 echo "The completion of {{ COMMAND_NAME }} requires the \"bash-completion\" package to be installed and loaded." + return 1 fi + # this must run with the default IFS: bash-completion 1.x, still shipped on + # macOS, joins every word into a single one when IFS is a newline local cur prev words cword _get_comp_words_by_ref -n := cur prev words cword - local completecmd=("$sf_cmd" "_complete" "--no-interaction" "-sbash" "-c$cword" "-a{{ VERSION }}") - for w in ${words[@]}; do + # Use newline as only separator to allow space in completion values + local IFS=$'\n' + + local completecmd=("${sf_cmd_parts[@]}" "_complete" "--no-interaction" "-sbash" "-c$cword" "-a{{ VERSION }}") + for w in "${words[@]}"; do w="${w//\\\\/\\}" # remove quotes from typed values quote="${w:0:1}" @@ -54,8 +72,15 @@ _sf_{{ COMMAND_NAME }}() { done local sfcomplete - if sfcomplete=$(SHELL_VERBOSITY=0 ${completecmd[@]} 2>&1); then + if sfcomplete=$(SHELL_VERBOSITY=0 "${completecmd[@]}" 2>&1); then local quote suggestions + + # for the "--option=value" form, the suggestions are the values: readline + # keeps the "--option=" part, which is a word of its own for it + if [[ "$cur" == -*=* ]]; then + cur="${cur#*=}" + fi + quote=${cur:0:1} # Use single quotes by default if suggestions contains backslash (FQCN) @@ -64,8 +89,11 @@ _sf_{{ COMMAND_NAME }}() { fi if [ "$quote" == \' ]; then - # single quotes: no additional escaping (does not accept ' in values) - suggestions=$(for s in $sfcomplete; do printf $'%q%q%q\n' "$quote" "$s" "$quote"; done) + # single quotes: escape the single quotes contained in the values + suggestions=$(for s in $sfcomplete; do + s=${s//\'/\'\\\'\'} + printf $'%q%q%q\n' "$quote" "$s" "$quote"; + done) elif [ "$quote" == \" ]; then # double quotes: double escaping for \ $ ` " suggestions=$(for s in $sfcomplete; do diff --git a/core/vendor/symfony/console/Resources/completion.fish b/core/vendor/symfony/console/Resources/completion.fish index d2309b36fb..a291049437 100644 --- a/core/vendor/symfony/console/Resources/completion.fish +++ b/core/vendor/symfony/console/Resources/completion.fish @@ -9,6 +9,13 @@ function _sf_{{ COMMAND_NAME }} set sf_cmd (commandline -o) set c (count (commandline -oc)) + # fish completes the whole "--option=value" token, so the option is prepended + # to the suggestions to let fish filter them + set flag_prefix "" + if [ (count $sf_cmd) -gt $c ]; and string match -qr '^-[^=]*=' -- $sf_cmd[-1] + set flag_prefix (string replace -r '=.*$' '=' -- $sf_cmd[-1]) + end + set completecmd "$sf_cmd[1]" "_complete" "--no-interaction" "-sfish" "-a{{ VERSION }}" for i in $sf_cmd @@ -22,7 +29,7 @@ function _sf_{{ COMMAND_NAME }} set sfcomplete (env SHELL_VERBOSITY=0 $completecmd) for i in $sfcomplete - echo $i + echo "$flag_prefix$i" end end diff --git a/core/vendor/symfony/console/Resources/completion.zsh b/core/vendor/symfony/console/Resources/completion.zsh index eabeefb50b..147b82b4e2 100644 --- a/core/vendor/symfony/console/Resources/completion.zsh +++ b/core/vendor/symfony/console/Resources/completion.zsh @@ -15,8 +15,8 @@ # - https://github.com/symfony/symfony/blob/5.4/src/Symfony/Component/Console/Resources/completion.bash # _sf_{{ COMMAND_NAME }}() { - local lastParam flagPrefix requestComp out comp - local -a completions + local lastParam out comp sf_cmd + local -a completions flagPrefix requestComp inputs # The user could have moved the cursor backwards on the command-line. # We need to trigger completion from the $CURRENT location, so we need @@ -29,11 +29,20 @@ _sf_{{ COMMAND_NAME }}() { setopt local_options BASH_REMATCH if [[ "${lastParam}" =~ '-.*=' ]]; then # We are dealing with a flag with an = - flagPrefix="-P ${BASH_REMATCH}" + flagPrefix=(-P "${BASH_REMATCH}") fi - # Prepare the command to obtain completions - requestComp="${words[0]} ${words[1]} _complete --no-interaction -szsh -a{{ VERSION }} -c$((CURRENT-1))" i="" + # Prepare the command to obtain completions. An alias is resolved here, + # because the request is no longer read again by the shell. + sf_cmd="${words[1]}" + if [[ -n "${aliases[$sf_cmd]}" ]]; then + requestComp=(${(z)aliases[$sf_cmd]}) + else + requestComp=(${~sf_cmd}) + fi + + requestComp+=(_complete --no-interaction -szsh -a{{ VERSION }} "-c$((CURRENT-1))") + for w in ${words[@]}; do w=$(printf -- '%b' "$w") # remove quotes from typed values @@ -47,19 +56,18 @@ _sf_{{ COMMAND_NAME }}() { fi # empty values are ignored if [ ! -z "$w" ]; then - i="${i}-i${w} " + inputs+=("-i$w") fi done # Ensure at least 1 input - if [ "${i}" = "" ]; then - requestComp="${requestComp} -i\" \"" - else - requestComp="${requestComp} ${i}" + if (( ! $#inputs )); then + inputs=(-i' ') fi - # Use eval to handle any environment variables and such - out=$(eval SHELL_VERBOSITY=0 ${requestComp} 2>/dev/null) + # The request is run without being read again by the shell, so that a + # "$(...)" or a backtick typed on the command line is not executed + out=$(SHELL_VERBOSITY=0 "${requestComp[@]}" "${inputs[@]}" 2>/dev/null) while IFS='\n' read -r comp; do if [ -n "$comp" ]; then @@ -75,7 +83,7 @@ _sf_{{ COMMAND_NAME }}() { done < <(printf "%s\n" "${out[@]}") # Let inbuilt _describe handle completions - eval _describe "completions" completions $flagPrefix + _describe "completions" completions "${flagPrefix[@]}" return $? } diff --git a/core/vendor/symfony/finder/Finder.php b/core/vendor/symfony/finder/Finder.php index 4264db1b30..35a208a94f 100644 --- a/core/vendor/symfony/finder/Finder.php +++ b/core/vendor/symfony/finder/Finder.php @@ -200,11 +200,13 @@ public function notName(string|array $patterns): static } /** - * Adds tests that file contents must match. + * Adds tests that file contents must match. If multiple patterns are given, + * files only need to match at least one of them. * * Strings or PCRE patterns can be used: * * $finder->contains('Lorem ipsum') + * $finder->contains(['Lorem', 'ipsum']) // matches files containing "Lorem", or "ipsum", or both * $finder->contains('/Lorem ipsum/i') * $finder->contains(['dolor', '/ipsum/i']) * @@ -222,11 +224,13 @@ public function contains(string|array $patterns): static } /** - * Adds tests that file contents must not match. + * Adds tests that file contents must not match. If multiple patterns are given, + * files are excluded as soon as they match any of them. * * Strings or PCRE patterns can be used: * * $finder->notContains('Lorem ipsum') + * $finder->notContains(['Lorem', 'ipsum']) // excludes files containing "Lorem", or "ipsum", or both * $finder->notContains('/Lorem ipsum/i') * $finder->notContains(['lorem', '/dolor/i']) * diff --git a/core/vendor/symfony/finder/Gitignore.php b/core/vendor/symfony/finder/Gitignore.php index 9ff64bd82a..7764588983 100644 --- a/core/vendor/symfony/finder/Gitignore.php +++ b/core/vendor/symfony/finder/Gitignore.php @@ -36,12 +36,17 @@ public static function toRegexMatchingNegatedPatterns(string $gitignoreFileConte private static function buildRegex(string $gitignoreFileContent, bool $inverted): string { - $gitignoreFileContent = preg_replace('~(? $alternatives + */ + private static function alternate(string $res, array &$alternatives): string + { + if (!$alternatives) { + return $res; + } + + $regex = '(?:'.$res.'|'.implode('|', $alternatives).')'; + $alternatives = []; + + return $regex; } private static function lineToRegex(string $gitignoreLine): string diff --git a/core/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php b/core/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php index 88be240760..4013a13d62 100644 --- a/core/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php +++ b/core/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php @@ -80,7 +80,9 @@ public function accept(): bool $path = $this->current()->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath(); $path = str_replace('\\', '/', $path); - return !preg_match($this->excludedPattern, $path); + if (preg_match($this->excludedPattern, $path)) { + return false; + } } if ($this->pruneFilters && $this->hasChildren()) { @@ -104,6 +106,7 @@ public function getChildren(): self $children = new self($this->iterator->getChildren(), []); $children->excludedDirs = $this->excludedDirs; $children->excludedPattern = $this->excludedPattern; + $children->pruneFilters = $this->pruneFilters; return $children; } diff --git a/core/vendor/symfony/finder/Iterator/VcsIgnoredFilterIterator.php b/core/vendor/symfony/finder/Iterator/VcsIgnoredFilterIterator.php index 82c2644efa..9e69d0e319 100644 --- a/core/vendor/symfony/finder/Iterator/VcsIgnoredFilterIterator.php +++ b/core/vendor/symfony/finder/Iterator/VcsIgnoredFilterIterator.php @@ -35,7 +35,8 @@ final class VcsIgnoredFilterIterator extends \FilterIterator */ public function __construct(\Iterator $iterator, string $baseDir) { - $this->baseDir = $this->normalizePath($baseDir); + // paths are compared to the real path of each file, so the base directory needs the same treatment + $this->baseDir = $this->normalizePath(realpath($baseDir) ?: $baseDir); foreach ([$this->baseDir, ...$this->parentDirectoriesUpwards($this->baseDir)] as $directory) { if (@is_dir("{$directory}/.git")) { @@ -161,8 +162,12 @@ private function readGitignoreFile(string $path): ?array $rules = []; foreach (preg_split('~\r\n?|\n~', file_get_contents($path)) as $line) { - $line = preg_replace('~(? + */ + private static array $trustedHostsLiterals = []; + + /** + * @var string[] + */ + private static array $trustedHostsRegexps = []; private const FORWARDED_PARAMS = [ self::HEADER_X_FORWARDED_FOR => 'for', @@ -656,8 +664,19 @@ public static function getTrustedHeaderSet(): int public static function setTrustedHosts(array $hostPatterns): void { self::$trustedHostPatterns = array_map(static fn ($hostPattern) => \sprintf('{%s}i', $hostPattern), $hostPatterns); - // the branch reset group keeps capturing groups, back references and inline modifiers local to each pattern - self::$trustedHostsRegexp = $hostPatterns ? \sprintf('{(?|(?:%s))}i', implode(')|(?:', $hostPatterns)) : null; + self::$trustedHostsLiterals = []; + $regexpPatterns = []; + + foreach ($hostPatterns as $hostPattern) { + // constant patterns are matched by a hash lookup in getHost(), where the host is lowercase and free of newlines + if (preg_match('{^\^((?:[a-z0-9_:-]|\\\\[^a-z0-9])++)\$$}Di', $hostPattern, $m)) { + self::$trustedHostsLiterals[strtolower(preg_replace('{\\\\(.)}s', '$1', $m[1]))] = true; + } else { + $regexpPatterns[] = $hostPattern; + } + } + + self::$trustedHostsRegexps = self::compileHostPatterns($regexpPatterns); } /** @@ -1195,13 +1214,19 @@ public function getHost(): string throw new SuspiciousOperationException(\sprintf('Invalid Host "%s".', $host)); } - if (self::$trustedHostsRegexp) { + if (self::$trustedHostsLiterals || self::$trustedHostsRegexps) { // to avoid host header injection attacks, you should provide a list of trusted host patterns - if (preg_match(self::$trustedHostsRegexp, $host)) { + if (isset(self::$trustedHostsLiterals[$host])) { return $host; } + foreach (self::$trustedHostsRegexps as $regexp) { + if (preg_match($regexp, $host)) { + return $host; + } + } + if (!$this->isHostValid) { return ''; } @@ -2258,4 +2283,31 @@ private static function isHostValid(string $host): bool // use preg_replace() instead of preg_match() to prevent DoS attacks with long host names return '' === preg_replace('/[-a-zA-Z0-9_]++\.?/', '', $host); } + + /** + * Combines host patterns into as few regexps as PCRE can compile. + * + * @return string[] + */ + private static function compileHostPatterns(array $hostPatterns): array + { + if (!$hostPatterns) { + return []; + } + + // the branch reset group keeps capturing groups, back references and inline modifiers local to each pattern + $regexp = \sprintf('{(?|(?:%s))}i', implode(')|(?:', $hostPatterns)); + + if (1 === \count($hostPatterns) || false !== @preg_match($regexp, '')) { + return [$regexp]; + } + + // the combined pattern exceeds the maximum size PCRE accepts, split it in half + $half = intdiv(\count($hostPatterns), 2); + + return array_merge( + self::compileHostPatterns(\array_slice($hostPatterns, 0, $half)), + self::compileHostPatterns(\array_slice($hostPatterns, $half)) + ); + } } diff --git a/core/vendor/symfony/http-foundation/RequestMatcher/PathRequestMatcher.php b/core/vendor/symfony/http-foundation/RequestMatcher/PathRequestMatcher.php index c7c7a02c10..64ce91cdf7 100644 --- a/core/vendor/symfony/http-foundation/RequestMatcher/PathRequestMatcher.php +++ b/core/vendor/symfony/http-foundation/RequestMatcher/PathRequestMatcher.php @@ -27,6 +27,6 @@ public function __construct(private string $regexp) public function matches(Request $request): bool { - return preg_match('{'.$this->regexp.'}', rawurldecode($request->getPathInfo())); + return preg_match('{'.$this->regexp.'}s', rawurldecode($request->getPathInfo())); } } diff --git a/core/vendor/symfony/http-kernel/Kernel.php b/core/vendor/symfony/http-kernel/Kernel.php index e8da43617d..d96e684844 100644 --- a/core/vendor/symfony/http-kernel/Kernel.php +++ b/core/vendor/symfony/http-kernel/Kernel.php @@ -74,11 +74,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl */ private static array $freshCache = []; - public const VERSION = '7.4.18'; - public const VERSION_ID = 70418; + public const VERSION = '7.4.19'; + public const VERSION_ID = 70419; public const MAJOR_VERSION = 7; public const MINOR_VERSION = 4; - public const RELEASE_VERSION = 18; + public const RELEASE_VERSION = 19; public const EXTRA_VERSION = ''; public const END_OF_MAINTENANCE = '11/2028'; @@ -580,16 +580,20 @@ protected function getKernelParameters(): array $bundles = []; $bundlesMetadata = []; + // filesystem paths are literals: a percent sign in them must be escaped + // so that the parameter bag does not read it as a parameter reference + $escape = static fn (string $path): string => str_replace('%', '%%', $path); + foreach ($this->bundles as $name => $bundle) { $bundles[$name] = $bundle::class; $bundlesMetadata[$name] = [ - 'path' => $bundle->getPath(), + 'path' => $escape($bundle->getPath()), 'namespace' => $bundle->getNamespace(), ]; } return [ - 'kernel.project_dir' => realpath($this->getProjectDir()) ?: $this->getProjectDir(), + 'kernel.project_dir' => $escape(realpath($this->getProjectDir()) ?: $this->getProjectDir()), 'kernel.environment' => $this->environment, 'kernel.runtime_environment' => '%env(default:kernel.environment:APP_RUNTIME_ENV)%', 'kernel.runtime_mode' => '%env(query_string:default:container.runtime_mode:APP_RUNTIME_MODE)%', @@ -597,14 +601,14 @@ protected function getKernelParameters(): array 'kernel.runtime_mode.cli' => '%env(not:default:kernel.runtime_mode.web:)%', 'kernel.runtime_mode.worker' => '%env(bool:default::key:worker:default:kernel.runtime_mode:)%', 'kernel.debug' => $this->debug, - 'kernel.build_dir' => realpath($dir = $this->warmupDir ?: $this->getBuildDir()) ?: $dir, - 'kernel.cache_dir' => realpath($dir = ($this->getCacheDir() === $this->getBuildDir() ? ($this->warmupDir ?: $this->getCacheDir()) : $this->getCacheDir())) ?: $dir, - 'kernel.logs_dir' => realpath($dir = $this->getLogDir()) ?: $dir, + 'kernel.build_dir' => $escape(realpath($buildDir = $this->warmupDir ?: $this->getBuildDir()) ?: $buildDir), + 'kernel.cache_dir' => $escape(realpath($cacheDir = ($this->getCacheDir() === $this->getBuildDir() ? ($this->warmupDir ?: $this->getCacheDir()) : $this->getCacheDir())) ?: $cacheDir), + 'kernel.logs_dir' => $escape(realpath($this->getLogDir()) ?: $this->getLogDir()), 'kernel.bundles' => $bundles, 'kernel.bundles_metadata' => $bundlesMetadata, 'kernel.charset' => $this->getCharset(), 'kernel.container_class' => $this->getContainerClass(), - ] + (null !== ($dir = $this->getShareDir()) ? ['kernel.share_dir' => realpath($dir) ?: $dir] : []); + ] + (null !== ($dir = $this->getShareDir()) ? ['kernel.share_dir' => $escape(realpath($dir) ?: $dir)] : []); } /** diff --git a/core/vendor/symfony/mime/Address.php b/core/vendor/symfony/mime/Address.php index 5c550ca532..7f632abeb6 100644 --- a/core/vendor/symfony/mime/Address.php +++ b/core/vendor/symfony/mime/Address.php @@ -48,7 +48,7 @@ public function __construct(string $address, string $name = '') self::$validator ??= new EmailValidator(); $this->address = trim($address); - $this->name = trim(str_replace(["\n", "\r"], '', $name)); + $this->name = trim(preg_replace('/[\x00-\x08\x0A-\x1F\x7F]/', '', $name)); if (preg_match('/[\x00-\x1F\x7F]/', $this->address)) { throw new InvalidArgumentException('Email address contains control characters.'); @@ -150,7 +150,9 @@ private static function isValidAddrSpec(string $address): bool return false; } - if (substr_count($address, '@') < 2) { + // an address that already complies with the addr-spec needs no further check: the extra + // "@" then belongs to the domain, e.g. inside a domain-literal (RFC 5322, 3.4.1) + if (substr_count($address, '@') < 2 || self::$validator->isValid($address, new RFCValidation())) { return true; } diff --git a/core/vendor/symfony/mime/Header/AbstractHeader.php b/core/vendor/symfony/mime/Header/AbstractHeader.php index 62b302f5b4..ba4bac62aa 100644 --- a/core/vendor/symfony/mime/Header/AbstractHeader.php +++ b/core/vendor/symfony/mime/Header/AbstractHeader.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Mime\Header; use Symfony\Component\Mime\Encoder\QpMimeHeaderEncoder; +use Symfony\Component\Mime\Exception\RfcComplianceException; /** * An abstract base MIME Header. @@ -31,6 +32,10 @@ abstract class AbstractHeader implements HeaderInterface public function __construct(string $name) { + if (!preg_match('/^[\x21-\x7E]++$/D', $name)) { + throw new RfcComplianceException(sprintf('The header name "%s" contains characters that are not allowed in a header name.', $name)); + } + $this->name = $name; } @@ -152,7 +157,7 @@ protected function encodeWords(HeaderInterface $header, string $input, int $used protected function tokenNeedsEncoding(string $token): bool { - return (bool) preg_match('~[\x00-\x08\x10-\x19\x7F-\xFF\r\n]~', $token); + return preg_match('~[\x00-\x08\x0A-\x1F\x7F-\xFF]~', $token); } /** diff --git a/core/vendor/symfony/mime/Header/ParameterizedHeader.php b/core/vendor/symfony/mime/Header/ParameterizedHeader.php index 585eced3b3..6592a6e6aa 100644 --- a/core/vendor/symfony/mime/Header/ParameterizedHeader.php +++ b/core/vendor/symfony/mime/Header/ParameterizedHeader.php @@ -117,7 +117,7 @@ private function createParameter(string $name, string $value): string if (!preg_match('/^'.self::TOKEN_REGEX.'$/D', $value)) { // TODO: text, or something else?? // ... and it's not ascii - if (!preg_match('/^[\x00-\x08\x0B\x0C\x0E-\x7F]*$/D', $value)) { + if (!preg_match('/^[\x20-\x7E]*$/D', $value)) { $encoded = true; // Allow space for the indices, charset and language $maxValueLength = $this->getMaxLineLength() - \strlen($name.'*N*="";') - 1; diff --git a/core/vendor/symfony/process/Process.php b/core/vendor/symfony/process/Process.php index 5333468644..744fe54aad 100644 --- a/core/vendor/symfony/process/Process.php +++ b/core/vendor/symfony/process/Process.php @@ -1612,12 +1612,15 @@ static function ($m) use (&$env, $uid) { static $comSpec; - if (!$comSpec && $comSpec = (new ExecutableFinder())->find('cmd.exe')) { + if (!$comSpec) { + // use an absolute path to prevent CreateProcess() from looking for "cmd" in the current directory + $comSpec = (new ExecutableFinder())->find('cmd.exe') ?: (getenv('SystemRoot') ?: 'C:\Windows').'\System32\cmd.exe'; + // Escape according to CommandLineToArgvW rules $comSpec = '"'.preg_replace('{(\\\\*+)"}', '$1$1\"', $comSpec).'"'; } - $cmd = ($comSpec ?? 'cmd').' /V:ON /E:ON /D /C ('.str_replace("\n", ' ', $cmd).')'; + $cmd = $comSpec.' /V:ON /E:ON /D /C ('.str_replace("\n", ' ', $cmd).')'; foreach ($this->processPipes->getFiles() as $offset => $filename) { $cmd .= ' '.$offset.'>"'.$filename.'"'; } diff --git a/core/vendor/symfony/string/AbstractUnicodeString.php b/core/vendor/symfony/string/AbstractUnicodeString.php index fcbe09a2c9..6846d8e639 100644 --- a/core/vendor/symfony/string/AbstractUnicodeString.php +++ b/core/vendor/symfony/string/AbstractUnicodeString.php @@ -389,14 +389,15 @@ public function title(bool $allWords = false): static */ public function localeTitle(string $locale): static { + $str = clone $this; + if (null !== $transliterator = $this->getLocaleTransliterator($locale, 'Title')) { - $str = clone $this; $str->string = $transliterator->transliterate($str->string); - - return $str; + } else { + $str->string = mb_convert_case($str->string, \MB_CASE_TITLE, 'UTF-8'); } - return $this->title(); + return $str; } public function trim(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): static diff --git a/core/vendor/symfony/string/ByteString.php b/core/vendor/symfony/string/ByteString.php index bd721fc492..3c31caf6b2 100644 --- a/core/vendor/symfony/string/ByteString.php +++ b/core/vendor/symfony/string/ByteString.php @@ -109,8 +109,10 @@ public function camel(): static { $str = clone $this; - $parts = explode(' ', trim(ucwords(preg_replace('/[^a-zA-Z0-9\x7f-\xff]++/', ' ', $this->string)))); - $parts[0] = 1 !== \strlen($parts[0]) && ctype_upper($parts[0]) ? $parts[0] : lcfirst($parts[0]); + $words = trim(preg_replace('/[^a-zA-Z0-9\x7f-\xff]++/', ' ', $this->string)); + $parts = explode(' ', ucwords($words)); + // a leading uppercase letter followed by another one is kept, as in AbstractUnicodeString::camel() + $parts[0] = preg_match('/^[A-Z]{2}/', $words) || (1 !== \strlen($parts[0]) && ctype_upper($parts[0])) ? $parts[0] : lcfirst($parts[0]); $str->string = implode('', $parts); return $str; diff --git a/core/vendor/symfony/string/Inflector/EnglishInflector.php b/core/vendor/symfony/string/Inflector/EnglishInflector.php index 9c82ccee28..81629110ed 100644 --- a/core/vendor/symfony/string/Inflector/EnglishInflector.php +++ b/core/vendor/symfony/string/Inflector/EnglishInflector.php @@ -152,8 +152,17 @@ final class EnglishInflector implements InflectorInterface // drives (drive) ['sevird', 6, false, true, 'drive'], - // lives (life), wives (wife) - ['sevi', 4, false, true, 'ife'], + // knives (knife), jackknives (jackknife) + ['sevink', 6, true, true, 'knife'], + + // wives (wife), midwives (midwife) + ['seviw', 5, true, true, 'wife'], + + // lives (life) + ['sevil', 5, false, true, 'life'], + + // archives (archive), explosives (explosive), hives (hive), olives (olive) + ['sevi', 4, true, true, 'ive'], // moves (move) ['sevom', 5, true, true, 'move'], diff --git a/install/assets/modules/store.tpl b/install/assets/modules/store.tpl index c6d510405d..4b53a13581 100644 --- a/install/assets/modules/store.tpl +++ b/install/assets/modules/store.tpl @@ -1,19 +1,19 @@ -// - - - -js_output)) : ?> - - - -

              - get('name') ?> -

              - - - renderView('chunks/db_setup') ?> - - -
              - -
              renderView('chunks/messages', $view->getMessages('global')) ?>
              - -
              - - -
              -

              txt('cm_add_new_category') ?>

              - -
              - renderView('chunks/messages', $view->getMessages('add')) ?> - renderView('add') ?> -
              -
              - - - -
              -

              txt('cm_edit_categories') ?>

              - -
              - renderView('chunks/messages', $view->getMessages('edit')) ?> - renderView('edit', $data) ?> -
              -
              - -
              -

              txt('cm_sort_categories') ?>

              - -
              - renderView('chunks/messages', $view->getMessages('sort')) ?> - renderView('sort', $data) ?> -
              -
              - -
              -

              txt('cm_categorize_elements') ?>

              - -
              - renderView('chunks/messages', $view->getMessages('categorize')) ?> - renderView('categorize', $data) ?> -
              -
              - - - - new_translations[$view->get('manager_language')])) : ?> - -
              -

              txt('Translations') ?>

              - -
              - renderView('chunks/messages', $view->getMessages('translate')) ?> - renderView('translate', $view->new_translations[$view->get('manager_language')]) ?> -
              -
              - - - -
              - -
              - - - - - - + + + + +js_output)) : ?> + + + +

              + get('name') ?> +

              + + + renderView('chunks/db_setup') ?> + + +
              + +
              renderView('chunks/messages', $view->getMessages('global')) ?>
              + +
              + + +
              +

              txt('cm_add_new_category') ?>

              + +
              + renderView('chunks/messages', $view->getMessages('add')) ?> + renderView('add') ?> +
              +
              + + + +
              +

              txt('cm_edit_categories') ?>

              + +
              + renderView('chunks/messages', $view->getMessages('edit')) ?> + renderView('edit', $data) ?> +
              +
              + +
              +

              txt('cm_sort_categories') ?>

              + +
              + renderView('chunks/messages', $view->getMessages('sort')) ?> + renderView('sort', $data) ?> +
              +
              + +
              +

              txt('cm_categorize_elements') ?>

              + +
              + renderView('chunks/messages', $view->getMessages('categorize')) ?> + renderView('categorize', $data) ?> +
              +
              + + + + new_translations[$view->get('manager_language')])) : ?> + +
              +

              txt('Translations') ?>

              + +
              + renderView('chunks/messages', $view->getMessages('translate')) ?> + renderView('translate', $view->new_translations[$view->get('manager_language')]) ?> +
              +
              + + + +
              + +
              + + + + + + diff --git a/manager/includes/actionlist.inc.php b/manager/includes/actionlist.inc.php index 74bb666b74..9209a0cad0 100644 --- a/manager/includes/actionlist.inc.php +++ b/manager/includes/actionlist.inc.php @@ -1,6 +1,6 @@ -INCLUDE_ORDERING_ERROR

              Please use the EVO Content Manager instead of accessing this file directly."); -} - -$GLOBALS['action_list'] = include EVO_CORE_PATH . 'factory/actionlist.php'; +INCLUDE_ORDERING_ERROR

              Please use the EVO Content Manager instead of accessing this file directly."); +} + +$GLOBALS['action_list'] = include EVO_CORE_PATH . 'factory/actionlist.php'; diff --git a/manager/includes/controls/datagrid.class.php b/manager/includes/controls/datagrid.class.php index 81c02588d9..7ca38971dd 100644 --- a/manager/includes/controls/datagrid.class.php +++ b/manager/includes/controls/datagrid.class.php @@ -1,6 +1,6 @@ -render(); +render(); diff --git a/manager/includes/template.parser.class.inc.php b/manager/includes/template.parser.class.inc.php index 94da5d0bce..93077c20da 100755 --- a/manager/includes/template.parser.class.inc.php +++ b/manager/includes/template.parser.class.inc.php @@ -1,13 +1,13 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/manager/media/browser/mcpuk/browser.php b/manager/media/browser/mcpuk/browser.php index 7ed522bbbf..9bb4163bfc 100755 --- a/manager/media/browser/mcpuk/browser.php +++ b/manager/media/browser/mcpuk/browser.php @@ -1,28 +1,28 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/manager/media/browser/mcpuk/config.php b/manager/media/browser/mcpuk/config.php index d89ccea561..71e328794d 100755 --- a/manager/media/browser/mcpuk/config.php +++ b/manager/media/browser/mcpuk/config.php @@ -1,152 +1,152 @@ - - * @copyright 2010-2014 KCFinder Project - * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 - * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 - * @link http://kcfinder.sunhater.com - */ - -// IMPORTANT!!! Do not remove uncommented settings in this file even if -// you are using session configuration. -// See http://kcfinder.sunhater.com/install for setting descriptions - -$modx = evolutionCMS(); - -$resolveUploadRoot = static function (string $defaultDir, string $defaultUrl, string $customDir): array { - $defaultDir = rtrim(str_replace('\\', '/', str_replace('[(base_path)]', EVO_BASE_PATH, $defaultDir)), '/'); - $defaultUrl = rtrim(str_replace('\\', '/', $defaultUrl), '/'); - $customDir = trim($customDir); - - if ($customDir === '') { - return [$defaultDir, $defaultUrl]; - } - - $customDir = str_replace('[(base_path)]', EVO_BASE_PATH, $customDir); - $customDir = str_replace('\\', '/', $customDir); - - if (!preg_match('/^(?:[A-Za-z]:[\/\\\\]|\/)/', $customDir)) { - $customDir = $defaultDir . '/' . ltrim($customDir, '/'); - } - - $customDir = rtrim($customDir, '/'); - $resolvedDir = str_replace('\\', '/', realpath($customDir) ?: $customDir); - - if ($defaultDir !== '' && strpos($resolvedDir, $defaultDir) === 0) { - $relativePath = ltrim(substr($resolvedDir, strlen($defaultDir)), '/'); - return [ - $resolvedDir, - $relativePath === '' ? $defaultUrl : $defaultUrl . '/' . $relativePath - ]; - } - - $siteBasePath = rtrim(str_replace('\\', '/', EVO_BASE_PATH), '/'); - $siteBaseUrl = rtrim(str_replace('\\', '/', EVO_BASE_URL), '/'); - if ($siteBasePath !== '' && strpos($resolvedDir, $siteBasePath) === 0) { - $relativePath = ltrim(substr($resolvedDir, strlen($siteBasePath)), '/'); - return [ - $resolvedDir, - $relativePath === '' ? ($siteBaseUrl === '' ? '/' : $siteBaseUrl) : - ($siteBaseUrl === '' ? '' : $siteBaseUrl) . '/' . $relativePath - ]; - } - - return [$defaultDir, $defaultUrl]; -}; - -[$uploadDir, $uploadUrl] = $resolveUploadRoot( - (string) EvolutionCMS()->getConfig('rb_base_dir'), - (string) EvolutionCMS()->getConfig('rb_base_url'), - (string) EvolutionCMS()->getConfig('image_base_upload_dir', '') -); - -$_CONFIG = [ - 'disabled' => false, - 'denyZipDownload' => EvolutionCMS()->getConfig('denyZipDownload'), - 'denyExtensionRename' => EvolutionCMS()->getConfig('denyExtensionRename'), - 'showHiddenFiles' => EvolutionCMS()->getConfig('showHiddenFiles'), - 'theme' => "evo", - 'uploadURL' => $uploadUrl, - 'uploadDir' => $uploadDir, - 'siteURL' => EVO_SITE_URL, - 'assetsURL' => $uploadUrl, - 'dirPerms' => intval(EvolutionCMS()->getConfig('new_folder_permissions'), 8), - 'filePerms' => intval(EvolutionCMS()->getConfig('new_file_permissions'), 8), - 'maxfilesize' => (int)EvolutionCMS()->getConfig('upload_maxsize'), - 'noThumbnailsRecreation' => EvolutionCMS()->getConfig('noThumbnailsRecreation'), - - 'access' => [ - - 'files' => [ - 'upload' => true, - 'delete' => true, - 'copy' => true, - 'move' => true, - 'rename' => true - ], - - 'dirs' => [ - 'create' => true, - 'delete' => true, - 'rename' => true - ] - ], - - 'deniedExts' => "exe com msi bat php phps phtml php3 php4 cgi pl", - - 'types' => [ - - // CKEditor & FCKEditor types - 'files' => str_replace(',', ' ', EvolutionCMS()->getConfig('upload_files')), - 'images' => str_replace(',', ' ', EvolutionCMS()->getConfig('upload_images')), - - // TinyMCE types - 'file' => str_replace(',', ' ', EvolutionCMS()->getConfig('upload_files')), - 'media' => str_replace(',', ' ', EvolutionCMS()->getConfig('upload_media')), - 'image' => str_replace(',', ' ', EvolutionCMS()->getConfig('upload_images')), - ], - 'dirnameChangeChars' => [ - ' ' => "_", - ':' => "." - ], - 'mime_magic' => "", - - 'maxImageWidth' => EvolutionCMS()->getConfig('maxImageWidth'), - 'maxImageHeight' => EvolutionCMS()->getConfig('maxImageHeight'), - 'clientResize' => EvolutionCMS()->getConfig('clientResize') && EvolutionCMS()->getConfig('maxImageWidth') - && EvolutionCMS()->getConfig('maxImageHeight') - ? ['maxWidth' => EvolutionCMS()->getConfig('maxImageWidth'), - 'maxHeight' => EvolutionCMS()->getConfig('maxImageHeight'), - 'quality' => EvolutionCMS()->getConfig('jpegQuality') / 100] - : [], - - 'thumbWidth' => EvolutionCMS()->getConfig('thumbWidth'), - 'thumbHeight' => EvolutionCMS()->getConfig('thumbHeight'), - 'thumbsDir' => EvolutionCMS()->getConfig('thumbsDir'), - - 'jpegQuality' => EvolutionCMS()->getConfig('jpegQuality'), - - 'cookieDomain' => "", - 'cookiePath' => "", - 'cookiePrefix' => 'KCFINDER_', - - // THE FOLLOWING SETTINGS CANNOT BE OVERRIDED WITH SESSION CONFIGURATION - '_check4htaccess' => false, - '_tinyMCEPath' => EVO_BASE_URL . "assets/plugins/tinymce/tiny_mce", - - '_sessionVar' => &$_SESSION['KCFINDER'], - //'_sessionLifetime' => 30, - //'_sessionDir' => "/full/directory/path", - - //'_sessionDomain' => ".mysite.com", - //'_sessionPath' => "/my/path", -]; - -EvolutionCMS()->invokeEvent('OnFileBrowserInit', [ - 'config' => &$_CONFIG, -]); + + * @copyright 2010-2014 KCFinder Project + * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 + * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 + * @link http://kcfinder.sunhater.com + */ + +// IMPORTANT!!! Do not remove uncommented settings in this file even if +// you are using session configuration. +// See http://kcfinder.sunhater.com/install for setting descriptions + +$modx = evolutionCMS(); + +$resolveUploadRoot = static function (string $defaultDir, string $defaultUrl, string $customDir): array { + $defaultDir = rtrim(str_replace('\\', '/', str_replace('[(base_path)]', EVO_BASE_PATH, $defaultDir)), '/'); + $defaultUrl = rtrim(str_replace('\\', '/', $defaultUrl), '/'); + $customDir = trim($customDir); + + if ($customDir === '') { + return [$defaultDir, $defaultUrl]; + } + + $customDir = str_replace('[(base_path)]', EVO_BASE_PATH, $customDir); + $customDir = str_replace('\\', '/', $customDir); + + if (!preg_match('/^(?:[A-Za-z]:[\/\\\\]|\/)/', $customDir)) { + $customDir = $defaultDir . '/' . ltrim($customDir, '/'); + } + + $customDir = rtrim($customDir, '/'); + $resolvedDir = str_replace('\\', '/', realpath($customDir) ?: $customDir); + + if ($defaultDir !== '' && strpos($resolvedDir, $defaultDir) === 0) { + $relativePath = ltrim(substr($resolvedDir, strlen($defaultDir)), '/'); + return [ + $resolvedDir, + $relativePath === '' ? $defaultUrl : $defaultUrl . '/' . $relativePath + ]; + } + + $siteBasePath = rtrim(str_replace('\\', '/', EVO_BASE_PATH), '/'); + $siteBaseUrl = rtrim(str_replace('\\', '/', EVO_BASE_URL), '/'); + if ($siteBasePath !== '' && strpos($resolvedDir, $siteBasePath) === 0) { + $relativePath = ltrim(substr($resolvedDir, strlen($siteBasePath)), '/'); + return [ + $resolvedDir, + $relativePath === '' ? ($siteBaseUrl === '' ? '/' : $siteBaseUrl) : + ($siteBaseUrl === '' ? '' : $siteBaseUrl) . '/' . $relativePath + ]; + } + + return [$defaultDir, $defaultUrl]; +}; + +[$uploadDir, $uploadUrl] = $resolveUploadRoot( + (string) EvolutionCMS()->getConfig('rb_base_dir'), + (string) EvolutionCMS()->getConfig('rb_base_url'), + (string) EvolutionCMS()->getConfig('image_base_upload_dir', '') +); + +$_CONFIG = [ + 'disabled' => false, + 'denyZipDownload' => EvolutionCMS()->getConfig('denyZipDownload'), + 'denyExtensionRename' => EvolutionCMS()->getConfig('denyExtensionRename'), + 'showHiddenFiles' => EvolutionCMS()->getConfig('showHiddenFiles'), + 'theme' => "evo", + 'uploadURL' => $uploadUrl, + 'uploadDir' => $uploadDir, + 'siteURL' => EVO_SITE_URL, + 'assetsURL' => $uploadUrl, + 'dirPerms' => intval(EvolutionCMS()->getConfig('new_folder_permissions'), 8), + 'filePerms' => intval(EvolutionCMS()->getConfig('new_file_permissions'), 8), + 'maxfilesize' => (int)EvolutionCMS()->getConfig('upload_maxsize'), + 'noThumbnailsRecreation' => EvolutionCMS()->getConfig('noThumbnailsRecreation'), + + 'access' => [ + + 'files' => [ + 'upload' => true, + 'delete' => true, + 'copy' => true, + 'move' => true, + 'rename' => true + ], + + 'dirs' => [ + 'create' => true, + 'delete' => true, + 'rename' => true + ] + ], + + 'deniedExts' => "exe com msi bat php phps phtml php3 php4 cgi pl", + + 'types' => [ + + // CKEditor & FCKEditor types + 'files' => str_replace(',', ' ', EvolutionCMS()->getConfig('upload_files')), + 'images' => str_replace(',', ' ', EvolutionCMS()->getConfig('upload_images')), + + // TinyMCE types + 'file' => str_replace(',', ' ', EvolutionCMS()->getConfig('upload_files')), + 'media' => str_replace(',', ' ', EvolutionCMS()->getConfig('upload_media')), + 'image' => str_replace(',', ' ', EvolutionCMS()->getConfig('upload_images')), + ], + 'dirnameChangeChars' => [ + ' ' => "_", + ':' => "." + ], + 'mime_magic' => "", + + 'maxImageWidth' => EvolutionCMS()->getConfig('maxImageWidth'), + 'maxImageHeight' => EvolutionCMS()->getConfig('maxImageHeight'), + 'clientResize' => EvolutionCMS()->getConfig('clientResize') && EvolutionCMS()->getConfig('maxImageWidth') + && EvolutionCMS()->getConfig('maxImageHeight') + ? ['maxWidth' => EvolutionCMS()->getConfig('maxImageWidth'), + 'maxHeight' => EvolutionCMS()->getConfig('maxImageHeight'), + 'quality' => EvolutionCMS()->getConfig('jpegQuality') / 100] + : [], + + 'thumbWidth' => EvolutionCMS()->getConfig('thumbWidth'), + 'thumbHeight' => EvolutionCMS()->getConfig('thumbHeight'), + 'thumbsDir' => EvolutionCMS()->getConfig('thumbsDir'), + + 'jpegQuality' => EvolutionCMS()->getConfig('jpegQuality'), + + 'cookieDomain' => "", + 'cookiePath' => "", + 'cookiePrefix' => 'KCFINDER_', + + // THE FOLLOWING SETTINGS CANNOT BE OVERRIDED WITH SESSION CONFIGURATION + '_check4htaccess' => false, + '_tinyMCEPath' => EVO_BASE_URL . "assets/plugins/tinymce/tiny_mce", + + '_sessionVar' => &$_SESSION['KCFINDER'], + //'_sessionLifetime' => 30, + //'_sessionDir' => "/full/directory/path", + + //'_sessionDomain' => ".mysite.com", + //'_sessionPath' => "/my/path", +]; + +EvolutionCMS()->invokeEvent('OnFileBrowserInit', [ + 'config' => &$_CONFIG, +]); diff --git a/manager/media/browser/mcpuk/core/autoload.php b/manager/media/browser/mcpuk/core/autoload.php index fff9929e0a..64d758c639 100755 --- a/manager/media/browser/mcpuk/core/autoload.php +++ b/manager/media/browser/mcpuk/core/autoload.php @@ -1,150 +1,150 @@ - - * @copyright 2010-2014 KCFinder Project - * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 - * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 - * @link http://kcfinder.sunhater.com - * - * This file is the place you can put any code (at the end of the file), - * which will be executed before any other. Suitable for: - * 1. Set PHP ini settings using ini_set() - * 2. Custom session save handler with session_set_save_handler() - * 3. Any custom integration code. If you use any global variables - * here, they can be accessed in config.php via $GLOBALS array. - * It's recommended to use constants instead. - */ -define('IN_MANAGER_MODE', true); -define('EVO_API_MODE', true); -include_once(__DIR__."/../../../../../index.php"); -$modx = EvolutionCMS(); - -$allowWebUser = (bool) $modx->getConfig('rb_webuser') && isset($_SESSION['webValidated']); -if (!isset($_SESSION['mgrValidated']) && !$allowWebUser) { - die("INCLUDE_ORDERING_ERROR

              Please use the EVO Content Manager instead of accessing this file directly."); -} -$manager_language = ManagerTheme::getLangName(); -$_GET['langCode'] = ManagerTheme::getLang(); - -// MAGIC AUTOLOAD CLASSES FUNCTION -function autoloadda9d06472ccb71b84928677ce2a6ca89($class) { - static $classes = null; - if ($classes === null) { - $classes = [ - 'browser' => '/browser.php', - 'dir' => '/../lib/helper_dir.php', - 'file' => '/../lib/helper_file.php', - 'gd' => '/../lib/class_gd.php', - 'httpCache' => '/../lib/helper_httpCache.php', - 'input' => '/../lib/class_input.php', - 'path' => '/../lib/helper_path.php', - 'text' => '/../lib/helper_text.php', - 'type_img' => '/types/type_img.php', - 'type_mime' => '/types/type_mime.php', - 'uploader' => '/uploader.php', - 'zipFolder' => '/../lib/class_zipFolder.php', - 'image' => '/../lib/class_image.php', - 'image_imagick' => '/../lib/class_image_imagick.php', - 'image_gmagick' => '/../lib/class_image_gmagick.php', - 'image_gd' => '/../lib/class_image_gd.php', - 'fastImage' => '/../lib/class_fastImage.php' - ]; - } - if (isset($classes[$class])) { - require __DIR__ . $classes[$class]; - } -} -spl_autoload_register('autoloadda9d06472ccb71b84928677ce2a6ca89', true); - -// CUSTOM SESSION SAVE HANDLER CLASS EXAMPLE -// -// Uncomment & edit it if the application you want to integrate with, have -// its own session save handler. It's not even needed to save instances of -// this class in variables. Just add a row: -// new SessionSaveHandler(); -// and your handler will rule the sessions ;-) - -/* -class SessionSaveHandler { - protected $savePath; - protected $sessionName; - - public function __construct() { - session_set_save_handler( - array($this, "open"), - array($this, "close"), - array($this, "read"), - array($this, "write"), - array($this, "destroy"), - array($this, "gc") - ); - } - - // Open function, this works like a constructor in classes and is - // executed when the session is being opened. The open function expects - // two parameters, where the first is the save path and the second is the - // session name. - public function open($savePath, $sessionName) { - $this->savePath = $savePath; - $this->sessionName = $sessionName; - return true; - } - - // Close function, this works like a destructor in classes and is - // executed when the session operation is done. - public function close() { - return true; - } - - // Read function must return string value always to make save handler - // work as expected. Return empty string if there is no data to read. - // Return values from other handlers are converted to boolean expression. - // TRUE for success, FALSE for failure. - public function read($id) { - $file = $this->savePath . "/sess_$id"; - return (string) @file_get_contents($file); - } - - // Write function that is called when session data is to be saved. This - // function expects two parameters: an identifier and the data associated - // with it. - public function write($id, $data) { - $file = $this->savePath . "/sess_$id"; - if (false !== ($fp = @fopen($file, "w"))) { - $return = fwrite($fp, $data); - fclose($fp); - return $return; - } else - return false; - } - - // The destroy handler, this is executed when a session is destroyed with - // session_destroy() and takes the session id as its only parameter. - public function destroy($id) { - $file = $this->savePath . "/sess_$id"; - return @unlink($file); - } - - // The garbage collector, this is executed when the session garbage - // collector is executed and takes the max session lifetime as its only - // parameter. - public function gc($maxlifetime) { - foreach (glob($this->savePath . "/sess_*") as $file) - if (filemtime($file) + $maxlifetime < time()) - @unlink($file); - return true; - } -} - -new SessionSaveHandler(); - -*/ - - -// PUT YOUR ADDITIONAL CODE HERE - + + * @copyright 2010-2014 KCFinder Project + * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 + * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 + * @link http://kcfinder.sunhater.com + * + * This file is the place you can put any code (at the end of the file), + * which will be executed before any other. Suitable for: + * 1. Set PHP ini settings using ini_set() + * 2. Custom session save handler with session_set_save_handler() + * 3. Any custom integration code. If you use any global variables + * here, they can be accessed in config.php via $GLOBALS array. + * It's recommended to use constants instead. + */ +define('IN_MANAGER_MODE', true); +define('EVO_API_MODE', true); +include_once(__DIR__."/../../../../../index.php"); +$modx = EvolutionCMS(); + +$allowWebUser = (bool) $modx->getConfig('rb_webuser') && isset($_SESSION['webValidated']); +if (!isset($_SESSION['mgrValidated']) && !$allowWebUser) { + die("INCLUDE_ORDERING_ERROR

              Please use the EVO Content Manager instead of accessing this file directly."); +} +$manager_language = ManagerTheme::getLangName(); +$_GET['langCode'] = ManagerTheme::getLang(); + +// MAGIC AUTOLOAD CLASSES FUNCTION +function autoloadda9d06472ccb71b84928677ce2a6ca89($class) { + static $classes = null; + if ($classes === null) { + $classes = [ + 'browser' => '/browser.php', + 'dir' => '/../lib/helper_dir.php', + 'file' => '/../lib/helper_file.php', + 'gd' => '/../lib/class_gd.php', + 'httpCache' => '/../lib/helper_httpCache.php', + 'input' => '/../lib/class_input.php', + 'path' => '/../lib/helper_path.php', + 'text' => '/../lib/helper_text.php', + 'type_img' => '/types/type_img.php', + 'type_mime' => '/types/type_mime.php', + 'uploader' => '/uploader.php', + 'zipFolder' => '/../lib/class_zipFolder.php', + 'image' => '/../lib/class_image.php', + 'image_imagick' => '/../lib/class_image_imagick.php', + 'image_gmagick' => '/../lib/class_image_gmagick.php', + 'image_gd' => '/../lib/class_image_gd.php', + 'fastImage' => '/../lib/class_fastImage.php' + ]; + } + if (isset($classes[$class])) { + require __DIR__ . $classes[$class]; + } +} +spl_autoload_register('autoloadda9d06472ccb71b84928677ce2a6ca89', true); + +// CUSTOM SESSION SAVE HANDLER CLASS EXAMPLE +// +// Uncomment & edit it if the application you want to integrate with, have +// its own session save handler. It's not even needed to save instances of +// this class in variables. Just add a row: +// new SessionSaveHandler(); +// and your handler will rule the sessions ;-) + +/* +class SessionSaveHandler { + protected $savePath; + protected $sessionName; + + public function __construct() { + session_set_save_handler( + array($this, "open"), + array($this, "close"), + array($this, "read"), + array($this, "write"), + array($this, "destroy"), + array($this, "gc") + ); + } + + // Open function, this works like a constructor in classes and is + // executed when the session is being opened. The open function expects + // two parameters, where the first is the save path and the second is the + // session name. + public function open($savePath, $sessionName) { + $this->savePath = $savePath; + $this->sessionName = $sessionName; + return true; + } + + // Close function, this works like a destructor in classes and is + // executed when the session operation is done. + public function close() { + return true; + } + + // Read function must return string value always to make save handler + // work as expected. Return empty string if there is no data to read. + // Return values from other handlers are converted to boolean expression. + // TRUE for success, FALSE for failure. + public function read($id) { + $file = $this->savePath . "/sess_$id"; + return (string) @file_get_contents($file); + } + + // Write function that is called when session data is to be saved. This + // function expects two parameters: an identifier and the data associated + // with it. + public function write($id, $data) { + $file = $this->savePath . "/sess_$id"; + if (false !== ($fp = @fopen($file, "w"))) { + $return = fwrite($fp, $data); + fclose($fp); + return $return; + } else + return false; + } + + // The destroy handler, this is executed when a session is destroyed with + // session_destroy() and takes the session id as its only parameter. + public function destroy($id) { + $file = $this->savePath . "/sess_$id"; + return @unlink($file); + } + + // The garbage collector, this is executed when the session garbage + // collector is executed and takes the max session lifetime as its only + // parameter. + public function gc($maxlifetime) { + foreach (glob($this->savePath . "/sess_*") as $file) + if (filemtime($file) + $maxlifetime < time()) + @unlink($file); + return true; + } +} + +new SessionSaveHandler(); + +*/ + + +// PUT YOUR ADDITIONAL CODE HERE + diff --git a/manager/media/browser/mcpuk/js/FileAPI/FileAPI.exif.js b/manager/media/browser/mcpuk/js/FileAPI/FileAPI.exif.js index 4dd678ce0f..0dd92d00c2 100644 --- a/manager/media/browser/mcpuk/js/FileAPI/FileAPI.exif.js +++ b/manager/media/browser/mcpuk/js/FileAPI/FileAPI.exif.js @@ -1,69 +1,69 @@ -(function (){ -/**! - * Binary Ajax 0.1.10 - * Copyright (c) 2008 Jacob Seidelin, cupboy@gmail.com, http://blog.nihilogic.dk/ - * Licensed under the MPL License [http://www.nihilogic.dk/licenses/mpl-license.txt] - * - * - * Javascript EXIF Reader 0.1.4 - * Copyright (c) 2008 Jacob Seidelin, cupboy@gmail.com, http://blog.nihilogic.dk/ - * Licensed under the MPL License [http://www.nihilogic.dk/licenses/mpl-license.txt] - */ - - -var BinaryFile=function(j,k,l){var h=j,i=k||0,b=0;this.getRawData=function(){return h};"string"==typeof j&&(b=l||h.length,this.getByteAt=function(a){return h.charCodeAt(a+i)&255},this.getBytesAt=function(a,b){for(var c=[],f=0;fc&&(c+=65536);return c};this.getSShortAt=function(a,b){var c=this.getShortAt(a,b);return 32767c&&(c+=4294967296);return c};this.getSLongAt=function(a,b){var c=this.getLongAt(a,b);return 2147483647 128*1024) { - try { - var size = Math.min(blob.size, 128 * 1024); - blob = (blob.slice || blob.mozSlice || blob.webkitSlice).call(blob, 0, size); - } catch (e) { - FileAPI.log("exception "+ e); - } - } - - FileAPI.readAsBinaryString(blob, function (evt){ - if( evt.type == 'load' ){ - var binaryString = evt.result; - var oFile = new BinaryFile(binaryString, 0, blob.size); - var exif = EXIF.readFromBinaryFile(oFile); - - defer.resolve(false, { 'exif': exif || {} }); - } - else if( evt.type == 'error' ){ - defer.resolve('read_as_binary_string_exif'); - } - }); - } - - file.__exif.then(callback); -}); -})(); +(function (){ +/**! + * Binary Ajax 0.1.10 + * Copyright (c) 2008 Jacob Seidelin, cupboy@gmail.com, http://blog.nihilogic.dk/ + * Licensed under the MPL License [http://www.nihilogic.dk/licenses/mpl-license.txt] + * + * + * Javascript EXIF Reader 0.1.4 + * Copyright (c) 2008 Jacob Seidelin, cupboy@gmail.com, http://blog.nihilogic.dk/ + * Licensed under the MPL License [http://www.nihilogic.dk/licenses/mpl-license.txt] + */ + + +var BinaryFile=function(j,k,l){var h=j,i=k||0,b=0;this.getRawData=function(){return h};"string"==typeof j&&(b=l||h.length,this.getByteAt=function(a){return h.charCodeAt(a+i)&255},this.getBytesAt=function(a,b){for(var c=[],f=0;fc&&(c+=65536);return c};this.getSShortAt=function(a,b){var c=this.getShortAt(a,b);return 32767c&&(c+=4294967296);return c};this.getSLongAt=function(a,b){var c=this.getLongAt(a,b);return 2147483647 128*1024) { + try { + var size = Math.min(blob.size, 128 * 1024); + blob = (blob.slice || blob.mozSlice || blob.webkitSlice).call(blob, 0, size); + } catch (e) { + FileAPI.log("exception "+ e); + } + } + + FileAPI.readAsBinaryString(blob, function (evt){ + if( evt.type == 'load' ){ + var binaryString = evt.result; + var oFile = new BinaryFile(binaryString, 0, blob.size); + var exif = EXIF.readFromBinaryFile(oFile); + + defer.resolve(false, { 'exif': exif || {} }); + } + else if( evt.type == 'error' ){ + defer.resolve('read_as_binary_string_exif'); + } + }); + } + + file.__exif.then(callback); +}); +})(); diff --git a/manager/media/browser/mcpuk/js/FileAPI/FileAPI.html5.js b/manager/media/browser/mcpuk/js/FileAPI/FileAPI.html5.js index e68fc60c18..aabab82d1f 100644 --- a/manager/media/browser/mcpuk/js/FileAPI/FileAPI.html5.js +++ b/manager/media/browser/mcpuk/js/FileAPI/FileAPI.html5.js @@ -1,3569 +1,3569 @@ -/*! FileAPI 2.0.19 - BSD | git://github.com/mailru/FileAPI.git - * FileAPI — a set of javascript tools for working with files. Multiupload, drag'n'drop and chunked file upload. Images: crop, resize and auto orientation by EXIF. - */ - -/* - * JavaScript Canvas to Blob 2.0.5 - * https://github.com/blueimp/JavaScript-Canvas-to-Blob - * - * Copyright 2012, Sebastian Tschan - * https://blueimp.net - * - * Licensed under the MIT license: - * http://www.opensource.org/licenses/MIT - * - * Based on stackoverflow user Stoive's code snippet: - * http://stackoverflow.com/q/4998908 - */ - -/*jslint nomen: true, regexp: true */ -/*global window, atob, Blob, ArrayBuffer, Uint8Array */ - -(function (window) { - 'use strict'; - var CanvasPrototype = window.HTMLCanvasElement && - window.HTMLCanvasElement.prototype, - hasBlobConstructor = window.Blob && (function () { - try { - return Boolean(new Blob()); - } catch (e) { - return false; - } - }()), - hasArrayBufferViewSupport = hasBlobConstructor && window.Uint8Array && - (function () { - try { - return new Blob([new Uint8Array(100)]).size === 100; - } catch (e) { - return false; - } - }()), - BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || - window.MozBlobBuilder || window.MSBlobBuilder, - dataURLtoBlob = (hasBlobConstructor || BlobBuilder) && window.atob && - window.ArrayBuffer && window.Uint8Array && function (dataURI) { - var byteString, - arrayBuffer, - intArray, - i, - mimeString, - bb; - if (dataURI.split(',')[0].indexOf('base64') >= 0) { - // Convert base64 to raw binary data held in a string: - byteString = atob(dataURI.split(',')[1]); - } else { - // Convert base64/URLEncoded data component to raw binary data: - byteString = decodeURIComponent(dataURI.split(',')[1]); - } - // Write the bytes of the string to an ArrayBuffer: - arrayBuffer = new ArrayBuffer(byteString.length); - intArray = new Uint8Array(arrayBuffer); - for (i = 0; i < byteString.length; i += 1) { - intArray[i] = byteString.charCodeAt(i); - } - // Separate out the mime component: - mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]; - // Write the ArrayBuffer (or ArrayBufferView) to a blob: - if (hasBlobConstructor) { - return new Blob( - [hasArrayBufferViewSupport ? intArray : arrayBuffer], - {type: mimeString} - ); - } - bb = new BlobBuilder(); - bb.append(arrayBuffer); - return bb.getBlob(mimeString); - }; - if (window.HTMLCanvasElement && !CanvasPrototype.toBlob) { - if (CanvasPrototype.mozGetAsFile) { - CanvasPrototype.toBlob = function (callback, type, quality) { - if (quality && CanvasPrototype.toDataURL && dataURLtoBlob) { - callback(dataURLtoBlob(this.toDataURL(type, quality))); - } else { - callback(this.mozGetAsFile('blob', type)); - } - }; - } else if (CanvasPrototype.toDataURL && dataURLtoBlob) { - CanvasPrototype.toBlob = function (callback, type, quality) { - callback(dataURLtoBlob(this.toDataURL(type, quality))); - }; - } - } - window.dataURLtoBlob = dataURLtoBlob; -})(window); - -/*jslint evil: true */ -/*global window, URL, webkitURL, ActiveXObject */ - -(function (window, undef){ - 'use strict'; - - var - gid = 1, - noop = function (){}, - - document = window.document, - doctype = document.doctype || {}, - userAgent = window.navigator.userAgent, - safari = /safari\//i.test(userAgent) && !/chrome\//i.test(userAgent), - iemobile = /iemobile\//i.test(userAgent), - - // https://github.com/blueimp/JavaScript-Load-Image/blob/master/load-image.js#L48 - apiURL = (window.createObjectURL && window) || (window.URL && URL.revokeObjectURL && URL) || (window.webkitURL && webkitURL), - - Blob = window.Blob, - File = window.File, - FileReader = window.FileReader, - FormData = window.FormData, - - - XMLHttpRequest = window.XMLHttpRequest, - jQuery = window.jQuery, - - html5 = !!(File && (FileReader && (window.Uint8Array || FormData || XMLHttpRequest.prototype.sendAsBinary))) - && !(safari && /windows/i.test(userAgent) && !iemobile), // BugFix: https://github.com/mailru/FileAPI/issues/25 - - cors = html5 && ('withCredentials' in (new XMLHttpRequest)), - - chunked = html5 && !!Blob && !!(Blob.prototype.webkitSlice || Blob.prototype.mozSlice || Blob.prototype.slice), - - normalize = ('' + ''.normalize).indexOf('[native code]') > 0, - - // https://github.com/blueimp/JavaScript-Canvas-to-Blob - dataURLtoBlob = window.dataURLtoBlob, - - - _rimg = /img/i, - _rcanvas = /canvas/i, - _rimgcanvas = /img|canvas/i, - _rinput = /input/i, - _rdata = /^data:[^,]+,/, - - _toString = {}.toString, - _supportConsoleLog, - _supportConsoleLogApply, - - - Math = window.Math, - - _SIZE_CONST = function (pow){ - pow = new window.Number(Math.pow(1024, pow)); - pow.from = function (sz){ return Math.round(sz * this); }; - return pow; - }, - - _elEvents = {}, // element event listeners - _infoReader = [], // list of file info processors - - _readerEvents = 'abort progress error load loadend', - _xhrPropsExport = 'status statusText readyState response responseXML responseText responseBody'.split(' '), - - currentTarget = 'currentTarget', // for minimize - preventDefault = 'preventDefault', // and this too - - _isArray = function (ar) { - return ar && ('length' in ar); - }, - - /** - * Iterate over a object or array - */ - _each = function (obj, fn, ctx){ - if( obj ){ - if( _isArray(obj) ){ - for( var i = 0, n = obj.length; i < n; i++ ){ - if( i in obj ){ - fn.call(ctx, obj[i], i, obj); - } - } - } - else { - for( var key in obj ){ - if( obj.hasOwnProperty(key) ){ - fn.call(ctx, obj[key], key, obj); - } - } - } - } - }, - - /** - * Merge the contents of two or more objects together into the first object - */ - _extend = function (dst){ - var args = arguments, i = 1, _ext = function (val, key){ dst[key] = val; }; - for( ; i < args.length; i++ ){ - _each(args[i], _ext); - } - return dst; - }, - - /** - * Add event listener - */ - _on = function (el, type, fn){ - if( el ){ - var uid = api.uid(el); - - if( !_elEvents[uid] ){ - _elEvents[uid] = {}; - } - - var isFileReader = (FileReader && el) && (el instanceof FileReader); - _each(type.split(/\s+/), function (type){ - if( jQuery && !isFileReader){ - jQuery.event.add(el, type, fn); - } else { - if( !_elEvents[uid][type] ){ - _elEvents[uid][type] = []; - } - - _elEvents[uid][type].push(fn); - - if( el.addEventListener ){ el.addEventListener(type, fn, false); } - else if( el.attachEvent ){ el.attachEvent('on'+type, fn); } - else { el['on'+type] = fn; } - } - }); - } - }, - - - /** - * Remove event listener - */ - _off = function (el, type, fn){ - if( el ){ - var uid = api.uid(el), events = _elEvents[uid] || {}; - - var isFileReader = (FileReader && el) && (el instanceof FileReader); - _each(type.split(/\s+/), function (type){ - if( jQuery && !isFileReader){ - jQuery.event.remove(el, type, fn); - } - else { - var fns = events[type] || [], i = fns.length; - - while( i-- ){ - if( fns[i] === fn ){ - fns.splice(i, 1); - break; - } - } - - if( el.addEventListener ){ el.removeEventListener(type, fn, false); } - else if( el.detachEvent ){ el.detachEvent('on'+type, fn); } - else { el['on'+type] = null; } - } - }); - } - }, - - - _one = function(el, type, fn){ - _on(el, type, function _(evt){ - _off(el, type, _); - fn(evt); - }); - }, - - - _fixEvent = function (evt){ - if( !evt.target ){ evt.target = window.event && window.event.srcElement || document; } - if( evt.target.nodeType === 3 ){ evt.target = evt.target.parentNode; } - return evt; - }, - - - _supportInputAttr = function (attr){ - var input = document.createElement('input'); - input.setAttribute('type', "file"); - return attr in input; - }, - - - /** - * FileAPI (core object) - */ - api = { - version: '2.0.19', - - cors: false, - html5: true, - media: false, - formData: true, - multiPassResize: true, - - debug: false, - pingUrl: false, - multiFlash: false, - flashAbortTimeout: 0, - withCredentials: true, - - staticPath: './dist/', - - flashUrl: 0, // @default: './FileAPI.flash.swf' - flashImageUrl: 0, // @default: './FileAPI.flash.image.swf' - - postNameConcat: function (name, idx){ - return name + (idx != null ? '['+ idx +']' : ''); - }, - - ext2mime: { - jpg: 'image/jpeg' - , tif: 'image/tiff' - , txt: 'text/plain' - }, - - // Fallback for flash - accept: { - 'image/*': 'art bm bmp dwg dxf cbr cbz fif fpx gif ico iefs jfif jpe jpeg jpg jps jut mcf nap nif pbm pcx pgm pict pm png pnm qif qtif ras rast rf rp svf tga tif tiff xbm xbm xpm xwd' - , 'audio/*': 'm4a flac aac rm mpa wav wma ogg mp3 mp2 m3u mod amf dmf dsm far gdm imf it m15 med okt s3m stm sfx ult uni xm sid ac3 dts cue aif aiff wpl ape mac mpc mpp shn wv nsf spc gym adplug adx dsp adp ymf ast afc hps xs' - , 'video/*': 'm4v 3gp nsv ts ty strm rm rmvb m3u ifo mov qt divx xvid bivx vob nrg img iso pva wmv asf asx ogm m2v avi bin dat dvr-ms mpg mpeg mp4 mkv avc vp3 svq3 nuv viv dv fli flv wpl' - }, - - uploadRetry : 0, - networkDownRetryTimeout : 5000, // milliseconds, don't flood when network is down - - chunkSize : 0, - chunkUploadRetry : 0, - chunkNetworkDownRetryTimeout : 2000, // milliseconds, don't flood when network is down - - KB: _SIZE_CONST(1), - MB: _SIZE_CONST(2), - GB: _SIZE_CONST(3), - TB: _SIZE_CONST(4), - - EMPTY_PNG: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=', - - expando: 'fileapi' + (new Date).getTime(), - - uid: function (obj){ - return obj - ? (obj[api.expando] = obj[api.expando] || api.uid()) - : (++gid, api.expando + gid) - ; - }, - - log: function (){ - if( api.debug && _supportConsoleLog ){ - if( _supportConsoleLogApply ){ - console.log.apply(console, arguments); - } - else { - console.log([].join.call(arguments, ' ')); - } - } - }, - - /** - * Create new image - * - * @param {String} [src] - * @param {Function} [fn] 1. error -- boolean, 2. img -- Image element - * @returns {HTMLElement} - */ - newImage: function (src, fn){ - var img = document.createElement('img'); - if( fn ){ - api.event.one(img, 'error load', function (evt){ - fn(evt.type == 'error', img); - img = null; - }); - } - img.src = src; - return img; - }, - - /** - * Get XHR - * @returns {XMLHttpRequest} - */ - getXHR: function (){ - var xhr; - - if( XMLHttpRequest ){ - xhr = new XMLHttpRequest; - } - else if( window.ActiveXObject ){ - try { - xhr = new ActiveXObject('MSXML2.XMLHttp.3.0'); - } catch (e) { - xhr = new ActiveXObject('Microsoft.XMLHTTP'); - } - } - - return xhr; - }, - - isArray: _isArray, - - support: { - dnd: cors && ('ondrop' in document.createElement('div')), - cors: cors, - html5: html5, - chunked: chunked, - dataURI: true, - accept: _supportInputAttr('accept'), - multiple: _supportInputAttr('multiple') - }, - - event: { - on: _on - , off: _off - , one: _one - , fix: _fixEvent - }, - - - throttle: function(fn, delay) { - var id, args; - - return function _throttle(){ - args = arguments; - - if( !id ){ - fn.apply(window, args); - id = setTimeout(function (){ - id = 0; - fn.apply(window, args); - }, delay); - } - }; - }, - - - F: function (){}, - - - parseJSON: function (str){ - var json; - if( window.JSON && JSON.parse ){ - json = JSON.parse(str); - } - else { - json = (new Function('return ('+str.replace(/([\r\n])/g, '\\$1')+');'))(); - } - return json; - }, - - - trim: function (str){ - str = String(str); - return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, ''); - }, - - /** - * Simple Defer - * @return {Object} - */ - defer: function (){ - var - list = [] - , result - , error - , defer = { - resolve: function (err, res){ - defer.resolve = noop; - error = err || false; - result = res; - - while( res = list.shift() ){ - res(error, result); - } - }, - - then: function (fn){ - if( error !== undef ){ - fn(error, result); - } else { - list.push(fn); - } - } - }; - - return defer; - }, - - queue: function (fn){ - var - _idx = 0 - , _length = 0 - , _fail = false - , _end = false - , queue = { - inc: function (){ - _length++; - }, - - next: function (){ - _idx++; - setTimeout(queue.check, 0); - }, - - check: function (){ - (_idx >= _length) && !_fail && queue.end(); - }, - - isFail: function (){ - return _fail; - }, - - fail: function (){ - !_fail && fn(_fail = true); - }, - - end: function (){ - if( !_end ){ - _end = true; - fn(); - } - } - } - ; - return queue; - }, - - - /** - * For each object - * - * @param {Object|Array} obj - * @param {Function} fn - * @param {*} [ctx] - */ - each: _each, - - - /** - * Async for - * @param {Array} array - * @param {Function} callback - */ - afor: function (array, callback){ - var i = 0, n = array.length; - - if( _isArray(array) && n-- ){ - (function _next(){ - callback(n != i && _next, array[i], i++); - })(); - } - else { - callback(false); - } - }, - - - /** - * Merge the contents of two or more objects together into the first object - * - * @param {Object} dst - * @return {Object} - */ - extend: _extend, - - - /** - * Is file? - * @param {File} file - * @return {Boolean} - */ - isFile: function (file){ - return _toString.call(file) === '[object File]'; - }, - - - /** - * Is blob? - * @param {Blob} blob - * @returns {Boolean} - */ - isBlob: function (blob) { - return this.isFile(blob) || (_toString.call(blob) === '[object Blob]'); - }, - - - /** - * Is canvas element - * - * @param {HTMLElement} el - * @return {Boolean} - */ - isCanvas: function (el){ - return el && _rcanvas.test(el.nodeName); - }, - - - getFilesFilter: function (filter){ - filter = typeof filter == 'string' ? filter : (filter.getAttribute && filter.getAttribute('accept') || ''); - return filter ? new RegExp('('+ filter.replace(/\./g, '\\.').replace(/,/g, '|') +')$', 'i') : /./; - }, - - - - /** - * Read as DataURL - * - * @param {File|Element} file - * @param {Function} fn - */ - readAsDataURL: function (file, fn){ - if( api.isCanvas(file) ){ - _emit(file, fn, 'load', api.toDataURL(file)); - } - else { - _readAs(file, fn, 'DataURL'); - } - }, - - - /** - * Read as Binary string - * - * @param {File} file - * @param {Function} fn - */ - readAsBinaryString: function (file, fn){ - if( _hasSupportReadAs('BinaryString') ){ - _readAs(file, fn, 'BinaryString'); - } else { - // Hello IE10! - _readAs(file, function (evt){ - if( evt.type == 'load' ){ - try { - // dataURL -> binaryString - evt.result = api.toBinaryString(evt.result); - } catch (e){ - evt.type = 'error'; - evt.message = e.toString(); - } - } - fn(evt); - }, 'DataURL'); - } - }, - - - /** - * Read as ArrayBuffer - * - * @param {File} file - * @param {Function} fn - */ - readAsArrayBuffer: function(file, fn){ - _readAs(file, fn, 'ArrayBuffer'); - }, - - - /** - * Read as text - * - * @param {File} file - * @param {String} encoding - * @param {Function} [fn] - */ - readAsText: function(file, encoding, fn){ - if( !fn ){ - fn = encoding; - encoding = 'utf-8'; - } - - _readAs(file, fn, 'Text', encoding); - }, - - - /** - * Convert image or canvas to DataURL - * - * @param {Element} el Image or Canvas element - * @param {String} [type] mime-type - * @return {String} - */ - toDataURL: function (el, type){ - if( typeof el == 'string' ){ - return el; - } - else if( el.toDataURL ){ - return el.toDataURL(type || 'image/png'); - } - }, - - - /** - * Canvert string, image or canvas to binary string - * - * @param {String|Element} val - * @return {String} - */ - toBinaryString: function (val){ - return window.atob(api.toDataURL(val).replace(_rdata, '')); - }, - - - /** - * Read file or DataURL as ImageElement - * - * @param {File|String} file - * @param {Function} fn - * @param {Boolean} [progress] - */ - readAsImage: function (file, fn, progress){ - if( api.isBlob(file) ){ - if( apiURL ){ - /** @namespace apiURL.createObjectURL */ - var data = apiURL.createObjectURL(file); - if( data === undef ){ - _emit(file, fn, 'error'); - } - else { - api.readAsImage(data, fn, progress); - } - } - else { - api.readAsDataURL(file, function (evt){ - if( evt.type == 'load' ){ - api.readAsImage(evt.result, fn, progress); - } - else if( progress || evt.type == 'error' ){ - _emit(file, fn, evt, null, { loaded: evt.loaded, total: evt.total }); - } - }); - } - } - else if( api.isCanvas(file) ){ - _emit(file, fn, 'load', file); - } - else if( _rimg.test(file.nodeName) ){ - if( file.complete ){ - _emit(file, fn, 'load', file); - } - else { - var events = 'error abort load'; - _one(file, events, function _fn(evt){ - if( evt.type == 'load' && apiURL ){ - /** @namespace apiURL.revokeObjectURL */ - apiURL.revokeObjectURL(file.src); - } - - _off(file, events, _fn); - _emit(file, fn, evt, file); - }); - } - } - else if( file.iframe ){ - _emit(file, fn, { type: 'error' }); - } - else { - // Created image - var img = api.newImage(file.dataURL || file); - api.readAsImage(img, fn, progress); - } - }, - - - /** - * Make file by name - * - * @param {String} name - * @return {Array} - */ - checkFileObj: function (name){ - var file = {}, accept = api.accept; - - if( typeof name == 'object' ){ - file = name; - } - else { - file.name = (name + '').split(/\\|\//g).pop(); - } - - if( file.type == null ){ - file.type = file.name.split('.').pop(); - } - - _each(accept, function (ext, type){ - ext = new RegExp(ext.replace(/\s/g, '|'), 'i'); - if( ext.test(file.type) || api.ext2mime[file.type] ){ - file.type = api.ext2mime[file.type] || (type.split('/')[0] +'/'+ file.type); - } - }); - - return file; - }, - - - /** - * Get drop files - * - * @param {Event} evt - * @param {Function} callback - */ - getDropFiles: function (evt, callback){ - var - files = [] - , all = [] - , items - , dataTransfer = _getDataTransfer(evt) - , transFiles = dataTransfer.files - , transItems = dataTransfer.items - , entrySupport = _isArray(transItems) && transItems[0] && _getAsEntry(transItems[0]) - , queue = api.queue(function (){ callback(files, all); }) - ; - - if( entrySupport ){ - if( normalize && transFiles ){ - var - i = transFiles.length - , file - , entry - ; - - items = new Array(i); - while( i-- ){ - file = transFiles[i]; - - try { - entry = _getAsEntry(transItems[i]); - } - catch( err ){ - api.log('[err] getDropFiles: ', err); - entry = null; - } - - if( _isEntry(entry) ){ - // OSX filesystems use Unicode Normalization Form D (NFD), - // and entry.file(…) can't read the files with the same names - if( entry.isDirectory || (entry.isFile && file.name == file.name.normalize('NFC')) ){ - items[i] = entry; - } - else { - items[i] = file; - } - } - else { - items[i] = file; - } - } - } - else { - items = transItems; - } - } - else { - items = transFiles; - } - - _each(items || [], function (item){ - queue.inc(); - - try { - if( entrySupport && _isEntry(item) ){ - _readEntryAsFiles(item, function (err, entryFiles, allEntries){ - if( err ){ - api.log('[err] getDropFiles:', err); - } else { - files.push.apply(files, entryFiles); - } - all.push.apply(all, allEntries); - - queue.next(); - }); - } - else { - _isRegularFile(item, function (yes, err){ - if( yes ){ - files.push(item); - } - else { - item.error = err; - } - all.push(item); - - queue.next(); - }); - } - } - catch( err ){ - queue.next(); - api.log('[err] getDropFiles: ', err); - } - }); - - queue.check(); - }, - - - /** - * Get file list - * - * @param {HTMLInputElement|Event} input - * @param {String|Function} [filter] - * @param {Function} [callback] - * @return {Array|Null} - */ - getFiles: function (input, filter, callback){ - var files = []; - - if( callback ){ - api.filterFiles(api.getFiles(input), filter, callback); - return null; - } - - if( input.jquery ){ - // jQuery object - input.each(function (){ - files = files.concat(api.getFiles(this)); - }); - input = files; - files = []; - } - - if( typeof filter == 'string' ){ - filter = api.getFilesFilter(filter); - } - - if( input.originalEvent ){ - // jQuery event - input = _fixEvent(input.originalEvent); - } - else if( input.srcElement ){ - // IE Event - input = _fixEvent(input); - } - - - if( input.dataTransfer ){ - // Drag'n'Drop - input = input.dataTransfer; - } - else if( input.target ){ - // Event - input = input.target; - } - - if( input.files ){ - // Input[type="file"] - files = input.files; - - if( !html5 ){ - // Partial support for file api - files[0].blob = input; - files[0].iframe = true; - } - } - else if( !html5 && isInputFile(input) ){ - if( api.trim(input.value) ){ - files = [api.checkFileObj(input.value)]; - files[0].blob = input; - files[0].iframe = true; - } - } - else if( _isArray(input) ){ - files = input; - } - - return api.filter(files, function (file){ return !filter || filter.test(file.name); }); - }, - - - /** - * Get total file size - * @param {Array} files - * @return {Number} - */ - getTotalSize: function (files){ - var size = 0, i = files && files.length; - while( i-- ){ - size += files[i].size; - } - return size; - }, - - - /** - * Get image information - * - * @param {File} file - * @param {Function} fn - */ - getInfo: function (file, fn){ - var info = {}, readers = _infoReader.concat(); - - if( api.isBlob(file) ){ - (function _next(){ - var reader = readers.shift(); - if( reader ){ - if( reader.test(file.type) ){ - reader(file, function (err, res){ - if( err ){ - fn(err); - } - else { - _extend(info, res); - _next(); - } - }); - } - else { - _next(); - } - } - else { - fn(false, info); - } - })(); - } - else { - fn('not_support_info', info); - } - }, - - - /** - * Add information reader - * - * @param {RegExp} mime - * @param {Function} fn - */ - addInfoReader: function (mime, fn){ - fn.test = function (type){ return mime.test(type); }; - _infoReader.push(fn); - }, - - - /** - * Filter of array - * - * @param {Array} input - * @param {Function} fn - * @return {Array} - */ - filter: function (input, fn){ - var result = [], i = 0, n = input.length, val; - - for( ; i < n; i++ ){ - if( i in input ){ - val = input[i]; - if( fn.call(val, val, i, input) ){ - result.push(val); - } - } - } - - return result; - }, - - - /** - * Filter files - * - * @param {Array} files - * @param {Function} eachFn - * @param {Function} resultFn - */ - filterFiles: function (files, eachFn, resultFn){ - if( files.length ){ - // HTML5 or Flash - var queue = files.concat(), file, result = [], deleted = []; - - (function _next(){ - if( queue.length ){ - file = queue.shift(); - api.getInfo(file, function (err, info){ - (eachFn(file, err ? false : info) ? result : deleted).push(file); - _next(); - }); - } - else { - resultFn(result, deleted); - } - })(); - } - else { - resultFn([], files); - } - }, - - - upload: function (options){ - options = _extend({ - jsonp: 'callback' - , prepare: api.F - , beforeupload: api.F - , upload: api.F - , fileupload: api.F - , fileprogress: api.F - , filecomplete: api.F - , progress: api.F - , complete: api.F - , pause: api.F - , imageOriginal: true - , chunkSize: api.chunkSize - , chunkUploadRetry: api.chunkUploadRetry - , uploadRetry: api.uploadRetry - }, options); - - - if( options.imageAutoOrientation && !options.imageTransform ){ - options.imageTransform = { rotate: 'auto' }; - } - - - var - proxyXHR = new api.XHR(options) - , dataArray = this._getFilesDataArray(options.files) - , _this = this - , _total = 0 - , _loaded = 0 - , _nextFile - , _complete = false - ; - - - // calc total size - _each(dataArray, function (data){ - _total += data.size; - }); - - // Array of files - proxyXHR.files = []; - _each(dataArray, function (data){ - proxyXHR.files.push(data.file); - }); - - // Set upload status props - proxyXHR.total = _total; - proxyXHR.loaded = 0; - proxyXHR.filesLeft = dataArray.length; - - // emit "beforeupload" event - options.beforeupload(proxyXHR, options); - - // Upload by file - _nextFile = function (){ - var - data = dataArray.shift() - , _file = data && data.file - , _fileLoaded = false - , _fileOptions = _simpleClone(options) - ; - - proxyXHR.filesLeft = dataArray.length; - - if( _file && _file.name === api.expando ){ - _file = null; - api.log('[warn] FileAPI.upload() — called without files'); - } - - if( ( proxyXHR.statusText != 'abort' || proxyXHR.current ) && data ){ - // Mark active job - _complete = false; - - // Set current upload file - proxyXHR.currentFile = _file; - - // Prepare file options - if (_file && options.prepare(_file, _fileOptions) === false) { - _nextFile.call(_this); - return; - } - _fileOptions.file = _file; - - _this._getFormData(_fileOptions, data, function (form){ - if( !_loaded ){ - // emit "upload" event - options.upload(proxyXHR, options); - } - - var xhr = new api.XHR(_extend({}, _fileOptions, { - - upload: _file ? function (){ - // emit "fileupload" event - options.fileupload(_file, xhr, _fileOptions); - } : noop, - - progress: _file ? function (evt){ - if( !_fileLoaded ){ - // For ignore the double calls. - _fileLoaded = (evt.loaded === evt.total); - - // emit "fileprogress" event - options.fileprogress({ - type: 'progress' - , total: data.total = evt.total - , loaded: data.loaded = evt.loaded - }, _file, xhr, _fileOptions); - - // emit "progress" event - options.progress({ - type: 'progress' - , total: _total - , loaded: proxyXHR.loaded = (_loaded + data.size * (evt.loaded/evt.total)) || 0 - }, _file, xhr, _fileOptions); - } - } : noop, - - complete: function (err){ - _each(_xhrPropsExport, function (name){ - proxyXHR[name] = xhr[name]; - }); - - if( _file ){ - data.total = (data.total || data.size); - data.loaded = data.total; - - if( !err ) { - // emulate 100% "progress" - this.progress(data); - - // fixed throttle event - _fileLoaded = true; - - // bytes loaded - _loaded += data.size; // data.size != data.total, it's desirable fix this - proxyXHR.loaded = _loaded; - } - - // emit "filecomplete" event - options.filecomplete(err, xhr, _file, _fileOptions); - } - - // upload next file - setTimeout(function () {_nextFile.call(_this);}, 0); - } - })); // xhr - - - // ... - proxyXHR.abort = function (current){ - if (!current) { dataArray.length = 0; } - this.current = current; - xhr.abort(); - }; - - // Start upload - xhr.send(form); - }); - } - else { - var successful = proxyXHR.status == 200 || proxyXHR.status == 201 || proxyXHR.status == 204; - options.complete(successful ? false : (proxyXHR.statusText || 'error'), proxyXHR, options); - // Mark done state - _complete = true; - } - }; - - - // Next tick - setTimeout(_nextFile, 0); - - - // Append more files to the existing request - // first - add them to the queue head/tail - proxyXHR.append = function (files, first) { - files = api._getFilesDataArray([].concat(files)); - - _each(files, function (data) { - _total += data.size; - proxyXHR.files.push(data.file); - if (first) { - dataArray.unshift(data); - } else { - dataArray.push(data); - } - }); - - proxyXHR.statusText = ""; - - if( _complete ){ - _nextFile.call(_this); - } - }; - - - // Removes file from queue by file reference and returns it - proxyXHR.remove = function (file) { - var i = dataArray.length, _file; - while( i-- ){ - if( dataArray[i].file == file ){ - _file = dataArray.splice(i, 1); - _total -= _file.size; - } - } - return _file; - }; - - return proxyXHR; - }, - - - _getFilesDataArray: function (data){ - var files = [], oFiles = {}; - - if( isInputFile(data) ){ - var tmp = api.getFiles(data); - oFiles[data.name || 'file'] = data.getAttribute('multiple') !== null ? tmp : tmp[0]; - } - else if( _isArray(data) && isInputFile(data[0]) ){ - _each(data, function (input){ - oFiles[input.name || 'file'] = api.getFiles(input); - }); - } - else { - oFiles = data; - } - - _each(oFiles, function add(file, name){ - if( _isArray(file) ){ - _each(file, function (file){ - add(file, name); - }); - } - else if( file && (file.name || file.image) ){ - files.push({ - name: name - , file: file - , size: file.size - , total: file.size - , loaded: 0 - }); - } - }); - - if( !files.length ){ - // Create fake `file` object - files.push({ file: { name: api.expando } }); - } - - return files; - }, - - - _getFormData: function (options, data, fn){ - var - file = data.file - , name = data.name - , filename = file.name - , filetype = file.type - , trans = api.support.transform && options.imageTransform - , Form = new api.Form - , queue = api.queue(function (){ fn(Form); }) - , isOrignTrans = trans && _isOriginTransform(trans) - , postNameConcat = api.postNameConcat - ; - - // Append data - _each(options.data, function add(val, name){ - if( typeof val == 'object' ){ - _each(val, function (v, i){ - add(v, postNameConcat(name, i)); - }); - } - else { - Form.append(name, val); - } - }); - - (function _addFile(file/**Object*/){ - if( file.image ){ // This is a FileAPI.Image - queue.inc(); - - file.toData(function (err, image){ - // @todo: требует рефакторинга и обработки ошибки - if (file.file) { - image.type = file.file.type; - image.quality = file.matrix.quality; - filename = file.file && file.file.name; - } - - filename = filename || (new Date).getTime()+'.png'; - - _addFile(image); - queue.next(); - }); - } - else if( api.Image && trans && (/^image/.test(file.type) || _rimgcanvas.test(file.nodeName)) ){ - queue.inc(); - - if( isOrignTrans ){ - // Convert to array for transform function - trans = [trans]; - } - - api.Image.transform(file, trans, options.imageAutoOrientation, function (err, images){ - if( isOrignTrans && !err ){ - if( !dataURLtoBlob && !api.flashEngine ){ - // Canvas.toBlob or Flash not supported, use multipart - Form.multipart = true; - } - - Form.append(name, images[0], filename, trans[0].type || filetype); - } - else { - var addOrigin = 0; - - if( !err ){ - _each(images, function (image, idx){ - if( !dataURLtoBlob && !api.flashEngine ){ - Form.multipart = true; - } - - if( !trans[idx].postName ){ - addOrigin = 1; - } - - Form.append(trans[idx].postName || postNameConcat(name, idx), image, filename, trans[idx].type || filetype); - }); - } - - if( err || options.imageOriginal ){ - Form.append(postNameConcat(name, (addOrigin ? 'original' : null)), file, filename, filetype); - } - } - - queue.next(); - }); - } - else if( filename !== api.expando ){ - Form.append(name, file, filename); - } - })(file); - - queue.check(); - }, - - - reset: function (inp, notRemove){ - var parent, clone; - - if( jQuery ){ - clone = jQuery(inp).clone(true).insertBefore(inp).val('')[0]; - if( !notRemove ){ - jQuery(inp).remove(); - } - } else { - parent = inp.parentNode; - clone = parent.insertBefore(inp.cloneNode(true), inp); - clone.value = ''; - - if( !notRemove ){ - parent.removeChild(inp); - } - - _each(_elEvents[api.uid(inp)], function (fns, type){ - _each(fns, function (fn){ - _off(inp, type, fn); - _on(clone, type, fn); - }); - }); - } - - return clone; - }, - - - /** - * Load remote file - * - * @param {String} url - * @param {Function} fn - * @return {XMLHttpRequest} - */ - load: function (url, fn){ - var xhr = api.getXHR(); - if( xhr ){ - xhr.open('GET', url, true); - - if( xhr.overrideMimeType ){ - xhr.overrideMimeType('text/plain; charset=x-user-defined'); - } - - _on(xhr, 'progress', function (/**Event*/evt){ - /** @namespace evt.lengthComputable */ - if( evt.lengthComputable ){ - fn({ type: evt.type, loaded: evt.loaded, total: evt.total }, xhr); - } - }); - - xhr.onreadystatechange = function(){ - if( xhr.readyState == 4 ){ - xhr.onreadystatechange = null; - if( xhr.status == 200 ){ - url = url.split('/'); - /** @namespace xhr.responseBody */ - var file = { - name: url[url.length-1] - , size: xhr.getResponseHeader('Content-Length') - , type: xhr.getResponseHeader('Content-Type') - }; - file.dataURL = 'data:'+file.type+';base64,' + api.encode64(xhr.responseBody || xhr.responseText); - fn({ type: 'load', result: file }, xhr); - } - else { - fn({ type: 'error' }, xhr); - } - } - }; - xhr.send(null); - } else { - fn({ type: 'error' }); - } - - return xhr; - }, - - encode64: function (str){ - var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=', outStr = '', i = 0; - - if( typeof str !== 'string' ){ - str = String(str); - } - - while( i < str.length ){ - //all three "& 0xff" added below are there to fix a known bug - //with bytes returned by xhr.responseText - var - byte1 = str.charCodeAt(i++) & 0xff - , byte2 = str.charCodeAt(i++) & 0xff - , byte3 = str.charCodeAt(i++) & 0xff - , enc1 = byte1 >> 2 - , enc2 = ((byte1 & 3) << 4) | (byte2 >> 4) - , enc3, enc4 - ; - - if( isNaN(byte2) ){ - enc3 = enc4 = 64; - } else { - enc3 = ((byte2 & 15) << 2) | (byte3 >> 6); - enc4 = isNaN(byte3) ? 64 : byte3 & 63; - } - - outStr += b64.charAt(enc1) + b64.charAt(enc2) + b64.charAt(enc3) + b64.charAt(enc4); - } - - return outStr; - } - - } // api - ; - - - function _emit(target, fn, name, res, ext){ - var evt = { - type: name.type || name - , target: target - , result: res - }; - _extend(evt, ext); - fn(evt); - } - - - function _hasSupportReadAs(method){ - return FileReader && !!FileReader.prototype['readAs' + method]; - } - - - function _readAs(file, fn, method, encoding){ - if( api.isBlob(file) && _hasSupportReadAs(method) ){ - var Reader = new FileReader; - - // Add event listener - _on(Reader, _readerEvents, function _fn(evt){ - var type = evt.type; - if( type == 'progress' ){ - _emit(file, fn, evt, evt.target.result, { loaded: evt.loaded, total: evt.total }); - } - else if( type == 'loadend' ){ - _off(Reader, _readerEvents, _fn); - Reader = null; - } - else { - _emit(file, fn, evt, evt.target.result); - } - }); - - - try { - // ReadAs ... - if( encoding ){ - Reader['readAs' + method](file, encoding); - } - else { - Reader['readAs' + method](file); - } - } - catch (err){ - _emit(file, fn, 'error', undef, { error: err.toString() }); - } - } - else { - _emit(file, fn, 'error', undef, { error: 'filreader_not_support_' + method }); - } - } - - - function _isRegularFile(file, callback){ - // http://stackoverflow.com/questions/8856628/detecting-folders-directories-in-javascript-filelist-objects - if( !file.type && (safari || ((file.size % 4096) === 0 && (file.size <= 102400))) ){ - if( FileReader ){ - try { - var reader = new FileReader(); - - _one(reader, _readerEvents, function (evt){ - var isFile = evt.type != 'error'; - if( isFile ){ - if ( reader.readyState == null || reader.readyState === reader.LOADING ) { - reader.abort(); - } - callback(isFile); - } - else { - callback(false, reader.error); - } - }); - - reader.readAsDataURL(file); - } catch( err ){ - callback(false, err); - } - } - else { - callback(null, new Error('FileReader is not supported')); - } - } - else { - callback(true); - } - } - - - function _isEntry(item){ - return item && (item.isFile || item.isDirectory); - } - - - function _getAsEntry(item){ - var entry; - if( item.getAsEntry ){ entry = item.getAsEntry(); } - else if( item.webkitGetAsEntry ){ entry = item.webkitGetAsEntry(); } - return entry; - } - - - function _readEntryAsFiles(entry, callback){ - if( !entry ){ - // error - var err = new Error('invalid entry'); - entry = new Object(entry); - entry.error = err; - callback(err.message, [], [entry]); - } - else if( entry.isFile ){ - // Read as file - entry.file(function (file){ - // success - file.fullPath = entry.fullPath; - callback(false, [file], [file]); - }, function (err){ - // error - entry.error = err; - callback('FileError.code: ' + err.code, [], [entry]); - }); - } - else if( entry.isDirectory ){ - var - reader = entry.createReader() - , firstAttempt = true - , files = [] - , all = [entry] - ; - - var onerror = function (err){ - // error - entry.error = err; - callback('DirectoryError.code: ' + err.code, files, all); - }; - var ondone = function ondone(entries){ - if( firstAttempt ){ - firstAttempt = false; - if( !entries.length ){ - entry.error = new Error('directory is empty'); - } - } - - // success - if( entries.length ){ - api.afor(entries, function (next, entry){ - _readEntryAsFiles(entry, function (err, entryFiles, allEntries){ - if( !err ){ - files = files.concat(entryFiles); - } - all = all.concat(allEntries); - - if( next ){ - next(); - } - else { - reader.readEntries(ondone, onerror); - } - }); - }); - } - else { - callback(false, files, all); - } - }; - - reader.readEntries(ondone, onerror); - } - else { - _readEntryAsFiles(_getAsEntry(entry), callback); - } - } - - - function _simpleClone(obj){ - var copy = {}; - _each(obj, function (val, key){ - if( val && (typeof val === 'object') && (val.nodeType === void 0) ){ - val = _extend({}, val); - } - copy[key] = val; - }); - return copy; - } - - - function isInputFile(el){ - return _rinput.test(el && el.tagName); - } - - - function _getDataTransfer(evt){ - return (evt.originalEvent || evt || '').dataTransfer || {}; - } - - - function _isOriginTransform(trans){ - var key; - for( key in trans ){ - if( trans.hasOwnProperty(key) ){ - if( !(trans[key] instanceof Object || key === 'overlay' || key === 'filter') ){ - return true; - } - } - } - return false; - } - - - // Add default image info reader - api.addInfoReader(/^image/, function (file/**File*/, callback/**Function*/){ - if( !file.__dimensions ){ - var defer = file.__dimensions = api.defer(); - - api.readAsImage(file, function (evt){ - var img = evt.target; - defer.resolve(evt.type == 'load' ? false : 'error', { - width: img.width - , height: img.height - }); - img.src = api.EMPTY_PNG; - img = null; - }); - } - - file.__dimensions.then(callback); - }); - - - /** - * Drag'n'Drop special event - * - * @param {HTMLElement} el - * @param {Function} onHover - * @param {Function} onDrop - */ - api.event.dnd = function (el, onHover, onDrop){ - var _id, _type; - - if( !onDrop ){ - onDrop = onHover; - onHover = api.F; - } - - if( FileReader ){ - // Hover - _on(el, 'dragenter dragleave dragover', onHover.ff = onHover.ff || function (evt){ - var - types = _getDataTransfer(evt).types - , i = types && types.length - , debounceTrigger = false - ; - - while( i-- ){ - if( ~types[i].indexOf('File') ){ - evt[preventDefault](); - - if( _type !== evt.type ){ - _type = evt.type; // Store current type of event - - if( _type != 'dragleave' ){ - onHover.call(evt[currentTarget], true, evt); - } - - debounceTrigger = true; - } - - break; // exit from "while" - } - } - - if( debounceTrigger ){ - clearTimeout(_id); - _id = setTimeout(function (){ - onHover.call(evt[currentTarget], _type != 'dragleave', evt); - }, 50); - } - }); - - - // Drop - _on(el, 'drop', onDrop.ff = onDrop.ff || function (evt){ - evt[preventDefault](); - - _type = 0; - onHover.call(evt[currentTarget], false, evt); - - api.getDropFiles(evt, function (files, all){ - onDrop.call(evt[currentTarget], files, all, evt); - }); - }); - } - else { - api.log("Drag'n'Drop -- not supported"); - } - }; - - - /** - * Remove drag'n'drop - * @param {HTMLElement} el - * @param {Function} onHover - * @param {Function} onDrop - */ - api.event.dnd.off = function (el, onHover, onDrop){ - _off(el, 'dragenter dragleave dragover', onHover.ff); - _off(el, 'drop', onDrop.ff); - }; - - - // Support jQuery - if( jQuery && !jQuery.fn.dnd ){ - jQuery.fn.dnd = function (onHover, onDrop){ - return this.each(function (){ - api.event.dnd(this, onHover, onDrop); - }); - }; - - jQuery.fn.offdnd = function (onHover, onDrop){ - return this.each(function (){ - api.event.dnd.off(this, onHover, onDrop); - }); - }; - } - - // @export - window.FileAPI = _extend(api, window.FileAPI); - - - // Debug info - api.log('FileAPI: ' + api.version); - api.log('protocol: ' + window.location.protocol); - api.log('doctype: [' + doctype.name + '] ' + doctype.publicId + ' ' + doctype.systemId); - - - // @detect 'x-ua-compatible' - _each(document.getElementsByTagName('meta'), function (meta){ - if( /x-ua-compatible/i.test(meta.getAttribute('http-equiv')) ){ - api.log('meta.http-equiv: ' + meta.getAttribute('content')); - } - }); - - - // Configuration - try { - _supportConsoleLog = !!console.log; - _supportConsoleLogApply = !!console.log.apply; - } - catch (err) {} - - if( !api.flashUrl ){ api.flashUrl = api.staticPath + 'FileAPI.flash.swf'; } - if( !api.flashImageUrl ){ api.flashImageUrl = api.staticPath + 'FileAPI.flash.image.swf'; } - if( !api.flashWebcamUrl ){ api.flashWebcamUrl = api.staticPath + 'FileAPI.flash.camera.swf'; } -})(window, void 0); - -/*global window, FileAPI, document */ - -(function (api, document, undef) { - 'use strict'; - - var - min = Math.min, - round = Math.round, - getCanvas = function () { return document.createElement('canvas'); }, - support = false, - exifOrientation = { - 8: 270 - , 3: 180 - , 6: 90 - , 7: 270 - , 4: 180 - , 5: 90 - } - ; - - try { - support = getCanvas().toDataURL('image/png').indexOf('data:image/png') > -1; - } - catch (e){} - - - function Image(file){ - if( file instanceof Image ){ - var img = new Image(file.file); - api.extend(img.matrix, file.matrix); - return img; - } - else if( !(this instanceof Image) ){ - return new Image(file); - } - - this.file = file; - this.size = file.size || 100; - - this.matrix = { - sx: 0, - sy: 0, - sw: 0, - sh: 0, - dx: 0, - dy: 0, - dw: 0, - dh: 0, - resize: 0, // min, max OR preview - deg: 0, - quality: 1, // jpeg quality - filter: 0 - }; - } - - - Image.prototype = { - image: true, - constructor: Image, - - set: function (attrs){ - api.extend(this.matrix, attrs); - return this; - }, - - crop: function (x, y, w, h){ - if( w === undef ){ - w = x; - h = y; - x = y = 0; - } - return this.set({ sx: x, sy: y, sw: w, sh: h || w }); - }, - - resize: function (w, h, strategy){ - if( /min|max|height|width/.test(h) ){ - strategy = h; - h = w; - } - - return this.set({ dw: w, dh: h || w, resize: strategy }); - }, - - preview: function (w, h){ - return this.resize(w, h || w, 'preview'); - }, - - rotate: function (deg){ - return this.set({ deg: deg }); - }, - - filter: function (filter){ - return this.set({ filter: filter }); - }, - - overlay: function (images){ - return this.set({ overlay: images }); - }, - - clone: function (){ - return new Image(this); - }, - - _load: function (image, fn){ - var self = this; - - if( /img|video/i.test(image.nodeName) ){ - fn.call(self, null, image); - } - else { - api.readAsImage(image, function (evt){ - fn.call(self, evt.type != 'load', evt.result); - }); - } - }, - - _apply: function (image, fn){ - var - canvas = getCanvas() - , m = this.getMatrix(image) - , ctx = canvas.getContext('2d') - , width = image.videoWidth || image.width - , height = image.videoHeight || image.height - , deg = m.deg - , dw = m.dw - , dh = m.dh - , w = width - , h = height - , filter = m.filter - , copy // canvas copy - , buffer = image - , overlay = m.overlay - , queue = api.queue(function (){ image.src = api.EMPTY_PNG; fn(false, canvas); }) - , renderImageToCanvas = api.renderImageToCanvas - ; - - // Normalize angle - deg = deg - Math.floor(deg/360)*360; - - // For `renderImageToCanvas` - image._type = this.file.type; - - while(m.multipass && min(w/dw, h/dh) > 2 ){ - w = (w/2 + 0.5)|0; - h = (h/2 + 0.5)|0; - - copy = getCanvas(); - copy.width = w; - copy.height = h; - - if( buffer !== image ){ - renderImageToCanvas(copy, buffer, 0, 0, buffer.width, buffer.height, 0, 0, w, h); - buffer = copy; - } - else { - buffer = copy; - renderImageToCanvas(buffer, image, m.sx, m.sy, m.sw, m.sh, 0, 0, w, h); - m.sx = m.sy = m.sw = m.sh = 0; - } - } - - - canvas.width = (deg % 180) ? dh : dw; - canvas.height = (deg % 180) ? dw : dh; - - canvas.type = m.type; - canvas.quality = m.quality; - - ctx.rotate(deg * Math.PI / 180); - renderImageToCanvas(ctx.canvas, buffer - , m.sx, m.sy - , m.sw || buffer.width - , m.sh || buffer.height - , (deg == 180 || deg == 270 ? -dw : 0) - , (deg == 90 || deg == 180 ? -dh : 0) - , dw, dh - ); - dw = canvas.width; - dh = canvas.height; - - // Apply overlay - overlay && api.each([].concat(overlay), function (over){ - queue.inc(); - // preload - var img = new window.Image, fn = function (){ - var - x = over.x|0 - , y = over.y|0 - , w = over.w || img.width - , h = over.h || img.height - , rel = over.rel - ; - - // center | right | left - x = (rel == 1 || rel == 4 || rel == 7) ? (dw - w + x)/2 : (rel == 2 || rel == 5 || rel == 8 ? dw - (w + x) : x); - - // center | bottom | top - y = (rel == 3 || rel == 4 || rel == 5) ? (dh - h + y)/2 : (rel >= 6 ? dh - (h + y) : y); - - api.event.off(img, 'error load abort', fn); - - try { - ctx.globalAlpha = over.opacity || 1; - ctx.drawImage(img, x, y, w, h); - } - catch (er){} - - queue.next(); - }; - - api.event.on(img, 'error load abort', fn); - img.src = over.src; - - if( img.complete ){ - fn(); - } - }); - - if( filter ){ - queue.inc(); - Image.applyFilter(canvas, filter, queue.next); - } - - queue.check(); - }, - - getMatrix: function (image){ - var - m = api.extend({}, this.matrix) - , sw = m.sw = m.sw || image.videoWidth || image.naturalWidth || image.width - , sh = m.sh = m.sh || image.videoHeight || image.naturalHeight || image.height - , dw = m.dw = m.dw || sw - , dh = m.dh = m.dh || sh - , sf = sw/sh, df = dw/dh - , strategy = m.resize - ; - - if( strategy == 'preview' ){ - if( dw != sw || dh != sh ){ - // Make preview - var w, h; - - if( df >= sf ){ - w = sw; - h = w / df; - } else { - h = sh; - w = h * df; - } - - if( w != sw || h != sh ){ - m.sx = ~~((sw - w)/2); - m.sy = ~~((sh - h)/2); - sw = w; - sh = h; - } - } - } - else if( strategy == 'height' ){ - dw = dh * sf; - } - else if( strategy == 'width' ){ - dh = dw / sf; - } - else if( strategy ){ - if( !(sw > dw || sh > dh) ){ - dw = sw; - dh = sh; - } - else if( strategy == 'min' ){ - dw = round(sf < df ? min(sw, dw) : dh*sf); - dh = round(sf < df ? dw/sf : min(sh, dh)); - } - else { - dw = round(sf >= df ? min(sw, dw) : dh*sf); - dh = round(sf >= df ? dw/sf : min(sh, dh)); - } - } - - m.sw = sw; - m.sh = sh; - m.dw = dw; - m.dh = dh; - m.multipass = api.multiPassResize; - return m; - }, - - _trans: function (fn){ - this._load(this.file, function (err, image){ - if( err ){ - fn(err); - } - else { - try { - this._apply(image, fn); - } catch (err){ - api.log('[err] FileAPI.Image.fn._apply:', err); - fn(err); - } - } - }); - }, - - - get: function (fn){ - if( api.support.transform ){ - var _this = this, matrix = _this.matrix; - - if( matrix.deg == 'auto' ){ - api.getInfo(_this.file, function (err, info){ - // rotate by exif orientation - matrix.deg = exifOrientation[info && info.exif && info.exif.Orientation] || 0; - _this._trans(fn); - }); - } - else { - _this._trans(fn); - } - } - else { - fn('not_support_transform'); - } - - return this; - }, - - - toData: function (fn){ - return this.get(fn); - } - - }; - - - Image.exifOrientation = exifOrientation; - - - Image.transform = function (file, transform, autoOrientation, fn){ - function _transform(err, img){ - // img -- info object - var - images = {} - , queue = api.queue(function (err){ - fn(err, images); - }) - ; - - if( !err ){ - api.each(transform, function (params, name){ - if( !queue.isFail() ){ - var ImgTrans = new Image(img.nodeType ? img : file), isFn = typeof params == 'function'; - - if( isFn ){ - params(img, ImgTrans); - } - else if( params.width ){ - ImgTrans[params.preview ? 'preview' : 'resize'](params.width, params.height, params.strategy); - } - else { - if( params.maxWidth && (img.width > params.maxWidth || img.height > params.maxHeight) ){ - ImgTrans.resize(params.maxWidth, params.maxHeight, 'max'); - } - } - - if( params.crop ){ - var crop = params.crop; - ImgTrans.crop(crop.x|0, crop.y|0, crop.w || crop.width, crop.h || crop.height); - } - - if( params.rotate === undef && autoOrientation ){ - params.rotate = 'auto'; - } - - ImgTrans.set({ type: ImgTrans.matrix.type || params.type || file.type || 'image/png' }); - - if( !isFn ){ - ImgTrans.set({ - deg: params.rotate - , overlay: params.overlay - , filter: params.filter - , quality: params.quality || 1 - }); - } - - queue.inc(); - ImgTrans.toData(function (err, image){ - if( err ){ - queue.fail(); - } - else { - images[name] = image; - queue.next(); - } - }); - } - }); - } - else { - queue.fail(); - } - } - - - // @todo: Оло-ло, нужно рефакторить это место - if( file.width ){ - _transform(false, file); - } else { - api.getInfo(file, _transform); - } - }; - - - // @const - api.each(['TOP', 'CENTER', 'BOTTOM'], function (x, i){ - api.each(['LEFT', 'CENTER', 'RIGHT'], function (y, j){ - Image[x+'_'+y] = i*3 + j; - Image[y+'_'+x] = i*3 + j; - }); - }); - - - /** - * Trabsform element to canvas - * - * @param {Image|HTMLVideoElement} el - * @returns {Canvas} - */ - Image.toCanvas = function(el){ - var canvas = document.createElement('canvas'); - canvas.width = el.videoWidth || el.width; - canvas.height = el.videoHeight || el.height; - canvas.getContext('2d').drawImage(el, 0, 0); - return canvas; - }; - - - /** - * Create image from DataURL - * @param {String} dataURL - * @param {Object} size - * @param {Function} callback - */ - Image.fromDataURL = function (dataURL, size, callback){ - var img = api.newImage(dataURL); - api.extend(img, size); - callback(img); - }; - - - /** - * Apply filter (caman.js) - * - * @param {Canvas|Image} canvas - * @param {String|Function} filter - * @param {Function} doneFn - */ - Image.applyFilter = function (canvas, filter, doneFn){ - if( typeof filter == 'function' ){ - filter(canvas, doneFn); - } - else if( window.Caman ){ - // http://camanjs.com/guides/ - window.Caman(canvas.tagName == 'IMG' ? Image.toCanvas(canvas) : canvas, function (){ - if( typeof filter == 'string' ){ - this[filter](); - } - else { - api.each(filter, function (val, method){ - this[method](val); - }, this); - } - this.render(doneFn); - }); - } - }; - - - /** - * For load-image-ios.js - */ - api.renderImageToCanvas = function (canvas, img, sx, sy, sw, sh, dx, dy, dw, dh){ - try { - return canvas.getContext('2d').drawImage(img, sx, sy, sw, sh, dx, dy, dw, dh); - } catch (ex) { - api.log('renderImageToCanvas failed'); - throw ex; - } - }; - - - // @export - api.support.canvas = api.support.transform = support; - api.Image = Image; -})(FileAPI, document); - -/* - * JavaScript Load Image iOS scaling fixes 1.0.3 - * https://github.com/blueimp/JavaScript-Load-Image - * - * Copyright 2013, Sebastian Tschan - * https://blueimp.net - * - * iOS image scaling fixes based on - * https://github.com/stomita/ios-imagefile-megapixel - * - * Licensed under the MIT license: - * http://www.opensource.org/licenses/MIT - */ - -/*jslint nomen: true, bitwise: true */ -/*global FileAPI, window, document */ - -(function (factory) { - 'use strict'; - factory(FileAPI); -}(function (loadImage) { - 'use strict'; - - // Only apply fixes on the iOS platform: - if (!window.navigator || !window.navigator.platform || - !(/iP(hone|od|ad)/).test(window.navigator.platform)) { - return; - } - - var originalRenderMethod = loadImage.renderImageToCanvas; - - // Detects subsampling in JPEG images: - loadImage.detectSubsampling = function (img) { - var canvas, - context; - if (img.width * img.height > 1024 * 1024) { // only consider mexapixel images - canvas = document.createElement('canvas'); - canvas.width = canvas.height = 1; - context = canvas.getContext('2d'); - context.drawImage(img, -img.width + 1, 0); - // subsampled image becomes half smaller in rendering size. - // check alpha channel value to confirm image is covering edge pixel or not. - // if alpha value is 0 image is not covering, hence subsampled. - return context.getImageData(0, 0, 1, 1).data[3] === 0; - } - return false; - }; - - // Detects vertical squash in JPEG images: - loadImage.detectVerticalSquash = function (img, subsampled) { - var naturalHeight = img.naturalHeight || img.height, - canvas = document.createElement('canvas'), - context = canvas.getContext('2d'), - data, - sy, - ey, - py, - alpha; - if (subsampled) { - naturalHeight /= 2; - } - canvas.width = 1; - canvas.height = naturalHeight; - context.drawImage(img, 0, 0); - data = context.getImageData(0, 0, 1, naturalHeight).data; - // search image edge pixel position in case it is squashed vertically: - sy = 0; - ey = naturalHeight; - py = naturalHeight; - while (py > sy) { - alpha = data[(py - 1) * 4 + 3]; - if (alpha === 0) { - ey = py; - } else { - sy = py; - } - py = (ey + sy) >> 1; - } - return (py / naturalHeight) || 1; - }; - - // Renders image to canvas while working around iOS image scaling bugs: - // https://github.com/blueimp/JavaScript-Load-Image/issues/13 - loadImage.renderImageToCanvas = function ( - canvas, - img, - sourceX, - sourceY, - sourceWidth, - sourceHeight, - destX, - destY, - destWidth, - destHeight - ) { - if (img._type === 'image/jpeg') { - var context = canvas.getContext('2d'), - tmpCanvas = document.createElement('canvas'), - tileSize = 1024, - tmpContext = tmpCanvas.getContext('2d'), - subsampled, - vertSquashRatio, - tileX, - tileY; - tmpCanvas.width = tileSize; - tmpCanvas.height = tileSize; - context.save(); - subsampled = loadImage.detectSubsampling(img); - if (subsampled) { - sourceX /= 2; - sourceY /= 2; - sourceWidth /= 2; - sourceHeight /= 2; - } - vertSquashRatio = loadImage.detectVerticalSquash(img, subsampled); - if (subsampled || vertSquashRatio !== 1) { - sourceY *= vertSquashRatio; - destWidth = Math.ceil(tileSize * destWidth / sourceWidth); - destHeight = Math.ceil( - tileSize * destHeight / sourceHeight / vertSquashRatio - ); - destY = 0; - tileY = 0; - while (tileY < sourceHeight) { - destX = 0; - tileX = 0; - while (tileX < sourceWidth) { - tmpContext.clearRect(0, 0, tileSize, tileSize); - tmpContext.drawImage( - img, - sourceX, - sourceY, - sourceWidth, - sourceHeight, - -tileX, - -tileY, - sourceWidth, - sourceHeight - ); - context.drawImage( - tmpCanvas, - 0, - 0, - tileSize, - tileSize, - destX, - destY, - destWidth, - destHeight - ); - tileX += tileSize; - destX += destWidth; - } - tileY += tileSize; - destY += destHeight; - } - context.restore(); - return canvas; - } - } - return originalRenderMethod( - canvas, - img, - sourceX, - sourceY, - sourceWidth, - sourceHeight, - destX, - destY, - destWidth, - destHeight - ); - }; - -})); - -/*global window, FileAPI */ - -(function (api, window){ - "use strict"; - - var - document = window.document - , FormData = window.FormData - , Form = function (){ this.items = []; } - , encodeURIComponent = window.encodeURIComponent - ; - - - Form.prototype = { - - append: function (name, blob, file, type){ - this.items.push({ - name: name - , blob: blob && blob.blob || (blob == void 0 ? '' : blob) - , file: blob && (file || blob.name) - , type: blob && (type || blob.type) - }); - }, - - each: function (fn){ - var i = 0, n = this.items.length; - for( ; i < n; i++ ){ - fn.call(this, this.items[i]); - } - }, - - toData: function (fn, options){ - // allow chunked transfer if we have only one file to send - // flag is used below and in XHR._send - options._chunked = api.support.chunked && options.chunkSize > 0 && api.filter(this.items, function (item){ return item.file; }).length == 1; - - if( !api.support.html5 ){ - api.log('FileAPI.Form.toHtmlData'); - this.toHtmlData(fn); - } - else if( !api.formData || this.multipart || !FormData ){ - api.log('FileAPI.Form.toMultipartData'); - this.toMultipartData(fn); - } - else if( options._chunked ){ - api.log('FileAPI.Form.toPlainData'); - this.toPlainData(fn); - } - else { - api.log('FileAPI.Form.toFormData'); - this.toFormData(fn); - } - }, - - _to: function (data, complete, next, arg){ - var queue = api.queue(function (){ - complete(data); - }); - - this.each(function (file){ - try{ - next(file, data, queue, arg); - } - catch( err ){ - api.log('FileAPI.Form._to: ' + err.message); - complete(err); - } - }); - - queue.check(); - }, - - - toHtmlData: function (fn){ - this._to(document.createDocumentFragment(), fn, function (file, data/**DocumentFragment*/){ - var blob = file.blob, hidden; - - if( file.file ){ - api.reset(blob, true); - // set new name - blob.name = file.name; - blob.disabled = false; - data.appendChild(blob); - } - else { - hidden = document.createElement('input'); - hidden.name = file.name; - hidden.type = 'hidden'; - hidden.value = blob; - data.appendChild(hidden); - } - }); - }, - - toPlainData: function (fn){ - this._to({}, fn, function (file, data, queue){ - if( file.file ){ - data.type = file.file; - } - - if( file.blob.toBlob ){ - // canvas - queue.inc(); - _convertFile(file, function (file, blob){ - data.name = file.name; - data.file = blob; - data.size = blob.length; - data.type = file.type; - queue.next(); - }); - } - else if( file.file ){ - // file - data.name = file.blob.name; - data.file = file.blob; - data.size = file.blob.size; - data.type = file.type; - } - else { - // additional data - if( !data.params ){ - data.params = []; - } - data.params.push(encodeURIComponent(file.name) +"="+ encodeURIComponent(file.blob)); - } - - data.start = -1; - data.end = data.file && data.file.FileAPIReadPosition || -1; - data.retry = 0; - }); - }, - - toFormData: function (fn){ - this._to(new FormData, fn, function (file, data, queue){ - if( file.blob && file.blob.toBlob ){ - queue.inc(); - _convertFile(file, function (file, blob){ - data.append(file.name, blob, file.file); - queue.next(); - }); - } - else if( file.file ){ - data.append(file.name, file.blob, file.file); - } - else { - data.append(file.name, file.blob); - } - - if( file.file ){ - data.append('_'+file.name, file.file); - } - }); - }, - - - toMultipartData: function (fn){ - this._to([], fn, function (file, data, queue, boundary){ - queue.inc(); - _convertFile(file, function (file, blob){ - data.push( - '--_' + boundary + ('\r\nContent-Disposition: form-data; name="'+ file.name +'"'+ (file.file ? '; filename="'+ encodeURIComponent(file.file) +'"' : '') - + (file.file ? '\r\nContent-Type: '+ (file.type || 'application/octet-stream') : '') - + '\r\n' - + '\r\n'+ (file.file ? blob : encodeURIComponent(blob)) - + '\r\n') - ); - queue.next(); - }, true); - }, api.expando); - } - }; - - - function _convertFile(file, fn, useBinaryString){ - var blob = file.blob, filename = file.file; - - if( filename ){ - if( !blob.toDataURL ){ - // The Blob is not an image. - api.readAsBinaryString(blob, function (evt){ - if( evt.type == 'load' ){ - fn(file, evt.result); - } - }); - return; - } - - var - mime = { 'image/jpeg': '.jpe?g', 'image/png': '.png' } - , type = mime[file.type] ? file.type : 'image/png' - , ext = mime[type] || '.png' - , quality = blob.quality || 1 - ; - - if( !filename.match(new RegExp(ext+'$', 'i')) ){ - // Does not change the current extension, but add a new one. - filename += ext.replace('?', ''); - } - - file.file = filename; - file.type = type; - - if( !useBinaryString && blob.toBlob ){ - blob.toBlob(function (blob){ - fn(file, blob); - }, type, quality); - } - else { - fn(file, api.toBinaryString(blob.toDataURL(type, quality))); - } - } - else { - fn(file, blob); - } - } - - - // @export - api.Form = Form; -})(FileAPI, window); - -/*global window, FileAPI, Uint8Array */ - -(function (window, api){ - "use strict"; - - var - noop = function (){} - , document = window.document - - , XHR = function (options){ - this.uid = api.uid(); - this.xhr = { - abort: noop - , getResponseHeader: noop - , getAllResponseHeaders: noop - }; - this.options = options; - }, - - _xhrResponsePostfix = { '': 1, XML: 1, Text: 1, Body: 1 } - ; - - - XHR.prototype = { - status: 0, - statusText: '', - constructor: XHR, - - getResponseHeader: function (name){ - return this.xhr.getResponseHeader(name); - }, - - getAllResponseHeaders: function (){ - return this.xhr.getAllResponseHeaders() || {}; - }, - - end: function (status, statusText){ - var _this = this, options = _this.options; - - _this.end = - _this.abort = noop; - _this.status = status; - - if( statusText ){ - _this.statusText = statusText; - } - - api.log('xhr.end:', status, statusText); - options.complete(status == 200 || status == 201 ? false : _this.statusText || 'unknown', _this); - - if( _this.xhr && _this.xhr.node ){ - setTimeout(function (){ - var node = _this.xhr.node; - try { node.parentNode.removeChild(node); } catch (e){} - try { delete window[_this.uid]; } catch (e){} - window[_this.uid] = _this.xhr.node = null; - }, 9); - } - }, - - abort: function (){ - this.end(0, 'abort'); - - if( this.xhr ){ - this.xhr.aborted = true; - this.xhr.abort(); - } - }, - - send: function (FormData){ - var _this = this, options = this.options; - - FormData.toData(function (data){ - if( data instanceof Error ){ - _this.end(0, data.message); - } - else{ - // Start uploading - options.upload(options, _this); - _this._send.call(_this, options, data); - } - }, options); - }, - - _send: function (options, data){ - var _this = this, xhr, uid = _this.uid, onLoadFnName = _this.uid + "Load", url = options.url; - - api.log('XHR._send:', data); - - if( !options.cache ){ - // No cache - url += (~url.indexOf('?') ? '&' : '?') + api.uid(); - } - - if( data.nodeName ){ - var jsonp = options.jsonp; - - // prepare callback in GET - url = url.replace(/([a-z]+)=(\?)/i, '$1='+uid); - - // legacy - options.upload(options, _this); - - var - onPostMessage = function (evt){ - if( ~url.indexOf(evt.origin) ){ - try { - var result = api.parseJSON(evt.data); - if( result.id == uid ){ - complete(result.status, result.statusText, result.response); - } - } catch( err ){ - complete(0, err.message); - } - } - }, - - // jsonp-callack - complete = window[uid] = function (status, statusText, response){ - _this.readyState = 4; - _this.responseText = response; - _this.end(status, statusText); - - api.event.off(window, 'message', onPostMessage); - window[uid] = xhr = transport = window[onLoadFnName] = null; - } - ; - - _this.xhr.abort = function (){ - try { - if( transport.stop ){ transport.stop(); } - else if( transport.contentWindow.stop ){ transport.contentWindow.stop(); } - else { transport.contentWindow.document.execCommand('Stop'); } - } - catch (er) {} - complete(0, "abort"); - }; - - api.event.on(window, 'message', onPostMessage); - - window[onLoadFnName] = function (){ - try { - var - win = transport.contentWindow - , doc = win.document - , result = win.result || api.parseJSON(doc.body.innerHTML) - ; - complete(result.status, result.statusText, result.response); - } catch (e){ - api.log('[transport.onload]', e); - } - }; - - xhr = document.createElement('div'); - xhr.innerHTML = '
              ' - + '' - + (jsonp && (options.url.indexOf('=?') < 0) ? '' : '') - + '' - ; - - // get form-data & transport - var - form = xhr.getElementsByTagName('form')[0] - , transport = xhr.getElementsByTagName('iframe')[0] - ; - - form.appendChild(data); - - api.log(form.parentNode.innerHTML); - - // append to DOM - document.body.appendChild(xhr); - - // keep a reference to node-transport - _this.xhr.node = xhr; - - // send - _this.readyState = 2; // loaded - try { - form.submit(); - } catch (err) { - api.log('iframe.error: ' + err); - } - form = null; - } - else { - // Clean url - url = url.replace(/([a-z]+)=(\?)&?/i, ''); - - // html5 - if (this.xhr && this.xhr.aborted) { - api.log("Error: already aborted"); - return; - } - xhr = _this.xhr = api.getXHR(); - - if (data.params) { - url += (url.indexOf('?') < 0 ? "?" : "&") + data.params.join("&"); - } - - xhr.open('POST', url, true); - - if( api.withCredentials ){ - xhr.withCredentials = "true"; - } - - if( !options.headers || !options.headers['X-Requested-With'] ){ - xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); - } - - api.each(options.headers, function (val, key){ - xhr.setRequestHeader(key, val); - }); - - - if ( options._chunked ) { - // chunked upload - if( xhr.upload ){ - xhr.upload.addEventListener('progress', api.throttle(function (/**Event*/evt){ - if (!data.retry) { - // show progress only for correct chunk uploads - options.progress({ - type: evt.type - , total: data.size - , loaded: data.start + evt.loaded - , totalSize: data.size - }, _this, options); - } - }, 100), false); - } - - xhr.onreadystatechange = function (){ - var lkb = parseInt(xhr.getResponseHeader('X-Last-Known-Byte'), 10); - - _this.status = xhr.status; - _this.statusText = xhr.statusText; - _this.readyState = xhr.readyState; - - if( xhr.readyState == 4 ){ - for( var k in _xhrResponsePostfix ){ - _this['response'+k] = xhr['response'+k]; - } - xhr.onreadystatechange = null; - - if (!xhr.status || xhr.status - 201 > 0) { - api.log("Error: " + xhr.status); - // some kind of error - // 0 - connection fail or timeout, if xhr.aborted is true, then it's not recoverable user action - // up - server error - if (((!xhr.status && !xhr.aborted) || 500 == xhr.status || 416 == xhr.status) && ++data.retry <= options.chunkUploadRetry) { - // let's try again the same chunk - // only applicable for recoverable error codes 500 && 416 - var delay = xhr.status ? 0 : api.chunkNetworkDownRetryTimeout; - - // inform about recoverable problems - options.pause(data.file, options); - - // smart restart if server reports about the last known byte - api.log("X-Last-Known-Byte: " + lkb); - if (lkb) { - data.end = lkb; - } else { - data.end = data.start - 1; - if (416 == xhr.status) { - data.end = data.end - options.chunkSize; - } - } - - setTimeout(function () { - _this._send(options, data); - }, delay); - } else { - // no mo retries - _this.end(xhr.status); - } - } else { - // success - data.retry = 0; - - if (data.end == data.size - 1) { - // finished - _this.end(xhr.status); - } else { - // next chunk - - // shift position if server reports about the last known byte - api.log("X-Last-Known-Byte: " + lkb); - if (lkb) { - data.end = lkb; - } - data.file.FileAPIReadPosition = data.end; - - setTimeout(function () { - _this._send(options, data); - }, 0); - } - } - - xhr = null; - } - }; - - data.start = data.end + 1; - data.end = Math.max(Math.min(data.start + options.chunkSize, data.size) - 1, data.start); - - // Retrieve a slice of file - var - file = data.file - , slice = (file.slice || file.mozSlice || file.webkitSlice).call(file, data.start, data.end + 1) - ; - - if( data.size && !slice.size ){ - setTimeout(function (){ - _this.end(-1); - }); - } else { - xhr.setRequestHeader("Content-Range", "bytes " + data.start + "-" + data.end + "/" + data.size); - xhr.setRequestHeader("Content-Disposition", 'attachment; filename=' + encodeURIComponent(data.name)); - xhr.setRequestHeader("Content-Type", data.type || "application/octet-stream"); - - xhr.send(slice); - } - - file = slice = null; - } else { - // single piece upload - if( xhr.upload ){ - // https://github.com/blueimp/jQuery-File-Upload/wiki/Fixing-Safari-hanging-on-very-high-speed-connections-%281Gbps%29 - xhr.upload.addEventListener('progress', api.throttle(function (/**Event*/evt){ - options.progress(evt, _this, options); - }, 100), false); - } - - xhr.onreadystatechange = function (){ - _this.status = xhr.status; - _this.statusText = xhr.statusText; - _this.readyState = xhr.readyState; - - if( xhr.readyState == 4 ){ - for( var k in _xhrResponsePostfix ){ - _this['response'+k] = xhr['response'+k]; - } - xhr.onreadystatechange = null; - - if (!xhr.status || xhr.status > 201) { - api.log("Error: " + xhr.status); - if (((!xhr.status && !xhr.aborted) || 500 == xhr.status) && (options.retry || 0) < options.uploadRetry) { - options.retry = (options.retry || 0) + 1; - var delay = api.networkDownRetryTimeout; - - // inform about recoverable problems - options.pause(options.file, options); - - setTimeout(function () { - _this._send(options, data); - }, delay); - } else { - //success - _this.end(xhr.status); - } - } else { - //success - _this.end(xhr.status); - } - - xhr = null; - } - }; - - if( api.isArray(data) ){ - // multipart - xhr.setRequestHeader('Content-Type', 'multipart/form-data; boundary=_'+api.expando); - var rawData = data.join('') +'--_'+ api.expando +'--'; - - /** @namespace xhr.sendAsBinary https://developer.mozilla.org/ru/XMLHttpRequest#Sending_binary_content */ - if( xhr.sendAsBinary ){ - xhr.sendAsBinary(rawData); - } - else { - var bytes = Array.prototype.map.call(rawData, function(c){ return c.charCodeAt(0) & 0xff; }); - xhr.send(new Uint8Array(bytes).buffer); - - } - } else { - // FormData - xhr.send(data); - } - } - } - } - }; - - - // @export - api.XHR = XHR; -})(window, FileAPI); - -/** - * @class FileAPI.Camera - * @author RubaXa - * @support Chrome 21+, FF 18+, Opera 12+ - */ - -/*global window, FileAPI, jQuery */ -/** @namespace LocalMediaStream -- https://developer.mozilla.org/en-US/docs/WebRTC/MediaStream_API#LocalMediaStream */ -(function (window, api){ - "use strict"; - - var - URL = window.URL || window.webkitURL, - - document = window.document, - navigator = window.navigator, - - getMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia, - - html5 = !!getMedia - ; - - - // Support "media" - api.support.media = html5; - - - var Camera = function (video){ - this.video = video; - }; - - - Camera.prototype = { - isActive: function (){ - return !!this._active; - }, - - - /** - * Start camera streaming - * @param {Function} callback - */ - start: function (callback){ - var - _this = this - , video = _this.video - , _successId - , _failId - , _complete = function (err){ - _this._active = !err; - clearTimeout(_failId); - clearTimeout(_successId); -// api.event.off(video, 'loadedmetadata', _complete); - callback && callback(err, _this); - } - ; - - getMedia.call(navigator, { video: true }, function (stream/**LocalMediaStream*/){ - // Success - _this.stream = stream; - -// api.event.on(video, 'loadedmetadata', function (){ -// _complete(null); -// }); - - // Set camera stream - video.src = URL.createObjectURL(stream); - - // Note: onloadedmetadata doesn't fire in Chrome when using it with getUserMedia. - // See crbug.com/110938. - _successId = setInterval(function (){ - if( _detectVideoSignal(video) ){ - _complete(null); - } - }, 1000); - - _failId = setTimeout(function (){ - _complete('timeout'); - }, 5000); - - // Go-go-go! - video.play(); - }, _complete/*error*/); - }, - - - /** - * Stop camera streaming - */ - stop: function (){ - try { - this._active = false; - this.video.pause(); - - try { - this.stream.stop(); - } catch (err) { - api.each(this.stream.getTracks(), function (track) { - track.stop(); - }); - } - - this.stream = null; - } catch( err ){ - api.log('[FileAPI.Camera] stop:', err); - } - }, - - - /** - * Create screenshot - * @return {FileAPI.Camera.Shot} - */ - shot: function (){ - return new Shot(this.video); - } - }; - - - /** - * Get camera element from container - * - * @static - * @param {HTMLElement} el - * @return {Camera} - */ - Camera.get = function (el){ - return new Camera(el.firstChild); - }; - - - /** - * Publish camera element into container - * - * @static - * @param {HTMLElement} el - * @param {Object} options - * @param {Function} [callback] - */ - Camera.publish = function (el, options, callback){ - if( typeof options == 'function' ){ - callback = options; - options = {}; - } - - // Dimensions of "camera" - options = api.extend({}, { - width: '100%' - , height: '100%' - , start: true - }, options); - - - if( el.jquery ){ - // Extract first element, from jQuery collection - el = el[0]; - } - - - var doneFn = function (err){ - if( err ){ - callback(err); - } - else { - // Get camera - var cam = Camera.get(el); - if( options.start ){ - cam.start(callback); - } - else { - callback(null, cam); - } - } - }; - - - el.style.width = _px(options.width); - el.style.height = _px(options.height); - - - if( api.html5 && html5 ){ - // Create video element - var video = document.createElement('video'); - - // Set dimensions - video.style.width = _px(options.width); - video.style.height = _px(options.height); - - // Clean container - if( window.jQuery ){ - jQuery(el).empty(); - } else { - el.innerHTML = ''; - } - - // Add "camera" to container - el.appendChild(video); - - // end - doneFn(); - } - else { - Camera.fallback(el, options, doneFn); - } - }; - - - Camera.fallback = function (el, options, callback){ - callback('not_support_camera'); - }; - - - /** - * @class FileAPI.Camera.Shot - */ - var Shot = function (video){ - var canvas = video.nodeName ? api.Image.toCanvas(video) : video; - var shot = api.Image(canvas); - shot.type = 'image/png'; - shot.width = canvas.width; - shot.height = canvas.height; - shot.size = canvas.width * canvas.height * 4; - return shot; - }; - - - /** - * Add "px" postfix, if value is a number - * - * @private - * @param {*} val - * @return {String} - */ - function _px(val){ - return val >= 0 ? val + 'px' : val; - } - - - /** - * @private - * @param {HTMLVideoElement} video - * @return {Boolean} - */ - function _detectVideoSignal(video){ - var canvas = document.createElement('canvas'), ctx, res = false; - try { - ctx = canvas.getContext('2d'); - ctx.drawImage(video, 0, 0, 1, 1); - res = ctx.getImageData(0, 0, 1, 1).data[4] != 255; - } - catch( err ){ - api.log('[FileAPI.Camera] detectVideoSignal:', err); - } - return res; - } - - - // @export - Camera.Shot = Shot; - api.Camera = Camera; -})(window, FileAPI); - -/** - * FileAPI fallback to Flash - * - * @flash-developer "Vladimir Demidov" - */ - -/*global window, FileAPI */ -(function (window, jQuery, api) { - "use strict"; - - var _each = api.each, - _cameraQueue = []; - - if (api.support.flash && (api.media && (!api.support.media || !api.html5))) { - (function () { - function _wrap(fn) { - var id = fn.wid = api.uid(); - api.Flash._fn[id] = fn; - return 'FileAPI.Flash._fn.' + id; - } - - - function _unwrap(fn) { - try { - api.Flash._fn[fn.wid] = null; - delete api.Flash._fn[fn.wid]; - } catch (e) { - } - } - - var flash = api.Flash; - api.extend(api.Flash, { - - patchCamera: function () { - api.Camera.fallback = function (el, options, callback) { - var camId = api.uid(); - api.log('FlashAPI.Camera.publish: ' + camId); - flash.publish(el, camId, api.extend(options, { - camera: true, - onEvent: _wrap(function _(evt) { - if (evt.type === 'camera') { - _unwrap(_); - - if (evt.error) { - api.log('FlashAPI.Camera.publish.error: ' + evt.error); - callback(evt.error); - } else { - api.log('FlashAPI.Camera.publish.success: ' + camId); - callback(null); - } - } - }) - })); - }; - // Run - _each(_cameraQueue, function (args) { - api.Camera.fallback.apply(api.Camera, args); - }); - _cameraQueue = []; - - - // FileAPI.Camera:proto - api.extend(api.Camera.prototype, { - _id: function () { - return this.video.id; - }, - - start: function (callback) { - var _this = this; - flash.cmd(this._id(), 'camera.on', { - callback: _wrap(function _(evt) { - _unwrap(_); - - if (evt.error) { - api.log('FlashAPI.camera.on.error: ' + evt.error); - callback(evt.error, _this); - } else { - api.log('FlashAPI.camera.on.success: ' + _this._id()); - _this._active = true; - callback(null, _this); - } - }) - }); - }, - - stop: function () { - this._active = false; - flash.cmd(this._id(), 'camera.off'); - }, - - shot: function () { - api.log('FlashAPI.Camera.shot:', this._id()); - - var shot = api.Flash.cmd(this._id(), 'shot', {}); - shot.type = 'image/png'; - shot.flashId = this._id(); - shot.isShot = true; - - return new api.Camera.Shot(shot); - } - }); - } - }); - - api.Camera.fallback = function () { - _cameraQueue.push(arguments); - }; - - }()); - } -}(window, window.jQuery, FileAPI)); +/*! FileAPI 2.0.19 - BSD | git://github.com/mailru/FileAPI.git + * FileAPI — a set of javascript tools for working with files. Multiupload, drag'n'drop and chunked file upload. Images: crop, resize and auto orientation by EXIF. + */ + +/* + * JavaScript Canvas to Blob 2.0.5 + * https://github.com/blueimp/JavaScript-Canvas-to-Blob + * + * Copyright 2012, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + * + * Based on stackoverflow user Stoive's code snippet: + * http://stackoverflow.com/q/4998908 + */ + +/*jslint nomen: true, regexp: true */ +/*global window, atob, Blob, ArrayBuffer, Uint8Array */ + +(function (window) { + 'use strict'; + var CanvasPrototype = window.HTMLCanvasElement && + window.HTMLCanvasElement.prototype, + hasBlobConstructor = window.Blob && (function () { + try { + return Boolean(new Blob()); + } catch (e) { + return false; + } + }()), + hasArrayBufferViewSupport = hasBlobConstructor && window.Uint8Array && + (function () { + try { + return new Blob([new Uint8Array(100)]).size === 100; + } catch (e) { + return false; + } + }()), + BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || + window.MozBlobBuilder || window.MSBlobBuilder, + dataURLtoBlob = (hasBlobConstructor || BlobBuilder) && window.atob && + window.ArrayBuffer && window.Uint8Array && function (dataURI) { + var byteString, + arrayBuffer, + intArray, + i, + mimeString, + bb; + if (dataURI.split(',')[0].indexOf('base64') >= 0) { + // Convert base64 to raw binary data held in a string: + byteString = atob(dataURI.split(',')[1]); + } else { + // Convert base64/URLEncoded data component to raw binary data: + byteString = decodeURIComponent(dataURI.split(',')[1]); + } + // Write the bytes of the string to an ArrayBuffer: + arrayBuffer = new ArrayBuffer(byteString.length); + intArray = new Uint8Array(arrayBuffer); + for (i = 0; i < byteString.length; i += 1) { + intArray[i] = byteString.charCodeAt(i); + } + // Separate out the mime component: + mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]; + // Write the ArrayBuffer (or ArrayBufferView) to a blob: + if (hasBlobConstructor) { + return new Blob( + [hasArrayBufferViewSupport ? intArray : arrayBuffer], + {type: mimeString} + ); + } + bb = new BlobBuilder(); + bb.append(arrayBuffer); + return bb.getBlob(mimeString); + }; + if (window.HTMLCanvasElement && !CanvasPrototype.toBlob) { + if (CanvasPrototype.mozGetAsFile) { + CanvasPrototype.toBlob = function (callback, type, quality) { + if (quality && CanvasPrototype.toDataURL && dataURLtoBlob) { + callback(dataURLtoBlob(this.toDataURL(type, quality))); + } else { + callback(this.mozGetAsFile('blob', type)); + } + }; + } else if (CanvasPrototype.toDataURL && dataURLtoBlob) { + CanvasPrototype.toBlob = function (callback, type, quality) { + callback(dataURLtoBlob(this.toDataURL(type, quality))); + }; + } + } + window.dataURLtoBlob = dataURLtoBlob; +})(window); + +/*jslint evil: true */ +/*global window, URL, webkitURL, ActiveXObject */ + +(function (window, undef){ + 'use strict'; + + var + gid = 1, + noop = function (){}, + + document = window.document, + doctype = document.doctype || {}, + userAgent = window.navigator.userAgent, + safari = /safari\//i.test(userAgent) && !/chrome\//i.test(userAgent), + iemobile = /iemobile\//i.test(userAgent), + + // https://github.com/blueimp/JavaScript-Load-Image/blob/master/load-image.js#L48 + apiURL = (window.createObjectURL && window) || (window.URL && URL.revokeObjectURL && URL) || (window.webkitURL && webkitURL), + + Blob = window.Blob, + File = window.File, + FileReader = window.FileReader, + FormData = window.FormData, + + + XMLHttpRequest = window.XMLHttpRequest, + jQuery = window.jQuery, + + html5 = !!(File && (FileReader && (window.Uint8Array || FormData || XMLHttpRequest.prototype.sendAsBinary))) + && !(safari && /windows/i.test(userAgent) && !iemobile), // BugFix: https://github.com/mailru/FileAPI/issues/25 + + cors = html5 && ('withCredentials' in (new XMLHttpRequest)), + + chunked = html5 && !!Blob && !!(Blob.prototype.webkitSlice || Blob.prototype.mozSlice || Blob.prototype.slice), + + normalize = ('' + ''.normalize).indexOf('[native code]') > 0, + + // https://github.com/blueimp/JavaScript-Canvas-to-Blob + dataURLtoBlob = window.dataURLtoBlob, + + + _rimg = /img/i, + _rcanvas = /canvas/i, + _rimgcanvas = /img|canvas/i, + _rinput = /input/i, + _rdata = /^data:[^,]+,/, + + _toString = {}.toString, + _supportConsoleLog, + _supportConsoleLogApply, + + + Math = window.Math, + + _SIZE_CONST = function (pow){ + pow = new window.Number(Math.pow(1024, pow)); + pow.from = function (sz){ return Math.round(sz * this); }; + return pow; + }, + + _elEvents = {}, // element event listeners + _infoReader = [], // list of file info processors + + _readerEvents = 'abort progress error load loadend', + _xhrPropsExport = 'status statusText readyState response responseXML responseText responseBody'.split(' '), + + currentTarget = 'currentTarget', // for minimize + preventDefault = 'preventDefault', // and this too + + _isArray = function (ar) { + return ar && ('length' in ar); + }, + + /** + * Iterate over a object or array + */ + _each = function (obj, fn, ctx){ + if( obj ){ + if( _isArray(obj) ){ + for( var i = 0, n = obj.length; i < n; i++ ){ + if( i in obj ){ + fn.call(ctx, obj[i], i, obj); + } + } + } + else { + for( var key in obj ){ + if( obj.hasOwnProperty(key) ){ + fn.call(ctx, obj[key], key, obj); + } + } + } + } + }, + + /** + * Merge the contents of two or more objects together into the first object + */ + _extend = function (dst){ + var args = arguments, i = 1, _ext = function (val, key){ dst[key] = val; }; + for( ; i < args.length; i++ ){ + _each(args[i], _ext); + } + return dst; + }, + + /** + * Add event listener + */ + _on = function (el, type, fn){ + if( el ){ + var uid = api.uid(el); + + if( !_elEvents[uid] ){ + _elEvents[uid] = {}; + } + + var isFileReader = (FileReader && el) && (el instanceof FileReader); + _each(type.split(/\s+/), function (type){ + if( jQuery && !isFileReader){ + jQuery.event.add(el, type, fn); + } else { + if( !_elEvents[uid][type] ){ + _elEvents[uid][type] = []; + } + + _elEvents[uid][type].push(fn); + + if( el.addEventListener ){ el.addEventListener(type, fn, false); } + else if( el.attachEvent ){ el.attachEvent('on'+type, fn); } + else { el['on'+type] = fn; } + } + }); + } + }, + + + /** + * Remove event listener + */ + _off = function (el, type, fn){ + if( el ){ + var uid = api.uid(el), events = _elEvents[uid] || {}; + + var isFileReader = (FileReader && el) && (el instanceof FileReader); + _each(type.split(/\s+/), function (type){ + if( jQuery && !isFileReader){ + jQuery.event.remove(el, type, fn); + } + else { + var fns = events[type] || [], i = fns.length; + + while( i-- ){ + if( fns[i] === fn ){ + fns.splice(i, 1); + break; + } + } + + if( el.addEventListener ){ el.removeEventListener(type, fn, false); } + else if( el.detachEvent ){ el.detachEvent('on'+type, fn); } + else { el['on'+type] = null; } + } + }); + } + }, + + + _one = function(el, type, fn){ + _on(el, type, function _(evt){ + _off(el, type, _); + fn(evt); + }); + }, + + + _fixEvent = function (evt){ + if( !evt.target ){ evt.target = window.event && window.event.srcElement || document; } + if( evt.target.nodeType === 3 ){ evt.target = evt.target.parentNode; } + return evt; + }, + + + _supportInputAttr = function (attr){ + var input = document.createElement('input'); + input.setAttribute('type', "file"); + return attr in input; + }, + + + /** + * FileAPI (core object) + */ + api = { + version: '2.0.19', + + cors: false, + html5: true, + media: false, + formData: true, + multiPassResize: true, + + debug: false, + pingUrl: false, + multiFlash: false, + flashAbortTimeout: 0, + withCredentials: true, + + staticPath: './dist/', + + flashUrl: 0, // @default: './FileAPI.flash.swf' + flashImageUrl: 0, // @default: './FileAPI.flash.image.swf' + + postNameConcat: function (name, idx){ + return name + (idx != null ? '['+ idx +']' : ''); + }, + + ext2mime: { + jpg: 'image/jpeg' + , tif: 'image/tiff' + , txt: 'text/plain' + }, + + // Fallback for flash + accept: { + 'image/*': 'art bm bmp dwg dxf cbr cbz fif fpx gif ico iefs jfif jpe jpeg jpg jps jut mcf nap nif pbm pcx pgm pict pm png pnm qif qtif ras rast rf rp svf tga tif tiff xbm xbm xpm xwd' + , 'audio/*': 'm4a flac aac rm mpa wav wma ogg mp3 mp2 m3u mod amf dmf dsm far gdm imf it m15 med okt s3m stm sfx ult uni xm sid ac3 dts cue aif aiff wpl ape mac mpc mpp shn wv nsf spc gym adplug adx dsp adp ymf ast afc hps xs' + , 'video/*': 'm4v 3gp nsv ts ty strm rm rmvb m3u ifo mov qt divx xvid bivx vob nrg img iso pva wmv asf asx ogm m2v avi bin dat dvr-ms mpg mpeg mp4 mkv avc vp3 svq3 nuv viv dv fli flv wpl' + }, + + uploadRetry : 0, + networkDownRetryTimeout : 5000, // milliseconds, don't flood when network is down + + chunkSize : 0, + chunkUploadRetry : 0, + chunkNetworkDownRetryTimeout : 2000, // milliseconds, don't flood when network is down + + KB: _SIZE_CONST(1), + MB: _SIZE_CONST(2), + GB: _SIZE_CONST(3), + TB: _SIZE_CONST(4), + + EMPTY_PNG: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=', + + expando: 'fileapi' + (new Date).getTime(), + + uid: function (obj){ + return obj + ? (obj[api.expando] = obj[api.expando] || api.uid()) + : (++gid, api.expando + gid) + ; + }, + + log: function (){ + if( api.debug && _supportConsoleLog ){ + if( _supportConsoleLogApply ){ + console.log.apply(console, arguments); + } + else { + console.log([].join.call(arguments, ' ')); + } + } + }, + + /** + * Create new image + * + * @param {String} [src] + * @param {Function} [fn] 1. error -- boolean, 2. img -- Image element + * @returns {HTMLElement} + */ + newImage: function (src, fn){ + var img = document.createElement('img'); + if( fn ){ + api.event.one(img, 'error load', function (evt){ + fn(evt.type == 'error', img); + img = null; + }); + } + img.src = src; + return img; + }, + + /** + * Get XHR + * @returns {XMLHttpRequest} + */ + getXHR: function (){ + var xhr; + + if( XMLHttpRequest ){ + xhr = new XMLHttpRequest; + } + else if( window.ActiveXObject ){ + try { + xhr = new ActiveXObject('MSXML2.XMLHttp.3.0'); + } catch (e) { + xhr = new ActiveXObject('Microsoft.XMLHTTP'); + } + } + + return xhr; + }, + + isArray: _isArray, + + support: { + dnd: cors && ('ondrop' in document.createElement('div')), + cors: cors, + html5: html5, + chunked: chunked, + dataURI: true, + accept: _supportInputAttr('accept'), + multiple: _supportInputAttr('multiple') + }, + + event: { + on: _on + , off: _off + , one: _one + , fix: _fixEvent + }, + + + throttle: function(fn, delay) { + var id, args; + + return function _throttle(){ + args = arguments; + + if( !id ){ + fn.apply(window, args); + id = setTimeout(function (){ + id = 0; + fn.apply(window, args); + }, delay); + } + }; + }, + + + F: function (){}, + + + parseJSON: function (str){ + var json; + if( window.JSON && JSON.parse ){ + json = JSON.parse(str); + } + else { + json = (new Function('return ('+str.replace(/([\r\n])/g, '\\$1')+');'))(); + } + return json; + }, + + + trim: function (str){ + str = String(str); + return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, ''); + }, + + /** + * Simple Defer + * @return {Object} + */ + defer: function (){ + var + list = [] + , result + , error + , defer = { + resolve: function (err, res){ + defer.resolve = noop; + error = err || false; + result = res; + + while( res = list.shift() ){ + res(error, result); + } + }, + + then: function (fn){ + if( error !== undef ){ + fn(error, result); + } else { + list.push(fn); + } + } + }; + + return defer; + }, + + queue: function (fn){ + var + _idx = 0 + , _length = 0 + , _fail = false + , _end = false + , queue = { + inc: function (){ + _length++; + }, + + next: function (){ + _idx++; + setTimeout(queue.check, 0); + }, + + check: function (){ + (_idx >= _length) && !_fail && queue.end(); + }, + + isFail: function (){ + return _fail; + }, + + fail: function (){ + !_fail && fn(_fail = true); + }, + + end: function (){ + if( !_end ){ + _end = true; + fn(); + } + } + } + ; + return queue; + }, + + + /** + * For each object + * + * @param {Object|Array} obj + * @param {Function} fn + * @param {*} [ctx] + */ + each: _each, + + + /** + * Async for + * @param {Array} array + * @param {Function} callback + */ + afor: function (array, callback){ + var i = 0, n = array.length; + + if( _isArray(array) && n-- ){ + (function _next(){ + callback(n != i && _next, array[i], i++); + })(); + } + else { + callback(false); + } + }, + + + /** + * Merge the contents of two or more objects together into the first object + * + * @param {Object} dst + * @return {Object} + */ + extend: _extend, + + + /** + * Is file? + * @param {File} file + * @return {Boolean} + */ + isFile: function (file){ + return _toString.call(file) === '[object File]'; + }, + + + /** + * Is blob? + * @param {Blob} blob + * @returns {Boolean} + */ + isBlob: function (blob) { + return this.isFile(blob) || (_toString.call(blob) === '[object Blob]'); + }, + + + /** + * Is canvas element + * + * @param {HTMLElement} el + * @return {Boolean} + */ + isCanvas: function (el){ + return el && _rcanvas.test(el.nodeName); + }, + + + getFilesFilter: function (filter){ + filter = typeof filter == 'string' ? filter : (filter.getAttribute && filter.getAttribute('accept') || ''); + return filter ? new RegExp('('+ filter.replace(/\./g, '\\.').replace(/,/g, '|') +')$', 'i') : /./; + }, + + + + /** + * Read as DataURL + * + * @param {File|Element} file + * @param {Function} fn + */ + readAsDataURL: function (file, fn){ + if( api.isCanvas(file) ){ + _emit(file, fn, 'load', api.toDataURL(file)); + } + else { + _readAs(file, fn, 'DataURL'); + } + }, + + + /** + * Read as Binary string + * + * @param {File} file + * @param {Function} fn + */ + readAsBinaryString: function (file, fn){ + if( _hasSupportReadAs('BinaryString') ){ + _readAs(file, fn, 'BinaryString'); + } else { + // Hello IE10! + _readAs(file, function (evt){ + if( evt.type == 'load' ){ + try { + // dataURL -> binaryString + evt.result = api.toBinaryString(evt.result); + } catch (e){ + evt.type = 'error'; + evt.message = e.toString(); + } + } + fn(evt); + }, 'DataURL'); + } + }, + + + /** + * Read as ArrayBuffer + * + * @param {File} file + * @param {Function} fn + */ + readAsArrayBuffer: function(file, fn){ + _readAs(file, fn, 'ArrayBuffer'); + }, + + + /** + * Read as text + * + * @param {File} file + * @param {String} encoding + * @param {Function} [fn] + */ + readAsText: function(file, encoding, fn){ + if( !fn ){ + fn = encoding; + encoding = 'utf-8'; + } + + _readAs(file, fn, 'Text', encoding); + }, + + + /** + * Convert image or canvas to DataURL + * + * @param {Element} el Image or Canvas element + * @param {String} [type] mime-type + * @return {String} + */ + toDataURL: function (el, type){ + if( typeof el == 'string' ){ + return el; + } + else if( el.toDataURL ){ + return el.toDataURL(type || 'image/png'); + } + }, + + + /** + * Canvert string, image or canvas to binary string + * + * @param {String|Element} val + * @return {String} + */ + toBinaryString: function (val){ + return window.atob(api.toDataURL(val).replace(_rdata, '')); + }, + + + /** + * Read file or DataURL as ImageElement + * + * @param {File|String} file + * @param {Function} fn + * @param {Boolean} [progress] + */ + readAsImage: function (file, fn, progress){ + if( api.isBlob(file) ){ + if( apiURL ){ + /** @namespace apiURL.createObjectURL */ + var data = apiURL.createObjectURL(file); + if( data === undef ){ + _emit(file, fn, 'error'); + } + else { + api.readAsImage(data, fn, progress); + } + } + else { + api.readAsDataURL(file, function (evt){ + if( evt.type == 'load' ){ + api.readAsImage(evt.result, fn, progress); + } + else if( progress || evt.type == 'error' ){ + _emit(file, fn, evt, null, { loaded: evt.loaded, total: evt.total }); + } + }); + } + } + else if( api.isCanvas(file) ){ + _emit(file, fn, 'load', file); + } + else if( _rimg.test(file.nodeName) ){ + if( file.complete ){ + _emit(file, fn, 'load', file); + } + else { + var events = 'error abort load'; + _one(file, events, function _fn(evt){ + if( evt.type == 'load' && apiURL ){ + /** @namespace apiURL.revokeObjectURL */ + apiURL.revokeObjectURL(file.src); + } + + _off(file, events, _fn); + _emit(file, fn, evt, file); + }); + } + } + else if( file.iframe ){ + _emit(file, fn, { type: 'error' }); + } + else { + // Created image + var img = api.newImage(file.dataURL || file); + api.readAsImage(img, fn, progress); + } + }, + + + /** + * Make file by name + * + * @param {String} name + * @return {Array} + */ + checkFileObj: function (name){ + var file = {}, accept = api.accept; + + if( typeof name == 'object' ){ + file = name; + } + else { + file.name = (name + '').split(/\\|\//g).pop(); + } + + if( file.type == null ){ + file.type = file.name.split('.').pop(); + } + + _each(accept, function (ext, type){ + ext = new RegExp(ext.replace(/\s/g, '|'), 'i'); + if( ext.test(file.type) || api.ext2mime[file.type] ){ + file.type = api.ext2mime[file.type] || (type.split('/')[0] +'/'+ file.type); + } + }); + + return file; + }, + + + /** + * Get drop files + * + * @param {Event} evt + * @param {Function} callback + */ + getDropFiles: function (evt, callback){ + var + files = [] + , all = [] + , items + , dataTransfer = _getDataTransfer(evt) + , transFiles = dataTransfer.files + , transItems = dataTransfer.items + , entrySupport = _isArray(transItems) && transItems[0] && _getAsEntry(transItems[0]) + , queue = api.queue(function (){ callback(files, all); }) + ; + + if( entrySupport ){ + if( normalize && transFiles ){ + var + i = transFiles.length + , file + , entry + ; + + items = new Array(i); + while( i-- ){ + file = transFiles[i]; + + try { + entry = _getAsEntry(transItems[i]); + } + catch( err ){ + api.log('[err] getDropFiles: ', err); + entry = null; + } + + if( _isEntry(entry) ){ + // OSX filesystems use Unicode Normalization Form D (NFD), + // and entry.file(…) can't read the files with the same names + if( entry.isDirectory || (entry.isFile && file.name == file.name.normalize('NFC')) ){ + items[i] = entry; + } + else { + items[i] = file; + } + } + else { + items[i] = file; + } + } + } + else { + items = transItems; + } + } + else { + items = transFiles; + } + + _each(items || [], function (item){ + queue.inc(); + + try { + if( entrySupport && _isEntry(item) ){ + _readEntryAsFiles(item, function (err, entryFiles, allEntries){ + if( err ){ + api.log('[err] getDropFiles:', err); + } else { + files.push.apply(files, entryFiles); + } + all.push.apply(all, allEntries); + + queue.next(); + }); + } + else { + _isRegularFile(item, function (yes, err){ + if( yes ){ + files.push(item); + } + else { + item.error = err; + } + all.push(item); + + queue.next(); + }); + } + } + catch( err ){ + queue.next(); + api.log('[err] getDropFiles: ', err); + } + }); + + queue.check(); + }, + + + /** + * Get file list + * + * @param {HTMLInputElement|Event} input + * @param {String|Function} [filter] + * @param {Function} [callback] + * @return {Array|Null} + */ + getFiles: function (input, filter, callback){ + var files = []; + + if( callback ){ + api.filterFiles(api.getFiles(input), filter, callback); + return null; + } + + if( input.jquery ){ + // jQuery object + input.each(function (){ + files = files.concat(api.getFiles(this)); + }); + input = files; + files = []; + } + + if( typeof filter == 'string' ){ + filter = api.getFilesFilter(filter); + } + + if( input.originalEvent ){ + // jQuery event + input = _fixEvent(input.originalEvent); + } + else if( input.srcElement ){ + // IE Event + input = _fixEvent(input); + } + + + if( input.dataTransfer ){ + // Drag'n'Drop + input = input.dataTransfer; + } + else if( input.target ){ + // Event + input = input.target; + } + + if( input.files ){ + // Input[type="file"] + files = input.files; + + if( !html5 ){ + // Partial support for file api + files[0].blob = input; + files[0].iframe = true; + } + } + else if( !html5 && isInputFile(input) ){ + if( api.trim(input.value) ){ + files = [api.checkFileObj(input.value)]; + files[0].blob = input; + files[0].iframe = true; + } + } + else if( _isArray(input) ){ + files = input; + } + + return api.filter(files, function (file){ return !filter || filter.test(file.name); }); + }, + + + /** + * Get total file size + * @param {Array} files + * @return {Number} + */ + getTotalSize: function (files){ + var size = 0, i = files && files.length; + while( i-- ){ + size += files[i].size; + } + return size; + }, + + + /** + * Get image information + * + * @param {File} file + * @param {Function} fn + */ + getInfo: function (file, fn){ + var info = {}, readers = _infoReader.concat(); + + if( api.isBlob(file) ){ + (function _next(){ + var reader = readers.shift(); + if( reader ){ + if( reader.test(file.type) ){ + reader(file, function (err, res){ + if( err ){ + fn(err); + } + else { + _extend(info, res); + _next(); + } + }); + } + else { + _next(); + } + } + else { + fn(false, info); + } + })(); + } + else { + fn('not_support_info', info); + } + }, + + + /** + * Add information reader + * + * @param {RegExp} mime + * @param {Function} fn + */ + addInfoReader: function (mime, fn){ + fn.test = function (type){ return mime.test(type); }; + _infoReader.push(fn); + }, + + + /** + * Filter of array + * + * @param {Array} input + * @param {Function} fn + * @return {Array} + */ + filter: function (input, fn){ + var result = [], i = 0, n = input.length, val; + + for( ; i < n; i++ ){ + if( i in input ){ + val = input[i]; + if( fn.call(val, val, i, input) ){ + result.push(val); + } + } + } + + return result; + }, + + + /** + * Filter files + * + * @param {Array} files + * @param {Function} eachFn + * @param {Function} resultFn + */ + filterFiles: function (files, eachFn, resultFn){ + if( files.length ){ + // HTML5 or Flash + var queue = files.concat(), file, result = [], deleted = []; + + (function _next(){ + if( queue.length ){ + file = queue.shift(); + api.getInfo(file, function (err, info){ + (eachFn(file, err ? false : info) ? result : deleted).push(file); + _next(); + }); + } + else { + resultFn(result, deleted); + } + })(); + } + else { + resultFn([], files); + } + }, + + + upload: function (options){ + options = _extend({ + jsonp: 'callback' + , prepare: api.F + , beforeupload: api.F + , upload: api.F + , fileupload: api.F + , fileprogress: api.F + , filecomplete: api.F + , progress: api.F + , complete: api.F + , pause: api.F + , imageOriginal: true + , chunkSize: api.chunkSize + , chunkUploadRetry: api.chunkUploadRetry + , uploadRetry: api.uploadRetry + }, options); + + + if( options.imageAutoOrientation && !options.imageTransform ){ + options.imageTransform = { rotate: 'auto' }; + } + + + var + proxyXHR = new api.XHR(options) + , dataArray = this._getFilesDataArray(options.files) + , _this = this + , _total = 0 + , _loaded = 0 + , _nextFile + , _complete = false + ; + + + // calc total size + _each(dataArray, function (data){ + _total += data.size; + }); + + // Array of files + proxyXHR.files = []; + _each(dataArray, function (data){ + proxyXHR.files.push(data.file); + }); + + // Set upload status props + proxyXHR.total = _total; + proxyXHR.loaded = 0; + proxyXHR.filesLeft = dataArray.length; + + // emit "beforeupload" event + options.beforeupload(proxyXHR, options); + + // Upload by file + _nextFile = function (){ + var + data = dataArray.shift() + , _file = data && data.file + , _fileLoaded = false + , _fileOptions = _simpleClone(options) + ; + + proxyXHR.filesLeft = dataArray.length; + + if( _file && _file.name === api.expando ){ + _file = null; + api.log('[warn] FileAPI.upload() — called without files'); + } + + if( ( proxyXHR.statusText != 'abort' || proxyXHR.current ) && data ){ + // Mark active job + _complete = false; + + // Set current upload file + proxyXHR.currentFile = _file; + + // Prepare file options + if (_file && options.prepare(_file, _fileOptions) === false) { + _nextFile.call(_this); + return; + } + _fileOptions.file = _file; + + _this._getFormData(_fileOptions, data, function (form){ + if( !_loaded ){ + // emit "upload" event + options.upload(proxyXHR, options); + } + + var xhr = new api.XHR(_extend({}, _fileOptions, { + + upload: _file ? function (){ + // emit "fileupload" event + options.fileupload(_file, xhr, _fileOptions); + } : noop, + + progress: _file ? function (evt){ + if( !_fileLoaded ){ + // For ignore the double calls. + _fileLoaded = (evt.loaded === evt.total); + + // emit "fileprogress" event + options.fileprogress({ + type: 'progress' + , total: data.total = evt.total + , loaded: data.loaded = evt.loaded + }, _file, xhr, _fileOptions); + + // emit "progress" event + options.progress({ + type: 'progress' + , total: _total + , loaded: proxyXHR.loaded = (_loaded + data.size * (evt.loaded/evt.total)) || 0 + }, _file, xhr, _fileOptions); + } + } : noop, + + complete: function (err){ + _each(_xhrPropsExport, function (name){ + proxyXHR[name] = xhr[name]; + }); + + if( _file ){ + data.total = (data.total || data.size); + data.loaded = data.total; + + if( !err ) { + // emulate 100% "progress" + this.progress(data); + + // fixed throttle event + _fileLoaded = true; + + // bytes loaded + _loaded += data.size; // data.size != data.total, it's desirable fix this + proxyXHR.loaded = _loaded; + } + + // emit "filecomplete" event + options.filecomplete(err, xhr, _file, _fileOptions); + } + + // upload next file + setTimeout(function () {_nextFile.call(_this);}, 0); + } + })); // xhr + + + // ... + proxyXHR.abort = function (current){ + if (!current) { dataArray.length = 0; } + this.current = current; + xhr.abort(); + }; + + // Start upload + xhr.send(form); + }); + } + else { + var successful = proxyXHR.status == 200 || proxyXHR.status == 201 || proxyXHR.status == 204; + options.complete(successful ? false : (proxyXHR.statusText || 'error'), proxyXHR, options); + // Mark done state + _complete = true; + } + }; + + + // Next tick + setTimeout(_nextFile, 0); + + + // Append more files to the existing request + // first - add them to the queue head/tail + proxyXHR.append = function (files, first) { + files = api._getFilesDataArray([].concat(files)); + + _each(files, function (data) { + _total += data.size; + proxyXHR.files.push(data.file); + if (first) { + dataArray.unshift(data); + } else { + dataArray.push(data); + } + }); + + proxyXHR.statusText = ""; + + if( _complete ){ + _nextFile.call(_this); + } + }; + + + // Removes file from queue by file reference and returns it + proxyXHR.remove = function (file) { + var i = dataArray.length, _file; + while( i-- ){ + if( dataArray[i].file == file ){ + _file = dataArray.splice(i, 1); + _total -= _file.size; + } + } + return _file; + }; + + return proxyXHR; + }, + + + _getFilesDataArray: function (data){ + var files = [], oFiles = {}; + + if( isInputFile(data) ){ + var tmp = api.getFiles(data); + oFiles[data.name || 'file'] = data.getAttribute('multiple') !== null ? tmp : tmp[0]; + } + else if( _isArray(data) && isInputFile(data[0]) ){ + _each(data, function (input){ + oFiles[input.name || 'file'] = api.getFiles(input); + }); + } + else { + oFiles = data; + } + + _each(oFiles, function add(file, name){ + if( _isArray(file) ){ + _each(file, function (file){ + add(file, name); + }); + } + else if( file && (file.name || file.image) ){ + files.push({ + name: name + , file: file + , size: file.size + , total: file.size + , loaded: 0 + }); + } + }); + + if( !files.length ){ + // Create fake `file` object + files.push({ file: { name: api.expando } }); + } + + return files; + }, + + + _getFormData: function (options, data, fn){ + var + file = data.file + , name = data.name + , filename = file.name + , filetype = file.type + , trans = api.support.transform && options.imageTransform + , Form = new api.Form + , queue = api.queue(function (){ fn(Form); }) + , isOrignTrans = trans && _isOriginTransform(trans) + , postNameConcat = api.postNameConcat + ; + + // Append data + _each(options.data, function add(val, name){ + if( typeof val == 'object' ){ + _each(val, function (v, i){ + add(v, postNameConcat(name, i)); + }); + } + else { + Form.append(name, val); + } + }); + + (function _addFile(file/**Object*/){ + if( file.image ){ // This is a FileAPI.Image + queue.inc(); + + file.toData(function (err, image){ + // @todo: требует рефакторинга и обработки ошибки + if (file.file) { + image.type = file.file.type; + image.quality = file.matrix.quality; + filename = file.file && file.file.name; + } + + filename = filename || (new Date).getTime()+'.png'; + + _addFile(image); + queue.next(); + }); + } + else if( api.Image && trans && (/^image/.test(file.type) || _rimgcanvas.test(file.nodeName)) ){ + queue.inc(); + + if( isOrignTrans ){ + // Convert to array for transform function + trans = [trans]; + } + + api.Image.transform(file, trans, options.imageAutoOrientation, function (err, images){ + if( isOrignTrans && !err ){ + if( !dataURLtoBlob && !api.flashEngine ){ + // Canvas.toBlob or Flash not supported, use multipart + Form.multipart = true; + } + + Form.append(name, images[0], filename, trans[0].type || filetype); + } + else { + var addOrigin = 0; + + if( !err ){ + _each(images, function (image, idx){ + if( !dataURLtoBlob && !api.flashEngine ){ + Form.multipart = true; + } + + if( !trans[idx].postName ){ + addOrigin = 1; + } + + Form.append(trans[idx].postName || postNameConcat(name, idx), image, filename, trans[idx].type || filetype); + }); + } + + if( err || options.imageOriginal ){ + Form.append(postNameConcat(name, (addOrigin ? 'original' : null)), file, filename, filetype); + } + } + + queue.next(); + }); + } + else if( filename !== api.expando ){ + Form.append(name, file, filename); + } + })(file); + + queue.check(); + }, + + + reset: function (inp, notRemove){ + var parent, clone; + + if( jQuery ){ + clone = jQuery(inp).clone(true).insertBefore(inp).val('')[0]; + if( !notRemove ){ + jQuery(inp).remove(); + } + } else { + parent = inp.parentNode; + clone = parent.insertBefore(inp.cloneNode(true), inp); + clone.value = ''; + + if( !notRemove ){ + parent.removeChild(inp); + } + + _each(_elEvents[api.uid(inp)], function (fns, type){ + _each(fns, function (fn){ + _off(inp, type, fn); + _on(clone, type, fn); + }); + }); + } + + return clone; + }, + + + /** + * Load remote file + * + * @param {String} url + * @param {Function} fn + * @return {XMLHttpRequest} + */ + load: function (url, fn){ + var xhr = api.getXHR(); + if( xhr ){ + xhr.open('GET', url, true); + + if( xhr.overrideMimeType ){ + xhr.overrideMimeType('text/plain; charset=x-user-defined'); + } + + _on(xhr, 'progress', function (/**Event*/evt){ + /** @namespace evt.lengthComputable */ + if( evt.lengthComputable ){ + fn({ type: evt.type, loaded: evt.loaded, total: evt.total }, xhr); + } + }); + + xhr.onreadystatechange = function(){ + if( xhr.readyState == 4 ){ + xhr.onreadystatechange = null; + if( xhr.status == 200 ){ + url = url.split('/'); + /** @namespace xhr.responseBody */ + var file = { + name: url[url.length-1] + , size: xhr.getResponseHeader('Content-Length') + , type: xhr.getResponseHeader('Content-Type') + }; + file.dataURL = 'data:'+file.type+';base64,' + api.encode64(xhr.responseBody || xhr.responseText); + fn({ type: 'load', result: file }, xhr); + } + else { + fn({ type: 'error' }, xhr); + } + } + }; + xhr.send(null); + } else { + fn({ type: 'error' }); + } + + return xhr; + }, + + encode64: function (str){ + var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=', outStr = '', i = 0; + + if( typeof str !== 'string' ){ + str = String(str); + } + + while( i < str.length ){ + //all three "& 0xff" added below are there to fix a known bug + //with bytes returned by xhr.responseText + var + byte1 = str.charCodeAt(i++) & 0xff + , byte2 = str.charCodeAt(i++) & 0xff + , byte3 = str.charCodeAt(i++) & 0xff + , enc1 = byte1 >> 2 + , enc2 = ((byte1 & 3) << 4) | (byte2 >> 4) + , enc3, enc4 + ; + + if( isNaN(byte2) ){ + enc3 = enc4 = 64; + } else { + enc3 = ((byte2 & 15) << 2) | (byte3 >> 6); + enc4 = isNaN(byte3) ? 64 : byte3 & 63; + } + + outStr += b64.charAt(enc1) + b64.charAt(enc2) + b64.charAt(enc3) + b64.charAt(enc4); + } + + return outStr; + } + + } // api + ; + + + function _emit(target, fn, name, res, ext){ + var evt = { + type: name.type || name + , target: target + , result: res + }; + _extend(evt, ext); + fn(evt); + } + + + function _hasSupportReadAs(method){ + return FileReader && !!FileReader.prototype['readAs' + method]; + } + + + function _readAs(file, fn, method, encoding){ + if( api.isBlob(file) && _hasSupportReadAs(method) ){ + var Reader = new FileReader; + + // Add event listener + _on(Reader, _readerEvents, function _fn(evt){ + var type = evt.type; + if( type == 'progress' ){ + _emit(file, fn, evt, evt.target.result, { loaded: evt.loaded, total: evt.total }); + } + else if( type == 'loadend' ){ + _off(Reader, _readerEvents, _fn); + Reader = null; + } + else { + _emit(file, fn, evt, evt.target.result); + } + }); + + + try { + // ReadAs ... + if( encoding ){ + Reader['readAs' + method](file, encoding); + } + else { + Reader['readAs' + method](file); + } + } + catch (err){ + _emit(file, fn, 'error', undef, { error: err.toString() }); + } + } + else { + _emit(file, fn, 'error', undef, { error: 'filreader_not_support_' + method }); + } + } + + + function _isRegularFile(file, callback){ + // http://stackoverflow.com/questions/8856628/detecting-folders-directories-in-javascript-filelist-objects + if( !file.type && (safari || ((file.size % 4096) === 0 && (file.size <= 102400))) ){ + if( FileReader ){ + try { + var reader = new FileReader(); + + _one(reader, _readerEvents, function (evt){ + var isFile = evt.type != 'error'; + if( isFile ){ + if ( reader.readyState == null || reader.readyState === reader.LOADING ) { + reader.abort(); + } + callback(isFile); + } + else { + callback(false, reader.error); + } + }); + + reader.readAsDataURL(file); + } catch( err ){ + callback(false, err); + } + } + else { + callback(null, new Error('FileReader is not supported')); + } + } + else { + callback(true); + } + } + + + function _isEntry(item){ + return item && (item.isFile || item.isDirectory); + } + + + function _getAsEntry(item){ + var entry; + if( item.getAsEntry ){ entry = item.getAsEntry(); } + else if( item.webkitGetAsEntry ){ entry = item.webkitGetAsEntry(); } + return entry; + } + + + function _readEntryAsFiles(entry, callback){ + if( !entry ){ + // error + var err = new Error('invalid entry'); + entry = new Object(entry); + entry.error = err; + callback(err.message, [], [entry]); + } + else if( entry.isFile ){ + // Read as file + entry.file(function (file){ + // success + file.fullPath = entry.fullPath; + callback(false, [file], [file]); + }, function (err){ + // error + entry.error = err; + callback('FileError.code: ' + err.code, [], [entry]); + }); + } + else if( entry.isDirectory ){ + var + reader = entry.createReader() + , firstAttempt = true + , files = [] + , all = [entry] + ; + + var onerror = function (err){ + // error + entry.error = err; + callback('DirectoryError.code: ' + err.code, files, all); + }; + var ondone = function ondone(entries){ + if( firstAttempt ){ + firstAttempt = false; + if( !entries.length ){ + entry.error = new Error('directory is empty'); + } + } + + // success + if( entries.length ){ + api.afor(entries, function (next, entry){ + _readEntryAsFiles(entry, function (err, entryFiles, allEntries){ + if( !err ){ + files = files.concat(entryFiles); + } + all = all.concat(allEntries); + + if( next ){ + next(); + } + else { + reader.readEntries(ondone, onerror); + } + }); + }); + } + else { + callback(false, files, all); + } + }; + + reader.readEntries(ondone, onerror); + } + else { + _readEntryAsFiles(_getAsEntry(entry), callback); + } + } + + + function _simpleClone(obj){ + var copy = {}; + _each(obj, function (val, key){ + if( val && (typeof val === 'object') && (val.nodeType === void 0) ){ + val = _extend({}, val); + } + copy[key] = val; + }); + return copy; + } + + + function isInputFile(el){ + return _rinput.test(el && el.tagName); + } + + + function _getDataTransfer(evt){ + return (evt.originalEvent || evt || '').dataTransfer || {}; + } + + + function _isOriginTransform(trans){ + var key; + for( key in trans ){ + if( trans.hasOwnProperty(key) ){ + if( !(trans[key] instanceof Object || key === 'overlay' || key === 'filter') ){ + return true; + } + } + } + return false; + } + + + // Add default image info reader + api.addInfoReader(/^image/, function (file/**File*/, callback/**Function*/){ + if( !file.__dimensions ){ + var defer = file.__dimensions = api.defer(); + + api.readAsImage(file, function (evt){ + var img = evt.target; + defer.resolve(evt.type == 'load' ? false : 'error', { + width: img.width + , height: img.height + }); + img.src = api.EMPTY_PNG; + img = null; + }); + } + + file.__dimensions.then(callback); + }); + + + /** + * Drag'n'Drop special event + * + * @param {HTMLElement} el + * @param {Function} onHover + * @param {Function} onDrop + */ + api.event.dnd = function (el, onHover, onDrop){ + var _id, _type; + + if( !onDrop ){ + onDrop = onHover; + onHover = api.F; + } + + if( FileReader ){ + // Hover + _on(el, 'dragenter dragleave dragover', onHover.ff = onHover.ff || function (evt){ + var + types = _getDataTransfer(evt).types + , i = types && types.length + , debounceTrigger = false + ; + + while( i-- ){ + if( ~types[i].indexOf('File') ){ + evt[preventDefault](); + + if( _type !== evt.type ){ + _type = evt.type; // Store current type of event + + if( _type != 'dragleave' ){ + onHover.call(evt[currentTarget], true, evt); + } + + debounceTrigger = true; + } + + break; // exit from "while" + } + } + + if( debounceTrigger ){ + clearTimeout(_id); + _id = setTimeout(function (){ + onHover.call(evt[currentTarget], _type != 'dragleave', evt); + }, 50); + } + }); + + + // Drop + _on(el, 'drop', onDrop.ff = onDrop.ff || function (evt){ + evt[preventDefault](); + + _type = 0; + onHover.call(evt[currentTarget], false, evt); + + api.getDropFiles(evt, function (files, all){ + onDrop.call(evt[currentTarget], files, all, evt); + }); + }); + } + else { + api.log("Drag'n'Drop -- not supported"); + } + }; + + + /** + * Remove drag'n'drop + * @param {HTMLElement} el + * @param {Function} onHover + * @param {Function} onDrop + */ + api.event.dnd.off = function (el, onHover, onDrop){ + _off(el, 'dragenter dragleave dragover', onHover.ff); + _off(el, 'drop', onDrop.ff); + }; + + + // Support jQuery + if( jQuery && !jQuery.fn.dnd ){ + jQuery.fn.dnd = function (onHover, onDrop){ + return this.each(function (){ + api.event.dnd(this, onHover, onDrop); + }); + }; + + jQuery.fn.offdnd = function (onHover, onDrop){ + return this.each(function (){ + api.event.dnd.off(this, onHover, onDrop); + }); + }; + } + + // @export + window.FileAPI = _extend(api, window.FileAPI); + + + // Debug info + api.log('FileAPI: ' + api.version); + api.log('protocol: ' + window.location.protocol); + api.log('doctype: [' + doctype.name + '] ' + doctype.publicId + ' ' + doctype.systemId); + + + // @detect 'x-ua-compatible' + _each(document.getElementsByTagName('meta'), function (meta){ + if( /x-ua-compatible/i.test(meta.getAttribute('http-equiv')) ){ + api.log('meta.http-equiv: ' + meta.getAttribute('content')); + } + }); + + + // Configuration + try { + _supportConsoleLog = !!console.log; + _supportConsoleLogApply = !!console.log.apply; + } + catch (err) {} + + if( !api.flashUrl ){ api.flashUrl = api.staticPath + 'FileAPI.flash.swf'; } + if( !api.flashImageUrl ){ api.flashImageUrl = api.staticPath + 'FileAPI.flash.image.swf'; } + if( !api.flashWebcamUrl ){ api.flashWebcamUrl = api.staticPath + 'FileAPI.flash.camera.swf'; } +})(window, void 0); + +/*global window, FileAPI, document */ + +(function (api, document, undef) { + 'use strict'; + + var + min = Math.min, + round = Math.round, + getCanvas = function () { return document.createElement('canvas'); }, + support = false, + exifOrientation = { + 8: 270 + , 3: 180 + , 6: 90 + , 7: 270 + , 4: 180 + , 5: 90 + } + ; + + try { + support = getCanvas().toDataURL('image/png').indexOf('data:image/png') > -1; + } + catch (e){} + + + function Image(file){ + if( file instanceof Image ){ + var img = new Image(file.file); + api.extend(img.matrix, file.matrix); + return img; + } + else if( !(this instanceof Image) ){ + return new Image(file); + } + + this.file = file; + this.size = file.size || 100; + + this.matrix = { + sx: 0, + sy: 0, + sw: 0, + sh: 0, + dx: 0, + dy: 0, + dw: 0, + dh: 0, + resize: 0, // min, max OR preview + deg: 0, + quality: 1, // jpeg quality + filter: 0 + }; + } + + + Image.prototype = { + image: true, + constructor: Image, + + set: function (attrs){ + api.extend(this.matrix, attrs); + return this; + }, + + crop: function (x, y, w, h){ + if( w === undef ){ + w = x; + h = y; + x = y = 0; + } + return this.set({ sx: x, sy: y, sw: w, sh: h || w }); + }, + + resize: function (w, h, strategy){ + if( /min|max|height|width/.test(h) ){ + strategy = h; + h = w; + } + + return this.set({ dw: w, dh: h || w, resize: strategy }); + }, + + preview: function (w, h){ + return this.resize(w, h || w, 'preview'); + }, + + rotate: function (deg){ + return this.set({ deg: deg }); + }, + + filter: function (filter){ + return this.set({ filter: filter }); + }, + + overlay: function (images){ + return this.set({ overlay: images }); + }, + + clone: function (){ + return new Image(this); + }, + + _load: function (image, fn){ + var self = this; + + if( /img|video/i.test(image.nodeName) ){ + fn.call(self, null, image); + } + else { + api.readAsImage(image, function (evt){ + fn.call(self, evt.type != 'load', evt.result); + }); + } + }, + + _apply: function (image, fn){ + var + canvas = getCanvas() + , m = this.getMatrix(image) + , ctx = canvas.getContext('2d') + , width = image.videoWidth || image.width + , height = image.videoHeight || image.height + , deg = m.deg + , dw = m.dw + , dh = m.dh + , w = width + , h = height + , filter = m.filter + , copy // canvas copy + , buffer = image + , overlay = m.overlay + , queue = api.queue(function (){ image.src = api.EMPTY_PNG; fn(false, canvas); }) + , renderImageToCanvas = api.renderImageToCanvas + ; + + // Normalize angle + deg = deg - Math.floor(deg/360)*360; + + // For `renderImageToCanvas` + image._type = this.file.type; + + while(m.multipass && min(w/dw, h/dh) > 2 ){ + w = (w/2 + 0.5)|0; + h = (h/2 + 0.5)|0; + + copy = getCanvas(); + copy.width = w; + copy.height = h; + + if( buffer !== image ){ + renderImageToCanvas(copy, buffer, 0, 0, buffer.width, buffer.height, 0, 0, w, h); + buffer = copy; + } + else { + buffer = copy; + renderImageToCanvas(buffer, image, m.sx, m.sy, m.sw, m.sh, 0, 0, w, h); + m.sx = m.sy = m.sw = m.sh = 0; + } + } + + + canvas.width = (deg % 180) ? dh : dw; + canvas.height = (deg % 180) ? dw : dh; + + canvas.type = m.type; + canvas.quality = m.quality; + + ctx.rotate(deg * Math.PI / 180); + renderImageToCanvas(ctx.canvas, buffer + , m.sx, m.sy + , m.sw || buffer.width + , m.sh || buffer.height + , (deg == 180 || deg == 270 ? -dw : 0) + , (deg == 90 || deg == 180 ? -dh : 0) + , dw, dh + ); + dw = canvas.width; + dh = canvas.height; + + // Apply overlay + overlay && api.each([].concat(overlay), function (over){ + queue.inc(); + // preload + var img = new window.Image, fn = function (){ + var + x = over.x|0 + , y = over.y|0 + , w = over.w || img.width + , h = over.h || img.height + , rel = over.rel + ; + + // center | right | left + x = (rel == 1 || rel == 4 || rel == 7) ? (dw - w + x)/2 : (rel == 2 || rel == 5 || rel == 8 ? dw - (w + x) : x); + + // center | bottom | top + y = (rel == 3 || rel == 4 || rel == 5) ? (dh - h + y)/2 : (rel >= 6 ? dh - (h + y) : y); + + api.event.off(img, 'error load abort', fn); + + try { + ctx.globalAlpha = over.opacity || 1; + ctx.drawImage(img, x, y, w, h); + } + catch (er){} + + queue.next(); + }; + + api.event.on(img, 'error load abort', fn); + img.src = over.src; + + if( img.complete ){ + fn(); + } + }); + + if( filter ){ + queue.inc(); + Image.applyFilter(canvas, filter, queue.next); + } + + queue.check(); + }, + + getMatrix: function (image){ + var + m = api.extend({}, this.matrix) + , sw = m.sw = m.sw || image.videoWidth || image.naturalWidth || image.width + , sh = m.sh = m.sh || image.videoHeight || image.naturalHeight || image.height + , dw = m.dw = m.dw || sw + , dh = m.dh = m.dh || sh + , sf = sw/sh, df = dw/dh + , strategy = m.resize + ; + + if( strategy == 'preview' ){ + if( dw != sw || dh != sh ){ + // Make preview + var w, h; + + if( df >= sf ){ + w = sw; + h = w / df; + } else { + h = sh; + w = h * df; + } + + if( w != sw || h != sh ){ + m.sx = ~~((sw - w)/2); + m.sy = ~~((sh - h)/2); + sw = w; + sh = h; + } + } + } + else if( strategy == 'height' ){ + dw = dh * sf; + } + else if( strategy == 'width' ){ + dh = dw / sf; + } + else if( strategy ){ + if( !(sw > dw || sh > dh) ){ + dw = sw; + dh = sh; + } + else if( strategy == 'min' ){ + dw = round(sf < df ? min(sw, dw) : dh*sf); + dh = round(sf < df ? dw/sf : min(sh, dh)); + } + else { + dw = round(sf >= df ? min(sw, dw) : dh*sf); + dh = round(sf >= df ? dw/sf : min(sh, dh)); + } + } + + m.sw = sw; + m.sh = sh; + m.dw = dw; + m.dh = dh; + m.multipass = api.multiPassResize; + return m; + }, + + _trans: function (fn){ + this._load(this.file, function (err, image){ + if( err ){ + fn(err); + } + else { + try { + this._apply(image, fn); + } catch (err){ + api.log('[err] FileAPI.Image.fn._apply:', err); + fn(err); + } + } + }); + }, + + + get: function (fn){ + if( api.support.transform ){ + var _this = this, matrix = _this.matrix; + + if( matrix.deg == 'auto' ){ + api.getInfo(_this.file, function (err, info){ + // rotate by exif orientation + matrix.deg = exifOrientation[info && info.exif && info.exif.Orientation] || 0; + _this._trans(fn); + }); + } + else { + _this._trans(fn); + } + } + else { + fn('not_support_transform'); + } + + return this; + }, + + + toData: function (fn){ + return this.get(fn); + } + + }; + + + Image.exifOrientation = exifOrientation; + + + Image.transform = function (file, transform, autoOrientation, fn){ + function _transform(err, img){ + // img -- info object + var + images = {} + , queue = api.queue(function (err){ + fn(err, images); + }) + ; + + if( !err ){ + api.each(transform, function (params, name){ + if( !queue.isFail() ){ + var ImgTrans = new Image(img.nodeType ? img : file), isFn = typeof params == 'function'; + + if( isFn ){ + params(img, ImgTrans); + } + else if( params.width ){ + ImgTrans[params.preview ? 'preview' : 'resize'](params.width, params.height, params.strategy); + } + else { + if( params.maxWidth && (img.width > params.maxWidth || img.height > params.maxHeight) ){ + ImgTrans.resize(params.maxWidth, params.maxHeight, 'max'); + } + } + + if( params.crop ){ + var crop = params.crop; + ImgTrans.crop(crop.x|0, crop.y|0, crop.w || crop.width, crop.h || crop.height); + } + + if( params.rotate === undef && autoOrientation ){ + params.rotate = 'auto'; + } + + ImgTrans.set({ type: ImgTrans.matrix.type || params.type || file.type || 'image/png' }); + + if( !isFn ){ + ImgTrans.set({ + deg: params.rotate + , overlay: params.overlay + , filter: params.filter + , quality: params.quality || 1 + }); + } + + queue.inc(); + ImgTrans.toData(function (err, image){ + if( err ){ + queue.fail(); + } + else { + images[name] = image; + queue.next(); + } + }); + } + }); + } + else { + queue.fail(); + } + } + + + // @todo: Оло-ло, нужно рефакторить это место + if( file.width ){ + _transform(false, file); + } else { + api.getInfo(file, _transform); + } + }; + + + // @const + api.each(['TOP', 'CENTER', 'BOTTOM'], function (x, i){ + api.each(['LEFT', 'CENTER', 'RIGHT'], function (y, j){ + Image[x+'_'+y] = i*3 + j; + Image[y+'_'+x] = i*3 + j; + }); + }); + + + /** + * Trabsform element to canvas + * + * @param {Image|HTMLVideoElement} el + * @returns {Canvas} + */ + Image.toCanvas = function(el){ + var canvas = document.createElement('canvas'); + canvas.width = el.videoWidth || el.width; + canvas.height = el.videoHeight || el.height; + canvas.getContext('2d').drawImage(el, 0, 0); + return canvas; + }; + + + /** + * Create image from DataURL + * @param {String} dataURL + * @param {Object} size + * @param {Function} callback + */ + Image.fromDataURL = function (dataURL, size, callback){ + var img = api.newImage(dataURL); + api.extend(img, size); + callback(img); + }; + + + /** + * Apply filter (caman.js) + * + * @param {Canvas|Image} canvas + * @param {String|Function} filter + * @param {Function} doneFn + */ + Image.applyFilter = function (canvas, filter, doneFn){ + if( typeof filter == 'function' ){ + filter(canvas, doneFn); + } + else if( window.Caman ){ + // http://camanjs.com/guides/ + window.Caman(canvas.tagName == 'IMG' ? Image.toCanvas(canvas) : canvas, function (){ + if( typeof filter == 'string' ){ + this[filter](); + } + else { + api.each(filter, function (val, method){ + this[method](val); + }, this); + } + this.render(doneFn); + }); + } + }; + + + /** + * For load-image-ios.js + */ + api.renderImageToCanvas = function (canvas, img, sx, sy, sw, sh, dx, dy, dw, dh){ + try { + return canvas.getContext('2d').drawImage(img, sx, sy, sw, sh, dx, dy, dw, dh); + } catch (ex) { + api.log('renderImageToCanvas failed'); + throw ex; + } + }; + + + // @export + api.support.canvas = api.support.transform = support; + api.Image = Image; +})(FileAPI, document); + +/* + * JavaScript Load Image iOS scaling fixes 1.0.3 + * https://github.com/blueimp/JavaScript-Load-Image + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * iOS image scaling fixes based on + * https://github.com/stomita/ios-imagefile-megapixel + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/*jslint nomen: true, bitwise: true */ +/*global FileAPI, window, document */ + +(function (factory) { + 'use strict'; + factory(FileAPI); +}(function (loadImage) { + 'use strict'; + + // Only apply fixes on the iOS platform: + if (!window.navigator || !window.navigator.platform || + !(/iP(hone|od|ad)/).test(window.navigator.platform)) { + return; + } + + var originalRenderMethod = loadImage.renderImageToCanvas; + + // Detects subsampling in JPEG images: + loadImage.detectSubsampling = function (img) { + var canvas, + context; + if (img.width * img.height > 1024 * 1024) { // only consider mexapixel images + canvas = document.createElement('canvas'); + canvas.width = canvas.height = 1; + context = canvas.getContext('2d'); + context.drawImage(img, -img.width + 1, 0); + // subsampled image becomes half smaller in rendering size. + // check alpha channel value to confirm image is covering edge pixel or not. + // if alpha value is 0 image is not covering, hence subsampled. + return context.getImageData(0, 0, 1, 1).data[3] === 0; + } + return false; + }; + + // Detects vertical squash in JPEG images: + loadImage.detectVerticalSquash = function (img, subsampled) { + var naturalHeight = img.naturalHeight || img.height, + canvas = document.createElement('canvas'), + context = canvas.getContext('2d'), + data, + sy, + ey, + py, + alpha; + if (subsampled) { + naturalHeight /= 2; + } + canvas.width = 1; + canvas.height = naturalHeight; + context.drawImage(img, 0, 0); + data = context.getImageData(0, 0, 1, naturalHeight).data; + // search image edge pixel position in case it is squashed vertically: + sy = 0; + ey = naturalHeight; + py = naturalHeight; + while (py > sy) { + alpha = data[(py - 1) * 4 + 3]; + if (alpha === 0) { + ey = py; + } else { + sy = py; + } + py = (ey + sy) >> 1; + } + return (py / naturalHeight) || 1; + }; + + // Renders image to canvas while working around iOS image scaling bugs: + // https://github.com/blueimp/JavaScript-Load-Image/issues/13 + loadImage.renderImageToCanvas = function ( + canvas, + img, + sourceX, + sourceY, + sourceWidth, + sourceHeight, + destX, + destY, + destWidth, + destHeight + ) { + if (img._type === 'image/jpeg') { + var context = canvas.getContext('2d'), + tmpCanvas = document.createElement('canvas'), + tileSize = 1024, + tmpContext = tmpCanvas.getContext('2d'), + subsampled, + vertSquashRatio, + tileX, + tileY; + tmpCanvas.width = tileSize; + tmpCanvas.height = tileSize; + context.save(); + subsampled = loadImage.detectSubsampling(img); + if (subsampled) { + sourceX /= 2; + sourceY /= 2; + sourceWidth /= 2; + sourceHeight /= 2; + } + vertSquashRatio = loadImage.detectVerticalSquash(img, subsampled); + if (subsampled || vertSquashRatio !== 1) { + sourceY *= vertSquashRatio; + destWidth = Math.ceil(tileSize * destWidth / sourceWidth); + destHeight = Math.ceil( + tileSize * destHeight / sourceHeight / vertSquashRatio + ); + destY = 0; + tileY = 0; + while (tileY < sourceHeight) { + destX = 0; + tileX = 0; + while (tileX < sourceWidth) { + tmpContext.clearRect(0, 0, tileSize, tileSize); + tmpContext.drawImage( + img, + sourceX, + sourceY, + sourceWidth, + sourceHeight, + -tileX, + -tileY, + sourceWidth, + sourceHeight + ); + context.drawImage( + tmpCanvas, + 0, + 0, + tileSize, + tileSize, + destX, + destY, + destWidth, + destHeight + ); + tileX += tileSize; + destX += destWidth; + } + tileY += tileSize; + destY += destHeight; + } + context.restore(); + return canvas; + } + } + return originalRenderMethod( + canvas, + img, + sourceX, + sourceY, + sourceWidth, + sourceHeight, + destX, + destY, + destWidth, + destHeight + ); + }; + +})); + +/*global window, FileAPI */ + +(function (api, window){ + "use strict"; + + var + document = window.document + , FormData = window.FormData + , Form = function (){ this.items = []; } + , encodeURIComponent = window.encodeURIComponent + ; + + + Form.prototype = { + + append: function (name, blob, file, type){ + this.items.push({ + name: name + , blob: blob && blob.blob || (blob == void 0 ? '' : blob) + , file: blob && (file || blob.name) + , type: blob && (type || blob.type) + }); + }, + + each: function (fn){ + var i = 0, n = this.items.length; + for( ; i < n; i++ ){ + fn.call(this, this.items[i]); + } + }, + + toData: function (fn, options){ + // allow chunked transfer if we have only one file to send + // flag is used below and in XHR._send + options._chunked = api.support.chunked && options.chunkSize > 0 && api.filter(this.items, function (item){ return item.file; }).length == 1; + + if( !api.support.html5 ){ + api.log('FileAPI.Form.toHtmlData'); + this.toHtmlData(fn); + } + else if( !api.formData || this.multipart || !FormData ){ + api.log('FileAPI.Form.toMultipartData'); + this.toMultipartData(fn); + } + else if( options._chunked ){ + api.log('FileAPI.Form.toPlainData'); + this.toPlainData(fn); + } + else { + api.log('FileAPI.Form.toFormData'); + this.toFormData(fn); + } + }, + + _to: function (data, complete, next, arg){ + var queue = api.queue(function (){ + complete(data); + }); + + this.each(function (file){ + try{ + next(file, data, queue, arg); + } + catch( err ){ + api.log('FileAPI.Form._to: ' + err.message); + complete(err); + } + }); + + queue.check(); + }, + + + toHtmlData: function (fn){ + this._to(document.createDocumentFragment(), fn, function (file, data/**DocumentFragment*/){ + var blob = file.blob, hidden; + + if( file.file ){ + api.reset(blob, true); + // set new name + blob.name = file.name; + blob.disabled = false; + data.appendChild(blob); + } + else { + hidden = document.createElement('input'); + hidden.name = file.name; + hidden.type = 'hidden'; + hidden.value = blob; + data.appendChild(hidden); + } + }); + }, + + toPlainData: function (fn){ + this._to({}, fn, function (file, data, queue){ + if( file.file ){ + data.type = file.file; + } + + if( file.blob.toBlob ){ + // canvas + queue.inc(); + _convertFile(file, function (file, blob){ + data.name = file.name; + data.file = blob; + data.size = blob.length; + data.type = file.type; + queue.next(); + }); + } + else if( file.file ){ + // file + data.name = file.blob.name; + data.file = file.blob; + data.size = file.blob.size; + data.type = file.type; + } + else { + // additional data + if( !data.params ){ + data.params = []; + } + data.params.push(encodeURIComponent(file.name) +"="+ encodeURIComponent(file.blob)); + } + + data.start = -1; + data.end = data.file && data.file.FileAPIReadPosition || -1; + data.retry = 0; + }); + }, + + toFormData: function (fn){ + this._to(new FormData, fn, function (file, data, queue){ + if( file.blob && file.blob.toBlob ){ + queue.inc(); + _convertFile(file, function (file, blob){ + data.append(file.name, blob, file.file); + queue.next(); + }); + } + else if( file.file ){ + data.append(file.name, file.blob, file.file); + } + else { + data.append(file.name, file.blob); + } + + if( file.file ){ + data.append('_'+file.name, file.file); + } + }); + }, + + + toMultipartData: function (fn){ + this._to([], fn, function (file, data, queue, boundary){ + queue.inc(); + _convertFile(file, function (file, blob){ + data.push( + '--_' + boundary + ('\r\nContent-Disposition: form-data; name="'+ file.name +'"'+ (file.file ? '; filename="'+ encodeURIComponent(file.file) +'"' : '') + + (file.file ? '\r\nContent-Type: '+ (file.type || 'application/octet-stream') : '') + + '\r\n' + + '\r\n'+ (file.file ? blob : encodeURIComponent(blob)) + + '\r\n') + ); + queue.next(); + }, true); + }, api.expando); + } + }; + + + function _convertFile(file, fn, useBinaryString){ + var blob = file.blob, filename = file.file; + + if( filename ){ + if( !blob.toDataURL ){ + // The Blob is not an image. + api.readAsBinaryString(blob, function (evt){ + if( evt.type == 'load' ){ + fn(file, evt.result); + } + }); + return; + } + + var + mime = { 'image/jpeg': '.jpe?g', 'image/png': '.png' } + , type = mime[file.type] ? file.type : 'image/png' + , ext = mime[type] || '.png' + , quality = blob.quality || 1 + ; + + if( !filename.match(new RegExp(ext+'$', 'i')) ){ + // Does not change the current extension, but add a new one. + filename += ext.replace('?', ''); + } + + file.file = filename; + file.type = type; + + if( !useBinaryString && blob.toBlob ){ + blob.toBlob(function (blob){ + fn(file, blob); + }, type, quality); + } + else { + fn(file, api.toBinaryString(blob.toDataURL(type, quality))); + } + } + else { + fn(file, blob); + } + } + + + // @export + api.Form = Form; +})(FileAPI, window); + +/*global window, FileAPI, Uint8Array */ + +(function (window, api){ + "use strict"; + + var + noop = function (){} + , document = window.document + + , XHR = function (options){ + this.uid = api.uid(); + this.xhr = { + abort: noop + , getResponseHeader: noop + , getAllResponseHeaders: noop + }; + this.options = options; + }, + + _xhrResponsePostfix = { '': 1, XML: 1, Text: 1, Body: 1 } + ; + + + XHR.prototype = { + status: 0, + statusText: '', + constructor: XHR, + + getResponseHeader: function (name){ + return this.xhr.getResponseHeader(name); + }, + + getAllResponseHeaders: function (){ + return this.xhr.getAllResponseHeaders() || {}; + }, + + end: function (status, statusText){ + var _this = this, options = _this.options; + + _this.end = + _this.abort = noop; + _this.status = status; + + if( statusText ){ + _this.statusText = statusText; + } + + api.log('xhr.end:', status, statusText); + options.complete(status == 200 || status == 201 ? false : _this.statusText || 'unknown', _this); + + if( _this.xhr && _this.xhr.node ){ + setTimeout(function (){ + var node = _this.xhr.node; + try { node.parentNode.removeChild(node); } catch (e){} + try { delete window[_this.uid]; } catch (e){} + window[_this.uid] = _this.xhr.node = null; + }, 9); + } + }, + + abort: function (){ + this.end(0, 'abort'); + + if( this.xhr ){ + this.xhr.aborted = true; + this.xhr.abort(); + } + }, + + send: function (FormData){ + var _this = this, options = this.options; + + FormData.toData(function (data){ + if( data instanceof Error ){ + _this.end(0, data.message); + } + else{ + // Start uploading + options.upload(options, _this); + _this._send.call(_this, options, data); + } + }, options); + }, + + _send: function (options, data){ + var _this = this, xhr, uid = _this.uid, onLoadFnName = _this.uid + "Load", url = options.url; + + api.log('XHR._send:', data); + + if( !options.cache ){ + // No cache + url += (~url.indexOf('?') ? '&' : '?') + api.uid(); + } + + if( data.nodeName ){ + var jsonp = options.jsonp; + + // prepare callback in GET + url = url.replace(/([a-z]+)=(\?)/i, '$1='+uid); + + // legacy + options.upload(options, _this); + + var + onPostMessage = function (evt){ + if( ~url.indexOf(evt.origin) ){ + try { + var result = api.parseJSON(evt.data); + if( result.id == uid ){ + complete(result.status, result.statusText, result.response); + } + } catch( err ){ + complete(0, err.message); + } + } + }, + + // jsonp-callack + complete = window[uid] = function (status, statusText, response){ + _this.readyState = 4; + _this.responseText = response; + _this.end(status, statusText); + + api.event.off(window, 'message', onPostMessage); + window[uid] = xhr = transport = window[onLoadFnName] = null; + } + ; + + _this.xhr.abort = function (){ + try { + if( transport.stop ){ transport.stop(); } + else if( transport.contentWindow.stop ){ transport.contentWindow.stop(); } + else { transport.contentWindow.document.execCommand('Stop'); } + } + catch (er) {} + complete(0, "abort"); + }; + + api.event.on(window, 'message', onPostMessage); + + window[onLoadFnName] = function (){ + try { + var + win = transport.contentWindow + , doc = win.document + , result = win.result || api.parseJSON(doc.body.innerHTML) + ; + complete(result.status, result.statusText, result.response); + } catch (e){ + api.log('[transport.onload]', e); + } + }; + + xhr = document.createElement('div'); + xhr.innerHTML = '
              ' + + '' + + (jsonp && (options.url.indexOf('=?') < 0) ? '' : '') + + '' + ; + + // get form-data & transport + var + form = xhr.getElementsByTagName('form')[0] + , transport = xhr.getElementsByTagName('iframe')[0] + ; + + form.appendChild(data); + + api.log(form.parentNode.innerHTML); + + // append to DOM + document.body.appendChild(xhr); + + // keep a reference to node-transport + _this.xhr.node = xhr; + + // send + _this.readyState = 2; // loaded + try { + form.submit(); + } catch (err) { + api.log('iframe.error: ' + err); + } + form = null; + } + else { + // Clean url + url = url.replace(/([a-z]+)=(\?)&?/i, ''); + + // html5 + if (this.xhr && this.xhr.aborted) { + api.log("Error: already aborted"); + return; + } + xhr = _this.xhr = api.getXHR(); + + if (data.params) { + url += (url.indexOf('?') < 0 ? "?" : "&") + data.params.join("&"); + } + + xhr.open('POST', url, true); + + if( api.withCredentials ){ + xhr.withCredentials = "true"; + } + + if( !options.headers || !options.headers['X-Requested-With'] ){ + xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); + } + + api.each(options.headers, function (val, key){ + xhr.setRequestHeader(key, val); + }); + + + if ( options._chunked ) { + // chunked upload + if( xhr.upload ){ + xhr.upload.addEventListener('progress', api.throttle(function (/**Event*/evt){ + if (!data.retry) { + // show progress only for correct chunk uploads + options.progress({ + type: evt.type + , total: data.size + , loaded: data.start + evt.loaded + , totalSize: data.size + }, _this, options); + } + }, 100), false); + } + + xhr.onreadystatechange = function (){ + var lkb = parseInt(xhr.getResponseHeader('X-Last-Known-Byte'), 10); + + _this.status = xhr.status; + _this.statusText = xhr.statusText; + _this.readyState = xhr.readyState; + + if( xhr.readyState == 4 ){ + for( var k in _xhrResponsePostfix ){ + _this['response'+k] = xhr['response'+k]; + } + xhr.onreadystatechange = null; + + if (!xhr.status || xhr.status - 201 > 0) { + api.log("Error: " + xhr.status); + // some kind of error + // 0 - connection fail or timeout, if xhr.aborted is true, then it's not recoverable user action + // up - server error + if (((!xhr.status && !xhr.aborted) || 500 == xhr.status || 416 == xhr.status) && ++data.retry <= options.chunkUploadRetry) { + // let's try again the same chunk + // only applicable for recoverable error codes 500 && 416 + var delay = xhr.status ? 0 : api.chunkNetworkDownRetryTimeout; + + // inform about recoverable problems + options.pause(data.file, options); + + // smart restart if server reports about the last known byte + api.log("X-Last-Known-Byte: " + lkb); + if (lkb) { + data.end = lkb; + } else { + data.end = data.start - 1; + if (416 == xhr.status) { + data.end = data.end - options.chunkSize; + } + } + + setTimeout(function () { + _this._send(options, data); + }, delay); + } else { + // no mo retries + _this.end(xhr.status); + } + } else { + // success + data.retry = 0; + + if (data.end == data.size - 1) { + // finished + _this.end(xhr.status); + } else { + // next chunk + + // shift position if server reports about the last known byte + api.log("X-Last-Known-Byte: " + lkb); + if (lkb) { + data.end = lkb; + } + data.file.FileAPIReadPosition = data.end; + + setTimeout(function () { + _this._send(options, data); + }, 0); + } + } + + xhr = null; + } + }; + + data.start = data.end + 1; + data.end = Math.max(Math.min(data.start + options.chunkSize, data.size) - 1, data.start); + + // Retrieve a slice of file + var + file = data.file + , slice = (file.slice || file.mozSlice || file.webkitSlice).call(file, data.start, data.end + 1) + ; + + if( data.size && !slice.size ){ + setTimeout(function (){ + _this.end(-1); + }); + } else { + xhr.setRequestHeader("Content-Range", "bytes " + data.start + "-" + data.end + "/" + data.size); + xhr.setRequestHeader("Content-Disposition", 'attachment; filename=' + encodeURIComponent(data.name)); + xhr.setRequestHeader("Content-Type", data.type || "application/octet-stream"); + + xhr.send(slice); + } + + file = slice = null; + } else { + // single piece upload + if( xhr.upload ){ + // https://github.com/blueimp/jQuery-File-Upload/wiki/Fixing-Safari-hanging-on-very-high-speed-connections-%281Gbps%29 + xhr.upload.addEventListener('progress', api.throttle(function (/**Event*/evt){ + options.progress(evt, _this, options); + }, 100), false); + } + + xhr.onreadystatechange = function (){ + _this.status = xhr.status; + _this.statusText = xhr.statusText; + _this.readyState = xhr.readyState; + + if( xhr.readyState == 4 ){ + for( var k in _xhrResponsePostfix ){ + _this['response'+k] = xhr['response'+k]; + } + xhr.onreadystatechange = null; + + if (!xhr.status || xhr.status > 201) { + api.log("Error: " + xhr.status); + if (((!xhr.status && !xhr.aborted) || 500 == xhr.status) && (options.retry || 0) < options.uploadRetry) { + options.retry = (options.retry || 0) + 1; + var delay = api.networkDownRetryTimeout; + + // inform about recoverable problems + options.pause(options.file, options); + + setTimeout(function () { + _this._send(options, data); + }, delay); + } else { + //success + _this.end(xhr.status); + } + } else { + //success + _this.end(xhr.status); + } + + xhr = null; + } + }; + + if( api.isArray(data) ){ + // multipart + xhr.setRequestHeader('Content-Type', 'multipart/form-data; boundary=_'+api.expando); + var rawData = data.join('') +'--_'+ api.expando +'--'; + + /** @namespace xhr.sendAsBinary https://developer.mozilla.org/ru/XMLHttpRequest#Sending_binary_content */ + if( xhr.sendAsBinary ){ + xhr.sendAsBinary(rawData); + } + else { + var bytes = Array.prototype.map.call(rawData, function(c){ return c.charCodeAt(0) & 0xff; }); + xhr.send(new Uint8Array(bytes).buffer); + + } + } else { + // FormData + xhr.send(data); + } + } + } + } + }; + + + // @export + api.XHR = XHR; +})(window, FileAPI); + +/** + * @class FileAPI.Camera + * @author RubaXa + * @support Chrome 21+, FF 18+, Opera 12+ + */ + +/*global window, FileAPI, jQuery */ +/** @namespace LocalMediaStream -- https://developer.mozilla.org/en-US/docs/WebRTC/MediaStream_API#LocalMediaStream */ +(function (window, api){ + "use strict"; + + var + URL = window.URL || window.webkitURL, + + document = window.document, + navigator = window.navigator, + + getMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia, + + html5 = !!getMedia + ; + + + // Support "media" + api.support.media = html5; + + + var Camera = function (video){ + this.video = video; + }; + + + Camera.prototype = { + isActive: function (){ + return !!this._active; + }, + + + /** + * Start camera streaming + * @param {Function} callback + */ + start: function (callback){ + var + _this = this + , video = _this.video + , _successId + , _failId + , _complete = function (err){ + _this._active = !err; + clearTimeout(_failId); + clearTimeout(_successId); +// api.event.off(video, 'loadedmetadata', _complete); + callback && callback(err, _this); + } + ; + + getMedia.call(navigator, { video: true }, function (stream/**LocalMediaStream*/){ + // Success + _this.stream = stream; + +// api.event.on(video, 'loadedmetadata', function (){ +// _complete(null); +// }); + + // Set camera stream + video.src = URL.createObjectURL(stream); + + // Note: onloadedmetadata doesn't fire in Chrome when using it with getUserMedia. + // See crbug.com/110938. + _successId = setInterval(function (){ + if( _detectVideoSignal(video) ){ + _complete(null); + } + }, 1000); + + _failId = setTimeout(function (){ + _complete('timeout'); + }, 5000); + + // Go-go-go! + video.play(); + }, _complete/*error*/); + }, + + + /** + * Stop camera streaming + */ + stop: function (){ + try { + this._active = false; + this.video.pause(); + + try { + this.stream.stop(); + } catch (err) { + api.each(this.stream.getTracks(), function (track) { + track.stop(); + }); + } + + this.stream = null; + } catch( err ){ + api.log('[FileAPI.Camera] stop:', err); + } + }, + + + /** + * Create screenshot + * @return {FileAPI.Camera.Shot} + */ + shot: function (){ + return new Shot(this.video); + } + }; + + + /** + * Get camera element from container + * + * @static + * @param {HTMLElement} el + * @return {Camera} + */ + Camera.get = function (el){ + return new Camera(el.firstChild); + }; + + + /** + * Publish camera element into container + * + * @static + * @param {HTMLElement} el + * @param {Object} options + * @param {Function} [callback] + */ + Camera.publish = function (el, options, callback){ + if( typeof options == 'function' ){ + callback = options; + options = {}; + } + + // Dimensions of "camera" + options = api.extend({}, { + width: '100%' + , height: '100%' + , start: true + }, options); + + + if( el.jquery ){ + // Extract first element, from jQuery collection + el = el[0]; + } + + + var doneFn = function (err){ + if( err ){ + callback(err); + } + else { + // Get camera + var cam = Camera.get(el); + if( options.start ){ + cam.start(callback); + } + else { + callback(null, cam); + } + } + }; + + + el.style.width = _px(options.width); + el.style.height = _px(options.height); + + + if( api.html5 && html5 ){ + // Create video element + var video = document.createElement('video'); + + // Set dimensions + video.style.width = _px(options.width); + video.style.height = _px(options.height); + + // Clean container + if( window.jQuery ){ + jQuery(el).empty(); + } else { + el.innerHTML = ''; + } + + // Add "camera" to container + el.appendChild(video); + + // end + doneFn(); + } + else { + Camera.fallback(el, options, doneFn); + } + }; + + + Camera.fallback = function (el, options, callback){ + callback('not_support_camera'); + }; + + + /** + * @class FileAPI.Camera.Shot + */ + var Shot = function (video){ + var canvas = video.nodeName ? api.Image.toCanvas(video) : video; + var shot = api.Image(canvas); + shot.type = 'image/png'; + shot.width = canvas.width; + shot.height = canvas.height; + shot.size = canvas.width * canvas.height * 4; + return shot; + }; + + + /** + * Add "px" postfix, if value is a number + * + * @private + * @param {*} val + * @return {String} + */ + function _px(val){ + return val >= 0 ? val + 'px' : val; + } + + + /** + * @private + * @param {HTMLVideoElement} video + * @return {Boolean} + */ + function _detectVideoSignal(video){ + var canvas = document.createElement('canvas'), ctx, res = false; + try { + ctx = canvas.getContext('2d'); + ctx.drawImage(video, 0, 0, 1, 1); + res = ctx.getImageData(0, 0, 1, 1).data[4] != 255; + } + catch( err ){ + api.log('[FileAPI.Camera] detectVideoSignal:', err); + } + return res; + } + + + // @export + Camera.Shot = Shot; + api.Camera = Camera; +})(window, FileAPI); + +/** + * FileAPI fallback to Flash + * + * @flash-developer "Vladimir Demidov" + */ + +/*global window, FileAPI */ +(function (window, jQuery, api) { + "use strict"; + + var _each = api.each, + _cameraQueue = []; + + if (api.support.flash && (api.media && (!api.support.media || !api.html5))) { + (function () { + function _wrap(fn) { + var id = fn.wid = api.uid(); + api.Flash._fn[id] = fn; + return 'FileAPI.Flash._fn.' + id; + } + + + function _unwrap(fn) { + try { + api.Flash._fn[fn.wid] = null; + delete api.Flash._fn[fn.wid]; + } catch (e) { + } + } + + var flash = api.Flash; + api.extend(api.Flash, { + + patchCamera: function () { + api.Camera.fallback = function (el, options, callback) { + var camId = api.uid(); + api.log('FlashAPI.Camera.publish: ' + camId); + flash.publish(el, camId, api.extend(options, { + camera: true, + onEvent: _wrap(function _(evt) { + if (evt.type === 'camera') { + _unwrap(_); + + if (evt.error) { + api.log('FlashAPI.Camera.publish.error: ' + evt.error); + callback(evt.error); + } else { + api.log('FlashAPI.Camera.publish.success: ' + camId); + callback(null); + } + } + }) + })); + }; + // Run + _each(_cameraQueue, function (args) { + api.Camera.fallback.apply(api.Camera, args); + }); + _cameraQueue = []; + + + // FileAPI.Camera:proto + api.extend(api.Camera.prototype, { + _id: function () { + return this.video.id; + }, + + start: function (callback) { + var _this = this; + flash.cmd(this._id(), 'camera.on', { + callback: _wrap(function _(evt) { + _unwrap(_); + + if (evt.error) { + api.log('FlashAPI.camera.on.error: ' + evt.error); + callback(evt.error, _this); + } else { + api.log('FlashAPI.camera.on.success: ' + _this._id()); + _this._active = true; + callback(null, _this); + } + }) + }); + }, + + stop: function () { + this._active = false; + flash.cmd(this._id(), 'camera.off'); + }, + + shot: function () { + api.log('FlashAPI.Camera.shot:', this._id()); + + var shot = api.Flash.cmd(this._id(), 'shot', {}); + shot.type = 'image/png'; + shot.flashId = this._id(); + shot.isShot = true; + + return new api.Camera.Shot(shot); + } + }); + } + }); + + api.Camera.fallback = function () { + _cameraQueue.push(arguments); + }; + + }()); + } +}(window, window.jQuery, FileAPI)); if( typeof define === "function" && define.amd ){ define("FileAPI", [], function (){ return FileAPI; }); } \ No newline at end of file diff --git a/manager/media/browser/mcpuk/js/FileAPI/FileAPI.html5.min.js b/manager/media/browser/mcpuk/js/FileAPI/FileAPI.html5.min.js index f5c8153fb4..d3a8e21162 100644 --- a/manager/media/browser/mcpuk/js/FileAPI/FileAPI.html5.min.js +++ b/manager/media/browser/mcpuk/js/FileAPI/FileAPI.html5.min.js @@ -1,3 +1,3 @@ -/*! FileAPI 2.0.19 - BSD | git://github.com/mailru/FileAPI.git */ -!function(a){"use strict";var b=a.HTMLCanvasElement&&a.HTMLCanvasElement.prototype,c=a.Blob&&function(){try{return Boolean(new Blob)}catch(a){return!1}}(),d=c&&a.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(a){return!1}}(),e=a.BlobBuilder||a.WebKitBlobBuilder||a.MozBlobBuilder||a.MSBlobBuilder,f=(c||e)&&a.atob&&a.ArrayBuffer&&a.Uint8Array&&function(a){var b,f,g,h,i,j;for(b=a.split(",")[0].indexOf("base64")>=0?atob(a.split(",")[1]):decodeURIComponent(a.split(",")[1]),f=new ArrayBuffer(b.length),g=new Uint8Array(f),h=0;h0,H=a.dataURLtoBlob,I=/img/i,J=/canvas/i,K=/img|canvas/i,L=/input/i,M=/^data:[^,]+,/,N={}.toString,O=a.Math,P=function(b){return b=new a.Number(O.pow(1024,b)),b.from=function(a){return O.round(a*this)},b},Q={},R=[],S="abort progress error load loadend",T="status statusText readyState response responseXML responseText responseBody".split(" "),U="currentTarget",V="preventDefault",W=function(a){return a&&"length"in a},X=function(a,b,c){if(a)if(W(a))for(var d=0,e=a.length;e>d;d++)d in a&&b.call(c,a[d],d,a);else for(var f in a)a.hasOwnProperty(f)&&b.call(c,a[f],f,a)},Y=function(a){for(var b=arguments,c=1,d=function(b,c){a[c]=b};c=c&&!d&&f.end()},isFail:function(){return d},fail:function(){!d&&a(d=!0)},end:function(){e||(e=!0,a())}};return f},each:X,afor:function(a,b){var c=0,d=a.length;W(a)&&d--?!function e(){b(d!=c&&e,a[c],c++)}():b(!1)},extend:Y,isFile:function(a){return"[object File]"===N.call(a)},isBlob:function(a){return this.isFile(a)||"[object Blob]"===N.call(a)},isCanvas:function(a){return a&&J.test(a.nodeName)},getFilesFilter:function(a){return a="string"==typeof a?a:a.getAttribute&&a.getAttribute("accept")||"",a?new RegExp("("+a.replace(/\./g,"\\.").replace(/,/g,"|")+")$","i"):/./},readAsDataURL:function(a,b){ca.isCanvas(a)?c(a,b,"load",ca.toDataURL(a)):e(a,b,"DataURL")},readAsBinaryString:function(a,b){d("BinaryString")?e(a,b,"BinaryString"):e(a,function(a){if("load"==a.type)try{a.result=ca.toBinaryString(a.result)}catch(c){a.type="error",a.message=c.toString()}b(a)},"DataURL")},readAsArrayBuffer:function(a,b){e(a,b,"ArrayBuffer")},readAsText:function(a,b,c){c||(c=b,b="utf-8"),e(a,c,"Text",b)},toDataURL:function(a,b){return"string"==typeof a?a:a.toDataURL?a.toDataURL(b||"image/png"):void 0},toBinaryString:function(b){return a.atob(ca.toDataURL(b).replace(M,""))},readAsImage:function(a,d,e){if(ca.isBlob(a))if(w){var f=w.createObjectURL(a);f===b?c(a,d,"error"):ca.readAsImage(f,d,e)}else ca.readAsDataURL(a,function(b){"load"==b.type?ca.readAsImage(b.result,d,e):(e||"error"==b.type)&&c(a,d,b,null,{loaded:b.loaded,total:b.total})});else if(ca.isCanvas(a))c(a,d,"load",a);else if(I.test(a.nodeName))if(a.complete)c(a,d,"load",a);else{var g="error abort load";_(a,g,function i(b){"load"==b.type&&w&&w.revokeObjectURL(a.src),$(a,g,i),c(a,d,b,a)})}else if(a.iframe)c(a,d,{type:"error"});else{var h=ca.newImage(a.dataURL||a);ca.readAsImage(h,d,e)}},checkFileObj:function(a){var b={},c=ca.accept;return"object"==typeof a?b=a:b.name=(a+"").split(/\\|\//g).pop(),null==b.type&&(b.type=b.name.split(".").pop()),X(c,function(a,c){a=new RegExp(a.replace(/\s/g,"|"),"i"),(a.test(b.type)||ca.ext2mime[b.type])&&(b.type=ca.ext2mime[b.type]||c.split("/")[0]+"/"+b.type)}),b},getDropFiles:function(a,b){var c,d=[],e=[],j=l(a),k=j.files,m=j.items,n=W(m)&&m[0]&&h(m[0]),o=ca.queue(function(){b(d,e)});if(n)if(G&&k){var p,q,r=k.length;for(c=new Array(r);r--;){p=k[r];try{q=h(m[r])}catch(s){ca.log("[err] getDropFiles: ",s),q=null}g(q)&&(q.isDirectory||q.isFile&&p.name==p.name.normalize("NFC"))?c[r]=q:c[r]=p}}else c=m;else c=k;X(c||[],function(a){o.inc();try{n&&g(a)?i(a,function(a,b,c){a?ca.log("[err] getDropFiles:",a):d.push.apply(d,b),e.push.apply(e,c),o.next()}):f(a,function(b,c){b?d.push(a):a.error=c,e.push(a),o.next()})}catch(b){o.next(),ca.log("[err] getDropFiles: ",b)}}),o.check()},getFiles:function(a,b,c){var d=[];return c?(ca.filterFiles(ca.getFiles(a),b,c),null):(a.jquery&&(a.each(function(){d=d.concat(ca.getFiles(this))}),a=d,d=[]),"string"==typeof b&&(b=ca.getFilesFilter(b)),a.originalEvent?a=aa(a.originalEvent):a.srcElement&&(a=aa(a)),a.dataTransfer?a=a.dataTransfer:a.target&&(a=a.target),a.files?(d=a.files,D||(d[0].blob=a,d[0].iframe=!0)):!D&&k(a)?ca.trim(a.value)&&(d=[ca.checkFileObj(a.value)],d[0].blob=a,d[0].iframe=!0):W(a)&&(d=a),ca.filter(d,function(a){return!b||b.test(a.name)}))},getTotalSize:function(a){for(var b=0,c=a&&a.length;c--;)b+=a[c].size;return b},getInfo:function(a,b){var c={},d=R.concat();ca.isBlob(a)?!function e(){var f=d.shift();f?f.test(a.type)?f(a,function(a,d){a?b(a):(Y(c,d),e())}):e():b(!1,c)}():b("not_support_info",c)},addInfoReader:function(a,b){b.test=function(b){return a.test(b)},R.push(b)},filter:function(a,b){for(var c,d=[],e=0,f=a.length;f>e;e++)e in a&&(c=a[e],b.call(c,c,e,a)&&d.push(c));return d},filterFiles:function(a,b,c){if(a.length){var d,e=a.concat(),f=[],g=[];!function h(){e.length?(d=e.shift(),ca.getInfo(d,function(a,c){(b(d,a?!1:c)?f:g).push(d),h()})):c(f,g)}()}else c([],a)},upload:function(a){a=Y({jsonp:"callback",prepare:ca.F,beforeupload:ca.F,upload:ca.F,fileupload:ca.F,fileprogress:ca.F,filecomplete:ca.F,progress:ca.F,complete:ca.F,pause:ca.F,imageOriginal:!0,chunkSize:ca.chunkSize,chunkUploadRetry:ca.chunkUploadRetry,uploadRetry:ca.uploadRetry},a),a.imageAutoOrientation&&!a.imageTransform&&(a.imageTransform={rotate:"auto"});var b,c=new ca.XHR(a),d=this._getFilesDataArray(a.files),e=this,f=0,g=0,h=!1;return X(d,function(a){f+=a.size}),c.files=[],X(d,function(a){c.files.push(a.file)}),c.total=f,c.loaded=0,c.filesLeft=d.length,a.beforeupload(c,a),b=function(){var i=d.shift(),k=i&&i.file,l=!1,m=j(a);if(c.filesLeft=d.length,k&&k.name===ca.expando&&(k=null,ca.log("[warn] FileAPI.upload() — called without files")),("abort"!=c.statusText||c.current)&&i){if(h=!1,c.currentFile=k,k&&a.prepare(k,m)===!1)return void b.call(e);m.file=k,e._getFormData(m,i,function(h){g||a.upload(c,a);var j=new ca.XHR(Y({},m,{upload:k?function(){a.fileupload(k,j,m)}:q,progress:k?function(b){l||(l=b.loaded===b.total,a.fileprogress({type:"progress",total:i.total=b.total,loaded:i.loaded=b.loaded},k,j,m),a.progress({type:"progress",total:f,loaded:c.loaded=g+i.size*(b.loaded/b.total)||0},k,j,m))}:q,complete:function(d){X(T,function(a){c[a]=j[a]}),k&&(i.total=i.total||i.size,i.loaded=i.total,d||(this.progress(i),l=!0,g+=i.size,c.loaded=g),a.filecomplete(d,j,k,m)),setTimeout(function(){b.call(e)},0)}}));c.abort=function(a){a||(d.length=0),this.current=a,j.abort()},j.send(h)})}else{var n=200==c.status||201==c.status||204==c.status;a.complete(n?!1:c.statusText||"error",c,a),h=!0}},setTimeout(b,0),c.append=function(a,g){a=ca._getFilesDataArray([].concat(a)),X(a,function(a){f+=a.size,c.files.push(a.file),g?d.unshift(a):d.push(a)}),c.statusText="",h&&b.call(e)},c.remove=function(a){for(var b,c=d.length;c--;)d[c].file==a&&(b=d.splice(c,1),f-=b.size);return b},c},_getFilesDataArray:function(a){var b=[],c={};if(k(a)){var d=ca.getFiles(a);c[a.name||"file"]=null!==a.getAttribute("multiple")?d:d[0]}else W(a)&&k(a[0])?X(a,function(a){c[a.name||"file"]=ca.getFiles(a)}):c=a;return X(c,function e(a,c){W(a)?X(a,function(a){e(a,c)}):a&&(a.name||a.image)&&b.push({name:c,file:a,size:a.size,total:a.size,loaded:0})}),b.length||b.push({file:{name:ca.expando}}),b},_getFormData:function(a,b,c){var d=b.file,e=b.name,f=d.name,g=d.type,h=ca.support.transform&&a.imageTransform,i=new ca.Form,j=ca.queue(function(){c(i)}),k=h&&m(h),l=ca.postNameConcat;X(a.data,function n(a,b){"object"==typeof a?X(a,function(a,c){n(a,l(b,c))}):i.append(b,a)}),function o(b){b.image?(j.inc(),b.toData(function(a,c){b.file&&(c.type=b.file.type,c.quality=b.matrix.quality,f=b.file&&b.file.name),f=f||(new Date).getTime()+".png",o(c),j.next()})):ca.Image&&h&&(/^image/.test(b.type)||K.test(b.nodeName))?(j.inc(),k&&(h=[h]),ca.Image.transform(b,h,a.imageAutoOrientation,function(c,d){if(k&&!c)H||ca.flashEngine||(i.multipart=!0),i.append(e,d[0],f,h[0].type||g);else{var m=0;c||X(d,function(a,b){H||ca.flashEngine||(i.multipart=!0),h[b].postName||(m=1),i.append(h[b].postName||l(e,b),a,f,h[b].type||g)}),(c||a.imageOriginal)&&i.append(l(e,m?"original":null),b,f,g)}j.next()})):f!==ca.expando&&i.append(e,b,f)}(d),j.check()},reset:function(a,b){var c,d;return C?(d=C(a).clone(!0).insertBefore(a).val("")[0],b||C(a).remove()):(c=a.parentNode,d=c.insertBefore(a.cloneNode(!0),a),d.value="",b||c.removeChild(a),X(Q[ca.uid(a)],function(b,c){X(b,function(b){$(a,c,b),Z(d,c,b)})})),d},load:function(a,b){var c=ca.getXHR();return c?(c.open("GET",a,!0),c.overrideMimeType&&c.overrideMimeType("text/plain; charset=x-user-defined"),Z(c,"progress",function(a){a.lengthComputable&&b({type:a.type,loaded:a.loaded,total:a.total},c)}),c.onreadystatechange=function(){if(4==c.readyState)if(c.onreadystatechange=null,200==c.status){a=a.split("/");var d={name:a[a.length-1],size:c.getResponseHeader("Content-Length"),type:c.getResponseHeader("Content-Type")};d.dataURL="data:"+d.type+";base64,"+ca.encode64(c.responseBody||c.responseText),b({type:"load",result:d},c)}else b({type:"error"},c)},c.send(null)):b({type:"error"}),c},encode64:function(a){var b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c="",d=0;for("string"!=typeof a&&(a=String(a));d>2,k=(3&g)<<4|h>>4;isNaN(h)?e=f=64:(e=(15&h)<<2|i>>6,f=isNaN(i)?64:63&i),c+=b.charAt(j)+b.charAt(k)+b.charAt(e)+b.charAt(f)}return c}};ca.addInfoReader(/^image/,function(a,b){if(!a.__dimensions){var c=a.__dimensions=ca.defer();ca.readAsImage(a,function(a){var b=a.target;c.resolve("load"==a.type?!1:"error",{width:b.width,height:b.height}),b.src=ca.EMPTY_PNG,b=null})}a.__dimensions.then(b)}),ca.event.dnd=function(a,b,c){var d,e;c||(c=b,b=ca.F),z?(Z(a,"dragenter dragleave dragover",b.ff=b.ff||function(a){for(var c=l(a).types,f=c&&c.length,g=!1;f--;)if(~c[f].indexOf("File")){a[V](),e!==a.type&&(e=a.type,"dragleave"!=e&&b.call(a[U],!0,a),g=!0);break}g&&(clearTimeout(d),d=setTimeout(function(){b.call(a[U],"dragleave"!=e,a)},50))}),Z(a,"drop",c.ff=c.ff||function(a){a[V](),e=0,b.call(a[U],!1,a),ca.getDropFiles(a,function(b,d){c.call(a[U],b,d,a)})})):ca.log("Drag'n'Drop -- not supported")},ca.event.dnd.off=function(a,b,c){$(a,"dragenter dragleave dragover",b.ff),$(a,"drop",c.ff)},C&&!C.fn.dnd&&(C.fn.dnd=function(a,b){return this.each(function(){ca.event.dnd(this,a,b)})},C.fn.offdnd=function(a,b){return this.each(function(){ca.event.dnd.off(this,a,b)})}),a.FileAPI=Y(ca,a.FileAPI),ca.log("FileAPI: "+ca.version),ca.log("protocol: "+a.location.protocol),ca.log("doctype: ["+s.name+"] "+s.publicId+" "+s.systemId),X(r.getElementsByTagName("meta"),function(a){/x-ua-compatible/i.test(a.getAttribute("http-equiv"))&&ca.log("meta.http-equiv: "+a.getAttribute("content"))});try{n=!!console.log,o=!!console.log.apply}catch(da){}ca.flashUrl||(ca.flashUrl=ca.staticPath+"FileAPI.flash.swf"),ca.flashImageUrl||(ca.flashImageUrl=ca.staticPath+"FileAPI.flash.image.swf"),ca.flashWebcamUrl||(ca.flashWebcamUrl=ca.staticPath+"FileAPI.flash.camera.swf")}(window,void 0),function(a,b,c){"use strict";function d(b){if(b instanceof d){var c=new d(b.file);return a.extend(c.matrix,b.matrix),c}return this instanceof d?(this.file=b,this.size=b.size||100,void(this.matrix={sx:0,sy:0,sw:0,sh:0,dx:0,dy:0,dw:0,dh:0,resize:0,deg:0,quality:1,filter:0})):new d(b)}var e=Math.min,f=Math.round,g=function(){return b.createElement("canvas")},h=!1,i={8:270,3:180,6:90,7:270,4:180,5:90};try{h=g().toDataURL("image/png").indexOf("data:image/png")>-1}catch(j){}d.prototype={image:!0,constructor:d,set:function(b){return a.extend(this.matrix,b),this},crop:function(a,b,d,e){return d===c&&(d=a,e=b,a=b=0),this.set({sx:a,sy:b,sw:d,sh:e||d})},resize:function(a,b,c){return/min|max|height|width/.test(b)&&(c=b,b=a),this.set({dw:a,dh:b||a,resize:c})},preview:function(a,b){return this.resize(a,b||a,"preview")},rotate:function(a){return this.set({deg:a})},filter:function(a){return this.set({filter:a})},overlay:function(a){return this.set({overlay:a})},clone:function(){return new d(this)},_load:function(b,c){var d=this;/img|video/i.test(b.nodeName)?c.call(d,null,b):a.readAsImage(b,function(a){c.call(d,"load"!=a.type,a.result)})},_apply:function(b,c){var f,h=g(),i=this.getMatrix(b),j=h.getContext("2d"),k=b.videoWidth||b.width,l=b.videoHeight||b.height,m=i.deg,n=i.dw,o=i.dh,p=k,q=l,r=i.filter,s=b,t=i.overlay,u=a.queue(function(){b.src=a.EMPTY_PNG,c(!1,h)}),v=a.renderImageToCanvas;for(m-=360*Math.floor(m/360),b._type=this.file.type;i.multipass&&e(p/n,q/o)>2;)p=p/2+.5|0,q=q/2+.5|0,f=g(),f.width=p,f.height=q,s!==b?(v(f,s,0,0,s.width,s.height,0,0,p,q),s=f):(s=f,v(s,b,i.sx,i.sy,i.sw,i.sh,0,0,p,q),i.sx=i.sy=i.sw=i.sh=0);h.width=m%180?o:n,h.height=m%180?n:o,h.type=i.type,h.quality=i.quality,j.rotate(m*Math.PI/180),v(j.canvas,s,i.sx,i.sy,i.sw||s.width,i.sh||s.height,180==m||270==m?-n:0,90==m||180==m?-o:0,n,o),n=h.width,o=h.height,t&&a.each([].concat(t),function(b){u.inc();var c=new window.Image,d=function(){var e=0|b.x,f=0|b.y,g=b.w||c.width,h=b.h||c.height,i=b.rel;e=1==i||4==i||7==i?(n-g+e)/2:2==i||5==i||8==i?n-(g+e):e,f=3==i||4==i||5==i?(o-h+f)/2:i>=6?o-(h+f):f,a.event.off(c,"error load abort",d);try{j.globalAlpha=b.opacity||1,j.drawImage(c,e,f,g,h)}catch(k){}u.next()};a.event.on(c,"error load abort",d),c.src=b.src,c.complete&&d()}),r&&(u.inc(),d.applyFilter(h,r,u.next)),u.check()},getMatrix:function(b){var c=a.extend({},this.matrix),d=c.sw=c.sw||b.videoWidth||b.naturalWidth||b.width,g=c.sh=c.sh||b.videoHeight||b.naturalHeight||b.height,h=c.dw=c.dw||d,i=c.dh=c.dh||g,j=d/g,k=h/i,l=c.resize;if("preview"==l){if(h!=d||i!=g){var m,n;k>=j?(m=d,n=m/k):(n=g,m=n*k),(m!=d||n!=g)&&(c.sx=~~((d-m)/2),c.sy=~~((g-n)/2),d=m,g=n)}}else"height"==l?h=i*j:"width"==l?i=h/j:l&&(d>h||g>i?"min"==l?(h=f(k>j?e(d,h):i*j),i=f(k>j?h/j:e(g,i))):(h=f(j>=k?e(d,h):i*j),i=f(j>=k?h/j:e(g,i))):(h=d,i=g));return c.sw=d,c.sh=g,c.dw=h,c.dh=i,c.multipass=a.multiPassResize,c},_trans:function(b){this._load(this.file,function(c,d){if(c)b(c);else try{this._apply(d,b)}catch(c){a.log("[err] FileAPI.Image.fn._apply:",c),b(c)}})},get:function(b){if(a.support.transform){var c=this,d=c.matrix;"auto"==d.deg?a.getInfo(c.file,function(a,e){d.deg=i[e&&e.exif&&e.exif.Orientation]||0,c._trans(b)}):c._trans(b)}else b("not_support_transform");return this},toData:function(a){return this.get(a)}},d.exifOrientation=i,d.transform=function(b,e,f,g){function h(h,i){var j={},k=a.queue(function(a){g(a,j)});h?k.fail():a.each(e,function(a,e){if(!k.isFail()){var g=new d(i.nodeType?i:b),h="function"==typeof a;if(h?a(i,g):a.width?g[a.preview?"preview":"resize"](a.width,a.height,a.strategy):a.maxWidth&&(i.width>a.maxWidth||i.height>a.maxHeight)&&g.resize(a.maxWidth,a.maxHeight,"max"),a.crop){var l=a.crop;g.crop(0|l.x,0|l.y,l.w||l.width,l.h||l.height)}a.rotate===c&&f&&(a.rotate="auto"),g.set({type:g.matrix.type||a.type||b.type||"image/png"}),h||g.set({deg:a.rotate,overlay:a.overlay,filter:a.filter,quality:a.quality||1}),k.inc(),g.toData(function(a,b){a?k.fail():(j[e]=b,k.next())})}})}b.width?h(!1,b):a.getInfo(b,h)},a.each(["TOP","CENTER","BOTTOM"],function(b,c){a.each(["LEFT","CENTER","RIGHT"],function(a,e){d[b+"_"+a]=3*c+e,d[a+"_"+b]=3*c+e})}),d.toCanvas=function(a){var c=b.createElement("canvas");return c.width=a.videoWidth||a.width,c.height=a.videoHeight||a.height,c.getContext("2d").drawImage(a,0,0),c},d.fromDataURL=function(b,c,d){var e=a.newImage(b);a.extend(e,c),d(e)},d.applyFilter=function(b,c,e){"function"==typeof c?c(b,e):window.Caman&&window.Caman("IMG"==b.tagName?d.toCanvas(b):b,function(){"string"==typeof c?this[c]():a.each(c,function(a,b){this[b](a)},this),this.render(e)})},a.renderImageToCanvas=function(b,c,d,e,f,g,h,i,j,k){try{return b.getContext("2d").drawImage(c,d,e,f,g,h,i,j,k)}catch(l){throw a.log("renderImageToCanvas failed"),l}},a.support.canvas=a.support.transform=h,a.Image=d}(FileAPI,document),function(a){"use strict";a(FileAPI)}(function(a){"use strict";if(window.navigator&&window.navigator.platform&&/iP(hone|od|ad)/.test(window.navigator.platform)){var b=a.renderImageToCanvas;a.detectSubsampling=function(a){var b,c;return a.width*a.height>1048576?(b=document.createElement("canvas"),b.width=b.height=1,c=b.getContext("2d"),c.drawImage(a,-a.width+1,0),0===c.getImageData(0,0,1,1).data[3]):!1},a.detectVerticalSquash=function(a,b){var c,d,e,f,g,h=a.naturalHeight||a.height,i=document.createElement("canvas"),j=i.getContext("2d");for(b&&(h/=2),i.width=1,i.height=h,j.drawImage(a,0,0),c=j.getImageData(0,0,1,h).data,d=0,e=h,f=h;f>d;)g=c[4*(f-1)+3],0===g?e=f:d=f,f=e+d>>1;return f/h||1},a.renderImageToCanvas=function(c,d,e,f,g,h,i,j,k,l){if("image/jpeg"===d._type){var m,n,o,p,q=c.getContext("2d"),r=document.createElement("canvas"),s=1024,t=r.getContext("2d");if(r.width=s,r.height=s,q.save(),m=a.detectSubsampling(d),m&&(e/=2,f/=2,g/=2,h/=2),n=a.detectVerticalSquash(d,m),m||1!==n){for(f*=n,k=Math.ceil(s*k/g),l=Math.ceil(s*l/h/n),j=0,p=0;h>p;){for(i=0,o=0;g>o;)t.clearRect(0,0,s,s),t.drawImage(d,e,f,g,h,-o,-p,g,h),q.drawImage(r,0,0,s,s,i,j,k,l),o+=s,i+=k;p+=s,j+=l}return q.restore(),c}}return b(c,d,e,f,g,h,i,j,k,l)}}}),function(a,b){"use strict";function c(b,c,d){var e=b.blob,f=b.file;if(f){if(!e.toDataURL)return void a.readAsBinaryString(e,function(a){"load"==a.type&&c(b,a.result)});var g={"image/jpeg":".jpe?g","image/png":".png"},h=g[b.type]?b.type:"image/png",i=g[h]||".png",j=e.quality||1;f.match(new RegExp(i+"$","i"))||(f+=i.replace("?","")),b.file=f,b.type=h,!d&&e.toBlob?e.toBlob(function(a){c(b,a)},h,j):c(b,a.toBinaryString(e.toDataURL(h,j)))}else c(b,e)}var d=b.document,e=b.FormData,f=function(){this.items=[]},g=b.encodeURIComponent;f.prototype={append:function(a,b,c,d){this.items.push({name:a,blob:b&&b.blob||(void 0==b?"":b),file:b&&(c||b.name),type:b&&(d||b.type)})},each:function(a){for(var b=0,c=this.items.length;c>b;b++)a.call(this,this.items[b])},toData:function(b,c){c._chunked=a.support.chunked&&c.chunkSize>0&&1==a.filter(this.items,function(a){return a.file}).length,a.support.html5?a.formData&&!this.multipart&&e?c._chunked?(a.log("FileAPI.Form.toPlainData"),this.toPlainData(b)):(a.log("FileAPI.Form.toFormData"),this.toFormData(b)):(a.log("FileAPI.Form.toMultipartData"),this.toMultipartData(b)):(a.log("FileAPI.Form.toHtmlData"),this.toHtmlData(b))},_to:function(b,c,d,e){var f=a.queue(function(){c(b)});this.each(function(g){try{d(g,b,f,e)}catch(h){a.log("FileAPI.Form._to: "+h.message),c(h)}}),f.check()},toHtmlData:function(b){this._to(d.createDocumentFragment(),b,function(b,c){var e,f=b.blob;b.file?(a.reset(f,!0),f.name=b.name,f.disabled=!1,c.appendChild(f)):(e=d.createElement("input"),e.name=b.name,e.type="hidden",e.value=f,c.appendChild(e))})},toPlainData:function(a){this._to({},a,function(a,b,d){a.file&&(b.type=a.file),a.blob.toBlob?(d.inc(),c(a,function(a,c){b.name=a.name,b.file=c,b.size=c.length,b.type=a.type,d.next()})):a.file?(b.name=a.blob.name,b.file=a.blob,b.size=a.blob.size,b.type=a.type):(b.params||(b.params=[]),b.params.push(g(a.name)+"="+g(a.blob))),b.start=-1,b.end=b.file&&b.file.FileAPIReadPosition||-1,b.retry=0})},toFormData:function(a){this._to(new e,a,function(a,b,d){a.blob&&a.blob.toBlob?(d.inc(),c(a,function(a,c){b.append(a.name,c,a.file),d.next()})):a.file?b.append(a.name,a.blob,a.file):b.append(a.name,a.blob),a.file&&b.append("_"+a.name,a.file)})},toMultipartData:function(b){this._to([],b,function(a,b,d,e){d.inc(),c(a,function(a,c){b.push("--_"+e+('\r\nContent-Disposition: form-data; name="'+a.name+'"'+(a.file?'; filename="'+g(a.file)+'"':"")+(a.file?"\r\nContent-Type: "+(a.type||"application/octet-stream"):"")+"\r\n\r\n"+(a.file?c:g(c))+"\r\n")),d.next()},!0)},a.expando)}},a.Form=f}(FileAPI,window),function(a,b){"use strict";var c=function(){},d=a.document,e=function(a){this.uid=b.uid(),this.xhr={abort:c,getResponseHeader:c,getAllResponseHeaders:c},this.options=a},f={"":1,XML:1,Text:1,Body:1};e.prototype={status:0,statusText:"",constructor:e,getResponseHeader:function(a){return this.xhr.getResponseHeader(a)},getAllResponseHeaders:function(){return this.xhr.getAllResponseHeaders()||{}},end:function(d,e){var f=this,g=f.options;f.end=f.abort=c,f.status=d,e&&(f.statusText=e),b.log("xhr.end:",d,e),g.complete(200==d||201==d?!1:f.statusText||"unknown",f),f.xhr&&f.xhr.node&&setTimeout(function(){var b=f.xhr.node;try{b.parentNode.removeChild(b)}catch(c){}try{delete a[f.uid]}catch(c){}a[f.uid]=f.xhr.node=null},9)},abort:function(){this.end(0,"abort"),this.xhr&&(this.xhr.aborted=!0,this.xhr.abort())},send:function(a){var b=this,c=this.options;a.toData(function(a){a instanceof Error?b.end(0,a.message):(c.upload(c,b),b._send.call(b,c,a))},c)},_send:function(c,e){var g,h=this,i=h.uid,j=h.uid+"Load",k=c.url;if(b.log("XHR._send:",e),c.cache||(k+=(~k.indexOf("?")?"&":"?")+b.uid()),e.nodeName){var l=c.jsonp;k=k.replace(/([a-z]+)=(\?)/i,"$1="+i),c.upload(c,h);var m=function(a){if(~k.indexOf(a.origin))try{var c=b.parseJSON(a.data);c.id==i&&n(c.status,c.statusText,c.response)}catch(d){n(0,d.message)}},n=a[i]=function(c,d,e){h.readyState=4,h.responseText=e,h.end(c,d),b.event.off(a,"message",m),a[i]=g=p=a[j]=null};h.xhr.abort=function(){try{p.stop?p.stop():p.contentWindow.stop?p.contentWindow.stop():p.contentWindow.document.execCommand("Stop")}catch(a){}n(0,"abort")},b.event.on(a,"message",m),a[j]=function(){try{var a=p.contentWindow,c=a.document,d=a.result||b.parseJSON(c.body.innerHTML);n(d.status,d.statusText,d.response)}catch(e){b.log("[transport.onload]",e)}},g=d.createElement("div"),g.innerHTML='
              '+(l&&c.url.indexOf("=?")<0?'':"")+"";var o=g.getElementsByTagName("form")[0],p=g.getElementsByTagName("iframe")[0];o.appendChild(e),b.log(o.parentNode.innerHTML),d.body.appendChild(g),h.xhr.node=g,h.readyState=2;try{o.submit()}catch(q){b.log("iframe.error: "+q)}o=null}else{if(k=k.replace(/([a-z]+)=(\?)&?/i,""),this.xhr&&this.xhr.aborted)return void b.log("Error: already aborted");if(g=h.xhr=b.getXHR(),e.params&&(k+=(k.indexOf("?")<0?"?":"&")+e.params.join("&")),g.open("POST",k,!0),b.withCredentials&&(g.withCredentials="true"),c.headers&&c.headers["X-Requested-With"]||g.setRequestHeader("X-Requested-With","XMLHttpRequest"),b.each(c.headers,function(a,b){g.setRequestHeader(b,a)}),c._chunked){g.upload&&g.upload.addEventListener("progress",b.throttle(function(a){e.retry||c.progress({type:a.type,total:e.size,loaded:e.start+a.loaded,totalSize:e.size},h,c)},100),!1),g.onreadystatechange=function(){var a=parseInt(g.getResponseHeader("X-Last-Known-Byte"),10);if(h.status=g.status,h.statusText=g.statusText,h.readyState=g.readyState,4==g.readyState){for(var d in f)h["response"+d]=g["response"+d];if(g.onreadystatechange=null,!g.status||g.status-201>0)if(b.log("Error: "+g.status),(!g.status&&!g.aborted||500==g.status||416==g.status)&&++e.retry<=c.chunkUploadRetry){var i=g.status?0:b.chunkNetworkDownRetryTimeout;c.pause(e.file,c),b.log("X-Last-Known-Byte: "+a),a?e.end=a:(e.end=e.start-1,416==g.status&&(e.end=e.end-c.chunkSize)),setTimeout(function(){h._send(c,e)},i)}else h.end(g.status);else e.retry=0,e.end==e.size-1?h.end(g.status):(b.log("X-Last-Known-Byte: "+a),a&&(e.end=a),e.file.FileAPIReadPosition=e.end,setTimeout(function(){h._send(c,e)},0));g=null}},e.start=e.end+1,e.end=Math.max(Math.min(e.start+c.chunkSize,e.size)-1,e.start);var r=e.file,s=(r.slice||r.mozSlice||r.webkitSlice).call(r,e.start,e.end+1);e.size&&!s.size?setTimeout(function(){h.end(-1)}):(g.setRequestHeader("Content-Range","bytes "+e.start+"-"+e.end+"/"+e.size),g.setRequestHeader("Content-Disposition","attachment; filename="+encodeURIComponent(e.name)),g.setRequestHeader("Content-Type",e.type||"application/octet-stream"),g.send(s)),r=s=null}else if(g.upload&&g.upload.addEventListener("progress",b.throttle(function(a){c.progress(a,h,c)},100),!1),g.onreadystatechange=function(){if(h.status=g.status,h.statusText=g.statusText,h.readyState=g.readyState,4==g.readyState){for(var a in f)h["response"+a]=g["response"+a];if(g.onreadystatechange=null,!g.status||g.status>201)if(b.log("Error: "+g.status),(!g.status&&!g.aborted||500==g.status)&&(c.retry||0)=0?a+"px":a}function d(a){var c,d=f.createElement("canvas"),e=!1;try{c=d.getContext("2d"),c.drawImage(a,0,0,1,1),e=255!=c.getImageData(0,0,1,1).data[4]}catch(g){b.log("[FileAPI.Camera] detectVideoSignal:",g)}return e}var e=a.URL||a.webkitURL,f=a.document,g=a.navigator,h=g.getUserMedia||g.webkitGetUserMedia||g.mozGetUserMedia||g.msGetUserMedia,i=!!h;b.support.media=i;var j=function(a){this.video=a};j.prototype={isActive:function(){return!!this._active},start:function(a){var b,c,f=this,i=f.video,j=function(d){f._active=!d,clearTimeout(c),clearTimeout(b),a&&a(d,f)};h.call(g,{video:!0},function(a){f.stream=a,i.src=e.createObjectURL(a),b=setInterval(function(){d(i)&&j(null)},1e3),c=setTimeout(function(){j("timeout"); +/*! FileAPI 2.0.19 - BSD | git://github.com/mailru/FileAPI.git */ +!function(a){"use strict";var b=a.HTMLCanvasElement&&a.HTMLCanvasElement.prototype,c=a.Blob&&function(){try{return Boolean(new Blob)}catch(a){return!1}}(),d=c&&a.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(a){return!1}}(),e=a.BlobBuilder||a.WebKitBlobBuilder||a.MozBlobBuilder||a.MSBlobBuilder,f=(c||e)&&a.atob&&a.ArrayBuffer&&a.Uint8Array&&function(a){var b,f,g,h,i,j;for(b=a.split(",")[0].indexOf("base64")>=0?atob(a.split(",")[1]):decodeURIComponent(a.split(",")[1]),f=new ArrayBuffer(b.length),g=new Uint8Array(f),h=0;h0,H=a.dataURLtoBlob,I=/img/i,J=/canvas/i,K=/img|canvas/i,L=/input/i,M=/^data:[^,]+,/,N={}.toString,O=a.Math,P=function(b){return b=new a.Number(O.pow(1024,b)),b.from=function(a){return O.round(a*this)},b},Q={},R=[],S="abort progress error load loadend",T="status statusText readyState response responseXML responseText responseBody".split(" "),U="currentTarget",V="preventDefault",W=function(a){return a&&"length"in a},X=function(a,b,c){if(a)if(W(a))for(var d=0,e=a.length;e>d;d++)d in a&&b.call(c,a[d],d,a);else for(var f in a)a.hasOwnProperty(f)&&b.call(c,a[f],f,a)},Y=function(a){for(var b=arguments,c=1,d=function(b,c){a[c]=b};c=c&&!d&&f.end()},isFail:function(){return d},fail:function(){!d&&a(d=!0)},end:function(){e||(e=!0,a())}};return f},each:X,afor:function(a,b){var c=0,d=a.length;W(a)&&d--?!function e(){b(d!=c&&e,a[c],c++)}():b(!1)},extend:Y,isFile:function(a){return"[object File]"===N.call(a)},isBlob:function(a){return this.isFile(a)||"[object Blob]"===N.call(a)},isCanvas:function(a){return a&&J.test(a.nodeName)},getFilesFilter:function(a){return a="string"==typeof a?a:a.getAttribute&&a.getAttribute("accept")||"",a?new RegExp("("+a.replace(/\./g,"\\.").replace(/,/g,"|")+")$","i"):/./},readAsDataURL:function(a,b){ca.isCanvas(a)?c(a,b,"load",ca.toDataURL(a)):e(a,b,"DataURL")},readAsBinaryString:function(a,b){d("BinaryString")?e(a,b,"BinaryString"):e(a,function(a){if("load"==a.type)try{a.result=ca.toBinaryString(a.result)}catch(c){a.type="error",a.message=c.toString()}b(a)},"DataURL")},readAsArrayBuffer:function(a,b){e(a,b,"ArrayBuffer")},readAsText:function(a,b,c){c||(c=b,b="utf-8"),e(a,c,"Text",b)},toDataURL:function(a,b){return"string"==typeof a?a:a.toDataURL?a.toDataURL(b||"image/png"):void 0},toBinaryString:function(b){return a.atob(ca.toDataURL(b).replace(M,""))},readAsImage:function(a,d,e){if(ca.isBlob(a))if(w){var f=w.createObjectURL(a);f===b?c(a,d,"error"):ca.readAsImage(f,d,e)}else ca.readAsDataURL(a,function(b){"load"==b.type?ca.readAsImage(b.result,d,e):(e||"error"==b.type)&&c(a,d,b,null,{loaded:b.loaded,total:b.total})});else if(ca.isCanvas(a))c(a,d,"load",a);else if(I.test(a.nodeName))if(a.complete)c(a,d,"load",a);else{var g="error abort load";_(a,g,function i(b){"load"==b.type&&w&&w.revokeObjectURL(a.src),$(a,g,i),c(a,d,b,a)})}else if(a.iframe)c(a,d,{type:"error"});else{var h=ca.newImage(a.dataURL||a);ca.readAsImage(h,d,e)}},checkFileObj:function(a){var b={},c=ca.accept;return"object"==typeof a?b=a:b.name=(a+"").split(/\\|\//g).pop(),null==b.type&&(b.type=b.name.split(".").pop()),X(c,function(a,c){a=new RegExp(a.replace(/\s/g,"|"),"i"),(a.test(b.type)||ca.ext2mime[b.type])&&(b.type=ca.ext2mime[b.type]||c.split("/")[0]+"/"+b.type)}),b},getDropFiles:function(a,b){var c,d=[],e=[],j=l(a),k=j.files,m=j.items,n=W(m)&&m[0]&&h(m[0]),o=ca.queue(function(){b(d,e)});if(n)if(G&&k){var p,q,r=k.length;for(c=new Array(r);r--;){p=k[r];try{q=h(m[r])}catch(s){ca.log("[err] getDropFiles: ",s),q=null}g(q)&&(q.isDirectory||q.isFile&&p.name==p.name.normalize("NFC"))?c[r]=q:c[r]=p}}else c=m;else c=k;X(c||[],function(a){o.inc();try{n&&g(a)?i(a,function(a,b,c){a?ca.log("[err] getDropFiles:",a):d.push.apply(d,b),e.push.apply(e,c),o.next()}):f(a,function(b,c){b?d.push(a):a.error=c,e.push(a),o.next()})}catch(b){o.next(),ca.log("[err] getDropFiles: ",b)}}),o.check()},getFiles:function(a,b,c){var d=[];return c?(ca.filterFiles(ca.getFiles(a),b,c),null):(a.jquery&&(a.each(function(){d=d.concat(ca.getFiles(this))}),a=d,d=[]),"string"==typeof b&&(b=ca.getFilesFilter(b)),a.originalEvent?a=aa(a.originalEvent):a.srcElement&&(a=aa(a)),a.dataTransfer?a=a.dataTransfer:a.target&&(a=a.target),a.files?(d=a.files,D||(d[0].blob=a,d[0].iframe=!0)):!D&&k(a)?ca.trim(a.value)&&(d=[ca.checkFileObj(a.value)],d[0].blob=a,d[0].iframe=!0):W(a)&&(d=a),ca.filter(d,function(a){return!b||b.test(a.name)}))},getTotalSize:function(a){for(var b=0,c=a&&a.length;c--;)b+=a[c].size;return b},getInfo:function(a,b){var c={},d=R.concat();ca.isBlob(a)?!function e(){var f=d.shift();f?f.test(a.type)?f(a,function(a,d){a?b(a):(Y(c,d),e())}):e():b(!1,c)}():b("not_support_info",c)},addInfoReader:function(a,b){b.test=function(b){return a.test(b)},R.push(b)},filter:function(a,b){for(var c,d=[],e=0,f=a.length;f>e;e++)e in a&&(c=a[e],b.call(c,c,e,a)&&d.push(c));return d},filterFiles:function(a,b,c){if(a.length){var d,e=a.concat(),f=[],g=[];!function h(){e.length?(d=e.shift(),ca.getInfo(d,function(a,c){(b(d,a?!1:c)?f:g).push(d),h()})):c(f,g)}()}else c([],a)},upload:function(a){a=Y({jsonp:"callback",prepare:ca.F,beforeupload:ca.F,upload:ca.F,fileupload:ca.F,fileprogress:ca.F,filecomplete:ca.F,progress:ca.F,complete:ca.F,pause:ca.F,imageOriginal:!0,chunkSize:ca.chunkSize,chunkUploadRetry:ca.chunkUploadRetry,uploadRetry:ca.uploadRetry},a),a.imageAutoOrientation&&!a.imageTransform&&(a.imageTransform={rotate:"auto"});var b,c=new ca.XHR(a),d=this._getFilesDataArray(a.files),e=this,f=0,g=0,h=!1;return X(d,function(a){f+=a.size}),c.files=[],X(d,function(a){c.files.push(a.file)}),c.total=f,c.loaded=0,c.filesLeft=d.length,a.beforeupload(c,a),b=function(){var i=d.shift(),k=i&&i.file,l=!1,m=j(a);if(c.filesLeft=d.length,k&&k.name===ca.expando&&(k=null,ca.log("[warn] FileAPI.upload() — called without files")),("abort"!=c.statusText||c.current)&&i){if(h=!1,c.currentFile=k,k&&a.prepare(k,m)===!1)return void b.call(e);m.file=k,e._getFormData(m,i,function(h){g||a.upload(c,a);var j=new ca.XHR(Y({},m,{upload:k?function(){a.fileupload(k,j,m)}:q,progress:k?function(b){l||(l=b.loaded===b.total,a.fileprogress({type:"progress",total:i.total=b.total,loaded:i.loaded=b.loaded},k,j,m),a.progress({type:"progress",total:f,loaded:c.loaded=g+i.size*(b.loaded/b.total)||0},k,j,m))}:q,complete:function(d){X(T,function(a){c[a]=j[a]}),k&&(i.total=i.total||i.size,i.loaded=i.total,d||(this.progress(i),l=!0,g+=i.size,c.loaded=g),a.filecomplete(d,j,k,m)),setTimeout(function(){b.call(e)},0)}}));c.abort=function(a){a||(d.length=0),this.current=a,j.abort()},j.send(h)})}else{var n=200==c.status||201==c.status||204==c.status;a.complete(n?!1:c.statusText||"error",c,a),h=!0}},setTimeout(b,0),c.append=function(a,g){a=ca._getFilesDataArray([].concat(a)),X(a,function(a){f+=a.size,c.files.push(a.file),g?d.unshift(a):d.push(a)}),c.statusText="",h&&b.call(e)},c.remove=function(a){for(var b,c=d.length;c--;)d[c].file==a&&(b=d.splice(c,1),f-=b.size);return b},c},_getFilesDataArray:function(a){var b=[],c={};if(k(a)){var d=ca.getFiles(a);c[a.name||"file"]=null!==a.getAttribute("multiple")?d:d[0]}else W(a)&&k(a[0])?X(a,function(a){c[a.name||"file"]=ca.getFiles(a)}):c=a;return X(c,function e(a,c){W(a)?X(a,function(a){e(a,c)}):a&&(a.name||a.image)&&b.push({name:c,file:a,size:a.size,total:a.size,loaded:0})}),b.length||b.push({file:{name:ca.expando}}),b},_getFormData:function(a,b,c){var d=b.file,e=b.name,f=d.name,g=d.type,h=ca.support.transform&&a.imageTransform,i=new ca.Form,j=ca.queue(function(){c(i)}),k=h&&m(h),l=ca.postNameConcat;X(a.data,function n(a,b){"object"==typeof a?X(a,function(a,c){n(a,l(b,c))}):i.append(b,a)}),function o(b){b.image?(j.inc(),b.toData(function(a,c){b.file&&(c.type=b.file.type,c.quality=b.matrix.quality,f=b.file&&b.file.name),f=f||(new Date).getTime()+".png",o(c),j.next()})):ca.Image&&h&&(/^image/.test(b.type)||K.test(b.nodeName))?(j.inc(),k&&(h=[h]),ca.Image.transform(b,h,a.imageAutoOrientation,function(c,d){if(k&&!c)H||ca.flashEngine||(i.multipart=!0),i.append(e,d[0],f,h[0].type||g);else{var m=0;c||X(d,function(a,b){H||ca.flashEngine||(i.multipart=!0),h[b].postName||(m=1),i.append(h[b].postName||l(e,b),a,f,h[b].type||g)}),(c||a.imageOriginal)&&i.append(l(e,m?"original":null),b,f,g)}j.next()})):f!==ca.expando&&i.append(e,b,f)}(d),j.check()},reset:function(a,b){var c,d;return C?(d=C(a).clone(!0).insertBefore(a).val("")[0],b||C(a).remove()):(c=a.parentNode,d=c.insertBefore(a.cloneNode(!0),a),d.value="",b||c.removeChild(a),X(Q[ca.uid(a)],function(b,c){X(b,function(b){$(a,c,b),Z(d,c,b)})})),d},load:function(a,b){var c=ca.getXHR();return c?(c.open("GET",a,!0),c.overrideMimeType&&c.overrideMimeType("text/plain; charset=x-user-defined"),Z(c,"progress",function(a){a.lengthComputable&&b({type:a.type,loaded:a.loaded,total:a.total},c)}),c.onreadystatechange=function(){if(4==c.readyState)if(c.onreadystatechange=null,200==c.status){a=a.split("/");var d={name:a[a.length-1],size:c.getResponseHeader("Content-Length"),type:c.getResponseHeader("Content-Type")};d.dataURL="data:"+d.type+";base64,"+ca.encode64(c.responseBody||c.responseText),b({type:"load",result:d},c)}else b({type:"error"},c)},c.send(null)):b({type:"error"}),c},encode64:function(a){var b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c="",d=0;for("string"!=typeof a&&(a=String(a));d>2,k=(3&g)<<4|h>>4;isNaN(h)?e=f=64:(e=(15&h)<<2|i>>6,f=isNaN(i)?64:63&i),c+=b.charAt(j)+b.charAt(k)+b.charAt(e)+b.charAt(f)}return c}};ca.addInfoReader(/^image/,function(a,b){if(!a.__dimensions){var c=a.__dimensions=ca.defer();ca.readAsImage(a,function(a){var b=a.target;c.resolve("load"==a.type?!1:"error",{width:b.width,height:b.height}),b.src=ca.EMPTY_PNG,b=null})}a.__dimensions.then(b)}),ca.event.dnd=function(a,b,c){var d,e;c||(c=b,b=ca.F),z?(Z(a,"dragenter dragleave dragover",b.ff=b.ff||function(a){for(var c=l(a).types,f=c&&c.length,g=!1;f--;)if(~c[f].indexOf("File")){a[V](),e!==a.type&&(e=a.type,"dragleave"!=e&&b.call(a[U],!0,a),g=!0);break}g&&(clearTimeout(d),d=setTimeout(function(){b.call(a[U],"dragleave"!=e,a)},50))}),Z(a,"drop",c.ff=c.ff||function(a){a[V](),e=0,b.call(a[U],!1,a),ca.getDropFiles(a,function(b,d){c.call(a[U],b,d,a)})})):ca.log("Drag'n'Drop -- not supported")},ca.event.dnd.off=function(a,b,c){$(a,"dragenter dragleave dragover",b.ff),$(a,"drop",c.ff)},C&&!C.fn.dnd&&(C.fn.dnd=function(a,b){return this.each(function(){ca.event.dnd(this,a,b)})},C.fn.offdnd=function(a,b){return this.each(function(){ca.event.dnd.off(this,a,b)})}),a.FileAPI=Y(ca,a.FileAPI),ca.log("FileAPI: "+ca.version),ca.log("protocol: "+a.location.protocol),ca.log("doctype: ["+s.name+"] "+s.publicId+" "+s.systemId),X(r.getElementsByTagName("meta"),function(a){/x-ua-compatible/i.test(a.getAttribute("http-equiv"))&&ca.log("meta.http-equiv: "+a.getAttribute("content"))});try{n=!!console.log,o=!!console.log.apply}catch(da){}ca.flashUrl||(ca.flashUrl=ca.staticPath+"FileAPI.flash.swf"),ca.flashImageUrl||(ca.flashImageUrl=ca.staticPath+"FileAPI.flash.image.swf"),ca.flashWebcamUrl||(ca.flashWebcamUrl=ca.staticPath+"FileAPI.flash.camera.swf")}(window,void 0),function(a,b,c){"use strict";function d(b){if(b instanceof d){var c=new d(b.file);return a.extend(c.matrix,b.matrix),c}return this instanceof d?(this.file=b,this.size=b.size||100,void(this.matrix={sx:0,sy:0,sw:0,sh:0,dx:0,dy:0,dw:0,dh:0,resize:0,deg:0,quality:1,filter:0})):new d(b)}var e=Math.min,f=Math.round,g=function(){return b.createElement("canvas")},h=!1,i={8:270,3:180,6:90,7:270,4:180,5:90};try{h=g().toDataURL("image/png").indexOf("data:image/png")>-1}catch(j){}d.prototype={image:!0,constructor:d,set:function(b){return a.extend(this.matrix,b),this},crop:function(a,b,d,e){return d===c&&(d=a,e=b,a=b=0),this.set({sx:a,sy:b,sw:d,sh:e||d})},resize:function(a,b,c){return/min|max|height|width/.test(b)&&(c=b,b=a),this.set({dw:a,dh:b||a,resize:c})},preview:function(a,b){return this.resize(a,b||a,"preview")},rotate:function(a){return this.set({deg:a})},filter:function(a){return this.set({filter:a})},overlay:function(a){return this.set({overlay:a})},clone:function(){return new d(this)},_load:function(b,c){var d=this;/img|video/i.test(b.nodeName)?c.call(d,null,b):a.readAsImage(b,function(a){c.call(d,"load"!=a.type,a.result)})},_apply:function(b,c){var f,h=g(),i=this.getMatrix(b),j=h.getContext("2d"),k=b.videoWidth||b.width,l=b.videoHeight||b.height,m=i.deg,n=i.dw,o=i.dh,p=k,q=l,r=i.filter,s=b,t=i.overlay,u=a.queue(function(){b.src=a.EMPTY_PNG,c(!1,h)}),v=a.renderImageToCanvas;for(m-=360*Math.floor(m/360),b._type=this.file.type;i.multipass&&e(p/n,q/o)>2;)p=p/2+.5|0,q=q/2+.5|0,f=g(),f.width=p,f.height=q,s!==b?(v(f,s,0,0,s.width,s.height,0,0,p,q),s=f):(s=f,v(s,b,i.sx,i.sy,i.sw,i.sh,0,0,p,q),i.sx=i.sy=i.sw=i.sh=0);h.width=m%180?o:n,h.height=m%180?n:o,h.type=i.type,h.quality=i.quality,j.rotate(m*Math.PI/180),v(j.canvas,s,i.sx,i.sy,i.sw||s.width,i.sh||s.height,180==m||270==m?-n:0,90==m||180==m?-o:0,n,o),n=h.width,o=h.height,t&&a.each([].concat(t),function(b){u.inc();var c=new window.Image,d=function(){var e=0|b.x,f=0|b.y,g=b.w||c.width,h=b.h||c.height,i=b.rel;e=1==i||4==i||7==i?(n-g+e)/2:2==i||5==i||8==i?n-(g+e):e,f=3==i||4==i||5==i?(o-h+f)/2:i>=6?o-(h+f):f,a.event.off(c,"error load abort",d);try{j.globalAlpha=b.opacity||1,j.drawImage(c,e,f,g,h)}catch(k){}u.next()};a.event.on(c,"error load abort",d),c.src=b.src,c.complete&&d()}),r&&(u.inc(),d.applyFilter(h,r,u.next)),u.check()},getMatrix:function(b){var c=a.extend({},this.matrix),d=c.sw=c.sw||b.videoWidth||b.naturalWidth||b.width,g=c.sh=c.sh||b.videoHeight||b.naturalHeight||b.height,h=c.dw=c.dw||d,i=c.dh=c.dh||g,j=d/g,k=h/i,l=c.resize;if("preview"==l){if(h!=d||i!=g){var m,n;k>=j?(m=d,n=m/k):(n=g,m=n*k),(m!=d||n!=g)&&(c.sx=~~((d-m)/2),c.sy=~~((g-n)/2),d=m,g=n)}}else"height"==l?h=i*j:"width"==l?i=h/j:l&&(d>h||g>i?"min"==l?(h=f(k>j?e(d,h):i*j),i=f(k>j?h/j:e(g,i))):(h=f(j>=k?e(d,h):i*j),i=f(j>=k?h/j:e(g,i))):(h=d,i=g));return c.sw=d,c.sh=g,c.dw=h,c.dh=i,c.multipass=a.multiPassResize,c},_trans:function(b){this._load(this.file,function(c,d){if(c)b(c);else try{this._apply(d,b)}catch(c){a.log("[err] FileAPI.Image.fn._apply:",c),b(c)}})},get:function(b){if(a.support.transform){var c=this,d=c.matrix;"auto"==d.deg?a.getInfo(c.file,function(a,e){d.deg=i[e&&e.exif&&e.exif.Orientation]||0,c._trans(b)}):c._trans(b)}else b("not_support_transform");return this},toData:function(a){return this.get(a)}},d.exifOrientation=i,d.transform=function(b,e,f,g){function h(h,i){var j={},k=a.queue(function(a){g(a,j)});h?k.fail():a.each(e,function(a,e){if(!k.isFail()){var g=new d(i.nodeType?i:b),h="function"==typeof a;if(h?a(i,g):a.width?g[a.preview?"preview":"resize"](a.width,a.height,a.strategy):a.maxWidth&&(i.width>a.maxWidth||i.height>a.maxHeight)&&g.resize(a.maxWidth,a.maxHeight,"max"),a.crop){var l=a.crop;g.crop(0|l.x,0|l.y,l.w||l.width,l.h||l.height)}a.rotate===c&&f&&(a.rotate="auto"),g.set({type:g.matrix.type||a.type||b.type||"image/png"}),h||g.set({deg:a.rotate,overlay:a.overlay,filter:a.filter,quality:a.quality||1}),k.inc(),g.toData(function(a,b){a?k.fail():(j[e]=b,k.next())})}})}b.width?h(!1,b):a.getInfo(b,h)},a.each(["TOP","CENTER","BOTTOM"],function(b,c){a.each(["LEFT","CENTER","RIGHT"],function(a,e){d[b+"_"+a]=3*c+e,d[a+"_"+b]=3*c+e})}),d.toCanvas=function(a){var c=b.createElement("canvas");return c.width=a.videoWidth||a.width,c.height=a.videoHeight||a.height,c.getContext("2d").drawImage(a,0,0),c},d.fromDataURL=function(b,c,d){var e=a.newImage(b);a.extend(e,c),d(e)},d.applyFilter=function(b,c,e){"function"==typeof c?c(b,e):window.Caman&&window.Caman("IMG"==b.tagName?d.toCanvas(b):b,function(){"string"==typeof c?this[c]():a.each(c,function(a,b){this[b](a)},this),this.render(e)})},a.renderImageToCanvas=function(b,c,d,e,f,g,h,i,j,k){try{return b.getContext("2d").drawImage(c,d,e,f,g,h,i,j,k)}catch(l){throw a.log("renderImageToCanvas failed"),l}},a.support.canvas=a.support.transform=h,a.Image=d}(FileAPI,document),function(a){"use strict";a(FileAPI)}(function(a){"use strict";if(window.navigator&&window.navigator.platform&&/iP(hone|od|ad)/.test(window.navigator.platform)){var b=a.renderImageToCanvas;a.detectSubsampling=function(a){var b,c;return a.width*a.height>1048576?(b=document.createElement("canvas"),b.width=b.height=1,c=b.getContext("2d"),c.drawImage(a,-a.width+1,0),0===c.getImageData(0,0,1,1).data[3]):!1},a.detectVerticalSquash=function(a,b){var c,d,e,f,g,h=a.naturalHeight||a.height,i=document.createElement("canvas"),j=i.getContext("2d");for(b&&(h/=2),i.width=1,i.height=h,j.drawImage(a,0,0),c=j.getImageData(0,0,1,h).data,d=0,e=h,f=h;f>d;)g=c[4*(f-1)+3],0===g?e=f:d=f,f=e+d>>1;return f/h||1},a.renderImageToCanvas=function(c,d,e,f,g,h,i,j,k,l){if("image/jpeg"===d._type){var m,n,o,p,q=c.getContext("2d"),r=document.createElement("canvas"),s=1024,t=r.getContext("2d");if(r.width=s,r.height=s,q.save(),m=a.detectSubsampling(d),m&&(e/=2,f/=2,g/=2,h/=2),n=a.detectVerticalSquash(d,m),m||1!==n){for(f*=n,k=Math.ceil(s*k/g),l=Math.ceil(s*l/h/n),j=0,p=0;h>p;){for(i=0,o=0;g>o;)t.clearRect(0,0,s,s),t.drawImage(d,e,f,g,h,-o,-p,g,h),q.drawImage(r,0,0,s,s,i,j,k,l),o+=s,i+=k;p+=s,j+=l}return q.restore(),c}}return b(c,d,e,f,g,h,i,j,k,l)}}}),function(a,b){"use strict";function c(b,c,d){var e=b.blob,f=b.file;if(f){if(!e.toDataURL)return void a.readAsBinaryString(e,function(a){"load"==a.type&&c(b,a.result)});var g={"image/jpeg":".jpe?g","image/png":".png"},h=g[b.type]?b.type:"image/png",i=g[h]||".png",j=e.quality||1;f.match(new RegExp(i+"$","i"))||(f+=i.replace("?","")),b.file=f,b.type=h,!d&&e.toBlob?e.toBlob(function(a){c(b,a)},h,j):c(b,a.toBinaryString(e.toDataURL(h,j)))}else c(b,e)}var d=b.document,e=b.FormData,f=function(){this.items=[]},g=b.encodeURIComponent;f.prototype={append:function(a,b,c,d){this.items.push({name:a,blob:b&&b.blob||(void 0==b?"":b),file:b&&(c||b.name),type:b&&(d||b.type)})},each:function(a){for(var b=0,c=this.items.length;c>b;b++)a.call(this,this.items[b])},toData:function(b,c){c._chunked=a.support.chunked&&c.chunkSize>0&&1==a.filter(this.items,function(a){return a.file}).length,a.support.html5?a.formData&&!this.multipart&&e?c._chunked?(a.log("FileAPI.Form.toPlainData"),this.toPlainData(b)):(a.log("FileAPI.Form.toFormData"),this.toFormData(b)):(a.log("FileAPI.Form.toMultipartData"),this.toMultipartData(b)):(a.log("FileAPI.Form.toHtmlData"),this.toHtmlData(b))},_to:function(b,c,d,e){var f=a.queue(function(){c(b)});this.each(function(g){try{d(g,b,f,e)}catch(h){a.log("FileAPI.Form._to: "+h.message),c(h)}}),f.check()},toHtmlData:function(b){this._to(d.createDocumentFragment(),b,function(b,c){var e,f=b.blob;b.file?(a.reset(f,!0),f.name=b.name,f.disabled=!1,c.appendChild(f)):(e=d.createElement("input"),e.name=b.name,e.type="hidden",e.value=f,c.appendChild(e))})},toPlainData:function(a){this._to({},a,function(a,b,d){a.file&&(b.type=a.file),a.blob.toBlob?(d.inc(),c(a,function(a,c){b.name=a.name,b.file=c,b.size=c.length,b.type=a.type,d.next()})):a.file?(b.name=a.blob.name,b.file=a.blob,b.size=a.blob.size,b.type=a.type):(b.params||(b.params=[]),b.params.push(g(a.name)+"="+g(a.blob))),b.start=-1,b.end=b.file&&b.file.FileAPIReadPosition||-1,b.retry=0})},toFormData:function(a){this._to(new e,a,function(a,b,d){a.blob&&a.blob.toBlob?(d.inc(),c(a,function(a,c){b.append(a.name,c,a.file),d.next()})):a.file?b.append(a.name,a.blob,a.file):b.append(a.name,a.blob),a.file&&b.append("_"+a.name,a.file)})},toMultipartData:function(b){this._to([],b,function(a,b,d,e){d.inc(),c(a,function(a,c){b.push("--_"+e+('\r\nContent-Disposition: form-data; name="'+a.name+'"'+(a.file?'; filename="'+g(a.file)+'"':"")+(a.file?"\r\nContent-Type: "+(a.type||"application/octet-stream"):"")+"\r\n\r\n"+(a.file?c:g(c))+"\r\n")),d.next()},!0)},a.expando)}},a.Form=f}(FileAPI,window),function(a,b){"use strict";var c=function(){},d=a.document,e=function(a){this.uid=b.uid(),this.xhr={abort:c,getResponseHeader:c,getAllResponseHeaders:c},this.options=a},f={"":1,XML:1,Text:1,Body:1};e.prototype={status:0,statusText:"",constructor:e,getResponseHeader:function(a){return this.xhr.getResponseHeader(a)},getAllResponseHeaders:function(){return this.xhr.getAllResponseHeaders()||{}},end:function(d,e){var f=this,g=f.options;f.end=f.abort=c,f.status=d,e&&(f.statusText=e),b.log("xhr.end:",d,e),g.complete(200==d||201==d?!1:f.statusText||"unknown",f),f.xhr&&f.xhr.node&&setTimeout(function(){var b=f.xhr.node;try{b.parentNode.removeChild(b)}catch(c){}try{delete a[f.uid]}catch(c){}a[f.uid]=f.xhr.node=null},9)},abort:function(){this.end(0,"abort"),this.xhr&&(this.xhr.aborted=!0,this.xhr.abort())},send:function(a){var b=this,c=this.options;a.toData(function(a){a instanceof Error?b.end(0,a.message):(c.upload(c,b),b._send.call(b,c,a))},c)},_send:function(c,e){var g,h=this,i=h.uid,j=h.uid+"Load",k=c.url;if(b.log("XHR._send:",e),c.cache||(k+=(~k.indexOf("?")?"&":"?")+b.uid()),e.nodeName){var l=c.jsonp;k=k.replace(/([a-z]+)=(\?)/i,"$1="+i),c.upload(c,h);var m=function(a){if(~k.indexOf(a.origin))try{var c=b.parseJSON(a.data);c.id==i&&n(c.status,c.statusText,c.response)}catch(d){n(0,d.message)}},n=a[i]=function(c,d,e){h.readyState=4,h.responseText=e,h.end(c,d),b.event.off(a,"message",m),a[i]=g=p=a[j]=null};h.xhr.abort=function(){try{p.stop?p.stop():p.contentWindow.stop?p.contentWindow.stop():p.contentWindow.document.execCommand("Stop")}catch(a){}n(0,"abort")},b.event.on(a,"message",m),a[j]=function(){try{var a=p.contentWindow,c=a.document,d=a.result||b.parseJSON(c.body.innerHTML);n(d.status,d.statusText,d.response)}catch(e){b.log("[transport.onload]",e)}},g=d.createElement("div"),g.innerHTML='
              '+(l&&c.url.indexOf("=?")<0?'':"")+"";var o=g.getElementsByTagName("form")[0],p=g.getElementsByTagName("iframe")[0];o.appendChild(e),b.log(o.parentNode.innerHTML),d.body.appendChild(g),h.xhr.node=g,h.readyState=2;try{o.submit()}catch(q){b.log("iframe.error: "+q)}o=null}else{if(k=k.replace(/([a-z]+)=(\?)&?/i,""),this.xhr&&this.xhr.aborted)return void b.log("Error: already aborted");if(g=h.xhr=b.getXHR(),e.params&&(k+=(k.indexOf("?")<0?"?":"&")+e.params.join("&")),g.open("POST",k,!0),b.withCredentials&&(g.withCredentials="true"),c.headers&&c.headers["X-Requested-With"]||g.setRequestHeader("X-Requested-With","XMLHttpRequest"),b.each(c.headers,function(a,b){g.setRequestHeader(b,a)}),c._chunked){g.upload&&g.upload.addEventListener("progress",b.throttle(function(a){e.retry||c.progress({type:a.type,total:e.size,loaded:e.start+a.loaded,totalSize:e.size},h,c)},100),!1),g.onreadystatechange=function(){var a=parseInt(g.getResponseHeader("X-Last-Known-Byte"),10);if(h.status=g.status,h.statusText=g.statusText,h.readyState=g.readyState,4==g.readyState){for(var d in f)h["response"+d]=g["response"+d];if(g.onreadystatechange=null,!g.status||g.status-201>0)if(b.log("Error: "+g.status),(!g.status&&!g.aborted||500==g.status||416==g.status)&&++e.retry<=c.chunkUploadRetry){var i=g.status?0:b.chunkNetworkDownRetryTimeout;c.pause(e.file,c),b.log("X-Last-Known-Byte: "+a),a?e.end=a:(e.end=e.start-1,416==g.status&&(e.end=e.end-c.chunkSize)),setTimeout(function(){h._send(c,e)},i)}else h.end(g.status);else e.retry=0,e.end==e.size-1?h.end(g.status):(b.log("X-Last-Known-Byte: "+a),a&&(e.end=a),e.file.FileAPIReadPosition=e.end,setTimeout(function(){h._send(c,e)},0));g=null}},e.start=e.end+1,e.end=Math.max(Math.min(e.start+c.chunkSize,e.size)-1,e.start);var r=e.file,s=(r.slice||r.mozSlice||r.webkitSlice).call(r,e.start,e.end+1);e.size&&!s.size?setTimeout(function(){h.end(-1)}):(g.setRequestHeader("Content-Range","bytes "+e.start+"-"+e.end+"/"+e.size),g.setRequestHeader("Content-Disposition","attachment; filename="+encodeURIComponent(e.name)),g.setRequestHeader("Content-Type",e.type||"application/octet-stream"),g.send(s)),r=s=null}else if(g.upload&&g.upload.addEventListener("progress",b.throttle(function(a){c.progress(a,h,c)},100),!1),g.onreadystatechange=function(){if(h.status=g.status,h.statusText=g.statusText,h.readyState=g.readyState,4==g.readyState){for(var a in f)h["response"+a]=g["response"+a];if(g.onreadystatechange=null,!g.status||g.status>201)if(b.log("Error: "+g.status),(!g.status&&!g.aborted||500==g.status)&&(c.retry||0)=0?a+"px":a}function d(a){var c,d=f.createElement("canvas"),e=!1;try{c=d.getContext("2d"),c.drawImage(a,0,0,1,1),e=255!=c.getImageData(0,0,1,1).data[4]}catch(g){b.log("[FileAPI.Camera] detectVideoSignal:",g)}return e}var e=a.URL||a.webkitURL,f=a.document,g=a.navigator,h=g.getUserMedia||g.webkitGetUserMedia||g.mozGetUserMedia||g.msGetUserMedia,i=!!h;b.support.media=i;var j=function(a){this.video=a};j.prototype={isActive:function(){return!!this._active},start:function(a){var b,c,f=this,i=f.video,j=function(d){f._active=!d,clearTimeout(c),clearTimeout(b),a&&a(d,f)};h.call(g,{video:!0},function(a){f.stream=a,i.src=e.createObjectURL(a),b=setInterval(function(){d(i)&&j(null)},1e3),c=setTimeout(function(){j("timeout"); },5e3),i.play()},j)},stop:function(){try{this._active=!1,this.video.pause();try{this.stream.stop()}catch(a){b.each(this.stream.getTracks(),function(a){a.stop()})}this.stream=null}catch(a){b.log("[FileAPI.Camera] stop:",a)}},shot:function(){return new k(this.video)}},j.get=function(a){return new j(a.firstChild)},j.publish=function(d,e,g){"function"==typeof e&&(g=e,e={}),e=b.extend({},{width:"100%",height:"100%",start:!0},e),d.jquery&&(d=d[0]);var h=function(a){if(a)g(a);else{var b=j.get(d);e.start?b.start(g):g(null,b)}};if(d.style.width=c(e.width),d.style.height=c(e.height),b.html5&&i){var k=f.createElement("video");k.style.width=c(e.width),k.style.height=c(e.height),a.jQuery?jQuery(d).empty():d.innerHTML="",d.appendChild(k),h()}else j.fallback(d,e,h)},j.fallback=function(a,b,c){c("not_support_camera")};var k=function(a){var c=a.nodeName?b.Image.toCanvas(a):a,d=b.Image(c);return d.type="image/png",d.width=c.width,d.height=c.height,d.size=c.width*c.height*4,d};j.Shot=k,b.Camera=j}(window,FileAPI),function(a,b,c){"use strict";var d=c.each,e=[];!c.support.flash||!c.media||c.support.media&&c.html5||!function(){function a(a){var b=a.wid=c.uid();return c.Flash._fn[b]=a,"FileAPI.Flash._fn."+b}function b(a){try{c.Flash._fn[a.wid]=null,delete c.Flash._fn[a.wid]}catch(b){}}var f=c.Flash;c.extend(c.Flash,{patchCamera:function(){c.Camera.fallback=function(d,e,g){var h=c.uid();c.log("FlashAPI.Camera.publish: "+h),f.publish(d,h,c.extend(e,{camera:!0,onEvent:a(function i(a){"camera"===a.type&&(b(i),a.error?(c.log("FlashAPI.Camera.publish.error: "+a.error),g(a.error)):(c.log("FlashAPI.Camera.publish.success: "+h),g(null)))})}))},d(e,function(a){c.Camera.fallback.apply(c.Camera,a)}),e=[],c.extend(c.Camera.prototype,{_id:function(){return this.video.id},start:function(d){var e=this;f.cmd(this._id(),"camera.on",{callback:a(function g(a){b(g),a.error?(c.log("FlashAPI.camera.on.error: "+a.error),d(a.error,e)):(c.log("FlashAPI.camera.on.success: "+e._id()),e._active=!0,d(null,e))})})},stop:function(){this._active=!1,f.cmd(this._id(),"camera.off")},shot:function(){c.log("FlashAPI.Camera.shot:",this._id());var a=c.Flash.cmd(this._id(),"shot",{});return a.type="image/png",a.flashId=this._id(),a.isShot=!0,new c.Camera.Shot(a)}})}}),c.Camera.fallback=function(){e.push(arguments)}}()}(window,window.jQuery,FileAPI),"function"==typeof define&&define.amd&&define("FileAPI",[],function(){return FileAPI}); \ No newline at end of file diff --git a/manager/media/browser/mcpuk/js/FileAPI/FileAPI.js b/manager/media/browser/mcpuk/js/FileAPI/FileAPI.js index 8e5b3c76ba..6b2e14b72d 100644 --- a/manager/media/browser/mcpuk/js/FileAPI/FileAPI.js +++ b/manager/media/browser/mcpuk/js/FileAPI/FileAPI.js @@ -1,4361 +1,4361 @@ -/*! FileAPI 2.0.19 - BSD | git://github.com/mailru/FileAPI.git - * FileAPI — a set of javascript tools for working with files. Multiupload, drag'n'drop and chunked file upload. Images: crop, resize and auto orientation by EXIF. - */ - -/* - * JavaScript Canvas to Blob 2.0.5 - * https://github.com/blueimp/JavaScript-Canvas-to-Blob - * - * Copyright 2012, Sebastian Tschan - * https://blueimp.net - * - * Licensed under the MIT license: - * http://www.opensource.org/licenses/MIT - * - * Based on stackoverflow user Stoive's code snippet: - * http://stackoverflow.com/q/4998908 - */ - -/*jslint nomen: true, regexp: true */ -/*global window, atob, Blob, ArrayBuffer, Uint8Array */ - -(function (window) { - 'use strict'; - var CanvasPrototype = window.HTMLCanvasElement && - window.HTMLCanvasElement.prototype, - hasBlobConstructor = window.Blob && (function () { - try { - return Boolean(new Blob()); - } catch (e) { - return false; - } - }()), - hasArrayBufferViewSupport = hasBlobConstructor && window.Uint8Array && - (function () { - try { - return new Blob([new Uint8Array(100)]).size === 100; - } catch (e) { - return false; - } - }()), - BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || - window.MozBlobBuilder || window.MSBlobBuilder, - dataURLtoBlob = (hasBlobConstructor || BlobBuilder) && window.atob && - window.ArrayBuffer && window.Uint8Array && function (dataURI) { - var byteString, - arrayBuffer, - intArray, - i, - mimeString, - bb; - if (dataURI.split(',')[0].indexOf('base64') >= 0) { - // Convert base64 to raw binary data held in a string: - byteString = atob(dataURI.split(',')[1]); - } else { - // Convert base64/URLEncoded data component to raw binary data: - byteString = decodeURIComponent(dataURI.split(',')[1]); - } - // Write the bytes of the string to an ArrayBuffer: - arrayBuffer = new ArrayBuffer(byteString.length); - intArray = new Uint8Array(arrayBuffer); - for (i = 0; i < byteString.length; i += 1) { - intArray[i] = byteString.charCodeAt(i); - } - // Separate out the mime component: - mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]; - // Write the ArrayBuffer (or ArrayBufferView) to a blob: - if (hasBlobConstructor) { - return new Blob( - [hasArrayBufferViewSupport ? intArray : arrayBuffer], - {type: mimeString} - ); - } - bb = new BlobBuilder(); - bb.append(arrayBuffer); - return bb.getBlob(mimeString); - }; - if (window.HTMLCanvasElement && !CanvasPrototype.toBlob) { - if (CanvasPrototype.mozGetAsFile) { - CanvasPrototype.toBlob = function (callback, type, quality) { - if (quality && CanvasPrototype.toDataURL && dataURLtoBlob) { - callback(dataURLtoBlob(this.toDataURL(type, quality))); - } else { - callback(this.mozGetAsFile('blob', type)); - } - }; - } else if (CanvasPrototype.toDataURL && dataURLtoBlob) { - CanvasPrototype.toBlob = function (callback, type, quality) { - callback(dataURLtoBlob(this.toDataURL(type, quality))); - }; - } - } - window.dataURLtoBlob = dataURLtoBlob; -})(window); - -/*jslint evil: true */ -/*global window, URL, webkitURL, ActiveXObject */ - -(function (window, undef){ - 'use strict'; - - var - gid = 1, - noop = function (){}, - - document = window.document, - doctype = document.doctype || {}, - userAgent = window.navigator.userAgent, - safari = /safari\//i.test(userAgent) && !/chrome\//i.test(userAgent), - iemobile = /iemobile\//i.test(userAgent), - - // https://github.com/blueimp/JavaScript-Load-Image/blob/master/load-image.js#L48 - apiURL = (window.createObjectURL && window) || (window.URL && URL.revokeObjectURL && URL) || (window.webkitURL && webkitURL), - - Blob = window.Blob, - File = window.File, - FileReader = window.FileReader, - FormData = window.FormData, - - - XMLHttpRequest = window.XMLHttpRequest, - jQuery = window.jQuery, - - html5 = !!(File && (FileReader && (window.Uint8Array || FormData || XMLHttpRequest.prototype.sendAsBinary))) - && !(safari && /windows/i.test(userAgent) && !iemobile), // BugFix: https://github.com/mailru/FileAPI/issues/25 - - cors = html5 && ('withCredentials' in (new XMLHttpRequest)), - - chunked = html5 && !!Blob && !!(Blob.prototype.webkitSlice || Blob.prototype.mozSlice || Blob.prototype.slice), - - normalize = ('' + ''.normalize).indexOf('[native code]') > 0, - - // https://github.com/blueimp/JavaScript-Canvas-to-Blob - dataURLtoBlob = window.dataURLtoBlob, - - - _rimg = /img/i, - _rcanvas = /canvas/i, - _rimgcanvas = /img|canvas/i, - _rinput = /input/i, - _rdata = /^data:[^,]+,/, - - _toString = {}.toString, - _supportConsoleLog, - _supportConsoleLogApply, - - - Math = window.Math, - - _SIZE_CONST = function (pow){ - pow = new window.Number(Math.pow(1024, pow)); - pow.from = function (sz){ return Math.round(sz * this); }; - return pow; - }, - - _elEvents = {}, // element event listeners - _infoReader = [], // list of file info processors - - _readerEvents = 'abort progress error load loadend', - _xhrPropsExport = 'status statusText readyState response responseXML responseText responseBody'.split(' '), - - currentTarget = 'currentTarget', // for minimize - preventDefault = 'preventDefault', // and this too - - _isArray = function (ar) { - return ar && ('length' in ar); - }, - - /** - * Iterate over a object or array - */ - _each = function (obj, fn, ctx){ - if( obj ){ - if( _isArray(obj) ){ - for( var i = 0, n = obj.length; i < n; i++ ){ - if( i in obj ){ - fn.call(ctx, obj[i], i, obj); - } - } - } - else { - for( var key in obj ){ - if( obj.hasOwnProperty(key) ){ - fn.call(ctx, obj[key], key, obj); - } - } - } - } - }, - - /** - * Merge the contents of two or more objects together into the first object - */ - _extend = function (dst){ - var args = arguments, i = 1, _ext = function (val, key){ dst[key] = val; }; - for( ; i < args.length; i++ ){ - _each(args[i], _ext); - } - return dst; - }, - - /** - * Add event listener - */ - _on = function (el, type, fn){ - if( el ){ - var uid = api.uid(el); - - if( !_elEvents[uid] ){ - _elEvents[uid] = {}; - } - - var isFileReader = (FileReader && el) && (el instanceof FileReader); - _each(type.split(/\s+/), function (type){ - if( jQuery && !isFileReader){ - jQuery.event.add(el, type, fn); - } else { - if( !_elEvents[uid][type] ){ - _elEvents[uid][type] = []; - } - - _elEvents[uid][type].push(fn); - - if( el.addEventListener ){ el.addEventListener(type, fn, false); } - else if( el.attachEvent ){ el.attachEvent('on'+type, fn); } - else { el['on'+type] = fn; } - } - }); - } - }, - - - /** - * Remove event listener - */ - _off = function (el, type, fn){ - if( el ){ - var uid = api.uid(el), events = _elEvents[uid] || {}; - - var isFileReader = (FileReader && el) && (el instanceof FileReader); - _each(type.split(/\s+/), function (type){ - if( jQuery && !isFileReader){ - jQuery.event.remove(el, type, fn); - } - else { - var fns = events[type] || [], i = fns.length; - - while( i-- ){ - if( fns[i] === fn ){ - fns.splice(i, 1); - break; - } - } - - if( el.addEventListener ){ el.removeEventListener(type, fn, false); } - else if( el.detachEvent ){ el.detachEvent('on'+type, fn); } - else { el['on'+type] = null; } - } - }); - } - }, - - - _one = function(el, type, fn){ - _on(el, type, function _(evt){ - _off(el, type, _); - fn(evt); - }); - }, - - - _fixEvent = function (evt){ - if( !evt.target ){ evt.target = window.event && window.event.srcElement || document; } - if( evt.target.nodeType === 3 ){ evt.target = evt.target.parentNode; } - return evt; - }, - - - _supportInputAttr = function (attr){ - var input = document.createElement('input'); - input.setAttribute('type', "file"); - return attr in input; - }, - - - /** - * FileAPI (core object) - */ - api = { - version: '2.0.19', - - cors: false, - html5: true, - media: false, - formData: true, - multiPassResize: true, - - debug: false, - pingUrl: false, - multiFlash: false, - flashAbortTimeout: 0, - withCredentials: true, - - staticPath: './dist/', - - flashUrl: 0, // @default: './FileAPI.flash.swf' - flashImageUrl: 0, // @default: './FileAPI.flash.image.swf' - - postNameConcat: function (name, idx){ - return name + (idx != null ? '['+ idx +']' : ''); - }, - - ext2mime: { - jpg: 'image/jpeg' - , tif: 'image/tiff' - , txt: 'text/plain' - }, - - // Fallback for flash - accept: { - 'image/*': 'art bm bmp dwg dxf cbr cbz fif fpx gif ico iefs jfif jpe jpeg jpg jps jut mcf nap nif pbm pcx pgm pict pm png pnm qif qtif ras rast rf rp svf tga tif tiff xbm xbm xpm xwd' - , 'audio/*': 'm4a flac aac rm mpa wav wma ogg mp3 mp2 m3u mod amf dmf dsm far gdm imf it m15 med okt s3m stm sfx ult uni xm sid ac3 dts cue aif aiff wpl ape mac mpc mpp shn wv nsf spc gym adplug adx dsp adp ymf ast afc hps xs' - , 'video/*': 'm4v 3gp nsv ts ty strm rm rmvb m3u ifo mov qt divx xvid bivx vob nrg img iso pva wmv asf asx ogm m2v avi bin dat dvr-ms mpg mpeg mp4 mkv avc vp3 svq3 nuv viv dv fli flv wpl' - }, - - uploadRetry : 0, - networkDownRetryTimeout : 5000, // milliseconds, don't flood when network is down - - chunkSize : 0, - chunkUploadRetry : 0, - chunkNetworkDownRetryTimeout : 2000, // milliseconds, don't flood when network is down - - KB: _SIZE_CONST(1), - MB: _SIZE_CONST(2), - GB: _SIZE_CONST(3), - TB: _SIZE_CONST(4), - - EMPTY_PNG: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=', - - expando: 'fileapi' + (new Date).getTime(), - - uid: function (obj){ - return obj - ? (obj[api.expando] = obj[api.expando] || api.uid()) - : (++gid, api.expando + gid) - ; - }, - - log: function (){ - if( api.debug && _supportConsoleLog ){ - if( _supportConsoleLogApply ){ - console.log.apply(console, arguments); - } - else { - console.log([].join.call(arguments, ' ')); - } - } - }, - - /** - * Create new image - * - * @param {String} [src] - * @param {Function} [fn] 1. error -- boolean, 2. img -- Image element - * @returns {HTMLElement} - */ - newImage: function (src, fn){ - var img = document.createElement('img'); - if( fn ){ - api.event.one(img, 'error load', function (evt){ - fn(evt.type == 'error', img); - img = null; - }); - } - img.src = src; - return img; - }, - - /** - * Get XHR - * @returns {XMLHttpRequest} - */ - getXHR: function (){ - var xhr; - - if( XMLHttpRequest ){ - xhr = new XMLHttpRequest; - } - else if( window.ActiveXObject ){ - try { - xhr = new ActiveXObject('MSXML2.XMLHttp.3.0'); - } catch (e) { - xhr = new ActiveXObject('Microsoft.XMLHTTP'); - } - } - - return xhr; - }, - - isArray: _isArray, - - support: { - dnd: cors && ('ondrop' in document.createElement('div')), - cors: cors, - html5: html5, - chunked: chunked, - dataURI: true, - accept: _supportInputAttr('accept'), - multiple: _supportInputAttr('multiple') - }, - - event: { - on: _on - , off: _off - , one: _one - , fix: _fixEvent - }, - - - throttle: function(fn, delay) { - var id, args; - - return function _throttle(){ - args = arguments; - - if( !id ){ - fn.apply(window, args); - id = setTimeout(function (){ - id = 0; - fn.apply(window, args); - }, delay); - } - }; - }, - - - F: function (){}, - - - parseJSON: function (str){ - var json; - if( window.JSON && JSON.parse ){ - json = JSON.parse(str); - } - else { - json = (new Function('return ('+str.replace(/([\r\n])/g, '\\$1')+');'))(); - } - return json; - }, - - - trim: function (str){ - str = String(str); - return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, ''); - }, - - /** - * Simple Defer - * @return {Object} - */ - defer: function (){ - var - list = [] - , result - , error - , defer = { - resolve: function (err, res){ - defer.resolve = noop; - error = err || false; - result = res; - - while( res = list.shift() ){ - res(error, result); - } - }, - - then: function (fn){ - if( error !== undef ){ - fn(error, result); - } else { - list.push(fn); - } - } - }; - - return defer; - }, - - queue: function (fn){ - var - _idx = 0 - , _length = 0 - , _fail = false - , _end = false - , queue = { - inc: function (){ - _length++; - }, - - next: function (){ - _idx++; - setTimeout(queue.check, 0); - }, - - check: function (){ - (_idx >= _length) && !_fail && queue.end(); - }, - - isFail: function (){ - return _fail; - }, - - fail: function (){ - !_fail && fn(_fail = true); - }, - - end: function (){ - if( !_end ){ - _end = true; - fn(); - } - } - } - ; - return queue; - }, - - - /** - * For each object - * - * @param {Object|Array} obj - * @param {Function} fn - * @param {*} [ctx] - */ - each: _each, - - - /** - * Async for - * @param {Array} array - * @param {Function} callback - */ - afor: function (array, callback){ - var i = 0, n = array.length; - - if( _isArray(array) && n-- ){ - (function _next(){ - callback(n != i && _next, array[i], i++); - })(); - } - else { - callback(false); - } - }, - - - /** - * Merge the contents of two or more objects together into the first object - * - * @param {Object} dst - * @return {Object} - */ - extend: _extend, - - - /** - * Is file? - * @param {File} file - * @return {Boolean} - */ - isFile: function (file){ - return _toString.call(file) === '[object File]'; - }, - - - /** - * Is blob? - * @param {Blob} blob - * @returns {Boolean} - */ - isBlob: function (blob) { - return this.isFile(blob) || (_toString.call(blob) === '[object Blob]'); - }, - - - /** - * Is canvas element - * - * @param {HTMLElement} el - * @return {Boolean} - */ - isCanvas: function (el){ - return el && _rcanvas.test(el.nodeName); - }, - - - getFilesFilter: function (filter){ - filter = typeof filter == 'string' ? filter : (filter.getAttribute && filter.getAttribute('accept') || ''); - return filter ? new RegExp('('+ filter.replace(/\./g, '\\.').replace(/,/g, '|') +')$', 'i') : /./; - }, - - - - /** - * Read as DataURL - * - * @param {File|Element} file - * @param {Function} fn - */ - readAsDataURL: function (file, fn){ - if( api.isCanvas(file) ){ - _emit(file, fn, 'load', api.toDataURL(file)); - } - else { - _readAs(file, fn, 'DataURL'); - } - }, - - - /** - * Read as Binary string - * - * @param {File} file - * @param {Function} fn - */ - readAsBinaryString: function (file, fn){ - if( _hasSupportReadAs('BinaryString') ){ - _readAs(file, fn, 'BinaryString'); - } else { - // Hello IE10! - _readAs(file, function (evt){ - if( evt.type == 'load' ){ - try { - // dataURL -> binaryString - evt.result = api.toBinaryString(evt.result); - } catch (e){ - evt.type = 'error'; - evt.message = e.toString(); - } - } - fn(evt); - }, 'DataURL'); - } - }, - - - /** - * Read as ArrayBuffer - * - * @param {File} file - * @param {Function} fn - */ - readAsArrayBuffer: function(file, fn){ - _readAs(file, fn, 'ArrayBuffer'); - }, - - - /** - * Read as text - * - * @param {File} file - * @param {String} encoding - * @param {Function} [fn] - */ - readAsText: function(file, encoding, fn){ - if( !fn ){ - fn = encoding; - encoding = 'utf-8'; - } - - _readAs(file, fn, 'Text', encoding); - }, - - - /** - * Convert image or canvas to DataURL - * - * @param {Element} el Image or Canvas element - * @param {String} [type] mime-type - * @return {String} - */ - toDataURL: function (el, type){ - if( typeof el == 'string' ){ - return el; - } - else if( el.toDataURL ){ - return el.toDataURL(type || 'image/png'); - } - }, - - - /** - * Canvert string, image or canvas to binary string - * - * @param {String|Element} val - * @return {String} - */ - toBinaryString: function (val){ - return window.atob(api.toDataURL(val).replace(_rdata, '')); - }, - - - /** - * Read file or DataURL as ImageElement - * - * @param {File|String} file - * @param {Function} fn - * @param {Boolean} [progress] - */ - readAsImage: function (file, fn, progress){ - if( api.isBlob(file) ){ - if( apiURL ){ - /** @namespace apiURL.createObjectURL */ - var data = apiURL.createObjectURL(file); - if( data === undef ){ - _emit(file, fn, 'error'); - } - else { - api.readAsImage(data, fn, progress); - } - } - else { - api.readAsDataURL(file, function (evt){ - if( evt.type == 'load' ){ - api.readAsImage(evt.result, fn, progress); - } - else if( progress || evt.type == 'error' ){ - _emit(file, fn, evt, null, { loaded: evt.loaded, total: evt.total }); - } - }); - } - } - else if( api.isCanvas(file) ){ - _emit(file, fn, 'load', file); - } - else if( _rimg.test(file.nodeName) ){ - if( file.complete ){ - _emit(file, fn, 'load', file); - } - else { - var events = 'error abort load'; - _one(file, events, function _fn(evt){ - if( evt.type == 'load' && apiURL ){ - /** @namespace apiURL.revokeObjectURL */ - apiURL.revokeObjectURL(file.src); - } - - _off(file, events, _fn); - _emit(file, fn, evt, file); - }); - } - } - else if( file.iframe ){ - _emit(file, fn, { type: 'error' }); - } - else { - // Created image - var img = api.newImage(file.dataURL || file); - api.readAsImage(img, fn, progress); - } - }, - - - /** - * Make file by name - * - * @param {String} name - * @return {Array} - */ - checkFileObj: function (name){ - var file = {}, accept = api.accept; - - if( typeof name == 'object' ){ - file = name; - } - else { - file.name = (name + '').split(/\\|\//g).pop(); - } - - if( file.type == null ){ - file.type = file.name.split('.').pop(); - } - - _each(accept, function (ext, type){ - ext = new RegExp(ext.replace(/\s/g, '|'), 'i'); - if( ext.test(file.type) || api.ext2mime[file.type] ){ - file.type = api.ext2mime[file.type] || (type.split('/')[0] +'/'+ file.type); - } - }); - - return file; - }, - - - /** - * Get drop files - * - * @param {Event} evt - * @param {Function} callback - */ - getDropFiles: function (evt, callback){ - var - files = [] - , all = [] - , items - , dataTransfer = _getDataTransfer(evt) - , transFiles = dataTransfer.files - , transItems = dataTransfer.items - , entrySupport = _isArray(transItems) && transItems[0] && _getAsEntry(transItems[0]) - , queue = api.queue(function (){ callback(files, all); }) - ; - - if( entrySupport ){ - if( normalize && transFiles ){ - var - i = transFiles.length - , file - , entry - ; - - items = new Array(i); - while( i-- ){ - file = transFiles[i]; - - try { - entry = _getAsEntry(transItems[i]); - } - catch( err ){ - api.log('[err] getDropFiles: ', err); - entry = null; - } - - if( _isEntry(entry) ){ - // OSX filesystems use Unicode Normalization Form D (NFD), - // and entry.file(…) can't read the files with the same names - if( entry.isDirectory || (entry.isFile && file.name == file.name.normalize('NFC')) ){ - items[i] = entry; - } - else { - items[i] = file; - } - } - else { - items[i] = file; - } - } - } - else { - items = transItems; - } - } - else { - items = transFiles; - } - - _each(items || [], function (item){ - queue.inc(); - - try { - if( entrySupport && _isEntry(item) ){ - _readEntryAsFiles(item, function (err, entryFiles, allEntries){ - if( err ){ - api.log('[err] getDropFiles:', err); - } else { - files.push.apply(files, entryFiles); - } - all.push.apply(all, allEntries); - - queue.next(); - }); - } - else { - _isRegularFile(item, function (yes, err){ - if( yes ){ - files.push(item); - } - else { - item.error = err; - } - all.push(item); - - queue.next(); - }); - } - } - catch( err ){ - queue.next(); - api.log('[err] getDropFiles: ', err); - } - }); - - queue.check(); - }, - - - /** - * Get file list - * - * @param {HTMLInputElement|Event} input - * @param {String|Function} [filter] - * @param {Function} [callback] - * @return {Array|Null} - */ - getFiles: function (input, filter, callback){ - var files = []; - - if( callback ){ - api.filterFiles(api.getFiles(input), filter, callback); - return null; - } - - if( input.jquery ){ - // jQuery object - input.each(function (){ - files = files.concat(api.getFiles(this)); - }); - input = files; - files = []; - } - - if( typeof filter == 'string' ){ - filter = api.getFilesFilter(filter); - } - - if( input.originalEvent ){ - // jQuery event - input = _fixEvent(input.originalEvent); - } - else if( input.srcElement ){ - // IE Event - input = _fixEvent(input); - } - - - if( input.dataTransfer ){ - // Drag'n'Drop - input = input.dataTransfer; - } - else if( input.target ){ - // Event - input = input.target; - } - - if( input.files ){ - // Input[type="file"] - files = input.files; - - if( !html5 ){ - // Partial support for file api - files[0].blob = input; - files[0].iframe = true; - } - } - else if( !html5 && isInputFile(input) ){ - if( api.trim(input.value) ){ - files = [api.checkFileObj(input.value)]; - files[0].blob = input; - files[0].iframe = true; - } - } - else if( _isArray(input) ){ - files = input; - } - - return api.filter(files, function (file){ return !filter || filter.test(file.name); }); - }, - - - /** - * Get total file size - * @param {Array} files - * @return {Number} - */ - getTotalSize: function (files){ - var size = 0, i = files && files.length; - while( i-- ){ - size += files[i].size; - } - return size; - }, - - - /** - * Get image information - * - * @param {File} file - * @param {Function} fn - */ - getInfo: function (file, fn){ - var info = {}, readers = _infoReader.concat(); - - if( api.isBlob(file) ){ - (function _next(){ - var reader = readers.shift(); - if( reader ){ - if( reader.test(file.type) ){ - reader(file, function (err, res){ - if( err ){ - fn(err); - } - else { - _extend(info, res); - _next(); - } - }); - } - else { - _next(); - } - } - else { - fn(false, info); - } - })(); - } - else { - fn('not_support_info', info); - } - }, - - - /** - * Add information reader - * - * @param {RegExp} mime - * @param {Function} fn - */ - addInfoReader: function (mime, fn){ - fn.test = function (type){ return mime.test(type); }; - _infoReader.push(fn); - }, - - - /** - * Filter of array - * - * @param {Array} input - * @param {Function} fn - * @return {Array} - */ - filter: function (input, fn){ - var result = [], i = 0, n = input.length, val; - - for( ; i < n; i++ ){ - if( i in input ){ - val = input[i]; - if( fn.call(val, val, i, input) ){ - result.push(val); - } - } - } - - return result; - }, - - - /** - * Filter files - * - * @param {Array} files - * @param {Function} eachFn - * @param {Function} resultFn - */ - filterFiles: function (files, eachFn, resultFn){ - if( files.length ){ - // HTML5 or Flash - var queue = files.concat(), file, result = [], deleted = []; - - (function _next(){ - if( queue.length ){ - file = queue.shift(); - api.getInfo(file, function (err, info){ - (eachFn(file, err ? false : info) ? result : deleted).push(file); - _next(); - }); - } - else { - resultFn(result, deleted); - } - })(); - } - else { - resultFn([], files); - } - }, - - - upload: function (options){ - options = _extend({ - jsonp: 'callback' - , prepare: api.F - , beforeupload: api.F - , upload: api.F - , fileupload: api.F - , fileprogress: api.F - , filecomplete: api.F - , progress: api.F - , complete: api.F - , pause: api.F - , imageOriginal: true - , chunkSize: api.chunkSize - , chunkUploadRetry: api.chunkUploadRetry - , uploadRetry: api.uploadRetry - }, options); - - - if( options.imageAutoOrientation && !options.imageTransform ){ - options.imageTransform = { rotate: 'auto' }; - } - - - var - proxyXHR = new api.XHR(options) - , dataArray = this._getFilesDataArray(options.files) - , _this = this - , _total = 0 - , _loaded = 0 - , _nextFile - , _complete = false - ; - - - // calc total size - _each(dataArray, function (data){ - _total += data.size; - }); - - // Array of files - proxyXHR.files = []; - _each(dataArray, function (data){ - proxyXHR.files.push(data.file); - }); - - // Set upload status props - proxyXHR.total = _total; - proxyXHR.loaded = 0; - proxyXHR.filesLeft = dataArray.length; - - // emit "beforeupload" event - options.beforeupload(proxyXHR, options); - - // Upload by file - _nextFile = function (){ - var - data = dataArray.shift() - , _file = data && data.file - , _fileLoaded = false - , _fileOptions = _simpleClone(options) - ; - - proxyXHR.filesLeft = dataArray.length; - - if( _file && _file.name === api.expando ){ - _file = null; - api.log('[warn] FileAPI.upload() — called without files'); - } - - if( ( proxyXHR.statusText != 'abort' || proxyXHR.current ) && data ){ - // Mark active job - _complete = false; - - // Set current upload file - proxyXHR.currentFile = _file; - - // Prepare file options - if (_file && options.prepare(_file, _fileOptions) === false) { - _nextFile.call(_this); - return; - } - _fileOptions.file = _file; - - _this._getFormData(_fileOptions, data, function (form){ - if( !_loaded ){ - // emit "upload" event - options.upload(proxyXHR, options); - } - - var xhr = new api.XHR(_extend({}, _fileOptions, { - - upload: _file ? function (){ - // emit "fileupload" event - options.fileupload(_file, xhr, _fileOptions); - } : noop, - - progress: _file ? function (evt){ - if( !_fileLoaded ){ - // For ignore the double calls. - _fileLoaded = (evt.loaded === evt.total); - - // emit "fileprogress" event - options.fileprogress({ - type: 'progress' - , total: data.total = evt.total - , loaded: data.loaded = evt.loaded - }, _file, xhr, _fileOptions); - - // emit "progress" event - options.progress({ - type: 'progress' - , total: _total - , loaded: proxyXHR.loaded = (_loaded + data.size * (evt.loaded/evt.total)) || 0 - }, _file, xhr, _fileOptions); - } - } : noop, - - complete: function (err){ - _each(_xhrPropsExport, function (name){ - proxyXHR[name] = xhr[name]; - }); - - if( _file ){ - data.total = (data.total || data.size); - data.loaded = data.total; - - if( !err ) { - // emulate 100% "progress" - this.progress(data); - - // fixed throttle event - _fileLoaded = true; - - // bytes loaded - _loaded += data.size; // data.size != data.total, it's desirable fix this - proxyXHR.loaded = _loaded; - } - - // emit "filecomplete" event - options.filecomplete(err, xhr, _file, _fileOptions); - } - - // upload next file - setTimeout(function () {_nextFile.call(_this);}, 0); - } - })); // xhr - - - // ... - proxyXHR.abort = function (current){ - if (!current) { dataArray.length = 0; } - this.current = current; - xhr.abort(); - }; - - // Start upload - xhr.send(form); - }); - } - else { - var successful = proxyXHR.status == 200 || proxyXHR.status == 201 || proxyXHR.status == 204; - options.complete(successful ? false : (proxyXHR.statusText || 'error'), proxyXHR, options); - // Mark done state - _complete = true; - } - }; - - - // Next tick - setTimeout(_nextFile, 0); - - - // Append more files to the existing request - // first - add them to the queue head/tail - proxyXHR.append = function (files, first) { - files = api._getFilesDataArray([].concat(files)); - - _each(files, function (data) { - _total += data.size; - proxyXHR.files.push(data.file); - if (first) { - dataArray.unshift(data); - } else { - dataArray.push(data); - } - }); - - proxyXHR.statusText = ""; - - if( _complete ){ - _nextFile.call(_this); - } - }; - - - // Removes file from queue by file reference and returns it - proxyXHR.remove = function (file) { - var i = dataArray.length, _file; - while( i-- ){ - if( dataArray[i].file == file ){ - _file = dataArray.splice(i, 1); - _total -= _file.size; - } - } - return _file; - }; - - return proxyXHR; - }, - - - _getFilesDataArray: function (data){ - var files = [], oFiles = {}; - - if( isInputFile(data) ){ - var tmp = api.getFiles(data); - oFiles[data.name || 'file'] = data.getAttribute('multiple') !== null ? tmp : tmp[0]; - } - else if( _isArray(data) && isInputFile(data[0]) ){ - _each(data, function (input){ - oFiles[input.name || 'file'] = api.getFiles(input); - }); - } - else { - oFiles = data; - } - - _each(oFiles, function add(file, name){ - if( _isArray(file) ){ - _each(file, function (file){ - add(file, name); - }); - } - else if( file && (file.name || file.image) ){ - files.push({ - name: name - , file: file - , size: file.size - , total: file.size - , loaded: 0 - }); - } - }); - - if( !files.length ){ - // Create fake `file` object - files.push({ file: { name: api.expando } }); - } - - return files; - }, - - - _getFormData: function (options, data, fn){ - var - file = data.file - , name = data.name - , filename = file.name - , filetype = file.type - , trans = api.support.transform && options.imageTransform - , Form = new api.Form - , queue = api.queue(function (){ fn(Form); }) - , isOrignTrans = trans && _isOriginTransform(trans) - , postNameConcat = api.postNameConcat - ; - - // Append data - _each(options.data, function add(val, name){ - if( typeof val == 'object' ){ - _each(val, function (v, i){ - add(v, postNameConcat(name, i)); - }); - } - else { - Form.append(name, val); - } - }); - - (function _addFile(file/**Object*/){ - if( file.image ){ // This is a FileAPI.Image - queue.inc(); - - file.toData(function (err, image){ - // @todo: требует рефакторинга и обработки ошибки - if (file.file) { - image.type = file.file.type; - image.quality = file.matrix.quality; - filename = file.file && file.file.name; - } - - filename = filename || (new Date).getTime()+'.png'; - - _addFile(image); - queue.next(); - }); - } - else if( api.Image && trans && (/^image/.test(file.type) || _rimgcanvas.test(file.nodeName)) ){ - queue.inc(); - - if( isOrignTrans ){ - // Convert to array for transform function - trans = [trans]; - } - - api.Image.transform(file, trans, options.imageAutoOrientation, function (err, images){ - if( isOrignTrans && !err ){ - if( !dataURLtoBlob && !api.flashEngine ){ - // Canvas.toBlob or Flash not supported, use multipart - Form.multipart = true; - } - - Form.append(name, images[0], filename, trans[0].type || filetype); - } - else { - var addOrigin = 0; - - if( !err ){ - _each(images, function (image, idx){ - if( !dataURLtoBlob && !api.flashEngine ){ - Form.multipart = true; - } - - if( !trans[idx].postName ){ - addOrigin = 1; - } - - Form.append(trans[idx].postName || postNameConcat(name, idx), image, filename, trans[idx].type || filetype); - }); - } - - if( err || options.imageOriginal ){ - Form.append(postNameConcat(name, (addOrigin ? 'original' : null)), file, filename, filetype); - } - } - - queue.next(); - }); - } - else if( filename !== api.expando ){ - Form.append(name, file, filename); - } - })(file); - - queue.check(); - }, - - - reset: function (inp, notRemove){ - var parent, clone; - - if( jQuery ){ - clone = jQuery(inp).clone(true).insertBefore(inp).val('')[0]; - if( !notRemove ){ - jQuery(inp).remove(); - } - } else { - parent = inp.parentNode; - clone = parent.insertBefore(inp.cloneNode(true), inp); - clone.value = ''; - - if( !notRemove ){ - parent.removeChild(inp); - } - - _each(_elEvents[api.uid(inp)], function (fns, type){ - _each(fns, function (fn){ - _off(inp, type, fn); - _on(clone, type, fn); - }); - }); - } - - return clone; - }, - - - /** - * Load remote file - * - * @param {String} url - * @param {Function} fn - * @return {XMLHttpRequest} - */ - load: function (url, fn){ - var xhr = api.getXHR(); - if( xhr ){ - xhr.open('GET', url, true); - - if( xhr.overrideMimeType ){ - xhr.overrideMimeType('text/plain; charset=x-user-defined'); - } - - _on(xhr, 'progress', function (/**Event*/evt){ - /** @namespace evt.lengthComputable */ - if( evt.lengthComputable ){ - fn({ type: evt.type, loaded: evt.loaded, total: evt.total }, xhr); - } - }); - - xhr.onreadystatechange = function(){ - if( xhr.readyState == 4 ){ - xhr.onreadystatechange = null; - if( xhr.status == 200 ){ - url = url.split('/'); - /** @namespace xhr.responseBody */ - var file = { - name: url[url.length-1] - , size: xhr.getResponseHeader('Content-Length') - , type: xhr.getResponseHeader('Content-Type') - }; - file.dataURL = 'data:'+file.type+';base64,' + api.encode64(xhr.responseBody || xhr.responseText); - fn({ type: 'load', result: file }, xhr); - } - else { - fn({ type: 'error' }, xhr); - } - } - }; - xhr.send(null); - } else { - fn({ type: 'error' }); - } - - return xhr; - }, - - encode64: function (str){ - var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=', outStr = '', i = 0; - - if( typeof str !== 'string' ){ - str = String(str); - } - - while( i < str.length ){ - //all three "& 0xff" added below are there to fix a known bug - //with bytes returned by xhr.responseText - var - byte1 = str.charCodeAt(i++) & 0xff - , byte2 = str.charCodeAt(i++) & 0xff - , byte3 = str.charCodeAt(i++) & 0xff - , enc1 = byte1 >> 2 - , enc2 = ((byte1 & 3) << 4) | (byte2 >> 4) - , enc3, enc4 - ; - - if( isNaN(byte2) ){ - enc3 = enc4 = 64; - } else { - enc3 = ((byte2 & 15) << 2) | (byte3 >> 6); - enc4 = isNaN(byte3) ? 64 : byte3 & 63; - } - - outStr += b64.charAt(enc1) + b64.charAt(enc2) + b64.charAt(enc3) + b64.charAt(enc4); - } - - return outStr; - } - - } // api - ; - - - function _emit(target, fn, name, res, ext){ - var evt = { - type: name.type || name - , target: target - , result: res - }; - _extend(evt, ext); - fn(evt); - } - - - function _hasSupportReadAs(method){ - return FileReader && !!FileReader.prototype['readAs' + method]; - } - - - function _readAs(file, fn, method, encoding){ - if( api.isBlob(file) && _hasSupportReadAs(method) ){ - var Reader = new FileReader; - - // Add event listener - _on(Reader, _readerEvents, function _fn(evt){ - var type = evt.type; - if( type == 'progress' ){ - _emit(file, fn, evt, evt.target.result, { loaded: evt.loaded, total: evt.total }); - } - else if( type == 'loadend' ){ - _off(Reader, _readerEvents, _fn); - Reader = null; - } - else { - _emit(file, fn, evt, evt.target.result); - } - }); - - - try { - // ReadAs ... - if( encoding ){ - Reader['readAs' + method](file, encoding); - } - else { - Reader['readAs' + method](file); - } - } - catch (err){ - _emit(file, fn, 'error', undef, { error: err.toString() }); - } - } - else { - _emit(file, fn, 'error', undef, { error: 'filreader_not_support_' + method }); - } - } - - - function _isRegularFile(file, callback){ - // http://stackoverflow.com/questions/8856628/detecting-folders-directories-in-javascript-filelist-objects - if( !file.type && (safari || ((file.size % 4096) === 0 && (file.size <= 102400))) ){ - if( FileReader ){ - try { - var reader = new FileReader(); - - _one(reader, _readerEvents, function (evt){ - var isFile = evt.type != 'error'; - if( isFile ){ - if ( reader.readyState == null || reader.readyState === reader.LOADING ) { - reader.abort(); - } - callback(isFile); - } - else { - callback(false, reader.error); - } - }); - - reader.readAsDataURL(file); - } catch( err ){ - callback(false, err); - } - } - else { - callback(null, new Error('FileReader is not supported')); - } - } - else { - callback(true); - } - } - - - function _isEntry(item){ - return item && (item.isFile || item.isDirectory); - } - - - function _getAsEntry(item){ - var entry; - if( item.getAsEntry ){ entry = item.getAsEntry(); } - else if( item.webkitGetAsEntry ){ entry = item.webkitGetAsEntry(); } - return entry; - } - - - function _readEntryAsFiles(entry, callback){ - if( !entry ){ - // error - var err = new Error('invalid entry'); - entry = new Object(entry); - entry.error = err; - callback(err.message, [], [entry]); - } - else if( entry.isFile ){ - // Read as file - entry.file(function (file){ - // success - file.fullPath = entry.fullPath; - callback(false, [file], [file]); - }, function (err){ - // error - entry.error = err; - callback('FileError.code: ' + err.code, [], [entry]); - }); - } - else if( entry.isDirectory ){ - var - reader = entry.createReader() - , firstAttempt = true - , files = [] - , all = [entry] - ; - - var onerror = function (err){ - // error - entry.error = err; - callback('DirectoryError.code: ' + err.code, files, all); - }; - var ondone = function ondone(entries){ - if( firstAttempt ){ - firstAttempt = false; - if( !entries.length ){ - entry.error = new Error('directory is empty'); - } - } - - // success - if( entries.length ){ - api.afor(entries, function (next, entry){ - _readEntryAsFiles(entry, function (err, entryFiles, allEntries){ - if( !err ){ - files = files.concat(entryFiles); - } - all = all.concat(allEntries); - - if( next ){ - next(); - } - else { - reader.readEntries(ondone, onerror); - } - }); - }); - } - else { - callback(false, files, all); - } - }; - - reader.readEntries(ondone, onerror); - } - else { - _readEntryAsFiles(_getAsEntry(entry), callback); - } - } - - - function _simpleClone(obj){ - var copy = {}; - _each(obj, function (val, key){ - if( val && (typeof val === 'object') && (val.nodeType === void 0) ){ - val = _extend({}, val); - } - copy[key] = val; - }); - return copy; - } - - - function isInputFile(el){ - return _rinput.test(el && el.tagName); - } - - - function _getDataTransfer(evt){ - return (evt.originalEvent || evt || '').dataTransfer || {}; - } - - - function _isOriginTransform(trans){ - var key; - for( key in trans ){ - if( trans.hasOwnProperty(key) ){ - if( !(trans[key] instanceof Object || key === 'overlay' || key === 'filter') ){ - return true; - } - } - } - return false; - } - - - // Add default image info reader - api.addInfoReader(/^image/, function (file/**File*/, callback/**Function*/){ - if( !file.__dimensions ){ - var defer = file.__dimensions = api.defer(); - - api.readAsImage(file, function (evt){ - var img = evt.target; - defer.resolve(evt.type == 'load' ? false : 'error', { - width: img.width - , height: img.height - }); - img.src = api.EMPTY_PNG; - img = null; - }); - } - - file.__dimensions.then(callback); - }); - - - /** - * Drag'n'Drop special event - * - * @param {HTMLElement} el - * @param {Function} onHover - * @param {Function} onDrop - */ - api.event.dnd = function (el, onHover, onDrop){ - var _id, _type; - - if( !onDrop ){ - onDrop = onHover; - onHover = api.F; - } - - if( FileReader ){ - // Hover - _on(el, 'dragenter dragleave dragover', onHover.ff = onHover.ff || function (evt){ - var - types = _getDataTransfer(evt).types - , i = types && types.length - , debounceTrigger = false - ; - - while( i-- ){ - if( ~types[i].indexOf('File') ){ - evt[preventDefault](); - - if( _type !== evt.type ){ - _type = evt.type; // Store current type of event - - if( _type != 'dragleave' ){ - onHover.call(evt[currentTarget], true, evt); - } - - debounceTrigger = true; - } - - break; // exit from "while" - } - } - - if( debounceTrigger ){ - clearTimeout(_id); - _id = setTimeout(function (){ - onHover.call(evt[currentTarget], _type != 'dragleave', evt); - }, 50); - } - }); - - - // Drop - _on(el, 'drop', onDrop.ff = onDrop.ff || function (evt){ - evt[preventDefault](); - - _type = 0; - onHover.call(evt[currentTarget], false, evt); - - api.getDropFiles(evt, function (files, all){ - onDrop.call(evt[currentTarget], files, all, evt); - }); - }); - } - else { - api.log("Drag'n'Drop -- not supported"); - } - }; - - - /** - * Remove drag'n'drop - * @param {HTMLElement} el - * @param {Function} onHover - * @param {Function} onDrop - */ - api.event.dnd.off = function (el, onHover, onDrop){ - _off(el, 'dragenter dragleave dragover', onHover.ff); - _off(el, 'drop', onDrop.ff); - }; - - - // Support jQuery - if( jQuery && !jQuery.fn.dnd ){ - jQuery.fn.dnd = function (onHover, onDrop){ - return this.each(function (){ - api.event.dnd(this, onHover, onDrop); - }); - }; - - jQuery.fn.offdnd = function (onHover, onDrop){ - return this.each(function (){ - api.event.dnd.off(this, onHover, onDrop); - }); - }; - } - - // @export - window.FileAPI = _extend(api, window.FileAPI); - - - // Debug info - api.log('FileAPI: ' + api.version); - api.log('protocol: ' + window.location.protocol); - api.log('doctype: [' + doctype.name + '] ' + doctype.publicId + ' ' + doctype.systemId); - - - // @detect 'x-ua-compatible' - _each(document.getElementsByTagName('meta'), function (meta){ - if( /x-ua-compatible/i.test(meta.getAttribute('http-equiv')) ){ - api.log('meta.http-equiv: ' + meta.getAttribute('content')); - } - }); - - - // Configuration - try { - _supportConsoleLog = !!console.log; - _supportConsoleLogApply = !!console.log.apply; - } - catch (err) {} - - if( !api.flashUrl ){ api.flashUrl = api.staticPath + 'FileAPI.flash.swf'; } - if( !api.flashImageUrl ){ api.flashImageUrl = api.staticPath + 'FileAPI.flash.image.swf'; } - if( !api.flashWebcamUrl ){ api.flashWebcamUrl = api.staticPath + 'FileAPI.flash.camera.swf'; } -})(window, void 0); - -/*global window, FileAPI, document */ - -(function (api, document, undef) { - 'use strict'; - - var - min = Math.min, - round = Math.round, - getCanvas = function () { return document.createElement('canvas'); }, - support = false, - exifOrientation = { - 8: 270 - , 3: 180 - , 6: 90 - , 7: 270 - , 4: 180 - , 5: 90 - } - ; - - try { - support = getCanvas().toDataURL('image/png').indexOf('data:image/png') > -1; - } - catch (e){} - - - function Image(file){ - if( file instanceof Image ){ - var img = new Image(file.file); - api.extend(img.matrix, file.matrix); - return img; - } - else if( !(this instanceof Image) ){ - return new Image(file); - } - - this.file = file; - this.size = file.size || 100; - - this.matrix = { - sx: 0, - sy: 0, - sw: 0, - sh: 0, - dx: 0, - dy: 0, - dw: 0, - dh: 0, - resize: 0, // min, max OR preview - deg: 0, - quality: 1, // jpeg quality - filter: 0 - }; - } - - - Image.prototype = { - image: true, - constructor: Image, - - set: function (attrs){ - api.extend(this.matrix, attrs); - return this; - }, - - crop: function (x, y, w, h){ - if( w === undef ){ - w = x; - h = y; - x = y = 0; - } - return this.set({ sx: x, sy: y, sw: w, sh: h || w }); - }, - - resize: function (w, h, strategy){ - if( /min|max|height|width/.test(h) ){ - strategy = h; - h = w; - } - - return this.set({ dw: w, dh: h || w, resize: strategy }); - }, - - preview: function (w, h){ - return this.resize(w, h || w, 'preview'); - }, - - rotate: function (deg){ - return this.set({ deg: deg }); - }, - - filter: function (filter){ - return this.set({ filter: filter }); - }, - - overlay: function (images){ - return this.set({ overlay: images }); - }, - - clone: function (){ - return new Image(this); - }, - - _load: function (image, fn){ - var self = this; - - if( /img|video/i.test(image.nodeName) ){ - fn.call(self, null, image); - } - else { - api.readAsImage(image, function (evt){ - fn.call(self, evt.type != 'load', evt.result); - }); - } - }, - - _apply: function (image, fn){ - var - canvas = getCanvas() - , m = this.getMatrix(image) - , ctx = canvas.getContext('2d') - , width = image.videoWidth || image.width - , height = image.videoHeight || image.height - , deg = m.deg - , dw = m.dw - , dh = m.dh - , w = width - , h = height - , filter = m.filter - , copy // canvas copy - , buffer = image - , overlay = m.overlay - , queue = api.queue(function (){ image.src = api.EMPTY_PNG; fn(false, canvas); }) - , renderImageToCanvas = api.renderImageToCanvas - ; - - // Normalize angle - deg = deg - Math.floor(deg/360)*360; - - // For `renderImageToCanvas` - image._type = this.file.type; - - while(m.multipass && min(w/dw, h/dh) > 2 ){ - w = (w/2 + 0.5)|0; - h = (h/2 + 0.5)|0; - - copy = getCanvas(); - copy.width = w; - copy.height = h; - - if( buffer !== image ){ - renderImageToCanvas(copy, buffer, 0, 0, buffer.width, buffer.height, 0, 0, w, h); - buffer = copy; - } - else { - buffer = copy; - renderImageToCanvas(buffer, image, m.sx, m.sy, m.sw, m.sh, 0, 0, w, h); - m.sx = m.sy = m.sw = m.sh = 0; - } - } - - - canvas.width = (deg % 180) ? dh : dw; - canvas.height = (deg % 180) ? dw : dh; - - canvas.type = m.type; - canvas.quality = m.quality; - - ctx.rotate(deg * Math.PI / 180); - renderImageToCanvas(ctx.canvas, buffer - , m.sx, m.sy - , m.sw || buffer.width - , m.sh || buffer.height - , (deg == 180 || deg == 270 ? -dw : 0) - , (deg == 90 || deg == 180 ? -dh : 0) - , dw, dh - ); - dw = canvas.width; - dh = canvas.height; - - // Apply overlay - overlay && api.each([].concat(overlay), function (over){ - queue.inc(); - // preload - var img = new window.Image, fn = function (){ - var - x = over.x|0 - , y = over.y|0 - , w = over.w || img.width - , h = over.h || img.height - , rel = over.rel - ; - - // center | right | left - x = (rel == 1 || rel == 4 || rel == 7) ? (dw - w + x)/2 : (rel == 2 || rel == 5 || rel == 8 ? dw - (w + x) : x); - - // center | bottom | top - y = (rel == 3 || rel == 4 || rel == 5) ? (dh - h + y)/2 : (rel >= 6 ? dh - (h + y) : y); - - api.event.off(img, 'error load abort', fn); - - try { - ctx.globalAlpha = over.opacity || 1; - ctx.drawImage(img, x, y, w, h); - } - catch (er){} - - queue.next(); - }; - - api.event.on(img, 'error load abort', fn); - img.src = over.src; - - if( img.complete ){ - fn(); - } - }); - - if( filter ){ - queue.inc(); - Image.applyFilter(canvas, filter, queue.next); - } - - queue.check(); - }, - - getMatrix: function (image){ - var - m = api.extend({}, this.matrix) - , sw = m.sw = m.sw || image.videoWidth || image.naturalWidth || image.width - , sh = m.sh = m.sh || image.videoHeight || image.naturalHeight || image.height - , dw = m.dw = m.dw || sw - , dh = m.dh = m.dh || sh - , sf = sw/sh, df = dw/dh - , strategy = m.resize - ; - - if( strategy == 'preview' ){ - if( dw != sw || dh != sh ){ - // Make preview - var w, h; - - if( df >= sf ){ - w = sw; - h = w / df; - } else { - h = sh; - w = h * df; - } - - if( w != sw || h != sh ){ - m.sx = ~~((sw - w)/2); - m.sy = ~~((sh - h)/2); - sw = w; - sh = h; - } - } - } - else if( strategy == 'height' ){ - dw = dh * sf; - } - else if( strategy == 'width' ){ - dh = dw / sf; - } - else if( strategy ){ - if( !(sw > dw || sh > dh) ){ - dw = sw; - dh = sh; - } - else if( strategy == 'min' ){ - dw = round(sf < df ? min(sw, dw) : dh*sf); - dh = round(sf < df ? dw/sf : min(sh, dh)); - } - else { - dw = round(sf >= df ? min(sw, dw) : dh*sf); - dh = round(sf >= df ? dw/sf : min(sh, dh)); - } - } - - m.sw = sw; - m.sh = sh; - m.dw = dw; - m.dh = dh; - m.multipass = api.multiPassResize; - return m; - }, - - _trans: function (fn){ - this._load(this.file, function (err, image){ - if( err ){ - fn(err); - } - else { - try { - this._apply(image, fn); - } catch (err){ - api.log('[err] FileAPI.Image.fn._apply:', err); - fn(err); - } - } - }); - }, - - - get: function (fn){ - if( api.support.transform ){ - var _this = this, matrix = _this.matrix; - - if( matrix.deg == 'auto' ){ - api.getInfo(_this.file, function (err, info){ - // rotate by exif orientation - matrix.deg = exifOrientation[info && info.exif && info.exif.Orientation] || 0; - _this._trans(fn); - }); - } - else { - _this._trans(fn); - } - } - else { - fn('not_support_transform'); - } - - return this; - }, - - - toData: function (fn){ - return this.get(fn); - } - - }; - - - Image.exifOrientation = exifOrientation; - - - Image.transform = function (file, transform, autoOrientation, fn){ - function _transform(err, img){ - // img -- info object - var - images = {} - , queue = api.queue(function (err){ - fn(err, images); - }) - ; - - if( !err ){ - api.each(transform, function (params, name){ - if( !queue.isFail() ){ - var ImgTrans = new Image(img.nodeType ? img : file), isFn = typeof params == 'function'; - - if( isFn ){ - params(img, ImgTrans); - } - else if( params.width ){ - ImgTrans[params.preview ? 'preview' : 'resize'](params.width, params.height, params.strategy); - } - else { - if( params.maxWidth && (img.width > params.maxWidth || img.height > params.maxHeight) ){ - ImgTrans.resize(params.maxWidth, params.maxHeight, 'max'); - } - } - - if( params.crop ){ - var crop = params.crop; - ImgTrans.crop(crop.x|0, crop.y|0, crop.w || crop.width, crop.h || crop.height); - } - - if( params.rotate === undef && autoOrientation ){ - params.rotate = 'auto'; - } - - ImgTrans.set({ type: ImgTrans.matrix.type || params.type || file.type || 'image/png' }); - - if( !isFn ){ - ImgTrans.set({ - deg: params.rotate - , overlay: params.overlay - , filter: params.filter - , quality: params.quality || 1 - }); - } - - queue.inc(); - ImgTrans.toData(function (err, image){ - if( err ){ - queue.fail(); - } - else { - images[name] = image; - queue.next(); - } - }); - } - }); - } - else { - queue.fail(); - } - } - - - // @todo: Оло-ло, нужно рефакторить это место - if( file.width ){ - _transform(false, file); - } else { - api.getInfo(file, _transform); - } - }; - - - // @const - api.each(['TOP', 'CENTER', 'BOTTOM'], function (x, i){ - api.each(['LEFT', 'CENTER', 'RIGHT'], function (y, j){ - Image[x+'_'+y] = i*3 + j; - Image[y+'_'+x] = i*3 + j; - }); - }); - - - /** - * Trabsform element to canvas - * - * @param {Image|HTMLVideoElement} el - * @returns {Canvas} - */ - Image.toCanvas = function(el){ - var canvas = document.createElement('canvas'); - canvas.width = el.videoWidth || el.width; - canvas.height = el.videoHeight || el.height; - canvas.getContext('2d').drawImage(el, 0, 0); - return canvas; - }; - - - /** - * Create image from DataURL - * @param {String} dataURL - * @param {Object} size - * @param {Function} callback - */ - Image.fromDataURL = function (dataURL, size, callback){ - var img = api.newImage(dataURL); - api.extend(img, size); - callback(img); - }; - - - /** - * Apply filter (caman.js) - * - * @param {Canvas|Image} canvas - * @param {String|Function} filter - * @param {Function} doneFn - */ - Image.applyFilter = function (canvas, filter, doneFn){ - if( typeof filter == 'function' ){ - filter(canvas, doneFn); - } - else if( window.Caman ){ - // http://camanjs.com/guides/ - window.Caman(canvas.tagName == 'IMG' ? Image.toCanvas(canvas) : canvas, function (){ - if( typeof filter == 'string' ){ - this[filter](); - } - else { - api.each(filter, function (val, method){ - this[method](val); - }, this); - } - this.render(doneFn); - }); - } - }; - - - /** - * For load-image-ios.js - */ - api.renderImageToCanvas = function (canvas, img, sx, sy, sw, sh, dx, dy, dw, dh){ - try { - return canvas.getContext('2d').drawImage(img, sx, sy, sw, sh, dx, dy, dw, dh); - } catch (ex) { - api.log('renderImageToCanvas failed'); - throw ex; - } - }; - - - // @export - api.support.canvas = api.support.transform = support; - api.Image = Image; -})(FileAPI, document); - -/* - * JavaScript Load Image iOS scaling fixes 1.0.3 - * https://github.com/blueimp/JavaScript-Load-Image - * - * Copyright 2013, Sebastian Tschan - * https://blueimp.net - * - * iOS image scaling fixes based on - * https://github.com/stomita/ios-imagefile-megapixel - * - * Licensed under the MIT license: - * http://www.opensource.org/licenses/MIT - */ - -/*jslint nomen: true, bitwise: true */ -/*global FileAPI, window, document */ - -(function (factory) { - 'use strict'; - factory(FileAPI); -}(function (loadImage) { - 'use strict'; - - // Only apply fixes on the iOS platform: - if (!window.navigator || !window.navigator.platform || - !(/iP(hone|od|ad)/).test(window.navigator.platform)) { - return; - } - - var originalRenderMethod = loadImage.renderImageToCanvas; - - // Detects subsampling in JPEG images: - loadImage.detectSubsampling = function (img) { - var canvas, - context; - if (img.width * img.height > 1024 * 1024) { // only consider mexapixel images - canvas = document.createElement('canvas'); - canvas.width = canvas.height = 1; - context = canvas.getContext('2d'); - context.drawImage(img, -img.width + 1, 0); - // subsampled image becomes half smaller in rendering size. - // check alpha channel value to confirm image is covering edge pixel or not. - // if alpha value is 0 image is not covering, hence subsampled. - return context.getImageData(0, 0, 1, 1).data[3] === 0; - } - return false; - }; - - // Detects vertical squash in JPEG images: - loadImage.detectVerticalSquash = function (img, subsampled) { - var naturalHeight = img.naturalHeight || img.height, - canvas = document.createElement('canvas'), - context = canvas.getContext('2d'), - data, - sy, - ey, - py, - alpha; - if (subsampled) { - naturalHeight /= 2; - } - canvas.width = 1; - canvas.height = naturalHeight; - context.drawImage(img, 0, 0); - data = context.getImageData(0, 0, 1, naturalHeight).data; - // search image edge pixel position in case it is squashed vertically: - sy = 0; - ey = naturalHeight; - py = naturalHeight; - while (py > sy) { - alpha = data[(py - 1) * 4 + 3]; - if (alpha === 0) { - ey = py; - } else { - sy = py; - } - py = (ey + sy) >> 1; - } - return (py / naturalHeight) || 1; - }; - - // Renders image to canvas while working around iOS image scaling bugs: - // https://github.com/blueimp/JavaScript-Load-Image/issues/13 - loadImage.renderImageToCanvas = function ( - canvas, - img, - sourceX, - sourceY, - sourceWidth, - sourceHeight, - destX, - destY, - destWidth, - destHeight - ) { - if (img._type === 'image/jpeg') { - var context = canvas.getContext('2d'), - tmpCanvas = document.createElement('canvas'), - tileSize = 1024, - tmpContext = tmpCanvas.getContext('2d'), - subsampled, - vertSquashRatio, - tileX, - tileY; - tmpCanvas.width = tileSize; - tmpCanvas.height = tileSize; - context.save(); - subsampled = loadImage.detectSubsampling(img); - if (subsampled) { - sourceX /= 2; - sourceY /= 2; - sourceWidth /= 2; - sourceHeight /= 2; - } - vertSquashRatio = loadImage.detectVerticalSquash(img, subsampled); - if (subsampled || vertSquashRatio !== 1) { - sourceY *= vertSquashRatio; - destWidth = Math.ceil(tileSize * destWidth / sourceWidth); - destHeight = Math.ceil( - tileSize * destHeight / sourceHeight / vertSquashRatio - ); - destY = 0; - tileY = 0; - while (tileY < sourceHeight) { - destX = 0; - tileX = 0; - while (tileX < sourceWidth) { - tmpContext.clearRect(0, 0, tileSize, tileSize); - tmpContext.drawImage( - img, - sourceX, - sourceY, - sourceWidth, - sourceHeight, - -tileX, - -tileY, - sourceWidth, - sourceHeight - ); - context.drawImage( - tmpCanvas, - 0, - 0, - tileSize, - tileSize, - destX, - destY, - destWidth, - destHeight - ); - tileX += tileSize; - destX += destWidth; - } - tileY += tileSize; - destY += destHeight; - } - context.restore(); - return canvas; - } - } - return originalRenderMethod( - canvas, - img, - sourceX, - sourceY, - sourceWidth, - sourceHeight, - destX, - destY, - destWidth, - destHeight - ); - }; - -})); - -/*global window, FileAPI */ - -(function (api, window){ - "use strict"; - - var - document = window.document - , FormData = window.FormData - , Form = function (){ this.items = []; } - , encodeURIComponent = window.encodeURIComponent - ; - - - Form.prototype = { - - append: function (name, blob, file, type){ - this.items.push({ - name: name - , blob: blob && blob.blob || (blob == void 0 ? '' : blob) - , file: blob && (file || blob.name) - , type: blob && (type || blob.type) - }); - }, - - each: function (fn){ - var i = 0, n = this.items.length; - for( ; i < n; i++ ){ - fn.call(this, this.items[i]); - } - }, - - toData: function (fn, options){ - // allow chunked transfer if we have only one file to send - // flag is used below and in XHR._send - options._chunked = api.support.chunked && options.chunkSize > 0 && api.filter(this.items, function (item){ return item.file; }).length == 1; - - if( !api.support.html5 ){ - api.log('FileAPI.Form.toHtmlData'); - this.toHtmlData(fn); - } - else if( !api.formData || this.multipart || !FormData ){ - api.log('FileAPI.Form.toMultipartData'); - this.toMultipartData(fn); - } - else if( options._chunked ){ - api.log('FileAPI.Form.toPlainData'); - this.toPlainData(fn); - } - else { - api.log('FileAPI.Form.toFormData'); - this.toFormData(fn); - } - }, - - _to: function (data, complete, next, arg){ - var queue = api.queue(function (){ - complete(data); - }); - - this.each(function (file){ - try{ - next(file, data, queue, arg); - } - catch( err ){ - api.log('FileAPI.Form._to: ' + err.message); - complete(err); - } - }); - - queue.check(); - }, - - - toHtmlData: function (fn){ - this._to(document.createDocumentFragment(), fn, function (file, data/**DocumentFragment*/){ - var blob = file.blob, hidden; - - if( file.file ){ - api.reset(blob, true); - // set new name - blob.name = file.name; - blob.disabled = false; - data.appendChild(blob); - } - else { - hidden = document.createElement('input'); - hidden.name = file.name; - hidden.type = 'hidden'; - hidden.value = blob; - data.appendChild(hidden); - } - }); - }, - - toPlainData: function (fn){ - this._to({}, fn, function (file, data, queue){ - if( file.file ){ - data.type = file.file; - } - - if( file.blob.toBlob ){ - // canvas - queue.inc(); - _convertFile(file, function (file, blob){ - data.name = file.name; - data.file = blob; - data.size = blob.length; - data.type = file.type; - queue.next(); - }); - } - else if( file.file ){ - // file - data.name = file.blob.name; - data.file = file.blob; - data.size = file.blob.size; - data.type = file.type; - } - else { - // additional data - if( !data.params ){ - data.params = []; - } - data.params.push(encodeURIComponent(file.name) +"="+ encodeURIComponent(file.blob)); - } - - data.start = -1; - data.end = data.file && data.file.FileAPIReadPosition || -1; - data.retry = 0; - }); - }, - - toFormData: function (fn){ - this._to(new FormData, fn, function (file, data, queue){ - if( file.blob && file.blob.toBlob ){ - queue.inc(); - _convertFile(file, function (file, blob){ - data.append(file.name, blob, file.file); - queue.next(); - }); - } - else if( file.file ){ - data.append(file.name, file.blob, file.file); - } - else { - data.append(file.name, file.blob); - } - - if( file.file ){ - data.append('_'+file.name, file.file); - } - }); - }, - - - toMultipartData: function (fn){ - this._to([], fn, function (file, data, queue, boundary){ - queue.inc(); - _convertFile(file, function (file, blob){ - data.push( - '--_' + boundary + ('\r\nContent-Disposition: form-data; name="'+ file.name +'"'+ (file.file ? '; filename="'+ encodeURIComponent(file.file) +'"' : '') - + (file.file ? '\r\nContent-Type: '+ (file.type || 'application/octet-stream') : '') - + '\r\n' - + '\r\n'+ (file.file ? blob : encodeURIComponent(blob)) - + '\r\n') - ); - queue.next(); - }, true); - }, api.expando); - } - }; - - - function _convertFile(file, fn, useBinaryString){ - var blob = file.blob, filename = file.file; - - if( filename ){ - if( !blob.toDataURL ){ - // The Blob is not an image. - api.readAsBinaryString(blob, function (evt){ - if( evt.type == 'load' ){ - fn(file, evt.result); - } - }); - return; - } - - var - mime = { 'image/jpeg': '.jpe?g', 'image/png': '.png' } - , type = mime[file.type] ? file.type : 'image/png' - , ext = mime[type] || '.png' - , quality = blob.quality || 1 - ; - - if( !filename.match(new RegExp(ext+'$', 'i')) ){ - // Does not change the current extension, but add a new one. - filename += ext.replace('?', ''); - } - - file.file = filename; - file.type = type; - - if( !useBinaryString && blob.toBlob ){ - blob.toBlob(function (blob){ - fn(file, blob); - }, type, quality); - } - else { - fn(file, api.toBinaryString(blob.toDataURL(type, quality))); - } - } - else { - fn(file, blob); - } - } - - - // @export - api.Form = Form; -})(FileAPI, window); - -/*global window, FileAPI, Uint8Array */ - -(function (window, api){ - "use strict"; - - var - noop = function (){} - , document = window.document - - , XHR = function (options){ - this.uid = api.uid(); - this.xhr = { - abort: noop - , getResponseHeader: noop - , getAllResponseHeaders: noop - }; - this.options = options; - }, - - _xhrResponsePostfix = { '': 1, XML: 1, Text: 1, Body: 1 } - ; - - - XHR.prototype = { - status: 0, - statusText: '', - constructor: XHR, - - getResponseHeader: function (name){ - return this.xhr.getResponseHeader(name); - }, - - getAllResponseHeaders: function (){ - return this.xhr.getAllResponseHeaders() || {}; - }, - - end: function (status, statusText){ - var _this = this, options = _this.options; - - _this.end = - _this.abort = noop; - _this.status = status; - - if( statusText ){ - _this.statusText = statusText; - } - - api.log('xhr.end:', status, statusText); - options.complete(status == 200 || status == 201 ? false : _this.statusText || 'unknown', _this); - - if( _this.xhr && _this.xhr.node ){ - setTimeout(function (){ - var node = _this.xhr.node; - try { node.parentNode.removeChild(node); } catch (e){} - try { delete window[_this.uid]; } catch (e){} - window[_this.uid] = _this.xhr.node = null; - }, 9); - } - }, - - abort: function (){ - this.end(0, 'abort'); - - if( this.xhr ){ - this.xhr.aborted = true; - this.xhr.abort(); - } - }, - - send: function (FormData){ - var _this = this, options = this.options; - - FormData.toData(function (data){ - if( data instanceof Error ){ - _this.end(0, data.message); - } - else{ - // Start uploading - options.upload(options, _this); - _this._send.call(_this, options, data); - } - }, options); - }, - - _send: function (options, data){ - var _this = this, xhr, uid = _this.uid, onLoadFnName = _this.uid + "Load", url = options.url; - - api.log('XHR._send:', data); - - if( !options.cache ){ - // No cache - url += (~url.indexOf('?') ? '&' : '?') + api.uid(); - } - - if( data.nodeName ){ - var jsonp = options.jsonp; - - // prepare callback in GET - url = url.replace(/([a-z]+)=(\?)/i, '$1='+uid); - - // legacy - options.upload(options, _this); - - var - onPostMessage = function (evt){ - if( ~url.indexOf(evt.origin) ){ - try { - var result = api.parseJSON(evt.data); - if( result.id == uid ){ - complete(result.status, result.statusText, result.response); - } - } catch( err ){ - complete(0, err.message); - } - } - }, - - // jsonp-callack - complete = window[uid] = function (status, statusText, response){ - _this.readyState = 4; - _this.responseText = response; - _this.end(status, statusText); - - api.event.off(window, 'message', onPostMessage); - window[uid] = xhr = transport = window[onLoadFnName] = null; - } - ; - - _this.xhr.abort = function (){ - try { - if( transport.stop ){ transport.stop(); } - else if( transport.contentWindow.stop ){ transport.contentWindow.stop(); } - else { transport.contentWindow.document.execCommand('Stop'); } - } - catch (er) {} - complete(0, "abort"); - }; - - api.event.on(window, 'message', onPostMessage); - - window[onLoadFnName] = function (){ - try { - var - win = transport.contentWindow - , doc = win.document - , result = win.result || api.parseJSON(doc.body.innerHTML) - ; - complete(result.status, result.statusText, result.response); - } catch (e){ - api.log('[transport.onload]', e); - } - }; - - xhr = document.createElement('div'); - xhr.innerHTML = '
              ' - + '' - + (jsonp && (options.url.indexOf('=?') < 0) ? '' : '') - + '' - ; - - // get form-data & transport - var - form = xhr.getElementsByTagName('form')[0] - , transport = xhr.getElementsByTagName('iframe')[0] - ; - - form.appendChild(data); - - api.log(form.parentNode.innerHTML); - - // append to DOM - document.body.appendChild(xhr); - - // keep a reference to node-transport - _this.xhr.node = xhr; - - // send - _this.readyState = 2; // loaded - try { - form.submit(); - } catch (err) { - api.log('iframe.error: ' + err); - } - form = null; - } - else { - // Clean url - url = url.replace(/([a-z]+)=(\?)&?/i, ''); - - // html5 - if (this.xhr && this.xhr.aborted) { - api.log("Error: already aborted"); - return; - } - xhr = _this.xhr = api.getXHR(); - - if (data.params) { - url += (url.indexOf('?') < 0 ? "?" : "&") + data.params.join("&"); - } - - xhr.open('POST', url, true); - - if( api.withCredentials ){ - xhr.withCredentials = "true"; - } - - if( !options.headers || !options.headers['X-Requested-With'] ){ - xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); - } - - api.each(options.headers, function (val, key){ - xhr.setRequestHeader(key, val); - }); - - - if ( options._chunked ) { - // chunked upload - if( xhr.upload ){ - xhr.upload.addEventListener('progress', api.throttle(function (/**Event*/evt){ - if (!data.retry) { - // show progress only for correct chunk uploads - options.progress({ - type: evt.type - , total: data.size - , loaded: data.start + evt.loaded - , totalSize: data.size - }, _this, options); - } - }, 100), false); - } - - xhr.onreadystatechange = function (){ - var lkb = parseInt(xhr.getResponseHeader('X-Last-Known-Byte'), 10); - - _this.status = xhr.status; - _this.statusText = xhr.statusText; - _this.readyState = xhr.readyState; - - if( xhr.readyState == 4 ){ - for( var k in _xhrResponsePostfix ){ - _this['response'+k] = xhr['response'+k]; - } - xhr.onreadystatechange = null; - - if (!xhr.status || xhr.status - 201 > 0) { - api.log("Error: " + xhr.status); - // some kind of error - // 0 - connection fail or timeout, if xhr.aborted is true, then it's not recoverable user action - // up - server error - if (((!xhr.status && !xhr.aborted) || 500 == xhr.status || 416 == xhr.status) && ++data.retry <= options.chunkUploadRetry) { - // let's try again the same chunk - // only applicable for recoverable error codes 500 && 416 - var delay = xhr.status ? 0 : api.chunkNetworkDownRetryTimeout; - - // inform about recoverable problems - options.pause(data.file, options); - - // smart restart if server reports about the last known byte - api.log("X-Last-Known-Byte: " + lkb); - if (lkb) { - data.end = lkb; - } else { - data.end = data.start - 1; - if (416 == xhr.status) { - data.end = data.end - options.chunkSize; - } - } - - setTimeout(function () { - _this._send(options, data); - }, delay); - } else { - // no mo retries - _this.end(xhr.status); - } - } else { - // success - data.retry = 0; - - if (data.end == data.size - 1) { - // finished - _this.end(xhr.status); - } else { - // next chunk - - // shift position if server reports about the last known byte - api.log("X-Last-Known-Byte: " + lkb); - if (lkb) { - data.end = lkb; - } - data.file.FileAPIReadPosition = data.end; - - setTimeout(function () { - _this._send(options, data); - }, 0); - } - } - - xhr = null; - } - }; - - data.start = data.end + 1; - data.end = Math.max(Math.min(data.start + options.chunkSize, data.size) - 1, data.start); - - // Retrieve a slice of file - var - file = data.file - , slice = (file.slice || file.mozSlice || file.webkitSlice).call(file, data.start, data.end + 1) - ; - - if( data.size && !slice.size ){ - setTimeout(function (){ - _this.end(-1); - }); - } else { - xhr.setRequestHeader("Content-Range", "bytes " + data.start + "-" + data.end + "/" + data.size); - xhr.setRequestHeader("Content-Disposition", 'attachment; filename=' + encodeURIComponent(data.name)); - xhr.setRequestHeader("Content-Type", data.type || "application/octet-stream"); - - xhr.send(slice); - } - - file = slice = null; - } else { - // single piece upload - if( xhr.upload ){ - // https://github.com/blueimp/jQuery-File-Upload/wiki/Fixing-Safari-hanging-on-very-high-speed-connections-%281Gbps%29 - xhr.upload.addEventListener('progress', api.throttle(function (/**Event*/evt){ - options.progress(evt, _this, options); - }, 100), false); - } - - xhr.onreadystatechange = function (){ - _this.status = xhr.status; - _this.statusText = xhr.statusText; - _this.readyState = xhr.readyState; - - if( xhr.readyState == 4 ){ - for( var k in _xhrResponsePostfix ){ - _this['response'+k] = xhr['response'+k]; - } - xhr.onreadystatechange = null; - - if (!xhr.status || xhr.status > 201) { - api.log("Error: " + xhr.status); - if (((!xhr.status && !xhr.aborted) || 500 == xhr.status) && (options.retry || 0) < options.uploadRetry) { - options.retry = (options.retry || 0) + 1; - var delay = api.networkDownRetryTimeout; - - // inform about recoverable problems - options.pause(options.file, options); - - setTimeout(function () { - _this._send(options, data); - }, delay); - } else { - //success - _this.end(xhr.status); - } - } else { - //success - _this.end(xhr.status); - } - - xhr = null; - } - }; - - if( api.isArray(data) ){ - // multipart - xhr.setRequestHeader('Content-Type', 'multipart/form-data; boundary=_'+api.expando); - var rawData = data.join('') +'--_'+ api.expando +'--'; - - /** @namespace xhr.sendAsBinary https://developer.mozilla.org/ru/XMLHttpRequest#Sending_binary_content */ - if( xhr.sendAsBinary ){ - xhr.sendAsBinary(rawData); - } - else { - var bytes = Array.prototype.map.call(rawData, function(c){ return c.charCodeAt(0) & 0xff; }); - xhr.send(new Uint8Array(bytes).buffer); - - } - } else { - // FormData - xhr.send(data); - } - } - } - } - }; - - - // @export - api.XHR = XHR; -})(window, FileAPI); - -/** - * @class FileAPI.Camera - * @author RubaXa - * @support Chrome 21+, FF 18+, Opera 12+ - */ - -/*global window, FileAPI, jQuery */ -/** @namespace LocalMediaStream -- https://developer.mozilla.org/en-US/docs/WebRTC/MediaStream_API#LocalMediaStream */ -(function (window, api){ - "use strict"; - - var - URL = window.URL || window.webkitURL, - - document = window.document, - navigator = window.navigator, - - getMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia, - - html5 = !!getMedia - ; - - - // Support "media" - api.support.media = html5; - - - var Camera = function (video){ - this.video = video; - }; - - - Camera.prototype = { - isActive: function (){ - return !!this._active; - }, - - - /** - * Start camera streaming - * @param {Function} callback - */ - start: function (callback){ - var - _this = this - , video = _this.video - , _successId - , _failId - , _complete = function (err){ - _this._active = !err; - clearTimeout(_failId); - clearTimeout(_successId); -// api.event.off(video, 'loadedmetadata', _complete); - callback && callback(err, _this); - } - ; - - getMedia.call(navigator, { video: true }, function (stream/**LocalMediaStream*/){ - // Success - _this.stream = stream; - -// api.event.on(video, 'loadedmetadata', function (){ -// _complete(null); -// }); - - // Set camera stream - video.src = URL.createObjectURL(stream); - - // Note: onloadedmetadata doesn't fire in Chrome when using it with getUserMedia. - // See crbug.com/110938. - _successId = setInterval(function (){ - if( _detectVideoSignal(video) ){ - _complete(null); - } - }, 1000); - - _failId = setTimeout(function (){ - _complete('timeout'); - }, 5000); - - // Go-go-go! - video.play(); - }, _complete/*error*/); - }, - - - /** - * Stop camera streaming - */ - stop: function (){ - try { - this._active = false; - this.video.pause(); - - try { - this.stream.stop(); - } catch (err) { - api.each(this.stream.getTracks(), function (track) { - track.stop(); - }); - } - - this.stream = null; - } catch( err ){ - api.log('[FileAPI.Camera] stop:', err); - } - }, - - - /** - * Create screenshot - * @return {FileAPI.Camera.Shot} - */ - shot: function (){ - return new Shot(this.video); - } - }; - - - /** - * Get camera element from container - * - * @static - * @param {HTMLElement} el - * @return {Camera} - */ - Camera.get = function (el){ - return new Camera(el.firstChild); - }; - - - /** - * Publish camera element into container - * - * @static - * @param {HTMLElement} el - * @param {Object} options - * @param {Function} [callback] - */ - Camera.publish = function (el, options, callback){ - if( typeof options == 'function' ){ - callback = options; - options = {}; - } - - // Dimensions of "camera" - options = api.extend({}, { - width: '100%' - , height: '100%' - , start: true - }, options); - - - if( el.jquery ){ - // Extract first element, from jQuery collection - el = el[0]; - } - - - var doneFn = function (err){ - if( err ){ - callback(err); - } - else { - // Get camera - var cam = Camera.get(el); - if( options.start ){ - cam.start(callback); - } - else { - callback(null, cam); - } - } - }; - - - el.style.width = _px(options.width); - el.style.height = _px(options.height); - - - if( api.html5 && html5 ){ - // Create video element - var video = document.createElement('video'); - - // Set dimensions - video.style.width = _px(options.width); - video.style.height = _px(options.height); - - // Clean container - if( window.jQuery ){ - jQuery(el).empty(); - } else { - el.innerHTML = ''; - } - - // Add "camera" to container - el.appendChild(video); - - // end - doneFn(); - } - else { - Camera.fallback(el, options, doneFn); - } - }; - - - Camera.fallback = function (el, options, callback){ - callback('not_support_camera'); - }; - - - /** - * @class FileAPI.Camera.Shot - */ - var Shot = function (video){ - var canvas = video.nodeName ? api.Image.toCanvas(video) : video; - var shot = api.Image(canvas); - shot.type = 'image/png'; - shot.width = canvas.width; - shot.height = canvas.height; - shot.size = canvas.width * canvas.height * 4; - return shot; - }; - - - /** - * Add "px" postfix, if value is a number - * - * @private - * @param {*} val - * @return {String} - */ - function _px(val){ - return val >= 0 ? val + 'px' : val; - } - - - /** - * @private - * @param {HTMLVideoElement} video - * @return {Boolean} - */ - function _detectVideoSignal(video){ - var canvas = document.createElement('canvas'), ctx, res = false; - try { - ctx = canvas.getContext('2d'); - ctx.drawImage(video, 0, 0, 1, 1); - res = ctx.getImageData(0, 0, 1, 1).data[4] != 255; - } - catch( err ){ - api.log('[FileAPI.Camera] detectVideoSignal:', err); - } - return res; - } - - - // @export - Camera.Shot = Shot; - api.Camera = Camera; -})(window, FileAPI); - -/** - * FileAPI fallback to Flash - * - * @flash-developer "Vladimir Demidov" - */ - -/*global window, ActiveXObject, FileAPI */ -(function (window, jQuery, api) { - "use strict"; - - var - document = window.document - , location = window.location - , navigator = window.navigator - , _each = api.each - ; - - - api.support.flash = (function (){ - var mime = navigator.mimeTypes, has = false; - - if( navigator.plugins && typeof navigator.plugins['Shockwave Flash'] == 'object' ){ - has = navigator.plugins['Shockwave Flash'].description && !(mime && mime['application/x-shockwave-flash'] && !mime['application/x-shockwave-flash'].enabledPlugin); - } - else { - try { - has = !!(window.ActiveXObject && new ActiveXObject('ShockwaveFlash.ShockwaveFlash')); - } - catch(er){ - api.log('Flash -- does not supported.'); - } - } - - if( has && /^file:/i.test(location) ){ - api.log('[warn] Flash does not work on `file:` protocol.'); - } - - return has; - })(); - - - api.support.flash - && (0 - || !api.html5 || !api.support.html5 - || (api.cors && !api.support.cors) - || (api.media && !api.support.media) - ) - && (function (){ - var - _attr = api.uid() - , _retry = 0 - , _files = {} - , _rhttp = /^https?:/i - - , flash = { - _fn: {}, - - - /** - * Initialization & preload flash object - */ - init: function (){ - var child = document.body && document.body.firstChild; - - if( child ){ - do { - if( child.nodeType == 1 ){ - api.log('FlashAPI.state: awaiting'); - - var dummy = document.createElement('div'); - - dummy.id = '_' + _attr; - - _css(dummy, { - top: 1 - , right: 1 - , width: 5 - , height: 5 - , position: 'absolute' - , zIndex: 2147483647+'' // set max zIndex - }); - - child.parentNode.insertBefore(dummy, child); - flash.publish(dummy, _attr); - - return; - } - } - while( child = child.nextSibling ); - } - - if( _retry < 10 ){ - setTimeout(flash.init, ++_retry*50); - } - }, - - - /** - * Publish flash-object - * - * @param {HTMLElement} el - * @param {String} id - * @param {Object} [opts] - */ - publish: function (el, id, opts){ - opts = opts || {}; - el.innerHTML = _makeFlashHTML({ - id: id - , src: _getUrl(api.flashUrl, 'r=' + api.version) -// , src: _getUrl('http://v.demidov.boom.corp.mail.ru/uploaderfileapi/FlashFileAPI.swf?1') - , wmode: opts.camera ? '' : 'transparent' - , flashvars: 'callback=' + (opts.onEvent || 'FileAPI.Flash.onEvent') - + '&flashId='+ id - + '&storeKey='+ navigator.userAgent.match(/\d/ig).join('') +'_'+ api.version - + (flash.isReady || (api.pingUrl ? '&ping='+api.pingUrl : '')) - + '&timeout='+api.flashAbortTimeout - + (opts.camera ? '&useCamera=' + _getUrl(api.flashWebcamUrl) : '') - + '&debug='+(api.debug?"1":"") - }, opts); - }, - - - ready: function (){ - api.log('FlashAPI.state: ready'); - - flash.ready = api.F; - flash.isReady = true; - flash.patch(); - flash.patchCamera && flash.patchCamera(); - api.event.on(document, 'mouseover', flash.mouseover); - api.event.on(document, 'click', function (evt){ - if( flash.mouseover(evt) ){ - evt.preventDefault - ? evt.preventDefault() - : (evt.returnValue = true) - ; - } - }); - }, - - - getEl: function (){ - return document.getElementById('_'+_attr); - }, - - - getWrapper: function (node){ - do { - if( /js-fileapi-wrapper/.test(node.className) ){ - return node; - } - } - while( (node = node.parentNode) && (node !== document.body) ); - }, - - - mouseover: function (evt){ - var target = api.event.fix(evt).target; - - if( /input/i.test(target.nodeName) && target.type == 'file' && !target.disabled ){ - var - state = target.getAttribute(_attr) - , wrapper = flash.getWrapper(target) - ; - - if( api.multiFlash ){ - // check state: - // p — published - // i — initialization - // r — ready - if( state == 'i' || state == 'r' ){ - // publish fail - return false; - } - else if( state != 'p' ){ - // set "init" state - target.setAttribute(_attr, 'i'); - - var dummy = document.createElement('div'); - - if( !wrapper ){ - api.log('[err] FlashAPI.mouseover: js-fileapi-wrapper not found'); - return; - } - - _css(dummy, { - top: 0 - , left: 0 - , width: target.offsetWidth - , height: target.offsetHeight - , zIndex: 2147483647+'' // set max zIndex - , position: 'absolute' - }); - - wrapper.appendChild(dummy); - flash.publish(dummy, api.uid()); - - // set "publish" state - target.setAttribute(_attr, 'p'); - } - - return true; - } - else if( wrapper ){ - // Use one flash element - var box = _getDimensions(wrapper); - - _css(flash.getEl(), box); - - // Set current input - flash.curInp = target; - } - } - else if( !/object|embed/i.test(target.nodeName) ){ - _css(flash.getEl(), { top: 1, left: 1, width: 5, height: 5 }); - } - }, - - onEvent: function (evt){ - var type = evt.type; - - if( type == 'ready' ){ - try { - // set "ready" state - flash.getInput(evt.flashId).setAttribute(_attr, 'r'); - } catch (e){ - } - - flash.ready(); - setTimeout(function (){ flash.mouseenter(evt); }, 50); - return true; - } - else if( type === 'ping' ){ - api.log('(flash -> js).ping:', [evt.status, evt.savedStatus], evt.error); - } - else if( type === 'log' ){ - api.log('(flash -> js).log:', evt.target); - } - else if( type in flash ){ - setTimeout(function (){ - api.log('FlashAPI.event.'+evt.type+':', evt); - flash[type](evt); - }, 1); - } - }, - - - mouseenter: function (evt){ - var node = flash.getInput(evt.flashId); - - if( node ){ - // Set multiple mode - flash.cmd(evt, 'multiple', node.getAttribute('multiple') != null); - - - // Set files filter - var accept = [], exts = {}; - - _each((node.getAttribute('accept') || '').split(/,\s*/), function (mime){ - api.accept[mime] && _each(api.accept[mime].split(' '), function (ext){ - exts[ext] = 1; - }); - }); - - _each(exts, function (i, ext){ - accept.push( ext ); - }); - - flash.cmd(evt, 'accept', accept.length ? accept.join(',')+','+accept.join(',').toUpperCase() : '*'); - } - }, - - - get: function (id){ - return document[id] || window[id] || document.embeds[id]; - }, - - - getInput: function (id){ - if( api.multiFlash ){ - try { - var node = flash.getWrapper(flash.get(id)); - if( node ){ - return node.getElementsByTagName('input')[0]; - } - } catch (e){ - api.log('[err] Can not find "input" by flashId:', id, e); - } - } else { - return flash.curInp; - } - }, - - - select: function (evt){ - var - inp = flash.getInput(evt.flashId) - , uid = api.uid(inp) - , files = evt.target.files - , event - ; - - _each(files, function (file){ - api.checkFileObj(file); - }); - - _files[uid] = files; - - if( document.createEvent ){ - event = document.createEvent('Event'); - event.files = files; - event.initEvent('change', true, true); - inp.dispatchEvent(event); - } - else if( jQuery ){ - jQuery(inp).trigger({ type: 'change', files: files }); - } - else { - event = document.createEventObject(); - event.files = files; - inp.fireEvent('onchange', event); - } - }, - - - cmd: function (id, name, data, last){ - try { - api.log('(js -> flash).'+name+':', data); - return flash.get(id.flashId || id).cmd(name, data); - } catch (err){ - api.log('(js -> flash).onError:', err.toString()); - if( !last ){ - // try again - setTimeout(function (){ flash.cmd(id, name, data, true); }, 50); - } - } - }, - - - patch: function (){ - api.flashEngine = true; - - // FileAPI - _inherit(api, { - getFiles: function (input, filter, callback){ - if( callback ){ - api.filterFiles(api.getFiles(input), filter, callback); - return null; - } - - var files = api.isArray(input) ? input : _files[api.uid(input.target || input.srcElement || input)]; - - - if( !files ){ - // Файлов нету, вызываем родительский метод - return this.parent.apply(this, arguments); - } - - - if( filter ){ - filter = api.getFilesFilter(filter); - files = api.filter(files, function (file){ return filter.test(file.name); }); - } - - return files; - }, - - - getInfo: function (file, fn){ - if( _isHtmlFile(file) ){ - this.parent.apply(this, arguments); - } - else if( file.isShot ){ - fn(null, file.info = { - width: file.width, - height: file.height - }); - } - else { - if( !file.__info ){ - var defer = file.__info = api.defer(); - - flash.cmd(file, 'getFileInfo', { - id: file.id - , callback: _wrap(function _(err, info){ - _unwrap(_); - defer.resolve(err, file.info = info); - }) - }); - } - - file.__info.then(fn); - } - } - }); - - - // FileAPI.Image - api.support.transform = true; - api.Image && _inherit(api.Image.prototype, { - get: function (fn, scaleMode){ - this.set({ scaleMode: scaleMode || 'noScale' }); // noScale, exactFit - return this.parent(fn); - }, - - _load: function (file, fn){ - api.log('FlashAPI.Image._load:', file); - - if( _isHtmlFile(file) ){ - this.parent.apply(this, arguments); - } - else { - var _this = this; - api.getInfo(file, function (err){ - fn.call(_this, err, file); - }); - } - }, - - _apply: function (file, fn){ - api.log('FlashAPI.Image._apply:', file); - - if( _isHtmlFile(file) ){ - this.parent.apply(this, arguments); - } - else { - var m = this.getMatrix(file.info), doneFn = fn; - - flash.cmd(file, 'imageTransform', { - id: file.id - , matrix: m - , callback: _wrap(function _(err, base64){ - api.log('FlashAPI.Image._apply.callback:', err); - _unwrap(_); - - if( err ){ - doneFn(err); - } - else if( !api.support.html5 && (!api.support.dataURI || base64.length > 3e4) ){ - _makeFlashImage({ - width: (m.deg % 180) ? m.dh : m.dw - , height: (m.deg % 180) ? m.dw : m.dh - , scale: m.scaleMode - }, base64, doneFn); - } - else { - if( m.filter ){ - doneFn = function (err, img){ - if( err ){ - fn(err); - } - else { - api.Image.applyFilter(img, m.filter, function (){ - fn(err, this.canvas); - }); - } - }; - } - - api.newImage('data:'+ file.type +';base64,'+ base64, doneFn); - } - }) - }); - } - }, - - toData: function (fn){ - var - file = this.file - , info = file.info - , matrix = this.getMatrix(info) - ; - api.log('FlashAPI.Image.toData'); - - if( _isHtmlFile(file) ){ - this.parent.apply(this, arguments); - } - else { - if( matrix.deg == 'auto' ){ - matrix.deg = api.Image.exifOrientation[info && info.exif && info.exif.Orientation] || 0; - } - - fn.call(this, !file.info, { - id: file.id - , flashId: file.flashId - , name: file.name - , type: file.type - , matrix: matrix - }); - } - } - }); - - - api.Image && _inherit(api.Image, { - fromDataURL: function (dataURL, size, callback){ - if( !api.support.dataURI || dataURL.length > 3e4 ){ - _makeFlashImage( - api.extend({ scale: 'exactFit' }, size) - , dataURL.replace(/^data:[^,]+,/, '') - , function (err, el){ callback(el); } - ); - } - else { - this.parent(dataURL, size, callback); - } - } - }); - - // FileAPI.Form - _inherit(api.Form.prototype, { - toData: function (fn){ - var items = this.items, i = items.length; - - for( ; i--; ){ - if( items[i].file && _isHtmlFile(items[i].blob) ){ - return this.parent.apply(this, arguments); - } - } - - api.log('FlashAPI.Form.toData'); - fn(items); - } - }); - - - // FileAPI.XHR - _inherit(api.XHR.prototype, { - _send: function (options, formData){ - if( - formData.nodeName - || formData.append && api.support.html5 - || api.isArray(formData) && (typeof formData[0] === 'string') - ){ - // HTML5, Multipart or IFrame - return this.parent.apply(this, arguments); - } - - - var - data = {} - , files = {} - , _this = this - , flashId - , fileId - ; - - _each(formData, function (item){ - if( item.file ){ - files[item.name] = item = _getFileDescr(item.blob); - fileId = item.id; - flashId = item.flashId; - } - else { - data[item.name] = item.blob; - } - }); - - if( !fileId ){ - flashId = _attr; - } - - if( !flashId ){ - api.log('[err] FlashAPI._send: flashId -- undefined'); - return this.parent.apply(this, arguments); - } - else { - api.log('FlashAPI.XHR._send: '+ flashId +' -> '+ fileId); - } - - _this.xhr = { - headers: {}, - abort: function (){ flash.cmd(flashId, 'abort', { id: fileId }); }, - getResponseHeader: function (name){ return this.headers[name]; }, - getAllResponseHeaders: function (){ return this.headers; } - }; - - var queue = api.queue(function (){ - flash.cmd(flashId, 'upload', { - url: _getUrl(options.url.replace(/([a-z]+)=(\?)&?/i, '')) - , data: data - , files: fileId ? files : null - , headers: options.headers || {} - , callback: _wrap(function upload(evt){ - var type = evt.type, result = evt.result; - - api.log('FlashAPI.upload.'+type); - - if( type == 'progress' ){ - evt.loaded = Math.min(evt.loaded, evt.total); // @todo fixme - evt.lengthComputable = true; - options.progress(evt); - } - else if( type == 'complete' ){ - _unwrap(upload); - - if( typeof result == 'string' ){ - _this.responseText = result.replace(/%22/g, "\"").replace(/%5c/g, "\\").replace(/%26/g, "&").replace(/%25/g, "%"); - } - - _this.end(evt.status || 200); - } - else if( type == 'abort' || type == 'error' ){ - _this.end(evt.status || 0, evt.message); - _unwrap(upload); - } - }) - }); - }); - - - // #2174: FileReference.load() call while FileReference.upload() or vice versa - _each(files, function (file){ - queue.inc(); - api.getInfo(file, queue.next); - }); - - queue.check(); - } - }); - } - } - ; - - - function _makeFlashHTML(opts){ - return ('' - + '' - + '' - + '' - + '' - + '' - + '' - + '' - + '' - + '').replace(/#(\w+)#/ig, function (a, name){ return opts[name]; }) - ; - } - - - function _css(el, css){ - if( el && el.style ){ - var key, val; - for( key in css ){ - val = css[key]; - if( typeof val == 'number' ){ - val += 'px'; - } - try { el.style[key] = val; } catch (e) {} - } - } - } - - - function _inherit(obj, methods){ - _each(methods, function (fn, name){ - var prev = obj[name]; - obj[name] = function (){ - this.parent = prev; - return fn.apply(this, arguments); - }; - }); - } - - function _isHtmlFile(file){ - return file && !file.flashId; - } - - function _wrap(fn){ - var id = fn.wid = api.uid(); - flash._fn[id] = fn; - return 'FileAPI.Flash._fn.'+id; - } - - - function _unwrap(fn){ - try { - flash._fn[fn.wid] = null; - delete flash._fn[fn.wid]; - } - catch(e){} - } - - - function _getUrl(url, params){ - if( !_rhttp.test(url) ){ - if( /^\.\//.test(url) || '/' != url.charAt(0) ){ - var path = location.pathname; - path = path.substr(0, path.lastIndexOf('/')); - url = (path +'/'+ url).replace('/./', '/'); - } - - if( '//' != url.substr(0, 2) ){ - url = '//' + location.host + url; - } - - if( !_rhttp.test(url) ){ - url = location.protocol + url; - } - } - - if( params ){ - url += (/\?/.test(url) ? '&' : '?') + params; - } - - return url; - } - - - function _makeFlashImage(opts, base64, fn){ - var - key - , flashId = api.uid() - , el = document.createElement('div') - , attempts = 10 - ; - - for( key in opts ){ - el.setAttribute(key, opts[key]); - el[key] = opts[key]; - } - - _css(el, opts); - - opts.width = '100%'; - opts.height = '100%'; - - el.innerHTML = _makeFlashHTML(api.extend({ - id: flashId - , src: _getUrl(api.flashImageUrl, 'r='+ api.uid()) - , wmode: 'opaque' - , flashvars: 'scale='+ opts.scale +'&callback='+_wrap(function _(){ - _unwrap(_); - if( --attempts > 0 ){ - _setImage(); - } - return true; - }) - }, opts)); - - function _setImage(){ - try { - // Get flash-object by id - var img = flash.get(flashId); - img.setImage(base64); - } catch (e){ - api.log('[err] FlashAPI.Preview.setImage -- can not set "base64":', e); - } - } - - fn(false, el); - el = null; - } - - - function _getFileDescr(file){ - return { - id: file.id - , name: file.name - , matrix: file.matrix - , flashId: file.flashId - }; - } - - - function _getDimensions(el){ - var - box = el.getBoundingClientRect() - , body = document.body - , docEl = (el && el.ownerDocument).documentElement - ; - - return { - top: box.top + (window.pageYOffset || docEl.scrollTop) - (docEl.clientTop || body.clientTop || 0) - , left: box.left + (window.pageXOffset || docEl.scrollLeft) - (docEl.clientLeft || body.clientLeft || 0) - , width: box.right - box.left - , height: box.bottom - box.top - }; - } - - // @export - api.Flash = flash; - - - // Check dataURI support - api.newImage('data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==', function (err, img){ - api.support.dataURI = !(img.width != 1 || img.height != 1); - flash.init(); - }); - })(); -})(window, window.jQuery, FileAPI); - -/** - * FileAPI fallback to Flash - * - * @flash-developer "Vladimir Demidov" - */ - -/*global window, FileAPI */ -(function (window, jQuery, api) { - "use strict"; - - var _each = api.each, - _cameraQueue = []; - - if (api.support.flash && (api.media && (!api.support.media || !api.html5))) { - (function () { - function _wrap(fn) { - var id = fn.wid = api.uid(); - api.Flash._fn[id] = fn; - return 'FileAPI.Flash._fn.' + id; - } - - - function _unwrap(fn) { - try { - api.Flash._fn[fn.wid] = null; - delete api.Flash._fn[fn.wid]; - } catch (e) { - } - } - - var flash = api.Flash; - api.extend(api.Flash, { - - patchCamera: function () { - api.Camera.fallback = function (el, options, callback) { - var camId = api.uid(); - api.log('FlashAPI.Camera.publish: ' + camId); - flash.publish(el, camId, api.extend(options, { - camera: true, - onEvent: _wrap(function _(evt) { - if (evt.type === 'camera') { - _unwrap(_); - - if (evt.error) { - api.log('FlashAPI.Camera.publish.error: ' + evt.error); - callback(evt.error); - } else { - api.log('FlashAPI.Camera.publish.success: ' + camId); - callback(null); - } - } - }) - })); - }; - // Run - _each(_cameraQueue, function (args) { - api.Camera.fallback.apply(api.Camera, args); - }); - _cameraQueue = []; - - - // FileAPI.Camera:proto - api.extend(api.Camera.prototype, { - _id: function () { - return this.video.id; - }, - - start: function (callback) { - var _this = this; - flash.cmd(this._id(), 'camera.on', { - callback: _wrap(function _(evt) { - _unwrap(_); - - if (evt.error) { - api.log('FlashAPI.camera.on.error: ' + evt.error); - callback(evt.error, _this); - } else { - api.log('FlashAPI.camera.on.success: ' + _this._id()); - _this._active = true; - callback(null, _this); - } - }) - }); - }, - - stop: function () { - this._active = false; - flash.cmd(this._id(), 'camera.off'); - }, - - shot: function () { - api.log('FlashAPI.Camera.shot:', this._id()); - - var shot = api.Flash.cmd(this._id(), 'shot', {}); - shot.type = 'image/png'; - shot.flashId = this._id(); - shot.isShot = true; - - return new api.Camera.Shot(shot); - } - }); - } - }); - - api.Camera.fallback = function () { - _cameraQueue.push(arguments); - }; - - }()); - } -}(window, window.jQuery, FileAPI)); +/*! FileAPI 2.0.19 - BSD | git://github.com/mailru/FileAPI.git + * FileAPI — a set of javascript tools for working with files. Multiupload, drag'n'drop and chunked file upload. Images: crop, resize and auto orientation by EXIF. + */ + +/* + * JavaScript Canvas to Blob 2.0.5 + * https://github.com/blueimp/JavaScript-Canvas-to-Blob + * + * Copyright 2012, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + * + * Based on stackoverflow user Stoive's code snippet: + * http://stackoverflow.com/q/4998908 + */ + +/*jslint nomen: true, regexp: true */ +/*global window, atob, Blob, ArrayBuffer, Uint8Array */ + +(function (window) { + 'use strict'; + var CanvasPrototype = window.HTMLCanvasElement && + window.HTMLCanvasElement.prototype, + hasBlobConstructor = window.Blob && (function () { + try { + return Boolean(new Blob()); + } catch (e) { + return false; + } + }()), + hasArrayBufferViewSupport = hasBlobConstructor && window.Uint8Array && + (function () { + try { + return new Blob([new Uint8Array(100)]).size === 100; + } catch (e) { + return false; + } + }()), + BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || + window.MozBlobBuilder || window.MSBlobBuilder, + dataURLtoBlob = (hasBlobConstructor || BlobBuilder) && window.atob && + window.ArrayBuffer && window.Uint8Array && function (dataURI) { + var byteString, + arrayBuffer, + intArray, + i, + mimeString, + bb; + if (dataURI.split(',')[0].indexOf('base64') >= 0) { + // Convert base64 to raw binary data held in a string: + byteString = atob(dataURI.split(',')[1]); + } else { + // Convert base64/URLEncoded data component to raw binary data: + byteString = decodeURIComponent(dataURI.split(',')[1]); + } + // Write the bytes of the string to an ArrayBuffer: + arrayBuffer = new ArrayBuffer(byteString.length); + intArray = new Uint8Array(arrayBuffer); + for (i = 0; i < byteString.length; i += 1) { + intArray[i] = byteString.charCodeAt(i); + } + // Separate out the mime component: + mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]; + // Write the ArrayBuffer (or ArrayBufferView) to a blob: + if (hasBlobConstructor) { + return new Blob( + [hasArrayBufferViewSupport ? intArray : arrayBuffer], + {type: mimeString} + ); + } + bb = new BlobBuilder(); + bb.append(arrayBuffer); + return bb.getBlob(mimeString); + }; + if (window.HTMLCanvasElement && !CanvasPrototype.toBlob) { + if (CanvasPrototype.mozGetAsFile) { + CanvasPrototype.toBlob = function (callback, type, quality) { + if (quality && CanvasPrototype.toDataURL && dataURLtoBlob) { + callback(dataURLtoBlob(this.toDataURL(type, quality))); + } else { + callback(this.mozGetAsFile('blob', type)); + } + }; + } else if (CanvasPrototype.toDataURL && dataURLtoBlob) { + CanvasPrototype.toBlob = function (callback, type, quality) { + callback(dataURLtoBlob(this.toDataURL(type, quality))); + }; + } + } + window.dataURLtoBlob = dataURLtoBlob; +})(window); + +/*jslint evil: true */ +/*global window, URL, webkitURL, ActiveXObject */ + +(function (window, undef){ + 'use strict'; + + var + gid = 1, + noop = function (){}, + + document = window.document, + doctype = document.doctype || {}, + userAgent = window.navigator.userAgent, + safari = /safari\//i.test(userAgent) && !/chrome\//i.test(userAgent), + iemobile = /iemobile\//i.test(userAgent), + + // https://github.com/blueimp/JavaScript-Load-Image/blob/master/load-image.js#L48 + apiURL = (window.createObjectURL && window) || (window.URL && URL.revokeObjectURL && URL) || (window.webkitURL && webkitURL), + + Blob = window.Blob, + File = window.File, + FileReader = window.FileReader, + FormData = window.FormData, + + + XMLHttpRequest = window.XMLHttpRequest, + jQuery = window.jQuery, + + html5 = !!(File && (FileReader && (window.Uint8Array || FormData || XMLHttpRequest.prototype.sendAsBinary))) + && !(safari && /windows/i.test(userAgent) && !iemobile), // BugFix: https://github.com/mailru/FileAPI/issues/25 + + cors = html5 && ('withCredentials' in (new XMLHttpRequest)), + + chunked = html5 && !!Blob && !!(Blob.prototype.webkitSlice || Blob.prototype.mozSlice || Blob.prototype.slice), + + normalize = ('' + ''.normalize).indexOf('[native code]') > 0, + + // https://github.com/blueimp/JavaScript-Canvas-to-Blob + dataURLtoBlob = window.dataURLtoBlob, + + + _rimg = /img/i, + _rcanvas = /canvas/i, + _rimgcanvas = /img|canvas/i, + _rinput = /input/i, + _rdata = /^data:[^,]+,/, + + _toString = {}.toString, + _supportConsoleLog, + _supportConsoleLogApply, + + + Math = window.Math, + + _SIZE_CONST = function (pow){ + pow = new window.Number(Math.pow(1024, pow)); + pow.from = function (sz){ return Math.round(sz * this); }; + return pow; + }, + + _elEvents = {}, // element event listeners + _infoReader = [], // list of file info processors + + _readerEvents = 'abort progress error load loadend', + _xhrPropsExport = 'status statusText readyState response responseXML responseText responseBody'.split(' '), + + currentTarget = 'currentTarget', // for minimize + preventDefault = 'preventDefault', // and this too + + _isArray = function (ar) { + return ar && ('length' in ar); + }, + + /** + * Iterate over a object or array + */ + _each = function (obj, fn, ctx){ + if( obj ){ + if( _isArray(obj) ){ + for( var i = 0, n = obj.length; i < n; i++ ){ + if( i in obj ){ + fn.call(ctx, obj[i], i, obj); + } + } + } + else { + for( var key in obj ){ + if( obj.hasOwnProperty(key) ){ + fn.call(ctx, obj[key], key, obj); + } + } + } + } + }, + + /** + * Merge the contents of two or more objects together into the first object + */ + _extend = function (dst){ + var args = arguments, i = 1, _ext = function (val, key){ dst[key] = val; }; + for( ; i < args.length; i++ ){ + _each(args[i], _ext); + } + return dst; + }, + + /** + * Add event listener + */ + _on = function (el, type, fn){ + if( el ){ + var uid = api.uid(el); + + if( !_elEvents[uid] ){ + _elEvents[uid] = {}; + } + + var isFileReader = (FileReader && el) && (el instanceof FileReader); + _each(type.split(/\s+/), function (type){ + if( jQuery && !isFileReader){ + jQuery.event.add(el, type, fn); + } else { + if( !_elEvents[uid][type] ){ + _elEvents[uid][type] = []; + } + + _elEvents[uid][type].push(fn); + + if( el.addEventListener ){ el.addEventListener(type, fn, false); } + else if( el.attachEvent ){ el.attachEvent('on'+type, fn); } + else { el['on'+type] = fn; } + } + }); + } + }, + + + /** + * Remove event listener + */ + _off = function (el, type, fn){ + if( el ){ + var uid = api.uid(el), events = _elEvents[uid] || {}; + + var isFileReader = (FileReader && el) && (el instanceof FileReader); + _each(type.split(/\s+/), function (type){ + if( jQuery && !isFileReader){ + jQuery.event.remove(el, type, fn); + } + else { + var fns = events[type] || [], i = fns.length; + + while( i-- ){ + if( fns[i] === fn ){ + fns.splice(i, 1); + break; + } + } + + if( el.addEventListener ){ el.removeEventListener(type, fn, false); } + else if( el.detachEvent ){ el.detachEvent('on'+type, fn); } + else { el['on'+type] = null; } + } + }); + } + }, + + + _one = function(el, type, fn){ + _on(el, type, function _(evt){ + _off(el, type, _); + fn(evt); + }); + }, + + + _fixEvent = function (evt){ + if( !evt.target ){ evt.target = window.event && window.event.srcElement || document; } + if( evt.target.nodeType === 3 ){ evt.target = evt.target.parentNode; } + return evt; + }, + + + _supportInputAttr = function (attr){ + var input = document.createElement('input'); + input.setAttribute('type', "file"); + return attr in input; + }, + + + /** + * FileAPI (core object) + */ + api = { + version: '2.0.19', + + cors: false, + html5: true, + media: false, + formData: true, + multiPassResize: true, + + debug: false, + pingUrl: false, + multiFlash: false, + flashAbortTimeout: 0, + withCredentials: true, + + staticPath: './dist/', + + flashUrl: 0, // @default: './FileAPI.flash.swf' + flashImageUrl: 0, // @default: './FileAPI.flash.image.swf' + + postNameConcat: function (name, idx){ + return name + (idx != null ? '['+ idx +']' : ''); + }, + + ext2mime: { + jpg: 'image/jpeg' + , tif: 'image/tiff' + , txt: 'text/plain' + }, + + // Fallback for flash + accept: { + 'image/*': 'art bm bmp dwg dxf cbr cbz fif fpx gif ico iefs jfif jpe jpeg jpg jps jut mcf nap nif pbm pcx pgm pict pm png pnm qif qtif ras rast rf rp svf tga tif tiff xbm xbm xpm xwd' + , 'audio/*': 'm4a flac aac rm mpa wav wma ogg mp3 mp2 m3u mod amf dmf dsm far gdm imf it m15 med okt s3m stm sfx ult uni xm sid ac3 dts cue aif aiff wpl ape mac mpc mpp shn wv nsf spc gym adplug adx dsp adp ymf ast afc hps xs' + , 'video/*': 'm4v 3gp nsv ts ty strm rm rmvb m3u ifo mov qt divx xvid bivx vob nrg img iso pva wmv asf asx ogm m2v avi bin dat dvr-ms mpg mpeg mp4 mkv avc vp3 svq3 nuv viv dv fli flv wpl' + }, + + uploadRetry : 0, + networkDownRetryTimeout : 5000, // milliseconds, don't flood when network is down + + chunkSize : 0, + chunkUploadRetry : 0, + chunkNetworkDownRetryTimeout : 2000, // milliseconds, don't flood when network is down + + KB: _SIZE_CONST(1), + MB: _SIZE_CONST(2), + GB: _SIZE_CONST(3), + TB: _SIZE_CONST(4), + + EMPTY_PNG: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=', + + expando: 'fileapi' + (new Date).getTime(), + + uid: function (obj){ + return obj + ? (obj[api.expando] = obj[api.expando] || api.uid()) + : (++gid, api.expando + gid) + ; + }, + + log: function (){ + if( api.debug && _supportConsoleLog ){ + if( _supportConsoleLogApply ){ + console.log.apply(console, arguments); + } + else { + console.log([].join.call(arguments, ' ')); + } + } + }, + + /** + * Create new image + * + * @param {String} [src] + * @param {Function} [fn] 1. error -- boolean, 2. img -- Image element + * @returns {HTMLElement} + */ + newImage: function (src, fn){ + var img = document.createElement('img'); + if( fn ){ + api.event.one(img, 'error load', function (evt){ + fn(evt.type == 'error', img); + img = null; + }); + } + img.src = src; + return img; + }, + + /** + * Get XHR + * @returns {XMLHttpRequest} + */ + getXHR: function (){ + var xhr; + + if( XMLHttpRequest ){ + xhr = new XMLHttpRequest; + } + else if( window.ActiveXObject ){ + try { + xhr = new ActiveXObject('MSXML2.XMLHttp.3.0'); + } catch (e) { + xhr = new ActiveXObject('Microsoft.XMLHTTP'); + } + } + + return xhr; + }, + + isArray: _isArray, + + support: { + dnd: cors && ('ondrop' in document.createElement('div')), + cors: cors, + html5: html5, + chunked: chunked, + dataURI: true, + accept: _supportInputAttr('accept'), + multiple: _supportInputAttr('multiple') + }, + + event: { + on: _on + , off: _off + , one: _one + , fix: _fixEvent + }, + + + throttle: function(fn, delay) { + var id, args; + + return function _throttle(){ + args = arguments; + + if( !id ){ + fn.apply(window, args); + id = setTimeout(function (){ + id = 0; + fn.apply(window, args); + }, delay); + } + }; + }, + + + F: function (){}, + + + parseJSON: function (str){ + var json; + if( window.JSON && JSON.parse ){ + json = JSON.parse(str); + } + else { + json = (new Function('return ('+str.replace(/([\r\n])/g, '\\$1')+');'))(); + } + return json; + }, + + + trim: function (str){ + str = String(str); + return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, ''); + }, + + /** + * Simple Defer + * @return {Object} + */ + defer: function (){ + var + list = [] + , result + , error + , defer = { + resolve: function (err, res){ + defer.resolve = noop; + error = err || false; + result = res; + + while( res = list.shift() ){ + res(error, result); + } + }, + + then: function (fn){ + if( error !== undef ){ + fn(error, result); + } else { + list.push(fn); + } + } + }; + + return defer; + }, + + queue: function (fn){ + var + _idx = 0 + , _length = 0 + , _fail = false + , _end = false + , queue = { + inc: function (){ + _length++; + }, + + next: function (){ + _idx++; + setTimeout(queue.check, 0); + }, + + check: function (){ + (_idx >= _length) && !_fail && queue.end(); + }, + + isFail: function (){ + return _fail; + }, + + fail: function (){ + !_fail && fn(_fail = true); + }, + + end: function (){ + if( !_end ){ + _end = true; + fn(); + } + } + } + ; + return queue; + }, + + + /** + * For each object + * + * @param {Object|Array} obj + * @param {Function} fn + * @param {*} [ctx] + */ + each: _each, + + + /** + * Async for + * @param {Array} array + * @param {Function} callback + */ + afor: function (array, callback){ + var i = 0, n = array.length; + + if( _isArray(array) && n-- ){ + (function _next(){ + callback(n != i && _next, array[i], i++); + })(); + } + else { + callback(false); + } + }, + + + /** + * Merge the contents of two or more objects together into the first object + * + * @param {Object} dst + * @return {Object} + */ + extend: _extend, + + + /** + * Is file? + * @param {File} file + * @return {Boolean} + */ + isFile: function (file){ + return _toString.call(file) === '[object File]'; + }, + + + /** + * Is blob? + * @param {Blob} blob + * @returns {Boolean} + */ + isBlob: function (blob) { + return this.isFile(blob) || (_toString.call(blob) === '[object Blob]'); + }, + + + /** + * Is canvas element + * + * @param {HTMLElement} el + * @return {Boolean} + */ + isCanvas: function (el){ + return el && _rcanvas.test(el.nodeName); + }, + + + getFilesFilter: function (filter){ + filter = typeof filter == 'string' ? filter : (filter.getAttribute && filter.getAttribute('accept') || ''); + return filter ? new RegExp('('+ filter.replace(/\./g, '\\.').replace(/,/g, '|') +')$', 'i') : /./; + }, + + + + /** + * Read as DataURL + * + * @param {File|Element} file + * @param {Function} fn + */ + readAsDataURL: function (file, fn){ + if( api.isCanvas(file) ){ + _emit(file, fn, 'load', api.toDataURL(file)); + } + else { + _readAs(file, fn, 'DataURL'); + } + }, + + + /** + * Read as Binary string + * + * @param {File} file + * @param {Function} fn + */ + readAsBinaryString: function (file, fn){ + if( _hasSupportReadAs('BinaryString') ){ + _readAs(file, fn, 'BinaryString'); + } else { + // Hello IE10! + _readAs(file, function (evt){ + if( evt.type == 'load' ){ + try { + // dataURL -> binaryString + evt.result = api.toBinaryString(evt.result); + } catch (e){ + evt.type = 'error'; + evt.message = e.toString(); + } + } + fn(evt); + }, 'DataURL'); + } + }, + + + /** + * Read as ArrayBuffer + * + * @param {File} file + * @param {Function} fn + */ + readAsArrayBuffer: function(file, fn){ + _readAs(file, fn, 'ArrayBuffer'); + }, + + + /** + * Read as text + * + * @param {File} file + * @param {String} encoding + * @param {Function} [fn] + */ + readAsText: function(file, encoding, fn){ + if( !fn ){ + fn = encoding; + encoding = 'utf-8'; + } + + _readAs(file, fn, 'Text', encoding); + }, + + + /** + * Convert image or canvas to DataURL + * + * @param {Element} el Image or Canvas element + * @param {String} [type] mime-type + * @return {String} + */ + toDataURL: function (el, type){ + if( typeof el == 'string' ){ + return el; + } + else if( el.toDataURL ){ + return el.toDataURL(type || 'image/png'); + } + }, + + + /** + * Canvert string, image or canvas to binary string + * + * @param {String|Element} val + * @return {String} + */ + toBinaryString: function (val){ + return window.atob(api.toDataURL(val).replace(_rdata, '')); + }, + + + /** + * Read file or DataURL as ImageElement + * + * @param {File|String} file + * @param {Function} fn + * @param {Boolean} [progress] + */ + readAsImage: function (file, fn, progress){ + if( api.isBlob(file) ){ + if( apiURL ){ + /** @namespace apiURL.createObjectURL */ + var data = apiURL.createObjectURL(file); + if( data === undef ){ + _emit(file, fn, 'error'); + } + else { + api.readAsImage(data, fn, progress); + } + } + else { + api.readAsDataURL(file, function (evt){ + if( evt.type == 'load' ){ + api.readAsImage(evt.result, fn, progress); + } + else if( progress || evt.type == 'error' ){ + _emit(file, fn, evt, null, { loaded: evt.loaded, total: evt.total }); + } + }); + } + } + else if( api.isCanvas(file) ){ + _emit(file, fn, 'load', file); + } + else if( _rimg.test(file.nodeName) ){ + if( file.complete ){ + _emit(file, fn, 'load', file); + } + else { + var events = 'error abort load'; + _one(file, events, function _fn(evt){ + if( evt.type == 'load' && apiURL ){ + /** @namespace apiURL.revokeObjectURL */ + apiURL.revokeObjectURL(file.src); + } + + _off(file, events, _fn); + _emit(file, fn, evt, file); + }); + } + } + else if( file.iframe ){ + _emit(file, fn, { type: 'error' }); + } + else { + // Created image + var img = api.newImage(file.dataURL || file); + api.readAsImage(img, fn, progress); + } + }, + + + /** + * Make file by name + * + * @param {String} name + * @return {Array} + */ + checkFileObj: function (name){ + var file = {}, accept = api.accept; + + if( typeof name == 'object' ){ + file = name; + } + else { + file.name = (name + '').split(/\\|\//g).pop(); + } + + if( file.type == null ){ + file.type = file.name.split('.').pop(); + } + + _each(accept, function (ext, type){ + ext = new RegExp(ext.replace(/\s/g, '|'), 'i'); + if( ext.test(file.type) || api.ext2mime[file.type] ){ + file.type = api.ext2mime[file.type] || (type.split('/')[0] +'/'+ file.type); + } + }); + + return file; + }, + + + /** + * Get drop files + * + * @param {Event} evt + * @param {Function} callback + */ + getDropFiles: function (evt, callback){ + var + files = [] + , all = [] + , items + , dataTransfer = _getDataTransfer(evt) + , transFiles = dataTransfer.files + , transItems = dataTransfer.items + , entrySupport = _isArray(transItems) && transItems[0] && _getAsEntry(transItems[0]) + , queue = api.queue(function (){ callback(files, all); }) + ; + + if( entrySupport ){ + if( normalize && transFiles ){ + var + i = transFiles.length + , file + , entry + ; + + items = new Array(i); + while( i-- ){ + file = transFiles[i]; + + try { + entry = _getAsEntry(transItems[i]); + } + catch( err ){ + api.log('[err] getDropFiles: ', err); + entry = null; + } + + if( _isEntry(entry) ){ + // OSX filesystems use Unicode Normalization Form D (NFD), + // and entry.file(…) can't read the files with the same names + if( entry.isDirectory || (entry.isFile && file.name == file.name.normalize('NFC')) ){ + items[i] = entry; + } + else { + items[i] = file; + } + } + else { + items[i] = file; + } + } + } + else { + items = transItems; + } + } + else { + items = transFiles; + } + + _each(items || [], function (item){ + queue.inc(); + + try { + if( entrySupport && _isEntry(item) ){ + _readEntryAsFiles(item, function (err, entryFiles, allEntries){ + if( err ){ + api.log('[err] getDropFiles:', err); + } else { + files.push.apply(files, entryFiles); + } + all.push.apply(all, allEntries); + + queue.next(); + }); + } + else { + _isRegularFile(item, function (yes, err){ + if( yes ){ + files.push(item); + } + else { + item.error = err; + } + all.push(item); + + queue.next(); + }); + } + } + catch( err ){ + queue.next(); + api.log('[err] getDropFiles: ', err); + } + }); + + queue.check(); + }, + + + /** + * Get file list + * + * @param {HTMLInputElement|Event} input + * @param {String|Function} [filter] + * @param {Function} [callback] + * @return {Array|Null} + */ + getFiles: function (input, filter, callback){ + var files = []; + + if( callback ){ + api.filterFiles(api.getFiles(input), filter, callback); + return null; + } + + if( input.jquery ){ + // jQuery object + input.each(function (){ + files = files.concat(api.getFiles(this)); + }); + input = files; + files = []; + } + + if( typeof filter == 'string' ){ + filter = api.getFilesFilter(filter); + } + + if( input.originalEvent ){ + // jQuery event + input = _fixEvent(input.originalEvent); + } + else if( input.srcElement ){ + // IE Event + input = _fixEvent(input); + } + + + if( input.dataTransfer ){ + // Drag'n'Drop + input = input.dataTransfer; + } + else if( input.target ){ + // Event + input = input.target; + } + + if( input.files ){ + // Input[type="file"] + files = input.files; + + if( !html5 ){ + // Partial support for file api + files[0].blob = input; + files[0].iframe = true; + } + } + else if( !html5 && isInputFile(input) ){ + if( api.trim(input.value) ){ + files = [api.checkFileObj(input.value)]; + files[0].blob = input; + files[0].iframe = true; + } + } + else if( _isArray(input) ){ + files = input; + } + + return api.filter(files, function (file){ return !filter || filter.test(file.name); }); + }, + + + /** + * Get total file size + * @param {Array} files + * @return {Number} + */ + getTotalSize: function (files){ + var size = 0, i = files && files.length; + while( i-- ){ + size += files[i].size; + } + return size; + }, + + + /** + * Get image information + * + * @param {File} file + * @param {Function} fn + */ + getInfo: function (file, fn){ + var info = {}, readers = _infoReader.concat(); + + if( api.isBlob(file) ){ + (function _next(){ + var reader = readers.shift(); + if( reader ){ + if( reader.test(file.type) ){ + reader(file, function (err, res){ + if( err ){ + fn(err); + } + else { + _extend(info, res); + _next(); + } + }); + } + else { + _next(); + } + } + else { + fn(false, info); + } + })(); + } + else { + fn('not_support_info', info); + } + }, + + + /** + * Add information reader + * + * @param {RegExp} mime + * @param {Function} fn + */ + addInfoReader: function (mime, fn){ + fn.test = function (type){ return mime.test(type); }; + _infoReader.push(fn); + }, + + + /** + * Filter of array + * + * @param {Array} input + * @param {Function} fn + * @return {Array} + */ + filter: function (input, fn){ + var result = [], i = 0, n = input.length, val; + + for( ; i < n; i++ ){ + if( i in input ){ + val = input[i]; + if( fn.call(val, val, i, input) ){ + result.push(val); + } + } + } + + return result; + }, + + + /** + * Filter files + * + * @param {Array} files + * @param {Function} eachFn + * @param {Function} resultFn + */ + filterFiles: function (files, eachFn, resultFn){ + if( files.length ){ + // HTML5 or Flash + var queue = files.concat(), file, result = [], deleted = []; + + (function _next(){ + if( queue.length ){ + file = queue.shift(); + api.getInfo(file, function (err, info){ + (eachFn(file, err ? false : info) ? result : deleted).push(file); + _next(); + }); + } + else { + resultFn(result, deleted); + } + })(); + } + else { + resultFn([], files); + } + }, + + + upload: function (options){ + options = _extend({ + jsonp: 'callback' + , prepare: api.F + , beforeupload: api.F + , upload: api.F + , fileupload: api.F + , fileprogress: api.F + , filecomplete: api.F + , progress: api.F + , complete: api.F + , pause: api.F + , imageOriginal: true + , chunkSize: api.chunkSize + , chunkUploadRetry: api.chunkUploadRetry + , uploadRetry: api.uploadRetry + }, options); + + + if( options.imageAutoOrientation && !options.imageTransform ){ + options.imageTransform = { rotate: 'auto' }; + } + + + var + proxyXHR = new api.XHR(options) + , dataArray = this._getFilesDataArray(options.files) + , _this = this + , _total = 0 + , _loaded = 0 + , _nextFile + , _complete = false + ; + + + // calc total size + _each(dataArray, function (data){ + _total += data.size; + }); + + // Array of files + proxyXHR.files = []; + _each(dataArray, function (data){ + proxyXHR.files.push(data.file); + }); + + // Set upload status props + proxyXHR.total = _total; + proxyXHR.loaded = 0; + proxyXHR.filesLeft = dataArray.length; + + // emit "beforeupload" event + options.beforeupload(proxyXHR, options); + + // Upload by file + _nextFile = function (){ + var + data = dataArray.shift() + , _file = data && data.file + , _fileLoaded = false + , _fileOptions = _simpleClone(options) + ; + + proxyXHR.filesLeft = dataArray.length; + + if( _file && _file.name === api.expando ){ + _file = null; + api.log('[warn] FileAPI.upload() — called without files'); + } + + if( ( proxyXHR.statusText != 'abort' || proxyXHR.current ) && data ){ + // Mark active job + _complete = false; + + // Set current upload file + proxyXHR.currentFile = _file; + + // Prepare file options + if (_file && options.prepare(_file, _fileOptions) === false) { + _nextFile.call(_this); + return; + } + _fileOptions.file = _file; + + _this._getFormData(_fileOptions, data, function (form){ + if( !_loaded ){ + // emit "upload" event + options.upload(proxyXHR, options); + } + + var xhr = new api.XHR(_extend({}, _fileOptions, { + + upload: _file ? function (){ + // emit "fileupload" event + options.fileupload(_file, xhr, _fileOptions); + } : noop, + + progress: _file ? function (evt){ + if( !_fileLoaded ){ + // For ignore the double calls. + _fileLoaded = (evt.loaded === evt.total); + + // emit "fileprogress" event + options.fileprogress({ + type: 'progress' + , total: data.total = evt.total + , loaded: data.loaded = evt.loaded + }, _file, xhr, _fileOptions); + + // emit "progress" event + options.progress({ + type: 'progress' + , total: _total + , loaded: proxyXHR.loaded = (_loaded + data.size * (evt.loaded/evt.total)) || 0 + }, _file, xhr, _fileOptions); + } + } : noop, + + complete: function (err){ + _each(_xhrPropsExport, function (name){ + proxyXHR[name] = xhr[name]; + }); + + if( _file ){ + data.total = (data.total || data.size); + data.loaded = data.total; + + if( !err ) { + // emulate 100% "progress" + this.progress(data); + + // fixed throttle event + _fileLoaded = true; + + // bytes loaded + _loaded += data.size; // data.size != data.total, it's desirable fix this + proxyXHR.loaded = _loaded; + } + + // emit "filecomplete" event + options.filecomplete(err, xhr, _file, _fileOptions); + } + + // upload next file + setTimeout(function () {_nextFile.call(_this);}, 0); + } + })); // xhr + + + // ... + proxyXHR.abort = function (current){ + if (!current) { dataArray.length = 0; } + this.current = current; + xhr.abort(); + }; + + // Start upload + xhr.send(form); + }); + } + else { + var successful = proxyXHR.status == 200 || proxyXHR.status == 201 || proxyXHR.status == 204; + options.complete(successful ? false : (proxyXHR.statusText || 'error'), proxyXHR, options); + // Mark done state + _complete = true; + } + }; + + + // Next tick + setTimeout(_nextFile, 0); + + + // Append more files to the existing request + // first - add them to the queue head/tail + proxyXHR.append = function (files, first) { + files = api._getFilesDataArray([].concat(files)); + + _each(files, function (data) { + _total += data.size; + proxyXHR.files.push(data.file); + if (first) { + dataArray.unshift(data); + } else { + dataArray.push(data); + } + }); + + proxyXHR.statusText = ""; + + if( _complete ){ + _nextFile.call(_this); + } + }; + + + // Removes file from queue by file reference and returns it + proxyXHR.remove = function (file) { + var i = dataArray.length, _file; + while( i-- ){ + if( dataArray[i].file == file ){ + _file = dataArray.splice(i, 1); + _total -= _file.size; + } + } + return _file; + }; + + return proxyXHR; + }, + + + _getFilesDataArray: function (data){ + var files = [], oFiles = {}; + + if( isInputFile(data) ){ + var tmp = api.getFiles(data); + oFiles[data.name || 'file'] = data.getAttribute('multiple') !== null ? tmp : tmp[0]; + } + else if( _isArray(data) && isInputFile(data[0]) ){ + _each(data, function (input){ + oFiles[input.name || 'file'] = api.getFiles(input); + }); + } + else { + oFiles = data; + } + + _each(oFiles, function add(file, name){ + if( _isArray(file) ){ + _each(file, function (file){ + add(file, name); + }); + } + else if( file && (file.name || file.image) ){ + files.push({ + name: name + , file: file + , size: file.size + , total: file.size + , loaded: 0 + }); + } + }); + + if( !files.length ){ + // Create fake `file` object + files.push({ file: { name: api.expando } }); + } + + return files; + }, + + + _getFormData: function (options, data, fn){ + var + file = data.file + , name = data.name + , filename = file.name + , filetype = file.type + , trans = api.support.transform && options.imageTransform + , Form = new api.Form + , queue = api.queue(function (){ fn(Form); }) + , isOrignTrans = trans && _isOriginTransform(trans) + , postNameConcat = api.postNameConcat + ; + + // Append data + _each(options.data, function add(val, name){ + if( typeof val == 'object' ){ + _each(val, function (v, i){ + add(v, postNameConcat(name, i)); + }); + } + else { + Form.append(name, val); + } + }); + + (function _addFile(file/**Object*/){ + if( file.image ){ // This is a FileAPI.Image + queue.inc(); + + file.toData(function (err, image){ + // @todo: требует рефакторинга и обработки ошибки + if (file.file) { + image.type = file.file.type; + image.quality = file.matrix.quality; + filename = file.file && file.file.name; + } + + filename = filename || (new Date).getTime()+'.png'; + + _addFile(image); + queue.next(); + }); + } + else if( api.Image && trans && (/^image/.test(file.type) || _rimgcanvas.test(file.nodeName)) ){ + queue.inc(); + + if( isOrignTrans ){ + // Convert to array for transform function + trans = [trans]; + } + + api.Image.transform(file, trans, options.imageAutoOrientation, function (err, images){ + if( isOrignTrans && !err ){ + if( !dataURLtoBlob && !api.flashEngine ){ + // Canvas.toBlob or Flash not supported, use multipart + Form.multipart = true; + } + + Form.append(name, images[0], filename, trans[0].type || filetype); + } + else { + var addOrigin = 0; + + if( !err ){ + _each(images, function (image, idx){ + if( !dataURLtoBlob && !api.flashEngine ){ + Form.multipart = true; + } + + if( !trans[idx].postName ){ + addOrigin = 1; + } + + Form.append(trans[idx].postName || postNameConcat(name, idx), image, filename, trans[idx].type || filetype); + }); + } + + if( err || options.imageOriginal ){ + Form.append(postNameConcat(name, (addOrigin ? 'original' : null)), file, filename, filetype); + } + } + + queue.next(); + }); + } + else if( filename !== api.expando ){ + Form.append(name, file, filename); + } + })(file); + + queue.check(); + }, + + + reset: function (inp, notRemove){ + var parent, clone; + + if( jQuery ){ + clone = jQuery(inp).clone(true).insertBefore(inp).val('')[0]; + if( !notRemove ){ + jQuery(inp).remove(); + } + } else { + parent = inp.parentNode; + clone = parent.insertBefore(inp.cloneNode(true), inp); + clone.value = ''; + + if( !notRemove ){ + parent.removeChild(inp); + } + + _each(_elEvents[api.uid(inp)], function (fns, type){ + _each(fns, function (fn){ + _off(inp, type, fn); + _on(clone, type, fn); + }); + }); + } + + return clone; + }, + + + /** + * Load remote file + * + * @param {String} url + * @param {Function} fn + * @return {XMLHttpRequest} + */ + load: function (url, fn){ + var xhr = api.getXHR(); + if( xhr ){ + xhr.open('GET', url, true); + + if( xhr.overrideMimeType ){ + xhr.overrideMimeType('text/plain; charset=x-user-defined'); + } + + _on(xhr, 'progress', function (/**Event*/evt){ + /** @namespace evt.lengthComputable */ + if( evt.lengthComputable ){ + fn({ type: evt.type, loaded: evt.loaded, total: evt.total }, xhr); + } + }); + + xhr.onreadystatechange = function(){ + if( xhr.readyState == 4 ){ + xhr.onreadystatechange = null; + if( xhr.status == 200 ){ + url = url.split('/'); + /** @namespace xhr.responseBody */ + var file = { + name: url[url.length-1] + , size: xhr.getResponseHeader('Content-Length') + , type: xhr.getResponseHeader('Content-Type') + }; + file.dataURL = 'data:'+file.type+';base64,' + api.encode64(xhr.responseBody || xhr.responseText); + fn({ type: 'load', result: file }, xhr); + } + else { + fn({ type: 'error' }, xhr); + } + } + }; + xhr.send(null); + } else { + fn({ type: 'error' }); + } + + return xhr; + }, + + encode64: function (str){ + var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=', outStr = '', i = 0; + + if( typeof str !== 'string' ){ + str = String(str); + } + + while( i < str.length ){ + //all three "& 0xff" added below are there to fix a known bug + //with bytes returned by xhr.responseText + var + byte1 = str.charCodeAt(i++) & 0xff + , byte2 = str.charCodeAt(i++) & 0xff + , byte3 = str.charCodeAt(i++) & 0xff + , enc1 = byte1 >> 2 + , enc2 = ((byte1 & 3) << 4) | (byte2 >> 4) + , enc3, enc4 + ; + + if( isNaN(byte2) ){ + enc3 = enc4 = 64; + } else { + enc3 = ((byte2 & 15) << 2) | (byte3 >> 6); + enc4 = isNaN(byte3) ? 64 : byte3 & 63; + } + + outStr += b64.charAt(enc1) + b64.charAt(enc2) + b64.charAt(enc3) + b64.charAt(enc4); + } + + return outStr; + } + + } // api + ; + + + function _emit(target, fn, name, res, ext){ + var evt = { + type: name.type || name + , target: target + , result: res + }; + _extend(evt, ext); + fn(evt); + } + + + function _hasSupportReadAs(method){ + return FileReader && !!FileReader.prototype['readAs' + method]; + } + + + function _readAs(file, fn, method, encoding){ + if( api.isBlob(file) && _hasSupportReadAs(method) ){ + var Reader = new FileReader; + + // Add event listener + _on(Reader, _readerEvents, function _fn(evt){ + var type = evt.type; + if( type == 'progress' ){ + _emit(file, fn, evt, evt.target.result, { loaded: evt.loaded, total: evt.total }); + } + else if( type == 'loadend' ){ + _off(Reader, _readerEvents, _fn); + Reader = null; + } + else { + _emit(file, fn, evt, evt.target.result); + } + }); + + + try { + // ReadAs ... + if( encoding ){ + Reader['readAs' + method](file, encoding); + } + else { + Reader['readAs' + method](file); + } + } + catch (err){ + _emit(file, fn, 'error', undef, { error: err.toString() }); + } + } + else { + _emit(file, fn, 'error', undef, { error: 'filreader_not_support_' + method }); + } + } + + + function _isRegularFile(file, callback){ + // http://stackoverflow.com/questions/8856628/detecting-folders-directories-in-javascript-filelist-objects + if( !file.type && (safari || ((file.size % 4096) === 0 && (file.size <= 102400))) ){ + if( FileReader ){ + try { + var reader = new FileReader(); + + _one(reader, _readerEvents, function (evt){ + var isFile = evt.type != 'error'; + if( isFile ){ + if ( reader.readyState == null || reader.readyState === reader.LOADING ) { + reader.abort(); + } + callback(isFile); + } + else { + callback(false, reader.error); + } + }); + + reader.readAsDataURL(file); + } catch( err ){ + callback(false, err); + } + } + else { + callback(null, new Error('FileReader is not supported')); + } + } + else { + callback(true); + } + } + + + function _isEntry(item){ + return item && (item.isFile || item.isDirectory); + } + + + function _getAsEntry(item){ + var entry; + if( item.getAsEntry ){ entry = item.getAsEntry(); } + else if( item.webkitGetAsEntry ){ entry = item.webkitGetAsEntry(); } + return entry; + } + + + function _readEntryAsFiles(entry, callback){ + if( !entry ){ + // error + var err = new Error('invalid entry'); + entry = new Object(entry); + entry.error = err; + callback(err.message, [], [entry]); + } + else if( entry.isFile ){ + // Read as file + entry.file(function (file){ + // success + file.fullPath = entry.fullPath; + callback(false, [file], [file]); + }, function (err){ + // error + entry.error = err; + callback('FileError.code: ' + err.code, [], [entry]); + }); + } + else if( entry.isDirectory ){ + var + reader = entry.createReader() + , firstAttempt = true + , files = [] + , all = [entry] + ; + + var onerror = function (err){ + // error + entry.error = err; + callback('DirectoryError.code: ' + err.code, files, all); + }; + var ondone = function ondone(entries){ + if( firstAttempt ){ + firstAttempt = false; + if( !entries.length ){ + entry.error = new Error('directory is empty'); + } + } + + // success + if( entries.length ){ + api.afor(entries, function (next, entry){ + _readEntryAsFiles(entry, function (err, entryFiles, allEntries){ + if( !err ){ + files = files.concat(entryFiles); + } + all = all.concat(allEntries); + + if( next ){ + next(); + } + else { + reader.readEntries(ondone, onerror); + } + }); + }); + } + else { + callback(false, files, all); + } + }; + + reader.readEntries(ondone, onerror); + } + else { + _readEntryAsFiles(_getAsEntry(entry), callback); + } + } + + + function _simpleClone(obj){ + var copy = {}; + _each(obj, function (val, key){ + if( val && (typeof val === 'object') && (val.nodeType === void 0) ){ + val = _extend({}, val); + } + copy[key] = val; + }); + return copy; + } + + + function isInputFile(el){ + return _rinput.test(el && el.tagName); + } + + + function _getDataTransfer(evt){ + return (evt.originalEvent || evt || '').dataTransfer || {}; + } + + + function _isOriginTransform(trans){ + var key; + for( key in trans ){ + if( trans.hasOwnProperty(key) ){ + if( !(trans[key] instanceof Object || key === 'overlay' || key === 'filter') ){ + return true; + } + } + } + return false; + } + + + // Add default image info reader + api.addInfoReader(/^image/, function (file/**File*/, callback/**Function*/){ + if( !file.__dimensions ){ + var defer = file.__dimensions = api.defer(); + + api.readAsImage(file, function (evt){ + var img = evt.target; + defer.resolve(evt.type == 'load' ? false : 'error', { + width: img.width + , height: img.height + }); + img.src = api.EMPTY_PNG; + img = null; + }); + } + + file.__dimensions.then(callback); + }); + + + /** + * Drag'n'Drop special event + * + * @param {HTMLElement} el + * @param {Function} onHover + * @param {Function} onDrop + */ + api.event.dnd = function (el, onHover, onDrop){ + var _id, _type; + + if( !onDrop ){ + onDrop = onHover; + onHover = api.F; + } + + if( FileReader ){ + // Hover + _on(el, 'dragenter dragleave dragover', onHover.ff = onHover.ff || function (evt){ + var + types = _getDataTransfer(evt).types + , i = types && types.length + , debounceTrigger = false + ; + + while( i-- ){ + if( ~types[i].indexOf('File') ){ + evt[preventDefault](); + + if( _type !== evt.type ){ + _type = evt.type; // Store current type of event + + if( _type != 'dragleave' ){ + onHover.call(evt[currentTarget], true, evt); + } + + debounceTrigger = true; + } + + break; // exit from "while" + } + } + + if( debounceTrigger ){ + clearTimeout(_id); + _id = setTimeout(function (){ + onHover.call(evt[currentTarget], _type != 'dragleave', evt); + }, 50); + } + }); + + + // Drop + _on(el, 'drop', onDrop.ff = onDrop.ff || function (evt){ + evt[preventDefault](); + + _type = 0; + onHover.call(evt[currentTarget], false, evt); + + api.getDropFiles(evt, function (files, all){ + onDrop.call(evt[currentTarget], files, all, evt); + }); + }); + } + else { + api.log("Drag'n'Drop -- not supported"); + } + }; + + + /** + * Remove drag'n'drop + * @param {HTMLElement} el + * @param {Function} onHover + * @param {Function} onDrop + */ + api.event.dnd.off = function (el, onHover, onDrop){ + _off(el, 'dragenter dragleave dragover', onHover.ff); + _off(el, 'drop', onDrop.ff); + }; + + + // Support jQuery + if( jQuery && !jQuery.fn.dnd ){ + jQuery.fn.dnd = function (onHover, onDrop){ + return this.each(function (){ + api.event.dnd(this, onHover, onDrop); + }); + }; + + jQuery.fn.offdnd = function (onHover, onDrop){ + return this.each(function (){ + api.event.dnd.off(this, onHover, onDrop); + }); + }; + } + + // @export + window.FileAPI = _extend(api, window.FileAPI); + + + // Debug info + api.log('FileAPI: ' + api.version); + api.log('protocol: ' + window.location.protocol); + api.log('doctype: [' + doctype.name + '] ' + doctype.publicId + ' ' + doctype.systemId); + + + // @detect 'x-ua-compatible' + _each(document.getElementsByTagName('meta'), function (meta){ + if( /x-ua-compatible/i.test(meta.getAttribute('http-equiv')) ){ + api.log('meta.http-equiv: ' + meta.getAttribute('content')); + } + }); + + + // Configuration + try { + _supportConsoleLog = !!console.log; + _supportConsoleLogApply = !!console.log.apply; + } + catch (err) {} + + if( !api.flashUrl ){ api.flashUrl = api.staticPath + 'FileAPI.flash.swf'; } + if( !api.flashImageUrl ){ api.flashImageUrl = api.staticPath + 'FileAPI.flash.image.swf'; } + if( !api.flashWebcamUrl ){ api.flashWebcamUrl = api.staticPath + 'FileAPI.flash.camera.swf'; } +})(window, void 0); + +/*global window, FileAPI, document */ + +(function (api, document, undef) { + 'use strict'; + + var + min = Math.min, + round = Math.round, + getCanvas = function () { return document.createElement('canvas'); }, + support = false, + exifOrientation = { + 8: 270 + , 3: 180 + , 6: 90 + , 7: 270 + , 4: 180 + , 5: 90 + } + ; + + try { + support = getCanvas().toDataURL('image/png').indexOf('data:image/png') > -1; + } + catch (e){} + + + function Image(file){ + if( file instanceof Image ){ + var img = new Image(file.file); + api.extend(img.matrix, file.matrix); + return img; + } + else if( !(this instanceof Image) ){ + return new Image(file); + } + + this.file = file; + this.size = file.size || 100; + + this.matrix = { + sx: 0, + sy: 0, + sw: 0, + sh: 0, + dx: 0, + dy: 0, + dw: 0, + dh: 0, + resize: 0, // min, max OR preview + deg: 0, + quality: 1, // jpeg quality + filter: 0 + }; + } + + + Image.prototype = { + image: true, + constructor: Image, + + set: function (attrs){ + api.extend(this.matrix, attrs); + return this; + }, + + crop: function (x, y, w, h){ + if( w === undef ){ + w = x; + h = y; + x = y = 0; + } + return this.set({ sx: x, sy: y, sw: w, sh: h || w }); + }, + + resize: function (w, h, strategy){ + if( /min|max|height|width/.test(h) ){ + strategy = h; + h = w; + } + + return this.set({ dw: w, dh: h || w, resize: strategy }); + }, + + preview: function (w, h){ + return this.resize(w, h || w, 'preview'); + }, + + rotate: function (deg){ + return this.set({ deg: deg }); + }, + + filter: function (filter){ + return this.set({ filter: filter }); + }, + + overlay: function (images){ + return this.set({ overlay: images }); + }, + + clone: function (){ + return new Image(this); + }, + + _load: function (image, fn){ + var self = this; + + if( /img|video/i.test(image.nodeName) ){ + fn.call(self, null, image); + } + else { + api.readAsImage(image, function (evt){ + fn.call(self, evt.type != 'load', evt.result); + }); + } + }, + + _apply: function (image, fn){ + var + canvas = getCanvas() + , m = this.getMatrix(image) + , ctx = canvas.getContext('2d') + , width = image.videoWidth || image.width + , height = image.videoHeight || image.height + , deg = m.deg + , dw = m.dw + , dh = m.dh + , w = width + , h = height + , filter = m.filter + , copy // canvas copy + , buffer = image + , overlay = m.overlay + , queue = api.queue(function (){ image.src = api.EMPTY_PNG; fn(false, canvas); }) + , renderImageToCanvas = api.renderImageToCanvas + ; + + // Normalize angle + deg = deg - Math.floor(deg/360)*360; + + // For `renderImageToCanvas` + image._type = this.file.type; + + while(m.multipass && min(w/dw, h/dh) > 2 ){ + w = (w/2 + 0.5)|0; + h = (h/2 + 0.5)|0; + + copy = getCanvas(); + copy.width = w; + copy.height = h; + + if( buffer !== image ){ + renderImageToCanvas(copy, buffer, 0, 0, buffer.width, buffer.height, 0, 0, w, h); + buffer = copy; + } + else { + buffer = copy; + renderImageToCanvas(buffer, image, m.sx, m.sy, m.sw, m.sh, 0, 0, w, h); + m.sx = m.sy = m.sw = m.sh = 0; + } + } + + + canvas.width = (deg % 180) ? dh : dw; + canvas.height = (deg % 180) ? dw : dh; + + canvas.type = m.type; + canvas.quality = m.quality; + + ctx.rotate(deg * Math.PI / 180); + renderImageToCanvas(ctx.canvas, buffer + , m.sx, m.sy + , m.sw || buffer.width + , m.sh || buffer.height + , (deg == 180 || deg == 270 ? -dw : 0) + , (deg == 90 || deg == 180 ? -dh : 0) + , dw, dh + ); + dw = canvas.width; + dh = canvas.height; + + // Apply overlay + overlay && api.each([].concat(overlay), function (over){ + queue.inc(); + // preload + var img = new window.Image, fn = function (){ + var + x = over.x|0 + , y = over.y|0 + , w = over.w || img.width + , h = over.h || img.height + , rel = over.rel + ; + + // center | right | left + x = (rel == 1 || rel == 4 || rel == 7) ? (dw - w + x)/2 : (rel == 2 || rel == 5 || rel == 8 ? dw - (w + x) : x); + + // center | bottom | top + y = (rel == 3 || rel == 4 || rel == 5) ? (dh - h + y)/2 : (rel >= 6 ? dh - (h + y) : y); + + api.event.off(img, 'error load abort', fn); + + try { + ctx.globalAlpha = over.opacity || 1; + ctx.drawImage(img, x, y, w, h); + } + catch (er){} + + queue.next(); + }; + + api.event.on(img, 'error load abort', fn); + img.src = over.src; + + if( img.complete ){ + fn(); + } + }); + + if( filter ){ + queue.inc(); + Image.applyFilter(canvas, filter, queue.next); + } + + queue.check(); + }, + + getMatrix: function (image){ + var + m = api.extend({}, this.matrix) + , sw = m.sw = m.sw || image.videoWidth || image.naturalWidth || image.width + , sh = m.sh = m.sh || image.videoHeight || image.naturalHeight || image.height + , dw = m.dw = m.dw || sw + , dh = m.dh = m.dh || sh + , sf = sw/sh, df = dw/dh + , strategy = m.resize + ; + + if( strategy == 'preview' ){ + if( dw != sw || dh != sh ){ + // Make preview + var w, h; + + if( df >= sf ){ + w = sw; + h = w / df; + } else { + h = sh; + w = h * df; + } + + if( w != sw || h != sh ){ + m.sx = ~~((sw - w)/2); + m.sy = ~~((sh - h)/2); + sw = w; + sh = h; + } + } + } + else if( strategy == 'height' ){ + dw = dh * sf; + } + else if( strategy == 'width' ){ + dh = dw / sf; + } + else if( strategy ){ + if( !(sw > dw || sh > dh) ){ + dw = sw; + dh = sh; + } + else if( strategy == 'min' ){ + dw = round(sf < df ? min(sw, dw) : dh*sf); + dh = round(sf < df ? dw/sf : min(sh, dh)); + } + else { + dw = round(sf >= df ? min(sw, dw) : dh*sf); + dh = round(sf >= df ? dw/sf : min(sh, dh)); + } + } + + m.sw = sw; + m.sh = sh; + m.dw = dw; + m.dh = dh; + m.multipass = api.multiPassResize; + return m; + }, + + _trans: function (fn){ + this._load(this.file, function (err, image){ + if( err ){ + fn(err); + } + else { + try { + this._apply(image, fn); + } catch (err){ + api.log('[err] FileAPI.Image.fn._apply:', err); + fn(err); + } + } + }); + }, + + + get: function (fn){ + if( api.support.transform ){ + var _this = this, matrix = _this.matrix; + + if( matrix.deg == 'auto' ){ + api.getInfo(_this.file, function (err, info){ + // rotate by exif orientation + matrix.deg = exifOrientation[info && info.exif && info.exif.Orientation] || 0; + _this._trans(fn); + }); + } + else { + _this._trans(fn); + } + } + else { + fn('not_support_transform'); + } + + return this; + }, + + + toData: function (fn){ + return this.get(fn); + } + + }; + + + Image.exifOrientation = exifOrientation; + + + Image.transform = function (file, transform, autoOrientation, fn){ + function _transform(err, img){ + // img -- info object + var + images = {} + , queue = api.queue(function (err){ + fn(err, images); + }) + ; + + if( !err ){ + api.each(transform, function (params, name){ + if( !queue.isFail() ){ + var ImgTrans = new Image(img.nodeType ? img : file), isFn = typeof params == 'function'; + + if( isFn ){ + params(img, ImgTrans); + } + else if( params.width ){ + ImgTrans[params.preview ? 'preview' : 'resize'](params.width, params.height, params.strategy); + } + else { + if( params.maxWidth && (img.width > params.maxWidth || img.height > params.maxHeight) ){ + ImgTrans.resize(params.maxWidth, params.maxHeight, 'max'); + } + } + + if( params.crop ){ + var crop = params.crop; + ImgTrans.crop(crop.x|0, crop.y|0, crop.w || crop.width, crop.h || crop.height); + } + + if( params.rotate === undef && autoOrientation ){ + params.rotate = 'auto'; + } + + ImgTrans.set({ type: ImgTrans.matrix.type || params.type || file.type || 'image/png' }); + + if( !isFn ){ + ImgTrans.set({ + deg: params.rotate + , overlay: params.overlay + , filter: params.filter + , quality: params.quality || 1 + }); + } + + queue.inc(); + ImgTrans.toData(function (err, image){ + if( err ){ + queue.fail(); + } + else { + images[name] = image; + queue.next(); + } + }); + } + }); + } + else { + queue.fail(); + } + } + + + // @todo: Оло-ло, нужно рефакторить это место + if( file.width ){ + _transform(false, file); + } else { + api.getInfo(file, _transform); + } + }; + + + // @const + api.each(['TOP', 'CENTER', 'BOTTOM'], function (x, i){ + api.each(['LEFT', 'CENTER', 'RIGHT'], function (y, j){ + Image[x+'_'+y] = i*3 + j; + Image[y+'_'+x] = i*3 + j; + }); + }); + + + /** + * Trabsform element to canvas + * + * @param {Image|HTMLVideoElement} el + * @returns {Canvas} + */ + Image.toCanvas = function(el){ + var canvas = document.createElement('canvas'); + canvas.width = el.videoWidth || el.width; + canvas.height = el.videoHeight || el.height; + canvas.getContext('2d').drawImage(el, 0, 0); + return canvas; + }; + + + /** + * Create image from DataURL + * @param {String} dataURL + * @param {Object} size + * @param {Function} callback + */ + Image.fromDataURL = function (dataURL, size, callback){ + var img = api.newImage(dataURL); + api.extend(img, size); + callback(img); + }; + + + /** + * Apply filter (caman.js) + * + * @param {Canvas|Image} canvas + * @param {String|Function} filter + * @param {Function} doneFn + */ + Image.applyFilter = function (canvas, filter, doneFn){ + if( typeof filter == 'function' ){ + filter(canvas, doneFn); + } + else if( window.Caman ){ + // http://camanjs.com/guides/ + window.Caman(canvas.tagName == 'IMG' ? Image.toCanvas(canvas) : canvas, function (){ + if( typeof filter == 'string' ){ + this[filter](); + } + else { + api.each(filter, function (val, method){ + this[method](val); + }, this); + } + this.render(doneFn); + }); + } + }; + + + /** + * For load-image-ios.js + */ + api.renderImageToCanvas = function (canvas, img, sx, sy, sw, sh, dx, dy, dw, dh){ + try { + return canvas.getContext('2d').drawImage(img, sx, sy, sw, sh, dx, dy, dw, dh); + } catch (ex) { + api.log('renderImageToCanvas failed'); + throw ex; + } + }; + + + // @export + api.support.canvas = api.support.transform = support; + api.Image = Image; +})(FileAPI, document); + +/* + * JavaScript Load Image iOS scaling fixes 1.0.3 + * https://github.com/blueimp/JavaScript-Load-Image + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * iOS image scaling fixes based on + * https://github.com/stomita/ios-imagefile-megapixel + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/*jslint nomen: true, bitwise: true */ +/*global FileAPI, window, document */ + +(function (factory) { + 'use strict'; + factory(FileAPI); +}(function (loadImage) { + 'use strict'; + + // Only apply fixes on the iOS platform: + if (!window.navigator || !window.navigator.platform || + !(/iP(hone|od|ad)/).test(window.navigator.platform)) { + return; + } + + var originalRenderMethod = loadImage.renderImageToCanvas; + + // Detects subsampling in JPEG images: + loadImage.detectSubsampling = function (img) { + var canvas, + context; + if (img.width * img.height > 1024 * 1024) { // only consider mexapixel images + canvas = document.createElement('canvas'); + canvas.width = canvas.height = 1; + context = canvas.getContext('2d'); + context.drawImage(img, -img.width + 1, 0); + // subsampled image becomes half smaller in rendering size. + // check alpha channel value to confirm image is covering edge pixel or not. + // if alpha value is 0 image is not covering, hence subsampled. + return context.getImageData(0, 0, 1, 1).data[3] === 0; + } + return false; + }; + + // Detects vertical squash in JPEG images: + loadImage.detectVerticalSquash = function (img, subsampled) { + var naturalHeight = img.naturalHeight || img.height, + canvas = document.createElement('canvas'), + context = canvas.getContext('2d'), + data, + sy, + ey, + py, + alpha; + if (subsampled) { + naturalHeight /= 2; + } + canvas.width = 1; + canvas.height = naturalHeight; + context.drawImage(img, 0, 0); + data = context.getImageData(0, 0, 1, naturalHeight).data; + // search image edge pixel position in case it is squashed vertically: + sy = 0; + ey = naturalHeight; + py = naturalHeight; + while (py > sy) { + alpha = data[(py - 1) * 4 + 3]; + if (alpha === 0) { + ey = py; + } else { + sy = py; + } + py = (ey + sy) >> 1; + } + return (py / naturalHeight) || 1; + }; + + // Renders image to canvas while working around iOS image scaling bugs: + // https://github.com/blueimp/JavaScript-Load-Image/issues/13 + loadImage.renderImageToCanvas = function ( + canvas, + img, + sourceX, + sourceY, + sourceWidth, + sourceHeight, + destX, + destY, + destWidth, + destHeight + ) { + if (img._type === 'image/jpeg') { + var context = canvas.getContext('2d'), + tmpCanvas = document.createElement('canvas'), + tileSize = 1024, + tmpContext = tmpCanvas.getContext('2d'), + subsampled, + vertSquashRatio, + tileX, + tileY; + tmpCanvas.width = tileSize; + tmpCanvas.height = tileSize; + context.save(); + subsampled = loadImage.detectSubsampling(img); + if (subsampled) { + sourceX /= 2; + sourceY /= 2; + sourceWidth /= 2; + sourceHeight /= 2; + } + vertSquashRatio = loadImage.detectVerticalSquash(img, subsampled); + if (subsampled || vertSquashRatio !== 1) { + sourceY *= vertSquashRatio; + destWidth = Math.ceil(tileSize * destWidth / sourceWidth); + destHeight = Math.ceil( + tileSize * destHeight / sourceHeight / vertSquashRatio + ); + destY = 0; + tileY = 0; + while (tileY < sourceHeight) { + destX = 0; + tileX = 0; + while (tileX < sourceWidth) { + tmpContext.clearRect(0, 0, tileSize, tileSize); + tmpContext.drawImage( + img, + sourceX, + sourceY, + sourceWidth, + sourceHeight, + -tileX, + -tileY, + sourceWidth, + sourceHeight + ); + context.drawImage( + tmpCanvas, + 0, + 0, + tileSize, + tileSize, + destX, + destY, + destWidth, + destHeight + ); + tileX += tileSize; + destX += destWidth; + } + tileY += tileSize; + destY += destHeight; + } + context.restore(); + return canvas; + } + } + return originalRenderMethod( + canvas, + img, + sourceX, + sourceY, + sourceWidth, + sourceHeight, + destX, + destY, + destWidth, + destHeight + ); + }; + +})); + +/*global window, FileAPI */ + +(function (api, window){ + "use strict"; + + var + document = window.document + , FormData = window.FormData + , Form = function (){ this.items = []; } + , encodeURIComponent = window.encodeURIComponent + ; + + + Form.prototype = { + + append: function (name, blob, file, type){ + this.items.push({ + name: name + , blob: blob && blob.blob || (blob == void 0 ? '' : blob) + , file: blob && (file || blob.name) + , type: blob && (type || blob.type) + }); + }, + + each: function (fn){ + var i = 0, n = this.items.length; + for( ; i < n; i++ ){ + fn.call(this, this.items[i]); + } + }, + + toData: function (fn, options){ + // allow chunked transfer if we have only one file to send + // flag is used below and in XHR._send + options._chunked = api.support.chunked && options.chunkSize > 0 && api.filter(this.items, function (item){ return item.file; }).length == 1; + + if( !api.support.html5 ){ + api.log('FileAPI.Form.toHtmlData'); + this.toHtmlData(fn); + } + else if( !api.formData || this.multipart || !FormData ){ + api.log('FileAPI.Form.toMultipartData'); + this.toMultipartData(fn); + } + else if( options._chunked ){ + api.log('FileAPI.Form.toPlainData'); + this.toPlainData(fn); + } + else { + api.log('FileAPI.Form.toFormData'); + this.toFormData(fn); + } + }, + + _to: function (data, complete, next, arg){ + var queue = api.queue(function (){ + complete(data); + }); + + this.each(function (file){ + try{ + next(file, data, queue, arg); + } + catch( err ){ + api.log('FileAPI.Form._to: ' + err.message); + complete(err); + } + }); + + queue.check(); + }, + + + toHtmlData: function (fn){ + this._to(document.createDocumentFragment(), fn, function (file, data/**DocumentFragment*/){ + var blob = file.blob, hidden; + + if( file.file ){ + api.reset(blob, true); + // set new name + blob.name = file.name; + blob.disabled = false; + data.appendChild(blob); + } + else { + hidden = document.createElement('input'); + hidden.name = file.name; + hidden.type = 'hidden'; + hidden.value = blob; + data.appendChild(hidden); + } + }); + }, + + toPlainData: function (fn){ + this._to({}, fn, function (file, data, queue){ + if( file.file ){ + data.type = file.file; + } + + if( file.blob.toBlob ){ + // canvas + queue.inc(); + _convertFile(file, function (file, blob){ + data.name = file.name; + data.file = blob; + data.size = blob.length; + data.type = file.type; + queue.next(); + }); + } + else if( file.file ){ + // file + data.name = file.blob.name; + data.file = file.blob; + data.size = file.blob.size; + data.type = file.type; + } + else { + // additional data + if( !data.params ){ + data.params = []; + } + data.params.push(encodeURIComponent(file.name) +"="+ encodeURIComponent(file.blob)); + } + + data.start = -1; + data.end = data.file && data.file.FileAPIReadPosition || -1; + data.retry = 0; + }); + }, + + toFormData: function (fn){ + this._to(new FormData, fn, function (file, data, queue){ + if( file.blob && file.blob.toBlob ){ + queue.inc(); + _convertFile(file, function (file, blob){ + data.append(file.name, blob, file.file); + queue.next(); + }); + } + else if( file.file ){ + data.append(file.name, file.blob, file.file); + } + else { + data.append(file.name, file.blob); + } + + if( file.file ){ + data.append('_'+file.name, file.file); + } + }); + }, + + + toMultipartData: function (fn){ + this._to([], fn, function (file, data, queue, boundary){ + queue.inc(); + _convertFile(file, function (file, blob){ + data.push( + '--_' + boundary + ('\r\nContent-Disposition: form-data; name="'+ file.name +'"'+ (file.file ? '; filename="'+ encodeURIComponent(file.file) +'"' : '') + + (file.file ? '\r\nContent-Type: '+ (file.type || 'application/octet-stream') : '') + + '\r\n' + + '\r\n'+ (file.file ? blob : encodeURIComponent(blob)) + + '\r\n') + ); + queue.next(); + }, true); + }, api.expando); + } + }; + + + function _convertFile(file, fn, useBinaryString){ + var blob = file.blob, filename = file.file; + + if( filename ){ + if( !blob.toDataURL ){ + // The Blob is not an image. + api.readAsBinaryString(blob, function (evt){ + if( evt.type == 'load' ){ + fn(file, evt.result); + } + }); + return; + } + + var + mime = { 'image/jpeg': '.jpe?g', 'image/png': '.png' } + , type = mime[file.type] ? file.type : 'image/png' + , ext = mime[type] || '.png' + , quality = blob.quality || 1 + ; + + if( !filename.match(new RegExp(ext+'$', 'i')) ){ + // Does not change the current extension, but add a new one. + filename += ext.replace('?', ''); + } + + file.file = filename; + file.type = type; + + if( !useBinaryString && blob.toBlob ){ + blob.toBlob(function (blob){ + fn(file, blob); + }, type, quality); + } + else { + fn(file, api.toBinaryString(blob.toDataURL(type, quality))); + } + } + else { + fn(file, blob); + } + } + + + // @export + api.Form = Form; +})(FileAPI, window); + +/*global window, FileAPI, Uint8Array */ + +(function (window, api){ + "use strict"; + + var + noop = function (){} + , document = window.document + + , XHR = function (options){ + this.uid = api.uid(); + this.xhr = { + abort: noop + , getResponseHeader: noop + , getAllResponseHeaders: noop + }; + this.options = options; + }, + + _xhrResponsePostfix = { '': 1, XML: 1, Text: 1, Body: 1 } + ; + + + XHR.prototype = { + status: 0, + statusText: '', + constructor: XHR, + + getResponseHeader: function (name){ + return this.xhr.getResponseHeader(name); + }, + + getAllResponseHeaders: function (){ + return this.xhr.getAllResponseHeaders() || {}; + }, + + end: function (status, statusText){ + var _this = this, options = _this.options; + + _this.end = + _this.abort = noop; + _this.status = status; + + if( statusText ){ + _this.statusText = statusText; + } + + api.log('xhr.end:', status, statusText); + options.complete(status == 200 || status == 201 ? false : _this.statusText || 'unknown', _this); + + if( _this.xhr && _this.xhr.node ){ + setTimeout(function (){ + var node = _this.xhr.node; + try { node.parentNode.removeChild(node); } catch (e){} + try { delete window[_this.uid]; } catch (e){} + window[_this.uid] = _this.xhr.node = null; + }, 9); + } + }, + + abort: function (){ + this.end(0, 'abort'); + + if( this.xhr ){ + this.xhr.aborted = true; + this.xhr.abort(); + } + }, + + send: function (FormData){ + var _this = this, options = this.options; + + FormData.toData(function (data){ + if( data instanceof Error ){ + _this.end(0, data.message); + } + else{ + // Start uploading + options.upload(options, _this); + _this._send.call(_this, options, data); + } + }, options); + }, + + _send: function (options, data){ + var _this = this, xhr, uid = _this.uid, onLoadFnName = _this.uid + "Load", url = options.url; + + api.log('XHR._send:', data); + + if( !options.cache ){ + // No cache + url += (~url.indexOf('?') ? '&' : '?') + api.uid(); + } + + if( data.nodeName ){ + var jsonp = options.jsonp; + + // prepare callback in GET + url = url.replace(/([a-z]+)=(\?)/i, '$1='+uid); + + // legacy + options.upload(options, _this); + + var + onPostMessage = function (evt){ + if( ~url.indexOf(evt.origin) ){ + try { + var result = api.parseJSON(evt.data); + if( result.id == uid ){ + complete(result.status, result.statusText, result.response); + } + } catch( err ){ + complete(0, err.message); + } + } + }, + + // jsonp-callack + complete = window[uid] = function (status, statusText, response){ + _this.readyState = 4; + _this.responseText = response; + _this.end(status, statusText); + + api.event.off(window, 'message', onPostMessage); + window[uid] = xhr = transport = window[onLoadFnName] = null; + } + ; + + _this.xhr.abort = function (){ + try { + if( transport.stop ){ transport.stop(); } + else if( transport.contentWindow.stop ){ transport.contentWindow.stop(); } + else { transport.contentWindow.document.execCommand('Stop'); } + } + catch (er) {} + complete(0, "abort"); + }; + + api.event.on(window, 'message', onPostMessage); + + window[onLoadFnName] = function (){ + try { + var + win = transport.contentWindow + , doc = win.document + , result = win.result || api.parseJSON(doc.body.innerHTML) + ; + complete(result.status, result.statusText, result.response); + } catch (e){ + api.log('[transport.onload]', e); + } + }; + + xhr = document.createElement('div'); + xhr.innerHTML = '
              ' + + '' + + (jsonp && (options.url.indexOf('=?') < 0) ? '' : '') + + '' + ; + + // get form-data & transport + var + form = xhr.getElementsByTagName('form')[0] + , transport = xhr.getElementsByTagName('iframe')[0] + ; + + form.appendChild(data); + + api.log(form.parentNode.innerHTML); + + // append to DOM + document.body.appendChild(xhr); + + // keep a reference to node-transport + _this.xhr.node = xhr; + + // send + _this.readyState = 2; // loaded + try { + form.submit(); + } catch (err) { + api.log('iframe.error: ' + err); + } + form = null; + } + else { + // Clean url + url = url.replace(/([a-z]+)=(\?)&?/i, ''); + + // html5 + if (this.xhr && this.xhr.aborted) { + api.log("Error: already aborted"); + return; + } + xhr = _this.xhr = api.getXHR(); + + if (data.params) { + url += (url.indexOf('?') < 0 ? "?" : "&") + data.params.join("&"); + } + + xhr.open('POST', url, true); + + if( api.withCredentials ){ + xhr.withCredentials = "true"; + } + + if( !options.headers || !options.headers['X-Requested-With'] ){ + xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); + } + + api.each(options.headers, function (val, key){ + xhr.setRequestHeader(key, val); + }); + + + if ( options._chunked ) { + // chunked upload + if( xhr.upload ){ + xhr.upload.addEventListener('progress', api.throttle(function (/**Event*/evt){ + if (!data.retry) { + // show progress only for correct chunk uploads + options.progress({ + type: evt.type + , total: data.size + , loaded: data.start + evt.loaded + , totalSize: data.size + }, _this, options); + } + }, 100), false); + } + + xhr.onreadystatechange = function (){ + var lkb = parseInt(xhr.getResponseHeader('X-Last-Known-Byte'), 10); + + _this.status = xhr.status; + _this.statusText = xhr.statusText; + _this.readyState = xhr.readyState; + + if( xhr.readyState == 4 ){ + for( var k in _xhrResponsePostfix ){ + _this['response'+k] = xhr['response'+k]; + } + xhr.onreadystatechange = null; + + if (!xhr.status || xhr.status - 201 > 0) { + api.log("Error: " + xhr.status); + // some kind of error + // 0 - connection fail or timeout, if xhr.aborted is true, then it's not recoverable user action + // up - server error + if (((!xhr.status && !xhr.aborted) || 500 == xhr.status || 416 == xhr.status) && ++data.retry <= options.chunkUploadRetry) { + // let's try again the same chunk + // only applicable for recoverable error codes 500 && 416 + var delay = xhr.status ? 0 : api.chunkNetworkDownRetryTimeout; + + // inform about recoverable problems + options.pause(data.file, options); + + // smart restart if server reports about the last known byte + api.log("X-Last-Known-Byte: " + lkb); + if (lkb) { + data.end = lkb; + } else { + data.end = data.start - 1; + if (416 == xhr.status) { + data.end = data.end - options.chunkSize; + } + } + + setTimeout(function () { + _this._send(options, data); + }, delay); + } else { + // no mo retries + _this.end(xhr.status); + } + } else { + // success + data.retry = 0; + + if (data.end == data.size - 1) { + // finished + _this.end(xhr.status); + } else { + // next chunk + + // shift position if server reports about the last known byte + api.log("X-Last-Known-Byte: " + lkb); + if (lkb) { + data.end = lkb; + } + data.file.FileAPIReadPosition = data.end; + + setTimeout(function () { + _this._send(options, data); + }, 0); + } + } + + xhr = null; + } + }; + + data.start = data.end + 1; + data.end = Math.max(Math.min(data.start + options.chunkSize, data.size) - 1, data.start); + + // Retrieve a slice of file + var + file = data.file + , slice = (file.slice || file.mozSlice || file.webkitSlice).call(file, data.start, data.end + 1) + ; + + if( data.size && !slice.size ){ + setTimeout(function (){ + _this.end(-1); + }); + } else { + xhr.setRequestHeader("Content-Range", "bytes " + data.start + "-" + data.end + "/" + data.size); + xhr.setRequestHeader("Content-Disposition", 'attachment; filename=' + encodeURIComponent(data.name)); + xhr.setRequestHeader("Content-Type", data.type || "application/octet-stream"); + + xhr.send(slice); + } + + file = slice = null; + } else { + // single piece upload + if( xhr.upload ){ + // https://github.com/blueimp/jQuery-File-Upload/wiki/Fixing-Safari-hanging-on-very-high-speed-connections-%281Gbps%29 + xhr.upload.addEventListener('progress', api.throttle(function (/**Event*/evt){ + options.progress(evt, _this, options); + }, 100), false); + } + + xhr.onreadystatechange = function (){ + _this.status = xhr.status; + _this.statusText = xhr.statusText; + _this.readyState = xhr.readyState; + + if( xhr.readyState == 4 ){ + for( var k in _xhrResponsePostfix ){ + _this['response'+k] = xhr['response'+k]; + } + xhr.onreadystatechange = null; + + if (!xhr.status || xhr.status > 201) { + api.log("Error: " + xhr.status); + if (((!xhr.status && !xhr.aborted) || 500 == xhr.status) && (options.retry || 0) < options.uploadRetry) { + options.retry = (options.retry || 0) + 1; + var delay = api.networkDownRetryTimeout; + + // inform about recoverable problems + options.pause(options.file, options); + + setTimeout(function () { + _this._send(options, data); + }, delay); + } else { + //success + _this.end(xhr.status); + } + } else { + //success + _this.end(xhr.status); + } + + xhr = null; + } + }; + + if( api.isArray(data) ){ + // multipart + xhr.setRequestHeader('Content-Type', 'multipart/form-data; boundary=_'+api.expando); + var rawData = data.join('') +'--_'+ api.expando +'--'; + + /** @namespace xhr.sendAsBinary https://developer.mozilla.org/ru/XMLHttpRequest#Sending_binary_content */ + if( xhr.sendAsBinary ){ + xhr.sendAsBinary(rawData); + } + else { + var bytes = Array.prototype.map.call(rawData, function(c){ return c.charCodeAt(0) & 0xff; }); + xhr.send(new Uint8Array(bytes).buffer); + + } + } else { + // FormData + xhr.send(data); + } + } + } + } + }; + + + // @export + api.XHR = XHR; +})(window, FileAPI); + +/** + * @class FileAPI.Camera + * @author RubaXa + * @support Chrome 21+, FF 18+, Opera 12+ + */ + +/*global window, FileAPI, jQuery */ +/** @namespace LocalMediaStream -- https://developer.mozilla.org/en-US/docs/WebRTC/MediaStream_API#LocalMediaStream */ +(function (window, api){ + "use strict"; + + var + URL = window.URL || window.webkitURL, + + document = window.document, + navigator = window.navigator, + + getMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia, + + html5 = !!getMedia + ; + + + // Support "media" + api.support.media = html5; + + + var Camera = function (video){ + this.video = video; + }; + + + Camera.prototype = { + isActive: function (){ + return !!this._active; + }, + + + /** + * Start camera streaming + * @param {Function} callback + */ + start: function (callback){ + var + _this = this + , video = _this.video + , _successId + , _failId + , _complete = function (err){ + _this._active = !err; + clearTimeout(_failId); + clearTimeout(_successId); +// api.event.off(video, 'loadedmetadata', _complete); + callback && callback(err, _this); + } + ; + + getMedia.call(navigator, { video: true }, function (stream/**LocalMediaStream*/){ + // Success + _this.stream = stream; + +// api.event.on(video, 'loadedmetadata', function (){ +// _complete(null); +// }); + + // Set camera stream + video.src = URL.createObjectURL(stream); + + // Note: onloadedmetadata doesn't fire in Chrome when using it with getUserMedia. + // See crbug.com/110938. + _successId = setInterval(function (){ + if( _detectVideoSignal(video) ){ + _complete(null); + } + }, 1000); + + _failId = setTimeout(function (){ + _complete('timeout'); + }, 5000); + + // Go-go-go! + video.play(); + }, _complete/*error*/); + }, + + + /** + * Stop camera streaming + */ + stop: function (){ + try { + this._active = false; + this.video.pause(); + + try { + this.stream.stop(); + } catch (err) { + api.each(this.stream.getTracks(), function (track) { + track.stop(); + }); + } + + this.stream = null; + } catch( err ){ + api.log('[FileAPI.Camera] stop:', err); + } + }, + + + /** + * Create screenshot + * @return {FileAPI.Camera.Shot} + */ + shot: function (){ + return new Shot(this.video); + } + }; + + + /** + * Get camera element from container + * + * @static + * @param {HTMLElement} el + * @return {Camera} + */ + Camera.get = function (el){ + return new Camera(el.firstChild); + }; + + + /** + * Publish camera element into container + * + * @static + * @param {HTMLElement} el + * @param {Object} options + * @param {Function} [callback] + */ + Camera.publish = function (el, options, callback){ + if( typeof options == 'function' ){ + callback = options; + options = {}; + } + + // Dimensions of "camera" + options = api.extend({}, { + width: '100%' + , height: '100%' + , start: true + }, options); + + + if( el.jquery ){ + // Extract first element, from jQuery collection + el = el[0]; + } + + + var doneFn = function (err){ + if( err ){ + callback(err); + } + else { + // Get camera + var cam = Camera.get(el); + if( options.start ){ + cam.start(callback); + } + else { + callback(null, cam); + } + } + }; + + + el.style.width = _px(options.width); + el.style.height = _px(options.height); + + + if( api.html5 && html5 ){ + // Create video element + var video = document.createElement('video'); + + // Set dimensions + video.style.width = _px(options.width); + video.style.height = _px(options.height); + + // Clean container + if( window.jQuery ){ + jQuery(el).empty(); + } else { + el.innerHTML = ''; + } + + // Add "camera" to container + el.appendChild(video); + + // end + doneFn(); + } + else { + Camera.fallback(el, options, doneFn); + } + }; + + + Camera.fallback = function (el, options, callback){ + callback('not_support_camera'); + }; + + + /** + * @class FileAPI.Camera.Shot + */ + var Shot = function (video){ + var canvas = video.nodeName ? api.Image.toCanvas(video) : video; + var shot = api.Image(canvas); + shot.type = 'image/png'; + shot.width = canvas.width; + shot.height = canvas.height; + shot.size = canvas.width * canvas.height * 4; + return shot; + }; + + + /** + * Add "px" postfix, if value is a number + * + * @private + * @param {*} val + * @return {String} + */ + function _px(val){ + return val >= 0 ? val + 'px' : val; + } + + + /** + * @private + * @param {HTMLVideoElement} video + * @return {Boolean} + */ + function _detectVideoSignal(video){ + var canvas = document.createElement('canvas'), ctx, res = false; + try { + ctx = canvas.getContext('2d'); + ctx.drawImage(video, 0, 0, 1, 1); + res = ctx.getImageData(0, 0, 1, 1).data[4] != 255; + } + catch( err ){ + api.log('[FileAPI.Camera] detectVideoSignal:', err); + } + return res; + } + + + // @export + Camera.Shot = Shot; + api.Camera = Camera; +})(window, FileAPI); + +/** + * FileAPI fallback to Flash + * + * @flash-developer "Vladimir Demidov" + */ + +/*global window, ActiveXObject, FileAPI */ +(function (window, jQuery, api) { + "use strict"; + + var + document = window.document + , location = window.location + , navigator = window.navigator + , _each = api.each + ; + + + api.support.flash = (function (){ + var mime = navigator.mimeTypes, has = false; + + if( navigator.plugins && typeof navigator.plugins['Shockwave Flash'] == 'object' ){ + has = navigator.plugins['Shockwave Flash'].description && !(mime && mime['application/x-shockwave-flash'] && !mime['application/x-shockwave-flash'].enabledPlugin); + } + else { + try { + has = !!(window.ActiveXObject && new ActiveXObject('ShockwaveFlash.ShockwaveFlash')); + } + catch(er){ + api.log('Flash -- does not supported.'); + } + } + + if( has && /^file:/i.test(location) ){ + api.log('[warn] Flash does not work on `file:` protocol.'); + } + + return has; + })(); + + + api.support.flash + && (0 + || !api.html5 || !api.support.html5 + || (api.cors && !api.support.cors) + || (api.media && !api.support.media) + ) + && (function (){ + var + _attr = api.uid() + , _retry = 0 + , _files = {} + , _rhttp = /^https?:/i + + , flash = { + _fn: {}, + + + /** + * Initialization & preload flash object + */ + init: function (){ + var child = document.body && document.body.firstChild; + + if( child ){ + do { + if( child.nodeType == 1 ){ + api.log('FlashAPI.state: awaiting'); + + var dummy = document.createElement('div'); + + dummy.id = '_' + _attr; + + _css(dummy, { + top: 1 + , right: 1 + , width: 5 + , height: 5 + , position: 'absolute' + , zIndex: 2147483647+'' // set max zIndex + }); + + child.parentNode.insertBefore(dummy, child); + flash.publish(dummy, _attr); + + return; + } + } + while( child = child.nextSibling ); + } + + if( _retry < 10 ){ + setTimeout(flash.init, ++_retry*50); + } + }, + + + /** + * Publish flash-object + * + * @param {HTMLElement} el + * @param {String} id + * @param {Object} [opts] + */ + publish: function (el, id, opts){ + opts = opts || {}; + el.innerHTML = _makeFlashHTML({ + id: id + , src: _getUrl(api.flashUrl, 'r=' + api.version) +// , src: _getUrl('http://v.demidov.boom.corp.mail.ru/uploaderfileapi/FlashFileAPI.swf?1') + , wmode: opts.camera ? '' : 'transparent' + , flashvars: 'callback=' + (opts.onEvent || 'FileAPI.Flash.onEvent') + + '&flashId='+ id + + '&storeKey='+ navigator.userAgent.match(/\d/ig).join('') +'_'+ api.version + + (flash.isReady || (api.pingUrl ? '&ping='+api.pingUrl : '')) + + '&timeout='+api.flashAbortTimeout + + (opts.camera ? '&useCamera=' + _getUrl(api.flashWebcamUrl) : '') + + '&debug='+(api.debug?"1":"") + }, opts); + }, + + + ready: function (){ + api.log('FlashAPI.state: ready'); + + flash.ready = api.F; + flash.isReady = true; + flash.patch(); + flash.patchCamera && flash.patchCamera(); + api.event.on(document, 'mouseover', flash.mouseover); + api.event.on(document, 'click', function (evt){ + if( flash.mouseover(evt) ){ + evt.preventDefault + ? evt.preventDefault() + : (evt.returnValue = true) + ; + } + }); + }, + + + getEl: function (){ + return document.getElementById('_'+_attr); + }, + + + getWrapper: function (node){ + do { + if( /js-fileapi-wrapper/.test(node.className) ){ + return node; + } + } + while( (node = node.parentNode) && (node !== document.body) ); + }, + + + mouseover: function (evt){ + var target = api.event.fix(evt).target; + + if( /input/i.test(target.nodeName) && target.type == 'file' && !target.disabled ){ + var + state = target.getAttribute(_attr) + , wrapper = flash.getWrapper(target) + ; + + if( api.multiFlash ){ + // check state: + // p — published + // i — initialization + // r — ready + if( state == 'i' || state == 'r' ){ + // publish fail + return false; + } + else if( state != 'p' ){ + // set "init" state + target.setAttribute(_attr, 'i'); + + var dummy = document.createElement('div'); + + if( !wrapper ){ + api.log('[err] FlashAPI.mouseover: js-fileapi-wrapper not found'); + return; + } + + _css(dummy, { + top: 0 + , left: 0 + , width: target.offsetWidth + , height: target.offsetHeight + , zIndex: 2147483647+'' // set max zIndex + , position: 'absolute' + }); + + wrapper.appendChild(dummy); + flash.publish(dummy, api.uid()); + + // set "publish" state + target.setAttribute(_attr, 'p'); + } + + return true; + } + else if( wrapper ){ + // Use one flash element + var box = _getDimensions(wrapper); + + _css(flash.getEl(), box); + + // Set current input + flash.curInp = target; + } + } + else if( !/object|embed/i.test(target.nodeName) ){ + _css(flash.getEl(), { top: 1, left: 1, width: 5, height: 5 }); + } + }, + + onEvent: function (evt){ + var type = evt.type; + + if( type == 'ready' ){ + try { + // set "ready" state + flash.getInput(evt.flashId).setAttribute(_attr, 'r'); + } catch (e){ + } + + flash.ready(); + setTimeout(function (){ flash.mouseenter(evt); }, 50); + return true; + } + else if( type === 'ping' ){ + api.log('(flash -> js).ping:', [evt.status, evt.savedStatus], evt.error); + } + else if( type === 'log' ){ + api.log('(flash -> js).log:', evt.target); + } + else if( type in flash ){ + setTimeout(function (){ + api.log('FlashAPI.event.'+evt.type+':', evt); + flash[type](evt); + }, 1); + } + }, + + + mouseenter: function (evt){ + var node = flash.getInput(evt.flashId); + + if( node ){ + // Set multiple mode + flash.cmd(evt, 'multiple', node.getAttribute('multiple') != null); + + + // Set files filter + var accept = [], exts = {}; + + _each((node.getAttribute('accept') || '').split(/,\s*/), function (mime){ + api.accept[mime] && _each(api.accept[mime].split(' '), function (ext){ + exts[ext] = 1; + }); + }); + + _each(exts, function (i, ext){ + accept.push( ext ); + }); + + flash.cmd(evt, 'accept', accept.length ? accept.join(',')+','+accept.join(',').toUpperCase() : '*'); + } + }, + + + get: function (id){ + return document[id] || window[id] || document.embeds[id]; + }, + + + getInput: function (id){ + if( api.multiFlash ){ + try { + var node = flash.getWrapper(flash.get(id)); + if( node ){ + return node.getElementsByTagName('input')[0]; + } + } catch (e){ + api.log('[err] Can not find "input" by flashId:', id, e); + } + } else { + return flash.curInp; + } + }, + + + select: function (evt){ + var + inp = flash.getInput(evt.flashId) + , uid = api.uid(inp) + , files = evt.target.files + , event + ; + + _each(files, function (file){ + api.checkFileObj(file); + }); + + _files[uid] = files; + + if( document.createEvent ){ + event = document.createEvent('Event'); + event.files = files; + event.initEvent('change', true, true); + inp.dispatchEvent(event); + } + else if( jQuery ){ + jQuery(inp).trigger({ type: 'change', files: files }); + } + else { + event = document.createEventObject(); + event.files = files; + inp.fireEvent('onchange', event); + } + }, + + + cmd: function (id, name, data, last){ + try { + api.log('(js -> flash).'+name+':', data); + return flash.get(id.flashId || id).cmd(name, data); + } catch (err){ + api.log('(js -> flash).onError:', err.toString()); + if( !last ){ + // try again + setTimeout(function (){ flash.cmd(id, name, data, true); }, 50); + } + } + }, + + + patch: function (){ + api.flashEngine = true; + + // FileAPI + _inherit(api, { + getFiles: function (input, filter, callback){ + if( callback ){ + api.filterFiles(api.getFiles(input), filter, callback); + return null; + } + + var files = api.isArray(input) ? input : _files[api.uid(input.target || input.srcElement || input)]; + + + if( !files ){ + // Файлов нету, вызываем родительский метод + return this.parent.apply(this, arguments); + } + + + if( filter ){ + filter = api.getFilesFilter(filter); + files = api.filter(files, function (file){ return filter.test(file.name); }); + } + + return files; + }, + + + getInfo: function (file, fn){ + if( _isHtmlFile(file) ){ + this.parent.apply(this, arguments); + } + else if( file.isShot ){ + fn(null, file.info = { + width: file.width, + height: file.height + }); + } + else { + if( !file.__info ){ + var defer = file.__info = api.defer(); + + flash.cmd(file, 'getFileInfo', { + id: file.id + , callback: _wrap(function _(err, info){ + _unwrap(_); + defer.resolve(err, file.info = info); + }) + }); + } + + file.__info.then(fn); + } + } + }); + + + // FileAPI.Image + api.support.transform = true; + api.Image && _inherit(api.Image.prototype, { + get: function (fn, scaleMode){ + this.set({ scaleMode: scaleMode || 'noScale' }); // noScale, exactFit + return this.parent(fn); + }, + + _load: function (file, fn){ + api.log('FlashAPI.Image._load:', file); + + if( _isHtmlFile(file) ){ + this.parent.apply(this, arguments); + } + else { + var _this = this; + api.getInfo(file, function (err){ + fn.call(_this, err, file); + }); + } + }, + + _apply: function (file, fn){ + api.log('FlashAPI.Image._apply:', file); + + if( _isHtmlFile(file) ){ + this.parent.apply(this, arguments); + } + else { + var m = this.getMatrix(file.info), doneFn = fn; + + flash.cmd(file, 'imageTransform', { + id: file.id + , matrix: m + , callback: _wrap(function _(err, base64){ + api.log('FlashAPI.Image._apply.callback:', err); + _unwrap(_); + + if( err ){ + doneFn(err); + } + else if( !api.support.html5 && (!api.support.dataURI || base64.length > 3e4) ){ + _makeFlashImage({ + width: (m.deg % 180) ? m.dh : m.dw + , height: (m.deg % 180) ? m.dw : m.dh + , scale: m.scaleMode + }, base64, doneFn); + } + else { + if( m.filter ){ + doneFn = function (err, img){ + if( err ){ + fn(err); + } + else { + api.Image.applyFilter(img, m.filter, function (){ + fn(err, this.canvas); + }); + } + }; + } + + api.newImage('data:'+ file.type +';base64,'+ base64, doneFn); + } + }) + }); + } + }, + + toData: function (fn){ + var + file = this.file + , info = file.info + , matrix = this.getMatrix(info) + ; + api.log('FlashAPI.Image.toData'); + + if( _isHtmlFile(file) ){ + this.parent.apply(this, arguments); + } + else { + if( matrix.deg == 'auto' ){ + matrix.deg = api.Image.exifOrientation[info && info.exif && info.exif.Orientation] || 0; + } + + fn.call(this, !file.info, { + id: file.id + , flashId: file.flashId + , name: file.name + , type: file.type + , matrix: matrix + }); + } + } + }); + + + api.Image && _inherit(api.Image, { + fromDataURL: function (dataURL, size, callback){ + if( !api.support.dataURI || dataURL.length > 3e4 ){ + _makeFlashImage( + api.extend({ scale: 'exactFit' }, size) + , dataURL.replace(/^data:[^,]+,/, '') + , function (err, el){ callback(el); } + ); + } + else { + this.parent(dataURL, size, callback); + } + } + }); + + // FileAPI.Form + _inherit(api.Form.prototype, { + toData: function (fn){ + var items = this.items, i = items.length; + + for( ; i--; ){ + if( items[i].file && _isHtmlFile(items[i].blob) ){ + return this.parent.apply(this, arguments); + } + } + + api.log('FlashAPI.Form.toData'); + fn(items); + } + }); + + + // FileAPI.XHR + _inherit(api.XHR.prototype, { + _send: function (options, formData){ + if( + formData.nodeName + || formData.append && api.support.html5 + || api.isArray(formData) && (typeof formData[0] === 'string') + ){ + // HTML5, Multipart or IFrame + return this.parent.apply(this, arguments); + } + + + var + data = {} + , files = {} + , _this = this + , flashId + , fileId + ; + + _each(formData, function (item){ + if( item.file ){ + files[item.name] = item = _getFileDescr(item.blob); + fileId = item.id; + flashId = item.flashId; + } + else { + data[item.name] = item.blob; + } + }); + + if( !fileId ){ + flashId = _attr; + } + + if( !flashId ){ + api.log('[err] FlashAPI._send: flashId -- undefined'); + return this.parent.apply(this, arguments); + } + else { + api.log('FlashAPI.XHR._send: '+ flashId +' -> '+ fileId); + } + + _this.xhr = { + headers: {}, + abort: function (){ flash.cmd(flashId, 'abort', { id: fileId }); }, + getResponseHeader: function (name){ return this.headers[name]; }, + getAllResponseHeaders: function (){ return this.headers; } + }; + + var queue = api.queue(function (){ + flash.cmd(flashId, 'upload', { + url: _getUrl(options.url.replace(/([a-z]+)=(\?)&?/i, '')) + , data: data + , files: fileId ? files : null + , headers: options.headers || {} + , callback: _wrap(function upload(evt){ + var type = evt.type, result = evt.result; + + api.log('FlashAPI.upload.'+type); + + if( type == 'progress' ){ + evt.loaded = Math.min(evt.loaded, evt.total); // @todo fixme + evt.lengthComputable = true; + options.progress(evt); + } + else if( type == 'complete' ){ + _unwrap(upload); + + if( typeof result == 'string' ){ + _this.responseText = result.replace(/%22/g, "\"").replace(/%5c/g, "\\").replace(/%26/g, "&").replace(/%25/g, "%"); + } + + _this.end(evt.status || 200); + } + else if( type == 'abort' || type == 'error' ){ + _this.end(evt.status || 0, evt.message); + _unwrap(upload); + } + }) + }); + }); + + + // #2174: FileReference.load() call while FileReference.upload() or vice versa + _each(files, function (file){ + queue.inc(); + api.getInfo(file, queue.next); + }); + + queue.check(); + } + }); + } + } + ; + + + function _makeFlashHTML(opts){ + return ('' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '').replace(/#(\w+)#/ig, function (a, name){ return opts[name]; }) + ; + } + + + function _css(el, css){ + if( el && el.style ){ + var key, val; + for( key in css ){ + val = css[key]; + if( typeof val == 'number' ){ + val += 'px'; + } + try { el.style[key] = val; } catch (e) {} + } + } + } + + + function _inherit(obj, methods){ + _each(methods, function (fn, name){ + var prev = obj[name]; + obj[name] = function (){ + this.parent = prev; + return fn.apply(this, arguments); + }; + }); + } + + function _isHtmlFile(file){ + return file && !file.flashId; + } + + function _wrap(fn){ + var id = fn.wid = api.uid(); + flash._fn[id] = fn; + return 'FileAPI.Flash._fn.'+id; + } + + + function _unwrap(fn){ + try { + flash._fn[fn.wid] = null; + delete flash._fn[fn.wid]; + } + catch(e){} + } + + + function _getUrl(url, params){ + if( !_rhttp.test(url) ){ + if( /^\.\//.test(url) || '/' != url.charAt(0) ){ + var path = location.pathname; + path = path.substr(0, path.lastIndexOf('/')); + url = (path +'/'+ url).replace('/./', '/'); + } + + if( '//' != url.substr(0, 2) ){ + url = '//' + location.host + url; + } + + if( !_rhttp.test(url) ){ + url = location.protocol + url; + } + } + + if( params ){ + url += (/\?/.test(url) ? '&' : '?') + params; + } + + return url; + } + + + function _makeFlashImage(opts, base64, fn){ + var + key + , flashId = api.uid() + , el = document.createElement('div') + , attempts = 10 + ; + + for( key in opts ){ + el.setAttribute(key, opts[key]); + el[key] = opts[key]; + } + + _css(el, opts); + + opts.width = '100%'; + opts.height = '100%'; + + el.innerHTML = _makeFlashHTML(api.extend({ + id: flashId + , src: _getUrl(api.flashImageUrl, 'r='+ api.uid()) + , wmode: 'opaque' + , flashvars: 'scale='+ opts.scale +'&callback='+_wrap(function _(){ + _unwrap(_); + if( --attempts > 0 ){ + _setImage(); + } + return true; + }) + }, opts)); + + function _setImage(){ + try { + // Get flash-object by id + var img = flash.get(flashId); + img.setImage(base64); + } catch (e){ + api.log('[err] FlashAPI.Preview.setImage -- can not set "base64":', e); + } + } + + fn(false, el); + el = null; + } + + + function _getFileDescr(file){ + return { + id: file.id + , name: file.name + , matrix: file.matrix + , flashId: file.flashId + }; + } + + + function _getDimensions(el){ + var + box = el.getBoundingClientRect() + , body = document.body + , docEl = (el && el.ownerDocument).documentElement + ; + + return { + top: box.top + (window.pageYOffset || docEl.scrollTop) - (docEl.clientTop || body.clientTop || 0) + , left: box.left + (window.pageXOffset || docEl.scrollLeft) - (docEl.clientLeft || body.clientLeft || 0) + , width: box.right - box.left + , height: box.bottom - box.top + }; + } + + // @export + api.Flash = flash; + + + // Check dataURI support + api.newImage('data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==', function (err, img){ + api.support.dataURI = !(img.width != 1 || img.height != 1); + flash.init(); + }); + })(); +})(window, window.jQuery, FileAPI); + +/** + * FileAPI fallback to Flash + * + * @flash-developer "Vladimir Demidov" + */ + +/*global window, FileAPI */ +(function (window, jQuery, api) { + "use strict"; + + var _each = api.each, + _cameraQueue = []; + + if (api.support.flash && (api.media && (!api.support.media || !api.html5))) { + (function () { + function _wrap(fn) { + var id = fn.wid = api.uid(); + api.Flash._fn[id] = fn; + return 'FileAPI.Flash._fn.' + id; + } + + + function _unwrap(fn) { + try { + api.Flash._fn[fn.wid] = null; + delete api.Flash._fn[fn.wid]; + } catch (e) { + } + } + + var flash = api.Flash; + api.extend(api.Flash, { + + patchCamera: function () { + api.Camera.fallback = function (el, options, callback) { + var camId = api.uid(); + api.log('FlashAPI.Camera.publish: ' + camId); + flash.publish(el, camId, api.extend(options, { + camera: true, + onEvent: _wrap(function _(evt) { + if (evt.type === 'camera') { + _unwrap(_); + + if (evt.error) { + api.log('FlashAPI.Camera.publish.error: ' + evt.error); + callback(evt.error); + } else { + api.log('FlashAPI.Camera.publish.success: ' + camId); + callback(null); + } + } + }) + })); + }; + // Run + _each(_cameraQueue, function (args) { + api.Camera.fallback.apply(api.Camera, args); + }); + _cameraQueue = []; + + + // FileAPI.Camera:proto + api.extend(api.Camera.prototype, { + _id: function () { + return this.video.id; + }, + + start: function (callback) { + var _this = this; + flash.cmd(this._id(), 'camera.on', { + callback: _wrap(function _(evt) { + _unwrap(_); + + if (evt.error) { + api.log('FlashAPI.camera.on.error: ' + evt.error); + callback(evt.error, _this); + } else { + api.log('FlashAPI.camera.on.success: ' + _this._id()); + _this._active = true; + callback(null, _this); + } + }) + }); + }, + + stop: function () { + this._active = false; + flash.cmd(this._id(), 'camera.off'); + }, + + shot: function () { + api.log('FlashAPI.Camera.shot:', this._id()); + + var shot = api.Flash.cmd(this._id(), 'shot', {}); + shot.type = 'image/png'; + shot.flashId = this._id(); + shot.isShot = true; + + return new api.Camera.Shot(shot); + } + }); + } + }); + + api.Camera.fallback = function () { + _cameraQueue.push(arguments); + }; + + }()); + } +}(window, window.jQuery, FileAPI)); if( typeof define === "function" && define.amd ){ define("FileAPI", [], function (){ return FileAPI; }); } \ No newline at end of file diff --git a/manager/media/browser/mcpuk/js/FileAPI/FileAPI.min.js b/manager/media/browser/mcpuk/js/FileAPI/FileAPI.min.js index e7cf53fff3..01020adec0 100644 --- a/manager/media/browser/mcpuk/js/FileAPI/FileAPI.min.js +++ b/manager/media/browser/mcpuk/js/FileAPI/FileAPI.min.js @@ -1,3 +1,3 @@ -/*! FileAPI 2.0.19 - BSD | git://github.com/mailru/FileAPI.git */ -!function(a){"use strict";var b=a.HTMLCanvasElement&&a.HTMLCanvasElement.prototype,c=a.Blob&&function(){try{return Boolean(new Blob)}catch(a){return!1}}(),d=c&&a.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(a){return!1}}(),e=a.BlobBuilder||a.WebKitBlobBuilder||a.MozBlobBuilder||a.MSBlobBuilder,f=(c||e)&&a.atob&&a.ArrayBuffer&&a.Uint8Array&&function(a){var b,f,g,h,i,j;for(b=a.split(",")[0].indexOf("base64")>=0?atob(a.split(",")[1]):decodeURIComponent(a.split(",")[1]),f=new ArrayBuffer(b.length),g=new Uint8Array(f),h=0;h0,H=a.dataURLtoBlob,I=/img/i,J=/canvas/i,K=/img|canvas/i,L=/input/i,M=/^data:[^,]+,/,N={}.toString,O=a.Math,P=function(b){return b=new a.Number(O.pow(1024,b)),b.from=function(a){return O.round(a*this)},b},Q={},R=[],S="abort progress error load loadend",T="status statusText readyState response responseXML responseText responseBody".split(" "),U="currentTarget",V="preventDefault",W=function(a){return a&&"length"in a},X=function(a,b,c){if(a)if(W(a))for(var d=0,e=a.length;e>d;d++)d in a&&b.call(c,a[d],d,a);else for(var f in a)a.hasOwnProperty(f)&&b.call(c,a[f],f,a)},Y=function(a){for(var b=arguments,c=1,d=function(b,c){a[c]=b};c=c&&!d&&f.end()},isFail:function(){return d},fail:function(){!d&&a(d=!0)},end:function(){e||(e=!0,a())}};return f},each:X,afor:function(a,b){var c=0,d=a.length;W(a)&&d--?!function e(){b(d!=c&&e,a[c],c++)}():b(!1)},extend:Y,isFile:function(a){return"[object File]"===N.call(a)},isBlob:function(a){return this.isFile(a)||"[object Blob]"===N.call(a)},isCanvas:function(a){return a&&J.test(a.nodeName)},getFilesFilter:function(a){return a="string"==typeof a?a:a.getAttribute&&a.getAttribute("accept")||"",a?new RegExp("("+a.replace(/\./g,"\\.").replace(/,/g,"|")+")$","i"):/./},readAsDataURL:function(a,b){ca.isCanvas(a)?c(a,b,"load",ca.toDataURL(a)):e(a,b,"DataURL")},readAsBinaryString:function(a,b){d("BinaryString")?e(a,b,"BinaryString"):e(a,function(a){if("load"==a.type)try{a.result=ca.toBinaryString(a.result)}catch(c){a.type="error",a.message=c.toString()}b(a)},"DataURL")},readAsArrayBuffer:function(a,b){e(a,b,"ArrayBuffer")},readAsText:function(a,b,c){c||(c=b,b="utf-8"),e(a,c,"Text",b)},toDataURL:function(a,b){return"string"==typeof a?a:a.toDataURL?a.toDataURL(b||"image/png"):void 0},toBinaryString:function(b){return a.atob(ca.toDataURL(b).replace(M,""))},readAsImage:function(a,d,e){if(ca.isBlob(a))if(w){var f=w.createObjectURL(a);f===b?c(a,d,"error"):ca.readAsImage(f,d,e)}else ca.readAsDataURL(a,function(b){"load"==b.type?ca.readAsImage(b.result,d,e):(e||"error"==b.type)&&c(a,d,b,null,{loaded:b.loaded,total:b.total})});else if(ca.isCanvas(a))c(a,d,"load",a);else if(I.test(a.nodeName))if(a.complete)c(a,d,"load",a);else{var g="error abort load";_(a,g,function i(b){"load"==b.type&&w&&w.revokeObjectURL(a.src),$(a,g,i),c(a,d,b,a)})}else if(a.iframe)c(a,d,{type:"error"});else{var h=ca.newImage(a.dataURL||a);ca.readAsImage(h,d,e)}},checkFileObj:function(a){var b={},c=ca.accept;return"object"==typeof a?b=a:b.name=(a+"").split(/\\|\//g).pop(),null==b.type&&(b.type=b.name.split(".").pop()),X(c,function(a,c){a=new RegExp(a.replace(/\s/g,"|"),"i"),(a.test(b.type)||ca.ext2mime[b.type])&&(b.type=ca.ext2mime[b.type]||c.split("/")[0]+"/"+b.type)}),b},getDropFiles:function(a,b){var c,d=[],e=[],j=l(a),k=j.files,m=j.items,n=W(m)&&m[0]&&h(m[0]),o=ca.queue(function(){b(d,e)});if(n)if(G&&k){var p,q,r=k.length;for(c=new Array(r);r--;){p=k[r];try{q=h(m[r])}catch(s){ca.log("[err] getDropFiles: ",s),q=null}g(q)&&(q.isDirectory||q.isFile&&p.name==p.name.normalize("NFC"))?c[r]=q:c[r]=p}}else c=m;else c=k;X(c||[],function(a){o.inc();try{n&&g(a)?i(a,function(a,b,c){a?ca.log("[err] getDropFiles:",a):d.push.apply(d,b),e.push.apply(e,c),o.next()}):f(a,function(b,c){b?d.push(a):a.error=c,e.push(a),o.next()})}catch(b){o.next(),ca.log("[err] getDropFiles: ",b)}}),o.check()},getFiles:function(a,b,c){var d=[];return c?(ca.filterFiles(ca.getFiles(a),b,c),null):(a.jquery&&(a.each(function(){d=d.concat(ca.getFiles(this))}),a=d,d=[]),"string"==typeof b&&(b=ca.getFilesFilter(b)),a.originalEvent?a=aa(a.originalEvent):a.srcElement&&(a=aa(a)),a.dataTransfer?a=a.dataTransfer:a.target&&(a=a.target),a.files?(d=a.files,D||(d[0].blob=a,d[0].iframe=!0)):!D&&k(a)?ca.trim(a.value)&&(d=[ca.checkFileObj(a.value)],d[0].blob=a,d[0].iframe=!0):W(a)&&(d=a),ca.filter(d,function(a){return!b||b.test(a.name)}))},getTotalSize:function(a){for(var b=0,c=a&&a.length;c--;)b+=a[c].size;return b},getInfo:function(a,b){var c={},d=R.concat();ca.isBlob(a)?!function e(){var f=d.shift();f?f.test(a.type)?f(a,function(a,d){a?b(a):(Y(c,d),e())}):e():b(!1,c)}():b("not_support_info",c)},addInfoReader:function(a,b){b.test=function(b){return a.test(b)},R.push(b)},filter:function(a,b){for(var c,d=[],e=0,f=a.length;f>e;e++)e in a&&(c=a[e],b.call(c,c,e,a)&&d.push(c));return d},filterFiles:function(a,b,c){if(a.length){var d,e=a.concat(),f=[],g=[];!function h(){e.length?(d=e.shift(),ca.getInfo(d,function(a,c){(b(d,a?!1:c)?f:g).push(d),h()})):c(f,g)}()}else c([],a)},upload:function(a){a=Y({jsonp:"callback",prepare:ca.F,beforeupload:ca.F,upload:ca.F,fileupload:ca.F,fileprogress:ca.F,filecomplete:ca.F,progress:ca.F,complete:ca.F,pause:ca.F,imageOriginal:!0,chunkSize:ca.chunkSize,chunkUploadRetry:ca.chunkUploadRetry,uploadRetry:ca.uploadRetry},a),a.imageAutoOrientation&&!a.imageTransform&&(a.imageTransform={rotate:"auto"});var b,c=new ca.XHR(a),d=this._getFilesDataArray(a.files),e=this,f=0,g=0,h=!1;return X(d,function(a){f+=a.size}),c.files=[],X(d,function(a){c.files.push(a.file)}),c.total=f,c.loaded=0,c.filesLeft=d.length,a.beforeupload(c,a),b=function(){var i=d.shift(),k=i&&i.file,l=!1,m=j(a);if(c.filesLeft=d.length,k&&k.name===ca.expando&&(k=null,ca.log("[warn] FileAPI.upload() — called without files")),("abort"!=c.statusText||c.current)&&i){if(h=!1,c.currentFile=k,k&&a.prepare(k,m)===!1)return void b.call(e);m.file=k,e._getFormData(m,i,function(h){g||a.upload(c,a);var j=new ca.XHR(Y({},m,{upload:k?function(){a.fileupload(k,j,m)}:q,progress:k?function(b){l||(l=b.loaded===b.total,a.fileprogress({type:"progress",total:i.total=b.total,loaded:i.loaded=b.loaded},k,j,m),a.progress({type:"progress",total:f,loaded:c.loaded=g+i.size*(b.loaded/b.total)||0},k,j,m))}:q,complete:function(d){X(T,function(a){c[a]=j[a]}),k&&(i.total=i.total||i.size,i.loaded=i.total,d||(this.progress(i),l=!0,g+=i.size,c.loaded=g),a.filecomplete(d,j,k,m)),setTimeout(function(){b.call(e)},0)}}));c.abort=function(a){a||(d.length=0),this.current=a,j.abort()},j.send(h)})}else{var n=200==c.status||201==c.status||204==c.status;a.complete(n?!1:c.statusText||"error",c,a),h=!0}},setTimeout(b,0),c.append=function(a,g){a=ca._getFilesDataArray([].concat(a)),X(a,function(a){f+=a.size,c.files.push(a.file),g?d.unshift(a):d.push(a)}),c.statusText="",h&&b.call(e)},c.remove=function(a){for(var b,c=d.length;c--;)d[c].file==a&&(b=d.splice(c,1),f-=b.size);return b},c},_getFilesDataArray:function(a){var b=[],c={};if(k(a)){var d=ca.getFiles(a);c[a.name||"file"]=null!==a.getAttribute("multiple")?d:d[0]}else W(a)&&k(a[0])?X(a,function(a){c[a.name||"file"]=ca.getFiles(a)}):c=a;return X(c,function e(a,c){W(a)?X(a,function(a){e(a,c)}):a&&(a.name||a.image)&&b.push({name:c,file:a,size:a.size,total:a.size,loaded:0})}),b.length||b.push({file:{name:ca.expando}}),b},_getFormData:function(a,b,c){var d=b.file,e=b.name,f=d.name,g=d.type,h=ca.support.transform&&a.imageTransform,i=new ca.Form,j=ca.queue(function(){c(i)}),k=h&&m(h),l=ca.postNameConcat;X(a.data,function n(a,b){"object"==typeof a?X(a,function(a,c){n(a,l(b,c))}):i.append(b,a)}),function o(b){b.image?(j.inc(),b.toData(function(a,c){b.file&&(c.type=b.file.type,c.quality=b.matrix.quality,f=b.file&&b.file.name),f=f||(new Date).getTime()+".png",o(c),j.next()})):ca.Image&&h&&(/^image/.test(b.type)||K.test(b.nodeName))?(j.inc(),k&&(h=[h]),ca.Image.transform(b,h,a.imageAutoOrientation,function(c,d){if(k&&!c)H||ca.flashEngine||(i.multipart=!0),i.append(e,d[0],f,h[0].type||g);else{var m=0;c||X(d,function(a,b){H||ca.flashEngine||(i.multipart=!0),h[b].postName||(m=1),i.append(h[b].postName||l(e,b),a,f,h[b].type||g)}),(c||a.imageOriginal)&&i.append(l(e,m?"original":null),b,f,g)}j.next()})):f!==ca.expando&&i.append(e,b,f)}(d),j.check()},reset:function(a,b){var c,d;return C?(d=C(a).clone(!0).insertBefore(a).val("")[0],b||C(a).remove()):(c=a.parentNode,d=c.insertBefore(a.cloneNode(!0),a),d.value="",b||c.removeChild(a),X(Q[ca.uid(a)],function(b,c){X(b,function(b){$(a,c,b),Z(d,c,b)})})),d},load:function(a,b){var c=ca.getXHR();return c?(c.open("GET",a,!0),c.overrideMimeType&&c.overrideMimeType("text/plain; charset=x-user-defined"),Z(c,"progress",function(a){a.lengthComputable&&b({type:a.type,loaded:a.loaded,total:a.total},c)}),c.onreadystatechange=function(){if(4==c.readyState)if(c.onreadystatechange=null,200==c.status){a=a.split("/");var d={name:a[a.length-1],size:c.getResponseHeader("Content-Length"),type:c.getResponseHeader("Content-Type")};d.dataURL="data:"+d.type+";base64,"+ca.encode64(c.responseBody||c.responseText),b({type:"load",result:d},c)}else b({type:"error"},c)},c.send(null)):b({type:"error"}),c},encode64:function(a){var b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c="",d=0;for("string"!=typeof a&&(a=String(a));d>2,k=(3&g)<<4|h>>4;isNaN(h)?e=f=64:(e=(15&h)<<2|i>>6,f=isNaN(i)?64:63&i),c+=b.charAt(j)+b.charAt(k)+b.charAt(e)+b.charAt(f)}return c}};ca.addInfoReader(/^image/,function(a,b){if(!a.__dimensions){var c=a.__dimensions=ca.defer();ca.readAsImage(a,function(a){var b=a.target;c.resolve("load"==a.type?!1:"error",{width:b.width,height:b.height}),b.src=ca.EMPTY_PNG,b=null})}a.__dimensions.then(b)}),ca.event.dnd=function(a,b,c){var d,e;c||(c=b,b=ca.F),z?(Z(a,"dragenter dragleave dragover",b.ff=b.ff||function(a){for(var c=l(a).types,f=c&&c.length,g=!1;f--;)if(~c[f].indexOf("File")){a[V](),e!==a.type&&(e=a.type,"dragleave"!=e&&b.call(a[U],!0,a),g=!0);break}g&&(clearTimeout(d),d=setTimeout(function(){b.call(a[U],"dragleave"!=e,a)},50))}),Z(a,"drop",c.ff=c.ff||function(a){a[V](),e=0,b.call(a[U],!1,a),ca.getDropFiles(a,function(b,d){c.call(a[U],b,d,a)})})):ca.log("Drag'n'Drop -- not supported")},ca.event.dnd.off=function(a,b,c){$(a,"dragenter dragleave dragover",b.ff),$(a,"drop",c.ff)},C&&!C.fn.dnd&&(C.fn.dnd=function(a,b){return this.each(function(){ca.event.dnd(this,a,b)})},C.fn.offdnd=function(a,b){return this.each(function(){ca.event.dnd.off(this,a,b)})}),a.FileAPI=Y(ca,a.FileAPI),ca.log("FileAPI: "+ca.version),ca.log("protocol: "+a.location.protocol),ca.log("doctype: ["+s.name+"] "+s.publicId+" "+s.systemId),X(r.getElementsByTagName("meta"),function(a){/x-ua-compatible/i.test(a.getAttribute("http-equiv"))&&ca.log("meta.http-equiv: "+a.getAttribute("content"))});try{n=!!console.log,o=!!console.log.apply}catch(da){}ca.flashUrl||(ca.flashUrl=ca.staticPath+"FileAPI.flash.swf"),ca.flashImageUrl||(ca.flashImageUrl=ca.staticPath+"FileAPI.flash.image.swf"),ca.flashWebcamUrl||(ca.flashWebcamUrl=ca.staticPath+"FileAPI.flash.camera.swf")}(window,void 0),function(a,b,c){"use strict";function d(b){if(b instanceof d){var c=new d(b.file);return a.extend(c.matrix,b.matrix),c}return this instanceof d?(this.file=b,this.size=b.size||100,void(this.matrix={sx:0,sy:0,sw:0,sh:0,dx:0,dy:0,dw:0,dh:0,resize:0,deg:0,quality:1,filter:0})):new d(b)}var e=Math.min,f=Math.round,g=function(){return b.createElement("canvas")},h=!1,i={8:270,3:180,6:90,7:270,4:180,5:90};try{h=g().toDataURL("image/png").indexOf("data:image/png")>-1}catch(j){}d.prototype={image:!0,constructor:d,set:function(b){return a.extend(this.matrix,b),this},crop:function(a,b,d,e){return d===c&&(d=a,e=b,a=b=0),this.set({sx:a,sy:b,sw:d,sh:e||d})},resize:function(a,b,c){return/min|max|height|width/.test(b)&&(c=b,b=a),this.set({dw:a,dh:b||a,resize:c})},preview:function(a,b){return this.resize(a,b||a,"preview")},rotate:function(a){return this.set({deg:a})},filter:function(a){return this.set({filter:a})},overlay:function(a){return this.set({overlay:a})},clone:function(){return new d(this)},_load:function(b,c){var d=this;/img|video/i.test(b.nodeName)?c.call(d,null,b):a.readAsImage(b,function(a){c.call(d,"load"!=a.type,a.result)})},_apply:function(b,c){var f,h=g(),i=this.getMatrix(b),j=h.getContext("2d"),k=b.videoWidth||b.width,l=b.videoHeight||b.height,m=i.deg,n=i.dw,o=i.dh,p=k,q=l,r=i.filter,s=b,t=i.overlay,u=a.queue(function(){b.src=a.EMPTY_PNG,c(!1,h)}),v=a.renderImageToCanvas;for(m-=360*Math.floor(m/360),b._type=this.file.type;i.multipass&&e(p/n,q/o)>2;)p=p/2+.5|0,q=q/2+.5|0,f=g(),f.width=p,f.height=q,s!==b?(v(f,s,0,0,s.width,s.height,0,0,p,q),s=f):(s=f,v(s,b,i.sx,i.sy,i.sw,i.sh,0,0,p,q),i.sx=i.sy=i.sw=i.sh=0);h.width=m%180?o:n,h.height=m%180?n:o,h.type=i.type,h.quality=i.quality,j.rotate(m*Math.PI/180),v(j.canvas,s,i.sx,i.sy,i.sw||s.width,i.sh||s.height,180==m||270==m?-n:0,90==m||180==m?-o:0,n,o),n=h.width,o=h.height,t&&a.each([].concat(t),function(b){u.inc();var c=new window.Image,d=function(){var e=0|b.x,f=0|b.y,g=b.w||c.width,h=b.h||c.height,i=b.rel;e=1==i||4==i||7==i?(n-g+e)/2:2==i||5==i||8==i?n-(g+e):e,f=3==i||4==i||5==i?(o-h+f)/2:i>=6?o-(h+f):f,a.event.off(c,"error load abort",d);try{j.globalAlpha=b.opacity||1,j.drawImage(c,e,f,g,h)}catch(k){}u.next()};a.event.on(c,"error load abort",d),c.src=b.src,c.complete&&d()}),r&&(u.inc(),d.applyFilter(h,r,u.next)),u.check()},getMatrix:function(b){var c=a.extend({},this.matrix),d=c.sw=c.sw||b.videoWidth||b.naturalWidth||b.width,g=c.sh=c.sh||b.videoHeight||b.naturalHeight||b.height,h=c.dw=c.dw||d,i=c.dh=c.dh||g,j=d/g,k=h/i,l=c.resize;if("preview"==l){if(h!=d||i!=g){var m,n;k>=j?(m=d,n=m/k):(n=g,m=n*k),(m!=d||n!=g)&&(c.sx=~~((d-m)/2),c.sy=~~((g-n)/2),d=m,g=n)}}else"height"==l?h=i*j:"width"==l?i=h/j:l&&(d>h||g>i?"min"==l?(h=f(k>j?e(d,h):i*j),i=f(k>j?h/j:e(g,i))):(h=f(j>=k?e(d,h):i*j),i=f(j>=k?h/j:e(g,i))):(h=d,i=g));return c.sw=d,c.sh=g,c.dw=h,c.dh=i,c.multipass=a.multiPassResize,c},_trans:function(b){this._load(this.file,function(c,d){if(c)b(c);else try{this._apply(d,b)}catch(c){a.log("[err] FileAPI.Image.fn._apply:",c),b(c)}})},get:function(b){if(a.support.transform){var c=this,d=c.matrix;"auto"==d.deg?a.getInfo(c.file,function(a,e){d.deg=i[e&&e.exif&&e.exif.Orientation]||0,c._trans(b)}):c._trans(b)}else b("not_support_transform");return this},toData:function(a){return this.get(a)}},d.exifOrientation=i,d.transform=function(b,e,f,g){function h(h,i){var j={},k=a.queue(function(a){g(a,j)});h?k.fail():a.each(e,function(a,e){if(!k.isFail()){var g=new d(i.nodeType?i:b),h="function"==typeof a;if(h?a(i,g):a.width?g[a.preview?"preview":"resize"](a.width,a.height,a.strategy):a.maxWidth&&(i.width>a.maxWidth||i.height>a.maxHeight)&&g.resize(a.maxWidth,a.maxHeight,"max"),a.crop){var l=a.crop;g.crop(0|l.x,0|l.y,l.w||l.width,l.h||l.height)}a.rotate===c&&f&&(a.rotate="auto"),g.set({type:g.matrix.type||a.type||b.type||"image/png"}),h||g.set({deg:a.rotate,overlay:a.overlay,filter:a.filter,quality:a.quality||1}),k.inc(),g.toData(function(a,b){a?k.fail():(j[e]=b,k.next())})}})}b.width?h(!1,b):a.getInfo(b,h)},a.each(["TOP","CENTER","BOTTOM"],function(b,c){a.each(["LEFT","CENTER","RIGHT"],function(a,e){d[b+"_"+a]=3*c+e,d[a+"_"+b]=3*c+e})}),d.toCanvas=function(a){var c=b.createElement("canvas");return c.width=a.videoWidth||a.width,c.height=a.videoHeight||a.height,c.getContext("2d").drawImage(a,0,0),c},d.fromDataURL=function(b,c,d){var e=a.newImage(b);a.extend(e,c),d(e)},d.applyFilter=function(b,c,e){"function"==typeof c?c(b,e):window.Caman&&window.Caman("IMG"==b.tagName?d.toCanvas(b):b,function(){"string"==typeof c?this[c]():a.each(c,function(a,b){this[b](a)},this),this.render(e)})},a.renderImageToCanvas=function(b,c,d,e,f,g,h,i,j,k){try{return b.getContext("2d").drawImage(c,d,e,f,g,h,i,j,k)}catch(l){throw a.log("renderImageToCanvas failed"),l}},a.support.canvas=a.support.transform=h,a.Image=d}(FileAPI,document),function(a){"use strict";a(FileAPI)}(function(a){"use strict";if(window.navigator&&window.navigator.platform&&/iP(hone|od|ad)/.test(window.navigator.platform)){var b=a.renderImageToCanvas;a.detectSubsampling=function(a){var b,c;return a.width*a.height>1048576?(b=document.createElement("canvas"),b.width=b.height=1,c=b.getContext("2d"),c.drawImage(a,-a.width+1,0),0===c.getImageData(0,0,1,1).data[3]):!1},a.detectVerticalSquash=function(a,b){var c,d,e,f,g,h=a.naturalHeight||a.height,i=document.createElement("canvas"),j=i.getContext("2d");for(b&&(h/=2),i.width=1,i.height=h,j.drawImage(a,0,0),c=j.getImageData(0,0,1,h).data,d=0,e=h,f=h;f>d;)g=c[4*(f-1)+3],0===g?e=f:d=f,f=e+d>>1;return f/h||1},a.renderImageToCanvas=function(c,d,e,f,g,h,i,j,k,l){if("image/jpeg"===d._type){var m,n,o,p,q=c.getContext("2d"),r=document.createElement("canvas"),s=1024,t=r.getContext("2d");if(r.width=s,r.height=s,q.save(),m=a.detectSubsampling(d),m&&(e/=2,f/=2,g/=2,h/=2),n=a.detectVerticalSquash(d,m),m||1!==n){for(f*=n,k=Math.ceil(s*k/g),l=Math.ceil(s*l/h/n),j=0,p=0;h>p;){for(i=0,o=0;g>o;)t.clearRect(0,0,s,s),t.drawImage(d,e,f,g,h,-o,-p,g,h),q.drawImage(r,0,0,s,s,i,j,k,l),o+=s,i+=k;p+=s,j+=l}return q.restore(),c}}return b(c,d,e,f,g,h,i,j,k,l)}}}),function(a,b){"use strict";function c(b,c,d){var e=b.blob,f=b.file;if(f){if(!e.toDataURL)return void a.readAsBinaryString(e,function(a){"load"==a.type&&c(b,a.result)});var g={"image/jpeg":".jpe?g","image/png":".png"},h=g[b.type]?b.type:"image/png",i=g[h]||".png",j=e.quality||1;f.match(new RegExp(i+"$","i"))||(f+=i.replace("?","")),b.file=f,b.type=h,!d&&e.toBlob?e.toBlob(function(a){c(b,a)},h,j):c(b,a.toBinaryString(e.toDataURL(h,j)))}else c(b,e)}var d=b.document,e=b.FormData,f=function(){this.items=[]},g=b.encodeURIComponent;f.prototype={append:function(a,b,c,d){this.items.push({name:a,blob:b&&b.blob||(void 0==b?"":b),file:b&&(c||b.name),type:b&&(d||b.type)})},each:function(a){for(var b=0,c=this.items.length;c>b;b++)a.call(this,this.items[b])},toData:function(b,c){c._chunked=a.support.chunked&&c.chunkSize>0&&1==a.filter(this.items,function(a){return a.file}).length,a.support.html5?a.formData&&!this.multipart&&e?c._chunked?(a.log("FileAPI.Form.toPlainData"),this.toPlainData(b)):(a.log("FileAPI.Form.toFormData"),this.toFormData(b)):(a.log("FileAPI.Form.toMultipartData"),this.toMultipartData(b)):(a.log("FileAPI.Form.toHtmlData"),this.toHtmlData(b))},_to:function(b,c,d,e){var f=a.queue(function(){c(b)});this.each(function(g){try{d(g,b,f,e)}catch(h){a.log("FileAPI.Form._to: "+h.message),c(h)}}),f.check()},toHtmlData:function(b){this._to(d.createDocumentFragment(),b,function(b,c){var e,f=b.blob;b.file?(a.reset(f,!0),f.name=b.name,f.disabled=!1,c.appendChild(f)):(e=d.createElement("input"),e.name=b.name,e.type="hidden",e.value=f,c.appendChild(e))})},toPlainData:function(a){this._to({},a,function(a,b,d){a.file&&(b.type=a.file),a.blob.toBlob?(d.inc(),c(a,function(a,c){b.name=a.name,b.file=c,b.size=c.length,b.type=a.type,d.next()})):a.file?(b.name=a.blob.name,b.file=a.blob,b.size=a.blob.size,b.type=a.type):(b.params||(b.params=[]),b.params.push(g(a.name)+"="+g(a.blob))),b.start=-1,b.end=b.file&&b.file.FileAPIReadPosition||-1,b.retry=0})},toFormData:function(a){this._to(new e,a,function(a,b,d){a.blob&&a.blob.toBlob?(d.inc(),c(a,function(a,c){b.append(a.name,c,a.file),d.next()})):a.file?b.append(a.name,a.blob,a.file):b.append(a.name,a.blob),a.file&&b.append("_"+a.name,a.file)})},toMultipartData:function(b){this._to([],b,function(a,b,d,e){d.inc(),c(a,function(a,c){b.push("--_"+e+('\r\nContent-Disposition: form-data; name="'+a.name+'"'+(a.file?'; filename="'+g(a.file)+'"':"")+(a.file?"\r\nContent-Type: "+(a.type||"application/octet-stream"):"")+"\r\n\r\n"+(a.file?c:g(c))+"\r\n")),d.next()},!0)},a.expando)}},a.Form=f}(FileAPI,window),function(a,b){"use strict";var c=function(){},d=a.document,e=function(a){this.uid=b.uid(),this.xhr={abort:c,getResponseHeader:c,getAllResponseHeaders:c},this.options=a},f={"":1,XML:1,Text:1,Body:1};e.prototype={status:0,statusText:"",constructor:e,getResponseHeader:function(a){return this.xhr.getResponseHeader(a)},getAllResponseHeaders:function(){return this.xhr.getAllResponseHeaders()||{}},end:function(d,e){var f=this,g=f.options;f.end=f.abort=c,f.status=d,e&&(f.statusText=e),b.log("xhr.end:",d,e),g.complete(200==d||201==d?!1:f.statusText||"unknown",f),f.xhr&&f.xhr.node&&setTimeout(function(){var b=f.xhr.node;try{b.parentNode.removeChild(b)}catch(c){}try{delete a[f.uid]}catch(c){}a[f.uid]=f.xhr.node=null},9)},abort:function(){this.end(0,"abort"),this.xhr&&(this.xhr.aborted=!0,this.xhr.abort())},send:function(a){var b=this,c=this.options;a.toData(function(a){a instanceof Error?b.end(0,a.message):(c.upload(c,b),b._send.call(b,c,a))},c)},_send:function(c,e){var g,h=this,i=h.uid,j=h.uid+"Load",k=c.url;if(b.log("XHR._send:",e),c.cache||(k+=(~k.indexOf("?")?"&":"?")+b.uid()),e.nodeName){var l=c.jsonp;k=k.replace(/([a-z]+)=(\?)/i,"$1="+i),c.upload(c,h);var m=function(a){if(~k.indexOf(a.origin))try{var c=b.parseJSON(a.data);c.id==i&&n(c.status,c.statusText,c.response)}catch(d){n(0,d.message)}},n=a[i]=function(c,d,e){h.readyState=4,h.responseText=e,h.end(c,d),b.event.off(a,"message",m),a[i]=g=p=a[j]=null};h.xhr.abort=function(){try{p.stop?p.stop():p.contentWindow.stop?p.contentWindow.stop():p.contentWindow.document.execCommand("Stop")}catch(a){}n(0,"abort")},b.event.on(a,"message",m),a[j]=function(){try{var a=p.contentWindow,c=a.document,d=a.result||b.parseJSON(c.body.innerHTML);n(d.status,d.statusText,d.response)}catch(e){b.log("[transport.onload]",e)}},g=d.createElement("div"),g.innerHTML='
              '+(l&&c.url.indexOf("=?")<0?'':"")+"";var o=g.getElementsByTagName("form")[0],p=g.getElementsByTagName("iframe")[0];o.appendChild(e),b.log(o.parentNode.innerHTML),d.body.appendChild(g),h.xhr.node=g,h.readyState=2;try{o.submit()}catch(q){b.log("iframe.error: "+q)}o=null}else{if(k=k.replace(/([a-z]+)=(\?)&?/i,""),this.xhr&&this.xhr.aborted)return void b.log("Error: already aborted");if(g=h.xhr=b.getXHR(),e.params&&(k+=(k.indexOf("?")<0?"?":"&")+e.params.join("&")),g.open("POST",k,!0),b.withCredentials&&(g.withCredentials="true"),c.headers&&c.headers["X-Requested-With"]||g.setRequestHeader("X-Requested-With","XMLHttpRequest"),b.each(c.headers,function(a,b){g.setRequestHeader(b,a)}),c._chunked){g.upload&&g.upload.addEventListener("progress",b.throttle(function(a){e.retry||c.progress({type:a.type,total:e.size,loaded:e.start+a.loaded,totalSize:e.size},h,c)},100),!1),g.onreadystatechange=function(){var a=parseInt(g.getResponseHeader("X-Last-Known-Byte"),10);if(h.status=g.status,h.statusText=g.statusText,h.readyState=g.readyState,4==g.readyState){for(var d in f)h["response"+d]=g["response"+d];if(g.onreadystatechange=null,!g.status||g.status-201>0)if(b.log("Error: "+g.status),(!g.status&&!g.aborted||500==g.status||416==g.status)&&++e.retry<=c.chunkUploadRetry){var i=g.status?0:b.chunkNetworkDownRetryTimeout;c.pause(e.file,c),b.log("X-Last-Known-Byte: "+a),a?e.end=a:(e.end=e.start-1,416==g.status&&(e.end=e.end-c.chunkSize)),setTimeout(function(){h._send(c,e)},i)}else h.end(g.status);else e.retry=0,e.end==e.size-1?h.end(g.status):(b.log("X-Last-Known-Byte: "+a),a&&(e.end=a),e.file.FileAPIReadPosition=e.end,setTimeout(function(){h._send(c,e)},0));g=null}},e.start=e.end+1,e.end=Math.max(Math.min(e.start+c.chunkSize,e.size)-1,e.start);var r=e.file,s=(r.slice||r.mozSlice||r.webkitSlice).call(r,e.start,e.end+1);e.size&&!s.size?setTimeout(function(){h.end(-1)}):(g.setRequestHeader("Content-Range","bytes "+e.start+"-"+e.end+"/"+e.size),g.setRequestHeader("Content-Disposition","attachment; filename="+encodeURIComponent(e.name)),g.setRequestHeader("Content-Type",e.type||"application/octet-stream"),g.send(s)),r=s=null}else if(g.upload&&g.upload.addEventListener("progress",b.throttle(function(a){c.progress(a,h,c)},100),!1),g.onreadystatechange=function(){if(h.status=g.status,h.statusText=g.statusText,h.readyState=g.readyState,4==g.readyState){for(var a in f)h["response"+a]=g["response"+a];if(g.onreadystatechange=null,!g.status||g.status>201)if(b.log("Error: "+g.status),(!g.status&&!g.aborted||500==g.status)&&(c.retry||0)=0?a+"px":a}function d(a){var c,d=f.createElement("canvas"),e=!1;try{c=d.getContext("2d"),c.drawImage(a,0,0,1,1),e=255!=c.getImageData(0,0,1,1).data[4]}catch(g){b.log("[FileAPI.Camera] detectVideoSignal:",g)}return e}var e=a.URL||a.webkitURL,f=a.document,g=a.navigator,h=g.getUserMedia||g.webkitGetUserMedia||g.mozGetUserMedia||g.msGetUserMedia,i=!!h;b.support.media=i;var j=function(a){this.video=a};j.prototype={isActive:function(){return!!this._active},start:function(a){var b,c,f=this,i=f.video,j=function(d){f._active=!d,clearTimeout(c),clearTimeout(b),a&&a(d,f)};h.call(g,{video:!0},function(a){f.stream=a,i.src=e.createObjectURL(a),b=setInterval(function(){d(i)&&j(null)},1e3),c=setTimeout(function(){j("timeout"); +/*! FileAPI 2.0.19 - BSD | git://github.com/mailru/FileAPI.git */ +!function(a){"use strict";var b=a.HTMLCanvasElement&&a.HTMLCanvasElement.prototype,c=a.Blob&&function(){try{return Boolean(new Blob)}catch(a){return!1}}(),d=c&&a.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(a){return!1}}(),e=a.BlobBuilder||a.WebKitBlobBuilder||a.MozBlobBuilder||a.MSBlobBuilder,f=(c||e)&&a.atob&&a.ArrayBuffer&&a.Uint8Array&&function(a){var b,f,g,h,i,j;for(b=a.split(",")[0].indexOf("base64")>=0?atob(a.split(",")[1]):decodeURIComponent(a.split(",")[1]),f=new ArrayBuffer(b.length),g=new Uint8Array(f),h=0;h0,H=a.dataURLtoBlob,I=/img/i,J=/canvas/i,K=/img|canvas/i,L=/input/i,M=/^data:[^,]+,/,N={}.toString,O=a.Math,P=function(b){return b=new a.Number(O.pow(1024,b)),b.from=function(a){return O.round(a*this)},b},Q={},R=[],S="abort progress error load loadend",T="status statusText readyState response responseXML responseText responseBody".split(" "),U="currentTarget",V="preventDefault",W=function(a){return a&&"length"in a},X=function(a,b,c){if(a)if(W(a))for(var d=0,e=a.length;e>d;d++)d in a&&b.call(c,a[d],d,a);else for(var f in a)a.hasOwnProperty(f)&&b.call(c,a[f],f,a)},Y=function(a){for(var b=arguments,c=1,d=function(b,c){a[c]=b};c=c&&!d&&f.end()},isFail:function(){return d},fail:function(){!d&&a(d=!0)},end:function(){e||(e=!0,a())}};return f},each:X,afor:function(a,b){var c=0,d=a.length;W(a)&&d--?!function e(){b(d!=c&&e,a[c],c++)}():b(!1)},extend:Y,isFile:function(a){return"[object File]"===N.call(a)},isBlob:function(a){return this.isFile(a)||"[object Blob]"===N.call(a)},isCanvas:function(a){return a&&J.test(a.nodeName)},getFilesFilter:function(a){return a="string"==typeof a?a:a.getAttribute&&a.getAttribute("accept")||"",a?new RegExp("("+a.replace(/\./g,"\\.").replace(/,/g,"|")+")$","i"):/./},readAsDataURL:function(a,b){ca.isCanvas(a)?c(a,b,"load",ca.toDataURL(a)):e(a,b,"DataURL")},readAsBinaryString:function(a,b){d("BinaryString")?e(a,b,"BinaryString"):e(a,function(a){if("load"==a.type)try{a.result=ca.toBinaryString(a.result)}catch(c){a.type="error",a.message=c.toString()}b(a)},"DataURL")},readAsArrayBuffer:function(a,b){e(a,b,"ArrayBuffer")},readAsText:function(a,b,c){c||(c=b,b="utf-8"),e(a,c,"Text",b)},toDataURL:function(a,b){return"string"==typeof a?a:a.toDataURL?a.toDataURL(b||"image/png"):void 0},toBinaryString:function(b){return a.atob(ca.toDataURL(b).replace(M,""))},readAsImage:function(a,d,e){if(ca.isBlob(a))if(w){var f=w.createObjectURL(a);f===b?c(a,d,"error"):ca.readAsImage(f,d,e)}else ca.readAsDataURL(a,function(b){"load"==b.type?ca.readAsImage(b.result,d,e):(e||"error"==b.type)&&c(a,d,b,null,{loaded:b.loaded,total:b.total})});else if(ca.isCanvas(a))c(a,d,"load",a);else if(I.test(a.nodeName))if(a.complete)c(a,d,"load",a);else{var g="error abort load";_(a,g,function i(b){"load"==b.type&&w&&w.revokeObjectURL(a.src),$(a,g,i),c(a,d,b,a)})}else if(a.iframe)c(a,d,{type:"error"});else{var h=ca.newImage(a.dataURL||a);ca.readAsImage(h,d,e)}},checkFileObj:function(a){var b={},c=ca.accept;return"object"==typeof a?b=a:b.name=(a+"").split(/\\|\//g).pop(),null==b.type&&(b.type=b.name.split(".").pop()),X(c,function(a,c){a=new RegExp(a.replace(/\s/g,"|"),"i"),(a.test(b.type)||ca.ext2mime[b.type])&&(b.type=ca.ext2mime[b.type]||c.split("/")[0]+"/"+b.type)}),b},getDropFiles:function(a,b){var c,d=[],e=[],j=l(a),k=j.files,m=j.items,n=W(m)&&m[0]&&h(m[0]),o=ca.queue(function(){b(d,e)});if(n)if(G&&k){var p,q,r=k.length;for(c=new Array(r);r--;){p=k[r];try{q=h(m[r])}catch(s){ca.log("[err] getDropFiles: ",s),q=null}g(q)&&(q.isDirectory||q.isFile&&p.name==p.name.normalize("NFC"))?c[r]=q:c[r]=p}}else c=m;else c=k;X(c||[],function(a){o.inc();try{n&&g(a)?i(a,function(a,b,c){a?ca.log("[err] getDropFiles:",a):d.push.apply(d,b),e.push.apply(e,c),o.next()}):f(a,function(b,c){b?d.push(a):a.error=c,e.push(a),o.next()})}catch(b){o.next(),ca.log("[err] getDropFiles: ",b)}}),o.check()},getFiles:function(a,b,c){var d=[];return c?(ca.filterFiles(ca.getFiles(a),b,c),null):(a.jquery&&(a.each(function(){d=d.concat(ca.getFiles(this))}),a=d,d=[]),"string"==typeof b&&(b=ca.getFilesFilter(b)),a.originalEvent?a=aa(a.originalEvent):a.srcElement&&(a=aa(a)),a.dataTransfer?a=a.dataTransfer:a.target&&(a=a.target),a.files?(d=a.files,D||(d[0].blob=a,d[0].iframe=!0)):!D&&k(a)?ca.trim(a.value)&&(d=[ca.checkFileObj(a.value)],d[0].blob=a,d[0].iframe=!0):W(a)&&(d=a),ca.filter(d,function(a){return!b||b.test(a.name)}))},getTotalSize:function(a){for(var b=0,c=a&&a.length;c--;)b+=a[c].size;return b},getInfo:function(a,b){var c={},d=R.concat();ca.isBlob(a)?!function e(){var f=d.shift();f?f.test(a.type)?f(a,function(a,d){a?b(a):(Y(c,d),e())}):e():b(!1,c)}():b("not_support_info",c)},addInfoReader:function(a,b){b.test=function(b){return a.test(b)},R.push(b)},filter:function(a,b){for(var c,d=[],e=0,f=a.length;f>e;e++)e in a&&(c=a[e],b.call(c,c,e,a)&&d.push(c));return d},filterFiles:function(a,b,c){if(a.length){var d,e=a.concat(),f=[],g=[];!function h(){e.length?(d=e.shift(),ca.getInfo(d,function(a,c){(b(d,a?!1:c)?f:g).push(d),h()})):c(f,g)}()}else c([],a)},upload:function(a){a=Y({jsonp:"callback",prepare:ca.F,beforeupload:ca.F,upload:ca.F,fileupload:ca.F,fileprogress:ca.F,filecomplete:ca.F,progress:ca.F,complete:ca.F,pause:ca.F,imageOriginal:!0,chunkSize:ca.chunkSize,chunkUploadRetry:ca.chunkUploadRetry,uploadRetry:ca.uploadRetry},a),a.imageAutoOrientation&&!a.imageTransform&&(a.imageTransform={rotate:"auto"});var b,c=new ca.XHR(a),d=this._getFilesDataArray(a.files),e=this,f=0,g=0,h=!1;return X(d,function(a){f+=a.size}),c.files=[],X(d,function(a){c.files.push(a.file)}),c.total=f,c.loaded=0,c.filesLeft=d.length,a.beforeupload(c,a),b=function(){var i=d.shift(),k=i&&i.file,l=!1,m=j(a);if(c.filesLeft=d.length,k&&k.name===ca.expando&&(k=null,ca.log("[warn] FileAPI.upload() — called without files")),("abort"!=c.statusText||c.current)&&i){if(h=!1,c.currentFile=k,k&&a.prepare(k,m)===!1)return void b.call(e);m.file=k,e._getFormData(m,i,function(h){g||a.upload(c,a);var j=new ca.XHR(Y({},m,{upload:k?function(){a.fileupload(k,j,m)}:q,progress:k?function(b){l||(l=b.loaded===b.total,a.fileprogress({type:"progress",total:i.total=b.total,loaded:i.loaded=b.loaded},k,j,m),a.progress({type:"progress",total:f,loaded:c.loaded=g+i.size*(b.loaded/b.total)||0},k,j,m))}:q,complete:function(d){X(T,function(a){c[a]=j[a]}),k&&(i.total=i.total||i.size,i.loaded=i.total,d||(this.progress(i),l=!0,g+=i.size,c.loaded=g),a.filecomplete(d,j,k,m)),setTimeout(function(){b.call(e)},0)}}));c.abort=function(a){a||(d.length=0),this.current=a,j.abort()},j.send(h)})}else{var n=200==c.status||201==c.status||204==c.status;a.complete(n?!1:c.statusText||"error",c,a),h=!0}},setTimeout(b,0),c.append=function(a,g){a=ca._getFilesDataArray([].concat(a)),X(a,function(a){f+=a.size,c.files.push(a.file),g?d.unshift(a):d.push(a)}),c.statusText="",h&&b.call(e)},c.remove=function(a){for(var b,c=d.length;c--;)d[c].file==a&&(b=d.splice(c,1),f-=b.size);return b},c},_getFilesDataArray:function(a){var b=[],c={};if(k(a)){var d=ca.getFiles(a);c[a.name||"file"]=null!==a.getAttribute("multiple")?d:d[0]}else W(a)&&k(a[0])?X(a,function(a){c[a.name||"file"]=ca.getFiles(a)}):c=a;return X(c,function e(a,c){W(a)?X(a,function(a){e(a,c)}):a&&(a.name||a.image)&&b.push({name:c,file:a,size:a.size,total:a.size,loaded:0})}),b.length||b.push({file:{name:ca.expando}}),b},_getFormData:function(a,b,c){var d=b.file,e=b.name,f=d.name,g=d.type,h=ca.support.transform&&a.imageTransform,i=new ca.Form,j=ca.queue(function(){c(i)}),k=h&&m(h),l=ca.postNameConcat;X(a.data,function n(a,b){"object"==typeof a?X(a,function(a,c){n(a,l(b,c))}):i.append(b,a)}),function o(b){b.image?(j.inc(),b.toData(function(a,c){b.file&&(c.type=b.file.type,c.quality=b.matrix.quality,f=b.file&&b.file.name),f=f||(new Date).getTime()+".png",o(c),j.next()})):ca.Image&&h&&(/^image/.test(b.type)||K.test(b.nodeName))?(j.inc(),k&&(h=[h]),ca.Image.transform(b,h,a.imageAutoOrientation,function(c,d){if(k&&!c)H||ca.flashEngine||(i.multipart=!0),i.append(e,d[0],f,h[0].type||g);else{var m=0;c||X(d,function(a,b){H||ca.flashEngine||(i.multipart=!0),h[b].postName||(m=1),i.append(h[b].postName||l(e,b),a,f,h[b].type||g)}),(c||a.imageOriginal)&&i.append(l(e,m?"original":null),b,f,g)}j.next()})):f!==ca.expando&&i.append(e,b,f)}(d),j.check()},reset:function(a,b){var c,d;return C?(d=C(a).clone(!0).insertBefore(a).val("")[0],b||C(a).remove()):(c=a.parentNode,d=c.insertBefore(a.cloneNode(!0),a),d.value="",b||c.removeChild(a),X(Q[ca.uid(a)],function(b,c){X(b,function(b){$(a,c,b),Z(d,c,b)})})),d},load:function(a,b){var c=ca.getXHR();return c?(c.open("GET",a,!0),c.overrideMimeType&&c.overrideMimeType("text/plain; charset=x-user-defined"),Z(c,"progress",function(a){a.lengthComputable&&b({type:a.type,loaded:a.loaded,total:a.total},c)}),c.onreadystatechange=function(){if(4==c.readyState)if(c.onreadystatechange=null,200==c.status){a=a.split("/");var d={name:a[a.length-1],size:c.getResponseHeader("Content-Length"),type:c.getResponseHeader("Content-Type")};d.dataURL="data:"+d.type+";base64,"+ca.encode64(c.responseBody||c.responseText),b({type:"load",result:d},c)}else b({type:"error"},c)},c.send(null)):b({type:"error"}),c},encode64:function(a){var b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c="",d=0;for("string"!=typeof a&&(a=String(a));d>2,k=(3&g)<<4|h>>4;isNaN(h)?e=f=64:(e=(15&h)<<2|i>>6,f=isNaN(i)?64:63&i),c+=b.charAt(j)+b.charAt(k)+b.charAt(e)+b.charAt(f)}return c}};ca.addInfoReader(/^image/,function(a,b){if(!a.__dimensions){var c=a.__dimensions=ca.defer();ca.readAsImage(a,function(a){var b=a.target;c.resolve("load"==a.type?!1:"error",{width:b.width,height:b.height}),b.src=ca.EMPTY_PNG,b=null})}a.__dimensions.then(b)}),ca.event.dnd=function(a,b,c){var d,e;c||(c=b,b=ca.F),z?(Z(a,"dragenter dragleave dragover",b.ff=b.ff||function(a){for(var c=l(a).types,f=c&&c.length,g=!1;f--;)if(~c[f].indexOf("File")){a[V](),e!==a.type&&(e=a.type,"dragleave"!=e&&b.call(a[U],!0,a),g=!0);break}g&&(clearTimeout(d),d=setTimeout(function(){b.call(a[U],"dragleave"!=e,a)},50))}),Z(a,"drop",c.ff=c.ff||function(a){a[V](),e=0,b.call(a[U],!1,a),ca.getDropFiles(a,function(b,d){c.call(a[U],b,d,a)})})):ca.log("Drag'n'Drop -- not supported")},ca.event.dnd.off=function(a,b,c){$(a,"dragenter dragleave dragover",b.ff),$(a,"drop",c.ff)},C&&!C.fn.dnd&&(C.fn.dnd=function(a,b){return this.each(function(){ca.event.dnd(this,a,b)})},C.fn.offdnd=function(a,b){return this.each(function(){ca.event.dnd.off(this,a,b)})}),a.FileAPI=Y(ca,a.FileAPI),ca.log("FileAPI: "+ca.version),ca.log("protocol: "+a.location.protocol),ca.log("doctype: ["+s.name+"] "+s.publicId+" "+s.systemId),X(r.getElementsByTagName("meta"),function(a){/x-ua-compatible/i.test(a.getAttribute("http-equiv"))&&ca.log("meta.http-equiv: "+a.getAttribute("content"))});try{n=!!console.log,o=!!console.log.apply}catch(da){}ca.flashUrl||(ca.flashUrl=ca.staticPath+"FileAPI.flash.swf"),ca.flashImageUrl||(ca.flashImageUrl=ca.staticPath+"FileAPI.flash.image.swf"),ca.flashWebcamUrl||(ca.flashWebcamUrl=ca.staticPath+"FileAPI.flash.camera.swf")}(window,void 0),function(a,b,c){"use strict";function d(b){if(b instanceof d){var c=new d(b.file);return a.extend(c.matrix,b.matrix),c}return this instanceof d?(this.file=b,this.size=b.size||100,void(this.matrix={sx:0,sy:0,sw:0,sh:0,dx:0,dy:0,dw:0,dh:0,resize:0,deg:0,quality:1,filter:0})):new d(b)}var e=Math.min,f=Math.round,g=function(){return b.createElement("canvas")},h=!1,i={8:270,3:180,6:90,7:270,4:180,5:90};try{h=g().toDataURL("image/png").indexOf("data:image/png")>-1}catch(j){}d.prototype={image:!0,constructor:d,set:function(b){return a.extend(this.matrix,b),this},crop:function(a,b,d,e){return d===c&&(d=a,e=b,a=b=0),this.set({sx:a,sy:b,sw:d,sh:e||d})},resize:function(a,b,c){return/min|max|height|width/.test(b)&&(c=b,b=a),this.set({dw:a,dh:b||a,resize:c})},preview:function(a,b){return this.resize(a,b||a,"preview")},rotate:function(a){return this.set({deg:a})},filter:function(a){return this.set({filter:a})},overlay:function(a){return this.set({overlay:a})},clone:function(){return new d(this)},_load:function(b,c){var d=this;/img|video/i.test(b.nodeName)?c.call(d,null,b):a.readAsImage(b,function(a){c.call(d,"load"!=a.type,a.result)})},_apply:function(b,c){var f,h=g(),i=this.getMatrix(b),j=h.getContext("2d"),k=b.videoWidth||b.width,l=b.videoHeight||b.height,m=i.deg,n=i.dw,o=i.dh,p=k,q=l,r=i.filter,s=b,t=i.overlay,u=a.queue(function(){b.src=a.EMPTY_PNG,c(!1,h)}),v=a.renderImageToCanvas;for(m-=360*Math.floor(m/360),b._type=this.file.type;i.multipass&&e(p/n,q/o)>2;)p=p/2+.5|0,q=q/2+.5|0,f=g(),f.width=p,f.height=q,s!==b?(v(f,s,0,0,s.width,s.height,0,0,p,q),s=f):(s=f,v(s,b,i.sx,i.sy,i.sw,i.sh,0,0,p,q),i.sx=i.sy=i.sw=i.sh=0);h.width=m%180?o:n,h.height=m%180?n:o,h.type=i.type,h.quality=i.quality,j.rotate(m*Math.PI/180),v(j.canvas,s,i.sx,i.sy,i.sw||s.width,i.sh||s.height,180==m||270==m?-n:0,90==m||180==m?-o:0,n,o),n=h.width,o=h.height,t&&a.each([].concat(t),function(b){u.inc();var c=new window.Image,d=function(){var e=0|b.x,f=0|b.y,g=b.w||c.width,h=b.h||c.height,i=b.rel;e=1==i||4==i||7==i?(n-g+e)/2:2==i||5==i||8==i?n-(g+e):e,f=3==i||4==i||5==i?(o-h+f)/2:i>=6?o-(h+f):f,a.event.off(c,"error load abort",d);try{j.globalAlpha=b.opacity||1,j.drawImage(c,e,f,g,h)}catch(k){}u.next()};a.event.on(c,"error load abort",d),c.src=b.src,c.complete&&d()}),r&&(u.inc(),d.applyFilter(h,r,u.next)),u.check()},getMatrix:function(b){var c=a.extend({},this.matrix),d=c.sw=c.sw||b.videoWidth||b.naturalWidth||b.width,g=c.sh=c.sh||b.videoHeight||b.naturalHeight||b.height,h=c.dw=c.dw||d,i=c.dh=c.dh||g,j=d/g,k=h/i,l=c.resize;if("preview"==l){if(h!=d||i!=g){var m,n;k>=j?(m=d,n=m/k):(n=g,m=n*k),(m!=d||n!=g)&&(c.sx=~~((d-m)/2),c.sy=~~((g-n)/2),d=m,g=n)}}else"height"==l?h=i*j:"width"==l?i=h/j:l&&(d>h||g>i?"min"==l?(h=f(k>j?e(d,h):i*j),i=f(k>j?h/j:e(g,i))):(h=f(j>=k?e(d,h):i*j),i=f(j>=k?h/j:e(g,i))):(h=d,i=g));return c.sw=d,c.sh=g,c.dw=h,c.dh=i,c.multipass=a.multiPassResize,c},_trans:function(b){this._load(this.file,function(c,d){if(c)b(c);else try{this._apply(d,b)}catch(c){a.log("[err] FileAPI.Image.fn._apply:",c),b(c)}})},get:function(b){if(a.support.transform){var c=this,d=c.matrix;"auto"==d.deg?a.getInfo(c.file,function(a,e){d.deg=i[e&&e.exif&&e.exif.Orientation]||0,c._trans(b)}):c._trans(b)}else b("not_support_transform");return this},toData:function(a){return this.get(a)}},d.exifOrientation=i,d.transform=function(b,e,f,g){function h(h,i){var j={},k=a.queue(function(a){g(a,j)});h?k.fail():a.each(e,function(a,e){if(!k.isFail()){var g=new d(i.nodeType?i:b),h="function"==typeof a;if(h?a(i,g):a.width?g[a.preview?"preview":"resize"](a.width,a.height,a.strategy):a.maxWidth&&(i.width>a.maxWidth||i.height>a.maxHeight)&&g.resize(a.maxWidth,a.maxHeight,"max"),a.crop){var l=a.crop;g.crop(0|l.x,0|l.y,l.w||l.width,l.h||l.height)}a.rotate===c&&f&&(a.rotate="auto"),g.set({type:g.matrix.type||a.type||b.type||"image/png"}),h||g.set({deg:a.rotate,overlay:a.overlay,filter:a.filter,quality:a.quality||1}),k.inc(),g.toData(function(a,b){a?k.fail():(j[e]=b,k.next())})}})}b.width?h(!1,b):a.getInfo(b,h)},a.each(["TOP","CENTER","BOTTOM"],function(b,c){a.each(["LEFT","CENTER","RIGHT"],function(a,e){d[b+"_"+a]=3*c+e,d[a+"_"+b]=3*c+e})}),d.toCanvas=function(a){var c=b.createElement("canvas");return c.width=a.videoWidth||a.width,c.height=a.videoHeight||a.height,c.getContext("2d").drawImage(a,0,0),c},d.fromDataURL=function(b,c,d){var e=a.newImage(b);a.extend(e,c),d(e)},d.applyFilter=function(b,c,e){"function"==typeof c?c(b,e):window.Caman&&window.Caman("IMG"==b.tagName?d.toCanvas(b):b,function(){"string"==typeof c?this[c]():a.each(c,function(a,b){this[b](a)},this),this.render(e)})},a.renderImageToCanvas=function(b,c,d,e,f,g,h,i,j,k){try{return b.getContext("2d").drawImage(c,d,e,f,g,h,i,j,k)}catch(l){throw a.log("renderImageToCanvas failed"),l}},a.support.canvas=a.support.transform=h,a.Image=d}(FileAPI,document),function(a){"use strict";a(FileAPI)}(function(a){"use strict";if(window.navigator&&window.navigator.platform&&/iP(hone|od|ad)/.test(window.navigator.platform)){var b=a.renderImageToCanvas;a.detectSubsampling=function(a){var b,c;return a.width*a.height>1048576?(b=document.createElement("canvas"),b.width=b.height=1,c=b.getContext("2d"),c.drawImage(a,-a.width+1,0),0===c.getImageData(0,0,1,1).data[3]):!1},a.detectVerticalSquash=function(a,b){var c,d,e,f,g,h=a.naturalHeight||a.height,i=document.createElement("canvas"),j=i.getContext("2d");for(b&&(h/=2),i.width=1,i.height=h,j.drawImage(a,0,0),c=j.getImageData(0,0,1,h).data,d=0,e=h,f=h;f>d;)g=c[4*(f-1)+3],0===g?e=f:d=f,f=e+d>>1;return f/h||1},a.renderImageToCanvas=function(c,d,e,f,g,h,i,j,k,l){if("image/jpeg"===d._type){var m,n,o,p,q=c.getContext("2d"),r=document.createElement("canvas"),s=1024,t=r.getContext("2d");if(r.width=s,r.height=s,q.save(),m=a.detectSubsampling(d),m&&(e/=2,f/=2,g/=2,h/=2),n=a.detectVerticalSquash(d,m),m||1!==n){for(f*=n,k=Math.ceil(s*k/g),l=Math.ceil(s*l/h/n),j=0,p=0;h>p;){for(i=0,o=0;g>o;)t.clearRect(0,0,s,s),t.drawImage(d,e,f,g,h,-o,-p,g,h),q.drawImage(r,0,0,s,s,i,j,k,l),o+=s,i+=k;p+=s,j+=l}return q.restore(),c}}return b(c,d,e,f,g,h,i,j,k,l)}}}),function(a,b){"use strict";function c(b,c,d){var e=b.blob,f=b.file;if(f){if(!e.toDataURL)return void a.readAsBinaryString(e,function(a){"load"==a.type&&c(b,a.result)});var g={"image/jpeg":".jpe?g","image/png":".png"},h=g[b.type]?b.type:"image/png",i=g[h]||".png",j=e.quality||1;f.match(new RegExp(i+"$","i"))||(f+=i.replace("?","")),b.file=f,b.type=h,!d&&e.toBlob?e.toBlob(function(a){c(b,a)},h,j):c(b,a.toBinaryString(e.toDataURL(h,j)))}else c(b,e)}var d=b.document,e=b.FormData,f=function(){this.items=[]},g=b.encodeURIComponent;f.prototype={append:function(a,b,c,d){this.items.push({name:a,blob:b&&b.blob||(void 0==b?"":b),file:b&&(c||b.name),type:b&&(d||b.type)})},each:function(a){for(var b=0,c=this.items.length;c>b;b++)a.call(this,this.items[b])},toData:function(b,c){c._chunked=a.support.chunked&&c.chunkSize>0&&1==a.filter(this.items,function(a){return a.file}).length,a.support.html5?a.formData&&!this.multipart&&e?c._chunked?(a.log("FileAPI.Form.toPlainData"),this.toPlainData(b)):(a.log("FileAPI.Form.toFormData"),this.toFormData(b)):(a.log("FileAPI.Form.toMultipartData"),this.toMultipartData(b)):(a.log("FileAPI.Form.toHtmlData"),this.toHtmlData(b))},_to:function(b,c,d,e){var f=a.queue(function(){c(b)});this.each(function(g){try{d(g,b,f,e)}catch(h){a.log("FileAPI.Form._to: "+h.message),c(h)}}),f.check()},toHtmlData:function(b){this._to(d.createDocumentFragment(),b,function(b,c){var e,f=b.blob;b.file?(a.reset(f,!0),f.name=b.name,f.disabled=!1,c.appendChild(f)):(e=d.createElement("input"),e.name=b.name,e.type="hidden",e.value=f,c.appendChild(e))})},toPlainData:function(a){this._to({},a,function(a,b,d){a.file&&(b.type=a.file),a.blob.toBlob?(d.inc(),c(a,function(a,c){b.name=a.name,b.file=c,b.size=c.length,b.type=a.type,d.next()})):a.file?(b.name=a.blob.name,b.file=a.blob,b.size=a.blob.size,b.type=a.type):(b.params||(b.params=[]),b.params.push(g(a.name)+"="+g(a.blob))),b.start=-1,b.end=b.file&&b.file.FileAPIReadPosition||-1,b.retry=0})},toFormData:function(a){this._to(new e,a,function(a,b,d){a.blob&&a.blob.toBlob?(d.inc(),c(a,function(a,c){b.append(a.name,c,a.file),d.next()})):a.file?b.append(a.name,a.blob,a.file):b.append(a.name,a.blob),a.file&&b.append("_"+a.name,a.file)})},toMultipartData:function(b){this._to([],b,function(a,b,d,e){d.inc(),c(a,function(a,c){b.push("--_"+e+('\r\nContent-Disposition: form-data; name="'+a.name+'"'+(a.file?'; filename="'+g(a.file)+'"':"")+(a.file?"\r\nContent-Type: "+(a.type||"application/octet-stream"):"")+"\r\n\r\n"+(a.file?c:g(c))+"\r\n")),d.next()},!0)},a.expando)}},a.Form=f}(FileAPI,window),function(a,b){"use strict";var c=function(){},d=a.document,e=function(a){this.uid=b.uid(),this.xhr={abort:c,getResponseHeader:c,getAllResponseHeaders:c},this.options=a},f={"":1,XML:1,Text:1,Body:1};e.prototype={status:0,statusText:"",constructor:e,getResponseHeader:function(a){return this.xhr.getResponseHeader(a)},getAllResponseHeaders:function(){return this.xhr.getAllResponseHeaders()||{}},end:function(d,e){var f=this,g=f.options;f.end=f.abort=c,f.status=d,e&&(f.statusText=e),b.log("xhr.end:",d,e),g.complete(200==d||201==d?!1:f.statusText||"unknown",f),f.xhr&&f.xhr.node&&setTimeout(function(){var b=f.xhr.node;try{b.parentNode.removeChild(b)}catch(c){}try{delete a[f.uid]}catch(c){}a[f.uid]=f.xhr.node=null},9)},abort:function(){this.end(0,"abort"),this.xhr&&(this.xhr.aborted=!0,this.xhr.abort())},send:function(a){var b=this,c=this.options;a.toData(function(a){a instanceof Error?b.end(0,a.message):(c.upload(c,b),b._send.call(b,c,a))},c)},_send:function(c,e){var g,h=this,i=h.uid,j=h.uid+"Load",k=c.url;if(b.log("XHR._send:",e),c.cache||(k+=(~k.indexOf("?")?"&":"?")+b.uid()),e.nodeName){var l=c.jsonp;k=k.replace(/([a-z]+)=(\?)/i,"$1="+i),c.upload(c,h);var m=function(a){if(~k.indexOf(a.origin))try{var c=b.parseJSON(a.data);c.id==i&&n(c.status,c.statusText,c.response)}catch(d){n(0,d.message)}},n=a[i]=function(c,d,e){h.readyState=4,h.responseText=e,h.end(c,d),b.event.off(a,"message",m),a[i]=g=p=a[j]=null};h.xhr.abort=function(){try{p.stop?p.stop():p.contentWindow.stop?p.contentWindow.stop():p.contentWindow.document.execCommand("Stop")}catch(a){}n(0,"abort")},b.event.on(a,"message",m),a[j]=function(){try{var a=p.contentWindow,c=a.document,d=a.result||b.parseJSON(c.body.innerHTML);n(d.status,d.statusText,d.response)}catch(e){b.log("[transport.onload]",e)}},g=d.createElement("div"),g.innerHTML='
              '+(l&&c.url.indexOf("=?")<0?'':"")+"";var o=g.getElementsByTagName("form")[0],p=g.getElementsByTagName("iframe")[0];o.appendChild(e),b.log(o.parentNode.innerHTML),d.body.appendChild(g),h.xhr.node=g,h.readyState=2;try{o.submit()}catch(q){b.log("iframe.error: "+q)}o=null}else{if(k=k.replace(/([a-z]+)=(\?)&?/i,""),this.xhr&&this.xhr.aborted)return void b.log("Error: already aborted");if(g=h.xhr=b.getXHR(),e.params&&(k+=(k.indexOf("?")<0?"?":"&")+e.params.join("&")),g.open("POST",k,!0),b.withCredentials&&(g.withCredentials="true"),c.headers&&c.headers["X-Requested-With"]||g.setRequestHeader("X-Requested-With","XMLHttpRequest"),b.each(c.headers,function(a,b){g.setRequestHeader(b,a)}),c._chunked){g.upload&&g.upload.addEventListener("progress",b.throttle(function(a){e.retry||c.progress({type:a.type,total:e.size,loaded:e.start+a.loaded,totalSize:e.size},h,c)},100),!1),g.onreadystatechange=function(){var a=parseInt(g.getResponseHeader("X-Last-Known-Byte"),10);if(h.status=g.status,h.statusText=g.statusText,h.readyState=g.readyState,4==g.readyState){for(var d in f)h["response"+d]=g["response"+d];if(g.onreadystatechange=null,!g.status||g.status-201>0)if(b.log("Error: "+g.status),(!g.status&&!g.aborted||500==g.status||416==g.status)&&++e.retry<=c.chunkUploadRetry){var i=g.status?0:b.chunkNetworkDownRetryTimeout;c.pause(e.file,c),b.log("X-Last-Known-Byte: "+a),a?e.end=a:(e.end=e.start-1,416==g.status&&(e.end=e.end-c.chunkSize)),setTimeout(function(){h._send(c,e)},i)}else h.end(g.status);else e.retry=0,e.end==e.size-1?h.end(g.status):(b.log("X-Last-Known-Byte: "+a),a&&(e.end=a),e.file.FileAPIReadPosition=e.end,setTimeout(function(){h._send(c,e)},0));g=null}},e.start=e.end+1,e.end=Math.max(Math.min(e.start+c.chunkSize,e.size)-1,e.start);var r=e.file,s=(r.slice||r.mozSlice||r.webkitSlice).call(r,e.start,e.end+1);e.size&&!s.size?setTimeout(function(){h.end(-1)}):(g.setRequestHeader("Content-Range","bytes "+e.start+"-"+e.end+"/"+e.size),g.setRequestHeader("Content-Disposition","attachment; filename="+encodeURIComponent(e.name)),g.setRequestHeader("Content-Type",e.type||"application/octet-stream"),g.send(s)),r=s=null}else if(g.upload&&g.upload.addEventListener("progress",b.throttle(function(a){c.progress(a,h,c)},100),!1),g.onreadystatechange=function(){if(h.status=g.status,h.statusText=g.statusText,h.readyState=g.readyState,4==g.readyState){for(var a in f)h["response"+a]=g["response"+a];if(g.onreadystatechange=null,!g.status||g.status>201)if(b.log("Error: "+g.status),(!g.status&&!g.aborted||500==g.status)&&(c.retry||0)=0?a+"px":a}function d(a){var c,d=f.createElement("canvas"),e=!1;try{c=d.getContext("2d"),c.drawImage(a,0,0,1,1),e=255!=c.getImageData(0,0,1,1).data[4]}catch(g){b.log("[FileAPI.Camera] detectVideoSignal:",g)}return e}var e=a.URL||a.webkitURL,f=a.document,g=a.navigator,h=g.getUserMedia||g.webkitGetUserMedia||g.mozGetUserMedia||g.msGetUserMedia,i=!!h;b.support.media=i;var j=function(a){this.video=a};j.prototype={isActive:function(){return!!this._active},start:function(a){var b,c,f=this,i=f.video,j=function(d){f._active=!d,clearTimeout(c),clearTimeout(b),a&&a(d,f)};h.call(g,{video:!0},function(a){f.stream=a,i.src=e.createObjectURL(a),b=setInterval(function(){d(i)&&j(null)},1e3),c=setTimeout(function(){j("timeout"); },5e3),i.play()},j)},stop:function(){try{this._active=!1,this.video.pause();try{this.stream.stop()}catch(a){b.each(this.stream.getTracks(),function(a){a.stop()})}this.stream=null}catch(a){b.log("[FileAPI.Camera] stop:",a)}},shot:function(){return new k(this.video)}},j.get=function(a){return new j(a.firstChild)},j.publish=function(d,e,g){"function"==typeof e&&(g=e,e={}),e=b.extend({},{width:"100%",height:"100%",start:!0},e),d.jquery&&(d=d[0]);var h=function(a){if(a)g(a);else{var b=j.get(d);e.start?b.start(g):g(null,b)}};if(d.style.width=c(e.width),d.style.height=c(e.height),b.html5&&i){var k=f.createElement("video");k.style.width=c(e.width),k.style.height=c(e.height),a.jQuery?jQuery(d).empty():d.innerHTML="",d.appendChild(k),h()}else j.fallback(d,e,h)},j.fallback=function(a,b,c){c("not_support_camera")};var k=function(a){var c=a.nodeName?b.Image.toCanvas(a):a,d=b.Image(c);return d.type="image/png",d.width=c.width,d.height=c.height,d.size=c.width*c.height*4,d};j.Shot=k,b.Camera=j}(window,FileAPI),function(a,b,c){"use strict";var d=a.document,e=a.location,f=a.navigator,g=c.each;c.support.flash=function(){var b=f.mimeTypes,d=!1;if(f.plugins&&"object"==typeof f.plugins["Shockwave Flash"])d=f.plugins["Shockwave Flash"].description&&!(b&&b["application/x-shockwave-flash"]&&!b["application/x-shockwave-flash"].enabledPlugin);else try{d=!(!a.ActiveXObject||!new ActiveXObject("ShockwaveFlash.ShockwaveFlash"))}catch(g){c.log("Flash -- does not supported.")}return d&&/^file:/i.test(e)&&c.log("[warn] Flash does not work on `file:` protocol."),d}(),c.support.flash&&(!c.html5||!c.support.html5||c.cors&&!c.support.cors||c.media&&!c.support.media)&&function(){function h(a){return('').replace(/#(\w+)#/gi,function(b,c){return a[c]})}function i(a,b){if(a&&a.style){var c,d;for(c in b){d=b[c],"number"==typeof d&&(d+="px");try{a.style[c]=d}catch(e){}}}}function j(a,b){g(b,function(b,c){var d=a[c];a[c]=function(){return this.parent=d,b.apply(this,arguments)}})}function k(a){return a&&!a.flashId}function l(a){var b=a.wid=c.uid();return v._fn[b]=a,"FileAPI.Flash._fn."+b}function m(a){try{v._fn[a.wid]=null,delete v._fn[a.wid]}catch(b){}}function n(a,b){if(!u.test(a)){if(/^\.\//.test(a)||"/"!=a.charAt(0)){var c=e.pathname;c=c.substr(0,c.lastIndexOf("/")),a=(c+"/"+a).replace("/./","/")}"//"!=a.substr(0,2)&&(a="//"+e.host+a),u.test(a)||(a=e.protocol+a)}return b&&(a+=(/\?/.test(a)?"&":"?")+b),a}function o(a,b,e){function f(){try{var a=v.get(j);a.setImage(b)}catch(d){c.log('[err] FlashAPI.Preview.setImage -- can not set "base64":',d)}}var g,j=c.uid(),k=d.createElement("div"),o=10;for(g in a)k.setAttribute(g,a[g]),k[g]=a[g];i(k,a),a.width="100%",a.height="100%",k.innerHTML=h(c.extend({id:j,src:n(c.flashImageUrl,"r="+c.uid()),wmode:"opaque",flashvars:"scale="+a.scale+"&callback="+l(function p(){return m(p),--o>0&&f(),!0})},a)),e(!1,k),k=null}function p(a){return{id:a.id,name:a.name,matrix:a.matrix,flashId:a.flashId}}function q(b){var c=b.getBoundingClientRect(),e=d.body,f=(b&&b.ownerDocument).documentElement;return{top:c.top+(a.pageYOffset||f.scrollTop)-(f.clientTop||e.clientTop||0),left:c.left+(a.pageXOffset||f.scrollLeft)-(f.clientLeft||e.clientLeft||0),width:c.right-c.left,height:c.bottom-c.top}}var r=c.uid(),s=0,t={},u=/^https?:/i,v={_fn:{},init:function(){var a=d.body&&d.body.firstChild;if(a)do if(1==a.nodeType){c.log("FlashAPI.state: awaiting");var b=d.createElement("div");return b.id="_"+r,i(b,{top:1,right:1,width:5,height:5,position:"absolute",zIndex:"2147483647"}),a.parentNode.insertBefore(b,a),void v.publish(b,r)}while(a=a.nextSibling);10>s&&setTimeout(v.init,50*++s)},publish:function(a,b,d){d=d||{},a.innerHTML=h({id:b,src:n(c.flashUrl,"r="+c.version),wmode:d.camera?"":"transparent",flashvars:"callback="+(d.onEvent||"FileAPI.Flash.onEvent")+"&flashId="+b+"&storeKey="+f.userAgent.match(/\d/gi).join("")+"_"+c.version+(v.isReady||(c.pingUrl?"&ping="+c.pingUrl:""))+"&timeout="+c.flashAbortTimeout+(d.camera?"&useCamera="+n(c.flashWebcamUrl):"")+"&debug="+(c.debug?"1":"")},d)},ready:function(){c.log("FlashAPI.state: ready"),v.ready=c.F,v.isReady=!0,v.patch(),v.patchCamera&&v.patchCamera(),c.event.on(d,"mouseover",v.mouseover),c.event.on(d,"click",function(a){v.mouseover(a)&&(a.preventDefault?a.preventDefault():a.returnValue=!0)})},getEl:function(){return d.getElementById("_"+r)},getWrapper:function(a){do if(/js-fileapi-wrapper/.test(a.className))return a;while((a=a.parentNode)&&a!==d.body)},mouseover:function(a){var b=c.event.fix(a).target;if(/input/i.test(b.nodeName)&&"file"==b.type&&!b.disabled){var e=b.getAttribute(r),f=v.getWrapper(b);if(c.multiFlash){if("i"==e||"r"==e)return!1;if("p"!=e){b.setAttribute(r,"i");var g=d.createElement("div");if(!f)return void c.log("[err] FlashAPI.mouseover: js-fileapi-wrapper not found");i(g,{top:0,left:0,width:b.offsetWidth,height:b.offsetHeight,zIndex:"2147483647",position:"absolute"}),f.appendChild(g),v.publish(g,c.uid()),b.setAttribute(r,"p")}return!0}if(f){var h=q(f);i(v.getEl(),h),v.curInp=b}}else/object|embed/i.test(b.nodeName)||i(v.getEl(),{top:1,left:1,width:5,height:5})},onEvent:function(a){var b=a.type;if("ready"==b){try{v.getInput(a.flashId).setAttribute(r,"r")}catch(d){}return v.ready(),setTimeout(function(){v.mouseenter(a)},50),!0}"ping"===b?c.log("(flash -> js).ping:",[a.status,a.savedStatus],a.error):"log"===b?c.log("(flash -> js).log:",a.target):b in v&&setTimeout(function(){c.log("FlashAPI.event."+a.type+":",a),v[b](a)},1)},mouseenter:function(a){var b=v.getInput(a.flashId);if(b){v.cmd(a,"multiple",null!=b.getAttribute("multiple"));var d=[],e={};g((b.getAttribute("accept")||"").split(/,\s*/),function(a){c.accept[a]&&g(c.accept[a].split(" "),function(a){e[a]=1})}),g(e,function(a,b){d.push(b)}),v.cmd(a,"accept",d.length?d.join(",")+","+d.join(",").toUpperCase():"*")}},get:function(b){return d[b]||a[b]||d.embeds[b]},getInput:function(a){if(!c.multiFlash)return v.curInp;try{var b=v.getWrapper(v.get(a));if(b)return b.getElementsByTagName("input")[0]}catch(d){c.log('[err] Can not find "input" by flashId:',a,d)}},select:function(a){var e,f=v.getInput(a.flashId),h=c.uid(f),i=a.target.files;g(i,function(a){c.checkFileObj(a)}),t[h]=i,d.createEvent?(e=d.createEvent("Event"),e.files=i,e.initEvent("change",!0,!0),f.dispatchEvent(e)):b?b(f).trigger({type:"change",files:i}):(e=d.createEventObject(),e.files=i,f.fireEvent("onchange",e))},cmd:function(a,b,d,e){try{return c.log("(js -> flash)."+b+":",d),v.get(a.flashId||a).cmd(b,d)}catch(f){c.log("(js -> flash).onError:",f.toString()),e||setTimeout(function(){v.cmd(a,b,d,!0)},50)}},patch:function(){c.flashEngine=!0,j(c,{getFiles:function(a,b,d){if(d)return c.filterFiles(c.getFiles(a),b,d),null;var e=c.isArray(a)?a:t[c.uid(a.target||a.srcElement||a)];return e?(b&&(b=c.getFilesFilter(b),e=c.filter(e,function(a){return b.test(a.name)})),e):this.parent.apply(this,arguments)},getInfo:function(a,b){if(k(a))this.parent.apply(this,arguments);else if(a.isShot)b(null,a.info={width:a.width,height:a.height});else{if(!a.__info){var d=a.__info=c.defer();v.cmd(a,"getFileInfo",{id:a.id,callback:l(function e(b,c){m(e),d.resolve(b,a.info=c)})})}a.__info.then(b)}}}),c.support.transform=!0,c.Image&&j(c.Image.prototype,{get:function(a,b){return this.set({scaleMode:b||"noScale"}),this.parent(a)},_load:function(a,b){if(c.log("FlashAPI.Image._load:",a),k(a))this.parent.apply(this,arguments);else{var d=this;c.getInfo(a,function(c){b.call(d,c,a)})}},_apply:function(a,b){if(c.log("FlashAPI.Image._apply:",a),k(a))this.parent.apply(this,arguments);else{var d=this.getMatrix(a.info),e=b;v.cmd(a,"imageTransform",{id:a.id,matrix:d,callback:l(function f(g,h){c.log("FlashAPI.Image._apply.callback:",g),m(f),g?e(g):c.support.html5||c.support.dataURI&&!(h.length>3e4)?(d.filter&&(e=function(a,e){a?b(a):c.Image.applyFilter(e,d.filter,function(){b(a,this.canvas)})}),c.newImage("data:"+a.type+";base64,"+h,e)):o({width:d.deg%180?d.dh:d.dw,height:d.deg%180?d.dw:d.dh,scale:d.scaleMode},h,e)})})}},toData:function(a){var b=this.file,d=b.info,e=this.getMatrix(d);c.log("FlashAPI.Image.toData"),k(b)?this.parent.apply(this,arguments):("auto"==e.deg&&(e.deg=c.Image.exifOrientation[d&&d.exif&&d.exif.Orientation]||0),a.call(this,!b.info,{id:b.id,flashId:b.flashId,name:b.name,type:b.type,matrix:e}))}}),c.Image&&j(c.Image,{fromDataURL:function(a,b,d){!c.support.dataURI||a.length>3e4?o(c.extend({scale:"exactFit"},b),a.replace(/^data:[^,]+,/,""),function(a,b){d(b)}):this.parent(a,b,d)}}),j(c.Form.prototype,{toData:function(a){for(var b=this.items,d=b.length;d--;)if(b[d].file&&k(b[d].blob))return this.parent.apply(this,arguments);c.log("FlashAPI.Form.toData"),a(b)}}),j(c.XHR.prototype,{_send:function(a,b){if(b.nodeName||b.append&&c.support.html5||c.isArray(b)&&"string"==typeof b[0])return this.parent.apply(this,arguments);var d,e,f={},h={},i=this;if(g(b,function(a){a.file?(h[a.name]=a=p(a.blob),e=a.id,d=a.flashId):f[a.name]=a.blob}),e||(d=r),!d)return c.log("[err] FlashAPI._send: flashId -- undefined"),this.parent.apply(this,arguments);c.log("FlashAPI.XHR._send: "+d+" -> "+e),i.xhr={headers:{},abort:function(){v.cmd(d,"abort",{id:e})},getResponseHeader:function(a){return this.headers[a]},getAllResponseHeaders:function(){return this.headers}};var j=c.queue(function(){v.cmd(d,"upload",{url:n(a.url.replace(/([a-z]+)=(\?)&?/i,"")),data:f,files:e?h:null,headers:a.headers||{},callback:l(function b(d){var e=d.type,f=d.result;c.log("FlashAPI.upload."+e),"progress"==e?(d.loaded=Math.min(d.loaded,d.total),d.lengthComputable=!0,a.progress(d)):"complete"==e?(m(b),"string"==typeof f&&(i.responseText=f.replace(/%22/g,'"').replace(/%5c/g,"\\").replace(/%26/g,"&").replace(/%25/g,"%")),i.end(d.status||200)):("abort"==e||"error"==e)&&(i.end(d.status||0,d.message),m(b))})})});g(h,function(a){j.inc(),c.getInfo(a,j.next)}),j.check()}})}};c.Flash=v,c.newImage("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",function(a,b){c.support.dataURI=!(1!=b.width||1!=b.height),v.init()})}()}(window,window.jQuery,FileAPI),function(a,b,c){"use strict";var d=c.each,e=[];!c.support.flash||!c.media||c.support.media&&c.html5||!function(){function a(a){var b=a.wid=c.uid();return c.Flash._fn[b]=a,"FileAPI.Flash._fn."+b}function b(a){try{c.Flash._fn[a.wid]=null,delete c.Flash._fn[a.wid]}catch(b){}}var f=c.Flash;c.extend(c.Flash,{patchCamera:function(){c.Camera.fallback=function(d,e,g){var h=c.uid();c.log("FlashAPI.Camera.publish: "+h),f.publish(d,h,c.extend(e,{camera:!0,onEvent:a(function i(a){"camera"===a.type&&(b(i),a.error?(c.log("FlashAPI.Camera.publish.error: "+a.error),g(a.error)):(c.log("FlashAPI.Camera.publish.success: "+h),g(null)))})}))},d(e,function(a){c.Camera.fallback.apply(c.Camera,a)}),e=[],c.extend(c.Camera.prototype,{_id:function(){return this.video.id},start:function(d){var e=this;f.cmd(this._id(),"camera.on",{callback:a(function g(a){b(g),a.error?(c.log("FlashAPI.camera.on.error: "+a.error),d(a.error,e)):(c.log("FlashAPI.camera.on.success: "+e._id()),e._active=!0,d(null,e))})})},stop:function(){this._active=!1,f.cmd(this._id(),"camera.off")},shot:function(){c.log("FlashAPI.Camera.shot:",this._id());var a=c.Flash.cmd(this._id(),"shot",{});return a.type="image/png",a.flashId=this._id(),a.isShot=!0,new c.Camera.Shot(a)}})}}),c.Camera.fallback=function(){e.push(arguments)}}()}(window,window.jQuery,FileAPI),"function"==typeof define&&define.amd&&define("FileAPI",[],function(){return FileAPI}); \ No newline at end of file diff --git a/manager/media/browser/mcpuk/js/FileAPI/crossdomain.xml.example b/manager/media/browser/mcpuk/js/FileAPI/crossdomain.xml.example index 41503ae378..32920c4f07 100644 --- a/manager/media/browser/mcpuk/js/FileAPI/crossdomain.xml.example +++ b/manager/media/browser/mcpuk/js/FileAPI/crossdomain.xml.example @@ -1,9 +1,9 @@ - - - - - - - - - + + + + + + + + + diff --git a/manager/media/browser/mcpuk/js/FileAPI/jquery.fileapi.min.js b/manager/media/browser/mcpuk/js/FileAPI/jquery.fileapi.min.js index 8cd6472513..ec7369ec59 100644 --- a/manager/media/browser/mcpuk/js/FileAPI/jquery.fileapi.min.js +++ b/manager/media/browser/mcpuk/js/FileAPI/jquery.fileapi.min.js @@ -1,2 +1,2 @@ -/*! fileapi 2.0.1 - BSD | git://github.com/mailru/FileAPI.git */ +/*! fileapi 2.0.1 - BSD | git://github.com/mailru/FileAPI.git */ (function(e,t){"use strict";var n=e.noop,i=!e.fn.prop,a=i?"attr":"prop",r="data-fileapi",o="data-fileapi-id",s=function(i,a){if(this.$el=i=e(i).on("change.fileapi",e.proxy(this,"_onSelect")),this.el=i[0],this._options={},this.options=a=e.extend({url:0,data:{},accept:0,multiple:!1,paramName:0,dataType:"json",duplicate:!1,chunkSize:0,chunkUploadRetry:3,maxSize:0,maxFiles:0,imageSize:0,sortFn:0,filterFn:0,autoUpload:!1,lang:{B:"bytes",KB:"KB",MB:"MB",GB:"GB",TB:"TB"},sizeFormat:"0.00",imageTransform:0,elements:{ctrl:{upload:'[data-fileapi="ctrl.upload"]',reset:'[data-fileapi="ctrl.reset"]',abort:'[data-fileapi="ctrl.abort"]'},empty:{show:'[data-fileapi="empty.show"]',hide:'[data-fileapi="empty.hide"]'},emptyQueue:{show:'[data-fileapi="emptyQueue.show"]',hide:'[data-fileapi="emptyQueue.hide"]'},active:{show:'[data-fileapi="active.show"]',hide:'[data-fileapi="active.hide"]'},size:'[data-fileapi="size"]',name:'[data-fileapi="name"]',progress:'[data-fileapi="progress"]',file:{tpl:'[data-fileapi="file.tpl"]',progress:'[data-fileapi="file.progress"]',active:{show:'[data-fileapi="active.show"]',hide:'[data-fileapi="active.hide"]'},preview:{el:0,get:0,width:0,height:0,processing:0}},dnd:{el:'[data-fileapi="dnd"]',hover:"dnd_hover"}},onDrop:n,onDropHover:n,onSelect:n,onUpload:n,onProgress:n,onComplete:n,onFileUpload:n,onFileProgress:n,onFileComplete:n},a),!a.url){var o=this.$el.attr("action")||this.$el.find("form").attr("action");o?a.url=o:this._throw("url — is not defined")}this.$files=this.elem("list"),this.itemTplFn=e.fn.fileapi.tpl(e("
              ").append(this.elem("file.tpl")).html()),t.each(a,function(e,t){this._setOption(t,e)},this),this.$el.on("reset.fileapi",e.proxy(this,"_onReset")).on("submit.fileapi",e.proxy(this,"_onSubmit")).on("upload.fileapi progress.fileapi complete.fileapi",e.proxy(this,"_onUploadEvent")).on("fileupload.fileapi fileprogress.fileapi filecomplete.fileapi",e.proxy(this,"_onFileUploadEvent")).on("click","["+r+"]",e.proxy(this,"_onActionClick"));var s=a.elements.ctrl;s&&(s.reset&&this.$el.on("click.fileapi",s.reset,e.proxy(this,"_onReset")),s.upload&&this.$el.on("click.fileapi",s.upload,e.proxy(this,"_onSubmit"))),this.elem("dnd.el",!0).dnd(e.proxy(this,"_onDropHover"),e.proxy(this,"_onDrop")),this.$progress=this.elem("progress"),this._crop={},this._rotate={},this.files=[],this.uploaded=[],this.clear()};s.prototype={constructor:s,_throw:function(e){throw"jquery.fileapi: "+e},_getFiles:function(e,n){var i=this.options,a=i.maxSize,r=i.filterFn,o=t.getFiles(e),s={all:o,files:[],other:[],duplicate:i.duplicate?[]:this._extractDuplicateFiles(o)},l=i.imageSize,u=this;l||r?t.filterFiles(o,function(e,t){var n=!0;return t&&l&&(n=(!l.minWidth||t.width>=l.minWidth)&&(!l.minHeight||t.height>=l.minHeight)&&(!l.maxWidth||t.height<=l.maxWidth)&&(!l.maxHeight||t.height<=l.maxHeight)),n&&(!a||a>=e.size)&&(!r||r(e,t))},function(e,t){s.files=e,s.other=t,n.call(u,s)}):(t.each(o,function(e){s[!a||a>=e.size?"files":"other"].push(e)}),n.call(u,s))},_extractDuplicateFiles:function(e){for(var t,n=[],i=e.length,a=this.files;i--;)for(t=a.length;t--;)if(this._fileCompare(e[i],a[t])){n.push(e.splice(i,1));break}return n},_fileCompare:function(e,t){return e.size==t.size&&e.name==t.name},_getFormatedSize:function(e){var n=this.options,i="B";return e>=t.TB?e/=t[i="TB"]:e>=t.GB?e/=t[i="GB"]:e>=t.MB?e/=t[i="MB"]:e>=t.KB&&(e/=t[i="KB"]),n.sizeFormat.replace(/^\d+([^\d]+)(\d*)/,function(t,a,r){return e=e.toFixed(r.length),(e+"").replace(".",a)+" "+n.lang[i]})},_onSelect:function(t){this._getFiles(t,e.proxy(function(e){e.all.length&&this.emit("select",e)!==!1&&this.add(e.files)},this))},_onActionClick:function(n){var i=n.currentTarget,a=e.attr(i,r),s=e(i).closest("["+o+"]",this.$el),l=s.attr(o),u=!0;"remove"==a?(s.remove(),this.queue=t.filter(this.queue,function(e){return t.uid(e)!=l}),this.files=t.filter(this.files,function(e){return t.uid(e)!=l}),this._redraw()):/^rotate/.test(a)?this.rotate(l,/ccw/.test(a)?"-=90":"+=90"):u=!1,u&&n.preventDefault()},_onSubmit:function(e){this.upload(),e.preventDefault()},_onReset:function(e){this.clear(),e.preventDefault()},_onDrop:function(e){this._getFiles(e,function(e){this.emit("drop",e)!==!1&&this.add(e.files)})},_onDropHover:function(t,n){if(this.emit("dropHover",{state:t,event:n})!==!1){var i=this.option("elements.dnd.hover");i&&e(n.currentTarget).toggleClass(i,t)}},_getUploadEvent:function(t){var n=this.xhr,i={xhr:n,file:n.currentFile,files:n.files,widget:this};return e.extend(i,t)},_emitUploadEvent:function(e){var t=this._getUploadEvent();this.emit(e+"upload",t)},_emitProgressEvent:function(e,t){var n=this._getUploadEvent(t);this.emit(e+"progress",n)},_emitCompleteEvent:function(t,n){var i=this.xhr,a=this._getUploadEvent({error:n,status:i.status,statusText:i.statusText,result:i.responseText});"json"==this.options.dataType&&(a.result=e.parseJSON(a.result)),this.emit(t+"complete",a)},_onUploadEvent:function(e,t){var n=this,i=this.$progress,a=e.type;if("progress"==a)i.stop().animate({width:100*(t.loaded/t.total)+"%"},300);else if("upload"==a)i.width(0);else{var r=function(){i.dequeue(),n.clear()};this.xhr=null,this.active=!1,i.length?i.queue(r):r()}},_onFileUploadPrepare:function(n,i){var a=t.uid(n),r=this._rotate[a],o=this._crop[a];if(r||o){var s=i.imageTransform=i.imageTransform||{};e.isEmptyObject(s)||parseInt(s.maxWidth||s.minWidth||s.width,10)>0||s.type||s.quality?(s.crop=o,s.rotate=r):t.each(s,function(e){e.crop=o,e.rotate=r})}},_onFileUploadEvent:function(e,n){var i=this,a=e.type.substr(4),o=t.uid(n.file),s=this.fileElem(o),l=this._$fileprogress;if(this.__fileId!==o&&(this.__fileId=o,this._$fileprogress=l=s.find(this.option("elements.file.progress"))),"progress"==a)l.stop().animate({width:100*(n.loaded/n.total)+"%"},300);else if("upload"==a||"complete"==a){var u=function(){var e="elements.file."+a;"upload"==a&&(s.find("["+r+'="remove"]').hide(),l.width(0)),l.dequeue(),s.find(i.option(e+".show")).show(),s.find(i.option(e+".hide")).hide()};l.length?l.queue(u):u(),"complete"==a&&(this.uploaded.push(n.file),delete this._rotate[o])}},_redraw:function(){var n=!!this.active,i=this.files,r=!i.length&&!n,s=!this.queue.length&&!n,l=[],u=0,c=this.$files,f=c.children().length,d=this.option("elements.file.preview");t.each(i,function(n,i){var a=t.uid(n);if(l.push(n.name),u+=n.size,c.length&&!this.fileElem(a).length){var r=this.itemTplFn({$idx:f+i,uid:n.uid,name:n.name,type:n.type,size:n.size,sizeText:this._getFormatedSize(n.size)});c.append(e(r).attr(o,a)),d.el&&this._makeFilePreview(a,n,d)}},this),this.elem("name").text(l.join(", ")),this.elem("size").text(this._getFormatedSize(u)),this.__empty!==r&&(this.__empty=r,this.elem("empty.show").toggle(r),this.elem("empty.hide").toggle(!r)),this.__emptyQueue!==s&&(this.__emptyQueue=r,this.elem("emptyQueue.show").toggle(s),this.elem("emptyQueue.hide").toggle(!s)),this.__active!==n&&(this.__active=n,this.elem("active.show").toggle(n),this.elem("active.hide").toggle(!n),this.$(".js-fileapi-wrapper,:file")[n?"attr":"removeAttr"]("aria-disabled",n)[a]("disabled",n)),this.elem("ctrl.upload").add(this.elem("ctrl.reset"))[r||n?"attr":"removeAttr"]("aria-disabled",r||n)[a]("disabled",r||n)},_makeFilePreview:function(e,n,i,a){var r=this,o=a?r.$(i.el):r.fileElem(e).find(i.el);if(/^image/.test(n.type)){t.log("_makeFilePreview:",e,n);var s=t.Image(n),l=function(){s.get(function(t,a){r._crop[e]||(t?(i.get&&i.get(o,n),r.emit("filePreviewError",{error:t,file:n})):o.html(a))})};i.width&&s.preview(i.width,i.height),i.rotate&&s.rotate(i.rotate),i.processing?i.processing(n,s,l):l()}else i.get&&i.get(o,n)},emit:function(t,n){var i,a=this.options,r=e.Event(t);return r.widget=this,t=e.camelCase("on-"+t.replace(/(file)(upload)/,"$1-$2")),e.isFunction(a[t])&&(i=a[t].call(this.el,r,n)),i!==!1&&this.$el.triggerHandler(r,n)},add:function(e){if(e.length){var n=this.options,i=n.sortFn,a=n.elements.preview;i&&e.sort(i),a&&a.el&&t.each(e,function(e){this._makeFilePreview(t.uid(e),e,a,!0)},this),this.xhr&&this.xhr.append(e),this.queue=this.queue.concat(e),this.files=this.files.concat(e),this.options.autoUpload?this.upload():this._redraw()}},$:function(t,n){return"string"==typeof t&&(t=/^#/.test(t)?t:(n?e(n):this.$el).find(t)),e(t)},elem:function(t,n){var i=this.option("elements."+t);return void 0===i&&n&&(i=this.option("elements."+t.substr(0,t.lastIndexOf(".")))),this.$("string"!=e.type(i)&&e.isEmptyObject(i)?[]:i)},fileElem:function(e){return this.$("["+o+'="'+e+'"]')},option:function(n,i){if(void 0!==i&&e.isPlainObject(i))return t.each(i,function(e,t){this.option(n+"."+t,e)},this),this;var a,r,o=this.options,s=o[n],l=0;if(-1!=n.indexOf("."))for(s=o,n=n.split("."),a=n.length;a>l;l++){if(r=n[l],void 0!==i&&1===a-l){s[r]=i;break}void 0===s[r]&&(s[r]={}),s=s[r]}else void 0!==i&&(o[n]=i);return void 0!==i&&(this._setOption(n,i,this._options[n]),this._options[n]=i),void 0!==i?i:s},_setOption:function(e,t){switch(e){case"accept":case"multiple":case"paramName":"paramName"==e&&(e="name"),t&&this.$(":file")[a](e,t)}},serialize:function(){var t,n={};return this.$el.find(":input").each(function(i,a){(i=a.name)&&!a.disabled&&(a.checked||/select|textarea|input/i.test(a.nodeName)&&/checkbox|radio/i.test(a.type))&&(t=e(a).val(),void 0!==n[i]?(n[i].push||(n[i]=[n[i]]),n[i].push(t)):n[i]=t)}),n},upload:function(){if(!this.active){this.active=!0;var n=this.$el,i=this.options,a={},r={url:i.url,data:e.extend({},this.serialize(),i.data),files:a,chunkSize:0|i.chunkSize,chunkUploadRetry:0|i.chunkUploadRetry,prepare:e.proxy(this,"_onFileUploadPrepare"),imageTransform:i.imageTransform};a[n.find(":file").attr("name")||"files[]"]=this.queue,t.each(["upload","progress","complete"],function(t){r[t]=e.proxy(this,e.camelCase("_emit-"+t+"Event"),""),r["file"+t]=e.proxy(this,e.camelCase("_emit-"+t+"Event"),"file")},this),this.xhr=t.upload(r),this._redraw()}},crop:function(n,i){var a=t.uid(n),r=this.options,o=r.multiple?this.option("elements.file.preview"):r.elements.preview,s=(r.multiple?this.fileElem(a):this.$el).find(o&&o.el);s.length&&t.getInfo(n,e.proxy(function(a,r){if(!a){s.find("div>div").length||s.html(e("
              ").css(o).css("overflow","hidden")),this.__cropFile!==n&&(this.__cropFile=n,t.Image(n).get(function(t,n){s.find(">div>div").html(e(n).width("100%").height("100%"))},"exactFit"));var l=o.width/i.w,u=o.height/i.h;s.find(">div>div").css({width:Math.round(l*r.width),height:Math.round(u*r.height),marginLeft:-Math.round(l*i.x),marginTop:-Math.round(u*i.y)})}},this)),this._crop[a]=i},rotate:function(e,n){var i="object"==typeof e?t.uid(e):e,a=this.options,r=a.multiple?this.option("elements.file.preview"):a.elements.preview,o=(a.multiple?this.fileElem(i):this.$el).find(r&&r.el),s=this._rotate;/([+-])=/.test(n)?n=s[i]=(s[i]||0)+("+"==RegExp.$1?1:-1)*n.substr(2):s[i]=n,o.css({"-webkit-transform":"rotate("+n+"deg)","-moz-transform":"rotate("+n+"deg)",transform:"rotate("+n+"deg)"})},clear:function(){this.queue=[],this._redraw()},widget:function(){return this},destroy:function(){this.$el.off(".fileapi").removeData("fileapi")}},e.fn.fileapi=function(t,n){var i=this.data("fileapi");if(i){if("widget"===t)return i;if("string"==typeof t){var a,r=i[t];return e.isFunction(r)?a=r.call(i,n,arguments[2]):void 0===r&&(a=this.option(t,n)),void 0===a?this:a}}else this.data("fileapi",new s(this,t));return this},e.fn.fileapi.version="0.1.0",e.fn.fileapi.tpl=function(e){var t=0,n="__b+='";return e.replace(/(?:<|<)%([-=])?([\s\S]+?)%(?:>|>)|$/g,function(i,a,r,o){return n+=e.slice(t,o).replace(/[\r\n"']/g,function(e){return"\\"+e}),r&&(n+=a?"'+\n((__x=("+r+"))==null?'':"+("-"==a?"__esc(__x)":"__x")+")\n+'":"';\n"+r+"\n__b+='"),t=o+i.length,i}),Function("ctx","var __x,__b='',__esc=function(val){return typeof val=='string'?val.replace(/ - * @copyright 2010-2014 KCFinder Project - * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 - * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 - * @link http://kcfinder.sunhater.com - */ - +/** This file is part of KCFinder project + * + * @desc FileAPI uploader + * @package KCFinder + * @version 2.54 + * @author Pavel Tzonkov + * @copyright 2010-2014 KCFinder Project + * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 + * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 + * @link http://kcfinder.sunhater.com + */ + browser.initUploader = function() { var btn = $('#toolbar a[href="kcact:upload"]'); if (!this.access.files.upload) { btn.css('display', 'none'); return; - } - $('#toolbar').prepend(''); - var upload = $('input[name="upload"]', '#toolbar'); - btn.click(function(e){ - e.preventDefault(); - browser.clearUpload(); - upload.trigger('click'); - }); + } + $('#toolbar').prepend(''); + var upload = $('input[name="upload"]', '#toolbar'); + btn.click(function(e){ + e.preventDefault(); + browser.clearUpload(); + upload.trigger('click'); + }); FileAPI.event.on(upload.get(0), 'change', function (evt){ var files = FileAPI.getFiles(evt); // Retrieve file list browser.prepareFiles(files); @@ -221,116 +221,116 @@ browser.clearUpload = function() { upload.wrap('
              ').closest('form').get(0).reset(); upload.unwrap(); }; -browser.prepareFiles = function(files) { - FileAPI.filterFiles( - files, - function(file) { - var ext = file.name.split('.').pop().toLowerCase(); - var result = browser.allowedExts.test(ext) && !browser.deniedExts.test(ext); - if (!result) { - file.message = browser.label("Denied file extension."); - } - if (result) { - result = browser.maxFileSize > file.size; - if (!result) { - file.message = browser.label("The uploaded file exceeds {size} bytes.", {size: browser.maxFileSize}); - } - } - return result; - }, function (files, rejected) { - if (rejected.length > 0) { - var messages = []; - $.each(rejected, function(i, file) { - messages.push(file.name + ': ' +file.message); - }); - browser.alert(messages.join('
              '), true, function(){browser.uploadFiles(files)}); - } else { - browser.uploadFiles(files); - } - } - ); -}; -browser.uploadFiles = function(files) { - if (!this.dirWritable) { - browser.alert(this.label("Cannot write to upload folder.")); - return; - } - var uploadInProgress = false, - filesCount = 0, - errors = [], - uploaded = 0; - if( files.length ){ - filesCount = files.length; - var options = { - url: browser.baseGetData('upload'), - files: { file: files }, - data: { - dir: browser.dir - }, - imageAutoOrientation: false, - prepare: function (file/**Object*/, options/**Object*/){ - if (file.type !== 'image/jpeg' && file.type !== 'image/png') { - options.imageTransform = false; - } - }, - upload: function() { - $('#loading').html(browser.label("Uploading file {number} of {count}... {progress}", { - number: uploaded++, - count: filesCount, - progress: "" - })); - uploadInProgress = true; - $('#loading').show(); - browser.fadeFiles(); - }, - progress: function (evt){ - var progress = Math.round((evt.loaded * 100) / evt.total) + '%'; - $('#loading').html(browser.label("Uploading file {number} of {count}... {progress}", { - number: uploaded, - count: filesCount, - progress: progress - })); - }, - filecomplete:function(err, xhr, file) { - if(err === false) { - var response; - try { - response = $.parseJSON(xhr.response); - } catch (error) { - response = { - success:false, - message:browser.label("Unable to process server response") - } - } - if (!response.success) { - if (typeof response.message === 'object') { - response.message = response.message.join('; '); - }; - errors.push(file.name + ': ' + response.message); - } - } else { - errors.push(file.name + ': ' + browser.label("Server error") + ' ' + err); - } - uploaded++; - }, - complete: function (err, xhr){ - uploadInProgress = false; - $('#loading').hide(); - browser.refresh(); - browser.clearUpload(); - if (errors.length > 0) { - browser.alert(errors.join('
              '), false); - } - } - }; - if (Object.keys(browser.clientResize).length) { - options.imageTransform = { - maxWidth: browser.clientResize.maxWidth, - maxHeight: browser.clientResize.maxHeight, - quality: browser.clientResize.quality - }; - options.imageAutoOrientation = true; - } - FileAPI.upload(options); - } -}; +browser.prepareFiles = function(files) { + FileAPI.filterFiles( + files, + function(file) { + var ext = file.name.split('.').pop().toLowerCase(); + var result = browser.allowedExts.test(ext) && !browser.deniedExts.test(ext); + if (!result) { + file.message = browser.label("Denied file extension."); + } + if (result) { + result = browser.maxFileSize > file.size; + if (!result) { + file.message = browser.label("The uploaded file exceeds {size} bytes.", {size: browser.maxFileSize}); + } + } + return result; + }, function (files, rejected) { + if (rejected.length > 0) { + var messages = []; + $.each(rejected, function(i, file) { + messages.push(file.name + ': ' +file.message); + }); + browser.alert(messages.join('
              '), true, function(){browser.uploadFiles(files)}); + } else { + browser.uploadFiles(files); + } + } + ); +}; +browser.uploadFiles = function(files) { + if (!this.dirWritable) { + browser.alert(this.label("Cannot write to upload folder.")); + return; + } + var uploadInProgress = false, + filesCount = 0, + errors = [], + uploaded = 0; + if( files.length ){ + filesCount = files.length; + var options = { + url: browser.baseGetData('upload'), + files: { file: files }, + data: { + dir: browser.dir + }, + imageAutoOrientation: false, + prepare: function (file/**Object*/, options/**Object*/){ + if (file.type !== 'image/jpeg' && file.type !== 'image/png') { + options.imageTransform = false; + } + }, + upload: function() { + $('#loading').html(browser.label("Uploading file {number} of {count}... {progress}", { + number: uploaded++, + count: filesCount, + progress: "" + })); + uploadInProgress = true; + $('#loading').show(); + browser.fadeFiles(); + }, + progress: function (evt){ + var progress = Math.round((evt.loaded * 100) / evt.total) + '%'; + $('#loading').html(browser.label("Uploading file {number} of {count}... {progress}", { + number: uploaded, + count: filesCount, + progress: progress + })); + }, + filecomplete:function(err, xhr, file) { + if(err === false) { + var response; + try { + response = $.parseJSON(xhr.response); + } catch (error) { + response = { + success:false, + message:browser.label("Unable to process server response") + } + } + if (!response.success) { + if (typeof response.message === 'object') { + response.message = response.message.join('; '); + }; + errors.push(file.name + ': ' + response.message); + } + } else { + errors.push(file.name + ': ' + browser.label("Server error") + ' ' + err); + } + uploaded++; + }, + complete: function (err, xhr){ + uploadInProgress = false; + $('#loading').hide(); + browser.refresh(); + browser.clearUpload(); + if (errors.length > 0) { + browser.alert(errors.join('
              '), false); + } + } + }; + if (Object.keys(browser.clientResize).length) { + options.imageTransform = { + maxWidth: browser.clientResize.maxWidth, + maxHeight: browser.clientResize.maxHeight, + quality: browser.clientResize.quality + }; + options.imageAutoOrientation = true; + } + FileAPI.upload(options); + } +}; diff --git a/manager/media/browser/mcpuk/js/customEvent.js b/manager/media/browser/mcpuk/js/customEvent.js index a892baa31e..5a0ff4b75a 100644 --- a/manager/media/browser/mcpuk/js/customEvent.js +++ b/manager/media/browser/mcpuk/js/customEvent.js @@ -1,15 +1,15 @@ -(function () { - if (typeof window.CustomEvent === "function") { - return false; - } - - function CustomEvent(event, params) { - params = params || {bubbles: false, cancelable: false, detail: undefined}; - var evt = document.createEvent("CustomEvent"); - evt.initCustomEvent (event, params.bubbles, params.cancelable, params.detail); - return evt; - } - - CustomEvent.prototype = window.Event.prototype; - window.CustomEvent = CustomEvent; -})(); +(function () { + if (typeof window.CustomEvent === "function") { + return false; + } + + function CustomEvent(event, params) { + params = params || {bubbles: false, cancelable: false, detail: undefined}; + var evt = document.createEvent("CustomEvent"); + evt.initCustomEvent (event, params.bubbles, params.cancelable, params.detail); + return evt; + } + + CustomEvent.prototype = window.Event.prototype; + window.CustomEvent = CustomEvent; +})(); diff --git a/manager/media/browser/mcpuk/lib/class_gd.php b/manager/media/browser/mcpuk/lib/class_gd.php index 95975b8a47..bbb2583346 100755 --- a/manager/media/browser/mcpuk/lib/class_gd.php +++ b/manager/media/browser/mcpuk/lib/class_gd.php @@ -1,424 +1,424 @@ - - * @copyright 2010, 2011 KCFinder Project - * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 - * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 - * @link http://kcfinder.sunhater.com - */ - -class gd { - - /** GD resource - * @var resource */ - protected $image; - - /** Image width - * @var integer */ - protected $width; - - /** Image height - * @var integer */ - protected $height; - - /** Init error - * @var bool */ - public $init_error = false; - - /** Last builded image type constant (IMAGETYPE_XXX) - * @var integer */ - public $type; - - /** Returns an array. Element 0 - GD resource. Element 1 - width. Element 2 - height. - * Returns FALSE on failure. The only one parameter $image can be an instance of this class, - * a GD resource, an array(width, height) or path to image file. - * @param mixed $image - * @return array */ - - protected function build_image($image) { - - if ($image instanceof gd) { - $width = $image->get_width(); - $height = $image->get_height(); - $image = $image->get_image(); - - } elseif (is_resource($image) && (get_resource_type($image) == "gd")) { - $width = @imagesx($image); - $height = @imagesy($image); - - } elseif (is_array($image)) { - $height = $width = end($image); - $image = imagecreatetruecolor($width, $height); - - } elseif (false !== (list($width, $height, $type) = @getimagesize($image))) { - $image = - ($type == IMAGETYPE_GIF) ? @imagecreatefromgif($image) : ( - ($type == IMAGETYPE_WBMP) ? @imagecreatefromwbmp($image) : ( - ($type == IMAGETYPE_JPEG) ? @imagecreatefromjpeg($image) : ( - ($type == IMAGETYPE_JPEG2000) ? @imagecreatefromjpeg($image) : ( - ($type == IMAGETYPE_PNG) ? @imagecreatefrompng($image) : ( - ($type == IMAGETYPE_XBM) ? @imagecreatefromxbm($image) : false - ))))); - - if ($type == IMAGETYPE_PNG) - imagealphablending($image, false); - } - - $return = ( - is_resource($image) && - (get_resource_type($image) == "gd") && - isset($width) && - isset($height) && - (preg_match('/^[1-9][0-9]*$/', $width) !== false) && - (preg_match('/^[1-9][0-9]*$/', $height) !== false) - ) - ? [$image, $width, $height] - : false; - - if (($return !== false) && isset($type)) - $this->type = $type; - - return $return; - } - - /** Parameter $image can be: - * 1. An instance of this class (copy instance). - * 2. A GD resource. - * 3. An array with two elements. First - width, second - height. Create a blank image. - * 4. A filename string. Get image form file. - * The non-required parameter $bigger_size is the bigger dimension (width or height) the image - * will be resized to. The other dimension (height or width) will be calculated autamaticaly - * @param mixed $image - * @param integer $bigger_size - * @return gd */ - - public function __construct($image, $bigger_size=null) { - $this->image = $this->width = $this->height = null; - - $image_details = $this->build_image($image); - - if ($image_details !== false) - list($this->image, $this->width, $this->height) = $image_details; - else - $this->init_error = true; - - if (!is_null($this->image) && - !is_null($bigger_size) && - (preg_match('/^[1-9][0-9]*$/', $bigger_size) !== false) - ) { - $image = $this->image; - list($width, $height) = $this->get_prop_size($bigger_size); - $this->image = imagecreatetruecolor($width, $height); - imagealphablending($this->image, false); - imagesavealpha($this->image, true); - $this->width = $width; - $this->height = $height; - $this->imagecopyresampled($image); - } - } - - /** Returns the GD resource - * @return resource */ - - public function get_image() { - return $this->image; - } - - /** Returns the image width - * @return integer */ - - public function get_width() { - return $this->width; - } - - /** Returns the image height - * @return integer */ - - public function get_height() { - return $this->height; - } - - /** Returns calculated proportional width from the given height - * @param integer $resized_height - * @return integer */ - - public function get_prop_width($resized_height) { - $width = intval(($this->width * $resized_height) / $this->height); - if (!$width) $width = 1; - return $width; - } - - /** Returns calculated proportional height from the given width - * @param integer $resized_width - * @return integer */ - - public function get_prop_height($resized_width) { - $height = intval(($this->height * $resized_width) / $this->width); - if (!$height) $height = 1; - return $height; - } - - /** Returns an array with calculated proportional width & height. - * The parameter $bigger_size is the bigger dimension (width or height) of calculated sizes. - * The other dimension (height or width) will be calculated autamaticaly - * @param integer $bigger_size - * @return array */ - - public function get_prop_size($bigger_size) { - - if ($this->width > $this->height) { - $width = $bigger_size; - $height = $this->get_prop_height($width); - - } elseif ($this->height > $this->width) { - $height = $bigger_size; - $width = $this->get_prop_width($height); - - } else - $width = $height = $bigger_size; - - return [$width, $height]; - } - - /** Resize image. Returns TRUE on success or FALSE on failure - * @param integer $width - * @param integer $height - * @return bool */ - - public function resize($width, $height) { - if (!$width) $width = 1; - if (!$height) $height = 1; - return ( - (false !== ($img = new gd([$width, $height]))) && - $img->imagecopyresampled($this) && - (false !== ($this->image = $img->get_image())) && - (false !== ($this->width = $img->get_width())) && - (false !== ($this->height = $img->get_height())) - ); - } - - /** Resize the given image source (GD, gd object or image file path) to fit in the own image. - * The outside ares will be cropped out. Returns TRUE on success or FALSE on failure - * @param mixed $src - * @return bool */ - - public function resize_crop($src) { - $image_details = $this->build_image($src); - - if ($image_details !== false) { - list($src, $src_width, $src_height) = $image_details; - - if (($src_width / $src_height) > ($this->width / $this->height)) { - $src_w = $this->get_prop_width($src_height); - $src_h = $src_height; - $src_x = intval(($src_width - $src_w) / 2); - $src_y = 0; - - } else { - $src_w = $src_width; - $src_h = $this->get_prop_height($src_width); - $src_x = 0; - $src_y = intval(($src_height - $src_h) / 2); - } - - return imagecopyresampled($this->image, $src, 0, 0, $src_x, $src_y, $this->width, $this->height, $src_w, $src_h); - - } else - return false; - } - - /** Resize image to fit in given resolution. Returns TRUE on success or FALSE on failure - * @param integer $width - * @param integer $height - * @return bool */ - - public function resize_fit($width, $height) { - if ((!$width && !$height) || (($width == $this->width) && ($height == $this->height))) - return true; - if (!$width || (($height / $width) < ($this->height / $this->width))) - $width = intval(($this->width * $height) / $this->height); - elseif (!$height || (($width / $height) < ($this->width / $this->height))) - $height = intval(($this->height * $width) / $this->width); - if (!$width) $width = 1; - if (!$height) $height = 1; - return $this->resize($width, $height); - } - - /** Neka si predstavim vyobrazhaem pravoygylnik s razmeri $width i $height. - * Izobrazhenieto shte se preorazmeri taka che to shte izliza ot tozi pravoygylnik, - * no samo po edno (x ili y) izmerenie - * @param integer $width - * @param integer $height - * @return bool */ - - public function resize_overflow($width, $height) { - - $big = (($this->width / $this->height) > ($width / $height)) - ? ($this->width * $height) / $this->height - : ($this->height * $width) / $this->width; - $big = intval($big); - - $return = ($img = new gd($this->image, $big)); - - if ($return) { - $this->image = $img->get_image(); - $this->width = $img->get_width(); - $this->height = $img->get_height(); - } - - return $return; - } - - public function gd_color() { - $args = func_get_args(); - - $expr_rgb = '/^rgb\(\s*(\d{1,3})\s*\,\s*(\d{1,3})\s*\,\s*(\d{1,3})\s*\)$/i'; - $expr_hex1 = '/^\#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i'; - $expr_hex2 = '/^\#?([0-9a-f])([0-9a-f])([0-9a-f])$/i'; - $expr_byte = '/^([01]?\d?\d|2[0-4]\d|25[0-5])$/'; - - if (!isset($args[0])) - return false; - - if (count($args[0]) == 3) { - list($r, $g, $b) = $args[0]; - - } elseif (preg_match($expr_rgb, $args[0])) { - list($r, $g, $b) = explode(" ", preg_replace($expr_rgb, "$1 $2 $3", $args[0])); - - } elseif (preg_match($expr_hex1, $args[0])) { - list($r, $g, $b) = explode(" ", preg_replace($expr_hex1, "$1 $2 $3", $args[0])); - $r = hexdec($r); - $g = hexdec($g); - $b = hexdec($b); - - } elseif (preg_match($expr_hex2, $args[0])) { - list($r, $g, $b) = explode(" ", preg_replace($expr_hex2, "$1$1 $2$2 $3$3", $args[0])); - $r = hexdec($r); - $g = hexdec($g); - $b = hexdec($b); - - } elseif ((count($args) == 3) && - preg_match($expr_byte, $args[0]) && - preg_match($expr_byte, $args[1]) && - preg_match($expr_byte, $args[2]) - ) { - list($r, $g, $b) = $args; - - } else - return false; - - return imagecolorallocate($this->image, $r, $g, $b); - } - - public function fill_color($color) { - return $this->imagefilledrectangle(0, 0, $this->width - 1, $this->height - 1, $color); - } - - -/* G D M E T H O D S */ - - public function imagecopy( - $src, - $dst_x=0, $dst_y=0, - $src_x=0, $src_y=0, - $dst_w=null, $dst_h=null, - $src_w=null, $src_h=null - ) { - $image_details = $this->build_image($src); - - if ($image_details !== false) { - list($src, $src_width, $src_height) = $image_details; - - if (is_null($dst_w)) $dst_w = $this->width - $dst_x; - if (is_null($dst_h)) $dst_h = $this->height - $dst_y; - if (is_null($src_w)) $src_w = $src_width - $src_x; - if (is_null($src_h)) $src_h = $src_height - $src_y; - return imagecopy($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h); - - } else - return false; - } - - public function imagecopyresampled( - $src, - $dst_x=0, $dst_y=0, - $src_x=0, $src_y=0, - $dst_w=null, $dst_h=null, - $src_w=null, $src_h=null - ) { - $image_details = $this->build_image($src); - - if ($image_details !== false) { - list($src, $src_width, $src_height) = $image_details; - - if (is_null($dst_w)) $dst_w = $this->width - $dst_x; - if (is_null($dst_h)) $dst_h = $this->height - $dst_y; - if (is_null($src_w)) $src_w = $src_width - $src_x; - if (is_null($src_h)) $src_h = $src_height - $src_y; - imagealphablending($this->image, false); - imagesavealpha($this->image,true); - - - - - /*** gif transparent fix - 1.10.2013 ***/ - - $transindex = imagecolortransparent($src); - $palletsize = imagecolorstotal($src); - if($transindex >= 0 && $transindex < $palletsize) { - $transcol = imagecolorsforindex($src, $transindex); - - /*** end gif transparent fix ***/ - - $transindex = imagecolorallocatealpha($this->image, $transcol['red'], $transcol['green'], $transcol['blue'], 127); - imagefilledrectangle($this->image, 0, 0, $dst_w, $dst_h, $transindex); - imagecopyresampled($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); - imagecolortransparent($this->image, $transindex); - for($y=0; $y<$dst_h; ++$y) - for($x=0; $x<$dst_w; ++$x) - if(((imagecolorat($this->image, $x, $y)>>24) & 0x7F) >= 100) imagesetpixel($this->image, $x, $y, $transindex); - imagetruecolortopalette($this->image, true, 255); - } - else { - $transparent = imagecolorallocatealpha($this->image, 255, 255, 255, 127); - imagefilledrectangle($this->image, 0, 0, $dst_w, $dst_h, $transparent); - imagecopyresampled($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); - } - return $this->image; - - } else - return false; - } - - public function imagefilledrectangle($x1, $y1, $x2, $y2, $color) { - $color = $this->gd_color($color); - if ($color === false) return false; - return imagefilledrectangle($this->image, $x1, $y1, $x2, $y2, $color); - } - - public function imagepng($filename=null, $quality=null, $filters=null) { - if (is_null($filename) && !headers_sent()) - header("Content-Type: image/png"); - @imagesavealpha($this->image, true); - return imagepng($this->image, $filename, $quality, $filters); - } - - public function imagejpeg($filename=null, $quality=75) { - if (is_null($filename) && !headers_sent()) - header("Content-Type: image/jpeg"); - return imagejpeg($this->image, $filename, $quality); - } - - public function imagegif($filename=null) { - if (is_null($filename) && !headers_sent()) - header("Content-Type: image/gif"); - @imagesavealpha($this->image, true); - return imagegif($this->image, $filename); - } -} + + * @copyright 2010, 2011 KCFinder Project + * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 + * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 + * @link http://kcfinder.sunhater.com + */ + +class gd { + + /** GD resource + * @var resource */ + protected $image; + + /** Image width + * @var integer */ + protected $width; + + /** Image height + * @var integer */ + protected $height; + + /** Init error + * @var bool */ + public $init_error = false; + + /** Last builded image type constant (IMAGETYPE_XXX) + * @var integer */ + public $type; + + /** Returns an array. Element 0 - GD resource. Element 1 - width. Element 2 - height. + * Returns FALSE on failure. The only one parameter $image can be an instance of this class, + * a GD resource, an array(width, height) or path to image file. + * @param mixed $image + * @return array */ + + protected function build_image($image) { + + if ($image instanceof gd) { + $width = $image->get_width(); + $height = $image->get_height(); + $image = $image->get_image(); + + } elseif (is_resource($image) && (get_resource_type($image) == "gd")) { + $width = @imagesx($image); + $height = @imagesy($image); + + } elseif (is_array($image)) { + $height = $width = end($image); + $image = imagecreatetruecolor($width, $height); + + } elseif (false !== (list($width, $height, $type) = @getimagesize($image))) { + $image = + ($type == IMAGETYPE_GIF) ? @imagecreatefromgif($image) : ( + ($type == IMAGETYPE_WBMP) ? @imagecreatefromwbmp($image) : ( + ($type == IMAGETYPE_JPEG) ? @imagecreatefromjpeg($image) : ( + ($type == IMAGETYPE_JPEG2000) ? @imagecreatefromjpeg($image) : ( + ($type == IMAGETYPE_PNG) ? @imagecreatefrompng($image) : ( + ($type == IMAGETYPE_XBM) ? @imagecreatefromxbm($image) : false + ))))); + + if ($type == IMAGETYPE_PNG) + imagealphablending($image, false); + } + + $return = ( + is_resource($image) && + (get_resource_type($image) == "gd") && + isset($width) && + isset($height) && + (preg_match('/^[1-9][0-9]*$/', $width) !== false) && + (preg_match('/^[1-9][0-9]*$/', $height) !== false) + ) + ? [$image, $width, $height] + : false; + + if (($return !== false) && isset($type)) + $this->type = $type; + + return $return; + } + + /** Parameter $image can be: + * 1. An instance of this class (copy instance). + * 2. A GD resource. + * 3. An array with two elements. First - width, second - height. Create a blank image. + * 4. A filename string. Get image form file. + * The non-required parameter $bigger_size is the bigger dimension (width or height) the image + * will be resized to. The other dimension (height or width) will be calculated autamaticaly + * @param mixed $image + * @param integer $bigger_size + * @return gd */ + + public function __construct($image, $bigger_size=null) { + $this->image = $this->width = $this->height = null; + + $image_details = $this->build_image($image); + + if ($image_details !== false) + list($this->image, $this->width, $this->height) = $image_details; + else + $this->init_error = true; + + if (!is_null($this->image) && + !is_null($bigger_size) && + (preg_match('/^[1-9][0-9]*$/', $bigger_size) !== false) + ) { + $image = $this->image; + list($width, $height) = $this->get_prop_size($bigger_size); + $this->image = imagecreatetruecolor($width, $height); + imagealphablending($this->image, false); + imagesavealpha($this->image, true); + $this->width = $width; + $this->height = $height; + $this->imagecopyresampled($image); + } + } + + /** Returns the GD resource + * @return resource */ + + public function get_image() { + return $this->image; + } + + /** Returns the image width + * @return integer */ + + public function get_width() { + return $this->width; + } + + /** Returns the image height + * @return integer */ + + public function get_height() { + return $this->height; + } + + /** Returns calculated proportional width from the given height + * @param integer $resized_height + * @return integer */ + + public function get_prop_width($resized_height) { + $width = intval(($this->width * $resized_height) / $this->height); + if (!$width) $width = 1; + return $width; + } + + /** Returns calculated proportional height from the given width + * @param integer $resized_width + * @return integer */ + + public function get_prop_height($resized_width) { + $height = intval(($this->height * $resized_width) / $this->width); + if (!$height) $height = 1; + return $height; + } + + /** Returns an array with calculated proportional width & height. + * The parameter $bigger_size is the bigger dimension (width or height) of calculated sizes. + * The other dimension (height or width) will be calculated autamaticaly + * @param integer $bigger_size + * @return array */ + + public function get_prop_size($bigger_size) { + + if ($this->width > $this->height) { + $width = $bigger_size; + $height = $this->get_prop_height($width); + + } elseif ($this->height > $this->width) { + $height = $bigger_size; + $width = $this->get_prop_width($height); + + } else + $width = $height = $bigger_size; + + return [$width, $height]; + } + + /** Resize image. Returns TRUE on success or FALSE on failure + * @param integer $width + * @param integer $height + * @return bool */ + + public function resize($width, $height) { + if (!$width) $width = 1; + if (!$height) $height = 1; + return ( + (false !== ($img = new gd([$width, $height]))) && + $img->imagecopyresampled($this) && + (false !== ($this->image = $img->get_image())) && + (false !== ($this->width = $img->get_width())) && + (false !== ($this->height = $img->get_height())) + ); + } + + /** Resize the given image source (GD, gd object or image file path) to fit in the own image. + * The outside ares will be cropped out. Returns TRUE on success or FALSE on failure + * @param mixed $src + * @return bool */ + + public function resize_crop($src) { + $image_details = $this->build_image($src); + + if ($image_details !== false) { + list($src, $src_width, $src_height) = $image_details; + + if (($src_width / $src_height) > ($this->width / $this->height)) { + $src_w = $this->get_prop_width($src_height); + $src_h = $src_height; + $src_x = intval(($src_width - $src_w) / 2); + $src_y = 0; + + } else { + $src_w = $src_width; + $src_h = $this->get_prop_height($src_width); + $src_x = 0; + $src_y = intval(($src_height - $src_h) / 2); + } + + return imagecopyresampled($this->image, $src, 0, 0, $src_x, $src_y, $this->width, $this->height, $src_w, $src_h); + + } else + return false; + } + + /** Resize image to fit in given resolution. Returns TRUE on success or FALSE on failure + * @param integer $width + * @param integer $height + * @return bool */ + + public function resize_fit($width, $height) { + if ((!$width && !$height) || (($width == $this->width) && ($height == $this->height))) + return true; + if (!$width || (($height / $width) < ($this->height / $this->width))) + $width = intval(($this->width * $height) / $this->height); + elseif (!$height || (($width / $height) < ($this->width / $this->height))) + $height = intval(($this->height * $width) / $this->width); + if (!$width) $width = 1; + if (!$height) $height = 1; + return $this->resize($width, $height); + } + + /** Neka si predstavim vyobrazhaem pravoygylnik s razmeri $width i $height. + * Izobrazhenieto shte se preorazmeri taka che to shte izliza ot tozi pravoygylnik, + * no samo po edno (x ili y) izmerenie + * @param integer $width + * @param integer $height + * @return bool */ + + public function resize_overflow($width, $height) { + + $big = (($this->width / $this->height) > ($width / $height)) + ? ($this->width * $height) / $this->height + : ($this->height * $width) / $this->width; + $big = intval($big); + + $return = ($img = new gd($this->image, $big)); + + if ($return) { + $this->image = $img->get_image(); + $this->width = $img->get_width(); + $this->height = $img->get_height(); + } + + return $return; + } + + public function gd_color() { + $args = func_get_args(); + + $expr_rgb = '/^rgb\(\s*(\d{1,3})\s*\,\s*(\d{1,3})\s*\,\s*(\d{1,3})\s*\)$/i'; + $expr_hex1 = '/^\#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i'; + $expr_hex2 = '/^\#?([0-9a-f])([0-9a-f])([0-9a-f])$/i'; + $expr_byte = '/^([01]?\d?\d|2[0-4]\d|25[0-5])$/'; + + if (!isset($args[0])) + return false; + + if (count($args[0]) == 3) { + list($r, $g, $b) = $args[0]; + + } elseif (preg_match($expr_rgb, $args[0])) { + list($r, $g, $b) = explode(" ", preg_replace($expr_rgb, "$1 $2 $3", $args[0])); + + } elseif (preg_match($expr_hex1, $args[0])) { + list($r, $g, $b) = explode(" ", preg_replace($expr_hex1, "$1 $2 $3", $args[0])); + $r = hexdec($r); + $g = hexdec($g); + $b = hexdec($b); + + } elseif (preg_match($expr_hex2, $args[0])) { + list($r, $g, $b) = explode(" ", preg_replace($expr_hex2, "$1$1 $2$2 $3$3", $args[0])); + $r = hexdec($r); + $g = hexdec($g); + $b = hexdec($b); + + } elseif ((count($args) == 3) && + preg_match($expr_byte, $args[0]) && + preg_match($expr_byte, $args[1]) && + preg_match($expr_byte, $args[2]) + ) { + list($r, $g, $b) = $args; + + } else + return false; + + return imagecolorallocate($this->image, $r, $g, $b); + } + + public function fill_color($color) { + return $this->imagefilledrectangle(0, 0, $this->width - 1, $this->height - 1, $color); + } + + +/* G D M E T H O D S */ + + public function imagecopy( + $src, + $dst_x=0, $dst_y=0, + $src_x=0, $src_y=0, + $dst_w=null, $dst_h=null, + $src_w=null, $src_h=null + ) { + $image_details = $this->build_image($src); + + if ($image_details !== false) { + list($src, $src_width, $src_height) = $image_details; + + if (is_null($dst_w)) $dst_w = $this->width - $dst_x; + if (is_null($dst_h)) $dst_h = $this->height - $dst_y; + if (is_null($src_w)) $src_w = $src_width - $src_x; + if (is_null($src_h)) $src_h = $src_height - $src_y; + return imagecopy($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h); + + } else + return false; + } + + public function imagecopyresampled( + $src, + $dst_x=0, $dst_y=0, + $src_x=0, $src_y=0, + $dst_w=null, $dst_h=null, + $src_w=null, $src_h=null + ) { + $image_details = $this->build_image($src); + + if ($image_details !== false) { + list($src, $src_width, $src_height) = $image_details; + + if (is_null($dst_w)) $dst_w = $this->width - $dst_x; + if (is_null($dst_h)) $dst_h = $this->height - $dst_y; + if (is_null($src_w)) $src_w = $src_width - $src_x; + if (is_null($src_h)) $src_h = $src_height - $src_y; + imagealphablending($this->image, false); + imagesavealpha($this->image,true); + + + + + /*** gif transparent fix - 1.10.2013 ***/ + + $transindex = imagecolortransparent($src); + $palletsize = imagecolorstotal($src); + if($transindex >= 0 && $transindex < $palletsize) { + $transcol = imagecolorsforindex($src, $transindex); + + /*** end gif transparent fix ***/ + + $transindex = imagecolorallocatealpha($this->image, $transcol['red'], $transcol['green'], $transcol['blue'], 127); + imagefilledrectangle($this->image, 0, 0, $dst_w, $dst_h, $transindex); + imagecopyresampled($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); + imagecolortransparent($this->image, $transindex); + for($y=0; $y<$dst_h; ++$y) + for($x=0; $x<$dst_w; ++$x) + if(((imagecolorat($this->image, $x, $y)>>24) & 0x7F) >= 100) imagesetpixel($this->image, $x, $y, $transindex); + imagetruecolortopalette($this->image, true, 255); + } + else { + $transparent = imagecolorallocatealpha($this->image, 255, 255, 255, 127); + imagefilledrectangle($this->image, 0, 0, $dst_w, $dst_h, $transparent); + imagecopyresampled($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); + } + return $this->image; + + } else + return false; + } + + public function imagefilledrectangle($x1, $y1, $x2, $y2, $color) { + $color = $this->gd_color($color); + if ($color === false) return false; + return imagefilledrectangle($this->image, $x1, $y1, $x2, $y2, $color); + } + + public function imagepng($filename=null, $quality=null, $filters=null) { + if (is_null($filename) && !headers_sent()) + header("Content-Type: image/png"); + @imagesavealpha($this->image, true); + return imagepng($this->image, $filename, $quality, $filters); + } + + public function imagejpeg($filename=null, $quality=75) { + if (is_null($filename) && !headers_sent()) + header("Content-Type: image/jpeg"); + return imagejpeg($this->image, $filename, $quality); + } + + public function imagegif($filename=null) { + if (is_null($filename) && !headers_sent()) + header("Content-Type: image/gif"); + @imagesavealpha($this->image, true); + return imagegif($this->image, $filename); + } +} diff --git a/manager/media/browser/mcpuk/themes/evo/style.css b/manager/media/browser/mcpuk/themes/evo/style.css index ea808bec38..6c7ea0e2f6 100644 --- a/manager/media/browser/mcpuk/themes/evo/style.css +++ b/manager/media/browser/mcpuk/themes/evo/style.css @@ -1,136 +1,136 @@ -@import "../../../../style/common/font-awesome/css/font-awesome.min.css?v=5.10.2"; -body { background: #fff; } -input { margin: 0; } -input[type="radio"], input[type="checkbox"], label { cursor: pointer; } -input[name="newName"] { width: 98% !important; } -input[type="text"] { border: 1px solid #d3d3d3; background: #fff; padding: 2px; font-size: 1.5rem; margin: 0; outline-width: 0; } -input[type="text"]:hover { box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); -moz-box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); -webkit-box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); } -input[type="text"]:focus { border-color: #3687e2; box-shadow: 0 0 3px rgba(54, 135, 226, 1); -moz-box-shadow: 0 0 3px rgba(54, 135, 226, 1); -webkit-box-shadow: 0 0 3px rgba(54, 135, 226, 1); } -input[type="button"], input[type="submit"], input[type="reset"], button { font-size: 1.1rem; line-height: 2rem; color: #292b2c; background-color: #fff; border: 1px solid #d4d4d4; padding: 0.3rem 0.6rem; margin-left: 2px; display: inline-block; cursor: pointer; } -input[type="button"]:hover, input[type="submit"]:hover, input[type="reset"]:hover, button:hover { color: #292b2c; background-color: #e6e6e6; border-color: #adadad } -input[type="button"]:focus, input[type="submit"]:focus, input[type="reset"]:focus, button:focus { color: #292b2c; background-color: #e6e6e6; border-color: #adadad } -fieldset { margin: 0 5px 5px 0px; padding: 5px; border: 1px solid #dedede; cursor: default; } -fieldset td { white-space: nowrap; } -legend { margin: 0; padding: 0 3px; font-weight: bold; } -#folders { margin: 0; padding: 1rem 1rem 1rem .5rem; background: #fafafa; border: 0; border-right: 1px solid #dedede; border-bottom: 1px solid #dedede; } -#files { float: left; margin: 0 4px 0 0; background: #fafafa; border: 1px solid #dedede; border-left: 0; } -#files.drag { background: #ddebf8; } -#topic { padding-left: 12px; } -div.folders { margin-left: 1.7rem } -div.folder { white-space: nowrap; } -div.folder a { display: inline-block; text-decoration: none; cursor: default; outline: none; color: #000; } -span.folder { display: inline-block; font-size: 1.1rem; line-height: 1.2rem; padding: 2px 3px 2px 3px; outline: none; background: no-repeat 3px center; cursor: pointer; border: 1px solid transparent; } -span.brace { float: left; width: 1.6rem; height: 1.6rem; padding-left: 0; line-height: 1.9rem; font-size: 0; text-align: center; outline: none; } -span.current { background-color: #e4f0fa; border-color: #e4f0fa; color: #0e80cb; } -span.current:before { display: inline-block; font-family: 'Font Awesome 5 Free'; content: "\f07c"; width: 1.3em; font-size: 1.3rem; line-height: .8em; vertical-align: middle; color: #565656; font-weight:900} -span.regular { background-color: #f8f7f6; } -span.regular:before { display: inline-block; font-family: 'Font Awesome 5 Free'; content: "\f07b"; width: 1.3em; font-size: 1.3rem; line-height: .8em; vertical-align: middle; color: #565656; font-weight:900} -span.regular:hover, span.context { background-color: #ddebf8; border-color: #cee0f4; color: #000; } -span.opened:before { display: inline-block; font-family: 'Font Awesome 5 Free'; content: "\f107"; width: 1.3em; font-size: 1.3rem; line-height: .8em; vertical-align: middle; color: #565656; font-weight:900} -span.closed:before { display: inline-block; font-family: 'Font Awesome 5 Free'; content: "\f105"; width: 1.3em; font-size: 1.3rem; line-height: .8em; vertical-align: middle; color: #565656; font-weight:900} -span.denied:before { display: inline-block; font-family: 'Font Awesome 5 Free'; content: "\f05e"; width: 1.3em; font-size: 1.3rem; line-height: .8em; vertical-align: middle; color: #565656; font-weight:900} -div.file { padding: 4px; margin: 3px; border: 1px solid #aaa; background: #fff; } -div.file:hover { background: #ddebf8; border-color: #a7bed7; } -div.file .name { margin-top: 4px; font-weight: bold; height: 16px; overflow: hidden; } -tr.file td { font-size: 12px; } -/* -div.file .time { font-size: 10px; } -div.file .size { font-size: 10px; } -*/ -#files div.selected, #files div.selected:hover { background-color: #5b9bda; border-color: #2973bd; color: #fff; } -tr.file > td { padding: 3px 4px; background-color: #f8f7f6 } -tr.file:hover > td { background-color: #ddebf8; } -tr.selected > td, tr.selected:hover > td { background-color: #5b9bda; color: #fff; } -#collapseSide { padding: 5px 0; display: inline-block; float: left; margin: 0 0 0 5px; } -#hide-side { display: inline-block; width: 20px; text-align: center; font-size: 1.3rem; color: #5a5a5a; background-color: transparent; border: none; padding: 0.7rem 0.6rem 0.4rem 0.6rem; margin: 0px; } -#hide-side i.fa:hover { color: #292b2c; } -#toolbar { min-width: 500px; padding: 5px 0 5px 0; display: block; margin-top: 2px; } -#toolbar a { font-size: 1.1rem; line-height: 2rem; color: #292b2c; background-color: #fff; border: 1px solid #d4d4d4; padding: 0.3rem 0.6rem; margin-left: 5px; display: block; float: left; } -#toolbar a:before { font-family: 'Font Awesome 5 Free'; font-size: 1.3rem; display: inline-block; padding-right: 3px; margin-top: 0px; vertical-align: top; color: #404040; font-weight: bold;} -#toolbar a:hover, #toolbar a.hover { color: #292b2c; background-color: #e6e6e6; border-color: #adadad } -#toolbar a.selected, #toolbar a.selected:before { background-color: #3687e2; border-color: #3687e2; color: #fff; } -#toolbar a[href="kcact:upload"] { color: #fff; background-color: #5cb85c; border-color: #56ac56 } -#toolbar a[href="kcact:upload"]:hover { color: #fff; background-color: #449d44; border-color: #419641 } -#toolbar a[href="kcact:upload"]:before { content: "\f093"; color: #fff; font-weight: bold;} -#toolbar a[href="kcact:refresh"]:before { content: "\f021"; font-weight: bold;} -#toolbar a[href="kcact:settings"]:before { content: "\f0ad"; font-weight: bold;} -#toolbar a[href="kcact:about"], #toolbar a:hover[href="kcact:about"] { border: none; padding: 0; background: transparent; } -#toolbar a[href="kcact:about"]:before { content: "\f05a"; font-weight: bold;} -#toolbar a[href="kcact:maximize"]:before { content: "\f2d0"; font-weight: bold;} -/*try to hide Maximize button except in popup*/ -@media screen and (min-width: 840px) { -#toolbar a[href="kcact:maximize"], #toolbar a[href="kcact:maximize"]:before { display: none; } -} -@media screen and (max-width: 780px) { -#toolbar a[href="kcact:maximize"], #toolbar a[href="kcact:maximize"]:before { display: none; } -} -/*fake btn*/ -#viewThumbs, #viewList { display: none; float: left; margin: 0 0px 0 -30px; } -label.radio-thumbs:before { display: block; float: left; font-family: 'Font Awesome 5 Free'; font-size: 1.4rem; line-height: 1.6rem; vertical-align: middle; content: "\f00a"; color: #292b2c; background-color: #fff; border: 1px solid #d4d4d4; padding: 0.5rem 0.6rem; margin-left: 5px; font-weight: bold;} -label.radio-list:hover:before, label.radio-thumbs:hover:before { color: #292b2c; background-color: #e6e6e6; border-color: #adadad } -label.radio-list.labelchecked:before, label.radio-thumbs.labelchecked:before { background-color: #3687e2; border-color: #3687e2; color: #fff; } -label.radio-list:before { display: block; float: left; font-family: 'Font Awesome 5 Free'; font-size: 1.4rem; line-height: 1.6rem; vertical-align: middle; content: "\f03a"; color: #292b2c; background-color: #fff; border: 1px solid #d4d4d4; padding: 0.5rem 0.6rem; margin-left: 5px; font-weight: bold; } -input[type=checkbox] + label { color: #ccc; font-style: italic; } -input[type=checkbox]:checked + label { color: #f00; font-style: normal; } -#settings { background: #fff; padding: 5px; } -.box { width: 500px; } -.box, #loading, #alert { padding: 5px; border: 1px solid #3687e2; background: #fff; } -.box, #alert { padding: 8px; border-color: #fff; -moz-box-shadow: 0 0 4px rgba(255, 255, 255, 1); -webkit-box-shadow: 0 0 4px rgba(255, 255, 255, 1); box-shadow: 0 0 4px rgba(255, 255, 255, 1); } -#loading { background-image: url(img/loading.gif); font-weight: bold; margin-right: 4px; box-shadow: 0 0 3px rgba(54, 135, 226, 1); -moz-box-shadow: 0 0 3px rgba(54, 135, 226, 1); -webkit-box-shadow: 0 0 3px rgba(54, 135, 226, 1); } -#alert div.message, #dialog div.question { padding: 0 0 0 40px; } -#alert { background: #ff6347 url(img/alert.png) no-repeat 8px 29px; } -#dialog div.question { background: transparent url(img/confirm.png) no-repeat 0 0; } -#alert div.ok, #dialog div.buttons { padding-top: 5px; text-align: right; } -.menu { min-width: 180px; padding: 3px; border: 1px solid #dedede; background: #fff; opacity: 0.95; } -.menu a { font-size: 1.2rem; text-decoration: none; padding: 4px 4px 4px 4px; color: #000; margin: 0; outline: none; border: 1px solid transparent; } -.menu a:before { font-family: 'Font Awesome 5 Free'; font-size: 1.4rem; display: inline-block; width: 1.3rem; padding-right: 4px; margin-top: 0px; text-align: center; vertical-align: top; color: #404040; } -.menu .delimiter { border-top: 1px solid #acaaa7; padding-bottom: 3px; margin: 3px 2px 0 2px; } -.menu a:hover { background-color: #0e80cb; color: #fff; } -.menu a:hover:before { color: #fff; } -.menu a[href="kcact:refresh"]:before { content: "\f021"; font-weight: bold;} -.menu a[href="kcact:mkdir"]:before { content: "\f07b"; font-weight: bold;} -.menu a[href="kcact:mvdir"]:before, .menu a[href="kcact:mv"]:before { content: "\f246"; font-weight: bold;} -.menu a[href="kcact:rmdir"]:before, .menu a[href="kcact:rm"]:before, .menu a[href="kcact:rmcbd"]:before { content: "\f1f8"; font-weight: bold;} -.menu a[href="kcact:clpbrdadd"]:before { content: "\f0ea"; font-weight: bold;} -.menu a[href="kcact:pick"]:before, .menu a[href="kcact:pick_thumb"]:before { content: "\f00c"; font-weight: bold;} -.menu a[href="kcact:download"]:before { content: "\f019"; font-weight: bold;} -.menu a[href="kcact:view"]:before { content: "\f06e"; font-weight: bold;} -.menu a[href="kcact:cpcbd"]:before { content: "\f24d";font-weight: bold; } -.menu a[href="kcact:mvcbd"]:before { content: "\f047"; font-weight: bold;} -.menu a[href="kcact:clrcbd"]:before { content: "\f12d"; font-weight: bold;} -a.denied { color: #666; opacity: 0.5; filter: alpha(opacity:50); -cursor: default; } -a.denied:hover { background-color: #e4e3e2; border-color: transparent; box-shadow: none; -moz-box-shadow: none; -webkit-box-shadow: none; } -#dialog { -moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.5); -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.5); box-shadow: 0 0 5px rgba(0, 0, 0, 0.5); } -#dialog input[type="text"] { margin: 5px 0; width: 200px; } -#dialog div.slideshow { border: 1px solid #000; padding: 5px 5px 3px 5px; background: #000; -moz-box-shadow: 0 0 8px rgba(255, 255, 255, 1); -webkit-box-shadow: 0 0 8px rgba(255, 255, 255, 1); box-shadow: 0 0 8px rgba(255, 255, 255, 1); } -#dialog img { padding: 0; margin: 0; background: url(img/bg_transparent.png); } -#loadingDirs { padding: 5px 0 1px 24px; } -.about { text-align: center; } -.about div.head { font-weight: bold; font-size: 12px; padding: 3px 0 8px 0; } -.about div.head a { background: url(img/kcf_logo.png) no-repeat left center; padding: 0 0 0 27px; font-size: 17px; } -.about a { text-decoration: none; color: #05f; } -.about a:hover { text-decoration: underline; } -.about button { margin-top: 8px; } -#clipboard { padding: 0 4px 1px 0; } -#clipboard div { background: url(img/icons/clipboard.png) no-repeat center center; border: 1px solid transparent; padding: 1px; cursor: pointer; border-radius: 4px; -moz-border-radius: 4px; -webkit-border-radius: 4px; } -#clipboard div:hover { background-color: #bfbdbb; border-color: #a9a59f; } -#clipboard.selected div, #clipboard.selected div:hover { background-color: #c9c7c4; border-color: #3687e2; } -#checkver { padding-bottom: 8px; } -#checkver > span { padding: 2px; border: 1px solid transparent; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; } -#checkver > span.loading { background: url(img/loading.gif); border: 1px solid #3687e2; box-shadow: 0 0 3px rgba(54, 135, 226, 1); -moz-box-shadow: 0 0 3px rgba(54, 135, 226, 1); -webkit-box-shadow: 0 0 3px rgba(54, 135, 226, 1); } -#checkver span { padding: 3px; } -#checkver a { font-weight: normal; padding: 3px 3px 3px 20px; background: url(img/icons/download.png) no-repeat left center; } -div.title { overflow: auto; text-align: center; margin: -3px -5px 5px -5px; padding-left: 19px; padding-bottom: 2px; border-bottom: 1px solid #bbb; font-size: 2rem; cursor: move; } -.about div.title { cursor: default; } -span.close, span.clicked { float: right; width: 19px; height: 19px; background: url(img/icons/close.png) no-repeat; margin-top: 0px; cursor: pointer; } -.selectThis { padding: 6px 0; border-radius: 2px; background: #eee; color: #4ea94e; cursor: pointer; text-transform: uppercase; } -.selectThis:hover { background-color: #fff; } -.pull-right { position: absolute; } -.pull-right a { color: #bbb !important; } -div.file .thumb { background-size: contain; } -div.file .skipthumb { background-size: auto; } -.rangeTextContainer, .rangeThumbContainer { display: inline-block; padding: 0.4rem 0.4rem 0.2rem 0.4rem; margin-left: 2px; } -.hiddenrange { display: none } -.thumbsize, .textsize { display: inline-block; margin-left: 10px; } -input[type=range]::-moz-range-track { margin-top: 2px; } +@import "../../../../style/common/font-awesome/css/font-awesome.min.css?v=5.10.2"; +body { background: #fff; } +input { margin: 0; } +input[type="radio"], input[type="checkbox"], label { cursor: pointer; } +input[name="newName"] { width: 98% !important; } +input[type="text"] { border: 1px solid #d3d3d3; background: #fff; padding: 2px; font-size: 1.5rem; margin: 0; outline-width: 0; } +input[type="text"]:hover { box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); -moz-box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); -webkit-box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); } +input[type="text"]:focus { border-color: #3687e2; box-shadow: 0 0 3px rgba(54, 135, 226, 1); -moz-box-shadow: 0 0 3px rgba(54, 135, 226, 1); -webkit-box-shadow: 0 0 3px rgba(54, 135, 226, 1); } +input[type="button"], input[type="submit"], input[type="reset"], button { font-size: 1.1rem; line-height: 2rem; color: #292b2c; background-color: #fff; border: 1px solid #d4d4d4; padding: 0.3rem 0.6rem; margin-left: 2px; display: inline-block; cursor: pointer; } +input[type="button"]:hover, input[type="submit"]:hover, input[type="reset"]:hover, button:hover { color: #292b2c; background-color: #e6e6e6; border-color: #adadad } +input[type="button"]:focus, input[type="submit"]:focus, input[type="reset"]:focus, button:focus { color: #292b2c; background-color: #e6e6e6; border-color: #adadad } +fieldset { margin: 0 5px 5px 0px; padding: 5px; border: 1px solid #dedede; cursor: default; } +fieldset td { white-space: nowrap; } +legend { margin: 0; padding: 0 3px; font-weight: bold; } +#folders { margin: 0; padding: 1rem 1rem 1rem .5rem; background: #fafafa; border: 0; border-right: 1px solid #dedede; border-bottom: 1px solid #dedede; } +#files { float: left; margin: 0 4px 0 0; background: #fafafa; border: 1px solid #dedede; border-left: 0; } +#files.drag { background: #ddebf8; } +#topic { padding-left: 12px; } +div.folders { margin-left: 1.7rem } +div.folder { white-space: nowrap; } +div.folder a { display: inline-block; text-decoration: none; cursor: default; outline: none; color: #000; } +span.folder { display: inline-block; font-size: 1.1rem; line-height: 1.2rem; padding: 2px 3px 2px 3px; outline: none; background: no-repeat 3px center; cursor: pointer; border: 1px solid transparent; } +span.brace { float: left; width: 1.6rem; height: 1.6rem; padding-left: 0; line-height: 1.9rem; font-size: 0; text-align: center; outline: none; } +span.current { background-color: #e4f0fa; border-color: #e4f0fa; color: #0e80cb; } +span.current:before { display: inline-block; font-family: 'Font Awesome 5 Free'; content: "\f07c"; width: 1.3em; font-size: 1.3rem; line-height: .8em; vertical-align: middle; color: #565656; font-weight:900} +span.regular { background-color: #f8f7f6; } +span.regular:before { display: inline-block; font-family: 'Font Awesome 5 Free'; content: "\f07b"; width: 1.3em; font-size: 1.3rem; line-height: .8em; vertical-align: middle; color: #565656; font-weight:900} +span.regular:hover, span.context { background-color: #ddebf8; border-color: #cee0f4; color: #000; } +span.opened:before { display: inline-block; font-family: 'Font Awesome 5 Free'; content: "\f107"; width: 1.3em; font-size: 1.3rem; line-height: .8em; vertical-align: middle; color: #565656; font-weight:900} +span.closed:before { display: inline-block; font-family: 'Font Awesome 5 Free'; content: "\f105"; width: 1.3em; font-size: 1.3rem; line-height: .8em; vertical-align: middle; color: #565656; font-weight:900} +span.denied:before { display: inline-block; font-family: 'Font Awesome 5 Free'; content: "\f05e"; width: 1.3em; font-size: 1.3rem; line-height: .8em; vertical-align: middle; color: #565656; font-weight:900} +div.file { padding: 4px; margin: 3px; border: 1px solid #aaa; background: #fff; } +div.file:hover { background: #ddebf8; border-color: #a7bed7; } +div.file .name { margin-top: 4px; font-weight: bold; height: 16px; overflow: hidden; } +tr.file td { font-size: 12px; } +/* +div.file .time { font-size: 10px; } +div.file .size { font-size: 10px; } +*/ +#files div.selected, #files div.selected:hover { background-color: #5b9bda; border-color: #2973bd; color: #fff; } +tr.file > td { padding: 3px 4px; background-color: #f8f7f6 } +tr.file:hover > td { background-color: #ddebf8; } +tr.selected > td, tr.selected:hover > td { background-color: #5b9bda; color: #fff; } +#collapseSide { padding: 5px 0; display: inline-block; float: left; margin: 0 0 0 5px; } +#hide-side { display: inline-block; width: 20px; text-align: center; font-size: 1.3rem; color: #5a5a5a; background-color: transparent; border: none; padding: 0.7rem 0.6rem 0.4rem 0.6rem; margin: 0px; } +#hide-side i.fa:hover { color: #292b2c; } +#toolbar { min-width: 500px; padding: 5px 0 5px 0; display: block; margin-top: 2px; } +#toolbar a { font-size: 1.1rem; line-height: 2rem; color: #292b2c; background-color: #fff; border: 1px solid #d4d4d4; padding: 0.3rem 0.6rem; margin-left: 5px; display: block; float: left; } +#toolbar a:before { font-family: 'Font Awesome 5 Free'; font-size: 1.3rem; display: inline-block; padding-right: 3px; margin-top: 0px; vertical-align: top; color: #404040; font-weight: bold;} +#toolbar a:hover, #toolbar a.hover { color: #292b2c; background-color: #e6e6e6; border-color: #adadad } +#toolbar a.selected, #toolbar a.selected:before { background-color: #3687e2; border-color: #3687e2; color: #fff; } +#toolbar a[href="kcact:upload"] { color: #fff; background-color: #5cb85c; border-color: #56ac56 } +#toolbar a[href="kcact:upload"]:hover { color: #fff; background-color: #449d44; border-color: #419641 } +#toolbar a[href="kcact:upload"]:before { content: "\f093"; color: #fff; font-weight: bold;} +#toolbar a[href="kcact:refresh"]:before { content: "\f021"; font-weight: bold;} +#toolbar a[href="kcact:settings"]:before { content: "\f0ad"; font-weight: bold;} +#toolbar a[href="kcact:about"], #toolbar a:hover[href="kcact:about"] { border: none; padding: 0; background: transparent; } +#toolbar a[href="kcact:about"]:before { content: "\f05a"; font-weight: bold;} +#toolbar a[href="kcact:maximize"]:before { content: "\f2d0"; font-weight: bold;} +/*try to hide Maximize button except in popup*/ +@media screen and (min-width: 840px) { +#toolbar a[href="kcact:maximize"], #toolbar a[href="kcact:maximize"]:before { display: none; } +} +@media screen and (max-width: 780px) { +#toolbar a[href="kcact:maximize"], #toolbar a[href="kcact:maximize"]:before { display: none; } +} +/*fake btn*/ +#viewThumbs, #viewList { display: none; float: left; margin: 0 0px 0 -30px; } +label.radio-thumbs:before { display: block; float: left; font-family: 'Font Awesome 5 Free'; font-size: 1.4rem; line-height: 1.6rem; vertical-align: middle; content: "\f00a"; color: #292b2c; background-color: #fff; border: 1px solid #d4d4d4; padding: 0.5rem 0.6rem; margin-left: 5px; font-weight: bold;} +label.radio-list:hover:before, label.radio-thumbs:hover:before { color: #292b2c; background-color: #e6e6e6; border-color: #adadad } +label.radio-list.labelchecked:before, label.radio-thumbs.labelchecked:before { background-color: #3687e2; border-color: #3687e2; color: #fff; } +label.radio-list:before { display: block; float: left; font-family: 'Font Awesome 5 Free'; font-size: 1.4rem; line-height: 1.6rem; vertical-align: middle; content: "\f03a"; color: #292b2c; background-color: #fff; border: 1px solid #d4d4d4; padding: 0.5rem 0.6rem; margin-left: 5px; font-weight: bold; } +input[type=checkbox] + label { color: #ccc; font-style: italic; } +input[type=checkbox]:checked + label { color: #f00; font-style: normal; } +#settings { background: #fff; padding: 5px; } +.box { width: 500px; } +.box, #loading, #alert { padding: 5px; border: 1px solid #3687e2; background: #fff; } +.box, #alert { padding: 8px; border-color: #fff; -moz-box-shadow: 0 0 4px rgba(255, 255, 255, 1); -webkit-box-shadow: 0 0 4px rgba(255, 255, 255, 1); box-shadow: 0 0 4px rgba(255, 255, 255, 1); } +#loading { background-image: url(img/loading.gif); font-weight: bold; margin-right: 4px; box-shadow: 0 0 3px rgba(54, 135, 226, 1); -moz-box-shadow: 0 0 3px rgba(54, 135, 226, 1); -webkit-box-shadow: 0 0 3px rgba(54, 135, 226, 1); } +#alert div.message, #dialog div.question { padding: 0 0 0 40px; } +#alert { background: #ff6347 url(img/alert.png) no-repeat 8px 29px; } +#dialog div.question { background: transparent url(img/confirm.png) no-repeat 0 0; } +#alert div.ok, #dialog div.buttons { padding-top: 5px; text-align: right; } +.menu { min-width: 180px; padding: 3px; border: 1px solid #dedede; background: #fff; opacity: 0.95; } +.menu a { font-size: 1.2rem; text-decoration: none; padding: 4px 4px 4px 4px; color: #000; margin: 0; outline: none; border: 1px solid transparent; } +.menu a:before { font-family: 'Font Awesome 5 Free'; font-size: 1.4rem; display: inline-block; width: 1.3rem; padding-right: 4px; margin-top: 0px; text-align: center; vertical-align: top; color: #404040; } +.menu .delimiter { border-top: 1px solid #acaaa7; padding-bottom: 3px; margin: 3px 2px 0 2px; } +.menu a:hover { background-color: #0e80cb; color: #fff; } +.menu a:hover:before { color: #fff; } +.menu a[href="kcact:refresh"]:before { content: "\f021"; font-weight: bold;} +.menu a[href="kcact:mkdir"]:before { content: "\f07b"; font-weight: bold;} +.menu a[href="kcact:mvdir"]:before, .menu a[href="kcact:mv"]:before { content: "\f246"; font-weight: bold;} +.menu a[href="kcact:rmdir"]:before, .menu a[href="kcact:rm"]:before, .menu a[href="kcact:rmcbd"]:before { content: "\f1f8"; font-weight: bold;} +.menu a[href="kcact:clpbrdadd"]:before { content: "\f0ea"; font-weight: bold;} +.menu a[href="kcact:pick"]:before, .menu a[href="kcact:pick_thumb"]:before { content: "\f00c"; font-weight: bold;} +.menu a[href="kcact:download"]:before { content: "\f019"; font-weight: bold;} +.menu a[href="kcact:view"]:before { content: "\f06e"; font-weight: bold;} +.menu a[href="kcact:cpcbd"]:before { content: "\f24d";font-weight: bold; } +.menu a[href="kcact:mvcbd"]:before { content: "\f047"; font-weight: bold;} +.menu a[href="kcact:clrcbd"]:before { content: "\f12d"; font-weight: bold;} +a.denied { color: #666; opacity: 0.5; filter: alpha(opacity:50); +cursor: default; } +a.denied:hover { background-color: #e4e3e2; border-color: transparent; box-shadow: none; -moz-box-shadow: none; -webkit-box-shadow: none; } +#dialog { -moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.5); -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.5); box-shadow: 0 0 5px rgba(0, 0, 0, 0.5); } +#dialog input[type="text"] { margin: 5px 0; width: 200px; } +#dialog div.slideshow { border: 1px solid #000; padding: 5px 5px 3px 5px; background: #000; -moz-box-shadow: 0 0 8px rgba(255, 255, 255, 1); -webkit-box-shadow: 0 0 8px rgba(255, 255, 255, 1); box-shadow: 0 0 8px rgba(255, 255, 255, 1); } +#dialog img { padding: 0; margin: 0; background: url(img/bg_transparent.png); } +#loadingDirs { padding: 5px 0 1px 24px; } +.about { text-align: center; } +.about div.head { font-weight: bold; font-size: 12px; padding: 3px 0 8px 0; } +.about div.head a { background: url(img/kcf_logo.png) no-repeat left center; padding: 0 0 0 27px; font-size: 17px; } +.about a { text-decoration: none; color: #05f; } +.about a:hover { text-decoration: underline; } +.about button { margin-top: 8px; } +#clipboard { padding: 0 4px 1px 0; } +#clipboard div { background: url(img/icons/clipboard.png) no-repeat center center; border: 1px solid transparent; padding: 1px; cursor: pointer; border-radius: 4px; -moz-border-radius: 4px; -webkit-border-radius: 4px; } +#clipboard div:hover { background-color: #bfbdbb; border-color: #a9a59f; } +#clipboard.selected div, #clipboard.selected div:hover { background-color: #c9c7c4; border-color: #3687e2; } +#checkver { padding-bottom: 8px; } +#checkver > span { padding: 2px; border: 1px solid transparent; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; } +#checkver > span.loading { background: url(img/loading.gif); border: 1px solid #3687e2; box-shadow: 0 0 3px rgba(54, 135, 226, 1); -moz-box-shadow: 0 0 3px rgba(54, 135, 226, 1); -webkit-box-shadow: 0 0 3px rgba(54, 135, 226, 1); } +#checkver span { padding: 3px; } +#checkver a { font-weight: normal; padding: 3px 3px 3px 20px; background: url(img/icons/download.png) no-repeat left center; } +div.title { overflow: auto; text-align: center; margin: -3px -5px 5px -5px; padding-left: 19px; padding-bottom: 2px; border-bottom: 1px solid #bbb; font-size: 2rem; cursor: move; } +.about div.title { cursor: default; } +span.close, span.clicked { float: right; width: 19px; height: 19px; background: url(img/icons/close.png) no-repeat; margin-top: 0px; cursor: pointer; } +.selectThis { padding: 6px 0; border-radius: 2px; background: #eee; color: #4ea94e; cursor: pointer; text-transform: uppercase; } +.selectThis:hover { background-color: #fff; } +.pull-right { position: absolute; } +.pull-right a { color: #bbb !important; } +div.file .thumb { background-size: contain; } +div.file .skipthumb { background-size: auto; } +.rangeTextContainer, .rangeThumbContainer { display: inline-block; padding: 0.4rem 0.4rem 0.2rem 0.4rem; margin-left: 2px; } +.hiddenrange { display: none } +.thumbsize, .textsize { display: inline-block; margin-left: 10px; } +input[type=range]::-moz-range-track { margin-top: 2px; } diff --git a/manager/media/browser/mcpuk/tpl/tpl_browser.php b/manager/media/browser/mcpuk/tpl/tpl_browser.php index 5369878c64..cc142ac591 100755 --- a/manager/media/browser/mcpuk/tpl/tpl_browser.php +++ b/manager/media/browser/mcpuk/tpl/tpl_browser.php @@ -1,190 +1,190 @@ - - - - - KCFinder: / - <?php echo $this->session['dir'] ?> - - - - - - -
              -
              -
              -
              -
              -
              -
              -
              -
              -
              gaia-wines.gr OnlineCasinosSpelenPayID Pokies Sites Online Pokies in Australia Paysafecard Casino Australian Online Pokiesluckygans-casinoPayID Pokies SitesTransparencia en Casinos Online Top 10 Online Casino Australia Eu ComPlinko Game Online Kasyno PolisGuidebook.BetWinnerTop Rating casinogaia-wines.gr parhaatuudetkasinot.comNew Casino Bonuses
              New Casino Bonuses Fun88 East Villa FCFun88Fun88Casino ohne oasisFun88Fun88 Najlepsi BukmacherzyPaysafecard Casino WNB Casino BewertungCasinos ohne OASIS casino en ligne avec GirandièresBuitenlandse Online CasinoJBOJBOPlinko GameTop Rating casinoCasino ohne oasis
              Real Money Pokies TideliftOnline Casino Zonder RegistratieGuidebook.BetWinnerCasinos ohne OASISPaysafecard Casino Sportsbook Reviews OnlinelolajackCasinomithandyrechnung Casino-portugal.ptCasino mit Schneller AuszahlungОнлайн казино casino.uaBuitenlandse Online Casino Ставки на спорт Favbet ProbukmacherОнлайн казино casino.ua Interac-casino.com - Canada
              iDealeCasinos inkedin best non Gamstop casinosTop 10 Casino AustraliaOnline Casino Zonder Registratie freispace bestecasinozondercruksbetking онлайн казиноiDealeCasinos Run WeeklyNew Casino Sites UK (2025) Help DirectUnAIMyTextNew Casino Sites UK (2025) Help Direct TopKasynoOnline PLseguidores en instagram gratisInsta Finsta - DownloaderlolajackCasinomithandyrechnung
              ssddanbrown
              - - - - - - - - -
              - - -   - - -   - - - -
              - - -
              - -
              -
              - - label("Order by:") ?> - - - - - - - - - - - - - -
              - - -   - - -   - - -   - - -   - - - -
              -
              -
              - -
              -
              -
              -
              -
              -
                -
              -
              - - - + + + + + KCFinder: / + <?php echo $this->session['dir'] ?> + + + + + + +
              +
              +
              +
              +
              +
              +
              +
              +
              + +
                +
              +
              + + + \ No newline at end of file diff --git a/manager/media/calendar/datepicker.inc.php b/manager/media/calendar/datepicker.inc.php index 22068807d1..667d28f463 100755 --- a/manager/media/calendar/datepicker.inc.php +++ b/manager/media/calendar/datepicker.inc.php @@ -1,13 +1,13 @@ -parseText($tpl, $_lang, '[%', '%]'); - } -} +parseText($tpl, $_lang, '[%', '%]'); + } +} diff --git a/manager/media/calendar/datepicker.js b/manager/media/calendar/datepicker.js index a634cb062f..49d38dd8ea 100755 --- a/manager/media/calendar/datepicker.js +++ b/manager/media/calendar/datepicker.js @@ -1,99 +1,99 @@ -'use strict'; - -var _createClass = function() { - function defineProperties(target, props) - { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ('value' in descriptor) { - descriptor.writable = true; - } - Object.defineProperty(target, descriptor.key, descriptor); - } - } - - return function(Constructor, protoProps, staticProps) { - if (protoProps) { - defineProperties(Constructor.prototype, protoProps); - } - if (staticProps) { - defineProperties(Constructor, staticProps); - } - return Constructor; - }; -}(); - -var DatePicker = function() { - function DatePicker(dp, options) - { - if (!(this instanceof DatePicker)) { - throw new TypeError('Cannot call a class as a function'); - } - - var self = this; - this.dayChars = 1; - this.dayNames = [ - 'Sunday', - 'Monday', - 'Tuesday', - 'Wednesday', - 'Thursday', - 'Friday', - 'Saturday', - ]; - this.daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; - this.format = 'dd-mm-yyyy hh:mm:00'; - this.monthNames = [ - 'January', - 'February', - 'March', - 'April', - 'May', - 'June', - 'July', - 'August', - 'September', - 'October', - 'November', - 'December', - ]; - this.startDay = 7; - this.yearOrder = 'asc'; - this.yearRange = 10; - this.yearStart = new Date().getFullYear(); - this.yearOffset = -10; - this.error = ''; - options = options || []; - dp.options = { - monthNames: (options.monthNames && options.monthNames.length === 12 - ? options.monthNames - : this.monthNames) || this.monthNames, - daysInMonth: (options.daysInMonth && options.daysInMonth.length === 12 - ? options.daysInMonth - : this.daysInMonth) || this.daysInMonth, - dayNames: (options.dayNames && options.dayNames.length === 7 - ? options.dayNames - : this.dayNames) || this.dayNames, - startDay: options.startDay || this.startDay, - dayChars: options.dayChars || this.dayChars, - format: options.format || this.format, - yearStart: options.yearStart || this.yearStart, - yearRange: options.yearRange || this.yearRange, - yearOrder: options.yearOrder || this.yearOrder, - yearOffset: options.yearOffset || this.yearOffset, - }; - dp.id = dp.name; - dp.autocomplete = 'off'; - dp = DatePicker.getValue(dp); - dp.lastValidDate = dp.value; - dp.oldYear = dp.year = dp.then.getFullYear(); - dp.oldMonth = dp.month = dp.then.getMonth(); - dp.oldDay = dp.then.getDate(); - dp.nowYear = dp.today.getFullYear(); - dp.nowMonth = dp.today.getMonth(); - dp.nowDay = dp.today.getDate(); +'use strict'; + +var _createClass = function() { + function defineProperties(target, props) + { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ('value' in descriptor) { + descriptor.writable = true; + } + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + return function(Constructor, protoProps, staticProps) { + if (protoProps) { + defineProperties(Constructor.prototype, protoProps); + } + if (staticProps) { + defineProperties(Constructor, staticProps); + } + return Constructor; + }; +}(); + +var DatePicker = function() { + function DatePicker(dp, options) + { + if (!(this instanceof DatePicker)) { + throw new TypeError('Cannot call a class as a function'); + } + + var self = this; + this.dayChars = 1; + this.dayNames = [ + 'Sunday', + 'Monday', + 'Tuesday', + 'Wednesday', + 'Thursday', + 'Friday', + 'Saturday', + ]; + this.daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + this.format = 'dd-mm-yyyy hh:mm:00'; + this.monthNames = [ + 'January', + 'February', + 'March', + 'April', + 'May', + 'June', + 'July', + 'August', + 'September', + 'October', + 'November', + 'December', + ]; + this.startDay = 7; + this.yearOrder = 'asc'; + this.yearRange = 10; + this.yearStart = new Date().getFullYear(); + this.yearOffset = -10; + this.error = ''; + options = options || []; + dp.options = { + monthNames: (options.monthNames && options.monthNames.length === 12 + ? options.monthNames + : this.monthNames) || this.monthNames, + daysInMonth: (options.daysInMonth && options.daysInMonth.length === 12 + ? options.daysInMonth + : this.daysInMonth) || this.daysInMonth, + dayNames: (options.dayNames && options.dayNames.length === 7 + ? options.dayNames + : this.dayNames) || this.dayNames, + startDay: options.startDay || this.startDay, + dayChars: options.dayChars || this.dayChars, + format: options.format || this.format, + yearStart: options.yearStart || this.yearStart, + yearRange: options.yearRange || this.yearRange, + yearOrder: options.yearOrder || this.yearOrder, + yearOffset: options.yearOffset || this.yearOffset, + }; + dp.id = dp.name; + dp.autocomplete = 'off'; + dp = DatePicker.getValue(dp); + dp.lastValidDate = dp.value; + dp.oldYear = dp.year = dp.then.getFullYear(); + dp.oldMonth = dp.month = dp.then.getMonth(); + dp.oldDay = dp.then.getDate(); + dp.nowYear = dp.today.getFullYear(); + dp.nowMonth = dp.today.getMonth(); + dp.nowDay = dp.today.getDate(); dp.container = false; dp.calendar = false; dp.interval = null; @@ -103,37 +103,37 @@ var DatePicker = function() { }; DatePicker.bindToggle(dp); } - - _createClass(DatePicker, null, [ - { - key: 'getValue', value: function getValue(dp) { - if (dp.value !== '') { - if (dp.options.format === 'dd-mm-YYYY hh:mm:00' || - dp.options.format === 'dd-mm-YYYY') { - var dateVals = dp.value.split(' '); - var dateParts = dateVals[0].split('-'); - dp.thenvalue = dateParts[1] + '/' + dateParts[0] + '/' + dateParts[2]; - if (dateVals[1]) { - dp.thenvalue = dp.thenvalue + ' ' + dateVals[1]; - } - } else { - dp.thenvalue = dp.value; - } - dp.then = new Date(dp.thenvalue); - dp.today = new Date(); - } else { - dp.thenvalue = dp.then = dp.today = new Date(); - dp.thenvalue = dp.then; - } - return dp; - }, - }, { - key: 'updateValue', value: function updateValue(dp) { - var el = document.querySelector('td.dp_selected'); - var ds = void 0; - if (el) { - ds = el.axis.split('|'); - var formatted = DatePicker.formatValue(dp, ds[0], ds[1], ds[2]); + + _createClass(DatePicker, null, [ + { + key: 'getValue', value: function getValue(dp) { + if (dp.value !== '') { + if (dp.options.format === 'dd-mm-YYYY hh:mm:00' || + dp.options.format === 'dd-mm-YYYY') { + var dateVals = dp.value.split(' '); + var dateParts = dateVals[0].split('-'); + dp.thenvalue = dateParts[1] + '/' + dateParts[0] + '/' + dateParts[2]; + if (dateVals[1]) { + dp.thenvalue = dp.thenvalue + ' ' + dateVals[1]; + } + } else { + dp.thenvalue = dp.value; + } + dp.then = new Date(dp.thenvalue); + dp.today = new Date(); + } else { + dp.thenvalue = dp.then = dp.today = new Date(); + dp.thenvalue = dp.then; + } + return dp; + }, + }, { + key: 'updateValue', value: function updateValue(dp) { + var el = document.querySelector('td.dp_selected'); + var ds = void 0; + if (el) { + ds = el.axis.split('|'); + var formatted = DatePicker.formatValue(dp, ds[0], ds[1], ds[2]); if (formatted !== '') { dp.value = formatted; dp.lastValidDate = formatted; @@ -208,316 +208,316 @@ var DatePicker = function() { }, }, { key: 'alertError', value: function alertError(dp) { - if (typeof dp.error !== 'undefined' && dp.error !== '') { - alert(dp.error); - dp.error = ''; - } - }, - }, { - key: 'hasChild', value: function hasChild(a, b) { - var parent = a.parentNode; - while (parent && parent !== document.body) { - if (parent === b) { - return parent; - } else { - parent = parent.parentNode; - } - } - return null; - }, - }, { - key: 'close', value: function close(e) { - if (!document.getElementById(this.dp.id + 'dp_container')) { - return; - } - var clickOutside = e.target && e.target !== this.dp && e.target !== - this.dp.container && - !DatePicker.hasChild(e.target, this.dp.container); - if (clickOutside) { - if (this.dp.dirty) { - this.updateValue(this.dp); - DatePicker.alertError(this.dp); - } - DatePicker.remove(this.dp); - } - }, - }, { - key: 'create', value: function create(dp) { - var y = void 0; - var self = this; - dp = DatePicker.getValue(dp); - this.dp = dp; - if (dp.calendar) { - return false; - } - this.dp.dirty = false; - dp.container = document.createElement('div'); - dp.container.className = 'dp_container'; - dp.container.id = dp.id + 'dp_container'; - document.body.appendChild(dp.container); - document.onmousedown = function(e) { - DatePicker.close(e); - }; - document.onkeydown = function(e) { - if (e.code === 9 && !e.shift || e.code === 27 || e.code === 13) { - if (e.code === 13 && dp.container) { - e.preventDefault ? e.preventDefault() : e.returnValue = false; - if (self.dp.dirty) { - self.updateValue(dp); - } - DatePicker.remove(self.dp); - DatePicker.alertError(self.dp); - } else { - DatePicker.remove(self.dp); - } - } - }; - dp.calendar = document.createElement('div'); - dp.calendar.className = 'dp_cal'; - dp.container.appendChild(dp.calendar); - var date = new Date(); - if (dp.month >= 0 && dp.year) { - date.setFullYear(dp.year, dp.month, 1); - } else { - dp.month = parseInt(date.getMonth()); - dp.year = parseInt(date.getFullYear()); - date.setDate(1); - } - dp.year % 4 === 0 - ? dp.options.daysInMonth[1] = 29 - : dp.options.daysInMonth[1] = 28; - var firstDay = 1 - (7 + date.getDay() - dp.options.startDay) % 7; - var monthSel = document.createElement('select'); - monthSel.id = dp.id + '_monthSelect'; - for (var m = 0; m < dp.options.monthNames.length; m++) { - monthSel.options[m] = new Option(dp.options.monthNames[m], m); - if (parseInt(dp.month) === m) { - monthSel.options[m].selected = true; - } - } - var yearSel = document.createElement('select'); - yearSel.id = dp.id + '_yearSelect'; - var i = 0; - if (!dp.options.yearStart) { - dp.options.yearStart = date.getFullYear(); - } - if (dp.options.yearOrder === 'desc') { - for (y = dp.options.yearStart - dp.options.yearOffset; y > - dp.options.yearStart - dp.options.yearRange - 1; y--) { - yearSel.options[i] = new Option(y, y); - if (parseInt(dp.year) === y) { - yearSel.options[i].selected = true; - } - i++; - } - } else { - for (y = dp.options.yearStart + dp.options.yearOffset; y < - dp.options.yearStart + dp.options.yearRange + 1; y++) { - yearSel.options[i] = new Option(y, y); - if (parseInt(dp.year) === y) { - yearSel.options[i].selected = true; - } - i++; - } - } - var time = void 0; - if (!dp.time) { - var d = new Date(dp.thenvalue); - var minutes = d.getMinutes(); - if (minutes < 10) { - minutes = '0' + minutes; - } - time = d.getHours() + ':' + minutes; - } else { - time = dp.time; - } - var timeTextBox = document.createElement('input'); - timeTextBox.id = dp.id + '_timeTextBox'; - timeTextBox.className = 'cal_timeTextBox'; - timeTextBox.type = 'text'; - timeTextBox.value = time; - var submitButton = document.createElement('button'); - submitButton.id = dp.id + '_submit'; - submitButton.className = 'cal_submit btn btn-secondary'; - submitButton.innerHTML = 'OK'; - var calTable = document.createElement('table'); - var calTableThead = document.createElement('thead'); - var calSelRow = document.createElement('tr'); - var calSelCell = document.createElement('th'); - calSelCell.colSpan = 7; - calSelCell.appendChild(monthSel); - calSelCell.appendChild(yearSel); - calSelRow.appendChild(calSelCell); - calTableThead.appendChild(calSelRow); - var calTableTbody = document.createElement('tbody'); - var calDayNameRow = document.createElement('tr'); - var calDayNameCell = void 0; - for (i = 0; i < dp.options.dayNames.length; i++) { - calDayNameCell = document.createElement('th'); - calDayNameCell.innerHTML = dp.options.dayNames[(dp.options.startDay + - i) % 7].substr(0, dp.options.dayChars); - calDayNameRow.appendChild(calDayNameCell); - } - calTableTbody.appendChild(calDayNameRow); - var calDayRow = void 0; - var calDayCell = void 0; - while (firstDay <= dp.options.daysInMonth[dp.month]) { - calDayRow = document.createElement('tr'); - for (i = 0; i < 7; i++) { - calDayCell = document.createElement('td'); - if (firstDay <= dp.options.daysInMonth[dp.month] && firstDay > 0) { - calDayCell.className = dp.id + '_calDay'; - calDayCell.axis = dp.year + '|' + (parseInt(dp.month) + 1) + '|' + - firstDay; - calDayCell.innerHTML = firstDay; - } else { - calDayCell.className = 'dp_empty'; - calDayCell.innerHTML = ' '; - } - calDayRow.appendChild(calDayCell); - if (firstDay === parseInt(dp.oldDay) && dp.month === dp.oldMonth && - dp.year === dp.oldYear) { - calDayCell.classList.add('dp_selected'); - } - if (firstDay === dp.nowDay && parseInt(dp.month) === dp.nowMonth && - parseInt(dp.year) === dp.nowYear) { - calDayCell.classList.add('dp_today'); - } - firstDay++; - } - calTableTbody.appendChild(calDayRow); - } - calTable.appendChild(calTableThead); - calTable.appendChild(calTableTbody); - var calTimePara = document.createElement('p'); - calTimePara.id = dp.id + '_calTime'; - calTimePara.appendChild(timeTextBox); - calTimePara.appendChild(submitButton); - dp.calendar.appendChild(calTable); - dp.calendar.appendChild(calTimePara); - dp.position = dp.getBoundingClientRect(); - dp.container.style.left = dp.position.left + window.pageXOffset + 'px'; - if (dp.position.top + dp.container.offsetHeight > window.innerHeight) { - dp.container.style.top = dp.position.top + window.pageYOffset - - dp.container.offsetHeight + 'px'; - } else { - dp.container.style.top = dp.position.top + dp.position.height + - window.pageYOffset + 'px'; - } - var calDays = document.querySelectorAll('td.' + dp.id + '_calDay'); - for (i = 0; i < calDays.length; i++) { - calDays[i].onmouseover = function() { - this.classList.add('dp_roll'); - }; - calDays[i].onmouseout = function() { - this.classList.remove('dp_roll'); - }; - calDays[i].onclick = function() { - var el = document.querySelector('td.dp_selected'); - if (el) { - el.classList.remove('dp_selected'); - } - this.classList.add('dp_selected'); - self.updateValue(self.dp); - }; - calDays[i].ondblclick = function() { - var el = document.querySelector('td.dp_selected'); - if (el) { - el.classList.remove('dp_selected'); - } - this.classList.add('dp_selected'); - self.updateValue(self.dp); - DatePicker.remove(dp); - }; - } - monthSel.onfocus = function() { - dp.active = true; - }; - monthSel.onblur = function() { - dp.active = true; - }; - monthSel.onchange = function() { - dp.month = monthSel.value; - dp.year = yearSel.value; - DatePicker.remove(dp); - self.create(dp); - }; - yearSel.onfocus = function() { - dp.active = true; - }; - yearSel.onblur = function() { - dp.active = true; - }; - yearSel.onchange = function() { - dp.month = monthSel.value; - dp.year = yearSel.value; - DatePicker.remove(dp); - self.create(dp); - }; - timeTextBox.onfocus = function() { - dp.active = true; - }; - timeTextBox.onblur = function() { - self.updateValue(self.dp); - DatePicker.alertError(self.dp); - }; - timeTextBox.onkeyup = function(e) { - self.dp.dirty = true; - }; - submitButton.onclick = function(e) { - if (self.dp.dirty) { - self.updateValue(self.dp); - DatePicker.alertError(self.dp); - } - DatePicker.remove(self.dp); - e.stopPropagation(); - }; - }, - }, { - key: 'formatValue', value: function formatValue(dp, year, month, day) { - var time = document.getElementById(dp.id + '_timeTextBox'). - value. - split(':'); - if (!time[0] || time[0] === '' || time[0] < 0 || time[0] > 23) { - dp.error = 'Invalid hours value: ' + time[0] + - '\nAllowed range is 00:23'; - return ''; - } - if (!time[1] || time[1] === '' || time[1] < 0 || time[1] > 59 || - time[1].length !== 2) { - dp.error = 'Invalid minutes value: ' + time[1] + - '\nAllowed range is 00:59'; - return ''; - } - if (day < 10) { - day = '0' + day; - } - if (month < 10) { - month = '0' + month; - } - var dateStr = dp.options.format.replace(/dd/i, day). - replace(/mm/i, month). - replace(/yyyy/i, year). - replace(/hh/, time[0]). - replace(/mm/, time[1]); - dp.month = dp.oldMonth = '' + (month - 1) + ''; - dp.year = dp.oldYear = year; - dp.oldDay = day; - this.dp.thenvalue = month + '/' + day + '/' + year + ' ' + time[0] + - ':' + time[1] + ':00'; - return dateStr; - }, - }, { - key: 'remove', value: function remove(dp) { - dp.active = false; - if (dp.container) { - dp.container.remove(); - } - dp.calendar = false; - dp.container = false; - }, - }, - ]); - - return DatePicker; + if (typeof dp.error !== 'undefined' && dp.error !== '') { + alert(dp.error); + dp.error = ''; + } + }, + }, { + key: 'hasChild', value: function hasChild(a, b) { + var parent = a.parentNode; + while (parent && parent !== document.body) { + if (parent === b) { + return parent; + } else { + parent = parent.parentNode; + } + } + return null; + }, + }, { + key: 'close', value: function close(e) { + if (!document.getElementById(this.dp.id + 'dp_container')) { + return; + } + var clickOutside = e.target && e.target !== this.dp && e.target !== + this.dp.container && + !DatePicker.hasChild(e.target, this.dp.container); + if (clickOutside) { + if (this.dp.dirty) { + this.updateValue(this.dp); + DatePicker.alertError(this.dp); + } + DatePicker.remove(this.dp); + } + }, + }, { + key: 'create', value: function create(dp) { + var y = void 0; + var self = this; + dp = DatePicker.getValue(dp); + this.dp = dp; + if (dp.calendar) { + return false; + } + this.dp.dirty = false; + dp.container = document.createElement('div'); + dp.container.className = 'dp_container'; + dp.container.id = dp.id + 'dp_container'; + document.body.appendChild(dp.container); + document.onmousedown = function(e) { + DatePicker.close(e); + }; + document.onkeydown = function(e) { + if (e.code === 9 && !e.shift || e.code === 27 || e.code === 13) { + if (e.code === 13 && dp.container) { + e.preventDefault ? e.preventDefault() : e.returnValue = false; + if (self.dp.dirty) { + self.updateValue(dp); + } + DatePicker.remove(self.dp); + DatePicker.alertError(self.dp); + } else { + DatePicker.remove(self.dp); + } + } + }; + dp.calendar = document.createElement('div'); + dp.calendar.className = 'dp_cal'; + dp.container.appendChild(dp.calendar); + var date = new Date(); + if (dp.month >= 0 && dp.year) { + date.setFullYear(dp.year, dp.month, 1); + } else { + dp.month = parseInt(date.getMonth()); + dp.year = parseInt(date.getFullYear()); + date.setDate(1); + } + dp.year % 4 === 0 + ? dp.options.daysInMonth[1] = 29 + : dp.options.daysInMonth[1] = 28; + var firstDay = 1 - (7 + date.getDay() - dp.options.startDay) % 7; + var monthSel = document.createElement('select'); + monthSel.id = dp.id + '_monthSelect'; + for (var m = 0; m < dp.options.monthNames.length; m++) { + monthSel.options[m] = new Option(dp.options.monthNames[m], m); + if (parseInt(dp.month) === m) { + monthSel.options[m].selected = true; + } + } + var yearSel = document.createElement('select'); + yearSel.id = dp.id + '_yearSelect'; + var i = 0; + if (!dp.options.yearStart) { + dp.options.yearStart = date.getFullYear(); + } + if (dp.options.yearOrder === 'desc') { + for (y = dp.options.yearStart - dp.options.yearOffset; y > + dp.options.yearStart - dp.options.yearRange - 1; y--) { + yearSel.options[i] = new Option(y, y); + if (parseInt(dp.year) === y) { + yearSel.options[i].selected = true; + } + i++; + } + } else { + for (y = dp.options.yearStart + dp.options.yearOffset; y < + dp.options.yearStart + dp.options.yearRange + 1; y++) { + yearSel.options[i] = new Option(y, y); + if (parseInt(dp.year) === y) { + yearSel.options[i].selected = true; + } + i++; + } + } + var time = void 0; + if (!dp.time) { + var d = new Date(dp.thenvalue); + var minutes = d.getMinutes(); + if (minutes < 10) { + minutes = '0' + minutes; + } + time = d.getHours() + ':' + minutes; + } else { + time = dp.time; + } + var timeTextBox = document.createElement('input'); + timeTextBox.id = dp.id + '_timeTextBox'; + timeTextBox.className = 'cal_timeTextBox'; + timeTextBox.type = 'text'; + timeTextBox.value = time; + var submitButton = document.createElement('button'); + submitButton.id = dp.id + '_submit'; + submitButton.className = 'cal_submit btn btn-secondary'; + submitButton.innerHTML = 'OK'; + var calTable = document.createElement('table'); + var calTableThead = document.createElement('thead'); + var calSelRow = document.createElement('tr'); + var calSelCell = document.createElement('th'); + calSelCell.colSpan = 7; + calSelCell.appendChild(monthSel); + calSelCell.appendChild(yearSel); + calSelRow.appendChild(calSelCell); + calTableThead.appendChild(calSelRow); + var calTableTbody = document.createElement('tbody'); + var calDayNameRow = document.createElement('tr'); + var calDayNameCell = void 0; + for (i = 0; i < dp.options.dayNames.length; i++) { + calDayNameCell = document.createElement('th'); + calDayNameCell.innerHTML = dp.options.dayNames[(dp.options.startDay + + i) % 7].substr(0, dp.options.dayChars); + calDayNameRow.appendChild(calDayNameCell); + } + calTableTbody.appendChild(calDayNameRow); + var calDayRow = void 0; + var calDayCell = void 0; + while (firstDay <= dp.options.daysInMonth[dp.month]) { + calDayRow = document.createElement('tr'); + for (i = 0; i < 7; i++) { + calDayCell = document.createElement('td'); + if (firstDay <= dp.options.daysInMonth[dp.month] && firstDay > 0) { + calDayCell.className = dp.id + '_calDay'; + calDayCell.axis = dp.year + '|' + (parseInt(dp.month) + 1) + '|' + + firstDay; + calDayCell.innerHTML = firstDay; + } else { + calDayCell.className = 'dp_empty'; + calDayCell.innerHTML = ' '; + } + calDayRow.appendChild(calDayCell); + if (firstDay === parseInt(dp.oldDay) && dp.month === dp.oldMonth && + dp.year === dp.oldYear) { + calDayCell.classList.add('dp_selected'); + } + if (firstDay === dp.nowDay && parseInt(dp.month) === dp.nowMonth && + parseInt(dp.year) === dp.nowYear) { + calDayCell.classList.add('dp_today'); + } + firstDay++; + } + calTableTbody.appendChild(calDayRow); + } + calTable.appendChild(calTableThead); + calTable.appendChild(calTableTbody); + var calTimePara = document.createElement('p'); + calTimePara.id = dp.id + '_calTime'; + calTimePara.appendChild(timeTextBox); + calTimePara.appendChild(submitButton); + dp.calendar.appendChild(calTable); + dp.calendar.appendChild(calTimePara); + dp.position = dp.getBoundingClientRect(); + dp.container.style.left = dp.position.left + window.pageXOffset + 'px'; + if (dp.position.top + dp.container.offsetHeight > window.innerHeight) { + dp.container.style.top = dp.position.top + window.pageYOffset - + dp.container.offsetHeight + 'px'; + } else { + dp.container.style.top = dp.position.top + dp.position.height + + window.pageYOffset + 'px'; + } + var calDays = document.querySelectorAll('td.' + dp.id + '_calDay'); + for (i = 0; i < calDays.length; i++) { + calDays[i].onmouseover = function() { + this.classList.add('dp_roll'); + }; + calDays[i].onmouseout = function() { + this.classList.remove('dp_roll'); + }; + calDays[i].onclick = function() { + var el = document.querySelector('td.dp_selected'); + if (el) { + el.classList.remove('dp_selected'); + } + this.classList.add('dp_selected'); + self.updateValue(self.dp); + }; + calDays[i].ondblclick = function() { + var el = document.querySelector('td.dp_selected'); + if (el) { + el.classList.remove('dp_selected'); + } + this.classList.add('dp_selected'); + self.updateValue(self.dp); + DatePicker.remove(dp); + }; + } + monthSel.onfocus = function() { + dp.active = true; + }; + monthSel.onblur = function() { + dp.active = true; + }; + monthSel.onchange = function() { + dp.month = monthSel.value; + dp.year = yearSel.value; + DatePicker.remove(dp); + self.create(dp); + }; + yearSel.onfocus = function() { + dp.active = true; + }; + yearSel.onblur = function() { + dp.active = true; + }; + yearSel.onchange = function() { + dp.month = monthSel.value; + dp.year = yearSel.value; + DatePicker.remove(dp); + self.create(dp); + }; + timeTextBox.onfocus = function() { + dp.active = true; + }; + timeTextBox.onblur = function() { + self.updateValue(self.dp); + DatePicker.alertError(self.dp); + }; + timeTextBox.onkeyup = function(e) { + self.dp.dirty = true; + }; + submitButton.onclick = function(e) { + if (self.dp.dirty) { + self.updateValue(self.dp); + DatePicker.alertError(self.dp); + } + DatePicker.remove(self.dp); + e.stopPropagation(); + }; + }, + }, { + key: 'formatValue', value: function formatValue(dp, year, month, day) { + var time = document.getElementById(dp.id + '_timeTextBox'). + value. + split(':'); + if (!time[0] || time[0] === '' || time[0] < 0 || time[0] > 23) { + dp.error = 'Invalid hours value: ' + time[0] + + '\nAllowed range is 00:23'; + return ''; + } + if (!time[1] || time[1] === '' || time[1] < 0 || time[1] > 59 || + time[1].length !== 2) { + dp.error = 'Invalid minutes value: ' + time[1] + + '\nAllowed range is 00:59'; + return ''; + } + if (day < 10) { + day = '0' + day; + } + if (month < 10) { + month = '0' + month; + } + var dateStr = dp.options.format.replace(/dd/i, day). + replace(/mm/i, month). + replace(/yyyy/i, year). + replace(/hh/, time[0]). + replace(/mm/, time[1]); + dp.month = dp.oldMonth = '' + (month - 1) + ''; + dp.year = dp.oldYear = year; + dp.oldDay = day; + this.dp.thenvalue = month + '/' + day + '/' + year + ' ' + time[0] + + ':' + time[1] + ':00'; + return dateStr; + }, + }, { + key: 'remove', value: function remove(dp) { + dp.active = false; + if (dp.container) { + dp.container.remove(); + } + dp.calendar = false; + dp.container = false; + }, + }, + ]); + + return DatePicker; }(); diff --git a/manager/media/calendar/datepicker.tpl b/manager/media/calendar/datepicker.tpl index 34a2ba45d7..e8ad889923 100755 --- a/manager/media/calendar/datepicker.tpl +++ b/manager/media/calendar/datepicker.tpl @@ -1,21 +1,21 @@ - - + + diff --git a/manager/media/style/common/spectrum/spectrum.css b/manager/media/style/common/spectrum/spectrum.css index a31dedc2b2..b41bbafe06 100755 --- a/manager/media/style/common/spectrum/spectrum.css +++ b/manager/media/style/common/spectrum/spectrum.css @@ -1,515 +1,515 @@ -/*** -Spectrum Colorpicker v1.8.0 -https://github.com/bgrins/spectrum -Author: Brian Grinstead -License: MIT -***/ - -.sp-container { - position:absolute; - top:0; - left:0; - display:inline-block; - *display: inline; - *zoom: 1; - /* https://github.com/bgrins/spectrum/issues/40 */ - z-index: 9999994; - overflow: hidden; -} -.sp-container.sp-flat { - position: relative; - width:95%; - background:#FFF; - border:none; -} - -/* Fix for * { box-sizing: border-box; } */ -.sp-container, -.sp-container * { - -webkit-box-sizing: content-box; - -moz-box-sizing: content-box; - box-sizing: content-box; -} - -/* http://ansciath.tumblr.com/post/7347495869/css-aspect-ratio */ -.sp-top { - position:relative; - width: 100%; - display:inline-block; -} -.sp-top-inner { - position:absolute; - top:0; - left:0; - bottom:0; - right:0; -} -.sp-color { - position: absolute; - top:0; - left:0; - bottom:0; - right:20%; -} -.sp-hue { - position: absolute; - top:0; - right:0; - bottom:0; - left:84%; - height: 100%; -} - -.sp-clear-enabled .sp-hue { - top:33px; - height: 77.5%; -} - -.sp-fill { - padding-top: 80%; -} -.sp-sat, .sp-val { - position: absolute; - top:0; - left:0; - right:0; - bottom:0; -} - -.sp-alpha-enabled .sp-top { - margin-bottom: 18px; -} -.sp-alpha-enabled .sp-alpha { - display: block; -} -.sp-alpha-handle { - position:absolute; - top:-4px; - bottom: -4px; - width: 6px; - left: 50%; - cursor: pointer; - border: 1px solid black; - background: white; - opacity: .8; -} -.sp-alpha { - display: none; - position: absolute; - bottom: -14px; - right: 0; - left: 0; - height: 8px; -} -.sp-alpha-inner { - border: solid 1px #333; -} - -.sp-clear { - display: none; -} - -.sp-clear.sp-clear-display { - background-position: center; -} - -.sp-clear-enabled .sp-clear { - display: block; - position:absolute; - top:0px; - right:0; - bottom:0; - left:84%; - height: 28px; -} - -/* Don't allow text selection */ -.sp-container, .sp-replacer, .sp-preview, .sp-dragger, .sp-slider, .sp-alpha, .sp-clear, .sp-alpha-handle, .sp-container.sp-dragging .sp-input, .sp-container button { - -webkit-user-select:none; - -moz-user-select: -moz-none; - -o-user-select:none; - user-select: none; -} - -.sp-container.sp-input-disabled .sp-input-container { - display: none; -} -.sp-container.sp-buttons-disabled .sp-button-container { - display: none; -} -.sp-container.sp-palette-buttons-disabled .sp-palette-button-container { - display: none; -} -.sp-palette-only .sp-picker-container { - display: none; -} -.sp-palette-disabled .sp-palette-container { - display: none; -} - -.sp-initial-disabled .sp-initial { - display: none; -} - - -/* Gradients for hue, saturation and value instead of images. Not pretty... but it works */ -.sp-sat { - background-image: -webkit-gradient(linear, 0 0, 100% 0, from(#FFF), to(rgba(204, 154, 129, 0))); - background-image: -webkit-linear-gradient(left, #FFF, rgba(204, 154, 129, 0)); - background-image: -moz-linear-gradient(left, #fff, rgba(204, 154, 129, 0)); - background-image: -o-linear-gradient(left, #fff, rgba(204, 154, 129, 0)); - background-image: -ms-linear-gradient(left, #fff, rgba(204, 154, 129, 0)); - background-image: linear-gradient(to right, #fff, rgba(204, 154, 129, 0)); - -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr=#FFFFFFFF, endColorstr=#00CC9A81)"; - filter : progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr='#FFFFFFFF', endColorstr='#00CC9A81'); -} -.sp-val { - background-image: -webkit-gradient(linear, 0 100%, 0 0, from(#000000), to(rgba(204, 154, 129, 0))); - background-image: -webkit-linear-gradient(bottom, #000000, rgba(204, 154, 129, 0)); - background-image: -moz-linear-gradient(bottom, #000, rgba(204, 154, 129, 0)); - background-image: -o-linear-gradient(bottom, #000, rgba(204, 154, 129, 0)); - background-image: -ms-linear-gradient(bottom, #000, rgba(204, 154, 129, 0)); - background-image: linear-gradient(to top, #000, rgba(204, 154, 129, 0)); - -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00CC9A81, endColorstr=#FF000000)"; - filter : progid:DXImageTransform.Microsoft.gradient(startColorstr='#00CC9A81', endColorstr='#FF000000'); -} - -.sp-hue { - background: -moz-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%); - background: -ms-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%); - background: -o-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%); - background: -webkit-gradient(linear, left top, left bottom, from(#ff0000), color-stop(0.17, #ffff00), color-stop(0.33, #00ff00), color-stop(0.5, #00ffff), color-stop(0.67, #0000ff), color-stop(0.83, #ff00ff), to(#ff0000)); - background: -webkit-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%); - background: linear-gradient(to bottom, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%); -} - -/* IE filters do not support multiple color stops. - Generate 6 divs, line them up, and do two color gradients for each. - Yes, really. - */ -.sp-1 { - height:17%; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0000', endColorstr='#ffff00'); -} -.sp-2 { - height:16%; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffff00', endColorstr='#00ff00'); -} -.sp-3 { - height:17%; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ff00', endColorstr='#00ffff'); -} -.sp-4 { - height:17%; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ffff', endColorstr='#0000ff'); -} -.sp-5 { - height:16%; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0000ff', endColorstr='#ff00ff'); -} -.sp-6 { - height:17%; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff00ff', endColorstr='#ff0000'); -} - -.sp-hidden { - display: none !important; -} - -/* Clearfix hack */ -.sp-cf:before, .sp-cf:after { content: ""; display: table; } -.sp-cf:after { clear: both; } -.sp-cf { *zoom: 1; } - - -/* Mobile devices, make hue slider bigger so it is easier to slide */ -@media (max-device-width: 480px) { - .sp-color { right: 40%; } - .sp-hue { left: 63%; } - .sp-fill { padding-top: 60%; } -} -.sp-dragger { - border-radius: 5px; - height: 5px; - width: 5px; - border: 1px solid #fff; - background: #000; - cursor: pointer; - position:absolute; - top:0; - left: 0; -} -.sp-slider { - position: absolute; - top:0; - cursor:pointer; - height: 3px; - left: -1px; - right: -1px; - border: 1px solid #000; - background: white; - opacity: .8; -} - -/* -Theme authors: -Here are the basic themeable display options (colors, fonts, global widths). -See http://bgrins.github.io/spectrum/themes/ for instructions. -*/ - -.sp-container { - border-radius: 0; - background-color: #fff; - border: 0; - padding: 0; - top:1px; - left:0; - margin-bottom:3px -} -.sp-container, .sp-container button, .sp-container input, .sp-color, .sp-hue, .sp-clear { - font: normal 12px "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - -ms-box-sizing: border-box; - box-sizing: border-box; -} -.sp-top { - margin-bottom: 3px; -} -.sp-color, .sp-hue, .sp-clear { - border: solid 1px #666; -} - -/* Input */ -.sp-input-container { - float:right; - width: 100px; - margin-bottom: 4px; -} -.sp-initial-disabled .sp-input-container { - width: 100%; -} -.sp-input { - font-size: 12px !important; - border: 1px inset; - padding: 4px 5px; - margin: 0; - width: 100%; - background:transparent; - border-radius: 3px; - color: #222; -} -.sp-input:focus { - border: 1px solid orange; -} -.sp-input.sp-validation-error { - border: 1px solid red; - background: #fdd; -} -.sp-picker-container , .sp-palette-container { - float:left; - position: relative; - padding: 10px; - padding-bottom: 300px; - margin-bottom: -290px; - margin-left:20px; - width:95%; - border:none; -} -.sp-picker-container { - width: 210px; - /* border-left: solid 1px #fff;*/ -} - -/* Palettes */ -.sp-palette-container { - border-right: solid 1px #ccc; -} - -.sp-palette-only .sp-palette-container { - border: 0; -} - -.sp-palette .sp-thumb-el { - display: block; - position:relative; - float:left; - width: 24px; - height: 15px; - margin: 3px; - cursor: pointer; - border:solid 2px transparent; -} -.sp-palette .sp-thumb-el:hover, .sp-palette .sp-thumb-el.sp-thumb-active { - border-color: orange; -} -.sp-thumb-el { - position:relative; -} -.sp-palette-toggle {margin-right:110px;margin-top:3px;} - -.sp-container a.sp-palette-toggle{ -color:#1976d2; -font-size:16px; -font-weight:bold; -cursor:pointer; -padding:1px 10px 2px 10px;} -} -.sp-container a.sp-palette-toggle:hover -{ color: #292b2c; background-color: #e6e6e6!important; border-color: #adadad } - - -/* Initial */ -.sp-initial { - float: left; - border: solid 1px #333; -} -.sp-initial span { - width: 30px; - height: 25px; - border:none; - display:block; - float:left; - margin:0; -} - -.sp-initial .sp-clear-display { - background-position: center; -} - -/* Buttons */ -.sp-palette-button-container, -.sp-button-container { - float: right; -} - -/* Replacer (the little preview div that shows up instead of the ) */ -.sp-replacer { - margin:0; - overflow:hidden; - cursor:pointer; - padding: 4px; - display:inline-block; - *zoom: 1; - *display: inline; - border: solid 1px #91765d; - background: #eee; - color: #333; - vertical-align: middle; -} -.sp-replacer:hover, .sp-replacer.sp-active { - border-color: #F0C49B; - color: #111; -} -.sp-replacer.sp-disabled { - cursor:default; - border-color: silver; - color: silver; -} -.sp-dd { - padding: 2px 0; - height: 16px; - line-height: 16px; - float:left; - font-size:10px; -} -.sp-preview { - position:relative; - width:25px; - height: 20px; - border: solid 1px #222; - margin-right: 5px; - float:left; - z-index: 0; -} - -.sp-palette { - *width: 220px; - max-width: 220px; -} -.sp-palette .sp-thumb-el { - width:16px; - height: 16px; - margin:2px 1px; - border: solid 1px #d0d0d0; -} - -.sp-container { - padding-bottom:0; -} - - -/* Buttons: http://hellohappy.org/css3-buttons/ */ -.sp-container button { - background-color: #eeeeee; - border: 1px solid #ccc; - border-bottom: 1px solid #bbb; - border-radius: 3px; - color: #333; - font-size: 14px; - line-height: 1; - padding: 5px 4px; - text-align: center; - text-shadow: 0 1px 0 #eee; - vertical-align: middle; -} -.sp-container button:hover { - background-color: #dddddd; - border: 1px solid #bbb; - border-bottom: 1px solid #999; - cursor: pointer; - text-shadow: 0 1px 0 #ddd; -} -.sp-container button:active { - border: 1px solid #aaa; - border-bottom: 1px solid #888; -} -.sp-cancel { - font-size: 11px; - color: #d93f3f !important; - margin:0; - padding:2px; - margin-right: 5px; - vertical-align: middle; - text-decoration:none; - -} -.sp-cancel:hover { - color: #d93f3f !important; - text-decoration: underline; -} - - -.sp-palette span:hover, .sp-palette span.sp-thumb-active { - border-color: #000; -} - -.sp-preview, .sp-alpha, .sp-thumb-el { - position:relative; - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==); -} -.sp-preview-inner, .sp-alpha-inner, .sp-thumb-inner { - display:block; - position:absolute; - top:0;left:0;bottom:0;right:0; -} - -.sp-palette .sp-thumb-inner { - background-position: 50% 50%; - background-repeat: no-repeat; -} - -.sp-palette .sp-thumb-light.sp-thumb-active .sp-thumb-inner { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIVJREFUeNpiYBhsgJFMffxAXABlN5JruT4Q3wfi/0DsT64h8UD8HmpIPCWG/KemIfOJCUB+Aoacx6EGBZyHBqI+WsDCwuQ9mhxeg2A210Ntfo8klk9sOMijaURm7yc1UP2RNCMbKE9ODK1HM6iegYLkfx8pligC9lCD7KmRof0ZhjQACDAAceovrtpVBRkAAAAASUVORK5CYII=); -} - -.sp-palette .sp-thumb-dark.sp-thumb-active .sp-thumb-inner { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAMdJREFUOE+tkgsNwzAMRMugEAahEAahEAZhEAqlEAZhEAohEAYh81X2dIm8fKpEspLGvudPOsUYpxE2BIJCroJmEW9qJ+MKaBFhEMNabSy9oIcIPwrB+afvAUFoK4H0tMaQ3XtlrggDhOVVMuT4E5MMG0FBbCEYzjYT7OxLEvIHQLY2zWwQ3D+9luyOQTfKDiFD3iUIfPk8VqrKjgAiSfGFPecrg6HN6m/iBcwiDAo7WiBeawa+Kwh7tZoSCGLMqwlSAzVDhoK+6vH4G0P5wdkAAAAASUVORK5CYII=); -} - -.sp-clear-display { - background-repeat:no-repeat; - background-position: center; - background-image: url(data:image/gif;base64,R0lGODlhFAAUAPcAAAAAAJmZmZ2dnZ6enqKioqOjo6SkpKWlpaampqenp6ioqKmpqaqqqqurq/Hx8fLy8vT09PX19ff39/j4+Pn5+fr6+vv7+wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAP8ALAAAAAAUABQAAAihAP9FoPCvoMGDBy08+EdhQAIJCCMybCDAAYUEARBAlFiQQoMABQhKUJBxY0SPICEYHBnggEmDKAuoPMjS5cGYMxHW3IiT478JJA8M/CjTZ0GgLRekNGpwAsYABHIypcAgQMsITDtWJYBR6NSqMico9cqR6tKfY7GeBCuVwlipDNmefAtTrkSzB1RaIAoXodsABiZAEFB06gIBWC1mLVgBa0AAOw==); -} +/*** +Spectrum Colorpicker v1.8.0 +https://github.com/bgrins/spectrum +Author: Brian Grinstead +License: MIT +***/ + +.sp-container { + position:absolute; + top:0; + left:0; + display:inline-block; + *display: inline; + *zoom: 1; + /* https://github.com/bgrins/spectrum/issues/40 */ + z-index: 9999994; + overflow: hidden; +} +.sp-container.sp-flat { + position: relative; + width:95%; + background:#FFF; + border:none; +} + +/* Fix for * { box-sizing: border-box; } */ +.sp-container, +.sp-container * { + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; +} + +/* http://ansciath.tumblr.com/post/7347495869/css-aspect-ratio */ +.sp-top { + position:relative; + width: 100%; + display:inline-block; +} +.sp-top-inner { + position:absolute; + top:0; + left:0; + bottom:0; + right:0; +} +.sp-color { + position: absolute; + top:0; + left:0; + bottom:0; + right:20%; +} +.sp-hue { + position: absolute; + top:0; + right:0; + bottom:0; + left:84%; + height: 100%; +} + +.sp-clear-enabled .sp-hue { + top:33px; + height: 77.5%; +} + +.sp-fill { + padding-top: 80%; +} +.sp-sat, .sp-val { + position: absolute; + top:0; + left:0; + right:0; + bottom:0; +} + +.sp-alpha-enabled .sp-top { + margin-bottom: 18px; +} +.sp-alpha-enabled .sp-alpha { + display: block; +} +.sp-alpha-handle { + position:absolute; + top:-4px; + bottom: -4px; + width: 6px; + left: 50%; + cursor: pointer; + border: 1px solid black; + background: white; + opacity: .8; +} +.sp-alpha { + display: none; + position: absolute; + bottom: -14px; + right: 0; + left: 0; + height: 8px; +} +.sp-alpha-inner { + border: solid 1px #333; +} + +.sp-clear { + display: none; +} + +.sp-clear.sp-clear-display { + background-position: center; +} + +.sp-clear-enabled .sp-clear { + display: block; + position:absolute; + top:0px; + right:0; + bottom:0; + left:84%; + height: 28px; +} + +/* Don't allow text selection */ +.sp-container, .sp-replacer, .sp-preview, .sp-dragger, .sp-slider, .sp-alpha, .sp-clear, .sp-alpha-handle, .sp-container.sp-dragging .sp-input, .sp-container button { + -webkit-user-select:none; + -moz-user-select: -moz-none; + -o-user-select:none; + user-select: none; +} + +.sp-container.sp-input-disabled .sp-input-container { + display: none; +} +.sp-container.sp-buttons-disabled .sp-button-container { + display: none; +} +.sp-container.sp-palette-buttons-disabled .sp-palette-button-container { + display: none; +} +.sp-palette-only .sp-picker-container { + display: none; +} +.sp-palette-disabled .sp-palette-container { + display: none; +} + +.sp-initial-disabled .sp-initial { + display: none; +} + + +/* Gradients for hue, saturation and value instead of images. Not pretty... but it works */ +.sp-sat { + background-image: -webkit-gradient(linear, 0 0, 100% 0, from(#FFF), to(rgba(204, 154, 129, 0))); + background-image: -webkit-linear-gradient(left, #FFF, rgba(204, 154, 129, 0)); + background-image: -moz-linear-gradient(left, #fff, rgba(204, 154, 129, 0)); + background-image: -o-linear-gradient(left, #fff, rgba(204, 154, 129, 0)); + background-image: -ms-linear-gradient(left, #fff, rgba(204, 154, 129, 0)); + background-image: linear-gradient(to right, #fff, rgba(204, 154, 129, 0)); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr=#FFFFFFFF, endColorstr=#00CC9A81)"; + filter : progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr='#FFFFFFFF', endColorstr='#00CC9A81'); +} +.sp-val { + background-image: -webkit-gradient(linear, 0 100%, 0 0, from(#000000), to(rgba(204, 154, 129, 0))); + background-image: -webkit-linear-gradient(bottom, #000000, rgba(204, 154, 129, 0)); + background-image: -moz-linear-gradient(bottom, #000, rgba(204, 154, 129, 0)); + background-image: -o-linear-gradient(bottom, #000, rgba(204, 154, 129, 0)); + background-image: -ms-linear-gradient(bottom, #000, rgba(204, 154, 129, 0)); + background-image: linear-gradient(to top, #000, rgba(204, 154, 129, 0)); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00CC9A81, endColorstr=#FF000000)"; + filter : progid:DXImageTransform.Microsoft.gradient(startColorstr='#00CC9A81', endColorstr='#FF000000'); +} + +.sp-hue { + background: -moz-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%); + background: -ms-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%); + background: -o-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%); + background: -webkit-gradient(linear, left top, left bottom, from(#ff0000), color-stop(0.17, #ffff00), color-stop(0.33, #00ff00), color-stop(0.5, #00ffff), color-stop(0.67, #0000ff), color-stop(0.83, #ff00ff), to(#ff0000)); + background: -webkit-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%); + background: linear-gradient(to bottom, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%); +} + +/* IE filters do not support multiple color stops. + Generate 6 divs, line them up, and do two color gradients for each. + Yes, really. + */ +.sp-1 { + height:17%; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0000', endColorstr='#ffff00'); +} +.sp-2 { + height:16%; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffff00', endColorstr='#00ff00'); +} +.sp-3 { + height:17%; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ff00', endColorstr='#00ffff'); +} +.sp-4 { + height:17%; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ffff', endColorstr='#0000ff'); +} +.sp-5 { + height:16%; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0000ff', endColorstr='#ff00ff'); +} +.sp-6 { + height:17%; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff00ff', endColorstr='#ff0000'); +} + +.sp-hidden { + display: none !important; +} + +/* Clearfix hack */ +.sp-cf:before, .sp-cf:after { content: ""; display: table; } +.sp-cf:after { clear: both; } +.sp-cf { *zoom: 1; } + + +/* Mobile devices, make hue slider bigger so it is easier to slide */ +@media (max-device-width: 480px) { + .sp-color { right: 40%; } + .sp-hue { left: 63%; } + .sp-fill { padding-top: 60%; } +} +.sp-dragger { + border-radius: 5px; + height: 5px; + width: 5px; + border: 1px solid #fff; + background: #000; + cursor: pointer; + position:absolute; + top:0; + left: 0; +} +.sp-slider { + position: absolute; + top:0; + cursor:pointer; + height: 3px; + left: -1px; + right: -1px; + border: 1px solid #000; + background: white; + opacity: .8; +} + +/* +Theme authors: +Here are the basic themeable display options (colors, fonts, global widths). +See http://bgrins.github.io/spectrum/themes/ for instructions. +*/ + +.sp-container { + border-radius: 0; + background-color: #fff; + border: 0; + padding: 0; + top:1px; + left:0; + margin-bottom:3px +} +.sp-container, .sp-container button, .sp-container input, .sp-color, .sp-hue, .sp-clear { + font: normal 12px "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; +} +.sp-top { + margin-bottom: 3px; +} +.sp-color, .sp-hue, .sp-clear { + border: solid 1px #666; +} + +/* Input */ +.sp-input-container { + float:right; + width: 100px; + margin-bottom: 4px; +} +.sp-initial-disabled .sp-input-container { + width: 100%; +} +.sp-input { + font-size: 12px !important; + border: 1px inset; + padding: 4px 5px; + margin: 0; + width: 100%; + background:transparent; + border-radius: 3px; + color: #222; +} +.sp-input:focus { + border: 1px solid orange; +} +.sp-input.sp-validation-error { + border: 1px solid red; + background: #fdd; +} +.sp-picker-container , .sp-palette-container { + float:left; + position: relative; + padding: 10px; + padding-bottom: 300px; + margin-bottom: -290px; + margin-left:20px; + width:95%; + border:none; +} +.sp-picker-container { + width: 210px; + /* border-left: solid 1px #fff;*/ +} + +/* Palettes */ +.sp-palette-container { + border-right: solid 1px #ccc; +} + +.sp-palette-only .sp-palette-container { + border: 0; +} + +.sp-palette .sp-thumb-el { + display: block; + position:relative; + float:left; + width: 24px; + height: 15px; + margin: 3px; + cursor: pointer; + border:solid 2px transparent; +} +.sp-palette .sp-thumb-el:hover, .sp-palette .sp-thumb-el.sp-thumb-active { + border-color: orange; +} +.sp-thumb-el { + position:relative; +} +.sp-palette-toggle {margin-right:110px;margin-top:3px;} + +.sp-container a.sp-palette-toggle{ +color:#1976d2; +font-size:16px; +font-weight:bold; +cursor:pointer; +padding:1px 10px 2px 10px;} +} +.sp-container a.sp-palette-toggle:hover +{ color: #292b2c; background-color: #e6e6e6!important; border-color: #adadad } + + +/* Initial */ +.sp-initial { + float: left; + border: solid 1px #333; +} +.sp-initial span { + width: 30px; + height: 25px; + border:none; + display:block; + float:left; + margin:0; +} + +.sp-initial .sp-clear-display { + background-position: center; +} + +/* Buttons */ +.sp-palette-button-container, +.sp-button-container { + float: right; +} + +/* Replacer (the little preview div that shows up instead of the ) */ +.sp-replacer { + margin:0; + overflow:hidden; + cursor:pointer; + padding: 4px; + display:inline-block; + *zoom: 1; + *display: inline; + border: solid 1px #91765d; + background: #eee; + color: #333; + vertical-align: middle; +} +.sp-replacer:hover, .sp-replacer.sp-active { + border-color: #F0C49B; + color: #111; +} +.sp-replacer.sp-disabled { + cursor:default; + border-color: silver; + color: silver; +} +.sp-dd { + padding: 2px 0; + height: 16px; + line-height: 16px; + float:left; + font-size:10px; +} +.sp-preview { + position:relative; + width:25px; + height: 20px; + border: solid 1px #222; + margin-right: 5px; + float:left; + z-index: 0; +} + +.sp-palette { + *width: 220px; + max-width: 220px; +} +.sp-palette .sp-thumb-el { + width:16px; + height: 16px; + margin:2px 1px; + border: solid 1px #d0d0d0; +} + +.sp-container { + padding-bottom:0; +} + + +/* Buttons: http://hellohappy.org/css3-buttons/ */ +.sp-container button { + background-color: #eeeeee; + border: 1px solid #ccc; + border-bottom: 1px solid #bbb; + border-radius: 3px; + color: #333; + font-size: 14px; + line-height: 1; + padding: 5px 4px; + text-align: center; + text-shadow: 0 1px 0 #eee; + vertical-align: middle; +} +.sp-container button:hover { + background-color: #dddddd; + border: 1px solid #bbb; + border-bottom: 1px solid #999; + cursor: pointer; + text-shadow: 0 1px 0 #ddd; +} +.sp-container button:active { + border: 1px solid #aaa; + border-bottom: 1px solid #888; +} +.sp-cancel { + font-size: 11px; + color: #d93f3f !important; + margin:0; + padding:2px; + margin-right: 5px; + vertical-align: middle; + text-decoration:none; + +} +.sp-cancel:hover { + color: #d93f3f !important; + text-decoration: underline; +} + + +.sp-palette span:hover, .sp-palette span.sp-thumb-active { + border-color: #000; +} + +.sp-preview, .sp-alpha, .sp-thumb-el { + position:relative; + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==); +} +.sp-preview-inner, .sp-alpha-inner, .sp-thumb-inner { + display:block; + position:absolute; + top:0;left:0;bottom:0;right:0; +} + +.sp-palette .sp-thumb-inner { + background-position: 50% 50%; + background-repeat: no-repeat; +} + +.sp-palette .sp-thumb-light.sp-thumb-active .sp-thumb-inner { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIVJREFUeNpiYBhsgJFMffxAXABlN5JruT4Q3wfi/0DsT64h8UD8HmpIPCWG/KemIfOJCUB+Aoacx6EGBZyHBqI+WsDCwuQ9mhxeg2A210Ntfo8klk9sOMijaURm7yc1UP2RNCMbKE9ODK1HM6iegYLkfx8pligC9lCD7KmRof0ZhjQACDAAceovrtpVBRkAAAAASUVORK5CYII=); +} + +.sp-palette .sp-thumb-dark.sp-thumb-active .sp-thumb-inner { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAMdJREFUOE+tkgsNwzAMRMugEAahEAahEAZhEAqlEAZhEAohEAYh81X2dIm8fKpEspLGvudPOsUYpxE2BIJCroJmEW9qJ+MKaBFhEMNabSy9oIcIPwrB+afvAUFoK4H0tMaQ3XtlrggDhOVVMuT4E5MMG0FBbCEYzjYT7OxLEvIHQLY2zWwQ3D+9luyOQTfKDiFD3iUIfPk8VqrKjgAiSfGFPecrg6HN6m/iBcwiDAo7WiBeawa+Kwh7tZoSCGLMqwlSAzVDhoK+6vH4G0P5wdkAAAAASUVORK5CYII=); +} + +.sp-clear-display { + background-repeat:no-repeat; + background-position: center; + background-image: url(data:image/gif;base64,R0lGODlhFAAUAPcAAAAAAJmZmZ2dnZ6enqKioqOjo6SkpKWlpaampqenp6ioqKmpqaqqqqurq/Hx8fLy8vT09PX19ff39/j4+Pn5+fr6+vv7+wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAP8ALAAAAAAUABQAAAihAP9FoPCvoMGDBy08+EdhQAIJCCMybCDAAYUEARBAlFiQQoMABQhKUJBxY0SPICEYHBnggEmDKAuoPMjS5cGYMxHW3IiT478JJA8M/CjTZ0GgLRekNGpwAsYABHIypcAgQMsITDtWJYBR6NSqMico9cqR6tKfY7GeBCuVwlipDNmefAtTrkSzB1RaIAoXodsABiZAEFB06gIBWC1mLVgBa0AAOw==); +} #mainMenu.show .nav > li.dropdown.hover > a { background-color: #fff; color: #444!important; } \ No newline at end of file diff --git a/manager/media/style/default/color.switcher.php b/manager/media/style/default/color.switcher.php index 56dab8b15b..cbea9d5439 100755 --- a/manager/media/style/default/color.switcher.php +++ b/manager/media/style/default/color.switcher.php @@ -1,170 +1,170 @@ -
              -
              -
              -

              COLOR SWITCHER

              -
              -
              -

              Menu Background

              -
              -
              -
              -
              #000
              -
              #222
              -
              #333
              -
              #444
              -
              #555
              -
              #777
              -
              #888
              -
              #0f243e
              -
              #548dd4
              -
              #134f5c
              -
              #0b5394
              -
              #351c75
              -
              #741b47
              -
              #900
              -
              - -
              -
              -
              -
              -

              Menu links

              -
              - -
              - -
              -
              -

              Menu links:hover

              -
              - -
              -
              -
              -

              Text color

              -
              -
              -
              -
              #000
              -
              #222
              -
              #333
              -
              #444
              -
              #555
              -
              #777
              -
              #888
              -
              #b45f06
              -
              #38761d
              -
              #134f5c
              -
              #0b5394
              -
              #351c75
              -
              #741b47
              -
              #9d2661
              -
              - -
              -
              -
              -
              -

              Links Color

              -
              -
              -
              -
              #000
              -
              #222
              -
              #555
              -
              #666
              -
              #dedede
              -
              #fafafa
              -
              #fff
              -
              #b45f06
              -
              #38761d
              -
              #134f5c
              -
              #0b5394
              -
              #351c75
              -
              #741b47
              -
              #9d2661
              -
              - -
              -
              -
              - -
              -
              - +
              +
              +
              +

              COLOR SWITCHER

              +
              +
              +

              Menu Background

              +
              +
              +
              +
              #000
              +
              #222
              +
              #333
              +
              #444
              +
              #555
              +
              #777
              +
              #888
              +
              #0f243e
              +
              #548dd4
              +
              #134f5c
              +
              #0b5394
              +
              #351c75
              +
              #741b47
              +
              #900
              +
              + +
              +
              +
              +
              +

              Menu links

              +
              + +
              + +
              +
              +

              Menu links:hover

              +
              + +
              +
              +
              +

              Text color

              +
              +
              +
              +
              #000
              +
              #222
              +
              #333
              +
              #444
              +
              #555
              +
              #777
              +
              #888
              +
              #b45f06
              +
              #38761d
              +
              #134f5c
              +
              #0b5394
              +
              #351c75
              +
              #741b47
              +
              #9d2661
              +
              + +
              +
              +
              +
              +

              Links Color

              +
              +
              +
              +
              #000
              +
              #222
              +
              #555
              +
              #666
              +
              #dedede
              +
              #fafafa
              +
              #fff
              +
              #b45f06
              +
              #38761d
              +
              #134f5c
              +
              #0b5394
              +
              #351c75
              +
              #741b47
              +
              #9d2661
              +
              + +
              +
              +
              + +
              +
              + diff --git a/manager/media/style/default/css/color.switcher.css b/manager/media/style/default/css/color.switcher.css index 69df23573e..3a0418f23c 100755 --- a/manager/media/style/default/css/color.switcher.css +++ b/manager/media/style/default/css/color.switcher.css @@ -1,73 +1,73 @@ -* { margin: 0; padding: 0; box-sizing: border-box; } -.evocp-box { position: fixed; width: 300px; min-height: 100%; top: 35px; right: -300px; color: #444; z-index: 10; transition: 0.5s cubic-bezier(1, 1.48, 0.76, 0.95) right, box-shadow .5s; } -.evocp-icon { position: absolute; bottom:60px; width: 34px; height: 29px; vertical-align: middle; line-height: 28px; left: -34px; background: #fafafa; box-shadow: -3px 0 2px 1px rgba(0, 0, 0, 0.1); border-radius: 50% 0 0 50%; text-align: center; font-size: 17px; cursor: pointer; z-index: 10; -webkit-animation: colorchange 15s infinite alternate; } -.dark .evocp-icon { background: #2f323a; border: 1px solid #2f323a; border-right: 0; -webkit-animation: colorchange 15s infinite alternate; } -i.evocpicon:hover { -webkit-transform: rotate(30deg); -moz-transform: rotate(30deg); -ms-transform: rotate(30deg); -o-transform: rotate(30deg); transform: rotate(30deg); } -@keyframes colorchange { -0% { color: #b45f06; } -10% { color: #38761d; } -20% { color: #134f5c; } -30% { color: #0b5394; } -40% { color: #351c75; } -50% { color: #741b47; } -60% { color: blue; } -70% { color: #2980b9; } -80% { color: #f1c40f; } -90% { color: #2980b9; } -100% { color: #900;} -} -@-webkit-keyframes colorchange /* Safari and Chrome - necessary duplicate */ { -0% { color: #b45f06; } -10% { color: #38761d; } -20% { color: #134f5c; } -30% { color: #0b5394; } -40% { color: #351c75; } -50% { color: #741b47; } -60% { color: blue; } -70% { color: #2980b9; } -80% { color: #f1c40f; } -90% { color: #2980b9; } -100% { color: #900; } -} -.evocp-box .evocp-frame { position: absolute; width: 100%; height: 100%; top: 0; right: 0; background: #fafafa; text-align: center; font-weight: 700; color: #444; padding: 0 0 20px 0; } -.dark .evocp-box .evocp-frame { color: #dedede; background: #202329; border-top: 1px solid #2f323a; } -.evocp-box .evocp-menuHColors, .evocp-box .evocp-menuColors, .evocp-box .evocp-bgmcolors, .evocp-box .evocp-colors, .evocp-box .evocp-alinkcolors { margin: 10px; overflow: hidden; } -.evocp-box .evocp-menuHColor, .evocp-box .evocp-menuColor, .evocp-box .evocp-bgmcolor, .evocp-box .evocp-color, .evocp-box .evocp-alinkcolor { position: relative; float: left; margin: 2px; height: 31px; width: 31px; max-height: 31px; max-width: 31px; background: #2f323a; color: transparent; overflow: hidden; cursor: pointer; border: 1px solid #646b7b; border-radius: 50%; } -.evocp-box .evocp-custom-colors, .evocp-box .evocp-custom-colors { clear: both; padding-top: 20px; } -.evocp-box input[name="evocpCustomalinkcolor"], .evocp-box input[name="evocpCustommenuColor"], .evocp-box input[name="evocpCustommenuHColor"], .evocp-box input[name="evocpCustombgmColor"], .evocp-box input[name="evocpCustomTXColor"] { margin: 10px 0 0 -4px; cursor: pointer; height: 30px; width: 30px; border-radius: 50%; border: none; outline: none; background: transparent; padding: 0; } -.appear-it { right: 0; box-shadow: -3px 0 4px 1px rgba(0, 0, 0, 0.1); } -.evocp-frame h2 { font-size: 1.0rem; line-height: 1.6rem; border-bottom: 1px solid #dedede; padding-top: 4px; /* -webkit-animation: colorchange 20s infinite alternate;*/ } -.dark .evocp-frame h2 { background-color: #2f323a; border-bottom: 1px solid #dedede; } -.evocp-frame .panel-heading h3 { cursor: pointer; display: inline-block; font-size: 0.8rem; line-height: 1.1rem; margin-top: 9px; } -.evocp-frame .panel-heading h3:hover { color: #000; } -.dark .evocp-frame h3:hover { color: #fff; } -.evocp-frame .panel { margin-bottom: 2px; } -.evocp-frame .panel-heading { text-align: left; border-top: 1px solid #dedede; border-bottom: 1px solid #dedede; background-color: #f2f2f2; padding: 0 0 0 8px; text-transform: uppercase; } -.dark .evocp-frame .panel-heading { background-color: #2f323a; border-color: #3e4144; } -.evocp-frame .panel-heading .btn { margin-top: 2px } -.dark .evocp-frame .panel-heading .btn { background-color: #2f323a; border-color: #3e4144; color: #fafafa; } -.dark .evocp-frame .panel-heading .btn:hover { background-color: #1a1c21; } -.dark .evocp-frame h2 { border-color: #3e4144; } -.evocp-frame .panel-heading .togglearrow { width: 10px; font-size: 10px; color: #bbb; margin-right: 2px; margin-top: -5px; } -.evocp-box .evocp-menuHColor.colorSelected:before, .evocp-box .evocp-menuColor.colorSelected:before, .evocp-box .evocp-bgmcolor.colorSelected:before, .evocp-box .evocp-color.colorSelected:before, .evocp-box .evocp-alinkcolor.colorSelected:before { font-family: 'Font Awesome 5 Free'; content: "\f1fc"; display: inline-block; padding-top: 3px; vertical-align: middle; color: #fff; } -.evocp-box .evocp-menuHColor.evocp_light.colorSelected:before, .evocp-box .evocp-menuColor.evocp_light.colorSelected:before, .evocp-box .evocp-bgmcolor.evocp_light.colorSelected:before, .evocp-box .evocp-color.evocp_light.colorSelected:before, .evocp-box .evocp-alinkcolor.evocp_light.colorSelected:before { color: #444 !important; } -.dark .evocp-box .btn-secondary { background-color: #2f323a; border-color: #3e4144; color: #fafafa; } -/*fix for mainmenu*/ -/* -#mainMenu.show .nav > li.dropdown.hover > a { - background-color: #fff; - color: #666!important; -} -/* color picker*/ -.sp-picker-container { width: 200px; border-left: 0 !important; } -.sp-container { width: 300px; background: #f2f2f2; border: 1px solid #dedede; } -.dark .sp-container { background: #2f323a; border: 1px solid #3e4144; } -.evo-cp-replacer, .sp-replacer.sp-light { padding: 2px; background: #f2f2f2; border-color: #dedede; margin: 3px auto; } -.dark .evo-cp-replacer, .dark .sp-replacer.sp-light { background: #2f323a; border-color: #3e4144; } -.sp-dd { margin-top: 4px; color: #666; } -.dark .sp-dd { color: #bcbec0; } -.sp-preview { height: 25px; width: 25px; max-height: 25px; max-width: 25px; overflow: hidden; cursor: pointer; border-radius: 50%; border: 0px solid #2f323a; } -/* navbar left */ -.navbar-left .evocp-box { - top: 0; -} +* { margin: 0; padding: 0; box-sizing: border-box; } +.evocp-box { position: fixed; width: 300px; min-height: 100%; top: 35px; right: -300px; color: #444; z-index: 10; transition: 0.5s cubic-bezier(1, 1.48, 0.76, 0.95) right, box-shadow .5s; } +.evocp-icon { position: absolute; bottom:60px; width: 34px; height: 29px; vertical-align: middle; line-height: 28px; left: -34px; background: #fafafa; box-shadow: -3px 0 2px 1px rgba(0, 0, 0, 0.1); border-radius: 50% 0 0 50%; text-align: center; font-size: 17px; cursor: pointer; z-index: 10; -webkit-animation: colorchange 15s infinite alternate; } +.dark .evocp-icon { background: #2f323a; border: 1px solid #2f323a; border-right: 0; -webkit-animation: colorchange 15s infinite alternate; } +i.evocpicon:hover { -webkit-transform: rotate(30deg); -moz-transform: rotate(30deg); -ms-transform: rotate(30deg); -o-transform: rotate(30deg); transform: rotate(30deg); } +@keyframes colorchange { +0% { color: #b45f06; } +10% { color: #38761d; } +20% { color: #134f5c; } +30% { color: #0b5394; } +40% { color: #351c75; } +50% { color: #741b47; } +60% { color: blue; } +70% { color: #2980b9; } +80% { color: #f1c40f; } +90% { color: #2980b9; } +100% { color: #900;} +} +@-webkit-keyframes colorchange /* Safari and Chrome - necessary duplicate */ { +0% { color: #b45f06; } +10% { color: #38761d; } +20% { color: #134f5c; } +30% { color: #0b5394; } +40% { color: #351c75; } +50% { color: #741b47; } +60% { color: blue; } +70% { color: #2980b9; } +80% { color: #f1c40f; } +90% { color: #2980b9; } +100% { color: #900; } +} +.evocp-box .evocp-frame { position: absolute; width: 100%; height: 100%; top: 0; right: 0; background: #fafafa; text-align: center; font-weight: 700; color: #444; padding: 0 0 20px 0; } +.dark .evocp-box .evocp-frame { color: #dedede; background: #202329; border-top: 1px solid #2f323a; } +.evocp-box .evocp-menuHColors, .evocp-box .evocp-menuColors, .evocp-box .evocp-bgmcolors, .evocp-box .evocp-colors, .evocp-box .evocp-alinkcolors { margin: 10px; overflow: hidden; } +.evocp-box .evocp-menuHColor, .evocp-box .evocp-menuColor, .evocp-box .evocp-bgmcolor, .evocp-box .evocp-color, .evocp-box .evocp-alinkcolor { position: relative; float: left; margin: 2px; height: 31px; width: 31px; max-height: 31px; max-width: 31px; background: #2f323a; color: transparent; overflow: hidden; cursor: pointer; border: 1px solid #646b7b; border-radius: 50%; } +.evocp-box .evocp-custom-colors, .evocp-box .evocp-custom-colors { clear: both; padding-top: 20px; } +.evocp-box input[name="evocpCustomalinkcolor"], .evocp-box input[name="evocpCustommenuColor"], .evocp-box input[name="evocpCustommenuHColor"], .evocp-box input[name="evocpCustombgmColor"], .evocp-box input[name="evocpCustomTXColor"] { margin: 10px 0 0 -4px; cursor: pointer; height: 30px; width: 30px; border-radius: 50%; border: none; outline: none; background: transparent; padding: 0; } +.appear-it { right: 0; box-shadow: -3px 0 4px 1px rgba(0, 0, 0, 0.1); } +.evocp-frame h2 { font-size: 1.0rem; line-height: 1.6rem; border-bottom: 1px solid #dedede; padding-top: 4px; /* -webkit-animation: colorchange 20s infinite alternate;*/ } +.dark .evocp-frame h2 { background-color: #2f323a; border-bottom: 1px solid #dedede; } +.evocp-frame .panel-heading h3 { cursor: pointer; display: inline-block; font-size: 0.8rem; line-height: 1.1rem; margin-top: 9px; } +.evocp-frame .panel-heading h3:hover { color: #000; } +.dark .evocp-frame h3:hover { color: #fff; } +.evocp-frame .panel { margin-bottom: 2px; } +.evocp-frame .panel-heading { text-align: left; border-top: 1px solid #dedede; border-bottom: 1px solid #dedede; background-color: #f2f2f2; padding: 0 0 0 8px; text-transform: uppercase; } +.dark .evocp-frame .panel-heading { background-color: #2f323a; border-color: #3e4144; } +.evocp-frame .panel-heading .btn { margin-top: 2px } +.dark .evocp-frame .panel-heading .btn { background-color: #2f323a; border-color: #3e4144; color: #fafafa; } +.dark .evocp-frame .panel-heading .btn:hover { background-color: #1a1c21; } +.dark .evocp-frame h2 { border-color: #3e4144; } +.evocp-frame .panel-heading .togglearrow { width: 10px; font-size: 10px; color: #bbb; margin-right: 2px; margin-top: -5px; } +.evocp-box .evocp-menuHColor.colorSelected:before, .evocp-box .evocp-menuColor.colorSelected:before, .evocp-box .evocp-bgmcolor.colorSelected:before, .evocp-box .evocp-color.colorSelected:before, .evocp-box .evocp-alinkcolor.colorSelected:before { font-family: 'Font Awesome 5 Free'; content: "\f1fc"; display: inline-block; padding-top: 3px; vertical-align: middle; color: #fff; } +.evocp-box .evocp-menuHColor.evocp_light.colorSelected:before, .evocp-box .evocp-menuColor.evocp_light.colorSelected:before, .evocp-box .evocp-bgmcolor.evocp_light.colorSelected:before, .evocp-box .evocp-color.evocp_light.colorSelected:before, .evocp-box .evocp-alinkcolor.evocp_light.colorSelected:before { color: #444 !important; } +.dark .evocp-box .btn-secondary { background-color: #2f323a; border-color: #3e4144; color: #fafafa; } +/*fix for mainmenu*/ +/* +#mainMenu.show .nav > li.dropdown.hover > a { + background-color: #fff; + color: #666!important; +} +/* color picker*/ +.sp-picker-container { width: 200px; border-left: 0 !important; } +.sp-container { width: 300px; background: #f2f2f2; border: 1px solid #dedede; } +.dark .sp-container { background: #2f323a; border: 1px solid #3e4144; } +.evo-cp-replacer, .sp-replacer.sp-light { padding: 2px; background: #f2f2f2; border-color: #dedede; margin: 3px auto; } +.dark .evo-cp-replacer, .dark .sp-replacer.sp-light { background: #2f323a; border-color: #3e4144; } +.sp-dd { margin-top: 4px; color: #666; } +.dark .sp-dd { color: #bcbec0; } +.sp-preview { height: 25px; width: 25px; max-height: 25px; max-width: 25px; overflow: hidden; cursor: pointer; border-radius: 50%; border: 0px solid #2f323a; } +/* navbar left */ +.navbar-left .evocp-box { + top: 0; +} diff --git a/manager/media/style/default/css/contextmenu.css b/manager/media/style/default/css/contextmenu.css index 1148c979fb..900329a7a6 100755 --- a/manager/media/style/default/css/contextmenu.css +++ b/manager/media/style/default/css/contextmenu.css @@ -1,14 +1,14 @@ -/* contextmenu */ -#mx_contextmenu, #contextmenu, .nu-context-menu, .contextMenu { display: block !important; position: absolute; overflow: hidden; top: 0; max-width: 25rem; width: auto !important; height: auto; padding: 0.25rem 0; visibility: hidden; opacity: 0; z-index: 10000; background: #fff; font-size: 0.9em; border: none; border-radius: 0.25rem; -webkit-box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.3); box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.3); transition: opacity 0s, visibility 0s; transform: translateZ(0) } -#mx_contextmenu .fa, #contextmenu .fa, .nu-context-menu .fa, .contextMenu .fa { width: 1.3em; font-size: 0.9rem; text-align: center; } -#mx_contextmenu.show, #contextmenu.show, .nu-context-menu.active, .contextMenu { visibility: visible; opacity: 1; transition: opacity 0.1s, visibility 0.1s; } -#mx_contextmenu > div, #contextmenu > div, .nu-context-menu ul li, .contextMenu > div { padding: 0.5em 2em 0.5em 1em; } -#mx_contextmenu #nameHolder, #contextmenu .menuHeader, .nu-context-menu-title { color: #1377c5; padding: 0.75em 1em; } -#mx_contextmenu .menuLink, #contextmenu .menuLink, .nu-context-menu ul li, .contextMenu > div { cursor: pointer; } -#mx_contextmenu .menuLink:hover, #contextmenu .menuLink:hover, .nu-context-menu ul li:hover, .contextMenu > div:hover { background-color: #1976d2; color: #fff; } -#mx_contextmenu .seperator, #contextmenu .seperator, .nu-context-menu ul hr, .contextMenu .cntxMnuSeparator { height: 1px; background-color: rgba(0, 0, 0, 0.07) !important; margin: 0.25em 0; padding: 0; cursor: default; } -.nu-context-menu ul { margin: 0; padding: 0; } -.contextMenu .cntxMnuItem { white-space: nowrap } -/* modes theme */ -/* darkness */ -.darkness #mx_contextmenu, .darkness #contextmenu, .darkness .nu-context-menu, .darkness .contextMenu { background-color: #343942; color: inherit; } +/* contextmenu */ +#mx_contextmenu, #contextmenu, .nu-context-menu, .contextMenu { display: block !important; position: absolute; overflow: hidden; top: 0; max-width: 25rem; width: auto !important; height: auto; padding: 0.25rem 0; visibility: hidden; opacity: 0; z-index: 10000; background: #fff; font-size: 0.9em; border: none; border-radius: 0.25rem; -webkit-box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.3); box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.3); transition: opacity 0s, visibility 0s; transform: translateZ(0) } +#mx_contextmenu .fa, #contextmenu .fa, .nu-context-menu .fa, .contextMenu .fa { width: 1.3em; font-size: 0.9rem; text-align: center; } +#mx_contextmenu.show, #contextmenu.show, .nu-context-menu.active, .contextMenu { visibility: visible; opacity: 1; transition: opacity 0.1s, visibility 0.1s; } +#mx_contextmenu > div, #contextmenu > div, .nu-context-menu ul li, .contextMenu > div { padding: 0.5em 2em 0.5em 1em; } +#mx_contextmenu #nameHolder, #contextmenu .menuHeader, .nu-context-menu-title { color: #1377c5; padding: 0.75em 1em; } +#mx_contextmenu .menuLink, #contextmenu .menuLink, .nu-context-menu ul li, .contextMenu > div { cursor: pointer; } +#mx_contextmenu .menuLink:hover, #contextmenu .menuLink:hover, .nu-context-menu ul li:hover, .contextMenu > div:hover { background-color: #1976d2; color: #fff; } +#mx_contextmenu .seperator, #contextmenu .seperator, .nu-context-menu ul hr, .contextMenu .cntxMnuSeparator { height: 1px; background-color: rgba(0, 0, 0, 0.07) !important; margin: 0.25em 0; padding: 0; cursor: default; } +.nu-context-menu ul { margin: 0; padding: 0; } +.contextMenu .cntxMnuItem { white-space: nowrap } +/* modes theme */ +/* darkness */ +.darkness #mx_contextmenu, .darkness #contextmenu, .darkness .nu-context-menu, .darkness .contextMenu { background-color: #343942; color: inherit; } diff --git a/manager/media/style/default/css/fonts.css b/manager/media/style/default/css/fonts.css index e3941e8d2d..c1ab974b14 100755 --- a/manager/media/style/default/css/fonts.css +++ b/manager/media/style/default/css/fonts.css @@ -1,112 +1,112 @@ html { font-size: 16px } -@media (max-width: 900px) { -html { font-size: 16px; } -} -@media (max-width: 400px) { -html { font-size: 16px; } -} -@supports (-webkit-overflow-scrolling: touch) { - html, body { -webkit-overflow-scrolling: touch; overflow: auto; height: 100%; /* ios iframe scroll jumping to top fix */ } -} +@media (max-width: 900px) { +html { font-size: 16px; } +} +@media (max-width: 400px) { +html { font-size: 16px; } +} +@supports (-webkit-overflow-scrolling: touch) { + html, body { -webkit-overflow-scrolling: touch; overflow: auto; height: 100%; /* ios iframe scroll jumping to top fix */ } +} body { font-weight: normal; font-style: normal; font-size: 0.8125rem; line-height: 1.5; font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: subpixel-antialiased } -/* For Arabic Font */ -html[lang="ar"] body, html[lang="ary"] body, html[lang="azb"] body, html[lang="fa-IR"] body, html[lang="haz"] body, html[lang="ps"] body, html[lang="ur"] body { font-family: Tahoma, Arial, sans-serif; } -/* For Chinese Font */ -html[lang="zh"] body { font-family: "PingFang SC", "Microsoft JhengHei", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", Helvetica, sans-serif; } -/* For Devanagari Font */ -html[lang="bn-BD"] body, html[lang="hi-IN"] body, html[lang="mr-IN"] body { font-family: Arial, sans-serif; } -/* For Greek Font */ -html[lang="el"] body { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; } -/* For Gujarati Font */ -html[lang="gu-IN"] body { font-family: Arial, sans-serif; } -/* For Hebrew Font */ -html[lang="he"] body { font-family: "Arial Hebrew", Arial, sans-serif; } -/* For Japanese Font */ -html[lang="ja"] body { font-family: Meiryo, "Hiragino Kaku Gothic Pro", sans-serif; } -/* For Korean font */ -html[lang="ko-KR"] body { font-family: "Apple SD Gothic Neo", "Malgun Gothic", "Nanum Gothic", Dotum, sans-serif; } -/* For Thai Font */ -html[lang="th"] body { font-family: "Sukhumvit Set", "Helvetica Neue", Helvetica, Arial, sans-serif; } -/* For Arabic Font */ -html[lang="fa"] body { font-family: Tahoma, Arial, sans-serif; } -body { background-color: #fafafa; color: #444; } -body.drag *, body.drag::after { cursor: grabbing !important; cursor: -moz-grabbing !important; cursor: -webkit-grabbing !important; cursor: -moz-grab !important; -moz-user-select: none !important; -webkit-user-select: none !important; user-select: none !important } -body.drag::after { bottom: 0; content: ""; left: 0; position: fixed; right: 0; top: 0; z-index: 999 } -body, ul, li { padding: 0; margin: 0; } -ul { margin-left: 1rem; margin-right: 1rem; } -li { list-style: none } -img { max-width: 100%; height: auto } +/* For Arabic Font */ +html[lang="ar"] body, html[lang="ary"] body, html[lang="azb"] body, html[lang="fa-IR"] body, html[lang="haz"] body, html[lang="ps"] body, html[lang="ur"] body { font-family: Tahoma, Arial, sans-serif; } +/* For Chinese Font */ +html[lang="zh"] body { font-family: "PingFang SC", "Microsoft JhengHei", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", Helvetica, sans-serif; } +/* For Devanagari Font */ +html[lang="bn-BD"] body, html[lang="hi-IN"] body, html[lang="mr-IN"] body { font-family: Arial, sans-serif; } +/* For Greek Font */ +html[lang="el"] body { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; } +/* For Gujarati Font */ +html[lang="gu-IN"] body { font-family: Arial, sans-serif; } +/* For Hebrew Font */ +html[lang="he"] body { font-family: "Arial Hebrew", Arial, sans-serif; } +/* For Japanese Font */ +html[lang="ja"] body { font-family: Meiryo, "Hiragino Kaku Gothic Pro", sans-serif; } +/* For Korean font */ +html[lang="ko-KR"] body { font-family: "Apple SD Gothic Neo", "Malgun Gothic", "Nanum Gothic", Dotum, sans-serif; } +/* For Thai Font */ +html[lang="th"] body { font-family: "Sukhumvit Set", "Helvetica Neue", Helvetica, Arial, sans-serif; } +/* For Arabic Font */ +html[lang="fa"] body { font-family: Tahoma, Arial, sans-serif; } +body { background-color: #fafafa; color: #444; } +body.drag *, body.drag::after { cursor: grabbing !important; cursor: -moz-grabbing !important; cursor: -webkit-grabbing !important; cursor: -moz-grab !important; -moz-user-select: none !important; -webkit-user-select: none !important; user-select: none !important } +body.drag::after { bottom: 0; content: ""; left: 0; position: fixed; right: 0; top: 0; z-index: 999 } +body, ul, li { padding: 0; margin: 0; } +ul { margin-left: 1rem; margin-right: 1rem; } +li { list-style: none } +img { max-width: 100%; height: auto } .h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 { margin-bottom: .5rem; font-family: inherit; font-weight: 500; line-height: 1.1; color: inherit } -.h1, h1 { font-size: 1.75rem } -.h2, h2 { font-size: 1.5rem } -.h3, h3 { font-size: 1.25rem } -.h4, h4 { font-size: 1rem } -.h5, h5 { font-size: 0.8125rem } -.h6, h6 { font-size: 0.7rem } -h1 .fa:first-child { color:#444; margin-right: 0.5em } -a { color: #3481bc; text-decoration: none } -.text-primary { color: #3481bc !important; } -a:focus, a:hover { color: #014c8c; text-decoration: underline } -a[href=""], a:not([href]) { cursor: default } -a:not([href]):not([tabindex]) { color: inherit; text-decoration: none } -a:not([href]):not([tabindex]):focus, a:not([href]):not([tabindex]):hover { color: inherit; text-decoration: none } -a:not([href]):not([tabindex]):focus { outline: 0 } -* { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box } -*::-ms-clear { display: none; } -.text-justify { text-align: justify !important } -.text-nowrap { white-space: nowrap !important } -.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap } -.text-left { text-align: left !important } -.text-right { text-align: right !important } -.text-center { text-align: center !important } -.text-lowercase { text-transform: lowercase !important } -.text-uppercase { text-transform: uppercase !important } -.text-capitalize { text-transform: capitalize !important } -.font-weight-normal { font-weight: 400 } -.font-weight-bold { font-weight: 700 } -.font-italic { font-style: italic } -.text-white { color: #fff !important } -.text-muted { color: #818a91 !important } -.text-decoration-through { text-decoration: line-through !important } -.text-underline { text-decoration: underline !important } -a.text-underline:hover { text-decoration: none !important } -a.text-muted:focus, a.text-muted:hover { color: #4b5257 !important } -.text-primary { color: #0275d8 !important } -a.text-primary:focus, a.text-primary:hover { color: #025aa5 !important } -.text-success { color: #5cb85c !important } -a.text-success:focus, a.text-success:hover { color: #449d44 !important } -.text-info { color: #5bc0de !important } -a.text-info:focus, a.text-info:hover { color: #31b0d5 !important } -.text-warning { color: #f0ad4e !important } -a.text-warning:focus, a.text-warning:hover { color: #ec971f !important } -.text-danger { color: #d9534f !important } -a.text-danger:focus, a.text-danger:hover { color: #c9302c !important } -.text-gray-dark { color: #292b2c !important } -a.text-gray-dark:focus, a.text-gray-dark:hover { color: #101112 !important } -.text-hide { font: 0/0 a; color: transparent; text-shadow: none; background-color: transparent; border: 0 } -.hide { display: none !important } -.show { display: block !important } -.visible { visibility: visible !important; } -.invisible { visibility: hidden !important; } -.clear { clear: both; } -/* custom */ -#loadingmask { display: none !important; } -.fa > .fa-lock { position: relative; float: left; width: auto !important; margin-top: -1em; font-size: 0.7em !important; color: #ffc107 !important; -webkit-text-stroke: 1px rgba(0, 0, 0, 0.39); text-stroke: 1px rgba(0, 0, 0, 0.39); } -.rotate180 { -webkit-transform: rotate(180deg); -moz-transform: rotate(180deg); -ms-transform: rotate(180deg); -o-transform: rotate(180deg); transform: rotate(180deg); } -.disabledPlugin, .disabledPlugin a { color: #b68282; font-style: italic; } -h1 { font-size: 1.5em; line-height: 1.5rem; padding: 0.8rem; margin: 0; } -h1 .fa { margin-right: 0.25em; color: #1377c5; } -h1 .help { margin: 0 0 0 0.25em; color: rgba(0, 0, 0, 0.15); font-size: 0.8em; cursor: pointer } -h1 .help:hover { color: rgba(0, 0, 0, 0.3); } -h1 small { margin-left: 0.5em; line-height: 1em } -.split { height: 0; font-size: 0; clear: both; padding: 0; border-top: 1px dotted rgba(0, 0, 0, .1) } -#previewIframe { width: 100%; height: 400px; } -.messageRead { color: #333; } -.messageUnread { color: #3cb371; font-weight: 500; } -.element-edit-message { display: none } -.element-edit-message p:last-child, .element-edit-message-tab p:last-child { margin-bottom: 0 } -/* modes theme */ -/* darkness */ -.darkness h1 .help { color: #1976d2; opacity: .5; } -.darkness h1 .help:hover { opacity: 1; } +.h1, h1 { font-size: 1.75rem } +.h2, h2 { font-size: 1.5rem } +.h3, h3 { font-size: 1.25rem } +.h4, h4 { font-size: 1rem } +.h5, h5 { font-size: 0.8125rem } +.h6, h6 { font-size: 0.7rem } +h1 .fa:first-child { color:#444; margin-right: 0.5em } +a { color: #3481bc; text-decoration: none } +.text-primary { color: #3481bc !important; } +a:focus, a:hover { color: #014c8c; text-decoration: underline } +a[href=""], a:not([href]) { cursor: default } +a:not([href]):not([tabindex]) { color: inherit; text-decoration: none } +a:not([href]):not([tabindex]):focus, a:not([href]):not([tabindex]):hover { color: inherit; text-decoration: none } +a:not([href]):not([tabindex]):focus { outline: 0 } +* { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box } +*::-ms-clear { display: none; } +.text-justify { text-align: justify !important } +.text-nowrap { white-space: nowrap !important } +.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap } +.text-left { text-align: left !important } +.text-right { text-align: right !important } +.text-center { text-align: center !important } +.text-lowercase { text-transform: lowercase !important } +.text-uppercase { text-transform: uppercase !important } +.text-capitalize { text-transform: capitalize !important } +.font-weight-normal { font-weight: 400 } +.font-weight-bold { font-weight: 700 } +.font-italic { font-style: italic } +.text-white { color: #fff !important } +.text-muted { color: #818a91 !important } +.text-decoration-through { text-decoration: line-through !important } +.text-underline { text-decoration: underline !important } +a.text-underline:hover { text-decoration: none !important } +a.text-muted:focus, a.text-muted:hover { color: #4b5257 !important } +.text-primary { color: #0275d8 !important } +a.text-primary:focus, a.text-primary:hover { color: #025aa5 !important } +.text-success { color: #5cb85c !important } +a.text-success:focus, a.text-success:hover { color: #449d44 !important } +.text-info { color: #5bc0de !important } +a.text-info:focus, a.text-info:hover { color: #31b0d5 !important } +.text-warning { color: #f0ad4e !important } +a.text-warning:focus, a.text-warning:hover { color: #ec971f !important } +.text-danger { color: #d9534f !important } +a.text-danger:focus, a.text-danger:hover { color: #c9302c !important } +.text-gray-dark { color: #292b2c !important } +a.text-gray-dark:focus, a.text-gray-dark:hover { color: #101112 !important } +.text-hide { font: 0/0 a; color: transparent; text-shadow: none; background-color: transparent; border: 0 } +.hide { display: none !important } +.show { display: block !important } +.visible { visibility: visible !important; } +.invisible { visibility: hidden !important; } +.clear { clear: both; } +/* custom */ +#loadingmask { display: none !important; } +.fa > .fa-lock { position: relative; float: left; width: auto !important; margin-top: -1em; font-size: 0.7em !important; color: #ffc107 !important; -webkit-text-stroke: 1px rgba(0, 0, 0, 0.39); text-stroke: 1px rgba(0, 0, 0, 0.39); } +.rotate180 { -webkit-transform: rotate(180deg); -moz-transform: rotate(180deg); -ms-transform: rotate(180deg); -o-transform: rotate(180deg); transform: rotate(180deg); } +.disabledPlugin, .disabledPlugin a { color: #b68282; font-style: italic; } +h1 { font-size: 1.5em; line-height: 1.5rem; padding: 0.8rem; margin: 0; } +h1 .fa { margin-right: 0.25em; color: #1377c5; } +h1 .help { margin: 0 0 0 0.25em; color: rgba(0, 0, 0, 0.15); font-size: 0.8em; cursor: pointer } +h1 .help:hover { color: rgba(0, 0, 0, 0.3); } +h1 small { margin-left: 0.5em; line-height: 1em } +.split { height: 0; font-size: 0; clear: both; padding: 0; border-top: 1px dotted rgba(0, 0, 0, .1) } +#previewIframe { width: 100%; height: 400px; } +.messageRead { color: #333; } +.messageUnread { color: #3cb371; font-weight: 500; } +.element-edit-message { display: none } +.element-edit-message p:last-child, .element-edit-message-tab p:last-child { margin-bottom: 0 } +/* modes theme */ +/* darkness */ +.darkness h1 .help { color: #1976d2; opacity: .5; } +.darkness h1 .help:hover { opacity: 1; } diff --git a/manager/media/style/default/css/layout.css b/manager/media/style/default/css/layout.css index 173a9bcd6c..8d38186556 100755 --- a/manager/media/style/default/css/layout.css +++ b/manager/media/style/default/css/layout.css @@ -1,29 +1,29 @@ -.layout { display: table; table-layout: fixed; height: 100%; width: 100% } -.layout > .layout-row { display: table-row; vertical-align: top; height: 100% } -.layout > .layout-row > .layout-cell { display: table-cell; vertical-align: top; height: 100% } -.layout > .layout-row > .layout-cell.layout-container, .layout > .layout-row > .layout-cell .layout-container, .layout > .layout-row > .layout-cell.padded-container, .layout > .layout-row > .layout-cell .padded-container { padding: 1rem 1rem 0 1rem } -.layout > .layout-row > .layout-cell.layout-container .container-flush, .layout > .layout-row > .layout-cell .layout-container .container-flush, .layout > .layout-row > .layout-cell.padded-container .container-flush, .layout > .layout-row > .layout-cell .padded-container .container-flush { padding-top: 0 } -.layout > .layout-row > .layout-cell .layout-relative { position: relative; height: 100% } -.layout > .layout-row > .layout-cell .layout-absolute { position: absolute; height: 100%; width: 100% } -.layout > .layout-row > .layout-cell.min-size { width: 0 } -.layout > .layout-row > .layout-cell.min-height { height: 0 } -.layout > .layout-row > .layout-cell.center { text-align: center } -.layout > .layout-row > .layout-cell.middle { vertical-align: middle } -.layout > .layout-row > .layout-cell.layout-container, .layout > .layout-row > .layout-cell .layout-container, .layout > .layout-row > .layout-cell.padded-container, .layout > .layout-row > .layout-cell .padded-container { padding: 1rem 1rem 0 1rem } -.layout > .layout-row > .layout-cell.layout-container .container-flush, .layout > .layout-row > .layout-cell .layout-container .container-flush, .layout > .layout-row > .layout-cell.padded-container .container-flush, .layout > .layout-row > .layout-cell .padded-container .container-flush { padding-top: 0 } -.layout > .layout-row > .layout-cell .layout-relative { position: relative; height: 100% } -.layout > .layout-row > .layout-cell .layout-absolute { position: absolute; height: 100%; width: 100% } -.layout > .layout-row > .layout-cell.min-size { width: 0 } -.layout > .layout-row > .layout-cell.min-height { height: 0 } -.layout > .layout-row > .layout-cell.center { text-align: center } -.layout > .layout-row > .layout-cell.middle { vertical-align: middle } -.layout > .layout-row.min-size { height: 0 } -.layout > .layout-cell { display: table-cell; vertical-align: top; height: 100% } -.layout > .layout-cell.layout-container, .layout > .layout-cell .layout-container, .layout > .layout-cell.padded-container, .layout > .layout-cell .padded-container { padding: 1rem 1rem 0 1rem } -.layout > .layout-cell.layout-container .container-flush, .layout > .layout-cell .layout-container .container-flush, .layout > .layout-cell.padded-container .container-flush, .layout > .layout-cell .padded-container .container-flush { padding-top: 0 } -.layout > .layout-cell .layout-relative { position: relative; height: 100% } -.layout > .layout-cell .layout-absolute { position: absolute; height: 100%; width: 100% } -.layout > .layout-cell.min-size { width: 0 } -.layout > .layout-cell.min-height { height: 0 } -.layout > .layout-cell.center { text-align: center } -.layout > .layout-cell.middle { vertical-align: middle } +.layout { display: table; table-layout: fixed; height: 100%; width: 100% } +.layout > .layout-row { display: table-row; vertical-align: top; height: 100% } +.layout > .layout-row > .layout-cell { display: table-cell; vertical-align: top; height: 100% } +.layout > .layout-row > .layout-cell.layout-container, .layout > .layout-row > .layout-cell .layout-container, .layout > .layout-row > .layout-cell.padded-container, .layout > .layout-row > .layout-cell .padded-container { padding: 1rem 1rem 0 1rem } +.layout > .layout-row > .layout-cell.layout-container .container-flush, .layout > .layout-row > .layout-cell .layout-container .container-flush, .layout > .layout-row > .layout-cell.padded-container .container-flush, .layout > .layout-row > .layout-cell .padded-container .container-flush { padding-top: 0 } +.layout > .layout-row > .layout-cell .layout-relative { position: relative; height: 100% } +.layout > .layout-row > .layout-cell .layout-absolute { position: absolute; height: 100%; width: 100% } +.layout > .layout-row > .layout-cell.min-size { width: 0 } +.layout > .layout-row > .layout-cell.min-height { height: 0 } +.layout > .layout-row > .layout-cell.center { text-align: center } +.layout > .layout-row > .layout-cell.middle { vertical-align: middle } +.layout > .layout-row > .layout-cell.layout-container, .layout > .layout-row > .layout-cell .layout-container, .layout > .layout-row > .layout-cell.padded-container, .layout > .layout-row > .layout-cell .padded-container { padding: 1rem 1rem 0 1rem } +.layout > .layout-row > .layout-cell.layout-container .container-flush, .layout > .layout-row > .layout-cell .layout-container .container-flush, .layout > .layout-row > .layout-cell.padded-container .container-flush, .layout > .layout-row > .layout-cell .padded-container .container-flush { padding-top: 0 } +.layout > .layout-row > .layout-cell .layout-relative { position: relative; height: 100% } +.layout > .layout-row > .layout-cell .layout-absolute { position: absolute; height: 100%; width: 100% } +.layout > .layout-row > .layout-cell.min-size { width: 0 } +.layout > .layout-row > .layout-cell.min-height { height: 0 } +.layout > .layout-row > .layout-cell.center { text-align: center } +.layout > .layout-row > .layout-cell.middle { vertical-align: middle } +.layout > .layout-row.min-size { height: 0 } +.layout > .layout-cell { display: table-cell; vertical-align: top; height: 100% } +.layout > .layout-cell.layout-container, .layout > .layout-cell .layout-container, .layout > .layout-cell.padded-container, .layout > .layout-cell .padded-container { padding: 1rem 1rem 0 1rem } +.layout > .layout-cell.layout-container .container-flush, .layout > .layout-cell .layout-container .container-flush, .layout > .layout-cell.padded-container .container-flush, .layout > .layout-cell .padded-container .container-flush { padding-top: 0 } +.layout > .layout-cell .layout-relative { position: relative; height: 100% } +.layout > .layout-cell .layout-absolute { position: absolute; height: 100%; width: 100% } +.layout > .layout-cell.min-size { width: 0 } +.layout > .layout-cell.min-height { height: 0 } +.layout > .layout-cell.center { text-align: center } +.layout > .layout-cell.middle { vertical-align: middle } diff --git a/manager/media/style/default/css/page.css b/manager/media/style/default/css/page.css index 4844db2ca6..ddcccb1a0f 100644 --- a/manager/media/style/default/css/page.css +++ b/manager/media/style/default/css/page.css @@ -1,9 +1,9 @@ -@import "../../common/bootstrap/css/bootstrap.min.css?v=4.3.1"; -@import "../../common/font-awesome/css/font-awesome.min.css?v=5.10.2"; -@import 'fonts.css?v=1.3.5'; -@import "forms.css?v=1.3.5"; -@import "mainmenu.css?v=1.3.5"; -@import "tree.css"; -@import "tabpane.css"; -@import "contextmenu.css"; -@import "index.css"; +@import "../../common/bootstrap/css/bootstrap.min.css?v=4.3.1"; +@import "../../common/font-awesome/css/font-awesome.min.css?v=5.10.2"; +@import 'fonts.css?v=1.3.5'; +@import "forms.css?v=1.3.5"; +@import "mainmenu.css?v=1.3.5"; +@import "tree.css"; +@import "tabpane.css"; +@import "contextmenu.css"; +@import "index.css"; diff --git a/manager/media/style/default/index.html b/manager/media/style/default/index.html index fdd3791786..cfb7d0fe18 100755 --- a/manager/media/style/default/index.html +++ b/manager/media/style/default/index.html @@ -1,2 +1,2 @@ -

              Unauthorized access

              +

              Unauthorized access

              You're not allowed to access file folder \ No newline at end of file diff --git a/manager/media/style/default/js/color.switcher.js b/manager/media/style/default/js/color.switcher.js index 65b250c4d9..655f19ec92 100755 --- a/manager/media/style/default/js/color.switcher.js +++ b/manager/media/style/default/js/color.switcher.js @@ -1,281 +1,281 @@ -//Evolution color switcher -jQuery(document).ready(function($) { - //appear the evo colors switcher sidebar - $('.evocp-box .evocp-icon').on('click', function() { - $('.evocp-box').toggleClass('appear-it'); - }); - $('.evocp-box').attr('unselectable', 'on') - .css('user-select', 'none') - .on('selectstart', false); - - //vars// - var bgmcolor; - var color; - var menuColor; - var menuHColor; - var alinkcolor; - - // Get text color - var my_evo_color = localStorage.getItem('my_evo_color'); - if (my_evo_color) { - color = my_evo_color; - setColor(color); - } - // Get alink color - var my_evo_alinkcolor = localStorage.getItem('my_evo_alinkcolor'); - if (my_evo_alinkcolor) { - alinkcolor = my_evo_alinkcolor; - setalinkColor(alinkcolor); - } - // Get background menu color - var my_evo_bgmcolor = localStorage.getItem('my_evo_bgmcolor'); - if (my_evo_bgmcolor) { - bgmcolor = my_evo_bgmcolor; - setBgmColor(bgmcolor); - } - // Get menu link color - var my_evo_menuColor = localStorage.getItem('my_evo_menuColor'); - if (my_evo_menuColor) { - menuColor = my_evo_menuColor; - setMenuColor(menuColor); - } - // Get menu link hover color - var my_evo_menuHColor = localStorage.getItem('my_evo_menuHColor'); - if (my_evo_menuHColor) { - menuHColor = my_evo_menuHColor; - setMenuHColor(menuHColor); - } - - //Menu background part - - //change elements colors - function setBgmColor(bgmcolor) { - $('[data-evocp="bgmColor"]').css('backgroundColor', bgmcolor); - $('#mainMenu li.item > a').mouseover(function() { - $(this).css('backgroundColor', bgmcolor); - $(this).css('color', '#fff'); - }).mouseout(function() { - $(this).css('backgroundColor', '#FFF'); - $(this).css('color', '#444'); - }); - } - //store the color value in a variable - $('.evocp-bgmcolor').each(function(i) { - $('.evocp-bgmcolor').eq(i).css('backgroundColor', $(this).text()); - $('.evocp-bgmcolor').eq(i).on('click', function() { - bgmcolor = $(this).css('backgroundColor'); - // Save the color in local storage - localStorage.setItem('my_evo_bgmcolor', bgmcolor); - $(this).addClass('colorSelected').siblings().removeClass('colorSelected'); - }); - }); - //Color Picker colors - $('.bgmPicker .sp-top-inner').on('click', function() { - bgmcolor = $('.bgmcolors .sp-preview-inner').css("background-color"); - // Save the color in local storage - localStorage.setItem('my_evo_bgmcolor', bgmcolor); - setBgmColor(bgmcolor); - }); - $('.bgmPicker .sp-input').on('keydown', function() { - bgmcolor = $('.bgmcolors .sp-preview-inner').css("background-color"); - // Save the color in local storage - localStorage.setItem('my_evo_bgmcolor', bgmcolor); - setBgmColor(bgmcolor); - }); - //apply colors - $('*').on('click', function() { - setBgmColor(bgmcolor); - }); - - /////menu link Color part - - //change elements colors - function setMenuColor(menucolor) { - $('[data-evocp="menuColor"]').css('color', menuColor); - $("#mainMenu:not(.show) .nav > li > a").css('color', menuColor); - $("#mainMenu .nav .label_searchid").css('color', menuColor); - $("#mainMenu.show .nav > li > a").css('color', '#444!important'); - } - //store the color value in a variable - $('.evocp-menuColor').each(function(i) { - $('.evocp-menuColor').eq(i).css('backgroundColor', $(this).text()); - $('.evocp-menuColor').eq(i).on('click', function() { - menuColor = $(this).css('backgroundColor'); - // Save the color in local storage - localStorage.setItem('my_evo_menuColor', menuColor); - $(this).addClass('colorSelected').siblings().removeClass('colorSelected'); - }); - }); - - //Color Picker colors - $('.menucolorPicker .sp-top-inner').on('click', function() { - menuColor = $('.menuColors .sp-preview-inner').css("background-color"); - // Save the color in local storage - localStorage.setItem('my_evo_menuColor', menuColor); - setMenuColor(menuColor); - }); - $('.menucolorPicker .sp-input').on('keydown', function() { - menuColor = $('.menuColors .sp-preview-inner').css("background-color"); - // Save the color in local storage - localStorage.setItem('my_evo_menuColor', menuColor); - setMenuColor(menuColor); - }); - //apply colors - $('*').on('click', function() { - setMenuColor(menuColor); - }); - - /////menu link Hover Color - - //change elements colors - function setMenuHColor(menuHcolor) { - $('[data-evocp="menuHColor"]').css('color', menuHColor); - $('#mainMenu .nav > li:not(.active) > a.hover').css('color', menuHColor); - $('[data-evocp="menuColor"].hover').css('color', menuHColor); - - //$('#evo-tab-home.tab.selected').css('backgroundColor', bgcolor); - - $('#mainMenu .nav > li:not(.active) > a').mouseover(function() { - $(this).css('color', menuHColor); - }).mouseout(function() { - $(this).css('color', menuColor); - }); - $('#mainMenu .nav .label_searchid').mouseover(function() { - $(this).css('color', menuHColor); - }).mouseout(function() { - $(this).css('color', menuColor); - }); - $('#mainMenu .nav > li.active > a').css('color', menuHColor); - //#mainMenu.show .nav > li.dropdown.hover > a - //$('#bgPicker').val('bgcolor'); - } - //store the color value in a variable - $('.evocp-menuHColor').each(function(i) { - $('.evocp-menuHColor').eq(i).css('backgroundColor', $(this).text()); - $('.evocp-menuHColor').eq(i).on('click', function() { - menuHColor = $(this).css('backgroundColor'); - // Save the color in local storage - localStorage.setItem('my_evo_menuHColor', menuHColor); - $(this).addClass('colorSelected').siblings().removeClass('colorSelected'); - }); - }); - - //Color Picker colors - $('.menuHcolorPicker .sp-top-inner').on('click', function() { - menuHColor = $('.menuHColors .sp-preview-inner').css("background-color"); - // Save the color in local storage - localStorage.setItem('my_evo_menuHColor', menuHColor); - setMenuHColor(menuHColor); - }); - $('.menuHcolorPicker .sp-input').on('keydown', function() { - menuHColor = $('.menuHColors .sp-preview-inner').css("background-color"); - // Save the color in local storage - localStorage.setItem('my_evo_menuHColor', menuHColor); - setMenuHColor(menuHColor); - }); - //apply colors - $('*').on('click', function() { - setMenuHColor(menuHColor); - }); - - ///// Body Links color - //change elements colors - function setalinkColor(alinkcolor) { - $('[data-evocp="alinkcolor"]').css('color', alinkcolor); - //need fix and move to dedicated tree panel - // $('body:not(.dark) #treeRoot a:not(.deleted):not(.unpublished):not(.hidemenu) .title').css('color', alinkcolor); - // $('body #treeRoot a:not(.deleted):not(.unpublished):not(.hidemenu) .title').css('color', alinkcolor); - $('.container-body a:not(.btn)').css('color', alinkcolor); - } - //store the color value in a variable - $('.evocp-alinkcolor').each(function(i) { - $('.evocp-alinkcolor').eq(i).css('backgroundColor', $(this).text()); - $('.evocp-alinkcolor').eq(i).on('click', function() { - alinkcolor = $(this).css('backgroundColor'); - window.main.location.reload(); - // Save the color in local storage - localStorage.setItem('my_evo_alinkcolor', alinkcolor); - $(this).addClass('colorSelected').siblings().removeClass('colorSelected'); - }); - }); - //Color Picker colors - $('.linkcolorPicker .sp-top-inner').on('click', function() { - alinkcolor = $('.alinkcolors .sp-preview-inner').css("background-color"); - // Save the color in local storage - localStorage.setItem('my_evo_alinkcolor', alinkcolor); - setalinkColor(alinkcolor); - window.main.location.reload(); - }); - $('.linkcolorPicker .sp-input').on('keydown', function() { - alinkcolor = $('.alinkcolors .sp-preview-inner').css("background-color"); - // Save the color in local storage - localStorage.setItem('my_evo_alinkcolor', alinkcolor); - setalinkColor(alinkcolor); - window.main.location.reload(); - }); - //apply colors - $('*').on('click', function() { - setalinkColor(alinkcolor); - }); - - /////Body text color - //change elements colors - function setColor(color) { - $('[data-evocp="color"]').css('color', color); - $('[data-evocp="borderColor"]').css('border-color', color); - $('h1 .fa:not(.help)').css('color', color); - } - //store the color value in a variable - $('.evocp-color').each(function(i) { - $('.evocp-color').eq(i).css('backgroundColor', $(this).text()); - $('.evocp-color').eq(i).on('click', function() { - color = $(this).css('backgroundColor'); - window.main.location.reload(); - // Save the color in local storage - localStorage.setItem('my_evo_color', color); - $(this).addClass('colorSelected').siblings().removeClass('colorSelected'); - //alert("Text color is " + color); - - }); - }); - - //custom colors - $('.textcolorPicker .sp-top-inner').on('click', function() { - color = $('.cpcolors .sp-preview-inner').css("background-color"); - // Save the color in local storage - localStorage.setItem('my_evo_color', color); - setColor(color); - window.main.location.reload(); - }); - - //apply colors - $('*').on('click', function() { - setColor(color); - }); - - -////close document ready -}); -//clear Local Storage and reload only main frame -function cleanLocalStorageReloadMain(keys) { - keys = keys.split(','); - for (var i = 0; i < keys.length; i++) { - delete localStorage[keys[i]]; - } - window.main.location.reload(); -} -//clear Local Storage and reload all frames -function cleanLocalStorageReloadAll(keys) { - keys = keys.split(','); - for (var i = 0; i < keys.length; i++) { - delete localStorage[keys[i]]; - } - location.reload(); -} -//toggle chevron icon -jQuery(document).on('click', '.panel-heading h3', function(e) { - var $this = $(this); - icon = $(this).find("i.togglearrow"); - icon.toggleClass("fa-chevron-right fa-chevron-down") - -}) +//Evolution color switcher +jQuery(document).ready(function($) { + //appear the evo colors switcher sidebar + $('.evocp-box .evocp-icon').on('click', function() { + $('.evocp-box').toggleClass('appear-it'); + }); + $('.evocp-box').attr('unselectable', 'on') + .css('user-select', 'none') + .on('selectstart', false); + + //vars// + var bgmcolor; + var color; + var menuColor; + var menuHColor; + var alinkcolor; + + // Get text color + var my_evo_color = localStorage.getItem('my_evo_color'); + if (my_evo_color) { + color = my_evo_color; + setColor(color); + } + // Get alink color + var my_evo_alinkcolor = localStorage.getItem('my_evo_alinkcolor'); + if (my_evo_alinkcolor) { + alinkcolor = my_evo_alinkcolor; + setalinkColor(alinkcolor); + } + // Get background menu color + var my_evo_bgmcolor = localStorage.getItem('my_evo_bgmcolor'); + if (my_evo_bgmcolor) { + bgmcolor = my_evo_bgmcolor; + setBgmColor(bgmcolor); + } + // Get menu link color + var my_evo_menuColor = localStorage.getItem('my_evo_menuColor'); + if (my_evo_menuColor) { + menuColor = my_evo_menuColor; + setMenuColor(menuColor); + } + // Get menu link hover color + var my_evo_menuHColor = localStorage.getItem('my_evo_menuHColor'); + if (my_evo_menuHColor) { + menuHColor = my_evo_menuHColor; + setMenuHColor(menuHColor); + } + + //Menu background part + + //change elements colors + function setBgmColor(bgmcolor) { + $('[data-evocp="bgmColor"]').css('backgroundColor', bgmcolor); + $('#mainMenu li.item > a').mouseover(function() { + $(this).css('backgroundColor', bgmcolor); + $(this).css('color', '#fff'); + }).mouseout(function() { + $(this).css('backgroundColor', '#FFF'); + $(this).css('color', '#444'); + }); + } + //store the color value in a variable + $('.evocp-bgmcolor').each(function(i) { + $('.evocp-bgmcolor').eq(i).css('backgroundColor', $(this).text()); + $('.evocp-bgmcolor').eq(i).on('click', function() { + bgmcolor = $(this).css('backgroundColor'); + // Save the color in local storage + localStorage.setItem('my_evo_bgmcolor', bgmcolor); + $(this).addClass('colorSelected').siblings().removeClass('colorSelected'); + }); + }); + //Color Picker colors + $('.bgmPicker .sp-top-inner').on('click', function() { + bgmcolor = $('.bgmcolors .sp-preview-inner').css("background-color"); + // Save the color in local storage + localStorage.setItem('my_evo_bgmcolor', bgmcolor); + setBgmColor(bgmcolor); + }); + $('.bgmPicker .sp-input').on('keydown', function() { + bgmcolor = $('.bgmcolors .sp-preview-inner').css("background-color"); + // Save the color in local storage + localStorage.setItem('my_evo_bgmcolor', bgmcolor); + setBgmColor(bgmcolor); + }); + //apply colors + $('*').on('click', function() { + setBgmColor(bgmcolor); + }); + + /////menu link Color part + + //change elements colors + function setMenuColor(menucolor) { + $('[data-evocp="menuColor"]').css('color', menuColor); + $("#mainMenu:not(.show) .nav > li > a").css('color', menuColor); + $("#mainMenu .nav .label_searchid").css('color', menuColor); + $("#mainMenu.show .nav > li > a").css('color', '#444!important'); + } + //store the color value in a variable + $('.evocp-menuColor').each(function(i) { + $('.evocp-menuColor').eq(i).css('backgroundColor', $(this).text()); + $('.evocp-menuColor').eq(i).on('click', function() { + menuColor = $(this).css('backgroundColor'); + // Save the color in local storage + localStorage.setItem('my_evo_menuColor', menuColor); + $(this).addClass('colorSelected').siblings().removeClass('colorSelected'); + }); + }); + + //Color Picker colors + $('.menucolorPicker .sp-top-inner').on('click', function() { + menuColor = $('.menuColors .sp-preview-inner').css("background-color"); + // Save the color in local storage + localStorage.setItem('my_evo_menuColor', menuColor); + setMenuColor(menuColor); + }); + $('.menucolorPicker .sp-input').on('keydown', function() { + menuColor = $('.menuColors .sp-preview-inner').css("background-color"); + // Save the color in local storage + localStorage.setItem('my_evo_menuColor', menuColor); + setMenuColor(menuColor); + }); + //apply colors + $('*').on('click', function() { + setMenuColor(menuColor); + }); + + /////menu link Hover Color + + //change elements colors + function setMenuHColor(menuHcolor) { + $('[data-evocp="menuHColor"]').css('color', menuHColor); + $('#mainMenu .nav > li:not(.active) > a.hover').css('color', menuHColor); + $('[data-evocp="menuColor"].hover').css('color', menuHColor); + + //$('#evo-tab-home.tab.selected').css('backgroundColor', bgcolor); + + $('#mainMenu .nav > li:not(.active) > a').mouseover(function() { + $(this).css('color', menuHColor); + }).mouseout(function() { + $(this).css('color', menuColor); + }); + $('#mainMenu .nav .label_searchid').mouseover(function() { + $(this).css('color', menuHColor); + }).mouseout(function() { + $(this).css('color', menuColor); + }); + $('#mainMenu .nav > li.active > a').css('color', menuHColor); + //#mainMenu.show .nav > li.dropdown.hover > a + //$('#bgPicker').val('bgcolor'); + } + //store the color value in a variable + $('.evocp-menuHColor').each(function(i) { + $('.evocp-menuHColor').eq(i).css('backgroundColor', $(this).text()); + $('.evocp-menuHColor').eq(i).on('click', function() { + menuHColor = $(this).css('backgroundColor'); + // Save the color in local storage + localStorage.setItem('my_evo_menuHColor', menuHColor); + $(this).addClass('colorSelected').siblings().removeClass('colorSelected'); + }); + }); + + //Color Picker colors + $('.menuHcolorPicker .sp-top-inner').on('click', function() { + menuHColor = $('.menuHColors .sp-preview-inner').css("background-color"); + // Save the color in local storage + localStorage.setItem('my_evo_menuHColor', menuHColor); + setMenuHColor(menuHColor); + }); + $('.menuHcolorPicker .sp-input').on('keydown', function() { + menuHColor = $('.menuHColors .sp-preview-inner').css("background-color"); + // Save the color in local storage + localStorage.setItem('my_evo_menuHColor', menuHColor); + setMenuHColor(menuHColor); + }); + //apply colors + $('*').on('click', function() { + setMenuHColor(menuHColor); + }); + + ///// Body Links color + //change elements colors + function setalinkColor(alinkcolor) { + $('[data-evocp="alinkcolor"]').css('color', alinkcolor); + //need fix and move to dedicated tree panel + // $('body:not(.dark) #treeRoot a:not(.deleted):not(.unpublished):not(.hidemenu) .title').css('color', alinkcolor); + // $('body #treeRoot a:not(.deleted):not(.unpublished):not(.hidemenu) .title').css('color', alinkcolor); + $('.container-body a:not(.btn)').css('color', alinkcolor); + } + //store the color value in a variable + $('.evocp-alinkcolor').each(function(i) { + $('.evocp-alinkcolor').eq(i).css('backgroundColor', $(this).text()); + $('.evocp-alinkcolor').eq(i).on('click', function() { + alinkcolor = $(this).css('backgroundColor'); + window.main.location.reload(); + // Save the color in local storage + localStorage.setItem('my_evo_alinkcolor', alinkcolor); + $(this).addClass('colorSelected').siblings().removeClass('colorSelected'); + }); + }); + //Color Picker colors + $('.linkcolorPicker .sp-top-inner').on('click', function() { + alinkcolor = $('.alinkcolors .sp-preview-inner').css("background-color"); + // Save the color in local storage + localStorage.setItem('my_evo_alinkcolor', alinkcolor); + setalinkColor(alinkcolor); + window.main.location.reload(); + }); + $('.linkcolorPicker .sp-input').on('keydown', function() { + alinkcolor = $('.alinkcolors .sp-preview-inner').css("background-color"); + // Save the color in local storage + localStorage.setItem('my_evo_alinkcolor', alinkcolor); + setalinkColor(alinkcolor); + window.main.location.reload(); + }); + //apply colors + $('*').on('click', function() { + setalinkColor(alinkcolor); + }); + + /////Body text color + //change elements colors + function setColor(color) { + $('[data-evocp="color"]').css('color', color); + $('[data-evocp="borderColor"]').css('border-color', color); + $('h1 .fa:not(.help)').css('color', color); + } + //store the color value in a variable + $('.evocp-color').each(function(i) { + $('.evocp-color').eq(i).css('backgroundColor', $(this).text()); + $('.evocp-color').eq(i).on('click', function() { + color = $(this).css('backgroundColor'); + window.main.location.reload(); + // Save the color in local storage + localStorage.setItem('my_evo_color', color); + $(this).addClass('colorSelected').siblings().removeClass('colorSelected'); + //alert("Text color is " + color); + + }); + }); + + //custom colors + $('.textcolorPicker .sp-top-inner').on('click', function() { + color = $('.cpcolors .sp-preview-inner').css("background-color"); + // Save the color in local storage + localStorage.setItem('my_evo_color', color); + setColor(color); + window.main.location.reload(); + }); + + //apply colors + $('*').on('click', function() { + setColor(color); + }); + + +////close document ready +}); +//clear Local Storage and reload only main frame +function cleanLocalStorageReloadMain(keys) { + keys = keys.split(','); + for (var i = 0; i < keys.length; i++) { + delete localStorage[keys[i]]; + } + window.main.location.reload(); +} +//clear Local Storage and reload all frames +function cleanLocalStorageReloadAll(keys) { + keys = keys.split(','); + for (var i = 0; i < keys.length; i++) { + delete localStorage[keys[i]]; + } + location.reload(); +} +//toggle chevron icon +jQuery(document).on('click', '.panel-heading h3', function(e) { + var $this = $(this); + icon = $(this).find("i.togglearrow"); + icon.toggleClass("fa-chevron-right fa-chevron-down") + +}) diff --git a/manager/media/style/default/style.css b/manager/media/style/default/style.css index d86ee14dbf..a68b6c31f0 100755 --- a/manager/media/style/default/style.css +++ b/manager/media/style/default/style.css @@ -1,8 +1,8 @@ -@import "../common/bootstrap/css/bootstrap.min.css?v=4.0.0-alpha.5"; -@import "../common/font-awesome/css/font-awesome.min.css?v=4.7.0"; -@import "css/fonts.css?v=1.3.5"; -@import "css/forms.css?v=1.3.5"; -@import "css/custom.css?v=1.3.5"; -@import "css/tabpane.css"; -@import "css/contextmenu.css"; -@import "css/main.css"; +@import "../common/bootstrap/css/bootstrap.min.css?v=4.0.0-alpha.5"; +@import "../common/font-awesome/css/font-awesome.min.css?v=4.7.0"; +@import "css/fonts.css?v=1.3.5"; +@import "css/forms.css?v=1.3.5"; +@import "css/custom.css?v=1.3.5"; +@import "css/tabpane.css"; +@import "css/contextmenu.css"; +@import "css/main.css"; diff --git a/manager/media/style/default/welcome.tpl b/manager/media/style/default/welcome.tpl index 2df10fd9dc..f3e18d567e 100755 --- a/manager/media/style/default/welcome.tpl +++ b/manager/media/style/default/welcome.tpl @@ -1,33 +1,33 @@ -[[@OnManagerWelcomePrerender]] - -
              - - -
              -
              - [+logout_reminder_msg+] -
              -
              - - -
              -
              - [+multiple_sessions_msg+] -
              -
              - - -
              -
              - [+config_check_results+] -
              -
              - - -
              - [+widgets+] -
              - -
              - -[[@OnManagerWelcomeRender]] +[[@OnManagerWelcomePrerender]] + +
              + + +
              +
              + [+logout_reminder_msg+] +
              +
              + + +
              +
              + [+multiple_sessions_msg+] +
              +
              + + +
              +
              + [+config_check_results+] +
              +
              + + +
              + [+widgets+] +
              + +
              + +[[@OnManagerWelcomeRender]] diff --git a/manager/views/page/move_document.blade.php b/manager/views/page/move_document.blade.php index 885f305aa9..6a39edbfc5 100644 --- a/manager/views/page/move_document.blade.php +++ b/manager/views/page/move_document.blade.php @@ -1,76 +1,76 @@ -@extends('manager::template.page') -@section('content') - - @push('scripts.top') - - @endpush -

              - {{ $document->pagetitle }} ({{ $document->getKey() }}) -

              - - {{ ManagerTheme::styleHtml('actionbuttons.dynamic.save') }} - -
              -
              -

              {{ ManagerTheme::getLexicon('move_resource_message') }}

              - +@extends('manager::template.page') +@section('content') + + @push('scripts.top') + + @endpush +

              + {{ $document->pagetitle }} ({{ $document->getKey() }}) +

              + + {{ ManagerTheme::styleHtml('actionbuttons.dynamic.save') }} + +
              +
              +

              {{ ManagerTheme::getLexicon('move_resource_message') }}

              + @csrf - - - - -

              {{ ManagerTheme::getLexicon('resource_to_be_moved') }}: {{ $document->getKey() }}

              - {{ ManagerTheme::getLexicon('move_resource_new_parent') }} - -
              -
              -@endsection + + + + +

              {{ ManagerTheme::getLexicon('resource_to_be_moved') }}: {{ $document->getKey() }}

              + {{ ManagerTheme::getLexicon('move_resource_new_parent') }} + +
              +
              +@endsection diff --git a/manager/views/page/plugin_priority.blade.php b/manager/views/page/plugin_priority.blade.php index d4857a819b..e463358d46 100644 --- a/manager/views/page/plugin_priority.blade.php +++ b/manager/views/page/plugin_priority.blade.php @@ -1,62 +1,62 @@ -@extends('manager::template.page') -@section('content') - @push('scripts.top') - - @endpush - -

              - {{ ManagerTheme::getLexicon('plugin_priority_title') }} -

              - - {{ ManagerTheme::styleHtml('actionbuttons.dynamic.save') }} - -
              -
              - {{ ManagerTheme::getLexicon('plugin_priority') }} -

              {{ ManagerTheme::getLexicon('plugin_priority_instructions') }}

              - - @if($updateMsg) - {{ ManagerTheme::getLexicon('sort_updated') }} - @endif - - - -
              +@extends('manager::template.page') +@section('content') + @push('scripts.top') + + @endpush + +

              + {{ ManagerTheme::getLexicon('plugin_priority_title') }} +

              + + {{ ManagerTheme::styleHtml('actionbuttons.dynamic.save') }} + +
              +
              + {{ ManagerTheme::getLexicon('plugin_priority') }} +

              {{ ManagerTheme::getLexicon('plugin_priority_instructions') }}

              + + @if($updateMsg) + {{ ManagerTheme::getLexicon('sort_updated') }} + @endif + + + + @csrf - @foreach($events as $event) -
              - {{ $event->name }} -
                - @foreach($event->plugins as $plugin) -
              • disabled) class="disabledPlugin"@endif> - - {{ $plugin->name }}@if($plugin->disabled) (hide) @endif -
              • - @endforeach -
              -
              - @endforeach - -
              -
              - - -@endsection + @foreach($events as $event) +
              + {{ $event->name }} +
                + @foreach($event->plugins as $plugin) +
              • disabled) class="disabledPlugin"@endif> + + {{ $plugin->name }}@if($plugin->disabled) (hide) @endif +
              • + @endforeach +
              +
              + @endforeach + +
              +
              + + +@endsection