You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11379 lines
290 KiB
11379 lines
290 KiB
/**
|
|
* jQuery EasyUI 1.3.2
|
|
*
|
|
* Copyright (c) 2009-2013 www.jeasyui.com. All rights reserved.
|
|
*
|
|
* Licensed under the GPL or commercial licenses
|
|
* To use it on other terms please contact us: jeasyui@gmail.com
|
|
* http://www.gnu.org/licenses/gpl.txt
|
|
* http://www.jeasyui.com/license_commercial.php
|
|
*
|
|
*/
|
|
(function($){
|
|
$.parser={auto:true,onComplete:function(_1){
|
|
},plugins:["draggable","droppable","resizable","pagination","linkbutton","menu","menubutton","splitbutton","progressbar","tree","combobox","combotree","combogrid","numberbox","validatebox","searchbox","numberspinner","timespinner","calendar","datebox","datetimebox","slider","layout","panel","datagrid","propertygrid","treegrid","tabs","accordion","window","dialog"],parse:function(_2){
|
|
var aa=[];
|
|
for(var i=0;i<$.parser.plugins.length;i++){
|
|
var _3=$.parser.plugins[i];
|
|
var r=$(".easyui-"+_3,_2);
|
|
if(r.length){
|
|
if(r[_3]){
|
|
r[_3]();
|
|
}else{
|
|
aa.push({name:_3,jq:r});
|
|
}
|
|
}
|
|
}
|
|
if(aa.length&&window.easyloader){
|
|
var _4=[];
|
|
for(var i=0;i<aa.length;i++){
|
|
_4.push(aa[i].name);
|
|
}
|
|
easyloader.load(_4,function(){
|
|
for(var i=0;i<aa.length;i++){
|
|
var _5=aa[i].name;
|
|
var jq=aa[i].jq;
|
|
jq[_5]();
|
|
}
|
|
$.parser.onComplete.call($.parser,_2);
|
|
});
|
|
}else{
|
|
$.parser.onComplete.call($.parser,_2);
|
|
}
|
|
},parseOptions:function(_6,_7){
|
|
var t=$(_6);
|
|
var _8={};
|
|
var s=$.trim(t.attr("data-options"));
|
|
if(s){
|
|
var _9=s.substring(0,1);
|
|
var _a=s.substring(s.length-1,1);
|
|
if(_9!="{"){
|
|
s="{"+s;
|
|
}
|
|
if(_a!="}"){
|
|
s=s+"}";
|
|
}
|
|
_8=(new Function("return "+s))();
|
|
}
|
|
if(_7){
|
|
var _b={};
|
|
for(var i=0;i<_7.length;i++){
|
|
var pp=_7[i];
|
|
if(typeof pp=="string"){
|
|
if(pp=="width"||pp=="height"||pp=="left"||pp=="top"){
|
|
_b[pp]=parseInt(_6.style[pp])||undefined;
|
|
}else{
|
|
_b[pp]=t.attr(pp);
|
|
}
|
|
}else{
|
|
for(var _c in pp){
|
|
var _d=pp[_c];
|
|
if(_d=="boolean"){
|
|
_b[_c]=t.attr(_c)?(t.attr(_c)=="true"):undefined;
|
|
}else{
|
|
if(_d=="number"){
|
|
_b[_c]=t.attr(_c)=="0"?0:parseFloat(t.attr(_c))||undefined;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$.extend(_8,_b);
|
|
}
|
|
return _8;
|
|
}};
|
|
$(function(){
|
|
if(!window.easyloader&&$.parser.auto){
|
|
$.parser.parse();
|
|
}
|
|
});
|
|
$.fn._outerWidth=function(_e){
|
|
if(_e==undefined){
|
|
if(this[0]==window){
|
|
return this.width()||document.body.clientWidth;
|
|
}
|
|
return this.outerWidth()||0;
|
|
}
|
|
return this.each(function(){
|
|
if(!$.support.boxModel&&$.browser.msie){
|
|
$(this).width(_e);
|
|
}else{
|
|
$(this).width(_e-($(this).outerWidth()-$(this).width()));
|
|
}
|
|
});
|
|
};
|
|
$.fn._outerHeight=function(_f){
|
|
if(_f==undefined){
|
|
if(this[0]==window){
|
|
return this.height()||document.body.clientHeight;
|
|
}
|
|
return this.outerHeight()||0;
|
|
}
|
|
return this.each(function(){
|
|
if(!$.support.boxModel&&$.browser.msie){
|
|
$(this).height(_f);
|
|
}else{
|
|
$(this).height(_f-($(this).outerHeight()-$(this).height()));
|
|
}
|
|
});
|
|
};
|
|
$.fn._scrollLeft=function(_10){
|
|
if(_10==undefined){
|
|
return this.scrollLeft();
|
|
}else{
|
|
return this.each(function(){
|
|
$(this).scrollLeft(_10);
|
|
});
|
|
}
|
|
};
|
|
$.fn._propAttr=$.fn.prop||$.fn.attr;
|
|
$.fn._fit=function(fit){
|
|
fit=fit==undefined?true:fit;
|
|
var p=this.parent()[0];
|
|
var t=this[0];
|
|
var _11=p.fcount||0;
|
|
if(fit){
|
|
if(!t.fitted){
|
|
t.fitted=true;
|
|
p.fcount=_11+1;
|
|
$(p).addClass("panel-noscroll");
|
|
if(p.tagName=="BODY"){
|
|
$("html").addClass("panel-fit");
|
|
}
|
|
}
|
|
}else{
|
|
if(t.fitted){
|
|
t.fitted=false;
|
|
p.fcount=_11-1;
|
|
if(p.fcount==0){
|
|
$(p).removeClass("panel-noscroll");
|
|
if(p.tagName=="BODY"){
|
|
$("html").removeClass("panel-fit");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return {width:$(p).width(),height:$(p).height()};
|
|
};
|
|
})(jQuery);
|
|
(function($){
|
|
var _12=false;
|
|
function _13(e){
|
|
var _14=$.data(e.data.target,"draggable");
|
|
var _15=_14.options;
|
|
var _16=_14.proxy;
|
|
var _17=e.data;
|
|
var _18=_17.startLeft+e.pageX-_17.startX;
|
|
var top=_17.startTop+e.pageY-_17.startY;
|
|
if(_16){
|
|
if(_16.parent()[0]==document.body){
|
|
if(_15.deltaX!=null&&_15.deltaX!=undefined){
|
|
_18=e.pageX+_15.deltaX;
|
|
}else{
|
|
_18=e.pageX-e.data.offsetWidth;
|
|
}
|
|
if(_15.deltaY!=null&&_15.deltaY!=undefined){
|
|
top=e.pageY+_15.deltaY;
|
|
}else{
|
|
top=e.pageY-e.data.offsetHeight;
|
|
}
|
|
}else{
|
|
if(_15.deltaX!=null&&_15.deltaX!=undefined){
|
|
_18+=e.data.offsetWidth+_15.deltaX;
|
|
}
|
|
if(_15.deltaY!=null&&_15.deltaY!=undefined){
|
|
top+=e.data.offsetHeight+_15.deltaY;
|
|
}
|
|
}
|
|
}
|
|
if(e.data.parent!=document.body){
|
|
_18+=$(e.data.parent).scrollLeft();
|
|
top+=$(e.data.parent).scrollTop();
|
|
}
|
|
if(_15.axis=="h"){
|
|
_17.left=_18;
|
|
}else{
|
|
if(_15.axis=="v"){
|
|
_17.top=top;
|
|
}else{
|
|
_17.left=_18;
|
|
_17.top=top;
|
|
}
|
|
}
|
|
};
|
|
function _19(e){
|
|
var _1a=$.data(e.data.target,"draggable");
|
|
var _1b=_1a.options;
|
|
var _1c=_1a.proxy;
|
|
if(!_1c){
|
|
_1c=$(e.data.target);
|
|
}
|
|
_1c.css({left:e.data.left,top:e.data.top});
|
|
$("body").css("cursor",_1b.cursor);
|
|
};
|
|
function _1d(e){
|
|
_12=true;
|
|
var _1e=$.data(e.data.target,"draggable");
|
|
var _1f=_1e.options;
|
|
var _20=$(".droppable").filter(function(){
|
|
return e.data.target!=this;
|
|
}).filter(function(){
|
|
var _21=$.data(this,"droppable").options.accept;
|
|
if(_21){
|
|
return $(_21).filter(function(){
|
|
return this==e.data.target;
|
|
}).length>0;
|
|
}else{
|
|
return true;
|
|
}
|
|
});
|
|
_1e.droppables=_20;
|
|
var _22=_1e.proxy;
|
|
if(!_22){
|
|
if(_1f.proxy){
|
|
if(_1f.proxy=="clone"){
|
|
_22=$(e.data.target).clone().insertAfter(e.data.target);
|
|
}else{
|
|
_22=_1f.proxy.call(e.data.target,e.data.target);
|
|
}
|
|
_1e.proxy=_22;
|
|
}else{
|
|
_22=$(e.data.target);
|
|
}
|
|
}
|
|
_22.css("position","absolute");
|
|
_13(e);
|
|
_19(e);
|
|
_1f.onStartDrag.call(e.data.target,e);
|
|
return false;
|
|
};
|
|
function _23(e){
|
|
var _24=$.data(e.data.target,"draggable");
|
|
_13(e);
|
|
if(_24.options.onDrag.call(e.data.target,e)!=false){
|
|
_19(e);
|
|
}
|
|
var _25=e.data.target;
|
|
_24.droppables.each(function(){
|
|
var _26=$(this);
|
|
if(_26.droppable("options").disabled){
|
|
return;
|
|
}
|
|
var p2=_26.offset();
|
|
if(e.pageX>p2.left&&e.pageX<p2.left+_26.outerWidth()&&e.pageY>p2.top&&e.pageY<p2.top+_26.outerHeight()){
|
|
if(!this.entered){
|
|
$(this).trigger("_dragenter",[_25]);
|
|
this.entered=true;
|
|
}
|
|
$(this).trigger("_dragover",[_25]);
|
|
}else{
|
|
if(this.entered){
|
|
$(this).trigger("_dragleave",[_25]);
|
|
this.entered=false;
|
|
}
|
|
}
|
|
});
|
|
return false;
|
|
};
|
|
function _27(e){
|
|
_12=false;
|
|
_23(e);
|
|
var _28=$.data(e.data.target,"draggable");
|
|
var _29=_28.proxy;
|
|
var _2a=_28.options;
|
|
if(_2a.revert){
|
|
if(_2b()==true){
|
|
$(e.data.target).css({position:e.data.startPosition,left:e.data.startLeft,top:e.data.startTop});
|
|
}else{
|
|
if(_29){
|
|
var _2c,top;
|
|
if(_29.parent()[0]==document.body){
|
|
_2c=e.data.startX-e.data.offsetWidth;
|
|
top=e.data.startY-e.data.offsetHeight;
|
|
}else{
|
|
_2c=e.data.startLeft;
|
|
top=e.data.startTop;
|
|
}
|
|
_29.animate({left:_2c,top:top},function(){
|
|
_2d();
|
|
});
|
|
}else{
|
|
$(e.data.target).animate({left:e.data.startLeft,top:e.data.startTop},function(){
|
|
$(e.data.target).css("position",e.data.startPosition);
|
|
});
|
|
}
|
|
}
|
|
}else{
|
|
$(e.data.target).css({position:"absolute",left:e.data.left,top:e.data.top});
|
|
_2b();
|
|
}
|
|
_2a.onStopDrag.call(e.data.target,e);
|
|
$(document).unbind(".draggable");
|
|
setTimeout(function(){
|
|
$("body").css("cursor","");
|
|
},100);
|
|
function _2d(){
|
|
if(_29){
|
|
_29.remove();
|
|
}
|
|
_28.proxy=null;
|
|
};
|
|
function _2b(){
|
|
var _2e=false;
|
|
_28.droppables.each(function(){
|
|
var _2f=$(this);
|
|
if(_2f.droppable("options").disabled){
|
|
return;
|
|
}
|
|
var p2=_2f.offset();
|
|
if(e.pageX>p2.left&&e.pageX<p2.left+_2f.outerWidth()&&e.pageY>p2.top&&e.pageY<p2.top+_2f.outerHeight()){
|
|
if(_2a.revert){
|
|
$(e.data.target).css({position:e.data.startPosition,left:e.data.startLeft,top:e.data.startTop});
|
|
}
|
|
_2d();
|
|
$(this).trigger("_drop",[e.data.target]);
|
|
_2e=true;
|
|
this.entered=false;
|
|
return false;
|
|
}
|
|
});
|
|
if(!_2e&&!_2a.revert){
|
|
_2d();
|
|
}
|
|
return _2e;
|
|
};
|
|
return false;
|
|
};
|
|
$.fn.draggable=function(_30,_31){
|
|
if(typeof _30=="string"){
|
|
return $.fn.draggable.methods[_30](this,_31);
|
|
}
|
|
return this.each(function(){
|
|
var _32;
|
|
var _33=$.data(this,"draggable");
|
|
if(_33){
|
|
_33.handle.unbind(".draggable");
|
|
_32=$.extend(_33.options,_30);
|
|
}else{
|
|
_32=$.extend({},$.fn.draggable.defaults,$.fn.draggable.parseOptions(this),_30||{});
|
|
}
|
|
if(_32.disabled==true){
|
|
$(this).css("cursor","");
|
|
return;
|
|
}
|
|
var _34=null;
|
|
if(typeof _32.handle=="undefined"||_32.handle==null){
|
|
_34=$(this);
|
|
}else{
|
|
_34=(typeof _32.handle=="string"?$(_32.handle,this):_32.handle);
|
|
}
|
|
$.data(this,"draggable",{options:_32,handle:_34});
|
|
_34.unbind(".draggable").bind("mousemove.draggable",{target:this},function(e){
|
|
if(_12){
|
|
return;
|
|
}
|
|
var _35=$.data(e.data.target,"draggable").options;
|
|
if(_36(e)){
|
|
$(this).css("cursor",_35.cursor);
|
|
}else{
|
|
$(this).css("cursor","");
|
|
}
|
|
}).bind("mouseleave.draggable",{target:this},function(e){
|
|
$(this).css("cursor","");
|
|
}).bind("mousedown.draggable",{target:this},function(e){
|
|
if(_36(e)==false){
|
|
return;
|
|
}
|
|
$(this).css("cursor","");
|
|
var _37=$(e.data.target).position();
|
|
var _38=$(e.data.target).offset();
|
|
var _39={startPosition:$(e.data.target).css("position"),startLeft:_37.left,startTop:_37.top,left:_37.left,top:_37.top,startX:e.pageX,startY:e.pageY,offsetWidth:(e.pageX-_38.left),offsetHeight:(e.pageY-_38.top),target:e.data.target,parent:$(e.data.target).parent()[0]};
|
|
$.extend(e.data,_39);
|
|
var _3a=$.data(e.data.target,"draggable").options;
|
|
if(_3a.onBeforeDrag.call(e.data.target,e)==false){
|
|
return;
|
|
}
|
|
$(document).bind("mousedown.draggable",e.data,_1d);
|
|
$(document).bind("mousemove.draggable",e.data,_23);
|
|
$(document).bind("mouseup.draggable",e.data,_27);
|
|
});
|
|
function _36(e){
|
|
var _3b=$.data(e.data.target,"draggable");
|
|
var _3c=_3b.handle;
|
|
var _3d=$(_3c).offset();
|
|
var _3e=$(_3c).outerWidth();
|
|
var _3f=$(_3c).outerHeight();
|
|
var t=e.pageY-_3d.top;
|
|
var r=_3d.left+_3e-e.pageX;
|
|
var b=_3d.top+_3f-e.pageY;
|
|
var l=e.pageX-_3d.left;
|
|
return Math.min(t,r,b,l)>_3b.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(_40){
|
|
var t=$(_40);
|
|
return $.extend({},$.parser.parseOptions(_40,["cursor","handle","axis",{"revert":"boolean","deltaX":"number","deltaY":"number","edge":"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,onBeforeDrag:function(e){
|
|
},onStartDrag:function(e){
|
|
},onDrag:function(e){
|
|
},onStopDrag:function(e){
|
|
}};
|
|
})(jQuery);
|
|
(function($){
|
|
function _41(_42){
|
|
$(_42).addClass("droppable");
|
|
$(_42).bind("_dragenter",function(e,_43){
|
|
$.data(_42,"droppable").options.onDragEnter.apply(_42,[e,_43]);
|
|
});
|
|
$(_42).bind("_dragleave",function(e,_44){
|
|
$.data(_42,"droppable").options.onDragLeave.apply(_42,[e,_44]);
|
|
});
|
|
$(_42).bind("_dragover",function(e,_45){
|
|
$.data(_42,"droppable").options.onDragOver.apply(_42,[e,_45]);
|
|
});
|
|
$(_42).bind("_drop",function(e,_46){
|
|
$.data(_42,"droppable").options.onDrop.apply(_42,[e,_46]);
|
|
});
|
|
};
|
|
$.fn.droppable=function(_47,_48){
|
|
if(typeof _47=="string"){
|
|
return $.fn.droppable.methods[_47](this,_48);
|
|
}
|
|
_47=_47||{};
|
|
return this.each(function(){
|
|
var _49=$.data(this,"droppable");
|
|
if(_49){
|
|
$.extend(_49.options,_47);
|
|
}else{
|
|
_41(this);
|
|
$.data(this,"droppable",{options:$.extend({},$.fn.droppable.defaults,$.fn.droppable.parseOptions(this),_47)});
|
|
}
|
|
});
|
|
};
|
|
$.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(_4a){
|
|
var t=$(_4a);
|
|
return $.extend({},$.parser.parseOptions(_4a,["accept"]),{disabled:(t.attr("disabled")?true:undefined)});
|
|
};
|
|
$.fn.droppable.defaults={accept:null,disabled:false,onDragEnter:function(e,_4b){
|
|
},onDragOver:function(e,_4c){
|
|
},onDragLeave:function(e,_4d){
|
|
},onDrop:function(e,_4e){
|
|
}};
|
|
})(jQuery);
|
|
(function($){
|
|
var _4f=false;
|
|
$.fn.resizable=function(_50,_51){
|
|
if(typeof _50=="string"){
|
|
return $.fn.resizable.methods[_50](this,_51);
|
|
}
|
|
function _52(e){
|
|
var _53=e.data;
|
|
var _54=$.data(_53.target,"resizable").options;
|
|
if(_53.dir.indexOf("e")!=-1){
|
|
var _55=_53.startWidth+e.pageX-_53.startX;
|
|
_55=Math.min(Math.max(_55,_54.minWidth),_54.maxWidth);
|
|
_53.width=_55;
|
|
}
|
|
if(_53.dir.indexOf("s")!=-1){
|
|
var _56=_53.startHeight+e.pageY-_53.startY;
|
|
_56=Math.min(Math.max(_56,_54.minHeight),_54.maxHeight);
|
|
_53.height=_56;
|
|
}
|
|
if(_53.dir.indexOf("w")!=-1){
|
|
_53.width=_53.startWidth-e.pageX+_53.startX;
|
|
if(_53.width>=_54.minWidth&&_53.width<=_54.maxWidth){
|
|
_53.left=_53.startLeft+e.pageX-_53.startX;
|
|
}
|
|
}
|
|
if(_53.dir.indexOf("n")!=-1){
|
|
_53.height=_53.startHeight-e.pageY+_53.startY;
|
|
if(_53.height>=_54.minHeight&&_53.height<=_54.maxHeight){
|
|
_53.top=_53.startTop+e.pageY-_53.startY;
|
|
}
|
|
}
|
|
};
|
|
function _57(e){
|
|
var _58=e.data;
|
|
var _59=_58.target;
|
|
$(_59).css({left:_58.left,top:_58.top});
|
|
$(_59)._outerWidth(_58.width)._outerHeight(_58.height);
|
|
};
|
|
function _5a(e){
|
|
_4f=true;
|
|
$.data(e.data.target,"resizable").options.onStartResize.call(e.data.target,e);
|
|
return false;
|
|
};
|
|
function _5b(e){
|
|
_52(e);
|
|
if($.data(e.data.target,"resizable").options.onResize.call(e.data.target,e)!=false){
|
|
_57(e);
|
|
}
|
|
return false;
|
|
};
|
|
function _5c(e){
|
|
_4f=false;
|
|
_52(e,true);
|
|
_57(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 _5d=null;
|
|
var _5e=$.data(this,"resizable");
|
|
if(_5e){
|
|
$(this).unbind(".resizable");
|
|
_5d=$.extend(_5e.options,_50||{});
|
|
}else{
|
|
_5d=$.extend({},$.fn.resizable.defaults,$.fn.resizable.parseOptions(this),_50||{});
|
|
$.data(this,"resizable",{options:_5d});
|
|
}
|
|
if(_5d.disabled==true){
|
|
return;
|
|
}
|
|
$(this).bind("mousemove.resizable",{target:this},function(e){
|
|
if(_4f){
|
|
return;
|
|
}
|
|
var dir=_5f(e);
|
|
if(dir==""){
|
|
$(e.data.target).css("cursor","");
|
|
}else{
|
|
$(e.data.target).css("cursor",dir+"-resize");
|
|
}
|
|
}).bind("mouseleave.resizable",{target:this},function(e){
|
|
$(e.data.target).css("cursor","");
|
|
}).bind("mousedown.resizable",{target:this},function(e){
|
|
var dir=_5f(e);
|
|
if(dir==""){
|
|
return;
|
|
}
|
|
function _60(css){
|
|
var val=parseInt($(e.data.target).css(css));
|
|
if(isNaN(val)){
|
|
return 0;
|
|
}else{
|
|
return val;
|
|
}
|
|
};
|
|
var _61={target:e.data.target,dir:dir,startLeft:_60("left"),startTop:_60("top"),left:_60("left"),top:_60("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",_61,_5a);
|
|
$(document).bind("mousemove.resizable",_61,_5b);
|
|
$(document).bind("mouseup.resizable",_61,_5c);
|
|
$("body").css("cursor",dir+"-resize");
|
|
});
|
|
function _5f(e){
|
|
var tt=$(e.data.target);
|
|
var dir="";
|
|
var _62=tt.offset();
|
|
var _63=tt.outerWidth();
|
|
var _64=tt.outerHeight();
|
|
var _65=_5d.edge;
|
|
if(e.pageY>_62.top&&e.pageY<_62.top+_65){
|
|
dir+="n";
|
|
}else{
|
|
if(e.pageY<_62.top+_64&&e.pageY>_62.top+_64-_65){
|
|
dir+="s";
|
|
}
|
|
}
|
|
if(e.pageX>_62.left&&e.pageX<_62.left+_65){
|
|
dir+="w";
|
|
}else{
|
|
if(e.pageX<_62.left+_63&&e.pageX>_62.left+_63-_65){
|
|
dir+="e";
|
|
}
|
|
}
|
|
var _66=_5d.handles.split(",");
|
|
for(var i=0;i<_66.length;i++){
|
|
var _67=_66[i].replace(/(^\s*)|(\s*$)/g,"");
|
|
if(_67=="all"||_67==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(_68){
|
|
var t=$(_68);
|
|
return $.extend({},$.parser.parseOptions(_68,["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){
|
|
}};
|
|
})(jQuery);
|
|
(function($){
|
|
function _69(_6a){
|
|
var _6b=$.data(_6a,"linkbutton").options;
|
|
$(_6a).empty();
|
|
$(_6a).addClass("l-btn");
|
|
if(_6b.id){
|
|
$(_6a).attr("id",_6b.id);
|
|
}else{
|
|
$(_6a).attr("id","");
|
|
}
|
|
if(_6b.plain){
|
|
$(_6a).addClass("l-btn-plain");
|
|
}else{
|
|
$(_6a).removeClass("l-btn-plain");
|
|
}
|
|
if(_6b.text){
|
|
$(_6a).html(_6b.text).wrapInner("<span class=\"l-btn-left\">"+"<span class=\"l-btn-text\">"+"</span>"+"</span>");
|
|
if(_6b.iconCls){
|
|
$(_6a).find(".l-btn-text").addClass(_6b.iconCls).addClass(_6b.iconAlign=="left"?"l-btn-icon-left":"l-btn-icon-right");
|
|
}
|
|
}else{
|
|
$(_6a).html(" ").wrapInner("<span class=\"l-btn-left\">"+"<span class=\"l-btn-text\">"+"<span class=\"l-btn-empty\"></span>"+"</span>"+"</span>");
|
|
if(_6b.iconCls){
|
|
$(_6a).find(".l-btn-empty").addClass(_6b.iconCls);
|
|
}
|
|
}
|
|
$(_6a).unbind(".linkbutton").bind("focus.linkbutton",function(){
|
|
if(!_6b.disabled){
|
|
$(this).find("span.l-btn-text").addClass("l-btn-focus");
|
|
}
|
|
}).bind("blur.linkbutton",function(){
|
|
$(this).find("span.l-btn-text").removeClass("l-btn-focus");
|
|
});
|
|
_6c(_6a,_6b.disabled);
|
|
};
|
|
function _6c(_6d,_6e){
|
|
var _6f=$.data(_6d,"linkbutton");
|
|
if(_6e){
|
|
_6f.options.disabled=true;
|
|
var _70=$(_6d).attr("href");
|
|
if(_70){
|
|
_6f.href=_70;
|
|
$(_6d).attr("href","javascript:void(0)");
|
|
}
|
|
if(_6d.onclick){
|
|
_6f.onclick=_6d.onclick;
|
|
_6d.onclick=null;
|
|
}
|
|
$(_6d).addClass("l-btn-disabled");
|
|
}else{
|
|
_6f.options.disabled=false;
|
|
if(_6f.href){
|
|
$(_6d).attr("href",_6f.href);
|
|
}
|
|
if(_6f.onclick){
|
|
_6d.onclick=_6f.onclick;
|
|
}
|
|
$(_6d).removeClass("l-btn-disabled");
|
|
}
|
|
};
|
|
$.fn.linkbutton=function(_71,_72){
|
|
if(typeof _71=="string"){
|
|
return $.fn.linkbutton.methods[_71](this,_72);
|
|
}
|
|
_71=_71||{};
|
|
return this.each(function(){
|
|
var _73=$.data(this,"linkbutton");
|
|
if(_73){
|
|
$.extend(_73.options,_71);
|
|
}else{
|
|
$.data(this,"linkbutton",{options:$.extend({},$.fn.linkbutton.defaults,$.fn.linkbutton.parseOptions(this),_71)});
|
|
$(this).removeAttr("disabled");
|
|
}
|
|
_69(this);
|
|
});
|
|
};
|
|
$.fn.linkbutton.methods={options:function(jq){
|
|
return $.data(jq[0],"linkbutton").options;
|
|
},enable:function(jq){
|
|
return jq.each(function(){
|
|
_6c(this,false);
|
|
});
|
|
},disable:function(jq){
|
|
return jq.each(function(){
|
|
_6c(this,true);
|
|
});
|
|
}};
|
|
$.fn.linkbutton.parseOptions=function(_74){
|
|
var t=$(_74);
|
|
return $.extend({},$.parser.parseOptions(_74,["id","iconCls","iconAlign",{plain:"boolean"}]),{disabled:(t.attr("disabled")?true:undefined),text:$.trim(t.html()),iconCls:(t.attr("icon")||t.attr("iconCls"))});
|
|
};
|
|
$.fn.linkbutton.defaults={id:null,disabled:false,plain:false,text:"",iconCls:null,iconAlign:"left"};
|
|
})(jQuery);
|
|
(function($){
|
|
function _75(_76){
|
|
var _77=$.data(_76,"pagination");
|
|
var _78=_77.options;
|
|
var bb=_77.bb={};
|
|
var _79=$(_76).addClass("pagination").html("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr></tr></table>");
|
|
var tr=_79.find("tr");
|
|
function _7a(_7b){
|
|
var btn=_78.nav[_7b];
|
|
var a=$("<a href=\"javascript:void(0)\"></a>").appendTo(tr);
|
|
a.wrap("<td></td>");
|
|
a.linkbutton({iconCls:btn.iconCls,plain:true}).unbind(".pagination").bind("click.pagination",function(){
|
|
btn.handler.call(_76);
|
|
});
|
|
return a;
|
|
};
|
|
if(_78.showPageList){
|
|
var ps=$("<select class=\"pagination-page-list\"></select>");
|
|
ps.bind("change",function(){
|
|
_78.pageSize=parseInt($(this).val());
|
|
_78.onChangePageSize.call(_76,_78.pageSize);
|
|
_7d(_76,_78.pageNumber);
|
|
});
|
|
for(var i=0;i<_78.pageList.length;i++){
|
|
$("<option></option>").text(_78.pageList[i]).appendTo(ps);
|
|
}
|
|
$("<td></td>").append(ps).appendTo(tr);
|
|
$("<td><div class=\"pagination-btn-separator\"></div></td>").appendTo(tr);
|
|
}
|
|
bb.first=_7a("first");
|
|
bb.prev=_7a("prev");
|
|
$("<td><div class=\"pagination-btn-separator\"></div></td>").appendTo(tr);
|
|
$("<span style=\"padding-left:6px;\"></span>").html(_78.beforePageText).appendTo(tr).wrap("<td></td>");
|
|
bb.num=$("<input class=\"pagination-num\" type=\"text\" value=\"1\" size=\"2\">").appendTo(tr).wrap("<td></td>");
|
|
bb.num.unbind(".pagination").bind("keydown.pagination",function(e){
|
|
if(e.keyCode==13){
|
|
var _7c=parseInt($(this).val())||1;
|
|
_7d(_76,_7c);
|
|
return false;
|
|
}
|
|
});
|
|
bb.after=$("<span style=\"padding-right:6px;\"></span>").appendTo(tr).wrap("<td></td>");
|
|
$("<td><div class=\"pagination-btn-separator\"></div></td>").appendTo(tr);
|
|
bb.next=_7a("next");
|
|
bb.last=_7a("last");
|
|
if(_78.showRefresh){
|
|
$("<td><div class=\"pagination-btn-separator\"></div></td>").appendTo(tr);
|
|
bb.refresh=_7a("refresh");
|
|
}
|
|
if(_78.buttons){
|
|
$("<td><div class=\"pagination-btn-separator\"></div></td>").appendTo(tr);
|
|
for(var i=0;i<_78.buttons.length;i++){
|
|
var btn=_78.buttons[i];
|
|
if(btn=="-"){
|
|
$("<td><div class=\"pagination-btn-separator\"></div></td>").appendTo(tr);
|
|
}else{
|
|
var td=$("<td></td>").appendTo(tr);
|
|
$("<a href=\"javascript:void(0)\"></a>").appendTo(td).linkbutton($.extend(btn,{plain:true})).bind("click",eval(btn.handler||function(){
|
|
}));
|
|
}
|
|
}
|
|
}
|
|
$("<div class=\"pagination-info\"></div>").appendTo(_79);
|
|
$("<div style=\"clear:both;\"></div>").appendTo(_79);
|
|
};
|
|
function _7d(_7e,_7f){
|
|
var _80=$.data(_7e,"pagination").options;
|
|
var _81=Math.ceil(_80.total/_80.pageSize)||1;
|
|
_80.pageNumber=_7f;
|
|
if(_80.pageNumber<1){
|
|
_80.pageNumber=1;
|
|
}
|
|
if(_80.pageNumber>_81){
|
|
_80.pageNumber=_81;
|
|
}
|
|
_82(_7e,{pageNumber:_80.pageNumber});
|
|
_80.onSelectPage.call(_7e,_80.pageNumber,_80.pageSize);
|
|
};
|
|
function _82(_83,_84){
|
|
var _85=$.data(_83,"pagination").options;
|
|
var bb=$.data(_83,"pagination").bb;
|
|
$.extend(_85,_84||{});
|
|
var ps=$(_83).find("select.pagination-page-list");
|
|
if(ps.length){
|
|
ps.val(_85.pageSize+"");
|
|
_85.pageSize=parseInt(ps.val());
|
|
}
|
|
var _86=Math.ceil(_85.total/_85.pageSize)||1;
|
|
bb.num.val(_85.pageNumber);
|
|
bb.after.html(_85.afterPageText.replace(/{pages}/,_86));
|
|
var _87=_85.displayMsg;
|
|
_87=_87.replace(/{from}/,_85.total==0?0:_85.pageSize*(_85.pageNumber-1)+1);
|
|
_87=_87.replace(/{to}/,Math.min(_85.pageSize*(_85.pageNumber),_85.total));
|
|
_87=_87.replace(/{total}/,_85.total);
|
|
$(_83).find("div.pagination-info").html(_87);
|
|
bb.first.add(bb.prev).linkbutton({disabled:(_85.pageNumber==1)});
|
|
bb.next.add(bb.last).linkbutton({disabled:(_85.pageNumber==_86)});
|
|
_88(_83,_85.loading);
|
|
};
|
|
function _88(_89,_8a){
|
|
var _8b=$.data(_89,"pagination").options;
|
|
var bb=$.data(_89,"pagination").bb;
|
|
_8b.loading=_8a;
|
|
if(_8b.showRefresh){
|
|
if(_8b.loading){
|
|
bb.refresh.linkbutton({iconCls:"pagination-loading"});
|
|
}else{
|
|
bb.refresh.linkbutton({iconCls:"pagination-load"});
|
|
}
|
|
}
|
|
};
|
|
$.fn.pagination=function(_8c,_8d){
|
|
if(typeof _8c=="string"){
|
|
return $.fn.pagination.methods[_8c](this,_8d);
|
|
}
|
|
_8c=_8c||{};
|
|
return this.each(function(){
|
|
var _8e;
|
|
var _8f=$.data(this,"pagination");
|
|
if(_8f){
|
|
_8e=$.extend(_8f.options,_8c);
|
|
}else{
|
|
_8e=$.extend({},$.fn.pagination.defaults,$.fn.pagination.parseOptions(this),_8c);
|
|
$.data(this,"pagination",{options:_8e});
|
|
}
|
|
_75(this);
|
|
_82(this);
|
|
});
|
|
};
|
|
$.fn.pagination.methods={options:function(jq){
|
|
return $.data(jq[0],"pagination").options;
|
|
},loading:function(jq){
|
|
return jq.each(function(){
|
|
_88(this,true);
|
|
});
|
|
},loaded:function(jq){
|
|
return jq.each(function(){
|
|
_88(this,false);
|
|
});
|
|
},refresh:function(jq,_90){
|
|
return jq.each(function(){
|
|
_82(this,_90);
|
|
});
|
|
},select:function(jq,_91){
|
|
return jq.each(function(){
|
|
_7d(this,_91);
|
|
});
|
|
}};
|
|
$.fn.pagination.parseOptions=function(_92){
|
|
var t=$(_92);
|
|
return $.extend({},$.parser.parseOptions(_92,[{total:"number",pageSize:"number",pageNumber:"number"},{loading:"boolean",showPageList:"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,showRefresh:true,onSelectPage:function(_93,_94){
|
|
},onBeforeRefresh:function(_95,_96){
|
|
},onRefresh:function(_97,_98){
|
|
},onChangePageSize:function(_99){
|
|
},beforePageText:"Page",afterPageText:"of {pages}",displayMsg:"Displaying {from} to {to} of {total} items",nav:{first:{iconCls:"pagination-first",handler:function(){
|
|
var _9a=$(this).pagination("options");
|
|
if(_9a.pageNumber>1){
|
|
$(this).pagination("select",1);
|
|
}
|
|
}},prev:{iconCls:"pagination-prev",handler:function(){
|
|
var _9b=$(this).pagination("options");
|
|
if(_9b.pageNumber>1){
|
|
$(this).pagination("select",_9b.pageNumber-1);
|
|
}
|
|
}},next:{iconCls:"pagination-next",handler:function(){
|
|
var _9c=$(this).pagination("options");
|
|
var _9d=Math.ceil(_9c.total/_9c.pageSize);
|
|
if(_9c.pageNumber<_9d){
|
|
$(this).pagination("select",_9c.pageNumber+1);
|
|
}
|
|
}},last:{iconCls:"pagination-last",handler:function(){
|
|
var _9e=$(this).pagination("options");
|
|
var _9f=Math.ceil(_9e.total/_9e.pageSize);
|
|
if(_9e.pageNumber<_9f){
|
|
$(this).pagination("select",_9f);
|
|
}
|
|
}},refresh:{iconCls:"pagination-refresh",handler:function(){
|
|
var _a0=$(this).pagination("options");
|
|
if(_a0.onBeforeRefresh.call(this,_a0.pageNumber,_a0.pageSize)!=false){
|
|
$(this).pagination("select",_a0.pageNumber);
|
|
_a0.onRefresh.call(this,_a0.pageNumber,_a0.pageSize);
|
|
}
|
|
}}}};
|
|
})(jQuery);
|
|
(function($){
|
|
function _a1(_a2){
|
|
var _a3=$(_a2);
|
|
_a3.addClass("tree");
|
|
return _a3;
|
|
};
|
|
function _a4(_a5){
|
|
var _a6=[];
|
|
_a7(_a6,$(_a5));
|
|
function _a7(aa,_a8){
|
|
_a8.children("li").each(function(){
|
|
var _a9=$(this);
|
|
var _aa=$.extend({},$.parser.parseOptions(this,["id","iconCls","state"]),{checked:(_a9.attr("checked")?true:undefined)});
|
|
_aa.text=_a9.children("span").html();
|
|
if(!_aa.text){
|
|
_aa.text=_a9.html();
|
|
}
|
|
var _ab=_a9.children("ul");
|
|
if(_ab.length){
|
|
_aa.children=[];
|
|
_a7(_aa.children,_ab);
|
|
}
|
|
aa.push(_aa);
|
|
});
|
|
};
|
|
return _a6;
|
|
};
|
|
function _ac(_ad){
|
|
var _ae=$.data(_ad,"tree").options;
|
|
$(_ad).unbind().bind("mouseover",function(e){
|
|
var tt=$(e.target);
|
|
var _af=tt.closest("div.tree-node");
|
|
if(!_af.length){
|
|
return;
|
|
}
|
|
_af.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 _b0=tt.closest("div.tree-node");
|
|
if(!_b0.length){
|
|
return;
|
|
}
|
|
_b0.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 _b1=tt.closest("div.tree-node");
|
|
if(!_b1.length){
|
|
return;
|
|
}
|
|
if(tt.hasClass("tree-hit")){
|
|
_119(_ad,_b1[0]);
|
|
return false;
|
|
}else{
|
|
if(tt.hasClass("tree-checkbox")){
|
|
_d9(_ad,_b1[0],!tt.hasClass("tree-checkbox1"));
|
|
return false;
|
|
}else{
|
|
_157(_ad,_b1[0]);
|
|
_ae.onClick.call(_ad,_b4(_ad,_b1[0]));
|
|
}
|
|
}
|
|
e.stopPropagation();
|
|
}).bind("dblclick",function(e){
|
|
var _b2=$(e.target).closest("div.tree-node");
|
|
if(!_b2.length){
|
|
return;
|
|
}
|
|
_157(_ad,_b2[0]);
|
|
_ae.onDblClick.call(_ad,_b4(_ad,_b2[0]));
|
|
e.stopPropagation();
|
|
}).bind("contextmenu",function(e){
|
|
var _b3=$(e.target).closest("div.tree-node");
|
|
if(!_b3.length){
|
|
return;
|
|
}
|
|
_ae.onContextMenu.call(_ad,e,_b4(_ad,_b3[0]));
|
|
e.stopPropagation();
|
|
});
|
|
};
|
|
function _b5(_b6){
|
|
var _b7=$(_b6).find("div.tree-node");
|
|
_b7.draggable("disable");
|
|
_b7.css("cursor","pointer");
|
|
};
|
|
function _b8(_b9){
|
|
var _ba=$.data(_b9,"tree");
|
|
var _bb=_ba.options;
|
|
var _bc=_ba.tree;
|
|
_ba.disabledNodes=[];
|
|
_bc.find("div.tree-node").draggable({disabled:false,revert:true,cursor:"pointer",proxy:function(_bd){
|
|
var p=$("<div class=\"tree-node-proxy\"></div>").appendTo("body");
|
|
p.html("<span class=\"tree-dnd-icon tree-dnd-no\"> </span>"+$(_bd).find(".tree-title").html());
|
|
p.hide();
|
|
return p;
|
|
},deltaX:15,deltaY:15,onBeforeDrag:function(e){
|
|
if(_bb.onBeforeDrag.call(_b9,_b4(_b9,this))==false){
|
|
return false;
|
|
}
|
|
if($(e.target).hasClass("tree-hit")||$(e.target).hasClass("tree-checkbox")){
|
|
return false;
|
|
}
|
|
if(e.which!=1){
|
|
return false;
|
|
}
|
|
$(this).next("ul").find("div.tree-node").droppable({accept:"no-accept"});
|
|
var _be=$(this).find("span.tree-indent");
|
|
if(_be.length){
|
|
e.data.offsetWidth-=_be.length*_be.width();
|
|
}
|
|
},onStartDrag:function(){
|
|
$(this).draggable("proxy").css({left:-10000,top:-10000});
|
|
_bb.onStartDrag.call(_b9,_b4(_b9,this));
|
|
var _bf=_b4(_b9,this);
|
|
if(_bf.id==undefined){
|
|
_bf.id="easyui_tree_node_id_temp";
|
|
_14f(_b9,_bf);
|
|
}
|
|
_ba.draggingNodeId=_bf.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(){
|
|
$(this).next("ul").find("div.tree-node").droppable({accept:"div.tree-node"});
|
|
for(var i=0;i<_ba.disabledNodes.length;i++){
|
|
$(_ba.disabledNodes[i]).droppable("enable");
|
|
}
|
|
_ba.disabledNodes=[];
|
|
var _c0=_155(_b9,_ba.draggingNodeId);
|
|
if(_c0.id=="easyui_tree_node_id_temp"){
|
|
_c0.id="";
|
|
_14f(_b9,_c0);
|
|
}
|
|
_bb.onStopDrag.call(_b9,_c0);
|
|
}}).droppable({accept:"div.tree-node",onDragEnter:function(e,_c1){
|
|
if(_bb.onDragEnter.call(_b9,this,_b4(_b9,_c1))==false){
|
|
_c2(_c1,false);
|
|
$(this).removeClass("tree-node-append tree-node-top tree-node-bottom");
|
|
$(this).droppable("disable");
|
|
_ba.disabledNodes.push(this);
|
|
}
|
|
},onDragOver:function(e,_c3){
|
|
if($(this).droppable("options").disabled){
|
|
return;
|
|
}
|
|
var _c4=_c3.pageY;
|
|
var top=$(this).offset().top;
|
|
var _c5=top+$(this).outerHeight();
|
|
_c2(_c3,true);
|
|
$(this).removeClass("tree-node-append tree-node-top tree-node-bottom");
|
|
if(_c4>top+(_c5-top)/2){
|
|
if(_c5-_c4<5){
|
|
$(this).addClass("tree-node-bottom");
|
|
}else{
|
|
$(this).addClass("tree-node-append");
|
|
}
|
|
}else{
|
|
if(_c4-top<5){
|
|
$(this).addClass("tree-node-top");
|
|
}else{
|
|
$(this).addClass("tree-node-append");
|
|
}
|
|
}
|
|
if(_bb.onDragOver.call(_b9,this,_b4(_b9,_c3))==false){
|
|
_c2(_c3,false);
|
|
$(this).removeClass("tree-node-append tree-node-top tree-node-bottom");
|
|
$(this).droppable("disable");
|
|
_ba.disabledNodes.push(this);
|
|
}
|
|
},onDragLeave:function(e,_c6){
|
|
_c2(_c6,false);
|
|
$(this).removeClass("tree-node-append tree-node-top tree-node-bottom");
|
|
_bb.onDragLeave.call(_b9,this,_b4(_b9,_c6));
|
|
},onDrop:function(e,_c7){
|
|
var _c8=this;
|
|
var _c9,_ca;
|
|
if($(this).hasClass("tree-node-append")){
|
|
_c9=_cb;
|
|
}else{
|
|
_c9=_cc;
|
|
_ca=$(this).hasClass("tree-node-top")?"top":"bottom";
|
|
}
|
|
_c9(_c7,_c8,_ca);
|
|
$(this).removeClass("tree-node-append tree-node-top tree-node-bottom");
|
|
}});
|
|
function _c2(_cd,_ce){
|
|
var _cf=$(_cd).draggable("proxy").find("span.tree-dnd-icon");
|
|
_cf.removeClass("tree-dnd-yes tree-dnd-no").addClass(_ce?"tree-dnd-yes":"tree-dnd-no");
|
|
};
|
|
function _cb(_d0,_d1){
|
|
if(_b4(_b9,_d1).state=="closed"){
|
|
_111(_b9,_d1,function(){
|
|
_d2();
|
|
});
|
|
}else{
|
|
_d2();
|
|
}
|
|
function _d2(){
|
|
var _d3=$(_b9).tree("pop",_d0);
|
|
$(_b9).tree("append",{parent:_d1,data:[_d3]});
|
|
_bb.onDrop.call(_b9,_d1,_d3,"append");
|
|
};
|
|
};
|
|
function _cc(_d4,_d5,_d6){
|
|
var _d7={};
|
|
if(_d6=="top"){
|
|
_d7.before=_d5;
|
|
}else{
|
|
_d7.after=_d5;
|
|
}
|
|
var _d8=$(_b9).tree("pop",_d4);
|
|
_d7.data=_d8;
|
|
$(_b9).tree("insert",_d7);
|
|
_bb.onDrop.call(_b9,_d5,_d8,_d6);
|
|
};
|
|
};
|
|
function _d9(_da,_db,_dc){
|
|
var _dd=$.data(_da,"tree").options;
|
|
if(!_dd.checkbox){
|
|
return;
|
|
}
|
|
var _de=_b4(_da,_db);
|
|
if(_dd.onBeforeCheck.call(_da,_de,_dc)==false){
|
|
return;
|
|
}
|
|
var _df=$(_db);
|
|
var ck=_df.find(".tree-checkbox");
|
|
ck.removeClass("tree-checkbox0 tree-checkbox1 tree-checkbox2");
|
|
if(_dc){
|
|
ck.addClass("tree-checkbox1");
|
|
}else{
|
|
ck.addClass("tree-checkbox0");
|
|
}
|
|
if(_dd.cascadeCheck){
|
|
_e0(_df);
|
|
_e1(_df);
|
|
}
|
|
_dd.onCheck.call(_da,_de,_dc);
|
|
function _e1(_e2){
|
|
var _e3=_e2.next().find(".tree-checkbox");
|
|
_e3.removeClass("tree-checkbox0 tree-checkbox1 tree-checkbox2");
|
|
if(_e2.find(".tree-checkbox").hasClass("tree-checkbox1")){
|
|
_e3.addClass("tree-checkbox1");
|
|
}else{
|
|
_e3.addClass("tree-checkbox0");
|
|
}
|
|
};
|
|
function _e0(_e4){
|
|
var _e5=_124(_da,_e4[0]);
|
|
if(_e5){
|
|
var ck=$(_e5.target).find(".tree-checkbox");
|
|
ck.removeClass("tree-checkbox0 tree-checkbox1 tree-checkbox2");
|
|
if(_e6(_e4)){
|
|
ck.addClass("tree-checkbox1");
|
|
}else{
|
|
if(_e7(_e4)){
|
|
ck.addClass("tree-checkbox0");
|
|
}else{
|
|
ck.addClass("tree-checkbox2");
|
|
}
|
|
}
|
|
_e0($(_e5.target));
|
|
}
|
|
function _e6(n){
|
|
var ck=n.find(".tree-checkbox");
|
|
if(ck.hasClass("tree-checkbox0")||ck.hasClass("tree-checkbox2")){
|
|
return false;
|
|
}
|
|
var b=true;
|
|
n.parent().siblings().each(function(){
|
|
if(!$(this).children("div.tree-node").children(".tree-checkbox").hasClass("tree-checkbox1")){
|
|
b=false;
|
|
}
|
|
});
|
|
return b;
|
|
};
|
|
function _e7(n){
|
|
var ck=n.find(".tree-checkbox");
|
|
if(ck.hasClass("tree-checkbox1")||ck.hasClass("tree-checkbox2")){
|
|
return false;
|
|
}
|
|
var b=true;
|
|
n.parent().siblings().each(function(){
|
|
if(!$(this).children("div.tree-node").children(".tree-checkbox").hasClass("tree-checkbox0")){
|
|
b=false;
|
|
}
|
|
});
|
|
return b;
|
|
};
|
|
};
|
|
};
|
|
function _e8(_e9,_ea){
|
|
var _eb=$.data(_e9,"tree").options;
|
|
var _ec=$(_ea);
|
|
if(_ed(_e9,_ea)){
|
|
var ck=_ec.find(".tree-checkbox");
|
|
if(ck.length){
|
|
if(ck.hasClass("tree-checkbox1")){
|
|
_d9(_e9,_ea,true);
|
|
}else{
|
|
_d9(_e9,_ea,false);
|
|
}
|
|
}else{
|
|
if(_eb.onlyLeafCheck){
|
|
$("<span class=\"tree-checkbox tree-checkbox0\"></span>").insertBefore(_ec.find(".tree-title"));
|
|
}
|
|
}
|
|
}else{
|
|
var ck=_ec.find(".tree-checkbox");
|
|
if(_eb.onlyLeafCheck){
|
|
ck.remove();
|
|
}else{
|
|
if(ck.hasClass("tree-checkbox1")){
|
|
_d9(_e9,_ea,true);
|
|
}else{
|
|
if(ck.hasClass("tree-checkbox2")){
|
|
var _ee=true;
|
|
var _ef=true;
|
|
var _f0=_f1(_e9,_ea);
|
|
for(var i=0;i<_f0.length;i++){
|
|
if(_f0[i].checked){
|
|
_ef=false;
|
|
}else{
|
|
_ee=false;
|
|
}
|
|
}
|
|
if(_ee){
|
|
_d9(_e9,_ea,true);
|
|
}
|
|
if(_ef){
|
|
_d9(_e9,_ea,false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
function _f2(_f3,ul,_f4,_f5){
|
|
var _f6=$.data(_f3,"tree").options;
|
|
_f4=_f6.loadFilter.call(_f3,_f4,$(ul).prev("div.tree-node")[0]);
|
|
if(!_f5){
|
|
$(ul).empty();
|
|
}
|
|
var _f7=[];
|
|
var _f8=$(ul).prev("div.tree-node").find("span.tree-indent, span.tree-hit").length;
|
|
_f9(ul,_f4,_f8);
|
|
if(_f6.dnd){
|
|
_b8(_f3);
|
|
}else{
|
|
_b5(_f3);
|
|
}
|
|
for(var i=0;i<_f7.length;i++){
|
|
_d9(_f3,_f7[i],true);
|
|
}
|
|
setTimeout(function(){
|
|
_101(_f3,_f3);
|
|
},0);
|
|
var _fa=null;
|
|
if(_f3!=ul){
|
|
var _fb=$(ul).prev();
|
|
_fa=_b4(_f3,_fb[0]);
|
|
}
|
|
_f6.onLoadSuccess.call(_f3,_fa,_f4);
|
|
function _f9(ul,_fc,_fd){
|
|
for(var i=0;i<_fc.length;i++){
|
|
var li=$("<li></li>").appendTo(ul);
|
|
var _fe=_fc[i];
|
|
if(_fe.state!="open"&&_fe.state!="closed"){
|
|
_fe.state="open";
|
|
}
|
|
var _ff=$("<div class=\"tree-node\"></div>").appendTo(li);
|
|
_ff.attr("node-id",_fe.id);
|
|
$.data(_ff[0],"tree-node",{id:_fe.id,text:_fe.text,iconCls:_fe.iconCls,attributes:_fe.attributes});
|
|
$("<span class=\"tree-title\"></span>").html(_fe.text).appendTo(_ff);
|
|
if(_f6.checkbox){
|
|
if(_f6.onlyLeafCheck){
|
|
if(_fe.state=="open"&&(!_fe.children||!_fe.children.length)){
|
|
if(_fe.checked){
|
|
$("<span class=\"tree-checkbox tree-checkbox1\"></span>").prependTo(_ff);
|
|
}else{
|
|
$("<span class=\"tree-checkbox tree-checkbox0\"></span>").prependTo(_ff);
|
|
}
|
|
}
|
|
}else{
|
|
if(_fe.checked){
|
|
$("<span class=\"tree-checkbox tree-checkbox1\"></span>").prependTo(_ff);
|
|
_f7.push(_ff[0]);
|
|
}else{
|
|
$("<span class=\"tree-checkbox tree-checkbox0\"></span>").prependTo(_ff);
|
|
}
|
|
}
|
|
}
|
|
if(_fe.children&&_fe.children.length){
|
|
var _100=$("<ul></ul>").appendTo(li);
|
|
if(_fe.state=="open"){
|
|
$("<span class=\"tree-icon tree-folder tree-folder-open\"></span>").addClass(_fe.iconCls).prependTo(_ff);
|
|
$("<span class=\"tree-hit tree-expanded\"></span>").prependTo(_ff);
|
|
}else{
|
|
$("<span class=\"tree-icon tree-folder\"></span>").addClass(_fe.iconCls).prependTo(_ff);
|
|
$("<span class=\"tree-hit tree-collapsed\"></span>").prependTo(_ff);
|
|
_100.css("display","none");
|
|
}
|
|
_f9(_100,_fe.children,_fd+1);
|
|
}else{
|
|
if(_fe.state=="closed"){
|
|
$("<span class=\"tree-icon tree-folder\"></span>").addClass(_fe.iconCls).prependTo(_ff);
|
|
$("<span class=\"tree-hit tree-collapsed\"></span>").prependTo(_ff);
|
|
}else{
|
|
$("<span class=\"tree-icon tree-file\"></span>").addClass(_fe.iconCls).prependTo(_ff);
|
|
$("<span class=\"tree-indent\"></span>").prependTo(_ff);
|
|
}
|
|
}
|
|
for(var j=0;j<_fd;j++){
|
|
$("<span class=\"tree-indent\"></span>").prependTo(_ff);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
function _101(_102,ul,_103){
|
|
var opts=$.data(_102,"tree").options;
|
|
if(!opts.lines){
|
|
return;
|
|
}
|
|
if(!_103){
|
|
_103=true;
|
|
$(_102).find("span.tree-indent").removeClass("tree-line tree-join tree-joinbottom");
|
|
$(_102).find("div.tree-node").removeClass("tree-node-last tree-root-first tree-root-one");
|
|
var _104=$(_102).tree("getRoots");
|
|
if(_104.length>1){
|
|
$(_104[0].target).addClass("tree-root-first");
|
|
}else{
|
|
if(_104.length==1){
|
|
$(_104[0].target).addClass("tree-root-one");
|
|
}
|
|
}
|
|
}
|
|
$(ul).children("li").each(function(){
|
|
var node=$(this).children("div.tree-node");
|
|
var ul=node.next("ul");
|
|
if(ul.length){
|
|
if($(this).next().length){
|
|
_105(node);
|
|
}
|
|
_101(_102,ul,_103);
|
|
}else{
|
|
_106(node);
|
|
}
|
|
});
|
|
var _107=$(ul).children("li:last").children("div.tree-node").addClass("tree-node-last");
|
|
_107.children("span.tree-join").removeClass("tree-join").addClass("tree-joinbottom");
|
|
function _106(node,_108){
|
|
var icon=node.find("span.tree-icon");
|
|
icon.prev("span.tree-indent").addClass("tree-join");
|
|
};
|
|
function _105(node){
|
|
var _109=node.find("span.tree-indent, span.tree-hit").length;
|
|
node.next().find("div.tree-node").each(function(){
|
|
$(this).children("span:eq("+(_109-1)+")").addClass("tree-line");
|
|
});
|
|
};
|
|
};
|
|
function _10a(_10b,ul,_10c,_10d){
|
|
var opts=$.data(_10b,"tree").options;
|
|
_10c=_10c||{};
|
|
var _10e=null;
|
|
if(_10b!=ul){
|
|
var node=$(ul).prev();
|
|
_10e=_b4(_10b,node[0]);
|
|
}
|
|
if(opts.onBeforeLoad.call(_10b,_10e,_10c)==false){
|
|
return;
|
|
}
|
|
var _10f=$(ul).prev().children("span.tree-folder");
|
|
_10f.addClass("tree-loading");
|
|
var _110=opts.loader.call(_10b,_10c,function(data){
|
|
_10f.removeClass("tree-loading");
|
|
_f2(_10b,ul,data);
|
|
if(_10d){
|
|
_10d();
|
|
}
|
|
},function(){
|
|
_10f.removeClass("tree-loading");
|
|
opts.onLoadError.apply(_10b,arguments);
|
|
if(_10d){
|
|
_10d();
|
|
}
|
|
});
|
|
if(_110==false){
|
|
_10f.removeClass("tree-loading");
|
|
}
|
|
};
|
|
function _111(_112,_113,_114){
|
|
var opts=$.data(_112,"tree").options;
|
|
var hit=$(_113).children("span.tree-hit");
|
|
if(hit.length==0){
|
|
return;
|
|
}
|
|
if(hit.hasClass("tree-expanded")){
|
|
return;
|
|
}
|
|
var node=_b4(_112,_113);
|
|
if(opts.onBeforeExpand.call(_112,node)==false){
|
|
return;
|
|
}
|
|
hit.removeClass("tree-collapsed tree-collapsed-hover").addClass("tree-expanded");
|
|
hit.next().addClass("tree-folder-open");
|
|
var ul=$(_113).next();
|
|
if(ul.length){
|
|
if(opts.animate){
|
|
ul.slideDown("normal",function(){
|
|
opts.onExpand.call(_112,node);
|
|
if(_114){
|
|
_114();
|
|
}
|
|
});
|
|
}else{
|
|
ul.css("display","block");
|
|
opts.onExpand.call(_112,node);
|
|
if(_114){
|
|
_114();
|
|
}
|
|
}
|
|
}else{
|
|
var _115=$("<ul style=\"display:none\"></ul>").insertAfter(_113);
|
|
_10a(_112,_115[0],{id:node.id},function(){
|
|
if(_115.is(":empty")){
|
|
_115.remove();
|
|
}
|
|
if(opts.animate){
|
|
_115.slideDown("normal",function(){
|
|
opts.onExpand.call(_112,node);
|
|
if(_114){
|
|
_114();
|
|
}
|
|
});
|
|
}else{
|
|
_115.css("display","block");
|
|
opts.onExpand.call(_112,node);
|
|
if(_114){
|
|
_114();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
};
|
|
function _116(_117,_118){
|
|
var opts=$.data(_117,"tree").options;
|
|
var hit=$(_118).children("span.tree-hit");
|
|
if(hit.length==0){
|
|
return;
|
|
}
|
|
if(hit.hasClass("tree-collapsed")){
|
|
return;
|
|
}
|
|
var node=_b4(_117,_118);
|
|
if(opts.onBeforeCollapse.call(_117,node)==false){
|
|
return;
|
|
}
|
|
hit.removeClass("tree-expanded tree-expanded-hover").addClass("tree-collapsed");
|
|
hit.next().removeClass("tree-folder-open");
|
|
var ul=$(_118).next();
|
|
if(opts.animate){
|
|
ul.slideUp("normal",function(){
|
|
opts.onCollapse.call(_117,node);
|
|
});
|
|
}else{
|
|
ul.css("display","none");
|
|
opts.onCollapse.call(_117,node);
|
|
}
|
|
};
|
|
function _119(_11a,_11b){
|
|
var hit=$(_11b).children("span.tree-hit");
|
|
if(hit.length==0){
|
|
return;
|
|
}
|
|
if(hit.hasClass("tree-expanded")){
|
|
_116(_11a,_11b);
|
|
}else{
|
|
_111(_11a,_11b);
|
|
}
|
|
};
|
|
function _11c(_11d,_11e){
|
|
var _11f=_f1(_11d,_11e);
|
|
if(_11e){
|
|
_11f.unshift(_b4(_11d,_11e));
|
|
}
|
|
for(var i=0;i<_11f.length;i++){
|
|
_111(_11d,_11f[i].target);
|
|
}
|
|
};
|
|
function _120(_121,_122){
|
|
var _123=[];
|
|
var p=_124(_121,_122);
|
|
while(p){
|
|
_123.unshift(p);
|
|
p=_124(_121,p.target);
|
|
}
|
|
for(var i=0;i<_123.length;i++){
|
|
_111(_121,_123[i].target);
|
|
}
|
|
};
|
|
function _125(_126,_127){
|
|
var _128=_f1(_126,_127);
|
|
if(_127){
|
|
_128.unshift(_b4(_126,_127));
|
|
}
|
|
for(var i=0;i<_128.length;i++){
|
|
_116(_126,_128[i].target);
|
|
}
|
|
};
|
|
function _129(_12a){
|
|
var _12b=_12c(_12a);
|
|
if(_12b.length){
|
|
return _12b[0];
|
|
}else{
|
|
return null;
|
|
}
|
|
};
|
|
function _12c(_12d){
|
|
var _12e=[];
|
|
$(_12d).children("li").each(function(){
|
|
var node=$(this).children("div.tree-node");
|
|
_12e.push(_b4(_12d,node[0]));
|
|
});
|
|
return _12e;
|
|
};
|
|
function _f1(_12f,_130){
|
|
var _131=[];
|
|
if(_130){
|
|
_132($(_130));
|
|
}else{
|
|
var _133=_12c(_12f);
|
|
for(var i=0;i<_133.length;i++){
|
|
_131.push(_133[i]);
|
|
_132($(_133[i].target));
|
|
}
|
|
}
|
|
function _132(node){
|
|
node.next().find("div.tree-node").each(function(){
|
|
_131.push(_b4(_12f,this));
|
|
});
|
|
};
|
|
return _131;
|
|
};
|
|
function _124(_134,_135){
|
|
var ul=$(_135).parent().parent();
|
|
if(ul[0]==_134){
|
|
return null;
|
|
}else{
|
|
return _b4(_134,ul.prev()[0]);
|
|
}
|
|
};
|
|
function _136(_137,_138){
|
|
_138=_138||"checked";
|
|
var _139="";
|
|
if(_138=="checked"){
|
|
_139="span.tree-checkbox1";
|
|
}else{
|
|
if(_138=="unchecked"){
|
|
_139="span.tree-checkbox0";
|
|
}else{
|
|
if(_138=="indeterminate"){
|
|
_139="span.tree-checkbox2";
|
|
}
|
|
}
|
|
}
|
|
var _13a=[];
|
|
$(_137).find(_139).each(function(){
|
|
var node=$(this).parent();
|
|
_13a.push(_b4(_137,node[0]));
|
|
});
|
|
return _13a;
|
|
};
|
|
function _13b(_13c){
|
|
var node=$(_13c).find("div.tree-node-selected");
|
|
if(node.length){
|
|
return _b4(_13c,node[0]);
|
|
}else{
|
|
return null;
|
|
}
|
|
};
|
|
function _13d(_13e,_13f){
|
|
var node=$(_13f.parent);
|
|
var ul;
|
|
if(node.length==0){
|
|
ul=$(_13e);
|
|
}else{
|
|
ul=node.next();
|
|
if(ul.length==0){
|
|
ul=$("<ul></ul>").insertAfter(node);
|
|
}
|
|
}
|
|
if(_13f.data&&_13f.data.length){
|
|
var _140=node.find("span.tree-icon");
|
|
if(_140.hasClass("tree-file")){
|
|
_140.removeClass("tree-file").addClass("tree-folder tree-folder-open");
|
|
var hit=$("<span class=\"tree-hit tree-expanded\"></span>").insertBefore(_140);
|
|
if(hit.prev().length){
|
|
hit.prev().remove();
|
|
}
|
|
}
|
|
}
|
|
_f2(_13e,ul[0],_13f.data,true);
|
|
_e8(_13e,ul.prev());
|
|
};
|
|
function _141(_142,_143){
|
|
var ref=_143.before||_143.after;
|
|
var _144=_124(_142,ref);
|
|
var li;
|
|
if(_144){
|
|
_13d(_142,{parent:_144.target,data:[_143.data]});
|
|
li=$(_144.target).next().children("li:last");
|
|
}else{
|
|
_13d(_142,{parent:null,data:[_143.data]});
|
|
li=$(_142).children("li:last");
|
|
}
|
|
if(_143.before){
|
|
li.insertBefore($(ref).parent());
|
|
}else{
|
|
li.insertAfter($(ref).parent());
|
|
}
|
|
};
|
|
function _145(_146,_147){
|
|
var _148=_124(_146,_147);
|
|
var node=$(_147);
|
|
var li=node.parent();
|
|
var ul=li.parent();
|
|
li.remove();
|
|
if(ul.children("li").length==0){
|
|
var node=ul.prev();
|
|
node.find(".tree-icon").removeClass("tree-folder").addClass("tree-file");
|
|
node.find(".tree-hit").remove();
|
|
$("<span class=\"tree-indent\"></span>").prependTo(node);
|
|
if(ul[0]!=_146){
|
|
ul.remove();
|
|
}
|
|
}
|
|
if(_148){
|
|
_e8(_146,_148.target);
|
|
}
|
|
_101(_146,_146);
|
|
};
|
|
function _149(_14a,_14b){
|
|
function _14c(aa,ul){
|
|
ul.children("li").each(function(){
|
|
var node=$(this).children("div.tree-node");
|
|
var _14d=_b4(_14a,node[0]);
|
|
var sub=$(this).children("ul");
|
|
if(sub.length){
|
|
_14d.children=[];
|
|
_14c(_14d.children,sub);
|
|
}
|
|
aa.push(_14d);
|
|
});
|
|
};
|
|
if(_14b){
|
|
var _14e=_b4(_14a,_14b);
|
|
_14e.children=[];
|
|
_14c(_14e.children,$(_14b).next());
|
|
return _14e;
|
|
}else{
|
|
return null;
|
|
}
|
|
};
|
|
function _14f(_150,_151){
|
|
var node=$(_151.target);
|
|
var _152=_b4(_150,_151.target);
|
|
if(_152.iconCls){
|
|
node.find(".tree-icon").removeClass(_152.iconCls);
|
|
}
|
|
var data=$.extend({},_152,_151);
|
|
$.data(_151.target,"tree-node",data);
|
|
node.attr("node-id",data.id);
|
|
node.find(".tree-title").html(data.text);
|
|
if(data.iconCls){
|
|
node.find(".tree-icon").addClass(data.iconCls);
|
|
}
|
|
if(_152.checked!=data.checked){
|
|
_d9(_150,_151.target,data.checked);
|
|
}
|
|
};
|
|
function _b4(_153,_154){
|
|
var node=$.extend({},$.data(_154,"tree-node"),{target:_154,checked:$(_154).find(".tree-checkbox").hasClass("tree-checkbox1")});
|
|
if(!_ed(_153,_154)){
|
|
node.state=$(_154).find(".tree-hit").hasClass("tree-expanded")?"open":"closed";
|
|
}
|
|
return node;
|
|
};
|
|
function _155(_156,id){
|
|
var node=$(_156).find("div.tree-node[node-id="+id+"]");
|
|
if(node.length){
|
|
return _b4(_156,node[0]);
|
|
}else{
|
|
return null;
|
|
}
|
|
};
|
|
function _157(_158,_159){
|
|
var opts=$.data(_158,"tree").options;
|
|
var node=_b4(_158,_159);
|
|
if(opts.onBeforeSelect.call(_158,node)==false){
|
|
return;
|
|
}
|
|
$("div.tree-node-selected",_158).removeClass("tree-node-selected");
|
|
$(_159).addClass("tree-node-selected");
|
|
opts.onSelect.call(_158,node);
|
|
};
|
|
function _ed(_15a,_15b){
|
|
var node=$(_15b);
|
|
var hit=node.children("span.tree-hit");
|
|
return hit.length==0;
|
|
};
|
|
function _15c(_15d,_15e){
|
|
var opts=$.data(_15d,"tree").options;
|
|
var node=_b4(_15d,_15e);
|
|
if(opts.onBeforeEdit.call(_15d,node)==false){
|
|
return;
|
|
}
|
|
$(_15e).css("position","relative");
|
|
var nt=$(_15e).find(".tree-title");
|
|
var _15f=nt.outerWidth();
|
|
nt.empty();
|
|
var _160=$("<input class=\"tree-editor\">").appendTo(nt);
|
|
_160.val(node.text).focus();
|
|
_160.width(_15f+20);
|
|
_160.height(document.compatMode=="CSS1Compat"?(18-(_160.outerHeight()-_160.height())):18);
|
|
_160.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){
|
|
_161(_15d,_15e);
|
|
return false;
|
|
}else{
|
|
if(e.keyCode==27){
|
|
_165(_15d,_15e);
|
|
return false;
|
|
}
|
|
}
|
|
}).bind("blur",function(e){
|
|
e.stopPropagation();
|
|
_161(_15d,_15e);
|
|
});
|
|
};
|
|
function _161(_162,_163){
|
|
var opts=$.data(_162,"tree").options;
|
|
$(_163).css("position","");
|
|
var _164=$(_163).find("input.tree-editor");
|
|
var val=_164.val();
|
|
_164.remove();
|
|
var node=_b4(_162,_163);
|
|
node.text=val;
|
|
_14f(_162,node);
|
|
opts.onAfterEdit.call(_162,node);
|
|
};
|
|
function _165(_166,_167){
|
|
var opts=$.data(_166,"tree").options;
|
|
$(_167).css("position","");
|
|
$(_167).find("input.tree-editor").remove();
|
|
var node=_b4(_166,_167);
|
|
_14f(_166,node);
|
|
opts.onCancelEdit.call(_166,node);
|
|
};
|
|
$.fn.tree=function(_168,_169){
|
|
if(typeof _168=="string"){
|
|
return $.fn.tree.methods[_168](this,_169);
|
|
}
|
|
var _168=_168||{};
|
|
return this.each(function(){
|
|
var _16a=$.data(this,"tree");
|
|
var opts;
|
|
if(_16a){
|
|
opts=$.extend(_16a.options,_168);
|
|
_16a.options=opts;
|
|
}else{
|
|
opts=$.extend({},$.fn.tree.defaults,$.fn.tree.parseOptions(this),_168);
|
|
$.data(this,"tree",{options:opts,tree:_a1(this)});
|
|
var data=_a4(this);
|
|
if(data.length&&!opts.data){
|
|
opts.data=data;
|
|
}
|
|
}
|
|
_ac(this);
|
|
if(opts.lines){
|
|
$(this).addClass("tree-lines");
|
|
}
|
|
if(opts.data){
|
|
_f2(this,this,opts.data);
|
|
}else{
|
|
if(opts.dnd){
|
|
_b8(this);
|
|
}else{
|
|
_b5(this);
|
|
}
|
|
}
|
|
_10a(this,this);
|
|
});
|
|
};
|
|
$.fn.tree.methods={options:function(jq){
|
|
return $.data(jq[0],"tree").options;
|
|
},loadData:function(jq,data){
|
|
return jq.each(function(){
|
|
_f2(this,this,data);
|
|
});
|
|
},getNode:function(jq,_16b){
|
|
return _b4(jq[0],_16b);
|
|
},getData:function(jq,_16c){
|
|
return _149(jq[0],_16c);
|
|
},reload:function(jq,_16d){
|
|
return jq.each(function(){
|
|
if(_16d){
|
|
var node=$(_16d);
|
|
var hit=node.children("span.tree-hit");
|
|
hit.removeClass("tree-expanded tree-expanded-hover").addClass("tree-collapsed");
|
|
node.next().remove();
|
|
_111(this,_16d);
|
|
}else{
|
|
$(this).empty();
|
|
_10a(this,this);
|
|
}
|
|
});
|
|
},getRoot:function(jq){
|
|
return _129(jq[0]);
|
|
},getRoots:function(jq){
|
|
return _12c(jq[0]);
|
|
},getParent:function(jq,_16e){
|
|
return _124(jq[0],_16e);
|
|
},getChildren:function(jq,_16f){
|
|
return _f1(jq[0],_16f);
|
|
},getChecked:function(jq,_170){
|
|
return _136(jq[0],_170);
|
|
},getSelected:function(jq){
|
|
return _13b(jq[0]);
|
|
},isLeaf:function(jq,_171){
|
|
return _ed(jq[0],_171);
|
|
},find:function(jq,id){
|
|
return _155(jq[0],id);
|
|
},select:function(jq,_172){
|
|
return jq.each(function(){
|
|
_157(this,_172);
|
|
});
|
|
},check:function(jq,_173){
|
|
return jq.each(function(){
|
|
_d9(this,_173,true);
|
|
});
|
|
},uncheck:function(jq,_174){
|
|
return jq.each(function(){
|
|
_d9(this,_174,false);
|
|
});
|
|
},collapse:function(jq,_175){
|
|
return jq.each(function(){
|
|
_116(this,_175);
|
|
});
|
|
},expand:function(jq,_176){
|
|
return jq.each(function(){
|
|
_111(this,_176);
|
|
});
|
|
},collapseAll:function(jq,_177){
|
|
return jq.each(function(){
|
|
_125(this,_177);
|
|
});
|
|
},expandAll:function(jq,_178){
|
|
return jq.each(function(){
|
|
_11c(this,_178);
|
|
});
|
|
},expandTo:function(jq,_179){
|
|
return jq.each(function(){
|
|
_120(this,_179);
|
|
});
|
|
},toggle:function(jq,_17a){
|
|
return jq.each(function(){
|
|
_119(this,_17a);
|
|
});
|
|
},append:function(jq,_17b){
|
|
return jq.each(function(){
|
|
_13d(this,_17b);
|
|
});
|
|
},insert:function(jq,_17c){
|
|
return jq.each(function(){
|
|
_141(this,_17c);
|
|
});
|
|
},remove:function(jq,_17d){
|
|
return jq.each(function(){
|
|
_145(this,_17d);
|
|
});
|
|
},pop:function(jq,_17e){
|
|
var node=jq.tree("getData",_17e);
|
|
jq.tree("remove",_17e);
|
|
return node;
|
|
},update:function(jq,_17f){
|
|
return jq.each(function(){
|
|
_14f(this,_17f);
|
|
});
|
|
},enableDnd:function(jq){
|
|
return jq.each(function(){
|
|
_b8(this);
|
|
});
|
|
},disableDnd:function(jq){
|
|
return jq.each(function(){
|
|
_b5(this);
|
|
});
|
|
},beginEdit:function(jq,_180){
|
|
return jq.each(function(){
|
|
_15c(this,_180);
|
|
});
|
|
},endEdit:function(jq,_181){
|
|
return jq.each(function(){
|
|
_161(this,_181);
|
|
});
|
|
},cancelEdit:function(jq,_182){
|
|
return jq.each(function(){
|
|
_165(this,_182);
|
|
});
|
|
}};
|
|
$.fn.tree.parseOptions=function(_183){
|
|
var t=$(_183);
|
|
return $.extend({},$.parser.parseOptions(_183,["url","method",{checkbox:"boolean",cascadeCheck:"boolean",onlyLeafCheck:"boolean"},{animate:"boolean",lines:"boolean",dnd:"boolean"}]));
|
|
};
|
|
$.fn.tree.defaults={url:null,method:"post",animate:false,checkbox:false,cascadeCheck:true,onlyLeafCheck:false,lines:false,dnd:false,data:null,loader:function(_184,_185,_186){
|
|
var opts=$(this).tree("options");
|
|
if(!opts.url){
|
|
return false;
|
|
}
|
|
$.ajax({type:opts.method,url:opts.url,data:_184,dataType:"json",success:function(data){
|
|
_185(data);
|
|
},error:function(){
|
|
_186.apply(this,arguments);
|
|
}});
|
|
},loadFilter:function(data,_187){
|
|
return data;
|
|
},onBeforeLoad:function(node,_188){
|
|
},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,_189){
|
|
},onCheck:function(node,_18a){
|
|
},onBeforeSelect:function(node){
|
|
},onSelect:function(node){
|
|
},onContextMenu:function(e,node){
|
|
},onBeforeDrag:function(node){
|
|
},onStartDrag:function(node){
|
|
},onStopDrag:function(node){
|
|
},onDragEnter:function(_18b,_18c){
|
|
},onDragOver:function(_18d,_18e){
|
|
},onDragLeave:function(_18f,_190){
|
|
},onDrop:function(_191,_192,_193){
|
|
},onBeforeEdit:function(node){
|
|
},onAfterEdit:function(node){
|
|
},onCancelEdit:function(node){
|
|
}};
|
|
})(jQuery);
|
|
(function($){
|
|
function init(_194){
|
|
$(_194).addClass("progressbar");
|
|
$(_194).html("<div class=\"progressbar-text\"></div><div class=\"progressbar-value\"><div class=\"progressbar-text\"></div></div>");
|
|
return $(_194);
|
|
};
|
|
function _195(_196,_197){
|
|
var opts=$.data(_196,"progressbar").options;
|
|
var bar=$.data(_196,"progressbar").bar;
|
|
if(_197){
|
|
opts.width=_197;
|
|
}
|
|
bar._outerWidth(opts.width)._outerHeight(opts.height);
|
|
bar.find("div.progressbar-text").width(bar.width());
|
|
bar.find("div.progressbar-text,div.progressbar-value").css({height:bar.height()+"px",lineHeight:bar.height()+"px"});
|
|
};
|
|
$.fn.progressbar=function(_198,_199){
|
|
if(typeof _198=="string"){
|
|
var _19a=$.fn.progressbar.methods[_198];
|
|
if(_19a){
|
|
return _19a(this,_199);
|
|
}
|
|
}
|
|
_198=_198||{};
|
|
return this.each(function(){
|
|
var _19b=$.data(this,"progressbar");
|
|
if(_19b){
|
|
$.extend(_19b.options,_198);
|
|
}else{
|
|
_19b=$.data(this,"progressbar",{options:$.extend({},$.fn.progressbar.defaults,$.fn.progressbar.parseOptions(this),_198),bar:init(this)});
|
|
}
|
|
$(this).progressbar("setValue",_19b.options.value);
|
|
_195(this);
|
|
});
|
|
};
|
|
$.fn.progressbar.methods={options:function(jq){
|
|
return $.data(jq[0],"progressbar").options;
|
|
},resize:function(jq,_19c){
|
|
return jq.each(function(){
|
|
_195(this,_19c);
|
|
});
|
|
},getValue:function(jq){
|
|
return $.data(jq[0],"progressbar").options.value;
|
|
},setValue:function(jq,_19d){
|
|
if(_19d<0){
|
|
_19d=0;
|
|
}
|
|
if(_19d>100){
|
|
_19d=100;
|
|
}
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"progressbar").options;
|
|
var text=opts.text.replace(/{value}/,_19d);
|
|
var _19e=opts.value;
|
|
opts.value=_19d;
|
|
$(this).find("div.progressbar-value").width(_19d+"%");
|
|
$(this).find("div.progressbar-text").html(text);
|
|
if(_19e!=_19d){
|
|
opts.onChange.call(this,_19d,_19e);
|
|
}
|
|
});
|
|
}};
|
|
$.fn.progressbar.parseOptions=function(_19f){
|
|
return $.extend({},$.parser.parseOptions(_19f,["width","height","text",{value:"number"}]));
|
|
};
|
|
$.fn.progressbar.defaults={width:"auto",height:22,value:0,text:"{value}%",onChange:function(_1a0,_1a1){
|
|
}};
|
|
})(jQuery);
|
|
(function($){
|
|
function _1a2(node){
|
|
node.each(function(){
|
|
$(this).remove();
|
|
if($.browser.msie){
|
|
this.outerHTML="";
|
|
}
|
|
});
|
|
};
|
|
function _1a3(_1a4,_1a5){
|
|
var opts=$.data(_1a4,"panel").options;
|
|
var _1a6=$.data(_1a4,"panel").panel;
|
|
var _1a7=_1a6.children("div.panel-header");
|
|
var _1a8=_1a6.children("div.panel-body");
|
|
if(_1a5){
|
|
if(_1a5.width){
|
|
opts.width=_1a5.width;
|
|
}
|
|
if(_1a5.height){
|
|
opts.height=_1a5.height;
|
|
}
|
|
if(_1a5.left!=null){
|
|
opts.left=_1a5.left;
|
|
}
|
|
if(_1a5.top!=null){
|
|
opts.top=_1a5.top;
|
|
}
|
|
}
|
|
opts.fit?$.extend(opts,_1a6._fit()):_1a6._fit(false);
|
|
_1a6.css({left:opts.left,top:opts.top});
|
|
if(!isNaN(opts.width)){
|
|
_1a6._outerWidth(opts.width);
|
|
}else{
|
|
_1a6.width("auto");
|
|
}
|
|
_1a7.add(_1a8)._outerWidth(_1a6.width());
|
|
if(!isNaN(opts.height)){
|
|
_1a6._outerHeight(opts.height);
|
|
_1a8._outerHeight(_1a6.height()-_1a7._outerHeight());
|
|
}else{
|
|
_1a8.height("auto");
|
|
}
|
|
_1a6.css("height","");
|
|
opts.onResize.apply(_1a4,[opts.width,opts.height]);
|
|
_1a6.find(">div.panel-body>div").triggerHandler("_resize");
|
|
};
|
|
function _1a9(_1aa,_1ab){
|
|
var opts=$.data(_1aa,"panel").options;
|
|
var _1ac=$.data(_1aa,"panel").panel;
|
|
if(_1ab){
|
|
if(_1ab.left!=null){
|
|
opts.left=_1ab.left;
|
|
}
|
|
if(_1ab.top!=null){
|
|
opts.top=_1ab.top;
|
|
}
|
|
}
|
|
_1ac.css({left:opts.left,top:opts.top});
|
|
opts.onMove.apply(_1aa,[opts.left,opts.top]);
|
|
};
|
|
function _1ad(_1ae){
|
|
$(_1ae).addClass("panel-body");
|
|
var _1af=$("<div class=\"panel\"></div>").insertBefore(_1ae);
|
|
_1af[0].appendChild(_1ae);
|
|
_1af.bind("_resize",function(){
|
|
var opts=$.data(_1ae,"panel").options;
|
|
if(opts.fit==true){
|
|
_1a3(_1ae);
|
|
}
|
|
return false;
|
|
});
|
|
return _1af;
|
|
};
|
|
function _1b0(_1b1){
|
|
var opts=$.data(_1b1,"panel").options;
|
|
var _1b2=$.data(_1b1,"panel").panel;
|
|
if(opts.tools&&typeof opts.tools=="string"){
|
|
_1b2.find(">div.panel-header>div.panel-tool .panel-tool-a").appendTo(opts.tools);
|
|
}
|
|
_1a2(_1b2.children("div.panel-header"));
|
|
if(opts.title&&!opts.noheader){
|
|
var _1b3=$("<div class=\"panel-header\"><div class=\"panel-title\">"+opts.title+"</div></div>").prependTo(_1b2);
|
|
if(opts.iconCls){
|
|
_1b3.find(".panel-title").addClass("panel-with-icon");
|
|
$("<div class=\"panel-icon\"></div>").addClass(opts.iconCls).appendTo(_1b3);
|
|
}
|
|
var tool=$("<div class=\"panel-tool\"></div>").appendTo(_1b3);
|
|
tool.bind("click",function(e){
|
|
e.stopPropagation();
|
|
});
|
|
if(opts.tools){
|
|
if(typeof opts.tools=="string"){
|
|
$(opts.tools).children().each(function(){
|
|
$(this).addClass($(this).attr("iconCls")).addClass("panel-tool-a").appendTo(tool);
|
|
});
|
|
}else{
|
|
for(var i=0;i<opts.tools.length;i++){
|
|
var t=$("<a href=\"javascript:void(0)\"></a>").addClass(opts.tools[i].iconCls).appendTo(tool);
|
|
if(opts.tools[i].handler){
|
|
t.bind("click",eval(opts.tools[i].handler));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if(opts.collapsible){
|
|
$("<a class=\"panel-tool-collapse\" href=\"javascript:void(0)\"></a>").appendTo(tool).bind("click",function(){
|
|
if(opts.collapsed==true){
|
|
_1ce(_1b1,true);
|
|
}else{
|
|
_1c3(_1b1,true);
|
|
}
|
|
return false;
|
|
});
|
|
}
|
|
if(opts.minimizable){
|
|
$("<a class=\"panel-tool-min\" href=\"javascript:void(0)\"></a>").appendTo(tool).bind("click",function(){
|
|
_1d4(_1b1);
|
|
return false;
|
|
});
|
|
}
|
|
if(opts.maximizable){
|
|
$("<a class=\"panel-tool-max\" href=\"javascript:void(0)\"></a>").appendTo(tool).bind("click",function(){
|
|
if(opts.maximized==true){
|
|
_1d7(_1b1);
|
|
}else{
|
|
_1c2(_1b1);
|
|
}
|
|
return false;
|
|
});
|
|
}
|
|
if(opts.closable){
|
|
$("<a class=\"panel-tool-close\" href=\"javascript:void(0)\"></a>").appendTo(tool).bind("click",function(){
|
|
_1b4(_1b1);
|
|
return false;
|
|
});
|
|
}
|
|
_1b2.children("div.panel-body").removeClass("panel-body-noheader");
|
|
}else{
|
|
_1b2.children("div.panel-body").addClass("panel-body-noheader");
|
|
}
|
|
};
|
|
function _1b5(_1b6){
|
|
var _1b7=$.data(_1b6,"panel");
|
|
var opts=_1b7.options;
|
|
if(opts.href){
|
|
if(!_1b7.isLoaded||!opts.cache){
|
|
_1b7.isLoaded=false;
|
|
_1b8(_1b6);
|
|
if(opts.loadingMessage){
|
|
$(_1b6).html($("<div class=\"panel-loading\"></div>").html(opts.loadingMessage));
|
|
}
|
|
$.ajax({url:opts.href,cache:false,dataType:"html",success:function(data){
|
|
_1b9(opts.extractor.call(_1b6,data));
|
|
opts.onLoad.apply(_1b6,arguments);
|
|
_1b7.isLoaded=true;
|
|
}});
|
|
}
|
|
}else{
|
|
if(opts.content){
|
|
if(!_1b7.isLoaded){
|
|
_1b8(_1b6);
|
|
_1b9(opts.content);
|
|
_1b7.isLoaded=true;
|
|
}
|
|
}
|
|
}
|
|
function _1b9(_1ba){
|
|
$(_1b6).html(_1ba);
|
|
if($.parser){
|
|
$.parser.parse($(_1b6));
|
|
}
|
|
};
|
|
};
|
|
function _1b8(_1bb){
|
|
var t=$(_1bb);
|
|
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");
|
|
});
|
|
};
|
|
function _1bc(_1bd){
|
|
$(_1bd).find("div.panel:visible,div.accordion:visible,div.tabs-container:visible,div.layout:visible").each(function(){
|
|
$(this).triggerHandler("_resize",[true]);
|
|
});
|
|
};
|
|
function _1be(_1bf,_1c0){
|
|
var opts=$.data(_1bf,"panel").options;
|
|
var _1c1=$.data(_1bf,"panel").panel;
|
|
if(_1c0!=true){
|
|
if(opts.onBeforeOpen.call(_1bf)==false){
|
|
return;
|
|
}
|
|
}
|
|
_1c1.show();
|
|
opts.closed=false;
|
|
opts.minimized=false;
|
|
var tool=_1c1.children("div.panel-header").find("a.panel-tool-restore");
|
|
if(tool.length){
|
|
opts.maximized=true;
|
|
}
|
|
opts.onOpen.call(_1bf);
|
|
if(opts.maximized==true){
|
|
opts.maximized=false;
|
|
_1c2(_1bf);
|
|
}
|
|
if(opts.collapsed==true){
|
|
opts.collapsed=false;
|
|
_1c3(_1bf);
|
|
}
|
|
if(!opts.collapsed){
|
|
_1b5(_1bf);
|
|
_1bc(_1bf);
|
|
}
|
|
};
|
|
function _1b4(_1c4,_1c5){
|
|
var opts=$.data(_1c4,"panel").options;
|
|
var _1c6=$.data(_1c4,"panel").panel;
|
|
if(_1c5!=true){
|
|
if(opts.onBeforeClose.call(_1c4)==false){
|
|
return;
|
|
}
|
|
}
|
|
_1c6._fit(false);
|
|
_1c6.hide();
|
|
opts.closed=true;
|
|
opts.onClose.call(_1c4);
|
|
};
|
|
function _1c7(_1c8,_1c9){
|
|
var opts=$.data(_1c8,"panel").options;
|
|
var _1ca=$.data(_1c8,"panel").panel;
|
|
if(_1c9!=true){
|
|
if(opts.onBeforeDestroy.call(_1c8)==false){
|
|
return;
|
|
}
|
|
}
|
|
_1b8(_1c8);
|
|
_1a2(_1ca);
|
|
opts.onDestroy.call(_1c8);
|
|
};
|
|
function _1c3(_1cb,_1cc){
|
|
var opts=$.data(_1cb,"panel").options;
|
|
var _1cd=$.data(_1cb,"panel").panel;
|
|
var body=_1cd.children("div.panel-body");
|
|
var tool=_1cd.children("div.panel-header").find("a.panel-tool-collapse");
|
|
if(opts.collapsed==true){
|
|
return;
|
|
}
|
|
body.stop(true,true);
|
|
if(opts.onBeforeCollapse.call(_1cb)==false){
|
|
return;
|
|
}
|
|
tool.addClass("panel-tool-expand");
|
|
if(_1cc==true){
|
|
body.slideUp("normal",function(){
|
|
opts.collapsed=true;
|
|
opts.onCollapse.call(_1cb);
|
|
});
|
|
}else{
|
|
body.hide();
|
|
opts.collapsed=true;
|
|
opts.onCollapse.call(_1cb);
|
|
}
|
|
};
|
|
function _1ce(_1cf,_1d0){
|
|
var opts=$.data(_1cf,"panel").options;
|
|
var _1d1=$.data(_1cf,"panel").panel;
|
|
var body=_1d1.children("div.panel-body");
|
|
var tool=_1d1.children("div.panel-header").find("a.panel-tool-collapse");
|
|
if(opts.collapsed==false){
|
|
return;
|
|
}
|
|
body.stop(true,true);
|
|
if(opts.onBeforeExpand.call(_1cf)==false){
|
|
return;
|
|
}
|
|
tool.removeClass("panel-tool-expand");
|
|
if(_1d0==true){
|
|
body.slideDown("normal",function(){
|
|
opts.collapsed=false;
|
|
opts.onExpand.call(_1cf);
|
|
_1b5(_1cf);
|
|
_1bc(_1cf);
|
|
});
|
|
}else{
|
|
body.show();
|
|
opts.collapsed=false;
|
|
opts.onExpand.call(_1cf);
|
|
_1b5(_1cf);
|
|
_1bc(_1cf);
|
|
}
|
|
};
|
|
function _1c2(_1d2){
|
|
var opts=$.data(_1d2,"panel").options;
|
|
var _1d3=$.data(_1d2,"panel").panel;
|
|
var tool=_1d3.children("div.panel-header").find("a.panel-tool-max");
|
|
if(opts.maximized==true){
|
|
return;
|
|
}
|
|
tool.addClass("panel-tool-restore");
|
|
if(!$.data(_1d2,"panel").original){
|
|
$.data(_1d2,"panel").original={width:opts.width,height:opts.height,left:opts.left,top:opts.top,fit:opts.fit};
|
|
}
|
|
opts.left=0;
|
|
opts.top=0;
|
|
opts.fit=true;
|
|
_1a3(_1d2);
|
|
opts.minimized=false;
|
|
opts.maximized=true;
|
|
opts.onMaximize.call(_1d2);
|
|
};
|
|
function _1d4(_1d5){
|
|
var opts=$.data(_1d5,"panel").options;
|
|
var _1d6=$.data(_1d5,"panel").panel;
|
|
_1d6._fit(false);
|
|
_1d6.hide();
|
|
opts.minimized=true;
|
|
opts.maximized=false;
|
|
opts.onMinimize.call(_1d5);
|
|
};
|
|
function _1d7(_1d8){
|
|
var opts=$.data(_1d8,"panel").options;
|
|
var _1d9=$.data(_1d8,"panel").panel;
|
|
var tool=_1d9.children("div.panel-header").find("a.panel-tool-max");
|
|
if(opts.maximized==false){
|
|
return;
|
|
}
|
|
_1d9.show();
|
|
tool.removeClass("panel-tool-restore");
|
|
$.extend(opts,$.data(_1d8,"panel").original);
|
|
_1a3(_1d8);
|
|
opts.minimized=false;
|
|
opts.maximized=false;
|
|
$.data(_1d8,"panel").original=null;
|
|
opts.onRestore.call(_1d8);
|
|
};
|
|
function _1da(_1db){
|
|
var opts=$.data(_1db,"panel").options;
|
|
var _1dc=$.data(_1db,"panel").panel;
|
|
var _1dd=$(_1db).panel("header");
|
|
var body=$(_1db).panel("body");
|
|
_1dc.css(opts.style);
|
|
_1dc.addClass(opts.cls);
|
|
if(opts.border){
|
|
_1dd.removeClass("panel-header-noborder");
|
|
body.removeClass("panel-body-noborder");
|
|
}else{
|
|
_1dd.addClass("panel-header-noborder");
|
|
body.addClass("panel-body-noborder");
|
|
}
|
|
_1dd.addClass(opts.headerCls);
|
|
body.addClass(opts.bodyCls);
|
|
if(opts.id){
|
|
$(_1db).attr("id",opts.id);
|
|
}else{
|
|
$(_1db).attr("id","");
|
|
}
|
|
};
|
|
function _1de(_1df,_1e0){
|
|
$.data(_1df,"panel").options.title=_1e0;
|
|
$(_1df).panel("header").find("div.panel-title").html(_1e0);
|
|
};
|
|
var TO=false;
|
|
var _1e1=true;
|
|
$(window).unbind(".panel").bind("resize.panel",function(){
|
|
if(!_1e1){
|
|
return;
|
|
}
|
|
if(TO!==false){
|
|
clearTimeout(TO);
|
|
}
|
|
TO=setTimeout(function(){
|
|
_1e1=false;
|
|
var _1e2=$("body.layout");
|
|
if(_1e2.length){
|
|
_1e2.layout("resize");
|
|
}else{
|
|
$("body").children("div.panel,div.accordion,div.tabs-container,div.layout").triggerHandler("_resize");
|
|
}
|
|
_1e1=true;
|
|
TO=false;
|
|
},200);
|
|
});
|
|
$.fn.panel=function(_1e3,_1e4){
|
|
if(typeof _1e3=="string"){
|
|
return $.fn.panel.methods[_1e3](this,_1e4);
|
|
}
|
|
_1e3=_1e3||{};
|
|
return this.each(function(){
|
|
var _1e5=$.data(this,"panel");
|
|
var opts;
|
|
if(_1e5){
|
|
opts=$.extend(_1e5.options,_1e3);
|
|
_1e5.isLoaded=false;
|
|
}else{
|
|
opts=$.extend({},$.fn.panel.defaults,$.fn.panel.parseOptions(this),_1e3);
|
|
$(this).attr("title","");
|
|
_1e5=$.data(this,"panel",{options:opts,panel:_1ad(this),isLoaded:false});
|
|
}
|
|
_1b0(this);
|
|
_1da(this);
|
|
if(opts.doSize==true){
|
|
_1e5.panel.css("display","block");
|
|
_1a3(this);
|
|
}
|
|
if(opts.closed==true||opts.minimized==true){
|
|
_1e5.panel.hide();
|
|
}else{
|
|
_1be(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.find(">div.panel-header");
|
|
},body:function(jq){
|
|
return $.data(jq[0],"panel").panel.find(">div.panel-body");
|
|
},setTitle:function(jq,_1e6){
|
|
return jq.each(function(){
|
|
_1de(this,_1e6);
|
|
});
|
|
},open:function(jq,_1e7){
|
|
return jq.each(function(){
|
|
_1be(this,_1e7);
|
|
});
|
|
},close:function(jq,_1e8){
|
|
return jq.each(function(){
|
|
_1b4(this,_1e8);
|
|
});
|
|
},destroy:function(jq,_1e9){
|
|
return jq.each(function(){
|
|
_1c7(this,_1e9);
|
|
});
|
|
},refresh:function(jq,href){
|
|
return jq.each(function(){
|
|
$.data(this,"panel").isLoaded=false;
|
|
if(href){
|
|
$.data(this,"panel").options.href=href;
|
|
}
|
|
_1b5(this);
|
|
});
|
|
},resize:function(jq,_1ea){
|
|
return jq.each(function(){
|
|
_1a3(this,_1ea);
|
|
});
|
|
},move:function(jq,_1eb){
|
|
return jq.each(function(){
|
|
_1a9(this,_1eb);
|
|
});
|
|
},maximize:function(jq){
|
|
return jq.each(function(){
|
|
_1c2(this);
|
|
});
|
|
},minimize:function(jq){
|
|
return jq.each(function(){
|
|
_1d4(this);
|
|
});
|
|
},restore:function(jq){
|
|
return jq.each(function(){
|
|
_1d7(this);
|
|
});
|
|
},collapse:function(jq,_1ec){
|
|
return jq.each(function(){
|
|
_1c3(this,_1ec);
|
|
});
|
|
},expand:function(jq,_1ed){
|
|
return jq.each(function(){
|
|
_1ce(this,_1ed);
|
|
});
|
|
}};
|
|
$.fn.panel.parseOptions=function(_1ee){
|
|
var t=$(_1ee);
|
|
return $.extend({},$.parser.parseOptions(_1ee,["id","width","height","left","top","title","iconCls","cls","headerCls","bodyCls","tools","href",{cache:"boolean",fit:"boolean",border:"boolean",noheader:"boolean"},{collapsible:"boolean",minimizable:"boolean",maximizable:"boolean"},{closable:"boolean",collapsed:"boolean",minimized:"boolean",maximized:"boolean",closed:"boolean"}]),{loadingMessage:(t.attr("loadingMessage")!=undefined?t.attr("loadingMessage"):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,collapsible:false,minimizable:false,maximizable:false,closable:false,collapsed:false,minimized:false,maximized:false,closed:false,tools:null,href:null,loadingMessage:"Loading...",extractor:function(data){
|
|
var _1ef=/<body[^>]*>((.|[\n\r])*)<\/body>/im;
|
|
var _1f0=_1ef.exec(data);
|
|
if(_1f0){
|
|
return _1f0[1];
|
|
}else{
|
|
return data;
|
|
}
|
|
},onLoad:function(){
|
|
},onBeforeOpen:function(){
|
|
},onOpen:function(){
|
|
},onBeforeClose:function(){
|
|
},onClose:function(){
|
|
},onBeforeDestroy:function(){
|
|
},onDestroy:function(){
|
|
},onResize:function(_1f1,_1f2){
|
|
},onMove:function(left,top){
|
|
},onMaximize:function(){
|
|
},onRestore:function(){
|
|
},onMinimize:function(){
|
|
},onBeforeCollapse:function(){
|
|
},onBeforeExpand:function(){
|
|
},onCollapse:function(){
|
|
},onExpand:function(){
|
|
}};
|
|
})(jQuery);
|
|
(function($){
|
|
function _1f3(_1f4,_1f5){
|
|
var opts=$.data(_1f4,"window").options;
|
|
if(_1f5){
|
|
if(_1f5.width){
|
|
opts.width=_1f5.width;
|
|
}
|
|
if(_1f5.height){
|
|
opts.height=_1f5.height;
|
|
}
|
|
if(_1f5.left!=null){
|
|
opts.left=_1f5.left;
|
|
}
|
|
if(_1f5.top!=null){
|
|
opts.top=_1f5.top;
|
|
}
|
|
}
|
|
$(_1f4).panel("resize",opts);
|
|
};
|
|
function _1f6(_1f7,_1f8){
|
|
var _1f9=$.data(_1f7,"window");
|
|
if(_1f8){
|
|
if(_1f8.left!=null){
|
|
_1f9.options.left=_1f8.left;
|
|
}
|
|
if(_1f8.top!=null){
|
|
_1f9.options.top=_1f8.top;
|
|
}
|
|
}
|
|
$(_1f7).panel("move",_1f9.options);
|
|
if(_1f9.shadow){
|
|
_1f9.shadow.css({left:_1f9.options.left,top:_1f9.options.top});
|
|
}
|
|
};
|
|
function _1fa(_1fb,_1fc){
|
|
var _1fd=$.data(_1fb,"window");
|
|
var opts=_1fd.options;
|
|
var _1fe=opts.width;
|
|
if(isNaN(_1fe)){
|
|
_1fe=_1fd.window._outerWidth();
|
|
}
|
|
if(opts.inline){
|
|
var _1ff=_1fd.window.parent();
|
|
opts.left=(_1ff.width()-_1fe)/2+_1ff.scrollLeft();
|
|
}else{
|
|
opts.left=($(window)._outerWidth()-_1fe)/2+$(document).scrollLeft();
|
|
}
|
|
if(_1fc){
|
|
_1f6(_1fb);
|
|
}
|
|
};
|
|
function _200(_201,_202){
|
|
var _203=$.data(_201,"window");
|
|
var opts=_203.options;
|
|
var _204=opts.height;
|
|
if(isNaN(_204)){
|
|
_204=_203.window._outerHeight();
|
|
}
|
|
if(opts.inline){
|
|
var _205=_203.window.parent();
|
|
opts.top=(_205.height()-_204)/2+_205.scrollTop();
|
|
}else{
|
|
opts.top=($(window)._outerHeight()-_204)/2+$(document).scrollTop();
|
|
}
|
|
if(_202){
|
|
_1f6(_201);
|
|
}
|
|
};
|
|
function _206(_207){
|
|
var _208=$.data(_207,"window");
|
|
var win=$(_207).panel($.extend({},_208.options,{border:false,doSize:true,closed:true,cls:"window",headerCls:"window-header",bodyCls:"window-body "+(_208.options.noheader?"window-body-noheader":""),onBeforeDestroy:function(){
|
|
if(_208.options.onBeforeDestroy.call(_207)==false){
|
|
return false;
|
|
}
|
|
if(_208.shadow){
|
|
_208.shadow.remove();
|
|
}
|
|
if(_208.mask){
|
|
_208.mask.remove();
|
|
}
|
|
},onClose:function(){
|
|
if(_208.shadow){
|
|
_208.shadow.hide();
|
|
}
|
|
if(_208.mask){
|
|
_208.mask.hide();
|
|
}
|
|
_208.options.onClose.call(_207);
|
|
},onOpen:function(){
|
|
if(_208.mask){
|
|
_208.mask.css({display:"block",zIndex:$.fn.window.defaults.zIndex++});
|
|
}
|
|
if(_208.shadow){
|
|
_208.shadow.css({display:"block",zIndex:$.fn.window.defaults.zIndex++,left:_208.options.left,top:_208.options.top,width:_208.window._outerWidth(),height:_208.window._outerHeight()});
|
|
}
|
|
_208.window.css("z-index",$.fn.window.defaults.zIndex++);
|
|
_208.options.onOpen.call(_207);
|
|
},onResize:function(_209,_20a){
|
|
var opts=$(this).panel("options");
|
|
$.extend(_208.options,{width:opts.width,height:opts.height,left:opts.left,top:opts.top});
|
|
if(_208.shadow){
|
|
_208.shadow.css({left:_208.options.left,top:_208.options.top,width:_208.window._outerWidth(),height:_208.window._outerHeight()});
|
|
}
|
|
_208.options.onResize.call(_207,_209,_20a);
|
|
},onMinimize:function(){
|
|
if(_208.shadow){
|
|
_208.shadow.hide();
|
|
}
|
|
if(_208.mask){
|
|
_208.mask.hide();
|
|
}
|
|
_208.options.onMinimize.call(_207);
|
|
},onBeforeCollapse:function(){
|
|
if(_208.options.onBeforeCollapse.call(_207)==false){
|
|
return false;
|
|
}
|
|
if(_208.shadow){
|
|
_208.shadow.hide();
|
|
}
|
|
},onExpand:function(){
|
|
if(_208.shadow){
|
|
_208.shadow.show();
|
|
}
|
|
_208.options.onExpand.call(_207);
|
|
}}));
|
|
_208.window=win.panel("panel");
|
|
if(_208.mask){
|
|
_208.mask.remove();
|
|
}
|
|
if(_208.options.modal==true){
|
|
_208.mask=$("<div class=\"window-mask\"></div>").insertAfter(_208.window);
|
|
_208.mask.css({width:(_208.options.inline?_208.mask.parent().width():_20b().width),height:(_208.options.inline?_208.mask.parent().height():_20b().height),display:"none"});
|
|
}
|
|
if(_208.shadow){
|
|
_208.shadow.remove();
|
|
}
|
|
if(_208.options.shadow==true){
|
|
_208.shadow=$("<div class=\"window-shadow\"></div>").insertAfter(_208.window);
|
|
_208.shadow.css({display:"none"});
|
|
}
|
|
if(_208.options.left==null){
|
|
_1fa(_207);
|
|
}
|
|
if(_208.options.top==null){
|
|
_200(_207);
|
|
}
|
|
_1f6(_207);
|
|
if(_208.options.closed==false){
|
|
win.window("open");
|
|
}
|
|
};
|
|
function _20c(_20d){
|
|
var _20e=$.data(_20d,"window");
|
|
_20e.window.draggable({handle:">div.panel-header>div.panel-title",disabled:_20e.options.draggable==false,onStartDrag:function(e){
|
|
if(_20e.mask){
|
|
_20e.mask.css("z-index",$.fn.window.defaults.zIndex++);
|
|
}
|
|
if(_20e.shadow){
|
|
_20e.shadow.css("z-index",$.fn.window.defaults.zIndex++);
|
|
}
|
|
_20e.window.css("z-index",$.fn.window.defaults.zIndex++);
|
|
if(!_20e.proxy){
|
|
_20e.proxy=$("<div class=\"window-proxy\"></div>").insertAfter(_20e.window);
|
|
}
|
|
_20e.proxy.css({display:"none",zIndex:$.fn.window.defaults.zIndex++,left:e.data.left,top:e.data.top});
|
|
_20e.proxy._outerWidth(_20e.window._outerWidth());
|
|
_20e.proxy._outerHeight(_20e.window._outerHeight());
|
|
setTimeout(function(){
|
|
if(_20e.proxy){
|
|
_20e.proxy.show();
|
|
}
|
|
},500);
|
|
},onDrag:function(e){
|
|
_20e.proxy.css({display:"block",left:e.data.left,top:e.data.top});
|
|
return false;
|
|
},onStopDrag:function(e){
|
|
_20e.options.left=e.data.left;
|
|
_20e.options.top=e.data.top;
|
|
$(_20d).window("move");
|
|
_20e.proxy.remove();
|
|
_20e.proxy=null;
|
|
}});
|
|
_20e.window.resizable({disabled:_20e.options.resizable==false,onStartResize:function(e){
|
|
_20e.pmask=$("<div class=\"window-proxy-mask\"></div>").insertAfter(_20e.window);
|
|
_20e.pmask.css({zIndex:$.fn.window.defaults.zIndex++,left:e.data.left,top:e.data.top,width:_20e.window._outerWidth(),height:_20e.window._outerHeight()});
|
|
if(!_20e.proxy){
|
|
_20e.proxy=$("<div class=\"window-proxy\"></div>").insertAfter(_20e.window);
|
|
}
|
|
_20e.proxy.css({zIndex:$.fn.window.defaults.zIndex++,left:e.data.left,top:e.data.top});
|
|
_20e.proxy._outerWidth(e.data.width);
|
|
_20e.proxy._outerHeight(e.data.height);
|
|
},onResize:function(e){
|
|
_20e.proxy.css({left:e.data.left,top:e.data.top});
|
|
_20e.proxy._outerWidth(e.data.width);
|
|
_20e.proxy._outerHeight(e.data.height);
|
|
return false;
|
|
},onStopResize:function(e){
|
|
$.extend(_20e.options,{left:e.data.left,top:e.data.top,width:e.data.width,height:e.data.height});
|
|
_1f3(_20d);
|
|
_20e.pmask.remove();
|
|
_20e.pmask=null;
|
|
_20e.proxy.remove();
|
|
_20e.proxy=null;
|
|
}});
|
|
};
|
|
function _20b(){
|
|
if(document.compatMode=="BackCompat"){
|
|
return {width:Math.max(document.body.scrollWidth,document.body.clientWidth),height:Math.max(document.body.scrollHeight,document.body.clientHeight)};
|
|
}else{
|
|
return {width:Math.max(document.documentElement.scrollWidth,document.documentElement.clientWidth),height:Math.max(document.documentElement.scrollHeight,document.documentElement.clientHeight)};
|
|
}
|
|
};
|
|
$(window).resize(function(){
|
|
$("body>div.window-mask").css({width:$(window)._outerWidth(),height:$(window)._outerHeight()});
|
|
setTimeout(function(){
|
|
$("body>div.window-mask").css({width:_20b().width,height:_20b().height});
|
|
},50);
|
|
});
|
|
$.fn.window=function(_20f,_210){
|
|
if(typeof _20f=="string"){
|
|
var _211=$.fn.window.methods[_20f];
|
|
if(_211){
|
|
return _211(this,_210);
|
|
}else{
|
|
return this.panel(_20f,_210);
|
|
}
|
|
}
|
|
_20f=_20f||{};
|
|
return this.each(function(){
|
|
var _212=$.data(this,"window");
|
|
if(_212){
|
|
$.extend(_212.options,_20f);
|
|
}else{
|
|
_212=$.data(this,"window",{options:$.extend({},$.fn.window.defaults,$.fn.window.parseOptions(this),_20f)});
|
|
if(!_212.options.inline){
|
|
document.body.appendChild(this);
|
|
}
|
|
}
|
|
_206(this);
|
|
_20c(this);
|
|
});
|
|
};
|
|
$.fn.window.methods={options:function(jq){
|
|
var _213=jq.panel("options");
|
|
var _214=$.data(jq[0],"window").options;
|
|
return $.extend(_214,{closed:_213.closed,collapsed:_213.collapsed,minimized:_213.minimized,maximized:_213.maximized});
|
|
},window:function(jq){
|
|
return $.data(jq[0],"window").window;
|
|
},resize:function(jq,_215){
|
|
return jq.each(function(){
|
|
_1f3(this,_215);
|
|
});
|
|
},move:function(jq,_216){
|
|
return jq.each(function(){
|
|
_1f6(this,_216);
|
|
});
|
|
},hcenter:function(jq){
|
|
return jq.each(function(){
|
|
_1fa(this,true);
|
|
});
|
|
},vcenter:function(jq){
|
|
return jq.each(function(){
|
|
_200(this,true);
|
|
});
|
|
},center:function(jq){
|
|
return jq.each(function(){
|
|
_1fa(this);
|
|
_200(this);
|
|
_1f6(this);
|
|
});
|
|
}};
|
|
$.fn.window.parseOptions=function(_217){
|
|
return $.extend({},$.fn.panel.parseOptions(_217),$.parser.parseOptions(_217,[{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,inline:false,title:"New Window",collapsible:true,minimizable:true,maximizable:true,closable:true,closed:false});
|
|
})(jQuery);
|
|
(function($){
|
|
function _218(_219){
|
|
var cp=document.createElement("div");
|
|
while(_219.firstChild){
|
|
cp.appendChild(_219.firstChild);
|
|
}
|
|
_219.appendChild(cp);
|
|
var _21a=$(cp);
|
|
_21a.attr("style",$(_219).attr("style"));
|
|
$(_219).removeAttr("style").css("overflow","hidden");
|
|
_21a.panel({border:false,doSize:false,bodyCls:"dialog-content"});
|
|
return _21a;
|
|
};
|
|
function _21b(_21c){
|
|
var opts=$.data(_21c,"dialog").options;
|
|
var _21d=$.data(_21c,"dialog").contentPanel;
|
|
if(opts.toolbar){
|
|
if(typeof opts.toolbar=="string"){
|
|
$(opts.toolbar).addClass("dialog-toolbar").prependTo(_21c);
|
|
$(opts.toolbar).show();
|
|
}else{
|
|
$(_21c).find("div.dialog-toolbar").remove();
|
|
var _21e=$("<div class=\"dialog-toolbar\"><table cellspacing=\"0\" cellpadding=\"0\"><tr></tr></table></div>").prependTo(_21c);
|
|
var tr=_21e.find("tr");
|
|
for(var i=0;i<opts.toolbar.length;i++){
|
|
var btn=opts.toolbar[i];
|
|
if(btn=="-"){
|
|
$("<td><div class=\"dialog-tool-separator\"></div></td>").appendTo(tr);
|
|
}else{
|
|
var td=$("<td></td>").appendTo(tr);
|
|
var tool=$("<a href=\"javascript:void(0)\"></a>").appendTo(td);
|
|
tool[0].onclick=eval(btn.handler||function(){
|
|
});
|
|
tool.linkbutton($.extend({},btn,{plain:true}));
|
|
}
|
|
}
|
|
}
|
|
}else{
|
|
$(_21c).find("div.dialog-toolbar").remove();
|
|
}
|
|
if(opts.buttons){
|
|
if(typeof opts.buttons=="string"){
|
|
$(opts.buttons).addClass("dialog-button").appendTo(_21c);
|
|
$(opts.buttons).show();
|
|
}else{
|
|
$(_21c).find("div.dialog-button").remove();
|
|
var _21f=$("<div class=\"dialog-button\"></div>").appendTo(_21c);
|
|
for(var i=0;i<opts.buttons.length;i++){
|
|
var p=opts.buttons[i];
|
|
var _220=$("<a href=\"javascript:void(0)\"></a>").appendTo(_21f);
|
|
if(p.handler){
|
|
_220[0].onclick=p.handler;
|
|
}
|
|
_220.linkbutton(p);
|
|
}
|
|
}
|
|
}else{
|
|
$(_21c).find("div.dialog-button").remove();
|
|
}
|
|
var _221=opts.href;
|
|
var _222=opts.content;
|
|
opts.href=null;
|
|
opts.content=null;
|
|
_21d.panel({closed:opts.closed,cache:opts.cache,href:_221,content:_222,onLoad:function(){
|
|
if(opts.height=="auto"){
|
|
$(_21c).window("resize");
|
|
}
|
|
opts.onLoad.apply(_21c,arguments);
|
|
}});
|
|
$(_21c).window($.extend({},opts,{onOpen:function(){
|
|
if(_21d.panel("options").closed){
|
|
_21d.panel("open");
|
|
}
|
|
if(opts.onOpen){
|
|
opts.onOpen.call(_21c);
|
|
}
|
|
},onResize:function(_223,_224){
|
|
var _225=$(_21c);
|
|
_21d.panel("panel").show();
|
|
_21d.panel("resize",{width:_225.width(),height:(_224=="auto")?"auto":_225.height()-_225.children("div.dialog-toolbar")._outerHeight()-_225.children("div.dialog-button")._outerHeight()});
|
|
if(opts.onResize){
|
|
opts.onResize.call(_21c,_223,_224);
|
|
}
|
|
}}));
|
|
opts.href=_221;
|
|
opts.content=_222;
|
|
};
|
|
function _226(_227,href){
|
|
var _228=$.data(_227,"dialog").contentPanel;
|
|
_228.panel("refresh",href);
|
|
};
|
|
$.fn.dialog=function(_229,_22a){
|
|
if(typeof _229=="string"){
|
|
var _22b=$.fn.dialog.methods[_229];
|
|
if(_22b){
|
|
return _22b(this,_22a);
|
|
}else{
|
|
return this.window(_229,_22a);
|
|
}
|
|
}
|
|
_229=_229||{};
|
|
return this.each(function(){
|
|
var _22c=$.data(this,"dialog");
|
|
if(_22c){
|
|
$.extend(_22c.options,_229);
|
|
}else{
|
|
$.data(this,"dialog",{options:$.extend({},$.fn.dialog.defaults,$.fn.dialog.parseOptions(this),_229),contentPanel:_218(this)});
|
|
}
|
|
_21b(this);
|
|
});
|
|
};
|
|
$.fn.dialog.methods={options:function(jq){
|
|
var _22d=$.data(jq[0],"dialog").options;
|
|
var _22e=jq.panel("options");
|
|
$.extend(_22d,{closed:_22e.closed,collapsed:_22e.collapsed,minimized:_22e.minimized,maximized:_22e.maximized});
|
|
var _22f=$.data(jq[0],"dialog").contentPanel;
|
|
return _22d;
|
|
},dialog:function(jq){
|
|
return jq.window("window");
|
|
},refresh:function(jq,href){
|
|
return jq.each(function(){
|
|
_226(this,href);
|
|
});
|
|
}};
|
|
$.fn.dialog.parseOptions=function(_230){
|
|
return $.extend({},$.fn.window.parseOptions(_230),$.parser.parseOptions(_230,["toolbar","buttons"]));
|
|
};
|
|
$.fn.dialog.defaults=$.extend({},$.fn.window.defaults,{title:"New Dialog",collapsible:false,minimizable:false,maximizable:false,resizable:false,toolbar:null,buttons:null});
|
|
})(jQuery);
|
|
(function($){
|
|
function show(el,type,_231,_232){
|
|
var win=$(el).window("window");
|
|
if(!win){
|
|
return;
|
|
}
|
|
switch(type){
|
|
case null:
|
|
win.show();
|
|
break;
|
|
case "slide":
|
|
win.slideDown(_231);
|
|
break;
|
|
case "fade":
|
|
win.fadeIn(_231);
|
|
break;
|
|
case "show":
|
|
win.show(_231);
|
|
break;
|
|
}
|
|
var _233=null;
|
|
if(_232>0){
|
|
_233=setTimeout(function(){
|
|
hide(el,type,_231);
|
|
},_232);
|
|
}
|
|
win.hover(function(){
|
|
if(_233){
|
|
clearTimeout(_233);
|
|
}
|
|
},function(){
|
|
if(_232>0){
|
|
_233=setTimeout(function(){
|
|
hide(el,type,_231);
|
|
},_232);
|
|
}
|
|
});
|
|
};
|
|
function hide(el,type,_234){
|
|
if(el.locked==true){
|
|
return;
|
|
}
|
|
el.locked=true;
|
|
var win=$(el).window("window");
|
|
if(!win){
|
|
return;
|
|
}
|
|
switch(type){
|
|
case null:
|
|
win.hide();
|
|
break;
|
|
case "slide":
|
|
win.slideUp(_234);
|
|
break;
|
|
case "fade":
|
|
win.fadeOut(_234);
|
|
break;
|
|
case "show":
|
|
win.hide(_234);
|
|
break;
|
|
}
|
|
setTimeout(function(){
|
|
$(el).window("destroy");
|
|
},_234);
|
|
};
|
|
function _235(_236){
|
|
var opts=$.extend({},$.fn.window.defaults,{collapsible:false,minimizable:false,maximizable: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},onBeforeOpen:function(){
|
|
show(this,opts.showType,opts.showSpeed,opts.timeout);
|
|
return false;
|
|
},onBeforeClose:function(){
|
|
hide(this,opts.showType,opts.showSpeed);
|
|
return false;
|
|
}},{title:"",width:250,height:100,showType:"slide",showSpeed:600,msg:"",timeout:4000},_236);
|
|
opts.style.zIndex=$.fn.window.defaults.zIndex++;
|
|
var win=$("<div class=\"messager-body\"></div>").html(opts.msg).appendTo("body");
|
|
win.window(opts);
|
|
win.window("window").css(opts.style);
|
|
win.window("open");
|
|
return win;
|
|
};
|
|
function _237(_238,_239,_23a){
|
|
var win=$("<div class=\"messager-body\"></div>").appendTo("body");
|
|
win.append(_239);
|
|
if(_23a){
|
|
var tb=$("<div class=\"messager-button\"></div>").appendTo(win);
|
|
for(var _23b in _23a){
|
|
$("<a></a>").attr("href","javascript:void(0)").text(_23b).css("margin-left",10).bind("click",eval(_23a[_23b])).appendTo(tb).linkbutton();
|
|
}
|
|
}
|
|
win.window({title:_238,noheader:(_238?false:true),width:300,height:"auto",modal:true,collapsible:false,minimizable:false,maximizable:false,resizable:false,onClose:function(){
|
|
setTimeout(function(){
|
|
win.window("destroy");
|
|
},100);
|
|
}});
|
|
win.window("window").addClass("messager-window");
|
|
win.children("div.messager-button").children("a:first").focus();
|
|
return win;
|
|
};
|
|
$.messager={show:function(_23c){
|
|
return _235(_23c);
|
|
},alert:function(_23d,msg,icon,fn){
|
|
var _23e="<div>"+msg+"</div>";
|
|
switch(icon){
|
|
case "error":
|
|
_23e="<div class=\"messager-icon messager-error\"></div>"+_23e;
|
|
break;
|
|
case "info":
|
|
_23e="<div class=\"messager-icon messager-info\"></div>"+_23e;
|
|
break;
|
|
case "question":
|
|
_23e="<div class=\"messager-icon messager-question\"></div>"+_23e;
|
|
break;
|
|
case "warning":
|
|
_23e="<div class=\"messager-icon messager-warning\"></div>"+_23e;
|
|
break;
|
|
}
|
|
_23e+="<div style=\"clear:both;\"/>";
|
|
var _23f={};
|
|
_23f[$.messager.defaults.ok]=function(){
|
|
win.window("close");
|
|
if(fn){
|
|
fn();
|
|
return false;
|
|
}
|
|
};
|
|
var win=_237(_23d,_23e,_23f);
|
|
return win;
|
|
},confirm:function(_240,msg,fn){
|
|
var _241="<div class=\"messager-icon messager-question\"></div>"+"<div>"+msg+"</div>"+"<div style=\"clear:both;\"/>";
|
|
var _242={};
|
|
_242[$.messager.defaults.ok]=function(){
|
|
win.window("close");
|
|
if(fn){
|
|
fn(true);
|
|
return false;
|
|
}
|
|
};
|
|
_242[$.messager.defaults.cancel]=function(){
|
|
win.window("close");
|
|
if(fn){
|
|
fn(false);
|
|
return false;
|
|
}
|
|
};
|
|
var win=_237(_240,_241,_242);
|
|
return win;
|
|
},prompt:function(_243,msg,fn){
|
|
var _244="<div class=\"messager-icon messager-question\"></div>"+"<div>"+msg+"</div>"+"<br/>"+"<div style=\"clear:both;\"/>"+"<div><input class=\"messager-input\" type=\"text\"/></div>";
|
|
var _245={};
|
|
_245[$.messager.defaults.ok]=function(){
|
|
win.window("close");
|
|
if(fn){
|
|
fn($(".messager-input",win).val());
|
|
return false;
|
|
}
|
|
};
|
|
_245[$.messager.defaults.cancel]=function(){
|
|
win.window("close");
|
|
if(fn){
|
|
fn();
|
|
return false;
|
|
}
|
|
};
|
|
var win=_237(_243,_244,_245);
|
|
win.children("input.messager-input").focus();
|
|
return win;
|
|
},progress:function(_246){
|
|
var _247={bar:function(){
|
|
return $("body>div.messager-window").find("div.messager-p-bar");
|
|
},close:function(){
|
|
var win=$("body>div.messager-window>div.messager-body:has(div.messager-progress)");
|
|
if(win.length){
|
|
win.window("close");
|
|
}
|
|
}};
|
|
if(typeof _246=="string"){
|
|
var _248=_247[_246];
|
|
return _248();
|
|
}
|
|
var opts=$.extend({title:"",msg:"",text:undefined,interval:300},_246||{});
|
|
var _249="<div class=\"messager-progress\"><div class=\"messager-p-msg\"></div><div class=\"messager-p-bar\"></div></div>";
|
|
var win=_237(opts.title,_249,null);
|
|
win.find("div.messager-p-msg").html(opts.msg);
|
|
var bar=win.find("div.messager-p-bar");
|
|
bar.progressbar({text:opts.text});
|
|
win.window({closable:false,onClose:function(){
|
|
if(this.timer){
|
|
clearInterval(this.timer);
|
|
}
|
|
$(this).window("destroy");
|
|
}});
|
|
if(opts.interval){
|
|
win[0].timer=setInterval(function(){
|
|
var v=bar.progressbar("getValue");
|
|
v+=10;
|
|
if(v>100){
|
|
v=0;
|
|
}
|
|
bar.progressbar("setValue",v);
|
|
},opts.interval);
|
|
}
|
|
return win;
|
|
}};
|
|
$.messager.defaults={ok:"Ok",cancel:"Cancel"};
|
|
})(jQuery);
|
|
(function($){
|
|
function _24a(_24b){
|
|
var opts=$.data(_24b,"accordion").options;
|
|
var _24c=$.data(_24b,"accordion").panels;
|
|
var cc=$(_24b);
|
|
opts.fit?$.extend(opts,cc._fit()):cc._fit(false);
|
|
if(opts.width>0){
|
|
cc._outerWidth(opts.width);
|
|
}
|
|
var _24d="auto";
|
|
if(opts.height>0){
|
|
cc._outerHeight(opts.height);
|
|
var _24e=_24c.length?_24c[0].panel("header").css("height","")._outerHeight():"auto";
|
|
var _24d=cc.height()-(_24c.length-1)*_24e;
|
|
}
|
|
for(var i=0;i<_24c.length;i++){
|
|
var _24f=_24c[i];
|
|
var _250=_24f.panel("header");
|
|
_250._outerHeight(_24e);
|
|
_24f.panel("resize",{width:cc.width(),height:_24d});
|
|
}
|
|
};
|
|
function _251(_252){
|
|
var _253=$.data(_252,"accordion").panels;
|
|
for(var i=0;i<_253.length;i++){
|
|
var _254=_253[i];
|
|
if(_254.panel("options").collapsed==false){
|
|
return _254;
|
|
}
|
|
}
|
|
return null;
|
|
};
|
|
function _255(_256,_257){
|
|
var _258=$.data(_256,"accordion").panels;
|
|
for(var i=0;i<_258.length;i++){
|
|
if(_258[i][0]==$(_257)[0]){
|
|
return i;
|
|
}
|
|
}
|
|
return -1;
|
|
};
|
|
function _259(_25a,_25b,_25c){
|
|
var _25d=$.data(_25a,"accordion").panels;
|
|
if(typeof _25b=="number"){
|
|
if(_25b<0||_25b>=_25d.length){
|
|
return null;
|
|
}else{
|
|
var _25e=_25d[_25b];
|
|
if(_25c){
|
|
_25d.splice(_25b,1);
|
|
}
|
|
return _25e;
|
|
}
|
|
}
|
|
for(var i=0;i<_25d.length;i++){
|
|
var _25e=_25d[i];
|
|
if(_25e.panel("options").title==_25b){
|
|
if(_25c){
|
|
_25d.splice(i,1);
|
|
}
|
|
return _25e;
|
|
}
|
|
}
|
|
return null;
|
|
};
|
|
function _25f(_260){
|
|
var opts=$.data(_260,"accordion").options;
|
|
var cc=$(_260);
|
|
if(opts.border){
|
|
cc.removeClass("accordion-noborder");
|
|
}else{
|
|
cc.addClass("accordion-noborder");
|
|
}
|
|
};
|
|
function _261(_262){
|
|
var cc=$(_262);
|
|
cc.addClass("accordion");
|
|
var _263=[];
|
|
cc.children("div").each(function(){
|
|
var opts=$.extend({},$.parser.parseOptions(this),{selected:($(this).attr("selected")?true:undefined)});
|
|
var pp=$(this);
|
|
_263.push(pp);
|
|
_265(_262,pp,opts);
|
|
});
|
|
cc.bind("_resize",function(e,_264){
|
|
var opts=$.data(_262,"accordion").options;
|
|
if(opts.fit==true||_264){
|
|
_24a(_262);
|
|
}
|
|
return false;
|
|
});
|
|
return {accordion:cc,panels:_263};
|
|
};
|
|
function _265(_266,pp,_267){
|
|
pp.panel($.extend({},_267,{collapsible:false,minimizable:false,maximizable:false,closable:false,doSize:false,collapsed:true,headerCls:"accordion-header",bodyCls:"accordion-body",onBeforeExpand:function(){
|
|
var curr=_251(_266);
|
|
if(curr){
|
|
var _268=$(curr).panel("header");
|
|
_268.removeClass("accordion-header-selected");
|
|
_268.find(".accordion-collapse").triggerHandler("click");
|
|
}
|
|
var _268=pp.panel("header");
|
|
_268.addClass("accordion-header-selected");
|
|
_268.find(".accordion-collapse").removeClass("accordion-expand");
|
|
},onExpand:function(){
|
|
var opts=$.data(_266,"accordion").options;
|
|
opts.onSelect.call(_266,pp.panel("options").title,_255(_266,this));
|
|
},onBeforeCollapse:function(){
|
|
var _269=pp.panel("header");
|
|
_269.removeClass("accordion-header-selected");
|
|
_269.find(".accordion-collapse").addClass("accordion-expand");
|
|
}}));
|
|
var _26a=pp.panel("header");
|
|
var t=$("<a class=\"accordion-collapse accordion-expand\" href=\"javascript:void(0)\"></a>").appendTo(_26a.children("div.panel-tool"));
|
|
t.bind("click",function(e){
|
|
var _26b=$.data(_266,"accordion").options.animate;
|
|
_276(_266);
|
|
if(pp.panel("options").collapsed){
|
|
pp.panel("expand",_26b);
|
|
}else{
|
|
pp.panel("collapse",_26b);
|
|
}
|
|
return false;
|
|
});
|
|
_26a.click(function(){
|
|
$(this).find(".accordion-collapse").triggerHandler("click");
|
|
return false;
|
|
});
|
|
};
|
|
function _26c(_26d,_26e){
|
|
var _26f=_259(_26d,_26e);
|
|
if(!_26f){
|
|
return;
|
|
}
|
|
var curr=_251(_26d);
|
|
if(curr&&curr[0]==_26f[0]){
|
|
return;
|
|
}
|
|
_26f.panel("header").triggerHandler("click");
|
|
};
|
|
function _270(_271){
|
|
var _272=$.data(_271,"accordion").panels;
|
|
for(var i=0;i<_272.length;i++){
|
|
if(_272[i].panel("options").selected){
|
|
_273(i);
|
|
return;
|
|
}
|
|
}
|
|
if(_272.length){
|
|
_273(0);
|
|
}
|
|
function _273(_274){
|
|
var opts=$.data(_271,"accordion").options;
|
|
var _275=opts.animate;
|
|
opts.animate=false;
|
|
_26c(_271,_274);
|
|
opts.animate=_275;
|
|
};
|
|
};
|
|
function _276(_277){
|
|
var _278=$.data(_277,"accordion").panels;
|
|
for(var i=0;i<_278.length;i++){
|
|
_278[i].stop(true,true);
|
|
}
|
|
};
|
|
function add(_279,_27a){
|
|
var opts=$.data(_279,"accordion").options;
|
|
var _27b=$.data(_279,"accordion").panels;
|
|
if(_27a.selected==undefined){
|
|
_27a.selected=true;
|
|
}
|
|
_276(_279);
|
|
var pp=$("<div></div>").appendTo(_279);
|
|
_27b.push(pp);
|
|
_265(_279,pp,_27a);
|
|
_24a(_279);
|
|
opts.onAdd.call(_279,_27a.title,_27b.length-1);
|
|
if(_27a.selected){
|
|
_26c(_279,_27b.length-1);
|
|
}
|
|
};
|
|
function _27c(_27d,_27e){
|
|
var opts=$.data(_27d,"accordion").options;
|
|
var _27f=$.data(_27d,"accordion").panels;
|
|
_276(_27d);
|
|
var _280=_259(_27d,_27e);
|
|
var _281=_280.panel("options").title;
|
|
var _282=_255(_27d,_280);
|
|
if(opts.onBeforeRemove.call(_27d,_281,_282)==false){
|
|
return;
|
|
}
|
|
var _280=_259(_27d,_27e,true);
|
|
if(_280){
|
|
_280.panel("destroy");
|
|
if(_27f.length){
|
|
_24a(_27d);
|
|
var curr=_251(_27d);
|
|
if(!curr){
|
|
_26c(_27d,0);
|
|
}
|
|
}
|
|
}
|
|
opts.onRemove.call(_27d,_281,_282);
|
|
};
|
|
$.fn.accordion=function(_283,_284){
|
|
if(typeof _283=="string"){
|
|
return $.fn.accordion.methods[_283](this,_284);
|
|
}
|
|
_283=_283||{};
|
|
return this.each(function(){
|
|
var _285=$.data(this,"accordion");
|
|
var opts;
|
|
if(_285){
|
|
opts=$.extend(_285.options,_283);
|
|
_285.opts=opts;
|
|
}else{
|
|
opts=$.extend({},$.fn.accordion.defaults,$.fn.accordion.parseOptions(this),_283);
|
|
var r=_261(this);
|
|
$.data(this,"accordion",{options:opts,accordion:r.accordion,panels:r.panels});
|
|
}
|
|
_25f(this);
|
|
_24a(this);
|
|
_270(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){
|
|
return jq.each(function(){
|
|
_24a(this);
|
|
});
|
|
},getSelected:function(jq){
|
|
return _251(jq[0]);
|
|
},getPanel:function(jq,_286){
|
|
return _259(jq[0],_286);
|
|
},getPanelIndex:function(jq,_287){
|
|
return _255(jq[0],_287);
|
|
},select:function(jq,_288){
|
|
return jq.each(function(){
|
|
_26c(this,_288);
|
|
});
|
|
},add:function(jq,_289){
|
|
return jq.each(function(){
|
|
add(this,_289);
|
|
});
|
|
},remove:function(jq,_28a){
|
|
return jq.each(function(){
|
|
_27c(this,_28a);
|
|
});
|
|
}};
|
|
$.fn.accordion.parseOptions=function(_28b){
|
|
var t=$(_28b);
|
|
return $.extend({},$.parser.parseOptions(_28b,["width","height",{fit:"boolean",border:"boolean",animate:"boolean"}]));
|
|
};
|
|
$.fn.accordion.defaults={width:"auto",height:"auto",fit:false,border:true,animate:true,onSelect:function(_28c,_28d){
|
|
},onAdd:function(_28e,_28f){
|
|
},onBeforeRemove:function(_290,_291){
|
|
},onRemove:function(_292,_293){
|
|
}};
|
|
})(jQuery);
|
|
(function($){
|
|
function _294(_295){
|
|
var opts=$.data(_295,"tabs").options;
|
|
if(opts.tabPosition=="left"||opts.tabPosition=="right"){
|
|
return;
|
|
}
|
|
var _296=$(_295).children("div.tabs-header");
|
|
var tool=_296.children("div.tabs-tool");
|
|
var _297=_296.children("div.tabs-scroller-left");
|
|
var _298=_296.children("div.tabs-scroller-right");
|
|
var wrap=_296.children("div.tabs-wrap");
|
|
tool._outerHeight(_296.outerHeight()-(opts.plain?2:0));
|
|
var _299=0;
|
|
$("ul.tabs li",_296).each(function(){
|
|
_299+=$(this).outerWidth(true);
|
|
});
|
|
var _29a=_296.width()-tool._outerWidth();
|
|
if(_299>_29a){
|
|
_297.show();
|
|
_298.show();
|
|
if(opts.toolPosition=="left"){
|
|
tool.css({left:_297.outerWidth(),right:""});
|
|
wrap.css({marginLeft:_297.outerWidth()+tool._outerWidth(),marginRight:_298._outerWidth(),width:_29a-_297.outerWidth()-_298.outerWidth()});
|
|
}else{
|
|
tool.css({left:"",right:_298.outerWidth()});
|
|
wrap.css({marginLeft:_297.outerWidth(),marginRight:_298.outerWidth()+tool._outerWidth(),width:_29a-_297.outerWidth()-_298.outerWidth()});
|
|
}
|
|
}else{
|
|
_297.hide();
|
|
_298.hide();
|
|
if(opts.toolPosition=="left"){
|
|
tool.css({left:0,right:""});
|
|
wrap.css({marginLeft:tool._outerWidth(),marginRight:0,width:_29a});
|
|
}else{
|
|
tool.css({left:"",right:0});
|
|
wrap.css({marginLeft:0,marginRight:tool._outerWidth(),width:_29a});
|
|
}
|
|
}
|
|
};
|
|
function _29b(_29c){
|
|
var opts=$.data(_29c,"tabs").options;
|
|
var _29d=$(_29c).children("div.tabs-header");
|
|
if(opts.tools){
|
|
if(typeof opts.tools=="string"){
|
|
$(opts.tools).addClass("tabs-tool").appendTo(_29d);
|
|
$(opts.tools).show();
|
|
}else{
|
|
_29d.children("div.tabs-tool").remove();
|
|
var _29e=$("<div class=\"tabs-tool\"></div>").appendTo(_29d);
|
|
for(var i=0;i<opts.tools.length;i++){
|
|
var tool=$("<a href=\"javascript:void(0);\"></a>").appendTo(_29e);
|
|
tool[0].onclick=eval(opts.tools[i].handler||function(){
|
|
});
|
|
tool.linkbutton($.extend({},opts.tools[i],{plain:true}));
|
|
}
|
|
}
|
|
}else{
|
|
_29d.children("div.tabs-tool").remove();
|
|
}
|
|
};
|
|
function _29f(_2a0){
|
|
var opts=$.data(_2a0,"tabs").options;
|
|
var cc=$(_2a0);
|
|
opts.fit?$.extend(opts,cc._fit()):cc._fit(false);
|
|
cc.width(opts.width).height(opts.height);
|
|
var _2a1=$(_2a0).children("div.tabs-header");
|
|
var _2a2=$(_2a0).children("div.tabs-panels");
|
|
if(opts.tabPosition=="left"||opts.tabPosition=="right"){
|
|
_2a1._outerWidth(opts.headerWidth);
|
|
_2a2._outerWidth(cc.width()-opts.headerWidth);
|
|
_2a1.add(_2a2)._outerHeight(opts.height);
|
|
var wrap=_2a1.find("div.tabs-wrap");
|
|
wrap._outerWidth(_2a1.width());
|
|
_2a1.find(".tabs")._outerWidth(wrap.width());
|
|
}else{
|
|
_2a1.css("height","");
|
|
_2a1.find("div.tabs-wrap").css("width","");
|
|
_2a1.find(".tabs").css("width","");
|
|
_2a1._outerWidth(opts.width);
|
|
_294(_2a0);
|
|
var _2a3=opts.height;
|
|
if(!isNaN(_2a3)){
|
|
_2a2._outerHeight(_2a3-_2a1.outerHeight());
|
|
}else{
|
|
_2a2.height("auto");
|
|
}
|
|
var _2a4=opts.width;
|
|
if(!isNaN(_2a4)){
|
|
_2a2._outerWidth(_2a4);
|
|
}else{
|
|
_2a2.width("auto");
|
|
}
|
|
}
|
|
};
|
|
function _2a5(_2a6){
|
|
var opts=$.data(_2a6,"tabs").options;
|
|
var tab=_2a7(_2a6);
|
|
if(tab){
|
|
var _2a8=$(_2a6).children("div.tabs-panels");
|
|
var _2a9=opts.width=="auto"?"auto":_2a8.width();
|
|
var _2aa=opts.height=="auto"?"auto":_2a8.height();
|
|
tab.panel("resize",{width:_2a9,height:_2aa});
|
|
}
|
|
};
|
|
function _2ab(_2ac){
|
|
var tabs=$.data(_2ac,"tabs").tabs;
|
|
var cc=$(_2ac);
|
|
cc.addClass("tabs-container");
|
|
cc.wrapInner("<div class=\"tabs-panels\"/>");
|
|
$("<div class=\"tabs-header\">"+"<div class=\"tabs-scroller-left\"></div>"+"<div class=\"tabs-scroller-right\"></div>"+"<div class=\"tabs-wrap\">"+"<ul class=\"tabs\"></ul>"+"</div>"+"</div>").prependTo(_2ac);
|
|
cc.children("div.tabs-panels").children("div").each(function(i){
|
|
var opts=$.extend({},$.parser.parseOptions(this),{selected:($(this).attr("selected")?true:undefined)});
|
|
var pp=$(this);
|
|
tabs.push(pp);
|
|
_2b2(_2ac,pp,opts);
|
|
});
|
|
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,_2ad){
|
|
var opts=$.data(_2ac,"tabs").options;
|
|
if(opts.fit==true||_2ad){
|
|
_29f(_2ac);
|
|
_2a5(_2ac);
|
|
}
|
|
return false;
|
|
});
|
|
};
|
|
function _2ae(_2af){
|
|
var opts=$.data(_2af,"tabs").options;
|
|
var _2b0=$(_2af).children("div.tabs-header");
|
|
var _2b1=$(_2af).children("div.tabs-panels");
|
|
_2b0.removeClass("tabs-header-top tabs-header-bottom tabs-header-left tabs-header-right");
|
|
_2b1.removeClass("tabs-panels-top tabs-panels-bottom tabs-panels-left tabs-panels-right");
|
|
if(opts.tabPosition=="top"){
|
|
_2b0.insertBefore(_2b1);
|
|
}else{
|
|
if(opts.tabPosition=="bottom"){
|
|
_2b0.insertAfter(_2b1);
|
|
_2b0.addClass("tabs-header-bottom");
|
|
_2b1.addClass("tabs-panels-top");
|
|
}else{
|
|
if(opts.tabPosition=="left"){
|
|
_2b0.addClass("tabs-header-left");
|
|
_2b1.addClass("tabs-panels-right");
|
|
}else{
|
|
if(opts.tabPosition=="right"){
|
|
_2b0.addClass("tabs-header-right");
|
|
_2b1.addClass("tabs-panels-left");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if(opts.plain==true){
|
|
_2b0.addClass("tabs-header-plain");
|
|
}else{
|
|
_2b0.removeClass("tabs-header-plain");
|
|
}
|
|
if(opts.border==true){
|
|
_2b0.removeClass("tabs-header-noborder");
|
|
_2b1.removeClass("tabs-panels-noborder");
|
|
}else{
|
|
_2b0.addClass("tabs-header-noborder");
|
|
_2b1.addClass("tabs-panels-noborder");
|
|
}
|
|
$(".tabs-scroller-left",_2b0).unbind(".tabs").bind("click.tabs",function(){
|
|
$(_2af).tabs("scrollBy",-opts.scrollIncrement);
|
|
});
|
|
$(".tabs-scroller-right",_2b0).unbind(".tabs").bind("click.tabs",function(){
|
|
$(_2af).tabs("scrollBy",opts.scrollIncrement);
|
|
});
|
|
};
|
|
function _2b2(_2b3,pp,_2b4){
|
|
var _2b5=$.data(_2b3,"tabs");
|
|
_2b4=_2b4||{};
|
|
pp.panel($.extend({},_2b4,{border:false,noheader:true,closed:true,doSize:false,iconCls:(_2b4.icon?_2b4.icon:undefined),onLoad:function(){
|
|
if(_2b4.onLoad){
|
|
_2b4.onLoad.call(this,arguments);
|
|
}
|
|
_2b5.options.onLoad.call(_2b3,$(this));
|
|
}}));
|
|
var opts=pp.panel("options");
|
|
var tabs=$(_2b3).children("div.tabs-header").find("ul.tabs");
|
|
opts.tab=$("<li></li>").appendTo(tabs);
|
|
opts.tab.append("<a href=\"javascript:void(0)\" class=\"tabs-inner\">"+"<span class=\"tabs-title\"></span>"+"<span class=\"tabs-icon\"></span>"+"</a>");
|
|
opts.tab.unbind(".tabs").bind("click.tabs",{p:pp},function(e){
|
|
if($(this).hasClass("tabs-disabled")){
|
|
return;
|
|
}
|
|
_2ba(_2b3,_2b6(_2b3,e.data.p));
|
|
}).bind("contextmenu.tabs",{p:pp},function(e){
|
|
if($(this).hasClass("tabs-disabled")){
|
|
return;
|
|
}
|
|
_2b5.options.onContextMenu.call(_2b3,e,$(this).find("span.tabs-title").html(),_2b6(_2b3,e.data.p));
|
|
});
|
|
$(_2b3).tabs("update",{tab:pp,options:opts});
|
|
};
|
|
function _2b7(_2b8,_2b9){
|
|
var opts=$.data(_2b8,"tabs").options;
|
|
var tabs=$.data(_2b8,"tabs").tabs;
|
|
if(_2b9.selected==undefined){
|
|
_2b9.selected=true;
|
|
}
|
|
var pp=$("<div></div>").appendTo($(_2b8).children("div.tabs-panels"));
|
|
tabs.push(pp);
|
|
_2b2(_2b8,pp,_2b9);
|
|
opts.onAdd.call(_2b8,_2b9.title,tabs.length-1);
|
|
_294(_2b8);
|
|
if(_2b9.selected){
|
|
_2ba(_2b8,tabs.length-1);
|
|
}
|
|
};
|
|
function _2bb(_2bc,_2bd){
|
|
var _2be=$.data(_2bc,"tabs").selectHis;
|
|
var pp=_2bd.tab;
|
|
var _2bf=pp.panel("options").title;
|
|
pp.panel($.extend({},_2bd.options,{iconCls:(_2bd.options.icon?_2bd.options.icon:undefined)}));
|
|
var opts=pp.panel("options");
|
|
var tab=opts.tab;
|
|
var _2c0=tab.find("span.tabs-title");
|
|
var _2c1=tab.find("span.tabs-icon");
|
|
_2c0.html(opts.title);
|
|
_2c1.attr("class","tabs-icon");
|
|
tab.find("a.tabs-close").remove();
|
|
if(opts.closable){
|
|
_2c0.addClass("tabs-closable");
|
|
var _2c2=$("<a href=\"javascript:void(0)\" class=\"tabs-close\"></a>").appendTo(tab);
|
|
_2c2.bind("click.tabs",{p:pp},function(e){
|
|
if($(this).parent().hasClass("tabs-disabled")){
|
|
return;
|
|
}
|
|
_2c4(_2bc,_2b6(_2bc,e.data.p));
|
|
return false;
|
|
});
|
|
}else{
|
|
_2c0.removeClass("tabs-closable");
|
|
}
|
|
if(opts.iconCls){
|
|
_2c0.addClass("tabs-with-icon");
|
|
_2c1.addClass(opts.iconCls);
|
|
}else{
|
|
_2c0.removeClass("tabs-with-icon");
|
|
}
|
|
if(_2bf!=opts.title){
|
|
for(var i=0;i<_2be.length;i++){
|
|
if(_2be[i]==_2bf){
|
|
_2be[i]=opts.title;
|
|
}
|
|
}
|
|
}
|
|
tab.find("span.tabs-p-tool").remove();
|
|
if(opts.tools){
|
|
var _2c3=$("<span class=\"tabs-p-tool\"></span>").insertAfter(tab.find("a.tabs-inner"));
|
|
if(typeof opts.tools=="string"){
|
|
$(opts.tools).children().appendTo(_2c3);
|
|
}else{
|
|
for(var i=0;i<opts.tools.length;i++){
|
|
var t=$("<a href=\"javascript:void(0)\"></a>").appendTo(_2c3);
|
|
t.addClass(opts.tools[i].iconCls);
|
|
if(opts.tools[i].handler){
|
|
t.bind("click",{handler:opts.tools[i].handler},function(e){
|
|
if($(this).parents("li").hasClass("tabs-disabled")){
|
|
return;
|
|
}
|
|
e.data.handler.call(this);
|
|
});
|
|
}
|
|
}
|
|
}
|
|
var pr=_2c3.children().length*12;
|
|
if(opts.closable){
|
|
pr+=8;
|
|
}else{
|
|
pr-=3;
|
|
_2c3.css("right","5px");
|
|
}
|
|
_2c0.css("padding-right",pr+"px");
|
|
}
|
|
_294(_2bc);
|
|
$.data(_2bc,"tabs").options.onUpdate.call(_2bc,opts.title,_2b6(_2bc,pp));
|
|
};
|
|
function _2c4(_2c5,_2c6){
|
|
var opts=$.data(_2c5,"tabs").options;
|
|
var tabs=$.data(_2c5,"tabs").tabs;
|
|
var _2c7=$.data(_2c5,"tabs").selectHis;
|
|
if(!_2c8(_2c5,_2c6)){
|
|
return;
|
|
}
|
|
var tab=_2c9(_2c5,_2c6);
|
|
var _2ca=tab.panel("options").title;
|
|
var _2cb=_2b6(_2c5,tab);
|
|
if(opts.onBeforeClose.call(_2c5,_2ca,_2cb)==false){
|
|
return;
|
|
}
|
|
var tab=_2c9(_2c5,_2c6,true);
|
|
tab.panel("options").tab.remove();
|
|
tab.panel("destroy");
|
|
opts.onClose.call(_2c5,_2ca,_2cb);
|
|
_294(_2c5);
|
|
for(var i=0;i<_2c7.length;i++){
|
|
if(_2c7[i]==_2ca){
|
|
_2c7.splice(i,1);
|
|
i--;
|
|
}
|
|
}
|
|
var _2cc=_2c7.pop();
|
|
if(_2cc){
|
|
_2ba(_2c5,_2cc);
|
|
}else{
|
|
if(tabs.length){
|
|
_2ba(_2c5,0);
|
|
}
|
|
}
|
|
};
|
|
function _2c9(_2cd,_2ce,_2cf){
|
|
var tabs=$.data(_2cd,"tabs").tabs;
|
|
if(typeof _2ce=="number"){
|
|
if(_2ce<0||_2ce>=tabs.length){
|
|
return null;
|
|
}else{
|
|
var tab=tabs[_2ce];
|
|
if(_2cf){
|
|
tabs.splice(_2ce,1);
|
|
}
|
|
return tab;
|
|
}
|
|
}
|
|
for(var i=0;i<tabs.length;i++){
|
|
var tab=tabs[i];
|
|
if(tab.panel("options").title==_2ce){
|
|
if(_2cf){
|
|
tabs.splice(i,1);
|
|
}
|
|
return tab;
|
|
}
|
|
}
|
|
return null;
|
|
};
|
|
function _2b6(_2d0,tab){
|
|
var tabs=$.data(_2d0,"tabs").tabs;
|
|
for(var i=0;i<tabs.length;i++){
|
|
if(tabs[i][0]==$(tab)[0]){
|
|
return i;
|
|
}
|
|
}
|
|
return -1;
|
|
};
|
|
function _2a7(_2d1){
|
|
var tabs=$.data(_2d1,"tabs").tabs;
|
|
for(var i=0;i<tabs.length;i++){
|
|
var tab=tabs[i];
|
|
if(tab.panel("options").closed==false){
|
|
return tab;
|
|
}
|
|
}
|
|
return null;
|
|
};
|
|
function _2d2(_2d3){
|
|
var tabs=$.data(_2d3,"tabs").tabs;
|
|
for(var i=0;i<tabs.length;i++){
|
|
if(tabs[i].panel("options").selected){
|
|
_2ba(_2d3,i);
|
|
return;
|
|
}
|
|
}
|
|
if(tabs.length){
|
|
_2ba(_2d3,0);
|
|
}
|
|
};
|
|
function _2ba(_2d4,_2d5){
|
|
var opts=$.data(_2d4,"tabs").options;
|
|
var tabs=$.data(_2d4,"tabs").tabs;
|
|
var _2d6=$.data(_2d4,"tabs").selectHis;
|
|
if(tabs.length==0){
|
|
return;
|
|
}
|
|
var _2d7=_2c9(_2d4,_2d5);
|
|
if(!_2d7){
|
|
return;
|
|
}
|
|
var _2d8=_2a7(_2d4);
|
|
if(_2d8){
|
|
_2d8.panel("close");
|
|
_2d8.panel("options").tab.removeClass("tabs-selected");
|
|
}
|
|
_2d7.panel("open");
|
|
var _2d9=_2d7.panel("options").title;
|
|
_2d6.push(_2d9);
|
|
var tab=_2d7.panel("options").tab;
|
|
tab.addClass("tabs-selected");
|
|
var wrap=$(_2d4).find(">div.tabs-header>div.tabs-wrap");
|
|
var left=tab.position().left;
|
|
var _2da=left+tab.outerWidth();
|
|
if(left<0||_2da>wrap.width()){
|
|
var _2db=left-(wrap.width()-tab.width())/2;
|
|
$(_2d4).tabs("scrollBy",_2db);
|
|
}else{
|
|
$(_2d4).tabs("scrollBy",0);
|
|
}
|
|
_2a5(_2d4);
|
|
opts.onSelect.call(_2d4,_2d9,_2b6(_2d4,_2d7));
|
|
};
|
|
function _2c8(_2dc,_2dd){
|
|
return _2c9(_2dc,_2dd)!=null;
|
|
};
|
|
$.fn.tabs=function(_2de,_2df){
|
|
if(typeof _2de=="string"){
|
|
return $.fn.tabs.methods[_2de](this,_2df);
|
|
}
|
|
_2de=_2de||{};
|
|
return this.each(function(){
|
|
var _2e0=$.data(this,"tabs");
|
|
var opts;
|
|
if(_2e0){
|
|
opts=$.extend(_2e0.options,_2de);
|
|
_2e0.options=opts;
|
|
}else{
|
|
$.data(this,"tabs",{options:$.extend({},$.fn.tabs.defaults,$.fn.tabs.parseOptions(this),_2de),tabs:[],selectHis:[]});
|
|
_2ab(this);
|
|
}
|
|
_29b(this);
|
|
_2ae(this);
|
|
_29f(this);
|
|
_2d2(this);
|
|
});
|
|
};
|
|
$.fn.tabs.methods={options:function(jq){
|
|
return $.data(jq[0],"tabs").options;
|
|
},tabs:function(jq){
|
|
return $.data(jq[0],"tabs").tabs;
|
|
},resize:function(jq){
|
|
return jq.each(function(){
|
|
_29f(this);
|
|
_2a5(this);
|
|
});
|
|
},add:function(jq,_2e1){
|
|
return jq.each(function(){
|
|
_2b7(this,_2e1);
|
|
});
|
|
},close:function(jq,_2e2){
|
|
return jq.each(function(){
|
|
_2c4(this,_2e2);
|
|
});
|
|
},getTab:function(jq,_2e3){
|
|
return _2c9(jq[0],_2e3);
|
|
},getTabIndex:function(jq,tab){
|
|
return _2b6(jq[0],tab);
|
|
},getSelected:function(jq){
|
|
return _2a7(jq[0]);
|
|
},select:function(jq,_2e4){
|
|
return jq.each(function(){
|
|
_2ba(this,_2e4);
|
|
});
|
|
},exists:function(jq,_2e5){
|
|
return _2c8(jq[0],_2e5);
|
|
},update:function(jq,_2e6){
|
|
return jq.each(function(){
|
|
_2bb(this,_2e6);
|
|
});
|
|
},enableTab:function(jq,_2e7){
|
|
return jq.each(function(){
|
|
$(this).tabs("getTab",_2e7).panel("options").tab.removeClass("tabs-disabled");
|
|
});
|
|
},disableTab:function(jq,_2e8){
|
|
return jq.each(function(){
|
|
$(this).tabs("getTab",_2e8).panel("options").tab.addClass("tabs-disabled");
|
|
});
|
|
},scrollBy:function(jq,_2e9){
|
|
return jq.each(function(){
|
|
var opts=$(this).tabs("options");
|
|
var wrap=$(this).find(">div.tabs-header>div.tabs-wrap");
|
|
var pos=Math.min(wrap._scrollLeft()+_2e9,_2ea());
|
|
wrap.animate({scrollLeft:pos},opts.scrollDuration);
|
|
function _2ea(){
|
|
var w=0;
|
|
var ul=wrap.children("ul");
|
|
ul.children("li").each(function(){
|
|
w+=$(this).outerWidth(true);
|
|
});
|
|
return w-wrap.width()+(ul.outerWidth()-ul.width());
|
|
};
|
|
});
|
|
}};
|
|
$.fn.tabs.parseOptions=function(_2eb){
|
|
return $.extend({},$.parser.parseOptions(_2eb,["width","height","tools","toolPosition","tabPosition",{fit:"boolean",border:"boolean",plain:"boolean",headerWidth:"number"}]));
|
|
};
|
|
$.fn.tabs.defaults={width:"auto",height:"auto",headerWidth:150,plain:false,fit:false,border:true,tools:null,toolPosition:"right",tabPosition:"top",scrollIncrement:100,scrollDuration:400,onLoad:function(_2ec){
|
|
},onSelect:function(_2ed,_2ee){
|
|
},onBeforeClose:function(_2ef,_2f0){
|
|
},onClose:function(_2f1,_2f2){
|
|
},onAdd:function(_2f3,_2f4){
|
|
},onUpdate:function(_2f5,_2f6){
|
|
},onContextMenu:function(e,_2f7,_2f8){
|
|
}};
|
|
})(jQuery);
|
|
(function($){
|
|
var _2f9=false;
|
|
function _2fa(_2fb){
|
|
var opts=$.data(_2fb,"layout").options;
|
|
var _2fc=$.data(_2fb,"layout").panels;
|
|
var cc=$(_2fb);
|
|
opts.fit?cc.css(cc._fit()):cc._fit(false);
|
|
var cpos={top:0,left:0,width:cc.width(),height:cc.height()};
|
|
function _2fd(pp){
|
|
if(pp.length==0){
|
|
return;
|
|
}
|
|
pp.panel("resize",{width:cc.width(),height:pp.panel("options").height,left:0,top:0});
|
|
cpos.top+=pp.panel("options").height;
|
|
cpos.height-=pp.panel("options").height;
|
|
};
|
|
if(_301(_2fc.expandNorth)){
|
|
_2fd(_2fc.expandNorth);
|
|
}else{
|
|
_2fd(_2fc.north);
|
|
}
|
|
function _2fe(pp){
|
|
if(pp.length==0){
|
|
return;
|
|
}
|
|
pp.panel("resize",{width:cc.width(),height:pp.panel("options").height,left:0,top:cc.height()-pp.panel("options").height});
|
|
cpos.height-=pp.panel("options").height;
|
|
};
|
|
if(_301(_2fc.expandSouth)){
|
|
_2fe(_2fc.expandSouth);
|
|
}else{
|
|
_2fe(_2fc.south);
|
|
}
|
|
function _2ff(pp){
|
|
if(pp.length==0){
|
|
return;
|
|
}
|
|
pp.panel("resize",{width:pp.panel("options").width,height:cpos.height,left:cc.width()-pp.panel("options").width,top:cpos.top});
|
|
cpos.width-=pp.panel("options").width;
|
|
};
|
|
if(_301(_2fc.expandEast)){
|
|
_2ff(_2fc.expandEast);
|
|
}else{
|
|
_2ff(_2fc.east);
|
|
}
|
|
function _300(pp){
|
|
if(pp.length==0){
|
|
return;
|
|
}
|
|
pp.panel("resize",{width:pp.panel("options").width,height:cpos.height,left:0,top:cpos.top});
|
|
cpos.left+=pp.panel("options").width;
|
|
cpos.width-=pp.panel("options").width;
|
|
};
|
|
if(_301(_2fc.expandWest)){
|
|
_300(_2fc.expandWest);
|
|
}else{
|
|
_300(_2fc.west);
|
|
}
|
|
_2fc.center.panel("resize",cpos);
|
|
};
|
|
function init(_302){
|
|
var cc=$(_302);
|
|
if(cc[0].tagName=="BODY"){
|
|
$("html").addClass("panel-fit");
|
|
}
|
|
cc.addClass("layout");
|
|
function _303(cc){
|
|
cc.children("div").each(function(){
|
|
var opts=$.parser.parseOptions(this,["region"]);
|
|
var r=opts.region;
|
|
if(r=="north"||r=="south"||r=="east"||r=="west"||r=="center"){
|
|
_305(_302,{region:r},this);
|
|
}
|
|
});
|
|
};
|
|
cc.children("form").length?_303(cc.children("form")):_303(cc);
|
|
$("<div class=\"layout-split-proxy-h\"></div>").appendTo(cc);
|
|
$("<div class=\"layout-split-proxy-v\"></div>").appendTo(cc);
|
|
cc.bind("_resize",function(e,_304){
|
|
var opts=$.data(_302,"layout").options;
|
|
if(opts.fit==true||_304){
|
|
_2fa(_302);
|
|
}
|
|
return false;
|
|
});
|
|
};
|
|
function _305(_306,_307,el){
|
|
_307.region=_307.region||"center";
|
|
var _308=$.data(_306,"layout").panels;
|
|
var cc=$(_306);
|
|
var dir=_307.region;
|
|
if(_308[dir].length){
|
|
return;
|
|
}
|
|
var pp=$(el);
|
|
if(!pp.length){
|
|
pp=$("<div></div>").appendTo(cc);
|
|
}
|
|
pp.panel($.extend({},{width:(pp.length?parseInt(pp[0].style.width)||pp.outerWidth():"auto"),height:(pp.length?parseInt(pp[0].style.height)||pp.outerHeight():"auto"),split:(pp.attr("split")?pp.attr("split")=="true":undefined),doSize:false,cls:("layout-panel layout-panel-"+dir),bodyCls:"layout-body",onOpen:function(){
|
|
var _309={north:"up",south:"down",east:"right",west:"left"};
|
|
if(!_309[dir]){
|
|
return;
|
|
}
|
|
var _30a="layout-button-"+_309[dir];
|
|
var tool=$(this).panel("header").children("div.panel-tool");
|
|
if(!tool.children("a."+_30a).length){
|
|
var t=$("<a href=\"javascript:void(0)\"></a>").addClass(_30a).appendTo(tool);
|
|
t.bind("click",{dir:dir},function(e){
|
|
_316(_306,e.data.dir);
|
|
return false;
|
|
});
|
|
}
|
|
}},_307));
|
|
_308[dir]=pp;
|
|
if(pp.panel("options").split){
|
|
var _30b=pp.panel("panel");
|
|
_30b.addClass("layout-split-"+dir);
|
|
var _30c="";
|
|
if(dir=="north"){
|
|
_30c="s";
|
|
}
|
|
if(dir=="south"){
|
|
_30c="n";
|
|
}
|
|
if(dir=="east"){
|
|
_30c="w";
|
|
}
|
|
if(dir=="west"){
|
|
_30c="e";
|
|
}
|
|
_30b.resizable({handles:_30c,onStartResize:function(e){
|
|
_2f9=true;
|
|
if(dir=="north"||dir=="south"){
|
|
var _30d=$(">div.layout-split-proxy-v",_306);
|
|
}else{
|
|
var _30d=$(">div.layout-split-proxy-h",_306);
|
|
}
|
|
var top=0,left=0,_30e=0,_30f=0;
|
|
var pos={display:"block"};
|
|
if(dir=="north"){
|
|
pos.top=parseInt(_30b.css("top"))+_30b.outerHeight()-_30d.height();
|
|
pos.left=parseInt(_30b.css("left"));
|
|
pos.width=_30b.outerWidth();
|
|
pos.height=_30d.height();
|
|
}else{
|
|
if(dir=="south"){
|
|
pos.top=parseInt(_30b.css("top"));
|
|
pos.left=parseInt(_30b.css("left"));
|
|
pos.width=_30b.outerWidth();
|
|
pos.height=_30d.height();
|
|
}else{
|
|
if(dir=="east"){
|
|
pos.top=parseInt(_30b.css("top"))||0;
|
|
pos.left=parseInt(_30b.css("left"))||0;
|
|
pos.width=_30d.width();
|
|
pos.height=_30b.outerHeight();
|
|
}else{
|
|
if(dir=="west"){
|
|
pos.top=parseInt(_30b.css("top"))||0;
|
|
pos.left=_30b.outerWidth()-_30d.width();
|
|
pos.width=_30d.width();
|
|
pos.height=_30b.outerHeight();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
_30d.css(pos);
|
|
$("<div class=\"layout-mask\"></div>").css({left:0,top:0,width:cc.width(),height:cc.height()}).appendTo(cc);
|
|
},onResize:function(e){
|
|
if(dir=="north"||dir=="south"){
|
|
var _310=$(">div.layout-split-proxy-v",_306);
|
|
_310.css("top",e.pageY-$(_306).offset().top-_310.height()/2);
|
|
}else{
|
|
var _310=$(">div.layout-split-proxy-h",_306);
|
|
_310.css("left",e.pageX-$(_306).offset().left-_310.width()/2);
|
|
}
|
|
return false;
|
|
},onStopResize:function(){
|
|
$(">div.layout-split-proxy-v",_306).css("display","none");
|
|
$(">div.layout-split-proxy-h",_306).css("display","none");
|
|
var opts=pp.panel("options");
|
|
opts.width=_30b.outerWidth();
|
|
opts.height=_30b.outerHeight();
|
|
opts.left=_30b.css("left");
|
|
opts.top=_30b.css("top");
|
|
pp.panel("resize");
|
|
_2fa(_306);
|
|
_2f9=false;
|
|
cc.find(">div.layout-mask").remove();
|
|
}});
|
|
}
|
|
};
|
|
function _311(_312,_313){
|
|
var _314=$.data(_312,"layout").panels;
|
|
if(_314[_313].length){
|
|
_314[_313].panel("destroy");
|
|
_314[_313]=$();
|
|
var _315="expand"+_313.substring(0,1).toUpperCase()+_313.substring(1);
|
|
if(_314[_315]){
|
|
_314[_315].panel("destroy");
|
|
_314[_315]=undefined;
|
|
}
|
|
}
|
|
};
|
|
function _316(_317,_318,_319){
|
|
if(_319==undefined){
|
|
_319="normal";
|
|
}
|
|
var _31a=$.data(_317,"layout").panels;
|
|
var p=_31a[_318];
|
|
if(p.panel("options").onBeforeCollapse.call(p)==false){
|
|
return;
|
|
}
|
|
var _31b="expand"+_318.substring(0,1).toUpperCase()+_318.substring(1);
|
|
if(!_31a[_31b]){
|
|
_31a[_31b]=_31c(_318);
|
|
_31a[_31b].panel("panel").click(function(){
|
|
var _31d=_31e();
|
|
p.panel("expand",false).panel("open").panel("resize",_31d.collapse);
|
|
p.panel("panel").animate(_31d.expand);
|
|
return false;
|
|
});
|
|
}
|
|
var _31f=_31e();
|
|
if(!_301(_31a[_31b])){
|
|
_31a.center.panel("resize",_31f.resizeC);
|
|
}
|
|
p.panel("panel").animate(_31f.collapse,_319,function(){
|
|
p.panel("collapse",false).panel("close");
|
|
_31a[_31b].panel("open").panel("resize",_31f.expandP);
|
|
});
|
|
function _31c(dir){
|
|
var icon;
|
|
if(dir=="east"){
|
|
icon="layout-button-left";
|
|
}else{
|
|
if(dir=="west"){
|
|
icon="layout-button-right";
|
|
}else{
|
|
if(dir=="north"){
|
|
icon="layout-button-down";
|
|
}else{
|
|
if(dir=="south"){
|
|
icon="layout-button-up";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var p=$("<div></div>").appendTo(_317).panel({cls:"layout-expand",title:" ",closed:true,doSize:false,tools:[{iconCls:icon,handler:function(){
|
|
_320(_317,_318);
|
|
return false;
|
|
}}]});
|
|
p.panel("panel").hover(function(){
|
|
$(this).addClass("layout-expand-over");
|
|
},function(){
|
|
$(this).removeClass("layout-expand-over");
|
|
});
|
|
return p;
|
|
};
|
|
function _31e(){
|
|
var cc=$(_317);
|
|
if(_318=="east"){
|
|
return {resizeC:{width:_31a.center.panel("options").width+_31a["east"].panel("options").width-28},expand:{left:cc.width()-_31a["east"].panel("options").width},expandP:{top:_31a["east"].panel("options").top,left:cc.width()-28,width:28,height:_31a["center"].panel("options").height},collapse:{left:cc.width()}};
|
|
}else{
|
|
if(_318=="west"){
|
|
return {resizeC:{width:_31a.center.panel("options").width+_31a["west"].panel("options").width-28,left:28},expand:{left:0},expandP:{left:0,top:_31a["west"].panel("options").top,width:28,height:_31a["center"].panel("options").height},collapse:{left:-_31a["west"].panel("options").width}};
|
|
}else{
|
|
if(_318=="north"){
|
|
var hh=cc.height()-28;
|
|
if(_301(_31a.expandSouth)){
|
|
hh-=_31a.expandSouth.panel("options").height;
|
|
}else{
|
|
if(_301(_31a.south)){
|
|
hh-=_31a.south.panel("options").height;
|
|
}
|
|
}
|
|
_31a.east.panel("resize",{top:28,height:hh});
|
|
_31a.west.panel("resize",{top:28,height:hh});
|
|
if(_301(_31a.expandEast)){
|
|
_31a.expandEast.panel("resize",{top:28,height:hh});
|
|
}
|
|
if(_301(_31a.expandWest)){
|
|
_31a.expandWest.panel("resize",{top:28,height:hh});
|
|
}
|
|
return {resizeC:{top:28,height:hh},expand:{top:0},expandP:{top:0,left:0,width:cc.width(),height:28},collapse:{top:-_31a["north"].panel("options").height}};
|
|
}else{
|
|
if(_318=="south"){
|
|
var hh=cc.height()-28;
|
|
if(_301(_31a.expandNorth)){
|
|
hh-=_31a.expandNorth.panel("options").height;
|
|
}else{
|
|
if(_301(_31a.north)){
|
|
hh-=_31a.north.panel("options").height;
|
|
}
|
|
}
|
|
_31a.east.panel("resize",{height:hh});
|
|
_31a.west.panel("resize",{height:hh});
|
|
if(_301(_31a.expandEast)){
|
|
_31a.expandEast.panel("resize",{height:hh});
|
|
}
|
|
if(_301(_31a.expandWest)){
|
|
_31a.expandWest.panel("resize",{height:hh});
|
|
}
|
|
return {resizeC:{height:hh},expand:{top:cc.height()-_31a["south"].panel("options").height},expandP:{top:cc.height()-28,left:0,width:cc.width(),height:28},collapse:{top:cc.height()}};
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
function _320(_321,_322){
|
|
var _323=$.data(_321,"layout").panels;
|
|
var _324=_325();
|
|
var p=_323[_322];
|
|
if(p.panel("options").onBeforeExpand.call(p)==false){
|
|
return;
|
|
}
|
|
var _326="expand"+_322.substring(0,1).toUpperCase()+_322.substring(1);
|
|
_323[_326].panel("close");
|
|
p.panel("panel").stop(true,true);
|
|
p.panel("expand",false).panel("open").panel("resize",_324.collapse);
|
|
p.panel("panel").animate(_324.expand,function(){
|
|
_2fa(_321);
|
|
});
|
|
function _325(){
|
|
var cc=$(_321);
|
|
if(_322=="east"&&_323.expandEast){
|
|
return {collapse:{left:cc.width()},expand:{left:cc.width()-_323["east"].panel("options").width}};
|
|
}else{
|
|
if(_322=="west"&&_323.expandWest){
|
|
return {collapse:{left:-_323["west"].panel("options").width},expand:{left:0}};
|
|
}else{
|
|
if(_322=="north"&&_323.expandNorth){
|
|
return {collapse:{top:-_323["north"].panel("options").height},expand:{top:0}};
|
|
}else{
|
|
if(_322=="south"&&_323.expandSouth){
|
|
return {collapse:{top:cc.height()},expand:{top:cc.height()-_323["south"].panel("options").height}};
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
function _327(_328){
|
|
var _329=$.data(_328,"layout").panels;
|
|
var cc=$(_328);
|
|
if(_329.east.length){
|
|
_329.east.panel("panel").bind("mouseover","east",_32a);
|
|
}
|
|
if(_329.west.length){
|
|
_329.west.panel("panel").bind("mouseover","west",_32a);
|
|
}
|
|
if(_329.north.length){
|
|
_329.north.panel("panel").bind("mouseover","north",_32a);
|
|
}
|
|
if(_329.south.length){
|
|
_329.south.panel("panel").bind("mouseover","south",_32a);
|
|
}
|
|
_329.center.panel("panel").bind("mouseover","center",_32a);
|
|
function _32a(e){
|
|
if(_2f9==true){
|
|
return;
|
|
}
|
|
if(e.data!="east"&&_301(_329.east)&&_301(_329.expandEast)){
|
|
_316(_328,"east");
|
|
}
|
|
if(e.data!="west"&&_301(_329.west)&&_301(_329.expandWest)){
|
|
_316(_328,"west");
|
|
}
|
|
if(e.data!="north"&&_301(_329.north)&&_301(_329.expandNorth)){
|
|
_316(_328,"north");
|
|
}
|
|
if(e.data!="south"&&_301(_329.south)&&_301(_329.expandSouth)){
|
|
_316(_328,"south");
|
|
}
|
|
return false;
|
|
};
|
|
};
|
|
function _301(pp){
|
|
if(!pp){
|
|
return false;
|
|
}
|
|
if(pp.length){
|
|
return pp.panel("panel").is(":visible");
|
|
}else{
|
|
return false;
|
|
}
|
|
};
|
|
function _32b(_32c){
|
|
var _32d=$.data(_32c,"layout").panels;
|
|
if(_32d.east.length&&_32d.east.panel("options").collapsed){
|
|
_316(_32c,"east",0);
|
|
}
|
|
if(_32d.west.length&&_32d.west.panel("options").collapsed){
|
|
_316(_32c,"west",0);
|
|
}
|
|
if(_32d.north.length&&_32d.north.panel("options").collapsed){
|
|
_316(_32c,"north",0);
|
|
}
|
|
if(_32d.south.length&&_32d.south.panel("options").collapsed){
|
|
_316(_32c,"south",0);
|
|
}
|
|
};
|
|
$.fn.layout=function(_32e,_32f){
|
|
if(typeof _32e=="string"){
|
|
return $.fn.layout.methods[_32e](this,_32f);
|
|
}
|
|
_32e=_32e||{};
|
|
return this.each(function(){
|
|
var _330=$.data(this,"layout");
|
|
if(_330){
|
|
$.extend(_330.options,_32e);
|
|
}else{
|
|
var opts=$.extend({},$.fn.layout.defaults,$.fn.layout.parseOptions(this),_32e);
|
|
$.data(this,"layout",{options:opts,panels:{center:$(),north:$(),south:$(),east:$(),west:$()}});
|
|
init(this);
|
|
_327(this);
|
|
}
|
|
_2fa(this);
|
|
_32b(this);
|
|
});
|
|
};
|
|
$.fn.layout.methods={resize:function(jq){
|
|
return jq.each(function(){
|
|
_2fa(this);
|
|
});
|
|
},panel:function(jq,_331){
|
|
return $.data(jq[0],"layout").panels[_331];
|
|
},collapse:function(jq,_332){
|
|
return jq.each(function(){
|
|
_316(this,_332);
|
|
});
|
|
},expand:function(jq,_333){
|
|
return jq.each(function(){
|
|
_320(this,_333);
|
|
});
|
|
},add:function(jq,_334){
|
|
return jq.each(function(){
|
|
_305(this,_334);
|
|
_2fa(this);
|
|
if($(this).layout("panel",_334.region).panel("options").collapsed){
|
|
_316(this,_334.region,0);
|
|
}
|
|
});
|
|
},remove:function(jq,_335){
|
|
return jq.each(function(){
|
|
_311(this,_335);
|
|
_2fa(this);
|
|
});
|
|
}};
|
|
$.fn.layout.parseOptions=function(_336){
|
|
return $.extend({},$.parser.parseOptions(_336,[{fit:"boolean"}]));
|
|
};
|
|
$.fn.layout.defaults={fit:false};
|
|
})(jQuery);
|
|
(function($){
|
|
function init(_337){
|
|
$(_337).appendTo("body");
|
|
$(_337).addClass("menu-top");
|
|
$(document).unbind(".menu").bind("mousedown.menu",function(e){
|
|
var _338=$("body>div.menu:visible");
|
|
var m=$(e.target).closest("div.menu",_338);
|
|
if(m.length){
|
|
return;
|
|
}
|
|
$("body>div.menu-top:visible").menu("hide");
|
|
});
|
|
var _339=_33a($(_337));
|
|
for(var i=0;i<_339.length;i++){
|
|
_33b(_339[i]);
|
|
}
|
|
function _33a(menu){
|
|
var _33c=[];
|
|
menu.addClass("menu");
|
|
if(!menu[0].style.width){
|
|
menu[0].autowidth=true;
|
|
}
|
|
_33c.push(menu);
|
|
if(!menu.hasClass("menu-content")){
|
|
menu.children("div").each(function(){
|
|
var _33d=$(this).children("div");
|
|
if(_33d.length){
|
|
_33d.insertAfter(_337);
|
|
this.submenu=_33d;
|
|
var mm=_33a(_33d);
|
|
_33c=_33c.concat(mm);
|
|
}
|
|
});
|
|
}
|
|
return _33c;
|
|
};
|
|
function _33b(menu){
|
|
if(!menu.hasClass("menu-content")){
|
|
menu.children("div").each(function(){
|
|
var item=$(this);
|
|
if(item.hasClass("menu-sep")){
|
|
}else{
|
|
var _33e=$.extend({},$.parser.parseOptions(this,["name","iconCls","href"]),{disabled:(item.attr("disabled")?true:undefined)});
|
|
item.attr("name",_33e.name||"").attr("href",_33e.href||"");
|
|
var text=item.addClass("menu-item").html();
|
|
item.empty().append($("<div class=\"menu-text\"></div>").html(text));
|
|
if(_33e.iconCls){
|
|
$("<div class=\"menu-icon\"></div>").addClass(_33e.iconCls).appendTo(item);
|
|
}
|
|
if(_33e.disabled){
|
|
_33f(_337,item[0],true);
|
|
}
|
|
if(item[0].submenu){
|
|
$("<div class=\"menu-rightarrow\"></div>").appendTo(item);
|
|
}
|
|
item._outerHeight(22);
|
|
_340(_337,item);
|
|
}
|
|
});
|
|
$("<div class=\"menu-line\"></div>").prependTo(menu);
|
|
}
|
|
_341(_337,menu);
|
|
menu.hide();
|
|
_342(_337,menu);
|
|
};
|
|
};
|
|
function _341(_343,menu){
|
|
var opts=$.data(_343,"menu").options;
|
|
var d=menu.css("display");
|
|
menu.css({display:"block",left:-10000});
|
|
var _344=menu._outerWidth();
|
|
var _345=0;
|
|
menu.find("div.menu-text").each(function(){
|
|
if(_345<$(this)._outerWidth()){
|
|
_345=$(this)._outerWidth();
|
|
}
|
|
});
|
|
_345+=65;
|
|
menu._outerWidth(Math.max(_344,_345,opts.minWidth));
|
|
menu.css("display",d);
|
|
};
|
|
function _342(_346,menu){
|
|
var _347=$.data(_346,"menu");
|
|
menu.unbind(".menu").bind("mouseenter.menu",function(){
|
|
if(_347.timer){
|
|
clearTimeout(_347.timer);
|
|
_347.timer=null;
|
|
}
|
|
}).bind("mouseleave.menu",function(){
|
|
_347.timer=setTimeout(function(){
|
|
_348(_346);
|
|
},100);
|
|
});
|
|
};
|
|
function _340(_349,item){
|
|
item.unbind(".menu");
|
|
item.bind("click.menu",function(){
|
|
if($(this).hasClass("menu-item-disabled")){
|
|
return;
|
|
}
|
|
if(!this.submenu){
|
|
_348(_349);
|
|
var href=$(this).attr("href");
|
|
if(href){
|
|
location.href=href;
|
|
}
|
|
}
|
|
var item=$(_349).menu("getItem",this);
|
|
$.data(_349,"menu").options.onClick.call(_349,item);
|
|
}).bind("mouseenter.menu",function(e){
|
|
item.siblings().each(function(){
|
|
if(this.submenu){
|
|
_34c(this.submenu);
|
|
}
|
|
$(this).removeClass("menu-active");
|
|
});
|
|
item.addClass("menu-active");
|
|
if($(this).hasClass("menu-item-disabled")){
|
|
item.addClass("menu-active-disabled");
|
|
return;
|
|
}
|
|
var _34a=item[0].submenu;
|
|
if(_34a){
|
|
$(_349).menu("show",{menu:_34a,parent:item});
|
|
}
|
|
}).bind("mouseleave.menu",function(e){
|
|
item.removeClass("menu-active menu-active-disabled");
|
|
var _34b=item[0].submenu;
|
|
if(_34b){
|
|
if(e.pageX>=parseInt(_34b.css("left"))){
|
|
item.addClass("menu-active");
|
|
}else{
|
|
_34c(_34b);
|
|
}
|
|
}else{
|
|
item.removeClass("menu-active");
|
|
}
|
|
});
|
|
};
|
|
function _348(_34d){
|
|
var _34e=$.data(_34d,"menu");
|
|
if(_34e){
|
|
if($(_34d).is(":visible")){
|
|
_34c($(_34d));
|
|
_34e.options.onHide.call(_34d);
|
|
}
|
|
}
|
|
return false;
|
|
};
|
|
function _34f(_350,_351){
|
|
var left,top;
|
|
var menu=$(_351.menu||_350);
|
|
if(menu.hasClass("menu-top")){
|
|
var opts=$.data(_350,"menu").options;
|
|
left=opts.left;
|
|
top=opts.top;
|
|
if(_351.alignTo){
|
|
var at=$(_351.alignTo);
|
|
left=at.offset().left;
|
|
top=at.offset().top+at._outerHeight();
|
|
}
|
|
if(_351.left!=undefined){
|
|
left=_351.left;
|
|
}
|
|
if(_351.top!=undefined){
|
|
top=_351.top;
|
|
}
|
|
if(left+menu.outerWidth()>$(window)._outerWidth()+$(document)._scrollLeft()){
|
|
left=$(window)._outerWidth()+$(document).scrollLeft()-menu.outerWidth()-5;
|
|
}
|
|
if(top+menu.outerHeight()>$(window)._outerHeight()+$(document).scrollTop()){
|
|
top-=menu.outerHeight();
|
|
}
|
|
}else{
|
|
var _352=_351.parent;
|
|
left=_352.offset().left+_352.outerWidth()-2;
|
|
if(left+menu.outerWidth()+5>$(window)._outerWidth()+$(document).scrollLeft()){
|
|
left=_352.offset().left-menu.outerWidth()+2;
|
|
}
|
|
var top=_352.offset().top-3;
|
|
if(top+menu.outerHeight()>$(window)._outerHeight()+$(document).scrollTop()){
|
|
top=$(window)._outerHeight()+$(document).scrollTop()-menu.outerHeight()-5;
|
|
}
|
|
}
|
|
menu.css({left:left,top:top});
|
|
menu.show(0,function(){
|
|
if(!menu[0].shadow){
|
|
menu[0].shadow=$("<div class=\"menu-shadow\"></div>").insertAfter(menu);
|
|
}
|
|
menu[0].shadow.css({display:"block",zIndex:$.fn.menu.defaults.zIndex++,left:menu.css("left"),top:menu.css("top"),width:menu.outerWidth(),height:menu.outerHeight()});
|
|
menu.css("z-index",$.fn.menu.defaults.zIndex++);
|
|
if(menu.hasClass("menu-top")){
|
|
$.data(menu[0],"menu").options.onShow.call(menu[0]);
|
|
}
|
|
});
|
|
};
|
|
function _34c(menu){
|
|
if(!menu){
|
|
return;
|
|
}
|
|
_353(menu);
|
|
menu.find("div.menu-item").each(function(){
|
|
if(this.submenu){
|
|
_34c(this.submenu);
|
|
}
|
|
$(this).removeClass("menu-active");
|
|
});
|
|
function _353(m){
|
|
m.stop(true,true);
|
|
if(m[0].shadow){
|
|
m[0].shadow.hide();
|
|
}
|
|
m.hide();
|
|
};
|
|
};
|
|
function _354(_355,text){
|
|
var _356=null;
|
|
var tmp=$("<div></div>");
|
|
function find(menu){
|
|
menu.children("div.menu-item").each(function(){
|
|
var item=$(_355).menu("getItem",this);
|
|
var s=tmp.empty().html(item.text).text();
|
|
if(text==$.trim(s)){
|
|
_356=item;
|
|
}else{
|
|
if(this.submenu&&!_356){
|
|
find(this.submenu);
|
|
}
|
|
}
|
|
});
|
|
};
|
|
find($(_355));
|
|
tmp.remove();
|
|
return _356;
|
|
};
|
|
function _33f(_357,_358,_359){
|
|
var t=$(_358);
|
|
if(_359){
|
|
t.addClass("menu-item-disabled");
|
|
if(_358.onclick){
|
|
_358.onclick1=_358.onclick;
|
|
_358.onclick=null;
|
|
}
|
|
}else{
|
|
t.removeClass("menu-item-disabled");
|
|
if(_358.onclick1){
|
|
_358.onclick=_358.onclick1;
|
|
_358.onclick1=null;
|
|
}
|
|
}
|
|
};
|
|
function _35a(_35b,_35c){
|
|
var menu=$(_35b);
|
|
if(_35c.parent){
|
|
if(!_35c.parent.submenu){
|
|
var _35d=$("<div class=\"menu\"><div class=\"menu-line\"></div></div>").appendTo("body");
|
|
_35d[0].autowidth=true;
|
|
_35d.hide();
|
|
_35c.parent.submenu=_35d;
|
|
$("<div class=\"menu-rightarrow\"></div>").appendTo(_35c.parent);
|
|
}
|
|
menu=_35c.parent.submenu;
|
|
}
|
|
var item=$("<div class=\"menu-item\"></div>").appendTo(menu);
|
|
$("<div class=\"menu-text\"></div>").html(_35c.text).appendTo(item);
|
|
if(_35c.iconCls){
|
|
$("<div class=\"menu-icon\"></div>").addClass(_35c.iconCls).appendTo(item);
|
|
}
|
|
if(_35c.id){
|
|
item.attr("id",_35c.id);
|
|
}
|
|
if(_35c.href){
|
|
item.attr("href",_35c.href);
|
|
}
|
|
if(_35c.name){
|
|
item.attr("name",_35c.name);
|
|
}
|
|
if(_35c.onclick){
|
|
if(typeof _35c.onclick=="string"){
|
|
item.attr("onclick",_35c.onclick);
|
|
}else{
|
|
item[0].onclick=eval(_35c.onclick);
|
|
}
|
|
}
|
|
if(_35c.handler){
|
|
item[0].onclick=eval(_35c.handler);
|
|
}
|
|
_340(_35b,item);
|
|
if(_35c.disabled){
|
|
_33f(_35b,item[0],true);
|
|
}
|
|
_342(_35b,menu);
|
|
_341(_35b,menu);
|
|
};
|
|
function _35e(_35f,_360){
|
|
function _361(el){
|
|
if(el.submenu){
|
|
el.submenu.children("div.menu-item").each(function(){
|
|
_361(this);
|
|
});
|
|
var _362=el.submenu[0].shadow;
|
|
if(_362){
|
|
_362.remove();
|
|
}
|
|
el.submenu.remove();
|
|
}
|
|
$(el).remove();
|
|
};
|
|
_361(_360);
|
|
};
|
|
function _363(_364){
|
|
$(_364).children("div.menu-item").each(function(){
|
|
_35e(_364,this);
|
|
});
|
|
if(_364.shadow){
|
|
_364.shadow.remove();
|
|
}
|
|
$(_364).remove();
|
|
};
|
|
$.fn.menu=function(_365,_366){
|
|
if(typeof _365=="string"){
|
|
return $.fn.menu.methods[_365](this,_366);
|
|
}
|
|
_365=_365||{};
|
|
return this.each(function(){
|
|
var _367=$.data(this,"menu");
|
|
if(_367){
|
|
$.extend(_367.options,_365);
|
|
}else{
|
|
_367=$.data(this,"menu",{options:$.extend({},$.fn.menu.defaults,$.fn.menu.parseOptions(this),_365)});
|
|
init(this);
|
|
}
|
|
$(this).css({left:_367.options.left,top:_367.options.top});
|
|
});
|
|
};
|
|
$.fn.menu.methods={options:function(jq){
|
|
return $.data(jq[0],"menu").options;
|
|
},show:function(jq,pos){
|
|
return jq.each(function(){
|
|
_34f(this,pos);
|
|
});
|
|
},hide:function(jq){
|
|
return jq.each(function(){
|
|
_348(this);
|
|
});
|
|
},destroy:function(jq){
|
|
return jq.each(function(){
|
|
_363(this);
|
|
});
|
|
},setText:function(jq,_368){
|
|
return jq.each(function(){
|
|
$(_368.target).children("div.menu-text").html(_368.text);
|
|
});
|
|
},setIcon:function(jq,_369){
|
|
return jq.each(function(){
|
|
var item=$(this).menu("getItem",_369.target);
|
|
if(item.iconCls){
|
|
$(item.target).children("div.menu-icon").removeClass(item.iconCls).addClass(_369.iconCls);
|
|
}else{
|
|
$("<div class=\"menu-icon\"></div>").addClass(_369.iconCls).appendTo(_369.target);
|
|
}
|
|
});
|
|
},getItem:function(jq,_36a){
|
|
var t=$(_36a);
|
|
var item={target:_36a,id:t.attr("id"),text:$.trim(t.children("div.menu-text").html()),disabled:t.hasClass("menu-item-disabled"),href:t.attr("href"),name:t.attr("name"),onclick:_36a.onclick};
|
|
var icon=t.children("div.menu-icon");
|
|
if(icon.length){
|
|
var cc=[];
|
|
var aa=icon.attr("class").split(" ");
|
|
for(var i=0;i<aa.length;i++){
|
|
if(aa[i]!="menu-icon"){
|
|
cc.push(aa[i]);
|
|
}
|
|
}
|
|
item.iconCls=cc.join(" ");
|
|
}
|
|
return item;
|
|
},findItem:function(jq,text){
|
|
return _354(jq[0],text);
|
|
},appendItem:function(jq,_36b){
|
|
return jq.each(function(){
|
|
_35a(this,_36b);
|
|
});
|
|
},removeItem:function(jq,_36c){
|
|
return jq.each(function(){
|
|
_35e(this,_36c);
|
|
});
|
|
},enableItem:function(jq,_36d){
|
|
return jq.each(function(){
|
|
_33f(this,_36d,false);
|
|
});
|
|
},disableItem:function(jq,_36e){
|
|
return jq.each(function(){
|
|
_33f(this,_36e,true);
|
|
});
|
|
}};
|
|
$.fn.menu.parseOptions=function(_36f){
|
|
return $.extend({},$.parser.parseOptions(_36f,["left","top",{minWidth:"number"}]));
|
|
};
|
|
$.fn.menu.defaults={zIndex:110000,left:0,top:0,minWidth:120,onShow:function(){
|
|
},onHide:function(){
|
|
},onClick:function(item){
|
|
}};
|
|
})(jQuery);
|
|
(function($){
|
|
function init(_370){
|
|
var opts=$.data(_370,"menubutton").options;
|
|
var btn=$(_370);
|
|
btn.removeClass("m-btn-active m-btn-plain-active").addClass("m-btn");
|
|
btn.linkbutton($.extend({},opts,{text:opts.text+"<span class=\"m-btn-downarrow\"> </span>"}));
|
|
if(opts.menu){
|
|
$(opts.menu).menu({onShow:function(){
|
|
btn.addClass((opts.plain==true)?"m-btn-plain-active":"m-btn-active");
|
|
},onHide:function(){
|
|
btn.removeClass((opts.plain==true)?"m-btn-plain-active":"m-btn-active");
|
|
}});
|
|
}
|
|
_371(_370,opts.disabled);
|
|
};
|
|
function _371(_372,_373){
|
|
var opts=$.data(_372,"menubutton").options;
|
|
opts.disabled=_373;
|
|
var btn=$(_372);
|
|
if(_373){
|
|
btn.linkbutton("disable");
|
|
btn.unbind(".menubutton");
|
|
}else{
|
|
btn.linkbutton("enable");
|
|
btn.unbind(".menubutton");
|
|
btn.bind("click.menubutton",function(){
|
|
_374();
|
|
return false;
|
|
});
|
|
var _375=null;
|
|
btn.bind("mouseenter.menubutton",function(){
|
|
_375=setTimeout(function(){
|
|
_374();
|
|
},opts.duration);
|
|
return false;
|
|
}).bind("mouseleave.menubutton",function(){
|
|
if(_375){
|
|
clearTimeout(_375);
|
|
}
|
|
});
|
|
}
|
|
function _374(){
|
|
if(!opts.menu){
|
|
return;
|
|
}
|
|
$("body>div.menu-top").menu("hide");
|
|
$(opts.menu).menu("show",{alignTo:btn});
|
|
btn.blur();
|
|
};
|
|
};
|
|
$.fn.menubutton=function(_376,_377){
|
|
if(typeof _376=="string"){
|
|
return $.fn.menubutton.methods[_376](this,_377);
|
|
}
|
|
_376=_376||{};
|
|
return this.each(function(){
|
|
var _378=$.data(this,"menubutton");
|
|
if(_378){
|
|
$.extend(_378.options,_376);
|
|
}else{
|
|
$.data(this,"menubutton",{options:$.extend({},$.fn.menubutton.defaults,$.fn.menubutton.parseOptions(this),_376)});
|
|
$(this).removeAttr("disabled");
|
|
}
|
|
init(this);
|
|
});
|
|
};
|
|
$.fn.menubutton.methods={options:function(jq){
|
|
return $.data(jq[0],"menubutton").options;
|
|
},enable:function(jq){
|
|
return jq.each(function(){
|
|
_371(this,false);
|
|
});
|
|
},disable:function(jq){
|
|
return jq.each(function(){
|
|
_371(this,true);
|
|
});
|
|
},destroy:function(jq){
|
|
return jq.each(function(){
|
|
var opts=$(this).menubutton("options");
|
|
if(opts.menu){
|
|
$(opts.menu).menu("destroy");
|
|
}
|
|
$(this).remove();
|
|
});
|
|
}};
|
|
$.fn.menubutton.parseOptions=function(_379){
|
|
var t=$(_379);
|
|
return $.extend({},$.fn.linkbutton.parseOptions(_379),$.parser.parseOptions(_379,["menu",{plain:"boolean",duration:"number"}]));
|
|
};
|
|
$.fn.menubutton.defaults=$.extend({},$.fn.linkbutton.defaults,{plain:true,menu:null,duration:100});
|
|
})(jQuery);
|
|
(function($){
|
|
function init(_37a){
|
|
var opts=$.data(_37a,"splitbutton").options;
|
|
var btn=$(_37a);
|
|
btn.removeClass("s-btn-active s-btn-plain-active").addClass("s-btn");
|
|
btn.linkbutton($.extend({},opts,{text:opts.text+"<span class=\"s-btn-downarrow\"> </span>"}));
|
|
if(opts.menu){
|
|
$(opts.menu).menu({onShow:function(){
|
|
btn.addClass((opts.plain==true)?"s-btn-plain-active":"s-btn-active");
|
|
},onHide:function(){
|
|
btn.removeClass((opts.plain==true)?"s-btn-plain-active":"s-btn-active");
|
|
}});
|
|
}
|
|
_37b(_37a,opts.disabled);
|
|
};
|
|
function _37b(_37c,_37d){
|
|
var opts=$.data(_37c,"splitbutton").options;
|
|
opts.disabled=_37d;
|
|
var btn=$(_37c);
|
|
var _37e=btn.find(".s-btn-downarrow");
|
|
if(_37d){
|
|
btn.linkbutton("disable");
|
|
_37e.unbind(".splitbutton");
|
|
}else{
|
|
btn.linkbutton("enable");
|
|
_37e.unbind(".splitbutton");
|
|
_37e.bind("click.splitbutton",function(){
|
|
_37f();
|
|
return false;
|
|
});
|
|
var _380=null;
|
|
_37e.bind("mouseenter.splitbutton",function(){
|
|
_380=setTimeout(function(){
|
|
_37f();
|
|
},opts.duration);
|
|
return false;
|
|
}).bind("mouseleave.splitbutton",function(){
|
|
if(_380){
|
|
clearTimeout(_380);
|
|
}
|
|
});
|
|
}
|
|
function _37f(){
|
|
if(!opts.menu){
|
|
return;
|
|
}
|
|
$("body>div.menu-top").menu("hide");
|
|
$(opts.menu).menu("show",{alignTo:btn});
|
|
btn.blur();
|
|
};
|
|
};
|
|
$.fn.splitbutton=function(_381,_382){
|
|
if(typeof _381=="string"){
|
|
return $.fn.splitbutton.methods[_381](this,_382);
|
|
}
|
|
_381=_381||{};
|
|
return this.each(function(){
|
|
var _383=$.data(this,"splitbutton");
|
|
if(_383){
|
|
$.extend(_383.options,_381);
|
|
}else{
|
|
$.data(this,"splitbutton",{options:$.extend({},$.fn.splitbutton.defaults,$.fn.splitbutton.parseOptions(this),_381)});
|
|
$(this).removeAttr("disabled");
|
|
}
|
|
init(this);
|
|
});
|
|
};
|
|
$.fn.splitbutton.methods={options:function(jq){
|
|
return $.data(jq[0],"splitbutton").options;
|
|
},enable:function(jq){
|
|
return jq.each(function(){
|
|
_37b(this,false);
|
|
});
|
|
},disable:function(jq){
|
|
return jq.each(function(){
|
|
_37b(this,true);
|
|
});
|
|
},destroy:function(jq){
|
|
return jq.each(function(){
|
|
var opts=$(this).splitbutton("options");
|
|
if(opts.menu){
|
|
$(opts.menu).menu("destroy");
|
|
}
|
|
$(this).remove();
|
|
});
|
|
}};
|
|
$.fn.splitbutton.parseOptions=function(_384){
|
|
var t=$(_384);
|
|
return $.extend({},$.fn.linkbutton.parseOptions(_384),$.parser.parseOptions(_384,["menu",{plain:"boolean",duration:"number"}]));
|
|
};
|
|
$.fn.splitbutton.defaults=$.extend({},$.fn.linkbutton.defaults,{plain:true,menu:null,duration:100});
|
|
})(jQuery);
|
|
(function($){
|
|
function init(_385){
|
|
$(_385).hide();
|
|
var span=$("<span class=\"searchbox\"></span>").insertAfter(_385);
|
|
var _386=$("<input type=\"text\" class=\"searchbox-text\">").appendTo(span);
|
|
$("<span><span class=\"searchbox-button\"></span></span>").appendTo(span);
|
|
var name=$(_385).attr("name");
|
|
if(name){
|
|
_386.attr("name",name);
|
|
$(_385).removeAttr("name").attr("searchboxName",name);
|
|
}
|
|
return span;
|
|
};
|
|
function _387(_388,_389){
|
|
var opts=$.data(_388,"searchbox").options;
|
|
var sb=$.data(_388,"searchbox").searchbox;
|
|
if(_389){
|
|
opts.width=_389;
|
|
}
|
|
sb.appendTo("body");
|
|
if(isNaN(opts.width)){
|
|
opts.width=sb._outerWidth();
|
|
}
|
|
var _38a=sb.find("span.searchbox-button");
|
|
var menu=sb.find("a.searchbox-menu");
|
|
var _38b=sb.find("input.searchbox-text");
|
|
sb._outerWidth(opts.width)._outerHeight(opts.height);
|
|
_38b._outerWidth(sb.width()-menu._outerWidth()-_38a._outerWidth());
|
|
_38b.css({height:sb.height()+"px",lineHeight:sb.height()+"px"});
|
|
menu._outerHeight(sb.height());
|
|
_38a._outerHeight(sb.height());
|
|
var _38c=menu.find("span.l-btn-left");
|
|
_38c._outerHeight(sb.height());
|
|
_38c.find("span.l-btn-text,span.m-btn-downarrow").css({height:_38c.height()+"px",lineHeight:_38c.height()+"px"});
|
|
sb.insertAfter(_388);
|
|
};
|
|
function _38d(_38e){
|
|
var _38f=$.data(_38e,"searchbox");
|
|
var opts=_38f.options;
|
|
if(opts.menu){
|
|
_38f.menu=$(opts.menu).menu({onClick:function(item){
|
|
_390(item);
|
|
}});
|
|
var item=_38f.menu.children("div.menu-item:first");
|
|
_38f.menu.children("div.menu-item").each(function(){
|
|
var _391=$.extend({},$.parser.parseOptions(this),{selected:($(this).attr("selected")?true:undefined)});
|
|
if(_391.selected){
|
|
item=$(this);
|
|
return false;
|
|
}
|
|
});
|
|
item.triggerHandler("click");
|
|
}else{
|
|
_38f.searchbox.find("a.searchbox-menu").remove();
|
|
_38f.menu=null;
|
|
}
|
|
function _390(item){
|
|
_38f.searchbox.find("a.searchbox-menu").remove();
|
|
var mb=$("<a class=\"searchbox-menu\" href=\"javascript:void(0)\"></a>").html(item.text);
|
|
mb.prependTo(_38f.searchbox).menubutton({menu:_38f.menu,iconCls:item.iconCls});
|
|
_38f.searchbox.find("input.searchbox-text").attr("name",$(item.target).attr("name")||item.text);
|
|
_387(_38e);
|
|
};
|
|
};
|
|
function _392(_393){
|
|
var _394=$.data(_393,"searchbox");
|
|
var opts=_394.options;
|
|
var _395=_394.searchbox.find("input.searchbox-text");
|
|
var _396=_394.searchbox.find(".searchbox-button");
|
|
_395.unbind(".searchbox").bind("blur.searchbox",function(e){
|
|
opts.value=$(this).val();
|
|
if(opts.value==""){
|
|
$(this).val(opts.prompt);
|
|
$(this).addClass("searchbox-prompt");
|
|
}else{
|
|
$(this).removeClass("searchbox-prompt");
|
|
}
|
|
}).bind("focus.searchbox",function(e){
|
|
if($(this).val()!=opts.value){
|
|
$(this).val(opts.value);
|
|
}
|
|
$(this).removeClass("searchbox-prompt");
|
|
}).bind("keydown.searchbox",function(e){
|
|
if(e.keyCode==13){
|
|
e.preventDefault();
|
|
var name=$.fn.prop?_395.prop("name"):_395.attr("name");
|
|
opts.value=$(this).val();
|
|
opts.searcher.call(_393,opts.value,name);
|
|
return false;
|
|
}
|
|
});
|
|
_396.unbind(".searchbox").bind("click.searchbox",function(){
|
|
var name=$.fn.prop?_395.prop("name"):_395.attr("name");
|
|
opts.searcher.call(_393,opts.value,name);
|
|
}).bind("mouseenter.searchbox",function(){
|
|
$(this).addClass("searchbox-button-hover");
|
|
}).bind("mouseleave.searchbox",function(){
|
|
$(this).removeClass("searchbox-button-hover");
|
|
});
|
|
};
|
|
function _397(_398){
|
|
var _399=$.data(_398,"searchbox");
|
|
var opts=_399.options;
|
|
var _39a=_399.searchbox.find("input.searchbox-text");
|
|
if(opts.value==""){
|
|
_39a.val(opts.prompt);
|
|
_39a.addClass("searchbox-prompt");
|
|
}else{
|
|
_39a.val(opts.value);
|
|
_39a.removeClass("searchbox-prompt");
|
|
}
|
|
};
|
|
$.fn.searchbox=function(_39b,_39c){
|
|
if(typeof _39b=="string"){
|
|
return $.fn.searchbox.methods[_39b](this,_39c);
|
|
}
|
|
_39b=_39b||{};
|
|
return this.each(function(){
|
|
var _39d=$.data(this,"searchbox");
|
|
if(_39d){
|
|
$.extend(_39d.options,_39b);
|
|
}else{
|
|
_39d=$.data(this,"searchbox",{options:$.extend({},$.fn.searchbox.defaults,$.fn.searchbox.parseOptions(this),_39b),searchbox:init(this)});
|
|
}
|
|
_38d(this);
|
|
_397(this);
|
|
_392(this);
|
|
_387(this);
|
|
});
|
|
};
|
|
$.fn.searchbox.methods={options:function(jq){
|
|
return $.data(jq[0],"searchbox").options;
|
|
},menu:function(jq){
|
|
return $.data(jq[0],"searchbox").menu;
|
|
},textbox:function(jq){
|
|
return $.data(jq[0],"searchbox").searchbox.find("input.searchbox-text");
|
|
},getValue:function(jq){
|
|
return $.data(jq[0],"searchbox").options.value;
|
|
},setValue:function(jq,_39e){
|
|
return jq.each(function(){
|
|
$(this).searchbox("options").value=_39e;
|
|
$(this).searchbox("textbox").val(_39e);
|
|
$(this).searchbox("textbox").blur();
|
|
});
|
|
},getName:function(jq){
|
|
return $.data(jq[0],"searchbox").searchbox.find("input.searchbox-text").attr("name");
|
|
},selectName:function(jq,name){
|
|
return jq.each(function(){
|
|
var menu=$.data(this,"searchbox").menu;
|
|
if(menu){
|
|
menu.children("div.menu-item[name=\""+name+"\"]").triggerHandler("click");
|
|
}
|
|
});
|
|
},destroy:function(jq){
|
|
return jq.each(function(){
|
|
var menu=$(this).searchbox("menu");
|
|
if(menu){
|
|
menu.menu("destroy");
|
|
}
|
|
$.data(this,"searchbox").searchbox.remove();
|
|
$(this).remove();
|
|
});
|
|
},resize:function(jq,_39f){
|
|
return jq.each(function(){
|
|
_387(this,_39f);
|
|
});
|
|
}};
|
|
$.fn.searchbox.parseOptions=function(_3a0){
|
|
var t=$(_3a0);
|
|
return $.extend({},$.parser.parseOptions(_3a0,["width","height","prompt","menu"]),{value:t.val(),searcher:(t.attr("searcher")?eval(t.attr("searcher")):undefined)});
|
|
};
|
|
$.fn.searchbox.defaults={width:"auto",height:22,prompt:"",value:"",menu:null,searcher:function(_3a1,name){
|
|
}};
|
|
})(jQuery);
|
|
(function($){
|
|
function init(_3a2){
|
|
$(_3a2).addClass("validatebox-text");
|
|
};
|
|
function _3a3(_3a4){
|
|
var _3a5=$.data(_3a4,"validatebox");
|
|
_3a5.validating=false;
|
|
var tip=_3a5.tip;
|
|
if(tip){
|
|
tip.remove();
|
|
}
|
|
$(_3a4).unbind();
|
|
$(_3a4).remove();
|
|
};
|
|
function _3a6(_3a7){
|
|
var box=$(_3a7);
|
|
var _3a8=$.data(_3a7,"validatebox");
|
|
box.unbind(".validatebox").bind("focus.validatebox",function(){
|
|
_3a8.validating=true;
|
|
_3a8.value=undefined;
|
|
(function(){
|
|
if(_3a8.validating){
|
|
if(_3a8.value!=box.val()){
|
|
_3a8.value=box.val();
|
|
if(_3a8.timer){
|
|
clearTimeout(_3a8.timer);
|
|
}
|
|
_3a8.timer=setTimeout(function(){
|
|
$(_3a7).validatebox("validate");
|
|
},_3a8.options.delay);
|
|
}else{
|
|
_3ac(_3a7);
|
|
}
|
|
setTimeout(arguments.callee,200);
|
|
}
|
|
})();
|
|
}).bind("blur.validatebox",function(){
|
|
if(_3a8.timer){
|
|
clearTimeout(_3a8.timer);
|
|
_3a8.timer=undefined;
|
|
}
|
|
_3a8.validating=false;
|
|
_3a9(_3a7);
|
|
}).bind("mouseenter.validatebox",function(){
|
|
if(box.hasClass("validatebox-invalid")){
|
|
_3aa(_3a7);
|
|
}
|
|
}).bind("mouseleave.validatebox",function(){
|
|
if(!_3a8.validating){
|
|
_3a9(_3a7);
|
|
}
|
|
});
|
|
};
|
|
function _3aa(_3ab){
|
|
var msg=$.data(_3ab,"validatebox").message;
|
|
var tip=$.data(_3ab,"validatebox").tip;
|
|
if(!tip){
|
|
tip=$("<div class=\"validatebox-tip\">"+"<span class=\"validatebox-tip-content\">"+"</span>"+"<span class=\"validatebox-tip-pointer\">"+"</span>"+"</div>").appendTo("body");
|
|
$.data(_3ab,"validatebox").tip=tip;
|
|
}
|
|
tip.find(".validatebox-tip-content").html(msg);
|
|
_3ac(_3ab);
|
|
};
|
|
function _3ac(_3ad){
|
|
var _3ae=$.data(_3ad,"validatebox");
|
|
if(!_3ae){
|
|
return;
|
|
}
|
|
var tip=_3ae.tip;
|
|
if(tip){
|
|
var box=$(_3ad);
|
|
var _3af=tip.find(".validatebox-tip-pointer");
|
|
var _3b0=tip.find(".validatebox-tip-content");
|
|
tip.show();
|
|
tip.css("top",box.offset().top-(_3b0._outerHeight()-box._outerHeight())/2);
|
|
if(_3ae.options.tipPosition=="left"){
|
|
tip.css("left",box.offset().left-tip._outerWidth());
|
|
tip.addClass("validatebox-tip-left");
|
|
}else{
|
|
tip.css("left",box.offset().left+box._outerWidth());
|
|
tip.removeClass("validatebox-tip-left");
|
|
}
|
|
_3af.css("top",(_3b0._outerHeight()-_3af._outerHeight())/2);
|
|
}
|
|
};
|
|
function _3a9(_3b1){
|
|
var tip=$.data(_3b1,"validatebox").tip;
|
|
if(tip){
|
|
tip.remove();
|
|
$.data(_3b1,"validatebox").tip=null;
|
|
}
|
|
};
|
|
function _3b2(_3b3){
|
|
var _3b4=$.data(_3b3,"validatebox");
|
|
var opts=_3b4.options;
|
|
var tip=_3b4.tip;
|
|
var box=$(_3b3);
|
|
var _3b5=box.val();
|
|
function _3b6(msg){
|
|
_3b4.message=msg;
|
|
};
|
|
function _3b7(_3b8){
|
|
var _3b9=/([a-zA-Z_]+)(.*)/.exec(_3b8);
|
|
var rule=opts.rules[_3b9[1]];
|
|
if(rule&&_3b5){
|
|
var _3ba=eval(_3b9[2]);
|
|
if(!rule["validator"](_3b5,_3ba)){
|
|
box.addClass("validatebox-invalid");
|
|
var _3bb=rule["message"];
|
|
if(_3ba){
|
|
for(var i=0;i<_3ba.length;i++){
|
|
_3bb=_3bb.replace(new RegExp("\\{"+i+"\\}","g"),_3ba[i]);
|
|
}
|
|
}
|
|
_3b6(opts.invalidMessage||_3bb);
|
|
if(_3b4.validating){
|
|
_3aa(_3b3);
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
};
|
|
if(opts.required){
|
|
if(_3b5==""){
|
|
box.addClass("validatebox-invalid");
|
|
_3b6(opts.missingMessage);
|
|
if(_3b4.validating){
|
|
_3aa(_3b3);
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
if(opts.validType){
|
|
if(typeof opts.validType=="string"){
|
|
if(!_3b7(opts.validType)){
|
|
return false;
|
|
}
|
|
}else{
|
|
for(var i=0;i<opts.validType.length;i++){
|
|
if(!_3b7(opts.validType[i])){
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
box.removeClass("validatebox-invalid");
|
|
_3a9(_3b3);
|
|
return true;
|
|
};
|
|
$.fn.validatebox=function(_3bc,_3bd){
|
|
if(typeof _3bc=="string"){
|
|
return $.fn.validatebox.methods[_3bc](this,_3bd);
|
|
}
|
|
_3bc=_3bc||{};
|
|
return this.each(function(){
|
|
var _3be=$.data(this,"validatebox");
|
|
if(_3be){
|
|
$.extend(_3be.options,_3bc);
|
|
}else{
|
|
init(this);
|
|
$.data(this,"validatebox",{options:$.extend({},$.fn.validatebox.defaults,$.fn.validatebox.parseOptions(this),_3bc)});
|
|
}
|
|
_3a6(this);
|
|
});
|
|
};
|
|
$.fn.validatebox.methods={destroy:function(jq){
|
|
return jq.each(function(){
|
|
_3a3(this);
|
|
});
|
|
},validate:function(jq){
|
|
return jq.each(function(){
|
|
_3b2(this);
|
|
});
|
|
},isValid:function(jq){
|
|
return _3b2(jq[0]);
|
|
}};
|
|
$.fn.validatebox.parseOptions=function(_3bf){
|
|
var t=$(_3bf);
|
|
return $.extend({},$.parser.parseOptions(_3bf,["validType","missingMessage","invalidMessage","tipPosition",{delay:"number"}]),{required:(t.attr("required")?true:undefined)});
|
|
};
|
|
$.fn.validatebox.defaults={required:false,validType:null,delay:200,missingMessage:"This field is required.",invalidMessage:null,tipPosition:"right",rules:{email:{validator:function(_3c0){
|
|
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(_3c0);
|
|
},message:"Please enter a valid email address."},url:{validator:function(_3c1){
|
|
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(_3c1);
|
|
},message:"Please enter a valid URL."},length:{validator:function(_3c2,_3c3){
|
|
var len=$.trim(_3c2).length;
|
|
return len>=_3c3[0]&&len<=_3c3[1];
|
|
},message:"Please enter a value between {0} and {1}."},remote:{validator:function(_3c4,_3c5){
|
|
var data={};
|
|
data[_3c5[1]]=_3c4;
|
|
var _3c6=$.ajax({url:_3c5[0],dataType:"json",data:data,async:false,cache:false,type:"post"}).responseText;
|
|
return _3c6=="true";
|
|
},message:"Please fix this field."}}};
|
|
})(jQuery);
|
|
(function($){
|
|
function _3c7(_3c8,_3c9){
|
|
_3c9=_3c9||{};
|
|
var _3ca={};
|
|
if(_3c9.onSubmit){
|
|
if(_3c9.onSubmit.call(_3c8,_3ca)==false){
|
|
return;
|
|
}
|
|
}
|
|
var form=$(_3c8);
|
|
if(_3c9.url){
|
|
form.attr("action",_3c9.url);
|
|
}
|
|
var _3cb="easyui_frame_"+(new Date().getTime());
|
|
var _3cc=$("<iframe id="+_3cb+" name="+_3cb+"></iframe>").attr("src",window.ActiveXObject?"javascript:false":"about:blank").css({position:"absolute",top:-1000,left:-1000});
|
|
var t=form.attr("target"),a=form.attr("action");
|
|
form.attr("target",_3cb);
|
|
var _3cd=$();
|
|
try{
|
|
_3cc.appendTo("body");
|
|
_3cc.bind("load",cb);
|
|
for(var n in _3ca){
|
|
var f=$("<input type=\"hidden\" name=\""+n+"\">").val(_3ca[n]).appendTo(form);
|
|
_3cd=_3cd.add(f);
|
|
}
|
|
form[0].submit();
|
|
}
|
|
finally{
|
|
form.attr("action",a);
|
|
t?form.attr("target",t):form.removeAttr("target");
|
|
_3cd.remove();
|
|
}
|
|
var _3ce=10;
|
|
function cb(){
|
|
_3cc.unbind();
|
|
var body=$("#"+_3cb).contents().find("body");
|
|
var data=body.html();
|
|
if(data==""){
|
|
if(--_3ce){
|
|
setTimeout(cb,100);
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
var ta=body.find(">textarea");
|
|
if(ta.length){
|
|
data=ta.val();
|
|
}else{
|
|
var pre=body.find(">pre");
|
|
if(pre.length){
|
|
data=pre.html();
|
|
}
|
|
}
|
|
if(_3c9.success){
|
|
_3c9.success(data);
|
|
}
|
|
setTimeout(function(){
|
|
_3cc.unbind();
|
|
_3cc.remove();
|
|
},100);
|
|
};
|
|
};
|
|
function load(_3cf,data){
|
|
if(!$.data(_3cf,"form")){
|
|
$.data(_3cf,"form",{options:$.extend({},$.fn.form.defaults)});
|
|
}
|
|
var opts=$.data(_3cf,"form").options;
|
|
if(typeof data=="string"){
|
|
var _3d0={};
|
|
if(opts.onBeforeLoad.call(_3cf,_3d0)==false){
|
|
return;
|
|
}
|
|
$.ajax({url:data,data:_3d0,dataType:"json",success:function(data){
|
|
_3d1(data);
|
|
},error:function(){
|
|
opts.onLoadError.apply(_3cf,arguments);
|
|
}});
|
|
}else{
|
|
_3d1(data);
|
|
}
|
|
function _3d1(data){
|
|
var form=$(_3cf);
|
|
for(var name in data){
|
|
var val=data[name];
|
|
var rr=_3d2(name,val);
|
|
if(!rr.length){
|
|
var f=form.find("input[numberboxName=\""+name+"\"]");
|
|
if(f.length){
|
|
f.numberbox("setValue",val);
|
|
}else{
|
|
$("input[name=\""+name+"\"]",form).val(val);
|
|
$("textarea[name=\""+name+"\"]",form).val(val);
|
|
$("select[name=\""+name+"\"]",form).val(val);
|
|
}
|
|
}
|
|
_3d3(name,val);
|
|
}
|
|
opts.onLoadSuccess.call(_3cf,data);
|
|
_3d6(_3cf);
|
|
};
|
|
function _3d2(name,val){
|
|
var form=$(_3cf);
|
|
var rr=$("input[name=\""+name+"\"][type=radio], input[name=\""+name+"\"][type=checkbox]",form);
|
|
$.fn.prop?rr.prop("checked",false):rr.attr("checked",false);
|
|
rr.each(function(){
|
|
var f=$(this);
|
|
if(f.val()==String(val)){
|
|
$.fn.prop?f.prop("checked",true):f.attr("checked",true);
|
|
}
|
|
});
|
|
return rr;
|
|
};
|
|
function _3d3(name,val){
|
|
var form=$(_3cf);
|
|
var cc=["combobox","combotree","combogrid","datetimebox","datebox","combo"];
|
|
var c=form.find("[comboName=\""+name+"\"]");
|
|
if(c.length){
|
|
for(var i=0;i<cc.length;i++){
|
|
var type=cc[i];
|
|
if(c.hasClass(type+"-f")){
|
|
if(c[type]("options").multiple){
|
|
c[type]("setValues",val);
|
|
}else{
|
|
c[type]("setValue",val);
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
function _3d4(_3d5){
|
|
$("input,select,textarea",_3d5).each(function(){
|
|
var t=this.type,tag=this.tagName.toLowerCase();
|
|
if(t=="text"||t=="hidden"||t=="password"||tag=="textarea"){
|
|
this.value="";
|
|
}else{
|
|
if(t=="file"){
|
|
var file=$(this);
|
|
file.after(file.clone().val(""));
|
|
file.remove();
|
|
}else{
|
|
if(t=="checkbox"||t=="radio"){
|
|
this.checked=false;
|
|
}else{
|
|
if(tag=="select"){
|
|
this.selectedIndex=-1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
if($.fn.combo){
|
|
$(".combo-f",_3d5).combo("clear");
|
|
}
|
|
if($.fn.combobox){
|
|
$(".combobox-f",_3d5).combobox("clear");
|
|
}
|
|
if($.fn.combotree){
|
|
$(".combotree-f",_3d5).combotree("clear");
|
|
}
|
|
if($.fn.combogrid){
|
|
$(".combogrid-f",_3d5).combogrid("clear");
|
|
}
|
|
_3d6(_3d5);
|
|
};
|
|
function _3d7(_3d8){
|
|
_3d8.reset();
|
|
var t=$(_3d8);
|
|
if($.fn.combo){
|
|
t.find(".combo-f").combo("reset");
|
|
}
|
|
if($.fn.combobox){
|
|
t.find(".combobox-f").combobox("reset");
|
|
}
|
|
if($.fn.combotree){
|
|
t.find(".combotree-f").combotree("reset");
|
|
}
|
|
if($.fn.combogrid){
|
|
t.find(".combogrid-f").combogrid("reset");
|
|
}
|
|
if($.fn.spinner){
|
|
t.find(".spinner-f").spinner("reset");
|
|
}
|
|
if($.fn.timespinner){
|
|
t.find(".timespinner-f").timespinner("reset");
|
|
}
|
|
if($.fn.numberbox){
|
|
t.find(".numberbox-f").numberbox("reset");
|
|
}
|
|
if($.fn.numberspinner){
|
|
t.find(".numberspinner-f").numberspinner("reset");
|
|
}
|
|
_3d6(_3d8);
|
|
};
|
|
function _3d9(_3da){
|
|
var _3db=$.data(_3da,"form").options;
|
|
var form=$(_3da);
|
|
form.unbind(".form").bind("submit.form",function(){
|
|
setTimeout(function(){
|
|
_3c7(_3da,_3db);
|
|
},0);
|
|
return false;
|
|
});
|
|
};
|
|
function _3d6(_3dc){
|
|
if($.fn.validatebox){
|
|
var t=$(_3dc);
|
|
t.find(".validatebox-text:not(:disabled)").validatebox("validate");
|
|
var _3dd=t.find(".validatebox-invalid");
|
|
_3dd.filter(":not(:disabled):first").focus();
|
|
return _3dd.length==0;
|
|
}
|
|
return true;
|
|
};
|
|
$.fn.form=function(_3de,_3df){
|
|
if(typeof _3de=="string"){
|
|
return $.fn.form.methods[_3de](this,_3df);
|
|
}
|
|
_3de=_3de||{};
|
|
return this.each(function(){
|
|
if(!$.data(this,"form")){
|
|
$.data(this,"form",{options:$.extend({},$.fn.form.defaults,_3de)});
|
|
}
|
|
_3d9(this);
|
|
});
|
|
};
|
|
$.fn.form.methods={submit:function(jq,_3e0){
|
|
return jq.each(function(){
|
|
_3c7(this,$.extend({},$.fn.form.defaults,_3e0||{}));
|
|
});
|
|
},load:function(jq,data){
|
|
return jq.each(function(){
|
|
load(this,data);
|
|
});
|
|
},clear:function(jq){
|
|
return jq.each(function(){
|
|
_3d4(this);
|
|
});
|
|
},reset:function(jq){
|
|
return jq.each(function(){
|
|
_3d7(this);
|
|
});
|
|
},validate:function(jq){
|
|
return _3d6(jq[0]);
|
|
}};
|
|
$.fn.form.defaults={url:null,onSubmit:function(_3e1){
|
|
return $(this).form("validate");
|
|
},success:function(data){
|
|
},onBeforeLoad:function(_3e2){
|
|
},onLoadSuccess:function(data){
|
|
},onLoadError:function(){
|
|
}};
|
|
})(jQuery);
|
|
(function($){
|
|
function init(_3e3){
|
|
$(_3e3).addClass("numberbox-f");
|
|
var v=$("<input type=\"hidden\">").insertAfter(_3e3);
|
|
var name=$(_3e3).attr("name");
|
|
if(name){
|
|
v.attr("name",name);
|
|
$(_3e3).removeAttr("name").attr("numberboxName",name);
|
|
}
|
|
return v;
|
|
};
|
|
function _3e4(_3e5){
|
|
var opts=$.data(_3e5,"numberbox").options;
|
|
var fn=opts.onChange;
|
|
opts.onChange=function(){
|
|
};
|
|
_3e6(_3e5,opts.parser.call(_3e5,opts.value));
|
|
opts.onChange=fn;
|
|
opts.originalValue=_3e7(_3e5);
|
|
};
|
|
function _3e7(_3e8){
|
|
return $.data(_3e8,"numberbox").field.val();
|
|
};
|
|
function _3e6(_3e9,_3ea){
|
|
var _3eb=$.data(_3e9,"numberbox");
|
|
var opts=_3eb.options;
|
|
var _3ec=_3e7(_3e9);
|
|
_3ea=opts.parser.call(_3e9,_3ea);
|
|
opts.value=_3ea;
|
|
_3eb.field.val(_3ea);
|
|
$(_3e9).val(opts.formatter.call(_3e9,_3ea));
|
|
if(_3ec!=_3ea){
|
|
opts.onChange.call(_3e9,_3ea,_3ec);
|
|
}
|
|
};
|
|
function _3ed(_3ee){
|
|
var opts=$.data(_3ee,"numberbox").options;
|
|
$(_3ee).unbind(".numberbox").bind("keypress.numberbox",function(e){
|
|
if(e.which==45){
|
|
if($(this).val().indexOf("-")==-1){
|
|
return true;
|
|
}else{
|
|
return false;
|
|
}
|
|
}
|
|
if(e.which==46){
|
|
if($(this).val().indexOf(".")==-1){
|
|
return true;
|
|
}else{
|
|
return false;
|
|
}
|
|
}else{
|
|
if((e.which>=48&&e.which<=57&&e.ctrlKey==false&&e.shiftKey==false)||e.which==0||e.which==8){
|
|
return true;
|
|
}else{
|
|
if(e.ctrlKey==true&&(e.which==99||e.which==118)){
|
|
return true;
|
|
}else{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}).bind("blur.numberbox",function(){
|
|
_3e6(_3ee,$(this).val());
|
|
$(this).val(opts.formatter.call(_3ee,_3e7(_3ee)));
|
|
}).bind("focus.numberbox",function(){
|
|
var vv=_3e7(_3ee);
|
|
if($(this).val()!=vv){
|
|
$(this).val(vv);
|
|
}
|
|
});
|
|
};
|
|
function _3ef(_3f0){
|
|
if($.fn.validatebox){
|
|
var opts=$.data(_3f0,"numberbox").options;
|
|
$(_3f0).validatebox(opts);
|
|
}
|
|
};
|
|
function _3f1(_3f2,_3f3){
|
|
var opts=$.data(_3f2,"numberbox").options;
|
|
if(_3f3){
|
|
opts.disabled=true;
|
|
$(_3f2).attr("disabled",true);
|
|
}else{
|
|
opts.disabled=false;
|
|
$(_3f2).removeAttr("disabled");
|
|
}
|
|
};
|
|
$.fn.numberbox=function(_3f4,_3f5){
|
|
if(typeof _3f4=="string"){
|
|
var _3f6=$.fn.numberbox.methods[_3f4];
|
|
if(_3f6){
|
|
return _3f6(this,_3f5);
|
|
}else{
|
|
return this.validatebox(_3f4,_3f5);
|
|
}
|
|
}
|
|
_3f4=_3f4||{};
|
|
return this.each(function(){
|
|
var _3f7=$.data(this,"numberbox");
|
|
if(_3f7){
|
|
$.extend(_3f7.options,_3f4);
|
|
}else{
|
|
_3f7=$.data(this,"numberbox",{options:$.extend({},$.fn.numberbox.defaults,$.fn.numberbox.parseOptions(this),_3f4),field:init(this)});
|
|
$(this).removeAttr("disabled");
|
|
$(this).css({imeMode:"disabled"});
|
|
}
|
|
_3f1(this,_3f7.options.disabled);
|
|
_3ed(this);
|
|
_3ef(this);
|
|
_3e4(this);
|
|
});
|
|
};
|
|
$.fn.numberbox.methods={options:function(jq){
|
|
return $.data(jq[0],"numberbox").options;
|
|
},destroy:function(jq){
|
|
return jq.each(function(){
|
|
$.data(this,"numberbox").field.remove();
|
|
$(this).validatebox("destroy");
|
|
$(this).remove();
|
|
});
|
|
},disable:function(jq){
|
|
return jq.each(function(){
|
|
_3f1(this,true);
|
|
});
|
|
},enable:function(jq){
|
|
return jq.each(function(){
|
|
_3f1(this,false);
|
|
});
|
|
},fix:function(jq){
|
|
return jq.each(function(){
|
|
_3e6(this,$(this).val());
|
|
});
|
|
},setValue:function(jq,_3f8){
|
|
return jq.each(function(){
|
|
_3e6(this,_3f8);
|
|
});
|
|
},getValue:function(jq){
|
|
return _3e7(jq[0]);
|
|
},clear:function(jq){
|
|
return jq.each(function(){
|
|
var _3f9=$.data(this,"numberbox");
|
|
_3f9.field.val("");
|
|
$(this).val("");
|
|
});
|
|
},reset:function(jq){
|
|
return jq.each(function(){
|
|
var opts=$(this).numberbox("options");
|
|
$(this).numberbox("setValue",opts.originalValue);
|
|
});
|
|
}};
|
|
$.fn.numberbox.parseOptions=function(_3fa){
|
|
var t=$(_3fa);
|
|
return $.extend({},$.fn.validatebox.parseOptions(_3fa),$.parser.parseOptions(_3fa,["decimalSeparator","groupSeparator","suffix",{min:"number",max:"number",precision:"number"}]),{prefix:(t.attr("prefix")?t.attr("prefix"):undefined),disabled:(t.attr("disabled")?true:undefined),value:(t.val()||undefined)});
|
|
};
|
|
$.fn.numberbox.defaults=$.extend({},$.fn.validatebox.defaults,{disabled:false,value:"",min:null,max:null,precision:0,decimalSeparator:".",groupSeparator:"",prefix:"",suffix:"",formatter:function(_3fb){
|
|
if(!_3fb){
|
|
return _3fb;
|
|
}
|
|
_3fb=_3fb+"";
|
|
var opts=$(this).numberbox("options");
|
|
var s1=_3fb,s2="";
|
|
var dpos=_3fb.indexOf(".");
|
|
if(dpos>=0){
|
|
s1=_3fb.substring(0,dpos);
|
|
s2=_3fb.substring(dpos+1,_3fb.length);
|
|
}
|
|
if(opts.groupSeparator){
|
|
var p=/(\d+)(\d{3})/;
|
|
while(p.test(s1)){
|
|
s1=s1.replace(p,"$1"+opts.groupSeparator+"$2");
|
|
}
|
|
}
|
|
if(s2){
|
|
return opts.prefix+s1+opts.decimalSeparator+s2+opts.suffix;
|
|
}else{
|
|
return opts.prefix+s1+opts.suffix;
|
|
}
|
|
},parser:function(s){
|
|
s=s+"";
|
|
var opts=$(this).numberbox("options");
|
|
if(opts.groupSeparator){
|
|
s=s.replace(new RegExp("\\"+opts.groupSeparator,"g"),"");
|
|
}
|
|
if(opts.decimalSeparator){
|
|
s=s.replace(new RegExp("\\"+opts.decimalSeparator,"g"),".");
|
|
}
|
|
if(opts.prefix){
|
|
s=s.replace(new RegExp("\\"+$.trim(opts.prefix),"g"),"");
|
|
}
|
|
if(opts.suffix){
|
|
s=s.replace(new RegExp("\\"+$.trim(opts.suffix),"g"),"");
|
|
}
|
|
s=s.replace(/\s/g,"");
|
|
var val=parseFloat(s).toFixed(opts.precision);
|
|
if(isNaN(val)){
|
|
val="";
|
|
}else{
|
|
if(typeof (opts.min)=="number"&&val<opts.min){
|
|
val=opts.min.toFixed(opts.precision);
|
|
}else{
|
|
if(typeof (opts.max)=="number"&&val>opts.max){
|
|
val=opts.max.toFixed(opts.precision);
|
|
}
|
|
}
|
|
}
|
|
return val;
|
|
},onChange:function(_3fc,_3fd){
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
function _3fe(_3ff){
|
|
var opts=$.data(_3ff,"calendar").options;
|
|
var t=$(_3ff);
|
|
if(opts.fit==true){
|
|
var p=t.parent();
|
|
opts.width=p.width();
|
|
opts.height=p.height();
|
|
}
|
|
var _400=t.find(".calendar-header");
|
|
t._outerWidth(opts.width);
|
|
t._outerHeight(opts.height);
|
|
t.find(".calendar-body")._outerHeight(t.height()-_400._outerHeight());
|
|
};
|
|
function init(_401){
|
|
$(_401).addClass("calendar").wrapInner("<div class=\"calendar-header\">"+"<div class=\"calendar-prevmonth\"></div>"+"<div class=\"calendar-nextmonth\"></div>"+"<div class=\"calendar-prevyear\"></div>"+"<div class=\"calendar-nextyear\"></div>"+"<div class=\"calendar-title\">"+"<span>Aprial 2010</span>"+"</div>"+"</div>"+"<div class=\"calendar-body\">"+"<div class=\"calendar-menu\">"+"<div class=\"calendar-menu-year-inner\">"+"<span class=\"calendar-menu-prev\"></span>"+"<span><input class=\"calendar-menu-year\" type=\"text\"></input></span>"+"<span class=\"calendar-menu-next\"></span>"+"</div>"+"<div class=\"calendar-menu-month-inner\">"+"</div>"+"</div>"+"</div>");
|
|
$(_401).find(".calendar-title span").hover(function(){
|
|
$(this).addClass("calendar-menu-hover");
|
|
},function(){
|
|
$(this).removeClass("calendar-menu-hover");
|
|
}).click(function(){
|
|
var menu=$(_401).find(".calendar-menu");
|
|
if(menu.is(":visible")){
|
|
menu.hide();
|
|
}else{
|
|
_408(_401);
|
|
}
|
|
});
|
|
$(".calendar-prevmonth,.calendar-nextmonth,.calendar-prevyear,.calendar-nextyear",_401).hover(function(){
|
|
$(this).addClass("calendar-nav-hover");
|
|
},function(){
|
|
$(this).removeClass("calendar-nav-hover");
|
|
});
|
|
$(_401).find(".calendar-nextmonth").click(function(){
|
|
_402(_401,1);
|
|
});
|
|
$(_401).find(".calendar-prevmonth").click(function(){
|
|
_402(_401,-1);
|
|
});
|
|
$(_401).find(".calendar-nextyear").click(function(){
|
|
_405(_401,1);
|
|
});
|
|
$(_401).find(".calendar-prevyear").click(function(){
|
|
_405(_401,-1);
|
|
});
|
|
$(_401).bind("_resize",function(){
|
|
var opts=$.data(_401,"calendar").options;
|
|
if(opts.fit==true){
|
|
_3fe(_401);
|
|
}
|
|
return false;
|
|
});
|
|
};
|
|
function _402(_403,_404){
|
|
var opts=$.data(_403,"calendar").options;
|
|
opts.month+=_404;
|
|
if(opts.month>12){
|
|
opts.year++;
|
|
opts.month=1;
|
|
}else{
|
|
if(opts.month<1){
|
|
opts.year--;
|
|
opts.month=12;
|
|
}
|
|
}
|
|
show(_403);
|
|
var menu=$(_403).find(".calendar-menu-month-inner");
|
|
menu.find("td.calendar-selected").removeClass("calendar-selected");
|
|
menu.find("td:eq("+(opts.month-1)+")").addClass("calendar-selected");
|
|
};
|
|
function _405(_406,_407){
|
|
var opts=$.data(_406,"calendar").options;
|
|
opts.year+=_407;
|
|
show(_406);
|
|
var menu=$(_406).find(".calendar-menu-year");
|
|
menu.val(opts.year);
|
|
};
|
|
function _408(_409){
|
|
var opts=$.data(_409,"calendar").options;
|
|
$(_409).find(".calendar-menu").show();
|
|
if($(_409).find(".calendar-menu-month-inner").is(":empty")){
|
|
$(_409).find(".calendar-menu-month-inner").empty();
|
|
var t=$("<table></table>").appendTo($(_409).find(".calendar-menu-month-inner"));
|
|
var idx=0;
|
|
for(var i=0;i<3;i++){
|
|
var tr=$("<tr></tr>").appendTo(t);
|
|
for(var j=0;j<4;j++){
|
|
$("<td class=\"calendar-menu-month\"></td>").html(opts.months[idx++]).attr("abbr",idx).appendTo(tr);
|
|
}
|
|
}
|
|
$(_409).find(".calendar-menu-prev,.calendar-menu-next").hover(function(){
|
|
$(this).addClass("calendar-menu-hover");
|
|
},function(){
|
|
$(this).removeClass("calendar-menu-hover");
|
|
});
|
|
$(_409).find(".calendar-menu-next").click(function(){
|
|
var y=$(_409).find(".calendar-menu-year");
|
|
if(!isNaN(y.val())){
|
|
y.val(parseInt(y.val())+1);
|
|
}
|
|
});
|
|
$(_409).find(".calendar-menu-prev").click(function(){
|
|
var y=$(_409).find(".calendar-menu-year");
|
|
if(!isNaN(y.val())){
|
|
y.val(parseInt(y.val()-1));
|
|
}
|
|
});
|
|
$(_409).find(".calendar-menu-year").keypress(function(e){
|
|
if(e.keyCode==13){
|
|
_40a();
|
|
}
|
|
});
|
|
$(_409).find(".calendar-menu-month").hover(function(){
|
|
$(this).addClass("calendar-menu-hover");
|
|
},function(){
|
|
$(this).removeClass("calendar-menu-hover");
|
|
}).click(function(){
|
|
var menu=$(_409).find(".calendar-menu");
|
|
menu.find(".calendar-selected").removeClass("calendar-selected");
|
|
$(this).addClass("calendar-selected");
|
|
_40a();
|
|
});
|
|
}
|
|
function _40a(){
|
|
var menu=$(_409).find(".calendar-menu");
|
|
var year=menu.find(".calendar-menu-year").val();
|
|
var _40b=menu.find(".calendar-selected").attr("abbr");
|
|
if(!isNaN(year)){
|
|
opts.year=parseInt(year);
|
|
opts.month=parseInt(_40b);
|
|
show(_409);
|
|
}
|
|
menu.hide();
|
|
};
|
|
var body=$(_409).find(".calendar-body");
|
|
var sele=$(_409).find(".calendar-menu");
|
|
var _40c=sele.find(".calendar-menu-year-inner");
|
|
var _40d=sele.find(".calendar-menu-month-inner");
|
|
_40c.find("input").val(opts.year).focus();
|
|
_40d.find("td.calendar-selected").removeClass("calendar-selected");
|
|
_40d.find("td:eq("+(opts.month-1)+")").addClass("calendar-selected");
|
|
sele._outerWidth(body._outerWidth());
|
|
sele._outerHeight(body._outerHeight());
|
|
_40d._outerHeight(sele.height()-_40c._outerHeight());
|
|
};
|
|
function _40e(_40f,year,_410){
|
|
var opts=$.data(_40f,"calendar").options;
|
|
var _411=[];
|
|
var _412=new Date(year,_410,0).getDate();
|
|
for(var i=1;i<=_412;i++){
|
|
_411.push([year,_410,i]);
|
|
}
|
|
var _413=[],week=[];
|
|
var _414=-1;
|
|
while(_411.length>0){
|
|
var date=_411.shift();
|
|
week.push(date);
|
|
var day=new Date(date[0],date[1]-1,date[2]).getDay();
|
|
if(_414==day){
|
|
day=0;
|
|
}else{
|
|
if(day==(opts.firstDay==0?7:opts.firstDay)-1){
|
|
_413.push(week);
|
|
week=[];
|
|
}
|
|
}
|
|
_414=day;
|
|
}
|
|
if(week.length){
|
|
_413.push(week);
|
|
}
|
|
var _415=_413[0];
|
|
if(_415.length<7){
|
|
while(_415.length<7){
|
|
var _416=_415[0];
|
|
var date=new Date(_416[0],_416[1]-1,_416[2]-1);
|
|
_415.unshift([date.getFullYear(),date.getMonth()+1,date.getDate()]);
|
|
}
|
|
}else{
|
|
var _416=_415[0];
|
|
var week=[];
|
|
for(var i=1;i<=7;i++){
|
|
var date=new Date(_416[0],_416[1]-1,_416[2]-i);
|
|
week.unshift([date.getFullYear(),date.getMonth()+1,date.getDate()]);
|
|
}
|
|
_413.unshift(week);
|
|
}
|
|
var _417=_413[_413.length-1];
|
|
while(_417.length<7){
|
|
var _418=_417[_417.length-1];
|
|
var date=new Date(_418[0],_418[1]-1,_418[2]+1);
|
|
_417.push([date.getFullYear(),date.getMonth()+1,date.getDate()]);
|
|
}
|
|
if(_413.length<6){
|
|
var _418=_417[_417.length-1];
|
|
var week=[];
|
|
for(var i=1;i<=7;i++){
|
|
var date=new Date(_418[0],_418[1]-1,_418[2]+i);
|
|
week.push([date.getFullYear(),date.getMonth()+1,date.getDate()]);
|
|
}
|
|
_413.push(week);
|
|
}
|
|
return _413;
|
|
};
|
|
function show(_419){
|
|
var opts=$.data(_419,"calendar").options;
|
|
$(_419).find(".calendar-title span").html(opts.months[opts.month-1]+" "+opts.year);
|
|
var body=$(_419).find("div.calendar-body");
|
|
body.find(">table").remove();
|
|
var t=$("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><thead></thead><tbody></tbody></table>").prependTo(body);
|
|
var tr=$("<tr></tr>").appendTo(t.find("thead"));
|
|
for(var i=opts.firstDay;i<opts.weeks.length;i++){
|
|
tr.append("<th>"+opts.weeks[i]+"</th>");
|
|
}
|
|
for(var i=0;i<opts.firstDay;i++){
|
|
tr.append("<th>"+opts.weeks[i]+"</th>");
|
|
}
|
|
var _41a=_40e(_419,opts.year,opts.month);
|
|
for(var i=0;i<_41a.length;i++){
|
|
var week=_41a[i];
|
|
var tr=$("<tr></tr>").appendTo(t.find("tbody"));
|
|
for(var j=0;j<week.length;j++){
|
|
var day=week[j];
|
|
$("<td class=\"calendar-day calendar-other-month\"></td>").attr("abbr",day[0]+","+day[1]+","+day[2]).html(day[2]).appendTo(tr);
|
|
}
|
|
}
|
|
t.find("td[abbr^=\""+opts.year+","+opts.month+"\"]").removeClass("calendar-other-month");
|
|
var now=new Date();
|
|
var _41b=now.getFullYear()+","+(now.getMonth()+1)+","+now.getDate();
|
|
t.find("td[abbr=\""+_41b+"\"]").addClass("calendar-today");
|
|
if(opts.current){
|
|
t.find(".calendar-selected").removeClass("calendar-selected");
|
|
var _41c=opts.current.getFullYear()+","+(opts.current.getMonth()+1)+","+opts.current.getDate();
|
|
t.find("td[abbr=\""+_41c+"\"]").addClass("calendar-selected");
|
|
}
|
|
var _41d=6-opts.firstDay;
|
|
var _41e=_41d+1;
|
|
if(_41d>=7){
|
|
_41d-=7;
|
|
}
|
|
if(_41e>=7){
|
|
_41e-=7;
|
|
}
|
|
t.find("tr").find("td:eq("+_41d+")").addClass("calendar-saturday");
|
|
t.find("tr").find("td:eq("+_41e+")").addClass("calendar-sunday");
|
|
t.find("td").hover(function(){
|
|
$(this).addClass("calendar-hover");
|
|
},function(){
|
|
$(this).removeClass("calendar-hover");
|
|
}).click(function(){
|
|
t.find(".calendar-selected").removeClass("calendar-selected");
|
|
$(this).addClass("calendar-selected");
|
|
var _41f=$(this).attr("abbr").split(",");
|
|
opts.current=new Date(_41f[0],parseInt(_41f[1])-1,_41f[2]);
|
|
opts.onSelect.call(_419,opts.current);
|
|
});
|
|
};
|
|
$.fn.calendar=function(_420,_421){
|
|
if(typeof _420=="string"){
|
|
return $.fn.calendar.methods[_420](this,_421);
|
|
}
|
|
_420=_420||{};
|
|
return this.each(function(){
|
|
var _422=$.data(this,"calendar");
|
|
if(_422){
|
|
$.extend(_422.options,_420);
|
|
}else{
|
|
_422=$.data(this,"calendar",{options:$.extend({},$.fn.calendar.defaults,$.fn.calendar.parseOptions(this),_420)});
|
|
init(this);
|
|
}
|
|
if(_422.options.border==false){
|
|
$(this).addClass("calendar-noborder");
|
|
}
|
|
_3fe(this);
|
|
show(this);
|
|
$(this).find("div.calendar-menu").hide();
|
|
});
|
|
};
|
|
$.fn.calendar.methods={options:function(jq){
|
|
return $.data(jq[0],"calendar").options;
|
|
},resize:function(jq){
|
|
return jq.each(function(){
|
|
_3fe(this);
|
|
});
|
|
},moveTo:function(jq,date){
|
|
return jq.each(function(){
|
|
$(this).calendar({year:date.getFullYear(),month:date.getMonth()+1,current:date});
|
|
});
|
|
}};
|
|
$.fn.calendar.parseOptions=function(_423){
|
|
var t=$(_423);
|
|
return $.extend({},$.parser.parseOptions(_423,["width","height",{firstDay:"number",fit:"boolean",border:"boolean"}]));
|
|
};
|
|
$.fn.calendar.defaults={width:180,height:180,fit:false,border:true,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:new Date(),onSelect:function(date){
|
|
}};
|
|
})(jQuery);
|
|
(function($){
|
|
function init(_424){
|
|
var _425=$("<span class=\"spinner\">"+"<span class=\"spinner-arrow\">"+"<span class=\"spinner-arrow-up\"></span>"+"<span class=\"spinner-arrow-down\"></span>"+"</span>"+"</span>").insertAfter(_424);
|
|
$(_424).addClass("spinner-text spinner-f").prependTo(_425);
|
|
return _425;
|
|
};
|
|
function _426(_427,_428){
|
|
var opts=$.data(_427,"spinner").options;
|
|
var _429=$.data(_427,"spinner").spinner;
|
|
if(_428){
|
|
opts.width=_428;
|
|
}
|
|
var _42a=$("<div style=\"display:none\"></div>").insertBefore(_429);
|
|
_429.appendTo("body");
|
|
if(isNaN(opts.width)){
|
|
opts.width=$(_427).outerWidth();
|
|
}
|
|
var _42b=_429.find(".spinner-arrow");
|
|
_429._outerWidth(opts.width)._outerHeight(opts.height);
|
|
$(_427)._outerWidth(_429.width()-_42b.outerWidth());
|
|
$(_427).css({height:_429.height()+"px",lineHeight:_429.height()+"px"});
|
|
_42b._outerHeight(_429.height());
|
|
_42b.find("span")._outerHeight(_42b.height()/2);
|
|
_429.insertAfter(_42a);
|
|
_42a.remove();
|
|
};
|
|
function _42c(_42d){
|
|
var opts=$.data(_42d,"spinner").options;
|
|
var _42e=$.data(_42d,"spinner").spinner;
|
|
_42e.find(".spinner-arrow-up,.spinner-arrow-down").unbind(".spinner");
|
|
if(!opts.disabled){
|
|
_42e.find(".spinner-arrow-up").bind("mouseenter.spinner",function(){
|
|
$(this).addClass("spinner-arrow-hover");
|
|
}).bind("mouseleave.spinner",function(){
|
|
$(this).removeClass("spinner-arrow-hover");
|
|
}).bind("click.spinner",function(){
|
|
opts.spin.call(_42d,false);
|
|
opts.onSpinUp.call(_42d);
|
|
$(_42d).validatebox("validate");
|
|
});
|
|
_42e.find(".spinner-arrow-down").bind("mouseenter.spinner",function(){
|
|
$(this).addClass("spinner-arrow-hover");
|
|
}).bind("mouseleave.spinner",function(){
|
|
$(this).removeClass("spinner-arrow-hover");
|
|
}).bind("click.spinner",function(){
|
|
opts.spin.call(_42d,true);
|
|
opts.onSpinDown.call(_42d);
|
|
$(_42d).validatebox("validate");
|
|
});
|
|
}
|
|
};
|
|
function _42f(_430,_431){
|
|
var opts=$.data(_430,"spinner").options;
|
|
if(_431){
|
|
opts.disabled=true;
|
|
$(_430).attr("disabled",true);
|
|
}else{
|
|
opts.disabled=false;
|
|
$(_430).removeAttr("disabled");
|
|
}
|
|
};
|
|
$.fn.spinner=function(_432,_433){
|
|
if(typeof _432=="string"){
|
|
var _434=$.fn.spinner.methods[_432];
|
|
if(_434){
|
|
return _434(this,_433);
|
|
}else{
|
|
return this.validatebox(_432,_433);
|
|
}
|
|
}
|
|
_432=_432||{};
|
|
return this.each(function(){
|
|
var _435=$.data(this,"spinner");
|
|
if(_435){
|
|
$.extend(_435.options,_432);
|
|
}else{
|
|
_435=$.data(this,"spinner",{options:$.extend({},$.fn.spinner.defaults,$.fn.spinner.parseOptions(this),_432),spinner:init(this)});
|
|
$(this).removeAttr("disabled");
|
|
}
|
|
_435.options.originalValue=_435.options.value;
|
|
$(this).val(_435.options.value);
|
|
$(this).attr("readonly",!_435.options.editable);
|
|
_42f(this,_435.options.disabled);
|
|
_426(this);
|
|
$(this).validatebox(_435.options);
|
|
_42c(this);
|
|
});
|
|
};
|
|
$.fn.spinner.methods={options:function(jq){
|
|
var opts=$.data(jq[0],"spinner").options;
|
|
return $.extend(opts,{value:jq.val()});
|
|
},destroy:function(jq){
|
|
return jq.each(function(){
|
|
var _436=$.data(this,"spinner").spinner;
|
|
$(this).validatebox("destroy");
|
|
_436.remove();
|
|
});
|
|
},resize:function(jq,_437){
|
|
return jq.each(function(){
|
|
_426(this,_437);
|
|
});
|
|
},enable:function(jq){
|
|
return jq.each(function(){
|
|
_42f(this,false);
|
|
_42c(this);
|
|
});
|
|
},disable:function(jq){
|
|
return jq.each(function(){
|
|
_42f(this,true);
|
|
_42c(this);
|
|
});
|
|
},getValue:function(jq){
|
|
return jq.val();
|
|
},setValue:function(jq,_438){
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"spinner").options;
|
|
opts.value=_438;
|
|
$(this).val(_438);
|
|
});
|
|
},clear:function(jq){
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"spinner").options;
|
|
opts.value="";
|
|
$(this).val("");
|
|
});
|
|
},reset:function(jq){
|
|
return jq.each(function(){
|
|
var opts=$(this).spinner("options");
|
|
$(this).spinner("setValue",opts.originalValue);
|
|
});
|
|
}};
|
|
$.fn.spinner.parseOptions=function(_439){
|
|
var t=$(_439);
|
|
return $.extend({},$.fn.validatebox.parseOptions(_439),$.parser.parseOptions(_439,["width","height","min","max",{increment:"number",editable:"boolean"}]),{value:(t.val()||undefined),disabled:(t.attr("disabled")?true:undefined)});
|
|
};
|
|
$.fn.spinner.defaults=$.extend({},$.fn.validatebox.defaults,{width:"auto",height:22,value:"",min:null,max:null,increment:1,editable:true,disabled:false,spin:function(down){
|
|
},onSpinUp:function(){
|
|
},onSpinDown:function(){
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
function _43a(_43b){
|
|
$(_43b).addClass("numberspinner-f");
|
|
var opts=$.data(_43b,"numberspinner").options;
|
|
$(_43b).spinner(opts).numberbox(opts);
|
|
};
|
|
function _43c(_43d,down){
|
|
var opts=$.data(_43d,"numberspinner").options;
|
|
var v=parseFloat($(_43d).numberbox("getValue")||opts.value)||0;
|
|
if(down==true){
|
|
v-=opts.increment;
|
|
}else{
|
|
v+=opts.increment;
|
|
}
|
|
$(_43d).numberbox("setValue",v);
|
|
};
|
|
$.fn.numberspinner=function(_43e,_43f){
|
|
if(typeof _43e=="string"){
|
|
var _440=$.fn.numberspinner.methods[_43e];
|
|
if(_440){
|
|
return _440(this,_43f);
|
|
}else{
|
|
return this.spinner(_43e,_43f);
|
|
}
|
|
}
|
|
_43e=_43e||{};
|
|
return this.each(function(){
|
|
var _441=$.data(this,"numberspinner");
|
|
if(_441){
|
|
$.extend(_441.options,_43e);
|
|
}else{
|
|
$.data(this,"numberspinner",{options:$.extend({},$.fn.numberspinner.defaults,$.fn.numberspinner.parseOptions(this),_43e)});
|
|
}
|
|
_43a(this);
|
|
});
|
|
};
|
|
$.fn.numberspinner.methods={options:function(jq){
|
|
var opts=$.data(jq[0],"numberspinner").options;
|
|
return $.extend(opts,{value:jq.numberbox("getValue"),originalValue:jq.numberbox("options").originalValue});
|
|
},setValue:function(jq,_442){
|
|
return jq.each(function(){
|
|
$(this).numberbox("setValue",_442);
|
|
});
|
|
},getValue:function(jq){
|
|
return jq.numberbox("getValue");
|
|
},clear:function(jq){
|
|
return jq.each(function(){
|
|
$(this).spinner("clear");
|
|
$(this).numberbox("clear");
|
|
});
|
|
},reset:function(jq){
|
|
return jq.each(function(){
|
|
var opts=$(this).numberspinner("options");
|
|
$(this).numberspinner("setValue",opts.originalValue);
|
|
});
|
|
}};
|
|
$.fn.numberspinner.parseOptions=function(_443){
|
|
return $.extend({},$.fn.spinner.parseOptions(_443),$.fn.numberbox.parseOptions(_443),{});
|
|
};
|
|
$.fn.numberspinner.defaults=$.extend({},$.fn.spinner.defaults,$.fn.numberbox.defaults,{spin:function(down){
|
|
_43c(this,down);
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
function _444(_445){
|
|
var opts=$.data(_445,"timespinner").options;
|
|
$(_445).addClass("timespinner-f");
|
|
$(_445).spinner(opts);
|
|
$(_445).unbind(".timespinner");
|
|
$(_445).bind("click.timespinner",function(){
|
|
var _446=0;
|
|
if(this.selectionStart!=null){
|
|
_446=this.selectionStart;
|
|
}else{
|
|
if(this.createTextRange){
|
|
var _447=_445.createTextRange();
|
|
var s=document.selection.createRange();
|
|
s.setEndPoint("StartToStart",_447);
|
|
_446=s.text.length;
|
|
}
|
|
}
|
|
if(_446>=0&&_446<=2){
|
|
opts.highlight=0;
|
|
}else{
|
|
if(_446>=3&&_446<=5){
|
|
opts.highlight=1;
|
|
}else{
|
|
if(_446>=6&&_446<=8){
|
|
opts.highlight=2;
|
|
}
|
|
}
|
|
}
|
|
_449(_445);
|
|
}).bind("blur.timespinner",function(){
|
|
_448(_445);
|
|
});
|
|
};
|
|
function _449(_44a){
|
|
var opts=$.data(_44a,"timespinner").options;
|
|
var _44b=0,end=0;
|
|
if(opts.highlight==0){
|
|
_44b=0;
|
|
end=2;
|
|
}else{
|
|
if(opts.highlight==1){
|
|
_44b=3;
|
|
end=5;
|
|
}else{
|
|
if(opts.highlight==2){
|
|
_44b=6;
|
|
end=8;
|
|
}
|
|
}
|
|
}
|
|
if(_44a.selectionStart!=null){
|
|
_44a.setSelectionRange(_44b,end);
|
|
}else{
|
|
if(_44a.createTextRange){
|
|
var _44c=_44a.createTextRange();
|
|
_44c.collapse();
|
|
_44c.moveEnd("character",end);
|
|
_44c.moveStart("character",_44b);
|
|
_44c.select();
|
|
}
|
|
}
|
|
$(_44a).focus();
|
|
};
|
|
function _44d(_44e,_44f){
|
|
var opts=$.data(_44e,"timespinner").options;
|
|
if(!_44f){
|
|
return null;
|
|
}
|
|
var vv=_44f.split(opts.separator);
|
|
for(var i=0;i<vv.length;i++){
|
|
if(isNaN(vv[i])){
|
|
return null;
|
|
}
|
|
}
|
|
while(vv.length<3){
|
|
vv.push(0);
|
|
}
|
|
return new Date(1900,0,0,vv[0],vv[1],vv[2]);
|
|
};
|
|
function _448(_450){
|
|
var opts=$.data(_450,"timespinner").options;
|
|
var _451=$(_450).val();
|
|
var time=_44d(_450,_451);
|
|
if(!time){
|
|
time=_44d(_450,opts.value);
|
|
}
|
|
if(!time){
|
|
opts.value="";
|
|
$(_450).val("");
|
|
return;
|
|
}
|
|
var _452=_44d(_450,opts.min);
|
|
var _453=_44d(_450,opts.max);
|
|
if(_452&&_452>time){
|
|
time=_452;
|
|
}
|
|
if(_453&&_453<time){
|
|
time=_453;
|
|
}
|
|
var tt=[_454(time.getHours()),_454(time.getMinutes())];
|
|
if(opts.showSeconds){
|
|
tt.push(_454(time.getSeconds()));
|
|
}
|
|
var val=tt.join(opts.separator);
|
|
opts.value=val;
|
|
$(_450).val(val);
|
|
function _454(_455){
|
|
return (_455<10?"0":"")+_455;
|
|
};
|
|
};
|
|
function _456(_457,down){
|
|
var opts=$.data(_457,"timespinner").options;
|
|
var val=$(_457).val();
|
|
if(val==""){
|
|
val=[0,0,0].join(opts.separator);
|
|
}
|
|
var vv=val.split(opts.separator);
|
|
for(var i=0;i<vv.length;i++){
|
|
vv[i]=parseInt(vv[i],10);
|
|
}
|
|
if(down==true){
|
|
vv[opts.highlight]-=opts.increment;
|
|
}else{
|
|
vv[opts.highlight]+=opts.increment;
|
|
}
|
|
$(_457).val(vv.join(opts.separator));
|
|
_448(_457);
|
|
_449(_457);
|
|
};
|
|
$.fn.timespinner=function(_458,_459){
|
|
if(typeof _458=="string"){
|
|
var _45a=$.fn.timespinner.methods[_458];
|
|
if(_45a){
|
|
return _45a(this,_459);
|
|
}else{
|
|
return this.spinner(_458,_459);
|
|
}
|
|
}
|
|
_458=_458||{};
|
|
return this.each(function(){
|
|
var _45b=$.data(this,"timespinner");
|
|
if(_45b){
|
|
$.extend(_45b.options,_458);
|
|
}else{
|
|
$.data(this,"timespinner",{options:$.extend({},$.fn.timespinner.defaults,$.fn.timespinner.parseOptions(this),_458)});
|
|
_444(this);
|
|
}
|
|
});
|
|
};
|
|
$.fn.timespinner.methods={options:function(jq){
|
|
var opts=$.data(jq[0],"timespinner").options;
|
|
return $.extend(opts,{value:jq.val(),originalValue:jq.spinner("options").originalValue});
|
|
},setValue:function(jq,_45c){
|
|
return jq.each(function(){
|
|
$(this).val(_45c);
|
|
_448(this);
|
|
});
|
|
},getHours:function(jq){
|
|
var opts=$.data(jq[0],"timespinner").options;
|
|
var vv=jq.val().split(opts.separator);
|
|
return parseInt(vv[0],10);
|
|
},getMinutes:function(jq){
|
|
var opts=$.data(jq[0],"timespinner").options;
|
|
var vv=jq.val().split(opts.separator);
|
|
return parseInt(vv[1],10);
|
|
},getSeconds:function(jq){
|
|
var opts=$.data(jq[0],"timespinner").options;
|
|
var vv=jq.val().split(opts.separator);
|
|
return parseInt(vv[2],10)||0;
|
|
}};
|
|
$.fn.timespinner.parseOptions=function(_45d){
|
|
return $.extend({},$.fn.spinner.parseOptions(_45d),$.parser.parseOptions(_45d,["separator",{showSeconds:"boolean",highlight:"number"}]));
|
|
};
|
|
$.fn.timespinner.defaults=$.extend({},$.fn.spinner.defaults,{separator:":",showSeconds:false,highlight:0,spin:function(down){
|
|
_456(this,down);
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
var _45e=0;
|
|
function _45f(a,o){
|
|
for(var i=0,len=a.length;i<len;i++){
|
|
if(a[i]==o){
|
|
return i;
|
|
}
|
|
}
|
|
return -1;
|
|
};
|
|
function _460(a,o,id){
|
|
if(typeof o=="string"){
|
|
for(var i=0,len=a.length;i<len;i++){
|
|
if(a[i][o]==id){
|
|
a.splice(i,1);
|
|
return;
|
|
}
|
|
}
|
|
}else{
|
|
var _461=_45f(a,o);
|
|
if(_461!=-1){
|
|
a.splice(_461,1);
|
|
}
|
|
}
|
|
};
|
|
function _462(a,o,r){
|
|
for(var i=0,len=a.length;i<len;i++){
|
|
if(a[i][o]==r[o]){
|
|
return;
|
|
}
|
|
}
|
|
a.push(r);
|
|
};
|
|
function _463(_464,_465){
|
|
var opts=$.data(_464,"datagrid").options;
|
|
var _466=$.data(_464,"datagrid").panel;
|
|
if(_465){
|
|
if(_465.width){
|
|
opts.width=_465.width;
|
|
}
|
|
if(_465.height){
|
|
opts.height=_465.height;
|
|
}
|
|
}
|
|
if(opts.fit==true){
|
|
var p=_466.panel("panel").parent();
|
|
opts.width=p.width();
|
|
opts.height=p.height();
|
|
}
|
|
_466.panel("resize",{width:opts.width,height:opts.height});
|
|
};
|
|
function _467(_468){
|
|
var opts=$.data(_468,"datagrid").options;
|
|
var dc=$.data(_468,"datagrid").dc;
|
|
var wrap=$.data(_468,"datagrid").panel;
|
|
var _469=wrap.width();
|
|
var _46a=wrap.height();
|
|
var view=dc.view;
|
|
var _46b=dc.view1;
|
|
var _46c=dc.view2;
|
|
var _46d=_46b.children("div.datagrid-header");
|
|
var _46e=_46c.children("div.datagrid-header");
|
|
var _46f=_46d.find("table");
|
|
var _470=_46e.find("table");
|
|
view.width(_469);
|
|
var _471=_46d.children("div.datagrid-header-inner").show();
|
|
_46b.width(_471.find("table").width());
|
|
if(!opts.showHeader){
|
|
_471.hide();
|
|
}
|
|
_46c.width(_469-_46b._outerWidth());
|
|
_46b.children("div.datagrid-header,div.datagrid-body,div.datagrid-footer").width(_46b.width());
|
|
_46c.children("div.datagrid-header,div.datagrid-body,div.datagrid-footer").width(_46c.width());
|
|
var hh;
|
|
_46d.css("height","");
|
|
_46e.css("height","");
|
|
_46f.css("height","");
|
|
_470.css("height","");
|
|
hh=Math.max(_46f.height(),_470.height());
|
|
_46f.height(hh);
|
|
_470.height(hh);
|
|
_46d.add(_46e)._outerHeight(hh);
|
|
if(opts.height!="auto"){
|
|
var _472=_46a-_46c.children("div.datagrid-header")._outerHeight()-_46c.children("div.datagrid-footer")._outerHeight()-wrap.children("div.datagrid-toolbar")._outerHeight();
|
|
wrap.children("div.datagrid-pager").each(function(){
|
|
_472-=$(this)._outerHeight();
|
|
});
|
|
dc.body1.add(dc.body2).children("table.datagrid-btable-frozen").css({position:"absolute",top:dc.header2._outerHeight()});
|
|
var _473=dc.body2.children("table.datagrid-btable-frozen")._outerHeight();
|
|
_46b.add(_46c).children("div.datagrid-body").css({marginTop:_473,height:(_472-_473)});
|
|
}
|
|
view.height(_46c.height());
|
|
};
|
|
function _474(_475,_476,_477){
|
|
var rows=$.data(_475,"datagrid").data.rows;
|
|
var opts=$.data(_475,"datagrid").options;
|
|
var dc=$.data(_475,"datagrid").dc;
|
|
if(!dc.body1.is(":empty")&&(!opts.nowrap||opts.autoRowHeight||_477)){
|
|
if(_476!=undefined){
|
|
var tr1=opts.finder.getTr(_475,_476,"body",1);
|
|
var tr2=opts.finder.getTr(_475,_476,"body",2);
|
|
_478(tr1,tr2);
|
|
}else{
|
|
var tr1=opts.finder.getTr(_475,0,"allbody",1);
|
|
var tr2=opts.finder.getTr(_475,0,"allbody",2);
|
|
_478(tr1,tr2);
|
|
if(opts.showFooter){
|
|
var tr1=opts.finder.getTr(_475,0,"allfooter",1);
|
|
var tr2=opts.finder.getTr(_475,0,"allfooter",2);
|
|
_478(tr1,tr2);
|
|
}
|
|
}
|
|
}
|
|
_467(_475);
|
|
if(opts.height=="auto"){
|
|
var _479=dc.body1.parent();
|
|
var _47a=dc.body2;
|
|
var _47b=0;
|
|
var _47c=0;
|
|
_47a.children().each(function(){
|
|
var c=$(this);
|
|
if(c.is(":visible")){
|
|
_47b+=c._outerHeight();
|
|
if(_47c<c._outerWidth()){
|
|
_47c=c._outerWidth();
|
|
}
|
|
}
|
|
});
|
|
if(_47c>_47a.width()){
|
|
_47b+=18;
|
|
}
|
|
_479.height(_47b);
|
|
_47a.height(_47b);
|
|
dc.view.height(dc.view2.height());
|
|
}
|
|
dc.body2.triggerHandler("scroll");
|
|
function _478(trs1,trs2){
|
|
for(var i=0;i<trs2.length;i++){
|
|
var tr1=$(trs1[i]);
|
|
var tr2=$(trs2[i]);
|
|
tr1.css("height","");
|
|
tr2.css("height","");
|
|
var _47d=Math.max(tr1.height(),tr2.height());
|
|
tr1.css("height",_47d);
|
|
tr2.css("height",_47d);
|
|
}
|
|
};
|
|
};
|
|
function _47e(_47f,_480){
|
|
var _481=$.data(_47f,"datagrid");
|
|
var opts=_481.options;
|
|
var dc=_481.dc;
|
|
if(!dc.body2.children("table.datagrid-btable-frozen").length){
|
|
dc.body1.add(dc.body2).prepend("<table class=\"datagrid-btable datagrid-btable-frozen\" cellspacing=\"0\" cellpadding=\"0\"></table>");
|
|
}
|
|
_482(true);
|
|
_482(false);
|
|
_467(_47f);
|
|
function _482(_483){
|
|
var _484=_483?1:2;
|
|
var tr=opts.finder.getTr(_47f,_480,"body",_484);
|
|
(_483?dc.body1:dc.body2).children("table.datagrid-btable-frozen").append(tr);
|
|
};
|
|
};
|
|
function _485(_486,_487){
|
|
function _488(){
|
|
var _489=[];
|
|
var _48a=[];
|
|
$(_486).children("thead").each(function(){
|
|
var opt=$.parser.parseOptions(this,[{frozen:"boolean"}]);
|
|
$(this).find("tr").each(function(){
|
|
var cols=[];
|
|
$(this).find("th").each(function(){
|
|
var th=$(this);
|
|
var col=$.extend({},$.parser.parseOptions(this,["field","align","halign","order",{sortable:"boolean",checkbox:"boolean",resizable:"boolean"},{rowspan:"number",colspan:"number",width:"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(th.attr("editor")){
|
|
var s=$.trim(th.attr("editor"));
|
|
if(s.substr(0,1)=="{"){
|
|
col.editor=eval("("+s+")");
|
|
}else{
|
|
col.editor=s;
|
|
}
|
|
}
|
|
cols.push(col);
|
|
});
|
|
opt.frozen?_489.push(cols):_48a.push(cols);
|
|
});
|
|
});
|
|
return [_489,_48a];
|
|
};
|
|
var _48b=$("<div class=\"datagrid-wrap\">"+"<div class=\"datagrid-view\">"+"<div class=\"datagrid-view1\">"+"<div class=\"datagrid-header\">"+"<div class=\"datagrid-header-inner\"></div>"+"</div>"+"<div class=\"datagrid-body\">"+"<div class=\"datagrid-body-inner\"></div>"+"</div>"+"<div class=\"datagrid-footer\">"+"<div class=\"datagrid-footer-inner\"></div>"+"</div>"+"</div>"+"<div class=\"datagrid-view2\">"+"<div class=\"datagrid-header\">"+"<div class=\"datagrid-header-inner\"></div>"+"</div>"+"<div class=\"datagrid-body\"></div>"+"<div class=\"datagrid-footer\">"+"<div class=\"datagrid-footer-inner\"></div>"+"</div>"+"</div>"+"</div>"+"</div>").insertAfter(_486);
|
|
_48b.panel({doSize:false});
|
|
_48b.panel("panel").addClass("datagrid").bind("_resize",function(e,_48c){
|
|
var opts=$.data(_486,"datagrid").options;
|
|
if(opts.fit==true||_48c){
|
|
_463(_486);
|
|
setTimeout(function(){
|
|
if($.data(_486,"datagrid")){
|
|
_48d(_486);
|
|
}
|
|
},0);
|
|
}
|
|
return false;
|
|
});
|
|
$(_486).hide().appendTo(_48b.children("div.datagrid-view"));
|
|
var cc=_488();
|
|
var view=_48b.children("div.datagrid-view");
|
|
var _48e=view.children("div.datagrid-view1");
|
|
var _48f=view.children("div.datagrid-view2");
|
|
return {panel:_48b,frozenColumns:cc[0],columns:cc[1],dc:{view:view,view1:_48e,view2:_48f,header1:_48e.children("div.datagrid-header").children("div.datagrid-header-inner"),header2:_48f.children("div.datagrid-header").children("div.datagrid-header-inner"),body1:_48e.children("div.datagrid-body").children("div.datagrid-body-inner"),body2:_48f.children("div.datagrid-body"),footer1:_48e.children("div.datagrid-footer").children("div.datagrid-footer-inner"),footer2:_48f.children("div.datagrid-footer").children("div.datagrid-footer-inner")}};
|
|
};
|
|
function _490(_491){
|
|
var data={total:0,rows:[]};
|
|
var _492=_493(_491,true).concat(_493(_491,false));
|
|
$(_491).find("tbody tr").each(function(){
|
|
data.total++;
|
|
var col={};
|
|
for(var i=0;i<_492.length;i++){
|
|
col[_492[i]]=$("td:eq("+i+")",this).html();
|
|
}
|
|
data.rows.push(col);
|
|
});
|
|
return data;
|
|
};
|
|
function _494(_495){
|
|
var _496=$.data(_495,"datagrid");
|
|
var opts=_496.options;
|
|
var dc=_496.dc;
|
|
var _497=_496.panel;
|
|
_497.panel($.extend({},opts,{id:null,doSize:false,onResize:function(_498,_499){
|
|
setTimeout(function(){
|
|
if($.data(_495,"datagrid")){
|
|
_467(_495);
|
|
_4b7(_495);
|
|
opts.onResize.call(_497,_498,_499);
|
|
}
|
|
},0);
|
|
},onExpand:function(){
|
|
_474(_495);
|
|
opts.onExpand.call(_497);
|
|
}}));
|
|
_496.rowIdPrefix="datagrid-row-r"+(++_45e);
|
|
_49a(dc.header1,opts.frozenColumns,true);
|
|
_49a(dc.header2,opts.columns,false);
|
|
_49b();
|
|
dc.header1.add(dc.header2).css("display",opts.showHeader?"block":"none");
|
|
dc.footer1.add(dc.footer2).css("display",opts.showFooter?"block":"none");
|
|
if(opts.toolbar){
|
|
if(typeof opts.toolbar=="string"){
|
|
$(opts.toolbar).addClass("datagrid-toolbar").prependTo(_497);
|
|
$(opts.toolbar).show();
|
|
}else{
|
|
$("div.datagrid-toolbar",_497).remove();
|
|
var tb=$("<div class=\"datagrid-toolbar\"><table cellspacing=\"0\" cellpadding=\"0\"><tr></tr></table></div>").prependTo(_497);
|
|
var tr=tb.find("tr");
|
|
for(var i=0;i<opts.toolbar.length;i++){
|
|
var btn=opts.toolbar[i];
|
|
if(btn=="-"){
|
|
$("<td><div class=\"datagrid-btn-separator\"></div></td>").appendTo(tr);
|
|
}else{
|
|
var td=$("<td></td>").appendTo(tr);
|
|
var tool=$("<a href=\"javascript:void(0)\"></a>").appendTo(td);
|
|
tool[0].onclick=eval(btn.handler||function(){
|
|
});
|
|
tool.linkbutton($.extend({},btn,{plain:true}));
|
|
}
|
|
}
|
|
}
|
|
}else{
|
|
$("div.datagrid-toolbar",_497).remove();
|
|
}
|
|
$("div.datagrid-pager",_497).remove();
|
|
if(opts.pagination){
|
|
var _49c=$("<div class=\"datagrid-pager\"></div>");
|
|
if(opts.pagePosition=="bottom"){
|
|
_49c.appendTo(_497);
|
|
}else{
|
|
if(opts.pagePosition=="top"){
|
|
_49c.addClass("datagrid-pager-top").prependTo(_497);
|
|
}else{
|
|
var ptop=$("<div class=\"datagrid-pager datagrid-pager-top\"></div>").prependTo(_497);
|
|
_49c.appendTo(_497);
|
|
_49c=_49c.add(ptop);
|
|
}
|
|
}
|
|
_49c.pagination({total:0,pageNumber:opts.pageNumber,pageSize:opts.pageSize,pageList:opts.pageList,onSelectPage:function(_49d,_49e){
|
|
opts.pageNumber=_49d;
|
|
opts.pageSize=_49e;
|
|
_49c.pagination("refresh",{pageNumber:_49d,pageSize:_49e});
|
|
_576(_495);
|
|
}});
|
|
opts.pageSize=_49c.pagination("options").pageSize;
|
|
}
|
|
function _49a(_49f,_4a0,_4a1){
|
|
if(!_4a0){
|
|
return;
|
|
}
|
|
$(_49f).show();
|
|
$(_49f).empty();
|
|
var t=$("<table class=\"datagrid-htable\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tbody></tbody></table>").appendTo(_49f);
|
|
for(var i=0;i<_4a0.length;i++){
|
|
var tr=$("<tr class=\"datagrid-header-row\"></tr>").appendTo($("tbody",t));
|
|
var cols=_4a0[i];
|
|
for(var j=0;j<cols.length;j++){
|
|
var col=cols[j];
|
|
var attr="";
|
|
if(col.rowspan){
|
|
attr+="rowspan=\""+col.rowspan+"\" ";
|
|
}
|
|
if(col.colspan){
|
|
attr+="colspan=\""+col.colspan+"\" ";
|
|
}
|
|
var td=$("<td "+attr+"></td>").appendTo(tr);
|
|
if(col.checkbox){
|
|
td.attr("field",col.field);
|
|
$("<div class=\"datagrid-header-check\"></div>").html("<input type=\"checkbox\"/>").appendTo(td);
|
|
}else{
|
|
if(col.field){
|
|
td.attr("field",col.field);
|
|
td.append("<div class=\"datagrid-cell\"><span></span><span class=\"datagrid-sort-icon\"></span></div>");
|
|
$("span",td).html(col.title);
|
|
$("span.datagrid-sort-icon",td).html(" ");
|
|
var cell=td.find("div.datagrid-cell");
|
|
if(col.resizable==false){
|
|
cell.attr("resizable","false");
|
|
}
|
|
if(col.width){
|
|
cell._outerWidth(col.width);
|
|
col.boxWidth=parseInt(cell[0].style.width);
|
|
}else{
|
|
col.auto=true;
|
|
}
|
|
cell.css("text-align",(col.halign||col.align||""));
|
|
col.cellClass="datagrid-cell-c"+_45e+"-"+col.field.replace(/\./g,"-");
|
|
col.cellSelector="div."+col.cellClass;
|
|
}else{
|
|
$("<div class=\"datagrid-cell-group\"></div>").html(col.title).appendTo(td);
|
|
}
|
|
}
|
|
if(col.hidden){
|
|
td.hide();
|
|
}
|
|
}
|
|
}
|
|
if(_4a1&&opts.rownumbers){
|
|
var td=$("<td rowspan=\""+opts.frozenColumns.length+"\"><div class=\"datagrid-header-rownumber\"></div></td>");
|
|
if($("tr",t).length==0){
|
|
td.wrap("<tr class=\"datagrid-header-row\"></tr>").parent().appendTo($("tbody",t));
|
|
}else{
|
|
td.prependTo($("tr:first",t));
|
|
}
|
|
}
|
|
};
|
|
function _49b(){
|
|
var ss=["<style type=\"text/css\">"];
|
|
var _4a2=_493(_495,true).concat(_493(_495));
|
|
for(var i=0;i<_4a2.length;i++){
|
|
var col=_4a3(_495,_4a2[i]);
|
|
if(col&&!col.checkbox){
|
|
ss.push(col.cellSelector+" {width:"+col.boxWidth+"px;}");
|
|
}
|
|
}
|
|
ss.push("</style>");
|
|
$(ss.join("\n")).prependTo(dc.view);
|
|
};
|
|
};
|
|
function _4a4(_4a5){
|
|
var _4a6=$.data(_4a5,"datagrid");
|
|
var _4a7=_4a6.panel;
|
|
var opts=_4a6.options;
|
|
var dc=_4a6.dc;
|
|
var _4a8=dc.header1.add(dc.header2);
|
|
_4a8.find("input[type=checkbox]").unbind(".datagrid").bind("click.datagrid",function(e){
|
|
if(opts.singleSelect&&opts.selectOnCheck){
|
|
return false;
|
|
}
|
|
if($(this).is(":checked")){
|
|
_511(_4a5);
|
|
}else{
|
|
_517(_4a5);
|
|
}
|
|
e.stopPropagation();
|
|
});
|
|
var _4a9=_4a8.find("div.datagrid-cell");
|
|
_4a9.closest("td").unbind(".datagrid").bind("mouseenter.datagrid",function(){
|
|
if(_4a6.resizing){
|
|
return;
|
|
}
|
|
$(this).addClass("datagrid-header-over");
|
|
}).bind("mouseleave.datagrid",function(){
|
|
$(this).removeClass("datagrid-header-over");
|
|
}).bind("contextmenu.datagrid",function(e){
|
|
var _4aa=$(this).attr("field");
|
|
opts.onHeaderContextMenu.call(_4a5,e,_4aa);
|
|
});
|
|
_4a9.unbind(".datagrid").bind("click.datagrid",function(e){
|
|
var p1=$(this).offset().left+5;
|
|
var p2=$(this).offset().left+$(this)._outerWidth()-5;
|
|
if(e.pageX<p2&&e.pageX>p1){
|
|
var _4ab=$(this).parent().attr("field");
|
|
var col=_4a3(_4a5,_4ab);
|
|
if(!col.sortable||_4a6.resizing){
|
|
return;
|
|
}
|
|
opts.sortName=_4ab;
|
|
opts.sortOrder=col.order||"asc";
|
|
var cls="datagrid-sort-"+opts.sortOrder;
|
|
if($(this).hasClass("datagrid-sort-asc")){
|
|
cls="datagrid-sort-desc";
|
|
opts.sortOrder="desc";
|
|
}else{
|
|
if($(this).hasClass("datagrid-sort-desc")){
|
|
cls="datagrid-sort-asc";
|
|
opts.sortOrder="asc";
|
|
}
|
|
}
|
|
_4a9.removeClass("datagrid-sort-asc datagrid-sort-desc");
|
|
$(this).addClass(cls);
|
|
if(opts.remoteSort){
|
|
_576(_4a5);
|
|
}else{
|
|
var data=$.data(_4a5,"datagrid").data;
|
|
_4e5(_4a5,data);
|
|
}
|
|
opts.onSortColumn.call(_4a5,opts.sortName,opts.sortOrder);
|
|
}
|
|
}).bind("dblclick.datagrid",function(e){
|
|
var p1=$(this).offset().left+5;
|
|
var p2=$(this).offset().left+$(this)._outerWidth()-5;
|
|
var cond=opts.resizeHandle=="right"?(e.pageX>p2):(opts.resizeHandle=="left"?(e.pageX<p1):(e.pageX<p1||e.pageX>p2));
|
|
if(cond){
|
|
var _4ac=$(this).parent().attr("field");
|
|
var col=_4a3(_4a5,_4ac);
|
|
if(col.resizable==false){
|
|
return;
|
|
}
|
|
$(_4a5).datagrid("autoSizeColumn",_4ac);
|
|
col.auto=false;
|
|
}
|
|
});
|
|
var _4ad=opts.resizeHandle=="right"?"e":(opts.resizeHandle=="left"?"w":"e,w");
|
|
_4a9.each(function(){
|
|
$(this).resizable({handles:_4ad,disabled:($(this).attr("resizable")?$(this).attr("resizable")=="false":false),minWidth:25,onStartResize:function(e){
|
|
_4a6.resizing=true;
|
|
_4a8.css("cursor",$("body").css("cursor"));
|
|
if(!_4a6.proxy){
|
|
_4a6.proxy=$("<div class=\"datagrid-resize-proxy\"></div>").appendTo(dc.view);
|
|
}
|
|
_4a6.proxy.css({left:e.pageX-$(_4a7).offset().left-1,display:"none"});
|
|
setTimeout(function(){
|
|
if(_4a6.proxy){
|
|
_4a6.proxy.show();
|
|
}
|
|
},500);
|
|
},onResize:function(e){
|
|
_4a6.proxy.css({left:e.pageX-$(_4a7).offset().left-1,display:"block"});
|
|
return false;
|
|
},onStopResize:function(e){
|
|
_4a8.css("cursor","");
|
|
var _4ae=$(this).parent().attr("field");
|
|
var col=_4a3(_4a5,_4ae);
|
|
col.width=$(this)._outerWidth();
|
|
col.boxWidth=parseInt(this.style.width);
|
|
col.auto=undefined;
|
|
_48d(_4a5,_4ae);
|
|
_4a6.proxy.remove();
|
|
_4a6.proxy=null;
|
|
if($(this).parents("div:first.datagrid-header").parent().hasClass("datagrid-view1")){
|
|
_467(_4a5);
|
|
}
|
|
_4b7(_4a5);
|
|
opts.onResizeColumn.call(_4a5,_4ae,col.width);
|
|
setTimeout(function(){
|
|
_4a6.resizing=false;
|
|
},0);
|
|
}});
|
|
});
|
|
dc.body1.add(dc.body2).unbind().bind("mouseover",function(e){
|
|
if(_4a6.resizing){
|
|
return;
|
|
}
|
|
var tr=$(e.target).closest("tr.datagrid-row");
|
|
if(!tr.length){
|
|
return;
|
|
}
|
|
var _4af=_4b0(tr);
|
|
opts.finder.getTr(_4a5,_4af).addClass("datagrid-row-over");
|
|
e.stopPropagation();
|
|
}).bind("mouseout",function(e){
|
|
var tr=$(e.target).closest("tr.datagrid-row");
|
|
if(!tr.length){
|
|
return;
|
|
}
|
|
var _4b1=_4b0(tr);
|
|
opts.finder.getTr(_4a5,_4b1).removeClass("datagrid-row-over");
|
|
e.stopPropagation();
|
|
}).bind("click",function(e){
|
|
var tt=$(e.target);
|
|
var tr=tt.closest("tr.datagrid-row");
|
|
if(!tr.length){
|
|
return;
|
|
}
|
|
var _4b2=_4b0(tr);
|
|
if(tt.parent().hasClass("datagrid-cell-check")){
|
|
if(opts.singleSelect&&opts.selectOnCheck){
|
|
if(!opts.checkOnSelect){
|
|
_517(_4a5,true);
|
|
}
|
|
_501(_4a5,_4b2);
|
|
}else{
|
|
if(tt.is(":checked")){
|
|
_501(_4a5,_4b2);
|
|
}else{
|
|
_50b(_4a5,_4b2);
|
|
}
|
|
}
|
|
}else{
|
|
var row=opts.finder.getRow(_4a5,_4b2);
|
|
var td=tt.closest("td[field]",tr);
|
|
if(td.length){
|
|
var _4b3=td.attr("field");
|
|
opts.onClickCell.call(_4a5,_4b2,_4b3,row[_4b3]);
|
|
}
|
|
if(opts.singleSelect==true){
|
|
_4fa(_4a5,_4b2);
|
|
}else{
|
|
if(tr.hasClass("datagrid-row-selected")){
|
|
_505(_4a5,_4b2);
|
|
}else{
|
|
_4fa(_4a5,_4b2);
|
|
}
|
|
}
|
|
opts.onClickRow.call(_4a5,_4b2,row);
|
|
}
|
|
e.stopPropagation();
|
|
}).bind("dblclick",function(e){
|
|
var tt=$(e.target);
|
|
var tr=tt.closest("tr.datagrid-row");
|
|
if(!tr.length){
|
|
return;
|
|
}
|
|
var _4b4=_4b0(tr);
|
|
var row=opts.finder.getRow(_4a5,_4b4);
|
|
var td=tt.closest("td[field]",tr);
|
|
if(td.length){
|
|
var _4b5=td.attr("field");
|
|
opts.onDblClickCell.call(_4a5,_4b4,_4b5,row[_4b5]);
|
|
}
|
|
opts.onDblClickRow.call(_4a5,_4b4,row);
|
|
e.stopPropagation();
|
|
}).bind("contextmenu",function(e){
|
|
var tr=$(e.target).closest("tr.datagrid-row");
|
|
if(!tr.length){
|
|
return;
|
|
}
|
|
var _4b6=_4b0(tr);
|
|
var row=opts.finder.getRow(_4a5,_4b6);
|
|
opts.onRowContextMenu.call(_4a5,e,_4b6,row);
|
|
e.stopPropagation();
|
|
});
|
|
dc.body2.bind("scroll",function(){
|
|
dc.view1.children("div.datagrid-body").scrollTop($(this).scrollTop());
|
|
dc.view2.children("div.datagrid-header,div.datagrid-footer")._scrollLeft($(this)._scrollLeft());
|
|
dc.body2.children("table.datagrid-btable-frozen").css("left",-$(this)._scrollLeft());
|
|
});
|
|
function _4b0(tr){
|
|
if(tr.attr("datagrid-row-index")){
|
|
return parseInt(tr.attr("datagrid-row-index"));
|
|
}else{
|
|
return tr.attr("node-id");
|
|
}
|
|
};
|
|
};
|
|
function _4b7(_4b8){
|
|
var opts=$.data(_4b8,"datagrid").options;
|
|
var dc=$.data(_4b8,"datagrid").dc;
|
|
if(!opts.fitColumns){
|
|
return;
|
|
}
|
|
var _4b9=dc.view2.children("div.datagrid-header");
|
|
var _4ba=0;
|
|
var _4bb;
|
|
var _4bc=_493(_4b8,false);
|
|
for(var i=0;i<_4bc.length;i++){
|
|
var col=_4a3(_4b8,_4bc[i]);
|
|
if(_4bd(col)){
|
|
_4ba+=col.width;
|
|
_4bb=col;
|
|
}
|
|
}
|
|
var _4be=_4b9.children("div.datagrid-header-inner").show();
|
|
var _4bf=_4b9.width()-_4b9.find("table").width()-opts.scrollbarSize;
|
|
var rate=_4bf/_4ba;
|
|
if(!opts.showHeader){
|
|
_4be.hide();
|
|
}
|
|
for(var i=0;i<_4bc.length;i++){
|
|
var col=_4a3(_4b8,_4bc[i]);
|
|
if(_4bd(col)){
|
|
var _4c0=Math.floor(col.width*rate);
|
|
_4c1(col,_4c0);
|
|
_4bf-=_4c0;
|
|
}
|
|
}
|
|
if(_4bf&&_4bb){
|
|
_4c1(_4bb,_4bf);
|
|
}
|
|
_48d(_4b8);
|
|
function _4c1(col,_4c2){
|
|
col.width+=_4c2;
|
|
col.boxWidth+=_4c2;
|
|
_4b9.find("td[field=\""+col.field+"\"] div.datagrid-cell").width(col.boxWidth);
|
|
};
|
|
function _4bd(col){
|
|
if(!col.hidden&&!col.checkbox&&!col.auto){
|
|
return true;
|
|
}
|
|
};
|
|
};
|
|
function _4c3(_4c4,_4c5){
|
|
var opts=$.data(_4c4,"datagrid").options;
|
|
var dc=$.data(_4c4,"datagrid").dc;
|
|
if(_4c5){
|
|
_463(_4c5);
|
|
if(opts.fitColumns){
|
|
_467(_4c4);
|
|
_4b7(_4c4);
|
|
}
|
|
}else{
|
|
var _4c6=false;
|
|
var _4c7=_493(_4c4,true).concat(_493(_4c4,false));
|
|
for(var i=0;i<_4c7.length;i++){
|
|
var _4c5=_4c7[i];
|
|
var col=_4a3(_4c4,_4c5);
|
|
if(col.auto){
|
|
_463(_4c5);
|
|
_4c6=true;
|
|
}
|
|
}
|
|
if(_4c6&&opts.fitColumns){
|
|
_467(_4c4);
|
|
_4b7(_4c4);
|
|
}
|
|
}
|
|
function _463(_4c8){
|
|
var _4c9=dc.view.find("div.datagrid-header td[field=\""+_4c8+"\"] div.datagrid-cell");
|
|
_4c9.css("width","");
|
|
var col=$(_4c4).datagrid("getColumnOption",_4c8);
|
|
col.width=undefined;
|
|
col.boxWidth=undefined;
|
|
col.auto=true;
|
|
$(_4c4).datagrid("fixColumnSize",_4c8);
|
|
var _4ca=Math.max(_4c9._outerWidth(),_4cb("allbody"),_4cb("allfooter"));
|
|
_4c9._outerWidth(_4ca);
|
|
col.width=_4ca;
|
|
col.boxWidth=parseInt(_4c9[0].style.width);
|
|
$(_4c4).datagrid("fixColumnSize",_4c8);
|
|
opts.onResizeColumn.call(_4c4,_4c8,col.width);
|
|
function _4cb(type){
|
|
var _4cc=0;
|
|
opts.finder.getTr(_4c4,0,type).find("td[field=\""+_4c8+"\"] div.datagrid-cell").each(function(){
|
|
var w=$(this)._outerWidth();
|
|
if(_4cc<w){
|
|
_4cc=w;
|
|
}
|
|
});
|
|
return _4cc;
|
|
};
|
|
};
|
|
};
|
|
function _48d(_4cd,_4ce){
|
|
var opts=$.data(_4cd,"datagrid").options;
|
|
var dc=$.data(_4cd,"datagrid").dc;
|
|
var _4cf=dc.view.find("table.datagrid-btable,table.datagrid-ftable");
|
|
_4cf.css("table-layout","fixed");
|
|
if(_4ce){
|
|
fix(_4ce);
|
|
}else{
|
|
var ff=_493(_4cd,true).concat(_493(_4cd,false));
|
|
for(var i=0;i<ff.length;i++){
|
|
fix(ff[i]);
|
|
}
|
|
}
|
|
_4cf.css("table-layout","auto");
|
|
_4d0(_4cd);
|
|
setTimeout(function(){
|
|
_474(_4cd);
|
|
_4d8(_4cd);
|
|
},0);
|
|
function fix(_4d1){
|
|
var col=_4a3(_4cd,_4d1);
|
|
if(col.checkbox){
|
|
return;
|
|
}
|
|
var _4d2=dc.view.children("style")[0];
|
|
var _4d3=_4d2.styleSheet?_4d2.styleSheet:(_4d2.sheet||document.styleSheets[document.styleSheets.length-1]);
|
|
var _4d4=_4d3.cssRules||_4d3.rules;
|
|
for(var i=0,len=_4d4.length;i<len;i++){
|
|
var rule=_4d4[i];
|
|
if(rule.selectorText.toLowerCase()==col.cellSelector.toLowerCase()){
|
|
rule.style["width"]=col.boxWidth?col.boxWidth+"px":"auto";
|
|
break;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
function _4d0(_4d5){
|
|
var dc=$.data(_4d5,"datagrid").dc;
|
|
dc.body1.add(dc.body2).find("td.datagrid-td-merged").each(function(){
|
|
var td=$(this);
|
|
var _4d6=td.attr("colspan")||1;
|
|
var _4d7=_4a3(_4d5,td.attr("field")).width;
|
|
for(var i=1;i<_4d6;i++){
|
|
td=td.next();
|
|
_4d7+=_4a3(_4d5,td.attr("field")).width+1;
|
|
}
|
|
$(this).children("div.datagrid-cell")._outerWidth(_4d7);
|
|
});
|
|
};
|
|
function _4d8(_4d9){
|
|
var dc=$.data(_4d9,"datagrid").dc;
|
|
dc.view.find("div.datagrid-editable").each(function(){
|
|
var cell=$(this);
|
|
var _4da=cell.parent().attr("field");
|
|
var col=$(_4d9).datagrid("getColumnOption",_4da);
|
|
cell._outerWidth(col.width);
|
|
var ed=$.data(this,"datagrid.editor");
|
|
if(ed.actions.resize){
|
|
ed.actions.resize(ed.target,cell.width());
|
|
}
|
|
});
|
|
};
|
|
function _4a3(_4db,_4dc){
|
|
function find(_4dd){
|
|
if(_4dd){
|
|
for(var i=0;i<_4dd.length;i++){
|
|
var cc=_4dd[i];
|
|
for(var j=0;j<cc.length;j++){
|
|
var c=cc[j];
|
|
if(c.field==_4dc){
|
|
return c;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
};
|
|
var opts=$.data(_4db,"datagrid").options;
|
|
var col=find(opts.columns);
|
|
if(!col){
|
|
col=find(opts.frozenColumns);
|
|
}
|
|
return col;
|
|
};
|
|
function _493(_4de,_4df){
|
|
var opts=$.data(_4de,"datagrid").options;
|
|
var _4e0=(_4df==true)?(opts.frozenColumns||[[]]):opts.columns;
|
|
if(_4e0.length==0){
|
|
return [];
|
|
}
|
|
var _4e1=[];
|
|
function _4e2(_4e3){
|
|
var c=0;
|
|
var i=0;
|
|
while(true){
|
|
if(_4e1[i]==undefined){
|
|
if(c==_4e3){
|
|
return i;
|
|
}
|
|
c++;
|
|
}
|
|
i++;
|
|
}
|
|
};
|
|
function _4e4(r){
|
|
var ff=[];
|
|
var c=0;
|
|
for(var i=0;i<_4e0[r].length;i++){
|
|
var col=_4e0[r][i];
|
|
if(col.field){
|
|
ff.push([c,col.field]);
|
|
}
|
|
c+=parseInt(col.colspan||"1");
|
|
}
|
|
for(var i=0;i<ff.length;i++){
|
|
ff[i][0]=_4e2(ff[i][0]);
|
|
}
|
|
for(var i=0;i<ff.length;i++){
|
|
var f=ff[i];
|
|
_4e1[f[0]]=f[1];
|
|
}
|
|
};
|
|
for(var i=0;i<_4e0.length;i++){
|
|
_4e4(i);
|
|
}
|
|
return _4e1;
|
|
};
|
|
function _4e5(_4e6,data){
|
|
var _4e7=$.data(_4e6,"datagrid");
|
|
var opts=_4e7.options;
|
|
var dc=_4e7.dc;
|
|
data=opts.loadFilter.call(_4e6,data);
|
|
data.total=parseInt(data.total);
|
|
_4e7.data=data;
|
|
if(data.footer){
|
|
_4e7.footer=data.footer;
|
|
}
|
|
if(!opts.remoteSort){
|
|
var opt=_4a3(_4e6,opts.sortName);
|
|
if(opt){
|
|
var _4e8=opt.sorter||function(a,b){
|
|
return (a>b?1:-1);
|
|
};
|
|
data.rows.sort(function(r1,r2){
|
|
return _4e8(r1[opts.sortName],r2[opts.sortName])*(opts.sortOrder=="asc"?1:-1);
|
|
});
|
|
}
|
|
}
|
|
if(opts.view.onBeforeRender){
|
|
opts.view.onBeforeRender.call(opts.view,_4e6,data.rows);
|
|
}
|
|
opts.view.render.call(opts.view,_4e6,dc.body2,false);
|
|
opts.view.render.call(opts.view,_4e6,dc.body1,true);
|
|
if(opts.showFooter){
|
|
opts.view.renderFooter.call(opts.view,_4e6,dc.footer2,false);
|
|
opts.view.renderFooter.call(opts.view,_4e6,dc.footer1,true);
|
|
}
|
|
if(opts.view.onAfterRender){
|
|
opts.view.onAfterRender.call(opts.view,_4e6);
|
|
}
|
|
dc.view.children("style:gt(0)").remove();
|
|
opts.onLoadSuccess.call(_4e6,data);
|
|
var _4e9=$(_4e6).datagrid("getPager");
|
|
if(_4e9.length){
|
|
if(_4e9.pagination("options").total!=data.total){
|
|
_4e9.pagination("refresh",{total:data.total});
|
|
}
|
|
}
|
|
_474(_4e6);
|
|
dc.body2.triggerHandler("scroll");
|
|
_4ea();
|
|
$(_4e6).datagrid("autoSizeColumn");
|
|
function _4ea(){
|
|
if(opts.idField){
|
|
for(var i=0;i<data.rows.length;i++){
|
|
var row=data.rows[i];
|
|
if(_4eb(_4e7.selectedRows,row)){
|
|
_4fa(_4e6,i,true);
|
|
}
|
|
if(_4eb(_4e7.checkedRows,row)){
|
|
_501(_4e6,i,true);
|
|
}
|
|
}
|
|
}
|
|
function _4eb(a,r){
|
|
for(var i=0;i<a.length;i++){
|
|
if(a[i][opts.idField]==r[opts.idField]){
|
|
a[i]=r;
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
};
|
|
};
|
|
};
|
|
function _4ec(_4ed,row){
|
|
var opts=$.data(_4ed,"datagrid").options;
|
|
var rows=$.data(_4ed,"datagrid").data.rows;
|
|
if(typeof row=="object"){
|
|
return _45f(rows,row);
|
|
}else{
|
|
for(var i=0;i<rows.length;i++){
|
|
if(rows[i][opts.idField]==row){
|
|
return i;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
};
|
|
function _4ee(_4ef){
|
|
var _4f0=$.data(_4ef,"datagrid");
|
|
var opts=_4f0.options;
|
|
var data=_4f0.data;
|
|
if(opts.idField){
|
|
return _4f0.selectedRows;
|
|
}else{
|
|
var rows=[];
|
|
opts.finder.getTr(_4ef,"","selected",2).each(function(){
|
|
var _4f1=parseInt($(this).attr("datagrid-row-index"));
|
|
rows.push(data.rows[_4f1]);
|
|
});
|
|
return rows;
|
|
}
|
|
};
|
|
function _4f2(_4f3){
|
|
var _4f4=$.data(_4f3,"datagrid");
|
|
var opts=_4f4.options;
|
|
if(opts.idField){
|
|
return _4f4.checkedRows;
|
|
}else{
|
|
var rows=[];
|
|
_4f4.dc.view.find("div.datagrid-cell-check input:checked").each(function(){
|
|
var _4f5=$(this).closest("tr.datagrid-row").attr("datagrid-row-index");
|
|
rows.push(opts.finder.getRow(_4f3,_4f5));
|
|
});
|
|
return rows;
|
|
}
|
|
};
|
|
function _4f6(_4f7,_4f8){
|
|
var opts=$.data(_4f7,"datagrid").options;
|
|
if(opts.idField){
|
|
var _4f9=_4ec(_4f7,_4f8);
|
|
if(_4f9>=0){
|
|
_4fa(_4f7,_4f9);
|
|
}
|
|
}
|
|
};
|
|
function _4fa(_4fb,_4fc,_4fd){
|
|
var _4fe=$.data(_4fb,"datagrid");
|
|
var dc=_4fe.dc;
|
|
var opts=_4fe.options;
|
|
var _4ff=_4fe.selectedRows;
|
|
if(opts.singleSelect){
|
|
_500(_4fb);
|
|
_4ff.splice(0,_4ff.length);
|
|
}
|
|
if(!_4fd&&opts.checkOnSelect){
|
|
_501(_4fb,_4fc,true);
|
|
}
|
|
var row=opts.finder.getRow(_4fb,_4fc);
|
|
if(opts.idField){
|
|
_462(_4ff,opts.idField,row);
|
|
}
|
|
opts.onSelect.call(_4fb,_4fc,row);
|
|
var tr=opts.finder.getTr(_4fb,_4fc).addClass("datagrid-row-selected");
|
|
if(tr.length){
|
|
if(tr.closest("table").hasClass("datagrid-btable-frozen")){
|
|
return;
|
|
}
|
|
var _502=dc.view2.children("div.datagrid-header")._outerHeight();
|
|
var _503=dc.body2;
|
|
var _504=_503.outerHeight(true)-_503.outerHeight();
|
|
var top=tr.position().top-_502-_504;
|
|
if(top<0){
|
|
_503.scrollTop(_503.scrollTop()+top);
|
|
}else{
|
|
if(top+tr._outerHeight()>_503.height()-18){
|
|
_503.scrollTop(_503.scrollTop()+top+tr._outerHeight()-_503.height()+18);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
function _505(_506,_507,_508){
|
|
var _509=$.data(_506,"datagrid");
|
|
var dc=_509.dc;
|
|
var opts=_509.options;
|
|
var _50a=$.data(_506,"datagrid").selectedRows;
|
|
if(!_508&&opts.checkOnSelect){
|
|
_50b(_506,_507,true);
|
|
}
|
|
opts.finder.getTr(_506,_507).removeClass("datagrid-row-selected");
|
|
var row=opts.finder.getRow(_506,_507);
|
|
if(opts.idField){
|
|
_460(_50a,opts.idField,row[opts.idField]);
|
|
}
|
|
opts.onUnselect.call(_506,_507,row);
|
|
};
|
|
function _50c(_50d,_50e){
|
|
var _50f=$.data(_50d,"datagrid");
|
|
var opts=_50f.options;
|
|
var rows=_50f.data.rows;
|
|
var _510=$.data(_50d,"datagrid").selectedRows;
|
|
if(!_50e&&opts.checkOnSelect){
|
|
_511(_50d,true);
|
|
}
|
|
opts.finder.getTr(_50d,"","allbody").addClass("datagrid-row-selected");
|
|
if(opts.idField){
|
|
for(var _512=0;_512<rows.length;_512++){
|
|
_462(_510,opts.idField,rows[_512]);
|
|
}
|
|
}
|
|
opts.onSelectAll.call(_50d,rows);
|
|
};
|
|
function _500(_513,_514){
|
|
var _515=$.data(_513,"datagrid");
|
|
var opts=_515.options;
|
|
var rows=_515.data.rows;
|
|
var _516=$.data(_513,"datagrid").selectedRows;
|
|
if(!_514&&opts.checkOnSelect){
|
|
_517(_513,true);
|
|
}
|
|
opts.finder.getTr(_513,"","selected").removeClass("datagrid-row-selected");
|
|
if(opts.idField){
|
|
for(var _518=0;_518<rows.length;_518++){
|
|
_460(_516,opts.idField,rows[_518][opts.idField]);
|
|
}
|
|
}
|
|
opts.onUnselectAll.call(_513,rows);
|
|
};
|
|
function _501(_519,_51a,_51b){
|
|
var _51c=$.data(_519,"datagrid");
|
|
var opts=_51c.options;
|
|
if(!_51b&&opts.selectOnCheck){
|
|
_4fa(_519,_51a,true);
|
|
}
|
|
var ck=opts.finder.getTr(_519,_51a).find("div.datagrid-cell-check input[type=checkbox]");
|
|
ck._propAttr("checked",true);
|
|
ck=opts.finder.getTr(_519,"","allbody").find("div.datagrid-cell-check input[type=checkbox]:not(:checked)");
|
|
if(!ck.length){
|
|
var dc=_51c.dc;
|
|
var _51d=dc.header1.add(dc.header2);
|
|
_51d.find("input[type=checkbox]")._propAttr("checked",true);
|
|
}
|
|
var row=opts.finder.getRow(_519,_51a);
|
|
if(opts.idField){
|
|
_462(_51c.checkedRows,opts.idField,row);
|
|
}
|
|
opts.onCheck.call(_519,_51a,row);
|
|
};
|
|
function _50b(_51e,_51f,_520){
|
|
var _521=$.data(_51e,"datagrid");
|
|
var opts=_521.options;
|
|
if(!_520&&opts.selectOnCheck){
|
|
_505(_51e,_51f,true);
|
|
}
|
|
var ck=opts.finder.getTr(_51e,_51f).find("div.datagrid-cell-check input[type=checkbox]");
|
|
ck._propAttr("checked",false);
|
|
var dc=_521.dc;
|
|
var _522=dc.header1.add(dc.header2);
|
|
_522.find("input[type=checkbox]")._propAttr("checked",false);
|
|
var row=opts.finder.getRow(_51e,_51f);
|
|
if(opts.idField){
|
|
_460(_521.checkedRows,opts.idField,row[opts.idField]);
|
|
}
|
|
opts.onUncheck.call(_51e,_51f,row);
|
|
};
|
|
function _511(_523,_524){
|
|
var _525=$.data(_523,"datagrid");
|
|
var opts=_525.options;
|
|
var rows=_525.data.rows;
|
|
if(!_524&&opts.selectOnCheck){
|
|
_50c(_523,true);
|
|
}
|
|
var dc=_525.dc;
|
|
var hck=dc.header1.add(dc.header2).find("input[type=checkbox]");
|
|
var bck=opts.finder.getTr(_523,"","allbody").find("div.datagrid-cell-check input[type=checkbox]");
|
|
hck.add(bck)._propAttr("checked",true);
|
|
if(opts.idField){
|
|
for(var i=0;i<rows.length;i++){
|
|
_462(_525.checkedRows,opts.idField,rows[i]);
|
|
}
|
|
}
|
|
opts.onCheckAll.call(_523,rows);
|
|
};
|
|
function _517(_526,_527){
|
|
var _528=$.data(_526,"datagrid");
|
|
var opts=_528.options;
|
|
var rows=_528.data.rows;
|
|
if(!_527&&opts.selectOnCheck){
|
|
_500(_526,true);
|
|
}
|
|
var dc=_528.dc;
|
|
var hck=dc.header1.add(dc.header2).find("input[type=checkbox]");
|
|
var bck=opts.finder.getTr(_526,"","allbody").find("div.datagrid-cell-check input[type=checkbox]");
|
|
hck.add(bck)._propAttr("checked",false);
|
|
if(opts.idField){
|
|
for(var i=0;i<rows.length;i++){
|
|
_460(_528.checkedRows,opts.idField,rows[i][opts.idField]);
|
|
}
|
|
}
|
|
opts.onUncheckAll.call(_526,rows);
|
|
};
|
|
function _529(_52a,_52b){
|
|
var opts=$.data(_52a,"datagrid").options;
|
|
var tr=opts.finder.getTr(_52a,_52b);
|
|
var row=opts.finder.getRow(_52a,_52b);
|
|
if(tr.hasClass("datagrid-row-editing")){
|
|
return;
|
|
}
|
|
if(opts.onBeforeEdit.call(_52a,_52b,row)==false){
|
|
return;
|
|
}
|
|
tr.addClass("datagrid-row-editing");
|
|
_52c(_52a,_52b);
|
|
_4d8(_52a);
|
|
tr.find("div.datagrid-editable").each(function(){
|
|
var _52d=$(this).parent().attr("field");
|
|
var ed=$.data(this,"datagrid.editor");
|
|
ed.actions.setValue(ed.target,row[_52d]);
|
|
});
|
|
_52e(_52a,_52b);
|
|
};
|
|
function _52f(_530,_531,_532){
|
|
var opts=$.data(_530,"datagrid").options;
|
|
var _533=$.data(_530,"datagrid").updatedRows;
|
|
var _534=$.data(_530,"datagrid").insertedRows;
|
|
var tr=opts.finder.getTr(_530,_531);
|
|
var row=opts.finder.getRow(_530,_531);
|
|
if(!tr.hasClass("datagrid-row-editing")){
|
|
return;
|
|
}
|
|
if(!_532){
|
|
if(!_52e(_530,_531)){
|
|
return;
|
|
}
|
|
var _535=false;
|
|
var _536={};
|
|
tr.find("div.datagrid-editable").each(function(){
|
|
var _537=$(this).parent().attr("field");
|
|
var ed=$.data(this,"datagrid.editor");
|
|
var _538=ed.actions.getValue(ed.target);
|
|
if(row[_537]!=_538){
|
|
row[_537]=_538;
|
|
_535=true;
|
|
_536[_537]=_538;
|
|
}
|
|
});
|
|
if(_535){
|
|
if(_45f(_534,row)==-1){
|
|
if(_45f(_533,row)==-1){
|
|
_533.push(row);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
tr.removeClass("datagrid-row-editing");
|
|
_539(_530,_531);
|
|
$(_530).datagrid("refreshRow",_531);
|
|
if(!_532){
|
|
opts.onAfterEdit.call(_530,_531,row,_536);
|
|
}else{
|
|
opts.onCancelEdit.call(_530,_531,row);
|
|
}
|
|
};
|
|
function _53a(_53b,_53c){
|
|
var opts=$.data(_53b,"datagrid").options;
|
|
var tr=opts.finder.getTr(_53b,_53c);
|
|
var _53d=[];
|
|
tr.children("td").each(function(){
|
|
var cell=$(this).find("div.datagrid-editable");
|
|
if(cell.length){
|
|
var ed=$.data(cell[0],"datagrid.editor");
|
|
_53d.push(ed);
|
|
}
|
|
});
|
|
return _53d;
|
|
};
|
|
function _53e(_53f,_540){
|
|
var _541=_53a(_53f,_540.index);
|
|
for(var i=0;i<_541.length;i++){
|
|
if(_541[i].field==_540.field){
|
|
return _541[i];
|
|
}
|
|
}
|
|
return null;
|
|
};
|
|
function _52c(_542,_543){
|
|
var opts=$.data(_542,"datagrid").options;
|
|
var tr=opts.finder.getTr(_542,_543);
|
|
tr.children("td").each(function(){
|
|
var cell=$(this).find("div.datagrid-cell");
|
|
var _544=$(this).attr("field");
|
|
var col=_4a3(_542,_544);
|
|
if(col&&col.editor){
|
|
var _545,_546;
|
|
if(typeof col.editor=="string"){
|
|
_545=col.editor;
|
|
}else{
|
|
_545=col.editor.type;
|
|
_546=col.editor.options;
|
|
}
|
|
var _547=opts.editors[_545];
|
|
if(_547){
|
|
var _548=cell.html();
|
|
var _549=cell._outerWidth();
|
|
cell.addClass("datagrid-editable");
|
|
cell._outerWidth(_549);
|
|
cell.html("<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\"><tr><td></td></tr></table>");
|
|
cell.children("table").bind("click dblclick contextmenu",function(e){
|
|
e.stopPropagation();
|
|
});
|
|
$.data(cell[0],"datagrid.editor",{actions:_547,target:_547.init(cell.find("td"),_546),field:_544,type:_545,oldHtml:_548});
|
|
}
|
|
}
|
|
});
|
|
_474(_542,_543,true);
|
|
};
|
|
function _539(_54a,_54b){
|
|
var opts=$.data(_54a,"datagrid").options;
|
|
var tr=opts.finder.getTr(_54a,_54b);
|
|
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 _52e(_54c,_54d){
|
|
var tr=$.data(_54c,"datagrid").options.finder.getTr(_54c,_54d);
|
|
if(!tr.hasClass("datagrid-row-editing")){
|
|
return true;
|
|
}
|
|
var vbox=tr.find(".validatebox-text");
|
|
vbox.validatebox("validate");
|
|
vbox.trigger("mouseleave");
|
|
var _54e=tr.find(".validatebox-invalid");
|
|
return _54e.length==0;
|
|
};
|
|
function _54f(_550,_551){
|
|
var _552=$.data(_550,"datagrid").insertedRows;
|
|
var _553=$.data(_550,"datagrid").deletedRows;
|
|
var _554=$.data(_550,"datagrid").updatedRows;
|
|
if(!_551){
|
|
var rows=[];
|
|
rows=rows.concat(_552);
|
|
rows=rows.concat(_553);
|
|
rows=rows.concat(_554);
|
|
return rows;
|
|
}else{
|
|
if(_551=="inserted"){
|
|
return _552;
|
|
}else{
|
|
if(_551=="deleted"){
|
|
return _553;
|
|
}else{
|
|
if(_551=="updated"){
|
|
return _554;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return [];
|
|
};
|
|
function _555(_556,_557){
|
|
var _558=$.data(_556,"datagrid");
|
|
var opts=_558.options;
|
|
var data=_558.data;
|
|
var _559=_558.insertedRows;
|
|
var _55a=_558.deletedRows;
|
|
$(_556).datagrid("cancelEdit",_557);
|
|
var row=data.rows[_557];
|
|
if(_45f(_559,row)>=0){
|
|
_460(_559,row);
|
|
}else{
|
|
_55a.push(row);
|
|
}
|
|
_460(_558.selectedRows,opts.idField,data.rows[_557][opts.idField]);
|
|
_460(_558.checkedRows,opts.idField,data.rows[_557][opts.idField]);
|
|
opts.view.deleteRow.call(opts.view,_556,_557);
|
|
if(opts.height=="auto"){
|
|
_474(_556);
|
|
}
|
|
$(_556).datagrid("getPager").pagination("refresh",{total:data.total});
|
|
};
|
|
function _55b(_55c,_55d){
|
|
var data=$.data(_55c,"datagrid").data;
|
|
var view=$.data(_55c,"datagrid").options.view;
|
|
var _55e=$.data(_55c,"datagrid").insertedRows;
|
|
view.insertRow.call(view,_55c,_55d.index,_55d.row);
|
|
_55e.push(_55d.row);
|
|
$(_55c).datagrid("getPager").pagination("refresh",{total:data.total});
|
|
};
|
|
function _55f(_560,row){
|
|
var data=$.data(_560,"datagrid").data;
|
|
var view=$.data(_560,"datagrid").options.view;
|
|
var _561=$.data(_560,"datagrid").insertedRows;
|
|
view.insertRow.call(view,_560,null,row);
|
|
_561.push(row);
|
|
$(_560).datagrid("getPager").pagination("refresh",{total:data.total});
|
|
};
|
|
function _562(_563){
|
|
var _564=$.data(_563,"datagrid");
|
|
var data=_564.data;
|
|
var rows=data.rows;
|
|
var _565=[];
|
|
for(var i=0;i<rows.length;i++){
|
|
_565.push($.extend({},rows[i]));
|
|
}
|
|
_564.originalRows=_565;
|
|
_564.updatedRows=[];
|
|
_564.insertedRows=[];
|
|
_564.deletedRows=[];
|
|
};
|
|
function _566(_567){
|
|
var data=$.data(_567,"datagrid").data;
|
|
var ok=true;
|
|
for(var i=0,len=data.rows.length;i<len;i++){
|
|
if(_52e(_567,i)){
|
|
_52f(_567,i,false);
|
|
}else{
|
|
ok=false;
|
|
}
|
|
}
|
|
if(ok){
|
|
_562(_567);
|
|
}
|
|
};
|
|
function _568(_569){
|
|
var _56a=$.data(_569,"datagrid");
|
|
var opts=_56a.options;
|
|
var _56b=_56a.originalRows;
|
|
var _56c=_56a.insertedRows;
|
|
var _56d=_56a.deletedRows;
|
|
var _56e=_56a.selectedRows;
|
|
var _56f=_56a.checkedRows;
|
|
var data=_56a.data;
|
|
function _570(a){
|
|
var ids=[];
|
|
for(var i=0;i<a.length;i++){
|
|
ids.push(a[i][opts.idField]);
|
|
}
|
|
return ids;
|
|
};
|
|
function _571(ids,_572){
|
|
for(var i=0;i<ids.length;i++){
|
|
var _573=_4ec(_569,ids[i]);
|
|
(_572=="s"?_4fa:_501)(_569,_573,true);
|
|
}
|
|
};
|
|
for(var i=0;i<data.rows.length;i++){
|
|
_52f(_569,i,true);
|
|
}
|
|
var _574=_570(_56e);
|
|
var _575=_570(_56f);
|
|
_56e.splice(0,_56e.length);
|
|
_56f.splice(0,_56f.length);
|
|
data.total+=_56d.length-_56c.length;
|
|
data.rows=_56b;
|
|
_4e5(_569,data);
|
|
_571(_574,"s");
|
|
_571(_575,"c");
|
|
_562(_569);
|
|
};
|
|
function _576(_577,_578){
|
|
var opts=$.data(_577,"datagrid").options;
|
|
if(_578){
|
|
opts.queryParams=_578;
|
|
}
|
|
var _579=$.extend({},opts.queryParams);
|
|
if(opts.pagination){
|
|
$.extend(_579,{page:opts.pageNumber,rows:opts.pageSize});
|
|
}
|
|
if(opts.sortName){
|
|
$.extend(_579,{sort:opts.sortName,order:opts.sortOrder});
|
|
}
|
|
if(opts.onBeforeLoad.call(_577,_579)==false){
|
|
return;
|
|
}
|
|
$(_577).datagrid("loading");
|
|
setTimeout(function(){
|
|
_57a();
|
|
},0);
|
|
function _57a(){
|
|
var _57b=opts.loader.call(_577,_579,function(data){
|
|
setTimeout(function(){
|
|
$(_577).datagrid("loaded");
|
|
},0);
|
|
_4e5(_577,data);
|
|
setTimeout(function(){
|
|
_562(_577);
|
|
},0);
|
|
},function(){
|
|
setTimeout(function(){
|
|
$(_577).datagrid("loaded");
|
|
},0);
|
|
opts.onLoadError.apply(_577,arguments);
|
|
});
|
|
if(_57b==false){
|
|
$(_577).datagrid("loaded");
|
|
}
|
|
};
|
|
};
|
|
function _57c(_57d,_57e){
|
|
var opts=$.data(_57d,"datagrid").options;
|
|
_57e.rowspan=_57e.rowspan||1;
|
|
_57e.colspan=_57e.colspan||1;
|
|
if(_57e.rowspan==1&&_57e.colspan==1){
|
|
return;
|
|
}
|
|
var tr=opts.finder.getTr(_57d,(_57e.index!=undefined?_57e.index:_57e.id));
|
|
if(!tr.length){
|
|
return;
|
|
}
|
|
var row=opts.finder.getRow(_57d,tr);
|
|
var _57f=row[_57e.field];
|
|
var td=tr.find("td[field=\""+_57e.field+"\"]");
|
|
td.attr("rowspan",_57e.rowspan).attr("colspan",_57e.colspan);
|
|
td.addClass("datagrid-td-merged");
|
|
for(var i=1;i<_57e.colspan;i++){
|
|
td=td.next();
|
|
td.hide();
|
|
row[td.attr("field")]=_57f;
|
|
}
|
|
for(var i=1;i<_57e.rowspan;i++){
|
|
tr=tr.next();
|
|
if(!tr.length){
|
|
break;
|
|
}
|
|
var row=opts.finder.getRow(_57d,tr);
|
|
var td=tr.find("td[field=\""+_57e.field+"\"]").hide();
|
|
row[td.attr("field")]=_57f;
|
|
for(var j=1;j<_57e.colspan;j++){
|
|
td=td.next();
|
|
td.hide();
|
|
row[td.attr("field")]=_57f;
|
|
}
|
|
}
|
|
_4d0(_57d);
|
|
};
|
|
$.fn.datagrid=function(_580,_581){
|
|
if(typeof _580=="string"){
|
|
return $.fn.datagrid.methods[_580](this,_581);
|
|
}
|
|
_580=_580||{};
|
|
return this.each(function(){
|
|
var _582=$.data(this,"datagrid");
|
|
var opts;
|
|
if(_582){
|
|
opts=$.extend(_582.options,_580);
|
|
_582.options=opts;
|
|
}else{
|
|
opts=$.extend({},$.extend({},$.fn.datagrid.defaults,{queryParams:{}}),$.fn.datagrid.parseOptions(this),_580);
|
|
$(this).css("width","").css("height","");
|
|
var _583=_485(this,opts.rownumbers);
|
|
if(!opts.columns){
|
|
opts.columns=_583.columns;
|
|
}
|
|
if(!opts.frozenColumns){
|
|
opts.frozenColumns=_583.frozenColumns;
|
|
}
|
|
opts.columns=$.extend(true,[],opts.columns);
|
|
opts.frozenColumns=$.extend(true,[],opts.frozenColumns);
|
|
opts.view=$.extend({},opts.view);
|
|
$.data(this,"datagrid",{options:opts,panel:_583.panel,dc:_583.dc,selectedRows:[],checkedRows:[],data:{total:0,rows:[]},originalRows:[],updatedRows:[],insertedRows:[],deletedRows:[]});
|
|
}
|
|
_494(this);
|
|
if(opts.data){
|
|
_4e5(this,opts.data);
|
|
_562(this);
|
|
}else{
|
|
var data=_490(this);
|
|
if(data.total>0){
|
|
_4e5(this,data);
|
|
_562(this);
|
|
}
|
|
}
|
|
_463(this);
|
|
_576(this);
|
|
_4a4(this);
|
|
});
|
|
};
|
|
var _584={text:{init:function(_585,_586){
|
|
var _587=$("<input type=\"text\" class=\"datagrid-editable-input\">").appendTo(_585);
|
|
return _587;
|
|
},getValue:function(_588){
|
|
return $(_588).val();
|
|
},setValue:function(_589,_58a){
|
|
$(_589).val(_58a);
|
|
},resize:function(_58b,_58c){
|
|
$(_58b)._outerWidth(_58c);
|
|
}},textarea:{init:function(_58d,_58e){
|
|
var _58f=$("<textarea class=\"datagrid-editable-input\"></textarea>").appendTo(_58d);
|
|
return _58f;
|
|
},getValue:function(_590){
|
|
return $(_590).val();
|
|
},setValue:function(_591,_592){
|
|
$(_591).val(_592);
|
|
},resize:function(_593,_594){
|
|
$(_593)._outerWidth(_594);
|
|
}},checkbox:{init:function(_595,_596){
|
|
var _597=$("<input type=\"checkbox\">").appendTo(_595);
|
|
_597.val(_596.on);
|
|
_597.attr("offval",_596.off);
|
|
return _597;
|
|
},getValue:function(_598){
|
|
if($(_598).is(":checked")){
|
|
return $(_598).val();
|
|
}else{
|
|
return $(_598).attr("offval");
|
|
}
|
|
},setValue:function(_599,_59a){
|
|
var _59b=false;
|
|
if($(_599).val()==_59a){
|
|
_59b=true;
|
|
}
|
|
$(_599)._propAttr("checked",_59b);
|
|
}},numberbox:{init:function(_59c,_59d){
|
|
var _59e=$("<input type=\"text\" class=\"datagrid-editable-input\">").appendTo(_59c);
|
|
_59e.numberbox(_59d);
|
|
return _59e;
|
|
},destroy:function(_59f){
|
|
$(_59f).numberbox("destroy");
|
|
},getValue:function(_5a0){
|
|
$(_5a0).blur();
|
|
return $(_5a0).numberbox("getValue");
|
|
},setValue:function(_5a1,_5a2){
|
|
$(_5a1).numberbox("setValue",_5a2);
|
|
},resize:function(_5a3,_5a4){
|
|
$(_5a3)._outerWidth(_5a4);
|
|
}},validatebox:{init:function(_5a5,_5a6){
|
|
var _5a7=$("<input type=\"text\" class=\"datagrid-editable-input\">").appendTo(_5a5);
|
|
_5a7.validatebox(_5a6);
|
|
return _5a7;
|
|
},destroy:function(_5a8){
|
|
$(_5a8).validatebox("destroy");
|
|
},getValue:function(_5a9){
|
|
return $(_5a9).val();
|
|
},setValue:function(_5aa,_5ab){
|
|
$(_5aa).val(_5ab);
|
|
},resize:function(_5ac,_5ad){
|
|
$(_5ac)._outerWidth(_5ad);
|
|
}},datebox:{init:function(_5ae,_5af){
|
|
var _5b0=$("<input type=\"text\">").appendTo(_5ae);
|
|
_5b0.datebox(_5af);
|
|
return _5b0;
|
|
},destroy:function(_5b1){
|
|
$(_5b1).datebox("destroy");
|
|
},getValue:function(_5b2){
|
|
return $(_5b2).datebox("getValue");
|
|
},setValue:function(_5b3,_5b4){
|
|
$(_5b3).datebox("setValue",_5b4);
|
|
},resize:function(_5b5,_5b6){
|
|
$(_5b5).datebox("resize",_5b6);
|
|
}},combobox:{init:function(_5b7,_5b8){
|
|
var _5b9=$("<input type=\"text\">").appendTo(_5b7);
|
|
_5b9.combobox(_5b8||{});
|
|
return _5b9;
|
|
},destroy:function(_5ba){
|
|
$(_5ba).combobox("destroy");
|
|
},getValue:function(_5bb){
|
|
return $(_5bb).combobox("getValue");
|
|
},setValue:function(_5bc,_5bd){
|
|
$(_5bc).combobox("setValue",_5bd);
|
|
},resize:function(_5be,_5bf){
|
|
$(_5be).combobox("resize",_5bf);
|
|
}},combotree:{init:function(_5c0,_5c1){
|
|
var _5c2=$("<input type=\"text\">").appendTo(_5c0);
|
|
_5c2.combotree(_5c1);
|
|
return _5c2;
|
|
},destroy:function(_5c3){
|
|
$(_5c3).combotree("destroy");
|
|
},getValue:function(_5c4){
|
|
return $(_5c4).combotree("getValue");
|
|
},setValue:function(_5c5,_5c6){
|
|
$(_5c5).combotree("setValue",_5c6);
|
|
},resize:function(_5c7,_5c8){
|
|
$(_5c7).combotree("resize",_5c8);
|
|
}}};
|
|
$.fn.datagrid.methods={options:function(jq){
|
|
var _5c9=$.data(jq[0],"datagrid").options;
|
|
var _5ca=$.data(jq[0],"datagrid").panel.panel("options");
|
|
var opts=$.extend(_5c9,{width:_5ca.width,height:_5ca.height,closed:_5ca.closed,collapsed:_5ca.collapsed,minimized:_5ca.minimized,maximized:_5ca.maximized});
|
|
return opts;
|
|
},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,_5cb){
|
|
return _493(jq[0],_5cb);
|
|
},getColumnOption:function(jq,_5cc){
|
|
return _4a3(jq[0],_5cc);
|
|
},resize:function(jq,_5cd){
|
|
return jq.each(function(){
|
|
_463(this,_5cd);
|
|
});
|
|
},load:function(jq,_5ce){
|
|
return jq.each(function(){
|
|
var opts=$(this).datagrid("options");
|
|
opts.pageNumber=1;
|
|
var _5cf=$(this).datagrid("getPager");
|
|
_5cf.pagination({pageNumber:1});
|
|
_576(this,_5ce);
|
|
});
|
|
},reload:function(jq,_5d0){
|
|
return jq.each(function(){
|
|
_576(this,_5d0);
|
|
});
|
|
},reloadFooter:function(jq,_5d1){
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"datagrid").options;
|
|
var dc=$.data(this,"datagrid").dc;
|
|
if(_5d1){
|
|
$.data(this,"datagrid").footer=_5d1;
|
|
}
|
|
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 _5d2=$(this).datagrid("getPanel");
|
|
$("<div class=\"datagrid-mask\" style=\"display:block\"></div>").appendTo(_5d2);
|
|
var msg=$("<div class=\"datagrid-mask-msg\" style=\"display:block;left:50%\"></div>").html(opts.loadMsg).appendTo(_5d2);
|
|
msg.css("marginLeft",-msg.outerWidth()/2);
|
|
}
|
|
});
|
|
},loaded:function(jq){
|
|
return jq.each(function(){
|
|
$(this).datagrid("getPager").pagination("loaded");
|
|
var _5d3=$(this).datagrid("getPanel");
|
|
_5d3.children("div.datagrid-mask-msg").remove();
|
|
_5d3.children("div.datagrid-mask").remove();
|
|
});
|
|
},fitColumns:function(jq){
|
|
return jq.each(function(){
|
|
_4b7(this);
|
|
});
|
|
},fixColumnSize:function(jq,_5d4){
|
|
return jq.each(function(){
|
|
_48d(this,_5d4);
|
|
});
|
|
},fixRowHeight:function(jq,_5d5){
|
|
return jq.each(function(){
|
|
_474(this,_5d5);
|
|
});
|
|
},freezeRow:function(jq,_5d6){
|
|
return jq.each(function(){
|
|
_47e(this,_5d6);
|
|
});
|
|
},autoSizeColumn:function(jq,_5d7){
|
|
return jq.each(function(){
|
|
_4c3(this,_5d7);
|
|
});
|
|
},loadData:function(jq,data){
|
|
return jq.each(function(){
|
|
_4e5(this,data);
|
|
_562(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 _4ec(jq[0],id);
|
|
},getChecked:function(jq){
|
|
return _4f2(jq[0]);
|
|
},getSelected:function(jq){
|
|
var rows=_4ee(jq[0]);
|
|
return rows.length>0?rows[0]:null;
|
|
},getSelections:function(jq){
|
|
return _4ee(jq[0]);
|
|
},clearSelections:function(jq){
|
|
return jq.each(function(){
|
|
var _5d8=$.data(this,"datagrid").selectedRows;
|
|
_5d8.splice(0,_5d8.length);
|
|
_500(this);
|
|
});
|
|
},clearChecked:function(jq){
|
|
return jq.each(function(){
|
|
var _5d9=$.data(this,"datagrid").checkedRows;
|
|
_5d9.splice(0,_5d9.length);
|
|
_517(this);
|
|
});
|
|
},selectAll:function(jq){
|
|
return jq.each(function(){
|
|
_50c(this);
|
|
});
|
|
},unselectAll:function(jq){
|
|
return jq.each(function(){
|
|
_500(this);
|
|
});
|
|
},selectRow:function(jq,_5da){
|
|
return jq.each(function(){
|
|
_4fa(this,_5da);
|
|
});
|
|
},selectRecord:function(jq,id){
|
|
return jq.each(function(){
|
|
_4f6(this,id);
|
|
});
|
|
},unselectRow:function(jq,_5db){
|
|
return jq.each(function(){
|
|
_505(this,_5db);
|
|
});
|
|
},checkRow:function(jq,_5dc){
|
|
return jq.each(function(){
|
|
_501(this,_5dc);
|
|
});
|
|
},uncheckRow:function(jq,_5dd){
|
|
return jq.each(function(){
|
|
_50b(this,_5dd);
|
|
});
|
|
},checkAll:function(jq){
|
|
return jq.each(function(){
|
|
_511(this);
|
|
});
|
|
},uncheckAll:function(jq){
|
|
return jq.each(function(){
|
|
_517(this);
|
|
});
|
|
},beginEdit:function(jq,_5de){
|
|
return jq.each(function(){
|
|
_529(this,_5de);
|
|
});
|
|
},endEdit:function(jq,_5df){
|
|
return jq.each(function(){
|
|
_52f(this,_5df,false);
|
|
});
|
|
},cancelEdit:function(jq,_5e0){
|
|
return jq.each(function(){
|
|
_52f(this,_5e0,true);
|
|
});
|
|
},getEditors:function(jq,_5e1){
|
|
return _53a(jq[0],_5e1);
|
|
},getEditor:function(jq,_5e2){
|
|
return _53e(jq[0],_5e2);
|
|
},refreshRow:function(jq,_5e3){
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"datagrid").options;
|
|
opts.view.refreshRow.call(opts.view,this,_5e3);
|
|
});
|
|
},validateRow:function(jq,_5e4){
|
|
return _52e(jq[0],_5e4);
|
|
},updateRow:function(jq,_5e5){
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"datagrid").options;
|
|
opts.view.updateRow.call(opts.view,this,_5e5.index,_5e5.row);
|
|
});
|
|
},appendRow:function(jq,row){
|
|
return jq.each(function(){
|
|
_55f(this,row);
|
|
});
|
|
},insertRow:function(jq,_5e6){
|
|
return jq.each(function(){
|
|
_55b(this,_5e6);
|
|
});
|
|
},deleteRow:function(jq,_5e7){
|
|
return jq.each(function(){
|
|
_555(this,_5e7);
|
|
});
|
|
},getChanges:function(jq,_5e8){
|
|
return _54f(jq[0],_5e8);
|
|
},acceptChanges:function(jq){
|
|
return jq.each(function(){
|
|
_566(this);
|
|
});
|
|
},rejectChanges:function(jq){
|
|
return jq.each(function(){
|
|
_568(this);
|
|
});
|
|
},mergeCells:function(jq,_5e9){
|
|
return jq.each(function(){
|
|
_57c(this,_5e9);
|
|
});
|
|
},showColumn:function(jq,_5ea){
|
|
return jq.each(function(){
|
|
var _5eb=$(this).datagrid("getPanel");
|
|
_5eb.find("td[field=\""+_5ea+"\"]").show();
|
|
$(this).datagrid("getColumnOption",_5ea).hidden=false;
|
|
$(this).datagrid("fitColumns");
|
|
});
|
|
},hideColumn:function(jq,_5ec){
|
|
return jq.each(function(){
|
|
var _5ed=$(this).datagrid("getPanel");
|
|
_5ed.find("td[field=\""+_5ec+"\"]").hide();
|
|
$(this).datagrid("getColumnOption",_5ec).hidden=true;
|
|
$(this).datagrid("fitColumns");
|
|
});
|
|
}};
|
|
$.fn.datagrid.parseOptions=function(_5ee){
|
|
var t=$(_5ee);
|
|
return $.extend({},$.fn.panel.parseOptions(_5ee),$.parser.parseOptions(_5ee,["url","toolbar","idField","sortName","sortOrder","pagePosition","resizeHandle",{fitColumns:"boolean",autoRowHeight:"boolean",striped:"boolean",nowrap:"boolean"},{rownumbers:"boolean",singleSelect:"boolean",checkOnSelect:"boolean",selectOnCheck:"boolean"},{pagination:"boolean",pageSize:"number",pageNumber:"number"},{remoteSort:"boolean",showHeader:"boolean",showFooter:"boolean"},{scrollbarSize:"number"}]),{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)});
|
|
};
|
|
var _5ef={render:function(_5f0,_5f1,_5f2){
|
|
var _5f3=$.data(_5f0,"datagrid");
|
|
var opts=_5f3.options;
|
|
var rows=_5f3.data.rows;
|
|
var _5f4=$(_5f0).datagrid("getColumnFields",_5f2);
|
|
if(_5f2){
|
|
if(!(opts.rownumbers||(opts.frozenColumns&&opts.frozenColumns.length))){
|
|
return;
|
|
}
|
|
}
|
|
var _5f5=["<table class=\"datagrid-btable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"];
|
|
for(var i=0;i<rows.length;i++){
|
|
var cls=(i%2&&opts.striped)?"class=\"datagrid-row datagrid-row-alt\"":"class=\"datagrid-row\"";
|
|
var _5f6=opts.rowStyler?opts.rowStyler.call(_5f0,i,rows[i]):"";
|
|
var _5f7=_5f6?"style=\""+_5f6+"\"":"";
|
|
var _5f8=_5f3.rowIdPrefix+"-"+(_5f2?1:2)+"-"+i;
|
|
_5f5.push("<tr id=\""+_5f8+"\" datagrid-row-index=\""+i+"\" "+cls+" "+_5f7+">");
|
|
_5f5.push(this.renderRow.call(this,_5f0,_5f4,_5f2,i,rows[i]));
|
|
_5f5.push("</tr>");
|
|
}
|
|
_5f5.push("</tbody></table>");
|
|
$(_5f1).html(_5f5.join(""));
|
|
},renderFooter:function(_5f9,_5fa,_5fb){
|
|
var opts=$.data(_5f9,"datagrid").options;
|
|
var rows=$.data(_5f9,"datagrid").footer||[];
|
|
var _5fc=$(_5f9).datagrid("getColumnFields",_5fb);
|
|
var _5fd=["<table class=\"datagrid-ftable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"];
|
|
for(var i=0;i<rows.length;i++){
|
|
_5fd.push("<tr class=\"datagrid-row\" datagrid-row-index=\""+i+"\">");
|
|
_5fd.push(this.renderRow.call(this,_5f9,_5fc,_5fb,i,rows[i]));
|
|
_5fd.push("</tr>");
|
|
}
|
|
_5fd.push("</tbody></table>");
|
|
$(_5fa).html(_5fd.join(""));
|
|
},renderRow:function(_5fe,_5ff,_600,_601,_602){
|
|
var opts=$.data(_5fe,"datagrid").options;
|
|
var cc=[];
|
|
if(_600&&opts.rownumbers){
|
|
var _603=_601+1;
|
|
if(opts.pagination){
|
|
_603+=(opts.pageNumber-1)*opts.pageSize;
|
|
}
|
|
cc.push("<td class=\"datagrid-td-rownumber\"><div class=\"datagrid-cell-rownumber\">"+_603+"</div></td>");
|
|
}
|
|
for(var i=0;i<_5ff.length;i++){
|
|
var _604=_5ff[i];
|
|
var col=$(_5fe).datagrid("getColumnOption",_604);
|
|
if(col){
|
|
var _605=_602[_604];
|
|
var _606=col.styler?(col.styler(_605,_602,_601)||""):"";
|
|
var _607=col.hidden?"style=\"display:none;"+_606+"\"":(_606?"style=\""+_606+"\"":"");
|
|
cc.push("<td field=\""+_604+"\" "+_607+">");
|
|
if(col.checkbox){
|
|
var _607="";
|
|
}else{
|
|
var _607="";
|
|
if(col.align){
|
|
_607+="text-align:"+col.align+";";
|
|
}
|
|
if(!opts.nowrap){
|
|
_607+="white-space:normal;height:auto;";
|
|
}else{
|
|
if(opts.autoRowHeight){
|
|
_607+="height:auto;";
|
|
}
|
|
}
|
|
}
|
|
cc.push("<div style=\""+_607+"\" ");
|
|
if(col.checkbox){
|
|
cc.push("class=\"datagrid-cell-check ");
|
|
}else{
|
|
cc.push("class=\"datagrid-cell "+col.cellClass);
|
|
}
|
|
cc.push("\">");
|
|
if(col.checkbox){
|
|
cc.push("<input type=\"checkbox\" name=\""+_604+"\" value=\""+(_605!=undefined?_605:"")+"\"/>");
|
|
}else{
|
|
if(col.formatter){
|
|
cc.push(col.formatter(_605,_602,_601));
|
|
}else{
|
|
cc.push(_605);
|
|
}
|
|
}
|
|
cc.push("</div>");
|
|
cc.push("</td>");
|
|
}
|
|
}
|
|
return cc.join("");
|
|
},refreshRow:function(_608,_609){
|
|
this.updateRow.call(this,_608,_609,{});
|
|
},updateRow:function(_60a,_60b,row){
|
|
var opts=$.data(_60a,"datagrid").options;
|
|
var rows=$(_60a).datagrid("getRows");
|
|
$.extend(rows[_60b],row);
|
|
var _60c=opts.rowStyler?opts.rowStyler.call(_60a,_60b,rows[_60b]):"";
|
|
function _60d(_60e){
|
|
var _60f=$(_60a).datagrid("getColumnFields",_60e);
|
|
var tr=opts.finder.getTr(_60a,_60b,"body",(_60e?1:2));
|
|
var _610=tr.find("div.datagrid-cell-check input[type=checkbox]").is(":checked");
|
|
tr.html(this.renderRow.call(this,_60a,_60f,_60e,_60b,rows[_60b]));
|
|
tr.attr("style",_60c||"");
|
|
if(_610){
|
|
tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked",true);
|
|
}
|
|
};
|
|
_60d.call(this,true);
|
|
_60d.call(this,false);
|
|
$(_60a).datagrid("fixRowHeight",_60b);
|
|
},insertRow:function(_611,_612,row){
|
|
var _613=$.data(_611,"datagrid");
|
|
var opts=_613.options;
|
|
var dc=_613.dc;
|
|
var data=_613.data;
|
|
if(_612==undefined||_612==null){
|
|
_612=data.rows.length;
|
|
}
|
|
if(_612>data.rows.length){
|
|
_612=data.rows.length;
|
|
}
|
|
function _614(_615){
|
|
var _616=_615?1:2;
|
|
for(var i=data.rows.length-1;i>=_612;i--){
|
|
var tr=opts.finder.getTr(_611,i,"body",_616);
|
|
tr.attr("datagrid-row-index",i+1);
|
|
tr.attr("id",_613.rowIdPrefix+"-"+_616+"-"+(i+1));
|
|
if(_615&&opts.rownumbers){
|
|
var _617=i+2;
|
|
if(opts.pagination){
|
|
_617+=(opts.pageNumber-1)*opts.pageSize;
|
|
}
|
|
tr.find("div.datagrid-cell-rownumber").html(_617);
|
|
}
|
|
}
|
|
};
|
|
function _618(_619){
|
|
var _61a=_619?1:2;
|
|
var _61b=$(_611).datagrid("getColumnFields",_619);
|
|
var _61c=_613.rowIdPrefix+"-"+_61a+"-"+_612;
|
|
var tr="<tr id=\""+_61c+"\" class=\"datagrid-row\" datagrid-row-index=\""+_612+"\"></tr>";
|
|
if(_612>=data.rows.length){
|
|
if(data.rows.length){
|
|
opts.finder.getTr(_611,"","last",_61a).after(tr);
|
|
}else{
|
|
var cc=_619?dc.body1:dc.body2;
|
|
cc.html("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"+tr+"</tbody></table>");
|
|
}
|
|
}else{
|
|
opts.finder.getTr(_611,_612+1,"body",_61a).before(tr);
|
|
}
|
|
};
|
|
_614.call(this,true);
|
|
_614.call(this,false);
|
|
_618.call(this,true);
|
|
_618.call(this,false);
|
|
data.total+=1;
|
|
data.rows.splice(_612,0,row);
|
|
this.refreshRow.call(this,_611,_612);
|
|
},deleteRow:function(_61d,_61e){
|
|
var _61f=$.data(_61d,"datagrid");
|
|
var opts=_61f.options;
|
|
var data=_61f.data;
|
|
function _620(_621){
|
|
var _622=_621?1:2;
|
|
for(var i=_61e+1;i<data.rows.length;i++){
|
|
var tr=opts.finder.getTr(_61d,i,"body",_622);
|
|
tr.attr("datagrid-row-index",i-1);
|
|
tr.attr("id",_61f.rowIdPrefix+"-"+_622+"-"+(i-1));
|
|
if(_621&&opts.rownumbers){
|
|
var _623=i;
|
|
if(opts.pagination){
|
|
_623+=(opts.pageNumber-1)*opts.pageSize;
|
|
}
|
|
tr.find("div.datagrid-cell-rownumber").html(_623);
|
|
}
|
|
}
|
|
};
|
|
opts.finder.getTr(_61d,_61e).remove();
|
|
_620.call(this,true);
|
|
_620.call(this,false);
|
|
data.total-=1;
|
|
data.rows.splice(_61e,1);
|
|
},onBeforeRender:function(_624,rows){
|
|
},onAfterRender:function(_625){
|
|
var opts=$.data(_625,"datagrid").options;
|
|
if(opts.showFooter){
|
|
var _626=$(_625).datagrid("getPanel").find("div.datagrid-footer");
|
|
_626.find("div.datagrid-cell-rownumber,div.datagrid-cell-check").css("visibility","hidden");
|
|
}
|
|
}};
|
|
$.fn.datagrid.defaults=$.extend({},$.fn.panel.defaults,{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 ...",rownumbers:false,singleSelect:false,selectOnCheck:true,checkOnSelect:true,pagination:false,pagePosition:"bottom",pageNumber:1,pageSize:10,pageList:[10,20,30,40,50],queryParams:{},sortName:null,sortOrder:"asc",remoteSort:true,showHeader:true,showFooter:false,scrollbarSize:18,rowStyler:function(_627,_628){
|
|
},loader:function(_629,_62a,_62b){
|
|
var opts=$(this).datagrid("options");
|
|
if(!opts.url){
|
|
return false;
|
|
}
|
|
$.ajax({type:opts.method,url:opts.url,data:_629,dataType:"json",success:function(data){
|
|
_62a(data);
|
|
},error:function(){
|
|
_62b.apply(this,arguments);
|
|
}});
|
|
},loadFilter:function(data){
|
|
if(typeof data.length=="number"&&typeof data.splice=="function"){
|
|
return {total:data.length,rows:data};
|
|
}else{
|
|
return data;
|
|
}
|
|
},editors:_584,finder:{getTr:function(_62c,_62d,type,_62e){
|
|
type=type||"body";
|
|
_62e=_62e||0;
|
|
var _62f=$.data(_62c,"datagrid");
|
|
var dc=_62f.dc;
|
|
var opts=_62f.options;
|
|
if(_62e==0){
|
|
var tr1=opts.finder.getTr(_62c,_62d,type,1);
|
|
var tr2=opts.finder.getTr(_62c,_62d,type,2);
|
|
return tr1.add(tr2);
|
|
}else{
|
|
if(type=="body"){
|
|
var tr=$("#"+_62f.rowIdPrefix+"-"+_62e+"-"+_62d);
|
|
if(!tr.length){
|
|
tr=(_62e==1?dc.body1:dc.body2).find(">table>tbody>tr[datagrid-row-index="+_62d+"]");
|
|
}
|
|
return tr;
|
|
}else{
|
|
if(type=="footer"){
|
|
return (_62e==1?dc.footer1:dc.footer2).find(">table>tbody>tr[datagrid-row-index="+_62d+"]");
|
|
}else{
|
|
if(type=="selected"){
|
|
return (_62e==1?dc.body1:dc.body2).find(">table>tbody>tr.datagrid-row-selected");
|
|
}else{
|
|
if(type=="last"){
|
|
return (_62e==1?dc.body1:dc.body2).find(">table>tbody>tr[datagrid-row-index]:last");
|
|
}else{
|
|
if(type=="allbody"){
|
|
return (_62e==1?dc.body1:dc.body2).find(">table>tbody>tr[datagrid-row-index]");
|
|
}else{
|
|
if(type=="allfooter"){
|
|
return (_62e==1?dc.footer1:dc.footer2).find(">table>tbody>tr[datagrid-row-index]");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},getRow:function(_630,p){
|
|
var _631=(typeof p=="object")?p.attr("datagrid-row-index"):p;
|
|
return $.data(_630,"datagrid").data.rows[parseInt(_631)];
|
|
}},view:_5ef,onBeforeLoad:function(_632){
|
|
},onLoadSuccess:function(){
|
|
},onLoadError:function(){
|
|
},onClickRow:function(_633,_634){
|
|
},onDblClickRow:function(_635,_636){
|
|
},onClickCell:function(_637,_638,_639){
|
|
},onDblClickCell:function(_63a,_63b,_63c){
|
|
},onSortColumn:function(sort,_63d){
|
|
},onResizeColumn:function(_63e,_63f){
|
|
},onSelect:function(_640,_641){
|
|
},onUnselect:function(_642,_643){
|
|
},onSelectAll:function(rows){
|
|
},onUnselectAll:function(rows){
|
|
},onCheck:function(_644,_645){
|
|
},onUncheck:function(_646,_647){
|
|
},onCheckAll:function(rows){
|
|
},onUncheckAll:function(rows){
|
|
},onBeforeEdit:function(_648,_649){
|
|
},onAfterEdit:function(_64a,_64b,_64c){
|
|
},onCancelEdit:function(_64d,_64e){
|
|
},onHeaderContextMenu:function(e,_64f){
|
|
},onRowContextMenu:function(e,_650,_651){
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
var _652;
|
|
function _653(_654){
|
|
var _655=$.data(_654,"propertygrid");
|
|
var opts=$.data(_654,"propertygrid").options;
|
|
$(_654).datagrid($.extend({},opts,{cls:"propertygrid",view:(opts.showGroup?_656:undefined),onClickRow:function(_657,row){
|
|
if(_652!=this){
|
|
_658(_652);
|
|
_652=this;
|
|
}
|
|
if(opts.editIndex!=_657&&row.editor){
|
|
var col=$(this).datagrid("getColumnOption","value");
|
|
col.editor=row.editor;
|
|
_658(_652);
|
|
$(this).datagrid("beginEdit",_657);
|
|
$(this).datagrid("getEditors",_657)[0].target.focus();
|
|
opts.editIndex=_657;
|
|
}
|
|
opts.onClickRow.call(_654,_657,row);
|
|
},loadFilter:function(data){
|
|
_658(this);
|
|
return opts.loadFilter.call(this,data);
|
|
},onLoadSuccess:function(data){
|
|
$(_654).datagrid("getPanel").find("div.datagrid-group").attr("style","");
|
|
opts.onLoadSuccess.call(_654,data);
|
|
}}));
|
|
$(document).unbind(".propertygrid").bind("mousedown.propertygrid",function(e){
|
|
var p=$(e.target).closest("div.datagrid-view,div.combo-panel");
|
|
if(p.length){
|
|
return;
|
|
}
|
|
_658(_652);
|
|
_652=undefined;
|
|
});
|
|
};
|
|
function _658(_659){
|
|
var t=$(_659);
|
|
if(!t.length){
|
|
return;
|
|
}
|
|
var opts=$.data(_659,"propertygrid").options;
|
|
var _65a=opts.editIndex;
|
|
if(_65a==undefined){
|
|
return;
|
|
}
|
|
var ed=t.datagrid("getEditors",_65a)[0];
|
|
if(ed){
|
|
ed.target.blur();
|
|
if(t.datagrid("validateRow",_65a)){
|
|
t.datagrid("endEdit",_65a);
|
|
}else{
|
|
t.datagrid("cancelEdit",_65a);
|
|
}
|
|
}
|
|
opts.editIndex=undefined;
|
|
};
|
|
$.fn.propertygrid=function(_65b,_65c){
|
|
if(typeof _65b=="string"){
|
|
var _65d=$.fn.propertygrid.methods[_65b];
|
|
if(_65d){
|
|
return _65d(this,_65c);
|
|
}else{
|
|
return this.datagrid(_65b,_65c);
|
|
}
|
|
}
|
|
_65b=_65b||{};
|
|
return this.each(function(){
|
|
var _65e=$.data(this,"propertygrid");
|
|
if(_65e){
|
|
$.extend(_65e.options,_65b);
|
|
}else{
|
|
var opts=$.extend({},$.fn.propertygrid.defaults,$.fn.propertygrid.parseOptions(this),_65b);
|
|
opts.frozenColumns=$.extend(true,[],opts.frozenColumns);
|
|
opts.columns=$.extend(true,[],opts.columns);
|
|
$.data(this,"propertygrid",{options:opts});
|
|
}
|
|
_653(this);
|
|
});
|
|
};
|
|
$.fn.propertygrid.methods={options:function(jq){
|
|
return $.data(jq[0],"propertygrid").options;
|
|
}};
|
|
$.fn.propertygrid.parseOptions=function(_65f){
|
|
var t=$(_65f);
|
|
return $.extend({},$.fn.datagrid.parseOptions(_65f),$.parser.parseOptions(_65f,[{showGroup:"boolean"}]));
|
|
};
|
|
var _656=$.extend({},$.fn.datagrid.defaults.view,{render:function(_660,_661,_662){
|
|
var _663=$.data(_660,"datagrid");
|
|
var opts=_663.options;
|
|
var rows=_663.data.rows;
|
|
var _664=$(_660).datagrid("getColumnFields",_662);
|
|
var _665=[];
|
|
var _666=0;
|
|
var _667=this.groups;
|
|
for(var i=0;i<_667.length;i++){
|
|
var _668=_667[i];
|
|
_665.push("<div class=\"datagrid-group\" group-index="+i+" style=\"height:25px;overflow:hidden;border-bottom:1px solid #ccc;\">");
|
|
_665.push("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"height:100%\"><tbody>");
|
|
_665.push("<tr>");
|
|
_665.push("<td style=\"border:0;\">");
|
|
if(!_662){
|
|
_665.push("<span style=\"color:#666;font-weight:bold;\">");
|
|
_665.push(opts.groupFormatter.call(_660,_668.fvalue,_668.rows));
|
|
_665.push("</span>");
|
|
}
|
|
_665.push("</td>");
|
|
_665.push("</tr>");
|
|
_665.push("</tbody></table>");
|
|
_665.push("</div>");
|
|
_665.push("<table class=\"datagrid-btable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>");
|
|
for(var j=0;j<_668.rows.length;j++){
|
|
var cls=(_666%2&&opts.striped)?"class=\"datagrid-row datagrid-row-alt\"":"class=\"datagrid-row\"";
|
|
var _669=opts.rowStyler?opts.rowStyler.call(_660,_666,_668.rows[j]):"";
|
|
var _66a=_669?"style=\""+_669+"\"":"";
|
|
var _66b=_663.rowIdPrefix+"-"+(_662?1:2)+"-"+_666;
|
|
_665.push("<tr id=\""+_66b+"\" datagrid-row-index=\""+_666+"\" "+cls+" "+_66a+">");
|
|
_665.push(this.renderRow.call(this,_660,_664,_662,_666,_668.rows[j]));
|
|
_665.push("</tr>");
|
|
_666++;
|
|
}
|
|
_665.push("</tbody></table>");
|
|
}
|
|
$(_661).html(_665.join(""));
|
|
},onAfterRender:function(_66c){
|
|
var opts=$.data(_66c,"datagrid").options;
|
|
var dc=$.data(_66c,"datagrid").dc;
|
|
var view=dc.view;
|
|
var _66d=dc.view1;
|
|
var _66e=dc.view2;
|
|
$.fn.datagrid.defaults.view.onAfterRender.call(this,_66c);
|
|
if(opts.rownumbers||opts.frozenColumns.length){
|
|
var _66f=_66d.find("div.datagrid-group");
|
|
}else{
|
|
var _66f=_66e.find("div.datagrid-group");
|
|
}
|
|
$("<td style=\"border:0;text-align:center;width:25px\"><span class=\"datagrid-row-expander datagrid-row-collapse\" style=\"display:inline-block;width:16px;height:16px;cursor:pointer\"> </span></td>").insertBefore(_66f.find("td"));
|
|
view.find("div.datagrid-group").each(function(){
|
|
var _670=$(this).attr("group-index");
|
|
$(this).find("span.datagrid-row-expander").bind("click",{groupIndex:_670},function(e){
|
|
if($(this).hasClass("datagrid-row-collapse")){
|
|
$(_66c).datagrid("collapseGroup",e.data.groupIndex);
|
|
}else{
|
|
$(_66c).datagrid("expandGroup",e.data.groupIndex);
|
|
}
|
|
});
|
|
});
|
|
},onBeforeRender:function(_671,rows){
|
|
var opts=$.data(_671,"datagrid").options;
|
|
var _672=[];
|
|
for(var i=0;i<rows.length;i++){
|
|
var row=rows[i];
|
|
var _673=_674(row[opts.groupField]);
|
|
if(!_673){
|
|
_673={fvalue:row[opts.groupField],rows:[row],startRow:i};
|
|
_672.push(_673);
|
|
}else{
|
|
_673.rows.push(row);
|
|
}
|
|
}
|
|
function _674(_675){
|
|
for(var i=0;i<_672.length;i++){
|
|
var _676=_672[i];
|
|
if(_676.fvalue==_675){
|
|
return _676;
|
|
}
|
|
}
|
|
return null;
|
|
};
|
|
this.groups=_672;
|
|
var _677=[];
|
|
for(var i=0;i<_672.length;i++){
|
|
var _673=_672[i];
|
|
for(var j=0;j<_673.rows.length;j++){
|
|
_677.push(_673.rows[j]);
|
|
}
|
|
}
|
|
$.data(_671,"datagrid").data.rows=_677;
|
|
}});
|
|
$.extend($.fn.datagrid.methods,{expandGroup:function(jq,_678){
|
|
return jq.each(function(){
|
|
var view=$.data(this,"datagrid").dc.view;
|
|
if(_678!=undefined){
|
|
var _679=view.find("div.datagrid-group[group-index=\""+_678+"\"]");
|
|
}else{
|
|
var _679=view.find("div.datagrid-group");
|
|
}
|
|
var _67a=_679.find("span.datagrid-row-expander");
|
|
if(_67a.hasClass("datagrid-row-expand")){
|
|
_67a.removeClass("datagrid-row-expand").addClass("datagrid-row-collapse");
|
|
_679.next("table").show();
|
|
}
|
|
$(this).datagrid("fixRowHeight");
|
|
});
|
|
},collapseGroup:function(jq,_67b){
|
|
return jq.each(function(){
|
|
var view=$.data(this,"datagrid").dc.view;
|
|
if(_67b!=undefined){
|
|
var _67c=view.find("div.datagrid-group[group-index=\""+_67b+"\"]");
|
|
}else{
|
|
var _67c=view.find("div.datagrid-group");
|
|
}
|
|
var _67d=_67c.find("span.datagrid-row-expander");
|
|
if(_67d.hasClass("datagrid-row-collapse")){
|
|
_67d.removeClass("datagrid-row-collapse").addClass("datagrid-row-expand");
|
|
_67c.next("table").hide();
|
|
}
|
|
$(this).datagrid("fixRowHeight");
|
|
});
|
|
}});
|
|
$.fn.propertygrid.defaults=$.extend({},$.fn.datagrid.defaults,{singleSelect:true,remoteSort:false,fitColumns:true,loadMsg:"",frozenColumns:[[{field:"f",width:16,resizable:false}]],columns:[[{field:"name",title:"Name",width:100,sortable:true},{field:"value",title:"Value",width:100,resizable:false}]],showGroup:false,groupField:"group",groupFormatter:function(_67e,rows){
|
|
return _67e;
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
function _67f(a,o){
|
|
for(var i=0,len=a.length;i<len;i++){
|
|
if(a[i]==o){
|
|
return i;
|
|
}
|
|
}
|
|
return -1;
|
|
};
|
|
function _680(a,o){
|
|
var _681=_67f(a,o);
|
|
if(_681!=-1){
|
|
a.splice(_681,1);
|
|
}
|
|
};
|
|
function _682(_683){
|
|
var opts=$.data(_683,"treegrid").options;
|
|
$(_683).datagrid($.extend({},opts,{url:null,data:null,loader:function(){
|
|
return false;
|
|
},onLoadSuccess:function(){
|
|
},onResizeColumn:function(_684,_685){
|
|
_69a(_683);
|
|
opts.onResizeColumn.call(_683,_684,_685);
|
|
},onSortColumn:function(sort,_686){
|
|
opts.sortName=sort;
|
|
opts.sortOrder=_686;
|
|
if(opts.remoteSort){
|
|
_699(_683);
|
|
}else{
|
|
var data=$(_683).treegrid("getData");
|
|
_6af(_683,0,data);
|
|
}
|
|
opts.onSortColumn.call(_683,sort,_686);
|
|
},onBeforeEdit:function(_687,row){
|
|
if(opts.onBeforeEdit.call(_683,row)==false){
|
|
return false;
|
|
}
|
|
},onAfterEdit:function(_688,row,_689){
|
|
opts.onAfterEdit.call(_683,row,_689);
|
|
},onCancelEdit:function(_68a,row){
|
|
opts.onCancelEdit.call(_683,row);
|
|
},onSelect:function(_68b){
|
|
opts.onSelect.call(_683,find(_683,_68b));
|
|
},onUnselect:function(_68c){
|
|
opts.onUnselect.call(_683,find(_683,_68c));
|
|
},onSelectAll:function(){
|
|
opts.onSelectAll.call(_683,$.data(_683,"treegrid").data);
|
|
},onUnselectAll:function(){
|
|
opts.onUnselectAll.call(_683,$.data(_683,"treegrid").data);
|
|
},onCheck:function(_68d){
|
|
opts.onCheck.call(_683,find(_683,_68d));
|
|
},onUncheck:function(_68e){
|
|
opts.onUncheck.call(_683,find(_683,_68e));
|
|
},onCheckAll:function(){
|
|
opts.onCheckAll.call(_683,$.data(_683,"treegrid").data);
|
|
},onUncheckAll:function(){
|
|
opts.onUncheckAll.call(_683,$.data(_683,"treegrid").data);
|
|
},onClickRow:function(_68f){
|
|
opts.onClickRow.call(_683,find(_683,_68f));
|
|
},onDblClickRow:function(_690){
|
|
opts.onDblClickRow.call(_683,find(_683,_690));
|
|
},onClickCell:function(_691,_692){
|
|
opts.onClickCell.call(_683,_692,find(_683,_691));
|
|
},onDblClickCell:function(_693,_694){
|
|
opts.onDblClickCell.call(_683,_694,find(_683,_693));
|
|
},onRowContextMenu:function(e,_695){
|
|
opts.onContextMenu.call(_683,e,find(_683,_695));
|
|
}}));
|
|
if(opts.pagination){
|
|
var _696=$(_683).datagrid("getPager");
|
|
_696.pagination({pageNumber:opts.pageNumber,pageSize:opts.pageSize,pageList:opts.pageList,onSelectPage:function(_697,_698){
|
|
opts.pageNumber=_697;
|
|
opts.pageSize=_698;
|
|
_699(_683);
|
|
}});
|
|
opts.pageSize=_696.pagination("options").pageSize;
|
|
}
|
|
};
|
|
function _69a(_69b,_69c){
|
|
var opts=$.data(_69b,"datagrid").options;
|
|
var dc=$.data(_69b,"datagrid").dc;
|
|
if(!dc.body1.is(":empty")&&(!opts.nowrap||opts.autoRowHeight)){
|
|
if(_69c!=undefined){
|
|
var _69d=_69e(_69b,_69c);
|
|
for(var i=0;i<_69d.length;i++){
|
|
_69f(_69d[i][opts.idField]);
|
|
}
|
|
}
|
|
}
|
|
$(_69b).datagrid("fixRowHeight",_69c);
|
|
function _69f(_6a0){
|
|
var tr1=opts.finder.getTr(_69b,_6a0,"body",1);
|
|
var tr2=opts.finder.getTr(_69b,_6a0,"body",2);
|
|
tr1.css("height","");
|
|
tr2.css("height","");
|
|
var _6a1=Math.max(tr1.height(),tr2.height());
|
|
tr1.css("height",_6a1);
|
|
tr2.css("height",_6a1);
|
|
};
|
|
};
|
|
function _6a2(_6a3){
|
|
var dc=$.data(_6a3,"datagrid").dc;
|
|
var opts=$.data(_6a3,"treegrid").options;
|
|
if(!opts.rownumbers){
|
|
return;
|
|
}
|
|
dc.body1.find("div.datagrid-cell-rownumber").each(function(i){
|
|
$(this).html(i+1);
|
|
});
|
|
};
|
|
function _6a4(_6a5){
|
|
var dc=$.data(_6a5,"datagrid").dc;
|
|
var body=dc.body1.add(dc.body2);
|
|
var _6a6=($.data(body[0],"events")||$._data(body[0],"events")).click[0].handler;
|
|
dc.body1.add(dc.body2).bind("mouseover",function(e){
|
|
var tt=$(e.target);
|
|
var tr=tt.closest("tr.datagrid-row");
|
|
if(!tr.length){
|
|
return;
|
|
}
|
|
if(tt.hasClass("tree-hit")){
|
|
tt.hasClass("tree-expanded")?tt.addClass("tree-expanded-hover"):tt.addClass("tree-collapsed-hover");
|
|
}
|
|
e.stopPropagation();
|
|
}).bind("mouseout",function(e){
|
|
var tt=$(e.target);
|
|
var tr=tt.closest("tr.datagrid-row");
|
|
if(!tr.length){
|
|
return;
|
|
}
|
|
if(tt.hasClass("tree-hit")){
|
|
tt.hasClass("tree-expanded")?tt.removeClass("tree-expanded-hover"):tt.removeClass("tree-collapsed-hover");
|
|
}
|
|
e.stopPropagation();
|
|
}).unbind("click").bind("click",function(e){
|
|
var tt=$(e.target);
|
|
var tr=tt.closest("tr.datagrid-row");
|
|
if(!tr.length){
|
|
return;
|
|
}
|
|
if(tt.hasClass("tree-hit")){
|
|
_6a7(_6a5,tr.attr("node-id"));
|
|
}else{
|
|
_6a6(e);
|
|
}
|
|
e.stopPropagation();
|
|
});
|
|
};
|
|
function _6a8(_6a9,_6aa){
|
|
var opts=$.data(_6a9,"treegrid").options;
|
|
var tr1=opts.finder.getTr(_6a9,_6aa,"body",1);
|
|
var tr2=opts.finder.getTr(_6a9,_6aa,"body",2);
|
|
var _6ab=$(_6a9).datagrid("getColumnFields",true).length+(opts.rownumbers?1:0);
|
|
var _6ac=$(_6a9).datagrid("getColumnFields",false).length;
|
|
_6ad(tr1,_6ab);
|
|
_6ad(tr2,_6ac);
|
|
function _6ad(tr,_6ae){
|
|
$("<tr class=\"treegrid-tr-tree\">"+"<td style=\"border:0px\" colspan=\""+_6ae+"\">"+"<div></div>"+"</td>"+"</tr>").insertAfter(tr);
|
|
};
|
|
};
|
|
function _6af(_6b0,_6b1,data,_6b2){
|
|
var opts=$.data(_6b0,"treegrid").options;
|
|
var dc=$.data(_6b0,"datagrid").dc;
|
|
data=opts.loadFilter.call(_6b0,data,_6b1);
|
|
var node=find(_6b0,_6b1);
|
|
if(node){
|
|
var _6b3=opts.finder.getTr(_6b0,_6b1,"body",1);
|
|
var _6b4=opts.finder.getTr(_6b0,_6b1,"body",2);
|
|
var cc1=_6b3.next("tr.treegrid-tr-tree").children("td").children("div");
|
|
var cc2=_6b4.next("tr.treegrid-tr-tree").children("td").children("div");
|
|
}else{
|
|
var cc1=dc.body1;
|
|
var cc2=dc.body2;
|
|
}
|
|
if(!_6b2){
|
|
$.data(_6b0,"treegrid").data=[];
|
|
cc1.empty();
|
|
cc2.empty();
|
|
}
|
|
if(opts.view.onBeforeRender){
|
|
opts.view.onBeforeRender.call(opts.view,_6b0,_6b1,data);
|
|
}
|
|
opts.view.render.call(opts.view,_6b0,cc1,true);
|
|
opts.view.render.call(opts.view,_6b0,cc2,false);
|
|
if(opts.showFooter){
|
|
opts.view.renderFooter.call(opts.view,_6b0,dc.footer1,true);
|
|
opts.view.renderFooter.call(opts.view,_6b0,dc.footer2,false);
|
|
}
|
|
if(opts.view.onAfterRender){
|
|
opts.view.onAfterRender.call(opts.view,_6b0);
|
|
}
|
|
opts.onLoadSuccess.call(_6b0,node,data);
|
|
if(!_6b1&&opts.pagination){
|
|
var _6b5=$.data(_6b0,"treegrid").total;
|
|
var _6b6=$(_6b0).datagrid("getPager");
|
|
if(_6b6.pagination("options").total!=_6b5){
|
|
_6b6.pagination({total:_6b5});
|
|
}
|
|
}
|
|
_69a(_6b0);
|
|
_6a2(_6b0);
|
|
$(_6b0).treegrid("autoSizeColumn");
|
|
};
|
|
function _699(_6b7,_6b8,_6b9,_6ba,_6bb){
|
|
var opts=$.data(_6b7,"treegrid").options;
|
|
var body=$(_6b7).datagrid("getPanel").find("div.datagrid-body");
|
|
if(_6b9){
|
|
opts.queryParams=_6b9;
|
|
}
|
|
var _6bc=$.extend({},opts.queryParams);
|
|
if(opts.pagination){
|
|
$.extend(_6bc,{page:opts.pageNumber,rows:opts.pageSize});
|
|
}
|
|
if(opts.sortName){
|
|
$.extend(_6bc,{sort:opts.sortName,order:opts.sortOrder});
|
|
}
|
|
var row=find(_6b7,_6b8);
|
|
if(opts.onBeforeLoad.call(_6b7,row,_6bc)==false){
|
|
return;
|
|
}
|
|
var _6bd=body.find("tr[node-id="+_6b8+"] span.tree-folder");
|
|
_6bd.addClass("tree-loading");
|
|
$(_6b7).treegrid("loading");
|
|
var _6be=opts.loader.call(_6b7,_6bc,function(data){
|
|
_6bd.removeClass("tree-loading");
|
|
$(_6b7).treegrid("loaded");
|
|
_6af(_6b7,_6b8,data,_6ba);
|
|
if(_6bb){
|
|
_6bb();
|
|
}
|
|
},function(){
|
|
_6bd.removeClass("tree-loading");
|
|
$(_6b7).treegrid("loaded");
|
|
opts.onLoadError.apply(_6b7,arguments);
|
|
if(_6bb){
|
|
_6bb();
|
|
}
|
|
});
|
|
if(_6be==false){
|
|
_6bd.removeClass("tree-loading");
|
|
$(_6b7).treegrid("loaded");
|
|
}
|
|
};
|
|
function _6bf(_6c0){
|
|
var rows=_6c1(_6c0);
|
|
if(rows.length){
|
|
return rows[0];
|
|
}else{
|
|
return null;
|
|
}
|
|
};
|
|
function _6c1(_6c2){
|
|
return $.data(_6c2,"treegrid").data;
|
|
};
|
|
function _6c3(_6c4,_6c5){
|
|
var row=find(_6c4,_6c5);
|
|
if(row._parentId){
|
|
return find(_6c4,row._parentId);
|
|
}else{
|
|
return null;
|
|
}
|
|
};
|
|
function _69e(_6c6,_6c7){
|
|
var opts=$.data(_6c6,"treegrid").options;
|
|
var body=$(_6c6).datagrid("getPanel").find("div.datagrid-view2 div.datagrid-body");
|
|
var _6c8=[];
|
|
if(_6c7){
|
|
_6c9(_6c7);
|
|
}else{
|
|
var _6ca=_6c1(_6c6);
|
|
for(var i=0;i<_6ca.length;i++){
|
|
_6c8.push(_6ca[i]);
|
|
_6c9(_6ca[i][opts.idField]);
|
|
}
|
|
}
|
|
function _6c9(_6cb){
|
|
var _6cc=find(_6c6,_6cb);
|
|
if(_6cc&&_6cc.children){
|
|
for(var i=0,len=_6cc.children.length;i<len;i++){
|
|
var _6cd=_6cc.children[i];
|
|
_6c8.push(_6cd);
|
|
_6c9(_6cd[opts.idField]);
|
|
}
|
|
}
|
|
};
|
|
return _6c8;
|
|
};
|
|
function _6ce(_6cf){
|
|
var rows=_6d0(_6cf);
|
|
if(rows.length){
|
|
return rows[0];
|
|
}else{
|
|
return null;
|
|
}
|
|
};
|
|
function _6d0(_6d1){
|
|
var rows=[];
|
|
var _6d2=$(_6d1).datagrid("getPanel");
|
|
_6d2.find("div.datagrid-view2 div.datagrid-body tr.datagrid-row-selected").each(function(){
|
|
var id=$(this).attr("node-id");
|
|
rows.push(find(_6d1,id));
|
|
});
|
|
return rows;
|
|
};
|
|
function _6d3(_6d4,_6d5){
|
|
if(!_6d5){
|
|
return 0;
|
|
}
|
|
var opts=$.data(_6d4,"treegrid").options;
|
|
var view=$(_6d4).datagrid("getPanel").children("div.datagrid-view");
|
|
var node=view.find("div.datagrid-body tr[node-id="+_6d5+"]").children("td[field="+opts.treeField+"]");
|
|
return node.find("span.tree-indent,span.tree-hit").length;
|
|
};
|
|
function find(_6d6,_6d7){
|
|
var opts=$.data(_6d6,"treegrid").options;
|
|
var data=$.data(_6d6,"treegrid").data;
|
|
var cc=[data];
|
|
while(cc.length){
|
|
var c=cc.shift();
|
|
for(var i=0;i<c.length;i++){
|
|
var node=c[i];
|
|
if(node[opts.idField]==_6d7){
|
|
return node;
|
|
}else{
|
|
if(node["children"]){
|
|
cc.push(node["children"]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
};
|
|
function _6d8(_6d9,_6da){
|
|
var opts=$.data(_6d9,"treegrid").options;
|
|
var row=find(_6d9,_6da);
|
|
var tr=opts.finder.getTr(_6d9,_6da);
|
|
var hit=tr.find("span.tree-hit");
|
|
if(hit.length==0){
|
|
return;
|
|
}
|
|
if(hit.hasClass("tree-collapsed")){
|
|
return;
|
|
}
|
|
if(opts.onBeforeCollapse.call(_6d9,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(opts.animate){
|
|
cc.slideUp("normal",function(){
|
|
$(_6d9).treegrid("autoSizeColumn");
|
|
_69a(_6d9,_6da);
|
|
opts.onCollapse.call(_6d9,row);
|
|
});
|
|
}else{
|
|
cc.hide();
|
|
$(_6d9).treegrid("autoSizeColumn");
|
|
_69a(_6d9,_6da);
|
|
opts.onCollapse.call(_6d9,row);
|
|
}
|
|
};
|
|
function _6db(_6dc,_6dd){
|
|
var opts=$.data(_6dc,"treegrid").options;
|
|
var tr=opts.finder.getTr(_6dc,_6dd);
|
|
var hit=tr.find("span.tree-hit");
|
|
var row=find(_6dc,_6dd);
|
|
if(hit.length==0){
|
|
return;
|
|
}
|
|
if(hit.hasClass("tree-expanded")){
|
|
return;
|
|
}
|
|
if(opts.onBeforeExpand.call(_6dc,row)==false){
|
|
return;
|
|
}
|
|
hit.removeClass("tree-collapsed tree-collapsed-hover").addClass("tree-expanded");
|
|
hit.next().addClass("tree-folder-open");
|
|
var _6de=tr.next("tr.treegrid-tr-tree");
|
|
if(_6de.length){
|
|
var cc=_6de.children("td").children("div");
|
|
_6df(cc);
|
|
}else{
|
|
_6a8(_6dc,row[opts.idField]);
|
|
var _6de=tr.next("tr.treegrid-tr-tree");
|
|
var cc=_6de.children("td").children("div");
|
|
cc.hide();
|
|
_699(_6dc,row[opts.idField],{id:row[opts.idField]},true,function(){
|
|
if(cc.is(":empty")){
|
|
_6de.remove();
|
|
}else{
|
|
_6df(cc);
|
|
}
|
|
});
|
|
}
|
|
function _6df(cc){
|
|
row.state="open";
|
|
if(opts.animate){
|
|
cc.slideDown("normal",function(){
|
|
$(_6dc).treegrid("autoSizeColumn");
|
|
_69a(_6dc,_6dd);
|
|
opts.onExpand.call(_6dc,row);
|
|
});
|
|
}else{
|
|
cc.show();
|
|
$(_6dc).treegrid("autoSizeColumn");
|
|
_69a(_6dc,_6dd);
|
|
opts.onExpand.call(_6dc,row);
|
|
}
|
|
};
|
|
};
|
|
function _6a7(_6e0,_6e1){
|
|
var opts=$.data(_6e0,"treegrid").options;
|
|
var tr=opts.finder.getTr(_6e0,_6e1);
|
|
var hit=tr.find("span.tree-hit");
|
|
if(hit.hasClass("tree-expanded")){
|
|
_6d8(_6e0,_6e1);
|
|
}else{
|
|
_6db(_6e0,_6e1);
|
|
}
|
|
};
|
|
function _6e2(_6e3,_6e4){
|
|
var opts=$.data(_6e3,"treegrid").options;
|
|
var _6e5=_69e(_6e3,_6e4);
|
|
if(_6e4){
|
|
_6e5.unshift(find(_6e3,_6e4));
|
|
}
|
|
for(var i=0;i<_6e5.length;i++){
|
|
_6d8(_6e3,_6e5[i][opts.idField]);
|
|
}
|
|
};
|
|
function _6e6(_6e7,_6e8){
|
|
var opts=$.data(_6e7,"treegrid").options;
|
|
var _6e9=_69e(_6e7,_6e8);
|
|
if(_6e8){
|
|
_6e9.unshift(find(_6e7,_6e8));
|
|
}
|
|
for(var i=0;i<_6e9.length;i++){
|
|
_6db(_6e7,_6e9[i][opts.idField]);
|
|
}
|
|
};
|
|
function _6ea(_6eb,_6ec){
|
|
var opts=$.data(_6eb,"treegrid").options;
|
|
var ids=[];
|
|
var p=_6c3(_6eb,_6ec);
|
|
while(p){
|
|
var id=p[opts.idField];
|
|
ids.unshift(id);
|
|
p=_6c3(_6eb,id);
|
|
}
|
|
for(var i=0;i<ids.length;i++){
|
|
_6db(_6eb,ids[i]);
|
|
}
|
|
};
|
|
function _6ed(_6ee,_6ef){
|
|
var opts=$.data(_6ee,"treegrid").options;
|
|
if(_6ef.parent){
|
|
var tr=opts.finder.getTr(_6ee,_6ef.parent);
|
|
if(tr.next("tr.treegrid-tr-tree").length==0){
|
|
_6a8(_6ee,_6ef.parent);
|
|
}
|
|
var cell=tr.children("td[field="+opts.treeField+"]").children("div.datagrid-cell");
|
|
var _6f0=cell.children("span.tree-icon");
|
|
if(_6f0.hasClass("tree-file")){
|
|
_6f0.removeClass("tree-file").addClass("tree-folder");
|
|
var hit=$("<span class=\"tree-hit tree-expanded\"></span>").insertBefore(_6f0);
|
|
if(hit.prev().length){
|
|
hit.prev().remove();
|
|
}
|
|
}
|
|
}
|
|
_6af(_6ee,_6ef.parent,_6ef.data,true);
|
|
};
|
|
function _6f1(_6f2,_6f3){
|
|
var ref=_6f3.before||_6f3.after;
|
|
var opts=$.data(_6f2,"treegrid").options;
|
|
var _6f4=_6c3(_6f2,ref);
|
|
_6ed(_6f2,{parent:(_6f4?_6f4[opts.idField]:null),data:[_6f3.data]});
|
|
_6f5(true);
|
|
_6f5(false);
|
|
_6a2(_6f2);
|
|
function _6f5(_6f6){
|
|
var _6f7=_6f6?1:2;
|
|
var tr=opts.finder.getTr(_6f2,_6f3.data[opts.idField],"body",_6f7);
|
|
var _6f8=tr.closest("table.datagrid-btable");
|
|
tr=tr.parent().children();
|
|
var dest=opts.finder.getTr(_6f2,ref,"body",_6f7);
|
|
if(_6f3.before){
|
|
tr.insertBefore(dest);
|
|
}else{
|
|
var sub=dest.next("tr.treegrid-tr-tree");
|
|
tr.insertAfter(sub.length?sub:dest);
|
|
}
|
|
_6f8.remove();
|
|
};
|
|
};
|
|
function _6f9(_6fa,_6fb){
|
|
var opts=$.data(_6fa,"treegrid").options;
|
|
var tr=opts.finder.getTr(_6fa,_6fb);
|
|
tr.next("tr.treegrid-tr-tree").remove();
|
|
tr.remove();
|
|
var _6fc=del(_6fb);
|
|
if(_6fc){
|
|
if(_6fc.children.length==0){
|
|
tr=opts.finder.getTr(_6fa,_6fc[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();
|
|
$("<span class=\"tree-indent\"></span>").prependTo(cell);
|
|
}
|
|
}
|
|
_6a2(_6fa);
|
|
function del(id){
|
|
var cc;
|
|
var _6fd=_6c3(_6fa,_6fb);
|
|
if(_6fd){
|
|
cc=_6fd.children;
|
|
}else{
|
|
cc=$(_6fa).treegrid("getData");
|
|
}
|
|
for(var i=0;i<cc.length;i++){
|
|
if(cc[i][opts.idField]==id){
|
|
cc.splice(i,1);
|
|
break;
|
|
}
|
|
}
|
|
return _6fd;
|
|
};
|
|
};
|
|
$.fn.treegrid=function(_6fe,_6ff){
|
|
if(typeof _6fe=="string"){
|
|
var _700=$.fn.treegrid.methods[_6fe];
|
|
if(_700){
|
|
return _700(this,_6ff);
|
|
}else{
|
|
return this.datagrid(_6fe,_6ff);
|
|
}
|
|
}
|
|
_6fe=_6fe||{};
|
|
return this.each(function(){
|
|
var _701=$.data(this,"treegrid");
|
|
if(_701){
|
|
$.extend(_701.options,_6fe);
|
|
}else{
|
|
_701=$.data(this,"treegrid",{options:$.extend({},$.fn.treegrid.defaults,$.fn.treegrid.parseOptions(this),_6fe),data:[]});
|
|
}
|
|
_682(this);
|
|
if(_701.options.data){
|
|
$(this).treegrid("loadData",_701.options.data);
|
|
}
|
|
_699(this);
|
|
_6a4(this);
|
|
});
|
|
};
|
|
$.fn.treegrid.methods={options:function(jq){
|
|
return $.data(jq[0],"treegrid").options;
|
|
},resize:function(jq,_702){
|
|
return jq.each(function(){
|
|
$(this).datagrid("resize",_702);
|
|
});
|
|
},fixRowHeight:function(jq,_703){
|
|
return jq.each(function(){
|
|
_69a(this,_703);
|
|
});
|
|
},loadData:function(jq,data){
|
|
return jq.each(function(){
|
|
_6af(this,null,data);
|
|
});
|
|
},reload:function(jq,id){
|
|
return jq.each(function(){
|
|
if(id){
|
|
var node=$(this).treegrid("find",id);
|
|
if(node.children){
|
|
node.children.splice(0,node.children.length);
|
|
}
|
|
var body=$(this).datagrid("getPanel").find("div.datagrid-body");
|
|
var tr=body.find("tr[node-id="+id+"]");
|
|
tr.next("tr.treegrid-tr-tree").remove();
|
|
var hit=tr.find("span.tree-hit");
|
|
hit.removeClass("tree-expanded tree-expanded-hover").addClass("tree-collapsed");
|
|
_6db(this,id);
|
|
}else{
|
|
_699(this,null,{});
|
|
}
|
|
});
|
|
},reloadFooter:function(jq,_704){
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"treegrid").options;
|
|
var dc=$.data(this,"datagrid").dc;
|
|
if(_704){
|
|
$.data(this,"treegrid").footer=_704;
|
|
}
|
|
if(opts.showFooter){
|
|
opts.view.renderFooter.call(opts.view,this,dc.footer1,true);
|
|
opts.view.renderFooter.call(opts.view,this,dc.footer2,false);
|
|
if(opts.view.onAfterRender){
|
|
opts.view.onAfterRender.call(opts.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 _6bf(jq[0]);
|
|
},getRoots:function(jq){
|
|
return _6c1(jq[0]);
|
|
},getParent:function(jq,id){
|
|
return _6c3(jq[0],id);
|
|
},getChildren:function(jq,id){
|
|
return _69e(jq[0],id);
|
|
},getSelected:function(jq){
|
|
return _6ce(jq[0]);
|
|
},getSelections:function(jq){
|
|
return _6d0(jq[0]);
|
|
},getLevel:function(jq,id){
|
|
return _6d3(jq[0],id);
|
|
},find:function(jq,id){
|
|
return find(jq[0],id);
|
|
},isLeaf:function(jq,id){
|
|
var opts=$.data(jq[0],"treegrid").options;
|
|
var tr=opts.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(){
|
|
_6d8(this,id);
|
|
});
|
|
},expand:function(jq,id){
|
|
return jq.each(function(){
|
|
_6db(this,id);
|
|
});
|
|
},toggle:function(jq,id){
|
|
return jq.each(function(){
|
|
_6a7(this,id);
|
|
});
|
|
},collapseAll:function(jq,id){
|
|
return jq.each(function(){
|
|
_6e2(this,id);
|
|
});
|
|
},expandAll:function(jq,id){
|
|
return jq.each(function(){
|
|
_6e6(this,id);
|
|
});
|
|
},expandTo:function(jq,id){
|
|
return jq.each(function(){
|
|
_6ea(this,id);
|
|
});
|
|
},append:function(jq,_705){
|
|
return jq.each(function(){
|
|
_6ed(this,_705);
|
|
});
|
|
},insert:function(jq,_706){
|
|
return jq.each(function(){
|
|
_6f1(this,_706);
|
|
});
|
|
},remove:function(jq,id){
|
|
return jq.each(function(){
|
|
_6f9(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 opts=$.data(this,"treegrid").options;
|
|
opts.view.refreshRow.call(opts.view,this,id);
|
|
});
|
|
},update:function(jq,_707){
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"treegrid").options;
|
|
opts.view.updateRow.call(opts.view,this,_707.id,_707.row);
|
|
});
|
|
},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);
|
|
});
|
|
}};
|
|
$.fn.treegrid.parseOptions=function(_708){
|
|
return $.extend({},$.fn.datagrid.parseOptions(_708),$.parser.parseOptions(_708,["treeField",{animate:"boolean"}]));
|
|
};
|
|
var _709=$.extend({},$.fn.datagrid.defaults.view,{render:function(_70a,_70b,_70c){
|
|
var opts=$.data(_70a,"treegrid").options;
|
|
var _70d=$(_70a).datagrid("getColumnFields",_70c);
|
|
var _70e=$.data(_70a,"datagrid").rowIdPrefix;
|
|
if(_70c){
|
|
if(!(opts.rownumbers||(opts.frozenColumns&&opts.frozenColumns.length))){
|
|
return;
|
|
}
|
|
}
|
|
var view=this;
|
|
var _70f=_710(_70c,this.treeLevel,this.treeNodes);
|
|
$(_70b).append(_70f.join(""));
|
|
function _710(_711,_712,_713){
|
|
var _714=["<table class=\"datagrid-btable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"];
|
|
for(var i=0;i<_713.length;i++){
|
|
var row=_713[i];
|
|
if(row.state!="open"&&row.state!="closed"){
|
|
row.state="open";
|
|
}
|
|
var _715=opts.rowStyler?opts.rowStyler.call(_70a,row):"";
|
|
var _716=_715?"style=\""+_715+"\"":"";
|
|
var _717=_70e+"-"+(_711?1:2)+"-"+row[opts.idField];
|
|
_714.push("<tr id=\""+_717+"\" class=\"datagrid-row\" node-id="+row[opts.idField]+" "+_716+">");
|
|
_714=_714.concat(view.renderRow.call(view,_70a,_70d,_711,_712,row));
|
|
_714.push("</tr>");
|
|
if(row.children&&row.children.length){
|
|
var tt=_710(_711,_712+1,row.children);
|
|
var v=row.state=="closed"?"none":"block";
|
|
_714.push("<tr class=\"treegrid-tr-tree\"><td style=\"border:0px\" colspan="+(_70d.length+(opts.rownumbers?1:0))+"><div style=\"display:"+v+"\">");
|
|
_714=_714.concat(tt);
|
|
_714.push("</div></td></tr>");
|
|
}
|
|
}
|
|
_714.push("</tbody></table>");
|
|
return _714;
|
|
};
|
|
},renderFooter:function(_718,_719,_71a){
|
|
var opts=$.data(_718,"treegrid").options;
|
|
var rows=$.data(_718,"treegrid").footer||[];
|
|
var _71b=$(_718).datagrid("getColumnFields",_71a);
|
|
var _71c=["<table class=\"datagrid-ftable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"];
|
|
for(var i=0;i<rows.length;i++){
|
|
var row=rows[i];
|
|
row[opts.idField]=row[opts.idField]||("foot-row-id"+i);
|
|
_71c.push("<tr class=\"datagrid-row\" node-id="+row[opts.idField]+">");
|
|
_71c.push(this.renderRow.call(this,_718,_71b,_71a,0,row));
|
|
_71c.push("</tr>");
|
|
}
|
|
_71c.push("</tbody></table>");
|
|
$(_719).html(_71c.join(""));
|
|
},renderRow:function(_71d,_71e,_71f,_720,row){
|
|
var opts=$.data(_71d,"treegrid").options;
|
|
var cc=[];
|
|
if(_71f&&opts.rownumbers){
|
|
cc.push("<td class=\"datagrid-td-rownumber\"><div class=\"datagrid-cell-rownumber\">0</div></td>");
|
|
}
|
|
for(var i=0;i<_71e.length;i++){
|
|
var _721=_71e[i];
|
|
var col=$(_71d).datagrid("getColumnOption",_721);
|
|
if(col){
|
|
var _722=col.styler?(col.styler(row[_721],row)||""):"";
|
|
var _723=col.hidden?"style=\"display:none;"+_722+"\"":(_722?"style=\""+_722+"\"":"");
|
|
cc.push("<td field=\""+_721+"\" "+_723+">");
|
|
if(col.checkbox){
|
|
var _723="";
|
|
}else{
|
|
var _723="";
|
|
if(col.align){
|
|
_723+="text-align:"+col.align+";";
|
|
}
|
|
if(!opts.nowrap){
|
|
_723+="white-space:normal;height:auto;";
|
|
}else{
|
|
if(opts.autoRowHeight){
|
|
_723+="height:auto;";
|
|
}
|
|
}
|
|
}
|
|
cc.push("<div style=\""+_723+"\" ");
|
|
if(col.checkbox){
|
|
cc.push("class=\"datagrid-cell-check ");
|
|
}else{
|
|
cc.push("class=\"datagrid-cell "+col.cellClass);
|
|
}
|
|
cc.push("\">");
|
|
if(col.checkbox){
|
|
if(row.checked){
|
|
cc.push("<input type=\"checkbox\" checked=\"checked\"");
|
|
}else{
|
|
cc.push("<input type=\"checkbox\"");
|
|
}
|
|
cc.push(" name=\""+_721+"\" value=\""+(row[_721]!=undefined?row[_721]:"")+"\"/>");
|
|
}else{
|
|
var val=null;
|
|
if(col.formatter){
|
|
val=col.formatter(row[_721],row);
|
|
}else{
|
|
val=row[_721];
|
|
}
|
|
if(_721==opts.treeField){
|
|
for(var j=0;j<_720;j++){
|
|
cc.push("<span class=\"tree-indent\"></span>");
|
|
}
|
|
if(row.state=="closed"){
|
|
cc.push("<span class=\"tree-hit tree-collapsed\"></span>");
|
|
cc.push("<span class=\"tree-icon tree-folder "+(row.iconCls?row.iconCls:"")+"\"></span>");
|
|
}else{
|
|
if(row.children&&row.children.length){
|
|
cc.push("<span class=\"tree-hit tree-expanded\"></span>");
|
|
cc.push("<span class=\"tree-icon tree-folder tree-folder-open "+(row.iconCls?row.iconCls:"")+"\"></span>");
|
|
}else{
|
|
cc.push("<span class=\"tree-indent\"></span>");
|
|
cc.push("<span class=\"tree-icon tree-file "+(row.iconCls?row.iconCls:"")+"\"></span>");
|
|
}
|
|
}
|
|
cc.push("<span class=\"tree-title\">"+val+"</span>");
|
|
}else{
|
|
cc.push(val);
|
|
}
|
|
}
|
|
cc.push("</div>");
|
|
cc.push("</td>");
|
|
}
|
|
}
|
|
return cc.join("");
|
|
},refreshRow:function(_724,id){
|
|
this.updateRow.call(this,_724,id,{});
|
|
},updateRow:function(_725,id,row){
|
|
var opts=$.data(_725,"treegrid").options;
|
|
var _726=$(_725).treegrid("find",id);
|
|
$.extend(_726,row);
|
|
var _727=$(_725).treegrid("getLevel",id)-1;
|
|
var _728=opts.rowStyler?opts.rowStyler.call(_725,_726):"";
|
|
function _729(_72a){
|
|
var _72b=$(_725).treegrid("getColumnFields",_72a);
|
|
var tr=opts.finder.getTr(_725,id,"body",(_72a?1:2));
|
|
var _72c=tr.find("div.datagrid-cell-rownumber").html();
|
|
var _72d=tr.find("div.datagrid-cell-check input[type=checkbox]").is(":checked");
|
|
tr.html(this.renderRow(_725,_72b,_72a,_727,_726));
|
|
tr.attr("style",_728||"");
|
|
tr.find("div.datagrid-cell-rownumber").html(_72c);
|
|
if(_72d){
|
|
tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked",true);
|
|
}
|
|
};
|
|
_729.call(this,true);
|
|
_729.call(this,false);
|
|
$(_725).treegrid("fixRowHeight",id);
|
|
},onBeforeRender:function(_72e,_72f,data){
|
|
if(!data){
|
|
return false;
|
|
}
|
|
var opts=$.data(_72e,"treegrid").options;
|
|
if(data.length==undefined){
|
|
if(data.footer){
|
|
$.data(_72e,"treegrid").footer=data.footer;
|
|
}
|
|
if(data.total){
|
|
$.data(_72e,"treegrid").total=data.total;
|
|
}
|
|
data=this.transfer(_72e,_72f,data.rows);
|
|
}else{
|
|
function _730(_731,_732){
|
|
for(var i=0;i<_731.length;i++){
|
|
var row=_731[i];
|
|
row._parentId=_732;
|
|
if(row.children&&row.children.length){
|
|
_730(row.children,row[opts.idField]);
|
|
}
|
|
}
|
|
};
|
|
_730(data,_72f);
|
|
}
|
|
var node=find(_72e,_72f);
|
|
if(node){
|
|
if(node.children){
|
|
node.children=node.children.concat(data);
|
|
}else{
|
|
node.children=data;
|
|
}
|
|
}else{
|
|
$.data(_72e,"treegrid").data=$.data(_72e,"treegrid").data.concat(data);
|
|
}
|
|
if(!opts.remoteSort){
|
|
this.sort(_72e,data);
|
|
}
|
|
this.treeNodes=data;
|
|
this.treeLevel=$(_72e).treegrid("getLevel",_72f);
|
|
},sort:function(_733,data){
|
|
var opts=$.data(_733,"treegrid").options;
|
|
var opt=$(_733).treegrid("getColumnOption",opts.sortName);
|
|
if(opt){
|
|
var _734=opt.sorter||function(a,b){
|
|
return (a>b?1:-1);
|
|
};
|
|
_735(data);
|
|
}
|
|
function _735(rows){
|
|
rows.sort(function(r1,r2){
|
|
return _734(r1[opts.sortName],r2[opts.sortName])*(opts.sortOrder=="asc"?1:-1);
|
|
});
|
|
for(var i=0;i<rows.length;i++){
|
|
var _736=rows[i].children;
|
|
if(_736&&_736.length){
|
|
_735(_736);
|
|
}
|
|
}
|
|
};
|
|
},transfer:function(_737,_738,data){
|
|
var opts=$.data(_737,"treegrid").options;
|
|
var rows=[];
|
|
for(var i=0;i<data.length;i++){
|
|
rows.push(data[i]);
|
|
}
|
|
var _739=[];
|
|
for(var i=0;i<rows.length;i++){
|
|
var row=rows[i];
|
|
if(!_738){
|
|
if(!row._parentId){
|
|
_739.push(row);
|
|
_680(rows,row);
|
|
i--;
|
|
}
|
|
}else{
|
|
if(row._parentId==_738){
|
|
_739.push(row);
|
|
_680(rows,row);
|
|
i--;
|
|
}
|
|
}
|
|
}
|
|
var toDo=[];
|
|
for(var i=0;i<_739.length;i++){
|
|
toDo.push(_739[i]);
|
|
}
|
|
while(toDo.length){
|
|
var node=toDo.shift();
|
|
for(var i=0;i<rows.length;i++){
|
|
var row=rows[i];
|
|
if(row._parentId==node[opts.idField]){
|
|
if(node.children){
|
|
node.children.push(row);
|
|
}else{
|
|
node.children=[row];
|
|
}
|
|
toDo.push(row);
|
|
_680(rows,row);
|
|
i--;
|
|
}
|
|
}
|
|
}
|
|
return _739;
|
|
}});
|
|
$.fn.treegrid.defaults=$.extend({},$.fn.datagrid.defaults,{treeField:null,animate:false,singleSelect:true,view:_709,loader:function(_73a,_73b,_73c){
|
|
var opts=$(this).treegrid("options");
|
|
if(!opts.url){
|
|
return false;
|
|
}
|
|
$.ajax({type:opts.method,url:opts.url,data:_73a,dataType:"json",success:function(data){
|
|
_73b(data);
|
|
},error:function(){
|
|
_73c.apply(this,arguments);
|
|
}});
|
|
},loadFilter:function(data,_73d){
|
|
return data;
|
|
},finder:{getTr:function(_73e,id,type,_73f){
|
|
type=type||"body";
|
|
_73f=_73f||0;
|
|
var dc=$.data(_73e,"datagrid").dc;
|
|
if(_73f==0){
|
|
var opts=$.data(_73e,"treegrid").options;
|
|
var tr1=opts.finder.getTr(_73e,id,type,1);
|
|
var tr2=opts.finder.getTr(_73e,id,type,2);
|
|
return tr1.add(tr2);
|
|
}else{
|
|
if(type=="body"){
|
|
var tr=$("#"+$.data(_73e,"datagrid").rowIdPrefix+"-"+_73f+"-"+id);
|
|
if(!tr.length){
|
|
tr=(_73f==1?dc.body1:dc.body2).find("tr[node-id="+id+"]");
|
|
}
|
|
return tr;
|
|
}else{
|
|
if(type=="footer"){
|
|
return (_73f==1?dc.footer1:dc.footer2).find("tr[node-id="+id+"]");
|
|
}else{
|
|
if(type=="selected"){
|
|
return (_73f==1?dc.body1:dc.body2).find("tr.datagrid-row-selected");
|
|
}else{
|
|
if(type=="last"){
|
|
return (_73f==1?dc.body1:dc.body2).find("tr:last[node-id]");
|
|
}else{
|
|
if(type=="allbody"){
|
|
return (_73f==1?dc.body1:dc.body2).find("tr[node-id]");
|
|
}else{
|
|
if(type=="allfooter"){
|
|
return (_73f==1?dc.footer1:dc.footer2).find("tr[node-id]");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},getRow:function(_740,p){
|
|
var id=(typeof p=="object")?p.attr("node-id"):p;
|
|
return $(_740).treegrid("find",id);
|
|
}},onBeforeLoad:function(row,_741){
|
|
},onLoadSuccess:function(row,data){
|
|
},onLoadError:function(){
|
|
},onBeforeCollapse:function(row){
|
|
},onCollapse:function(row){
|
|
},onBeforeExpand:function(row){
|
|
},onExpand:function(row){
|
|
},onClickRow:function(row){
|
|
},onDblClickRow:function(row){
|
|
},onClickCell:function(_742,row){
|
|
},onDblClickCell:function(_743,row){
|
|
},onContextMenu:function(e,row){
|
|
},onBeforeEdit:function(row){
|
|
},onAfterEdit:function(row,_744){
|
|
},onCancelEdit:function(row){
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
function _745(_746,_747){
|
|
var opts=$.data(_746,"combo").options;
|
|
var _748=$.data(_746,"combo").combo;
|
|
var _749=$.data(_746,"combo").panel;
|
|
if(_747){
|
|
opts.width=_747;
|
|
}
|
|
if(isNaN(opts.width)){
|
|
var c=$(_746).clone();
|
|
c.css("visibility","hidden");
|
|
c.appendTo("body");
|
|
opts.width=c.outerWidth();
|
|
c.remove();
|
|
}
|
|
_748.appendTo("body");
|
|
var _74a=_748.find("input.combo-text");
|
|
var _74b=_748.find(".combo-arrow");
|
|
var _74c=opts.hasDownArrow?_74b._outerWidth():0;
|
|
_748._outerWidth(opts.width)._outerHeight(opts.height);
|
|
_74a._outerWidth(_748.width()-_74c);
|
|
_74a.css({height:_748.height()+"px",lineHeight:_748.height()+"px"});
|
|
_74b._outerHeight(_748.height());
|
|
_749.panel("resize",{width:(opts.panelWidth?opts.panelWidth:_748.outerWidth()),height:opts.panelHeight});
|
|
_748.insertAfter(_746);
|
|
};
|
|
function _74d(_74e){
|
|
var opts=$.data(_74e,"combo").options;
|
|
var _74f=$.data(_74e,"combo").combo;
|
|
if(opts.hasDownArrow){
|
|
_74f.find(".combo-arrow").show();
|
|
}else{
|
|
_74f.find(".combo-arrow").hide();
|
|
}
|
|
};
|
|
function init(_750){
|
|
$(_750).addClass("combo-f").hide();
|
|
var span=$("<span class=\"combo\"></span>").insertAfter(_750);
|
|
var _751=$("<input type=\"text\" class=\"combo-text\">").appendTo(span);
|
|
$("<span><span class=\"combo-arrow\"></span></span>").appendTo(span);
|
|
$("<input type=\"hidden\" class=\"combo-value\">").appendTo(span);
|
|
var _752=$("<div class=\"combo-panel\"></div>").appendTo("body");
|
|
_752.panel({doSize:false,closed:true,cls:"combo-p",style:{position:"absolute",zIndex:10},onOpen:function(){
|
|
$(this).panel("resize");
|
|
}});
|
|
var name=$(_750).attr("name");
|
|
if(name){
|
|
span.find("input.combo-value").attr("name",name);
|
|
$(_750).removeAttr("name").attr("comboName",name);
|
|
}
|
|
_751.attr("autocomplete","off");
|
|
return {combo:span,panel:_752};
|
|
};
|
|
function _753(_754){
|
|
var _755=$.data(_754,"combo").combo.find("input.combo-text");
|
|
_755.validatebox("destroy");
|
|
$.data(_754,"combo").panel.panel("destroy");
|
|
$.data(_754,"combo").combo.remove();
|
|
$(_754).remove();
|
|
};
|
|
function _756(_757){
|
|
var _758=$.data(_757,"combo");
|
|
var opts=_758.options;
|
|
var _759=$.data(_757,"combo").combo;
|
|
var _75a=$.data(_757,"combo").panel;
|
|
var _75b=_759.find(".combo-text");
|
|
var _75c=_759.find(".combo-arrow");
|
|
$(document).unbind(".combo").bind("mousedown.combo",function(e){
|
|
var p=$(e.target).closest("span.combo,div.combo-panel");
|
|
if(p.length){
|
|
return;
|
|
}
|
|
var _75d=$("body>div.combo-p>div.combo-panel");
|
|
_75d.panel("close");
|
|
});
|
|
_759.unbind(".combo");
|
|
_75a.unbind(".combo");
|
|
_75b.unbind(".combo");
|
|
_75c.unbind(".combo");
|
|
if(!opts.disabled){
|
|
_75b.bind("mousedown.combo",function(e){
|
|
$("div.combo-panel").not(_75a).panel("close");
|
|
e.stopPropagation();
|
|
}).bind("keydown.combo",function(e){
|
|
switch(e.keyCode){
|
|
case 38:
|
|
opts.keyHandler.up.call(_757);
|
|
break;
|
|
case 40:
|
|
opts.keyHandler.down.call(_757);
|
|
break;
|
|
case 13:
|
|
e.preventDefault();
|
|
opts.keyHandler.enter.call(_757);
|
|
return false;
|
|
case 9:
|
|
case 27:
|
|
_764(_757);
|
|
break;
|
|
default:
|
|
if(opts.editable){
|
|
if(_758.timer){
|
|
clearTimeout(_758.timer);
|
|
}
|
|
_758.timer=setTimeout(function(){
|
|
var q=_75b.val();
|
|
if(_758.previousValue!=q){
|
|
_758.previousValue=q;
|
|
$(_757).combo("showPanel");
|
|
opts.keyHandler.query.call(_757,_75b.val());
|
|
_767(_757,true);
|
|
}
|
|
},opts.delay);
|
|
}
|
|
}
|
|
});
|
|
_75c.bind("click.combo",function(){
|
|
if(_75a.is(":visible")){
|
|
_764(_757);
|
|
}else{
|
|
$("div.combo-panel").panel("close");
|
|
$(_757).combo("showPanel");
|
|
}
|
|
_75b.focus();
|
|
}).bind("mouseenter.combo",function(){
|
|
$(this).addClass("combo-arrow-hover");
|
|
}).bind("mouseleave.combo",function(){
|
|
$(this).removeClass("combo-arrow-hover");
|
|
}).bind("mousedown.combo",function(){
|
|
});
|
|
}
|
|
};
|
|
function _75e(_75f){
|
|
var opts=$.data(_75f,"combo").options;
|
|
var _760=$.data(_75f,"combo").combo;
|
|
var _761=$.data(_75f,"combo").panel;
|
|
if($.fn.window){
|
|
_761.panel("panel").css("z-index",$.fn.window.defaults.zIndex++);
|
|
}
|
|
_761.panel("move",{left:_760.offset().left,top:_762()});
|
|
if(_761.panel("options").closed){
|
|
_761.panel("open");
|
|
opts.onShowPanel.call(_75f);
|
|
}
|
|
(function(){
|
|
if(_761.is(":visible")){
|
|
_761.panel("move",{left:_763(),top:_762()});
|
|
setTimeout(arguments.callee,200);
|
|
}
|
|
})();
|
|
function _763(){
|
|
var left=_760.offset().left;
|
|
if(left+_761._outerWidth()>$(window)._outerWidth()+$(document).scrollLeft()){
|
|
left=$(window)._outerWidth()+$(document).scrollLeft()-_761._outerWidth();
|
|
}
|
|
if(left<0){
|
|
left=0;
|
|
}
|
|
return left;
|
|
};
|
|
function _762(){
|
|
var top=_760.offset().top+_760._outerHeight();
|
|
if(top+_761._outerHeight()>$(window)._outerHeight()+$(document).scrollTop()){
|
|
top=_760.offset().top-_761._outerHeight();
|
|
}
|
|
if(top<$(document).scrollTop()){
|
|
top=_760.offset().top+_760._outerHeight();
|
|
}
|
|
return top;
|
|
};
|
|
};
|
|
function _764(_765){
|
|
var opts=$.data(_765,"combo").options;
|
|
var _766=$.data(_765,"combo").panel;
|
|
_766.panel("close");
|
|
opts.onHidePanel.call(_765);
|
|
};
|
|
function _767(_768,doit){
|
|
var opts=$.data(_768,"combo").options;
|
|
var _769=$.data(_768,"combo").combo.find("input.combo-text");
|
|
_769.validatebox(opts);
|
|
if(doit){
|
|
_769.validatebox("validate");
|
|
}
|
|
};
|
|
function _76a(_76b,_76c){
|
|
var opts=$.data(_76b,"combo").options;
|
|
var _76d=$.data(_76b,"combo").combo;
|
|
if(_76c){
|
|
opts.disabled=true;
|
|
$(_76b).attr("disabled",true);
|
|
_76d.find(".combo-value").attr("disabled",true);
|
|
_76d.find(".combo-text").attr("disabled",true);
|
|
}else{
|
|
opts.disabled=false;
|
|
$(_76b).removeAttr("disabled");
|
|
_76d.find(".combo-value").removeAttr("disabled");
|
|
_76d.find(".combo-text").removeAttr("disabled");
|
|
}
|
|
};
|
|
function _76e(_76f){
|
|
var opts=$.data(_76f,"combo").options;
|
|
var _770=$.data(_76f,"combo").combo;
|
|
if(opts.multiple){
|
|
_770.find("input.combo-value").remove();
|
|
}else{
|
|
_770.find("input.combo-value").val("");
|
|
}
|
|
_770.find("input.combo-text").val("");
|
|
};
|
|
function _771(_772){
|
|
var _773=$.data(_772,"combo").combo;
|
|
return _773.find("input.combo-text").val();
|
|
};
|
|
function _774(_775,text){
|
|
var _776=$.data(_775,"combo").combo;
|
|
_776.find("input.combo-text").val(text);
|
|
_767(_775,true);
|
|
$.data(_775,"combo").previousValue=text;
|
|
};
|
|
function _777(_778){
|
|
var _779=[];
|
|
var _77a=$.data(_778,"combo").combo;
|
|
_77a.find("input.combo-value").each(function(){
|
|
_779.push($(this).val());
|
|
});
|
|
return _779;
|
|
};
|
|
function _77b(_77c,_77d){
|
|
var opts=$.data(_77c,"combo").options;
|
|
var _77e=_777(_77c);
|
|
var _77f=$.data(_77c,"combo").combo;
|
|
_77f.find("input.combo-value").remove();
|
|
var name=$(_77c).attr("comboName");
|
|
for(var i=0;i<_77d.length;i++){
|
|
var _780=$("<input type=\"hidden\" class=\"combo-value\">").appendTo(_77f);
|
|
if(name){
|
|
_780.attr("name",name);
|
|
}
|
|
_780.val(_77d[i]);
|
|
}
|
|
var tmp=[];
|
|
for(var i=0;i<_77e.length;i++){
|
|
tmp[i]=_77e[i];
|
|
}
|
|
var aa=[];
|
|
for(var i=0;i<_77d.length;i++){
|
|
for(var j=0;j<tmp.length;j++){
|
|
if(_77d[i]==tmp[j]){
|
|
aa.push(_77d[i]);
|
|
tmp.splice(j,1);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if(aa.length!=_77d.length||_77d.length!=_77e.length){
|
|
if(opts.multiple){
|
|
opts.onChange.call(_77c,_77d,_77e);
|
|
}else{
|
|
opts.onChange.call(_77c,_77d[0],_77e[0]);
|
|
}
|
|
}
|
|
};
|
|
function _781(_782){
|
|
var _783=_777(_782);
|
|
return _783[0];
|
|
};
|
|
function _784(_785,_786){
|
|
_77b(_785,[_786]);
|
|
};
|
|
function _787(_788){
|
|
var opts=$.data(_788,"combo").options;
|
|
var fn=opts.onChange;
|
|
opts.onChange=function(){
|
|
};
|
|
if(opts.multiple){
|
|
if(opts.value){
|
|
if(typeof opts.value=="object"){
|
|
_77b(_788,opts.value);
|
|
}else{
|
|
_784(_788,opts.value);
|
|
}
|
|
}else{
|
|
_77b(_788,[]);
|
|
}
|
|
opts.originalValue=_777(_788);
|
|
}else{
|
|
_784(_788,opts.value);
|
|
opts.originalValue=opts.value;
|
|
}
|
|
opts.onChange=fn;
|
|
};
|
|
$.fn.combo=function(_789,_78a){
|
|
if(typeof _789=="string"){
|
|
return $.fn.combo.methods[_789](this,_78a);
|
|
}
|
|
_789=_789||{};
|
|
return this.each(function(){
|
|
var _78b=$.data(this,"combo");
|
|
if(_78b){
|
|
$.extend(_78b.options,_789);
|
|
}else{
|
|
var r=init(this);
|
|
_78b=$.data(this,"combo",{options:$.extend({},$.fn.combo.defaults,$.fn.combo.parseOptions(this),_789),combo:r.combo,panel:r.panel,previousValue:null});
|
|
$(this).removeAttr("disabled");
|
|
}
|
|
$("input.combo-text",_78b.combo).attr("readonly",!_78b.options.editable);
|
|
_74d(this);
|
|
_76a(this,_78b.options.disabled);
|
|
_745(this);
|
|
_756(this);
|
|
_767(this);
|
|
_787(this);
|
|
});
|
|
};
|
|
$.fn.combo.methods={options:function(jq){
|
|
return $.data(jq[0],"combo").options;
|
|
},panel:function(jq){
|
|
return $.data(jq[0],"combo").panel;
|
|
},textbox:function(jq){
|
|
return $.data(jq[0],"combo").combo.find("input.combo-text");
|
|
},destroy:function(jq){
|
|
return jq.each(function(){
|
|
_753(this);
|
|
});
|
|
},resize:function(jq,_78c){
|
|
return jq.each(function(){
|
|
_745(this,_78c);
|
|
});
|
|
},showPanel:function(jq){
|
|
return jq.each(function(){
|
|
_75e(this);
|
|
});
|
|
},hidePanel:function(jq){
|
|
return jq.each(function(){
|
|
_764(this);
|
|
});
|
|
},disable:function(jq){
|
|
return jq.each(function(){
|
|
_76a(this,true);
|
|
_756(this);
|
|
});
|
|
},enable:function(jq){
|
|
return jq.each(function(){
|
|
_76a(this,false);
|
|
_756(this);
|
|
});
|
|
},validate:function(jq){
|
|
return jq.each(function(){
|
|
_767(this,true);
|
|
});
|
|
},isValid:function(jq){
|
|
var _78d=$.data(jq[0],"combo").combo.find("input.combo-text");
|
|
return _78d.validatebox("isValid");
|
|
},clear:function(jq){
|
|
return jq.each(function(){
|
|
_76e(this);
|
|
});
|
|
},reset:function(jq){
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"combo").options;
|
|
if(opts.multiple){
|
|
$(this).combo("setValues",opts.originalValue);
|
|
}else{
|
|
$(this).combo("setValue",opts.originalValue);
|
|
}
|
|
});
|
|
},getText:function(jq){
|
|
return _771(jq[0]);
|
|
},setText:function(jq,text){
|
|
return jq.each(function(){
|
|
_774(this,text);
|
|
});
|
|
},getValues:function(jq){
|
|
return _777(jq[0]);
|
|
},setValues:function(jq,_78e){
|
|
return jq.each(function(){
|
|
_77b(this,_78e);
|
|
});
|
|
},getValue:function(jq){
|
|
return _781(jq[0]);
|
|
},setValue:function(jq,_78f){
|
|
return jq.each(function(){
|
|
_784(this,_78f);
|
|
});
|
|
}};
|
|
$.fn.combo.parseOptions=function(_790){
|
|
var t=$(_790);
|
|
return $.extend({},$.fn.validatebox.parseOptions(_790),$.parser.parseOptions(_790,["width","height","separator",{panelWidth:"number",editable:"boolean",hasDownArrow:"boolean",delay:"number"}]),{panelHeight:(t.attr("panelHeight")=="auto"?"auto":parseInt(t.attr("panelHeight"))||undefined),multiple:(t.attr("multiple")?true:undefined),disabled:(t.attr("disabled")?true:undefined),value:(t.val()||undefined)});
|
|
};
|
|
$.fn.combo.defaults=$.extend({},$.fn.validatebox.defaults,{width:"auto",height:22,panelWidth:null,panelHeight:200,multiple:false,separator:",",editable:true,disabled:false,hasDownArrow:true,value:"",delay:200,keyHandler:{up:function(){
|
|
},down:function(){
|
|
},enter:function(){
|
|
},query:function(q){
|
|
}},onShowPanel:function(){
|
|
},onHidePanel:function(){
|
|
},onChange:function(_791,_792){
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
function _793(_794,_795){
|
|
var _796=$(_794).combo("panel");
|
|
var item=_796.find("div.combobox-item[value=\""+_795+"\"]");
|
|
if(item.length){
|
|
if(item.position().top<=0){
|
|
var h=_796.scrollTop()+item.position().top;
|
|
_796.scrollTop(h);
|
|
}else{
|
|
if(item.position().top+item.outerHeight()>_796.height()){
|
|
var h=_796.scrollTop()+item.position().top+item.outerHeight()-_796.height();
|
|
_796.scrollTop(h);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
function _797(_798){
|
|
var _799=$(_798).combo("panel");
|
|
var _79a=$(_798).combo("getValues");
|
|
var item=_799.find("div.combobox-item[value=\""+_79a.pop()+"\"]");
|
|
if(item.length){
|
|
var prev=item.prev(":visible");
|
|
if(prev.length){
|
|
item=prev;
|
|
}
|
|
}else{
|
|
item=_799.find("div.combobox-item:visible:last");
|
|
}
|
|
var _79b=item.attr("value");
|
|
_79c(_798,_79b);
|
|
_793(_798,_79b);
|
|
};
|
|
function _79d(_79e){
|
|
var _79f=$(_79e).combo("panel");
|
|
var _7a0=$(_79e).combo("getValues");
|
|
var item=_79f.find("div.combobox-item[value=\""+_7a0.pop()+"\"]");
|
|
if(item.length){
|
|
var next=item.next(":visible");
|
|
if(next.length){
|
|
item=next;
|
|
}
|
|
}else{
|
|
item=_79f.find("div.combobox-item:visible:first");
|
|
}
|
|
var _7a1=item.attr("value");
|
|
_79c(_79e,_7a1);
|
|
_793(_79e,_7a1);
|
|
};
|
|
function _79c(_7a2,_7a3){
|
|
var opts=$.data(_7a2,"combobox").options;
|
|
var data=$.data(_7a2,"combobox").data;
|
|
if(opts.multiple){
|
|
var _7a4=$(_7a2).combo("getValues");
|
|
for(var i=0;i<_7a4.length;i++){
|
|
if(_7a4[i]==_7a3){
|
|
return;
|
|
}
|
|
}
|
|
_7a4.push(_7a3);
|
|
_7a5(_7a2,_7a4);
|
|
}else{
|
|
_7a5(_7a2,[_7a3]);
|
|
}
|
|
for(var i=0;i<data.length;i++){
|
|
if(data[i][opts.valueField]==_7a3){
|
|
opts.onSelect.call(_7a2,data[i]);
|
|
return;
|
|
}
|
|
}
|
|
};
|
|
function _7a6(_7a7,_7a8){
|
|
var opts=$.data(_7a7,"combobox").options;
|
|
var data=$.data(_7a7,"combobox").data;
|
|
var _7a9=$(_7a7).combo("getValues");
|
|
for(var i=0;i<_7a9.length;i++){
|
|
if(_7a9[i]==_7a8){
|
|
_7a9.splice(i,1);
|
|
_7a5(_7a7,_7a9);
|
|
break;
|
|
}
|
|
}
|
|
for(var i=0;i<data.length;i++){
|
|
if(data[i][opts.valueField]==_7a8){
|
|
opts.onUnselect.call(_7a7,data[i]);
|
|
return;
|
|
}
|
|
}
|
|
};
|
|
function _7a5(_7aa,_7ab,_7ac){
|
|
var opts=$.data(_7aa,"combobox").options;
|
|
var data=$.data(_7aa,"combobox").data;
|
|
var _7ad=$(_7aa).combo("panel");
|
|
_7ad.find("div.combobox-item-selected").removeClass("combobox-item-selected");
|
|
var vv=[],ss=[];
|
|
for(var i=0;i<_7ab.length;i++){
|
|
var v=_7ab[i];
|
|
var s=v;
|
|
for(var j=0;j<data.length;j++){
|
|
if(data[j][opts.valueField]==v){
|
|
s=data[j][opts.textField];
|
|
break;
|
|
}
|
|
}
|
|
vv.push(v);
|
|
ss.push(s);
|
|
_7ad.find("div.combobox-item[value=\""+v+"\"]").addClass("combobox-item-selected");
|
|
}
|
|
$(_7aa).combo("setValues",vv);
|
|
if(!_7ac){
|
|
$(_7aa).combo("setText",ss.join(opts.separator));
|
|
}
|
|
};
|
|
function _7ae(_7af){
|
|
var opts=$.data(_7af,"combobox").options;
|
|
var data=[];
|
|
$(">option",_7af).each(function(){
|
|
var item={};
|
|
item[opts.valueField]=$(this).attr("value")!=undefined?$(this).attr("value"):$(this).html();
|
|
item[opts.textField]=$(this).html();
|
|
item["selected"]=$(this).attr("selected");
|
|
data.push(item);
|
|
});
|
|
return data;
|
|
};
|
|
function _7b0(_7b1,data,_7b2){
|
|
var opts=$.data(_7b1,"combobox").options;
|
|
var _7b3=$(_7b1).combo("panel");
|
|
$.data(_7b1,"combobox").data=data;
|
|
var _7b4=$(_7b1).combobox("getValues");
|
|
_7b3.empty();
|
|
for(var i=0;i<data.length;i++){
|
|
var v=data[i][opts.valueField];
|
|
var s=data[i][opts.textField];
|
|
var item=$("<div class=\"combobox-item\"></div>").appendTo(_7b3);
|
|
item.attr("value",v);
|
|
if(opts.formatter){
|
|
item.html(opts.formatter.call(_7b1,data[i]));
|
|
}else{
|
|
item.html(s);
|
|
}
|
|
if(data[i]["selected"]){
|
|
(function(){
|
|
for(var i=0;i<_7b4.length;i++){
|
|
if(v==_7b4[i]){
|
|
return;
|
|
}
|
|
}
|
|
_7b4.push(v);
|
|
})();
|
|
}
|
|
}
|
|
if(opts.multiple){
|
|
_7a5(_7b1,_7b4,_7b2);
|
|
}else{
|
|
if(_7b4.length){
|
|
_7a5(_7b1,[_7b4[_7b4.length-1]],_7b2);
|
|
}else{
|
|
_7a5(_7b1,[],_7b2);
|
|
}
|
|
}
|
|
opts.onLoadSuccess.call(_7b1,data);
|
|
$(".combobox-item",_7b3).hover(function(){
|
|
$(this).addClass("combobox-item-hover");
|
|
},function(){
|
|
$(this).removeClass("combobox-item-hover");
|
|
}).click(function(){
|
|
var item=$(this);
|
|
if(opts.multiple){
|
|
if(item.hasClass("combobox-item-selected")){
|
|
_7a6(_7b1,item.attr("value"));
|
|
}else{
|
|
_79c(_7b1,item.attr("value"));
|
|
}
|
|
}else{
|
|
_79c(_7b1,item.attr("value"));
|
|
$(_7b1).combo("hidePanel");
|
|
}
|
|
});
|
|
};
|
|
function _7b5(_7b6,url,_7b7,_7b8){
|
|
var opts=$.data(_7b6,"combobox").options;
|
|
if(url){
|
|
opts.url=url;
|
|
}
|
|
_7b7=_7b7||{};
|
|
if(opts.onBeforeLoad.call(_7b6,_7b7)==false){
|
|
return;
|
|
}
|
|
opts.loader.call(_7b6,_7b7,function(data){
|
|
_7b0(_7b6,data,_7b8);
|
|
},function(){
|
|
opts.onLoadError.apply(this,arguments);
|
|
});
|
|
};
|
|
function _7b9(_7ba,q){
|
|
var opts=$.data(_7ba,"combobox").options;
|
|
if(opts.multiple&&!q){
|
|
_7a5(_7ba,[],true);
|
|
}else{
|
|
_7a5(_7ba,[q],true);
|
|
}
|
|
if(opts.mode=="remote"){
|
|
_7b5(_7ba,null,{q:q},true);
|
|
}else{
|
|
var _7bb=$(_7ba).combo("panel");
|
|
_7bb.find("div.combobox-item").hide();
|
|
var data=$.data(_7ba,"combobox").data;
|
|
for(var i=0;i<data.length;i++){
|
|
if(opts.filter.call(_7ba,q,data[i])){
|
|
var v=data[i][opts.valueField];
|
|
var s=data[i][opts.textField];
|
|
var item=_7bb.find("div.combobox-item[value=\""+v+"\"]");
|
|
item.show();
|
|
if(s==q){
|
|
_7a5(_7ba,[v],true);
|
|
item.addClass("combobox-item-selected");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
function _7bc(_7bd){
|
|
var opts=$.data(_7bd,"combobox").options;
|
|
$(_7bd).addClass("combobox-f");
|
|
$(_7bd).combo($.extend({},opts,{onShowPanel:function(){
|
|
$(_7bd).combo("panel").find("div.combobox-item").show();
|
|
_793(_7bd,$(_7bd).combobox("getValue"));
|
|
opts.onShowPanel.call(_7bd);
|
|
}}));
|
|
};
|
|
$.fn.combobox=function(_7be,_7bf){
|
|
if(typeof _7be=="string"){
|
|
var _7c0=$.fn.combobox.methods[_7be];
|
|
if(_7c0){
|
|
return _7c0(this,_7bf);
|
|
}else{
|
|
return this.combo(_7be,_7bf);
|
|
}
|
|
}
|
|
_7be=_7be||{};
|
|
return this.each(function(){
|
|
var _7c1=$.data(this,"combobox");
|
|
if(_7c1){
|
|
$.extend(_7c1.options,_7be);
|
|
_7bc(this);
|
|
}else{
|
|
_7c1=$.data(this,"combobox",{options:$.extend({},$.fn.combobox.defaults,$.fn.combobox.parseOptions(this),_7be)});
|
|
_7bc(this);
|
|
_7b0(this,_7ae(this));
|
|
}
|
|
if(_7c1.options.data){
|
|
_7b0(this,_7c1.options.data);
|
|
}
|
|
_7b5(this);
|
|
});
|
|
};
|
|
$.fn.combobox.methods={options:function(jq){
|
|
var opts=$.data(jq[0],"combobox").options;
|
|
opts.originalValue=jq.combo("options").originalValue;
|
|
return opts;
|
|
},getData:function(jq){
|
|
return $.data(jq[0],"combobox").data;
|
|
},setValues:function(jq,_7c2){
|
|
return jq.each(function(){
|
|
_7a5(this,_7c2);
|
|
});
|
|
},setValue:function(jq,_7c3){
|
|
return jq.each(function(){
|
|
_7a5(this,[_7c3]);
|
|
});
|
|
},clear:function(jq){
|
|
return jq.each(function(){
|
|
$(this).combo("clear");
|
|
var _7c4=$(this).combo("panel");
|
|
_7c4.find("div.combobox-item-selected").removeClass("combobox-item-selected");
|
|
});
|
|
},reset:function(jq){
|
|
return jq.each(function(){
|
|
var opts=$(this).combobox("options");
|
|
if(opts.multiple){
|
|
$(this).combobox("setValues",opts.originalValue);
|
|
}else{
|
|
$(this).combobox("setValue",opts.originalValue);
|
|
}
|
|
});
|
|
},loadData:function(jq,data){
|
|
return jq.each(function(){
|
|
_7b0(this,data);
|
|
});
|
|
},reload:function(jq,url){
|
|
return jq.each(function(){
|
|
_7b5(this,url);
|
|
});
|
|
},select:function(jq,_7c5){
|
|
return jq.each(function(){
|
|
_79c(this,_7c5);
|
|
});
|
|
},unselect:function(jq,_7c6){
|
|
return jq.each(function(){
|
|
_7a6(this,_7c6);
|
|
});
|
|
}};
|
|
$.fn.combobox.parseOptions=function(_7c7){
|
|
var t=$(_7c7);
|
|
return $.extend({},$.fn.combo.parseOptions(_7c7),$.parser.parseOptions(_7c7,["valueField","textField","mode","method","url"]));
|
|
};
|
|
$.fn.combobox.defaults=$.extend({},$.fn.combo.defaults,{valueField:"value",textField:"text",mode:"local",method:"post",url:null,data:null,keyHandler:{up:function(){
|
|
_797(this);
|
|
},down:function(){
|
|
_79d(this);
|
|
},enter:function(){
|
|
var _7c8=$(this).combobox("getValues");
|
|
$(this).combobox("setValues",_7c8);
|
|
$(this).combobox("hidePanel");
|
|
},query:function(q){
|
|
_7b9(this,q);
|
|
}},filter:function(q,row){
|
|
var opts=$(this).combobox("options");
|
|
return row[opts.textField].indexOf(q)==0;
|
|
},formatter:function(row){
|
|
var opts=$(this).combobox("options");
|
|
return row[opts.textField];
|
|
},loader:function(_7c9,_7ca,_7cb){
|
|
var opts=$(this).combobox("options");
|
|
if(!opts.url){
|
|
return false;
|
|
}
|
|
$.ajax({type:opts.method,url:opts.url,data:_7c9,dataType:"json",success:function(data){
|
|
_7ca(data);
|
|
},error:function(){
|
|
_7cb.apply(this,arguments);
|
|
}});
|
|
},onBeforeLoad:function(_7cc){
|
|
},onLoadSuccess:function(){
|
|
},onLoadError:function(){
|
|
},onSelect:function(_7cd){
|
|
},onUnselect:function(_7ce){
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
function _7cf(_7d0){
|
|
var opts=$.data(_7d0,"combotree").options;
|
|
var tree=$.data(_7d0,"combotree").tree;
|
|
$(_7d0).addClass("combotree-f");
|
|
$(_7d0).combo(opts);
|
|
var _7d1=$(_7d0).combo("panel");
|
|
if(!tree){
|
|
tree=$("<ul></ul>").appendTo(_7d1);
|
|
$.data(_7d0,"combotree").tree=tree;
|
|
}
|
|
tree.tree($.extend({},opts,{checkbox:opts.multiple,onLoadSuccess:function(node,data){
|
|
var _7d2=$(_7d0).combotree("getValues");
|
|
if(opts.multiple){
|
|
var _7d3=tree.tree("getChecked");
|
|
for(var i=0;i<_7d3.length;i++){
|
|
var id=_7d3[i].id;
|
|
(function(){
|
|
for(var i=0;i<_7d2.length;i++){
|
|
if(id==_7d2[i]){
|
|
return;
|
|
}
|
|
}
|
|
_7d2.push(id);
|
|
})();
|
|
}
|
|
}
|
|
$(_7d0).combotree("setValues",_7d2);
|
|
opts.onLoadSuccess.call(this,node,data);
|
|
},onClick:function(node){
|
|
_7d5(_7d0);
|
|
$(_7d0).combo("hidePanel");
|
|
opts.onClick.call(this,node);
|
|
},onCheck:function(node,_7d4){
|
|
_7d5(_7d0);
|
|
opts.onCheck.call(this,node,_7d4);
|
|
}}));
|
|
};
|
|
function _7d5(_7d6){
|
|
var opts=$.data(_7d6,"combotree").options;
|
|
var tree=$.data(_7d6,"combotree").tree;
|
|
var vv=[],ss=[];
|
|
if(opts.multiple){
|
|
var _7d7=tree.tree("getChecked");
|
|
for(var i=0;i<_7d7.length;i++){
|
|
vv.push(_7d7[i].id);
|
|
ss.push(_7d7[i].text);
|
|
}
|
|
}else{
|
|
var node=tree.tree("getSelected");
|
|
if(node){
|
|
vv.push(node.id);
|
|
ss.push(node.text);
|
|
}
|
|
}
|
|
$(_7d6).combo("setValues",vv).combo("setText",ss.join(opts.separator));
|
|
};
|
|
function _7d8(_7d9,_7da){
|
|
var opts=$.data(_7d9,"combotree").options;
|
|
var tree=$.data(_7d9,"combotree").tree;
|
|
tree.find("span.tree-checkbox").addClass("tree-checkbox0").removeClass("tree-checkbox1 tree-checkbox2");
|
|
var vv=[],ss=[];
|
|
for(var i=0;i<_7da.length;i++){
|
|
var v=_7da[i];
|
|
var s=v;
|
|
var node=tree.tree("find",v);
|
|
if(node){
|
|
s=node.text;
|
|
tree.tree("check",node.target);
|
|
tree.tree("select",node.target);
|
|
}
|
|
vv.push(v);
|
|
ss.push(s);
|
|
}
|
|
$(_7d9).combo("setValues",vv).combo("setText",ss.join(opts.separator));
|
|
};
|
|
$.fn.combotree=function(_7db,_7dc){
|
|
if(typeof _7db=="string"){
|
|
var _7dd=$.fn.combotree.methods[_7db];
|
|
if(_7dd){
|
|
return _7dd(this,_7dc);
|
|
}else{
|
|
return this.combo(_7db,_7dc);
|
|
}
|
|
}
|
|
_7db=_7db||{};
|
|
return this.each(function(){
|
|
var _7de=$.data(this,"combotree");
|
|
if(_7de){
|
|
$.extend(_7de.options,_7db);
|
|
}else{
|
|
$.data(this,"combotree",{options:$.extend({},$.fn.combotree.defaults,$.fn.combotree.parseOptions(this),_7db)});
|
|
}
|
|
_7cf(this);
|
|
});
|
|
};
|
|
$.fn.combotree.methods={options:function(jq){
|
|
var opts=$.data(jq[0],"combotree").options;
|
|
opts.originalValue=jq.combo("options").originalValue;
|
|
return opts;
|
|
},tree:function(jq){
|
|
return $.data(jq[0],"combotree").tree;
|
|
},loadData:function(jq,data){
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"combotree").options;
|
|
opts.data=data;
|
|
var tree=$.data(this,"combotree").tree;
|
|
tree.tree("loadData",data);
|
|
});
|
|
},reload:function(jq,url){
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"combotree").options;
|
|
var tree=$.data(this,"combotree").tree;
|
|
if(url){
|
|
opts.url=url;
|
|
}
|
|
tree.tree({url:opts.url});
|
|
});
|
|
},setValues:function(jq,_7df){
|
|
return jq.each(function(){
|
|
_7d8(this,_7df);
|
|
});
|
|
},setValue:function(jq,_7e0){
|
|
return jq.each(function(){
|
|
_7d8(this,[_7e0]);
|
|
});
|
|
},clear:function(jq){
|
|
return jq.each(function(){
|
|
var tree=$.data(this,"combotree").tree;
|
|
tree.find("div.tree-node-selected").removeClass("tree-node-selected");
|
|
var cc=tree.tree("getChecked");
|
|
for(var i=0;i<cc.length;i++){
|
|
tree.tree("uncheck",cc[i].target);
|
|
}
|
|
$(this).combo("clear");
|
|
});
|
|
},reset:function(jq){
|
|
return jq.each(function(){
|
|
var opts=$(this).combotree("options");
|
|
if(opts.multiple){
|
|
$(this).combotree("setValues",opts.originalValue);
|
|
}else{
|
|
$(this).combotree("setValue",opts.originalValue);
|
|
}
|
|
});
|
|
}};
|
|
$.fn.combotree.parseOptions=function(_7e1){
|
|
return $.extend({},$.fn.combo.parseOptions(_7e1),$.fn.tree.parseOptions(_7e1));
|
|
};
|
|
$.fn.combotree.defaults=$.extend({},$.fn.combo.defaults,$.fn.tree.defaults,{editable:false});
|
|
})(jQuery);
|
|
(function($){
|
|
function _7e2(_7e3){
|
|
var opts=$.data(_7e3,"combogrid").options;
|
|
var grid=$.data(_7e3,"combogrid").grid;
|
|
$(_7e3).addClass("combogrid-f");
|
|
$(_7e3).combo(opts);
|
|
var _7e4=$(_7e3).combo("panel");
|
|
if(!grid){
|
|
grid=$("<table></table>").appendTo(_7e4);
|
|
$.data(_7e3,"combogrid").grid=grid;
|
|
}
|
|
grid.datagrid($.extend({},opts,{border:false,fit:true,singleSelect:(!opts.multiple),onLoadSuccess:function(data){
|
|
var _7e5=$.data(_7e3,"combogrid").remainText;
|
|
var _7e6=$(_7e3).combo("getValues");
|
|
_7f2(_7e3,_7e6,_7e5);
|
|
opts.onLoadSuccess.apply(_7e3,arguments);
|
|
},onClickRow:_7e7,onSelect:function(_7e8,row){
|
|
_7e9();
|
|
opts.onSelect.call(this,_7e8,row);
|
|
},onUnselect:function(_7ea,row){
|
|
_7e9();
|
|
opts.onUnselect.call(this,_7ea,row);
|
|
},onSelectAll:function(rows){
|
|
_7e9();
|
|
opts.onSelectAll.call(this,rows);
|
|
},onUnselectAll:function(rows){
|
|
if(opts.multiple){
|
|
_7e9();
|
|
}
|
|
opts.onUnselectAll.call(this,rows);
|
|
}}));
|
|
function _7e7(_7eb,row){
|
|
$.data(_7e3,"combogrid").remainText=false;
|
|
_7e9();
|
|
if(!opts.multiple){
|
|
$(_7e3).combo("hidePanel");
|
|
}
|
|
opts.onClickRow.call(this,_7eb,row);
|
|
};
|
|
function _7e9(){
|
|
var _7ec=$.data(_7e3,"combogrid").remainText;
|
|
var rows=grid.datagrid("getSelections");
|
|
var vv=[],ss=[];
|
|
for(var i=0;i<rows.length;i++){
|
|
vv.push(rows[i][opts.idField]);
|
|
ss.push(rows[i][opts.textField]);
|
|
}
|
|
if(!opts.multiple){
|
|
$(_7e3).combo("setValues",(vv.length?vv:[""]));
|
|
}else{
|
|
$(_7e3).combo("setValues",vv);
|
|
}
|
|
if(!_7ec){
|
|
$(_7e3).combo("setText",ss.join(opts.separator));
|
|
}
|
|
};
|
|
};
|
|
function _7ed(_7ee,step){
|
|
var opts=$.data(_7ee,"combogrid").options;
|
|
var grid=$.data(_7ee,"combogrid").grid;
|
|
var _7ef=grid.datagrid("getRows").length;
|
|
if(!_7ef){
|
|
return;
|
|
}
|
|
$.data(_7ee,"combogrid").remainText=false;
|
|
var _7f0;
|
|
var _7f1=grid.datagrid("getSelections");
|
|
if(_7f1.length){
|
|
_7f0=grid.datagrid("getRowIndex",_7f1[_7f1.length-1][opts.idField]);
|
|
_7f0+=step;
|
|
if(_7f0<0){
|
|
_7f0=0;
|
|
}
|
|
if(_7f0>=_7ef){
|
|
_7f0=_7ef-1;
|
|
}
|
|
}else{
|
|
if(step>0){
|
|
_7f0=0;
|
|
}else{
|
|
if(step<0){
|
|
_7f0=_7ef-1;
|
|
}else{
|
|
_7f0=-1;
|
|
}
|
|
}
|
|
}
|
|
if(_7f0>=0){
|
|
grid.datagrid("clearSelections");
|
|
grid.datagrid("selectRow",_7f0);
|
|
}
|
|
};
|
|
function _7f2(_7f3,_7f4,_7f5){
|
|
var opts=$.data(_7f3,"combogrid").options;
|
|
var grid=$.data(_7f3,"combogrid").grid;
|
|
var rows=grid.datagrid("getRows");
|
|
var ss=[];
|
|
for(var i=0;i<_7f4.length;i++){
|
|
var _7f6=grid.datagrid("getRowIndex",_7f4[i]);
|
|
if(_7f6>=0){
|
|
grid.datagrid("selectRow",_7f6);
|
|
ss.push(rows[_7f6][opts.textField]);
|
|
}else{
|
|
ss.push(_7f4[i]);
|
|
}
|
|
}
|
|
if($(_7f3).combo("getValues").join(",")==_7f4.join(",")){
|
|
return;
|
|
}
|
|
$(_7f3).combo("setValues",_7f4);
|
|
if(!_7f5){
|
|
$(_7f3).combo("setText",ss.join(opts.separator));
|
|
}
|
|
};
|
|
function _7f7(_7f8,q){
|
|
var opts=$.data(_7f8,"combogrid").options;
|
|
var grid=$.data(_7f8,"combogrid").grid;
|
|
$.data(_7f8,"combogrid").remainText=true;
|
|
if(opts.multiple&&!q){
|
|
_7f2(_7f8,[],true);
|
|
}else{
|
|
_7f2(_7f8,[q],true);
|
|
}
|
|
if(opts.mode=="remote"){
|
|
grid.datagrid("clearSelections");
|
|
grid.datagrid("load",$.extend({},opts.queryParams,{q:q}));
|
|
}else{
|
|
if(!q){
|
|
return;
|
|
}
|
|
var rows=grid.datagrid("getRows");
|
|
for(var i=0;i<rows.length;i++){
|
|
if(opts.filter.call(_7f8,q,rows[i])){
|
|
grid.datagrid("clearSelections");
|
|
grid.datagrid("selectRow",i);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
};
|
|
$.fn.combogrid=function(_7f9,_7fa){
|
|
if(typeof _7f9=="string"){
|
|
var _7fb=$.fn.combogrid.methods[_7f9];
|
|
if(_7fb){
|
|
return _7fb(this,_7fa);
|
|
}else{
|
|
return $.fn.combo.methods[_7f9](this,_7fa);
|
|
}
|
|
}
|
|
_7f9=_7f9||{};
|
|
return this.each(function(){
|
|
var _7fc=$.data(this,"combogrid");
|
|
if(_7fc){
|
|
$.extend(_7fc.options,_7f9);
|
|
}else{
|
|
_7fc=$.data(this,"combogrid",{options:$.extend({},$.fn.combogrid.defaults,$.fn.combogrid.parseOptions(this),_7f9)});
|
|
}
|
|
_7e2(this);
|
|
});
|
|
};
|
|
$.fn.combogrid.methods={options:function(jq){
|
|
var opts=$.data(jq[0],"combogrid").options;
|
|
opts.originalValue=jq.combo("options").originalValue;
|
|
return opts;
|
|
},grid:function(jq){
|
|
return $.data(jq[0],"combogrid").grid;
|
|
},setValues:function(jq,_7fd){
|
|
return jq.each(function(){
|
|
_7f2(this,_7fd);
|
|
});
|
|
},setValue:function(jq,_7fe){
|
|
return jq.each(function(){
|
|
_7f2(this,[_7fe]);
|
|
});
|
|
},clear:function(jq){
|
|
return jq.each(function(){
|
|
$(this).combogrid("grid").datagrid("clearSelections");
|
|
$(this).combo("clear");
|
|
});
|
|
},reset:function(jq){
|
|
return jq.each(function(){
|
|
var opts=$(this).combogrid("options");
|
|
if(opts.multiple){
|
|
$(this).combogrid("setValues",opts.originalValue);
|
|
}else{
|
|
$(this).combogrid("setValue",opts.originalValue);
|
|
}
|
|
});
|
|
}};
|
|
$.fn.combogrid.parseOptions=function(_7ff){
|
|
var t=$(_7ff);
|
|
return $.extend({},$.fn.combo.parseOptions(_7ff),$.fn.datagrid.parseOptions(_7ff),$.parser.parseOptions(_7ff,["idField","textField","mode"]));
|
|
};
|
|
$.fn.combogrid.defaults=$.extend({},$.fn.combo.defaults,$.fn.datagrid.defaults,{loadMsg:null,idField:null,textField:null,mode:"local",keyHandler:{up:function(){
|
|
_7ed(this,-1);
|
|
},down:function(){
|
|
_7ed(this,1);
|
|
},enter:function(){
|
|
_7ed(this,0);
|
|
$(this).combo("hidePanel");
|
|
},query:function(q){
|
|
_7f7(this,q);
|
|
}},filter:function(q,row){
|
|
var opts=$(this).combogrid("options");
|
|
return row[opts.textField].indexOf(q)==0;
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
function _800(_801){
|
|
var _802=$.data(_801,"datebox");
|
|
var opts=_802.options;
|
|
$(_801).addClass("datebox-f");
|
|
$(_801).combo($.extend({},opts,{onShowPanel:function(){
|
|
_802.calendar.calendar("resize");
|
|
opts.onShowPanel.call(_801);
|
|
}}));
|
|
$(_801).combo("textbox").parent().addClass("datebox");
|
|
if(!_802.calendar){
|
|
_803();
|
|
}
|
|
function _803(){
|
|
var _804=$(_801).combo("panel");
|
|
_802.calendar=$("<div></div>").appendTo(_804).wrap("<div class=\"datebox-calendar-inner\"></div>");
|
|
_802.calendar.calendar({fit:true,border:false,onSelect:function(date){
|
|
var _805=opts.formatter(date);
|
|
_809(_801,_805);
|
|
$(_801).combo("hidePanel");
|
|
opts.onSelect.call(_801,date);
|
|
}});
|
|
_809(_801,opts.value);
|
|
var _806=$("<div class=\"datebox-button\"></div>").appendTo(_804);
|
|
$("<a href=\"javascript:void(0)\" class=\"datebox-current\"></a>").html(opts.currentText).appendTo(_806);
|
|
$("<a href=\"javascript:void(0)\" class=\"datebox-close\"></a>").html(opts.closeText).appendTo(_806);
|
|
_806.find(".datebox-current,.datebox-close").hover(function(){
|
|
$(this).addClass("datebox-button-hover");
|
|
},function(){
|
|
$(this).removeClass("datebox-button-hover");
|
|
});
|
|
_806.find(".datebox-current").click(function(){
|
|
_802.calendar.calendar({year:new Date().getFullYear(),month:new Date().getMonth()+1,current:new Date()});
|
|
});
|
|
_806.find(".datebox-close").click(function(){
|
|
$(_801).combo("hidePanel");
|
|
});
|
|
};
|
|
};
|
|
function _807(_808,q){
|
|
_809(_808,q);
|
|
};
|
|
function _80a(_80b){
|
|
var opts=$.data(_80b,"datebox").options;
|
|
var c=$.data(_80b,"datebox").calendar;
|
|
var _80c=opts.formatter(c.calendar("options").current);
|
|
_809(_80b,_80c);
|
|
$(_80b).combo("hidePanel");
|
|
};
|
|
function _809(_80d,_80e){
|
|
var _80f=$.data(_80d,"datebox");
|
|
var opts=_80f.options;
|
|
$(_80d).combo("setValue",_80e).combo("setText",_80e);
|
|
_80f.calendar.calendar("moveTo",opts.parser(_80e));
|
|
};
|
|
$.fn.datebox=function(_810,_811){
|
|
if(typeof _810=="string"){
|
|
var _812=$.fn.datebox.methods[_810];
|
|
if(_812){
|
|
return _812(this,_811);
|
|
}else{
|
|
return this.combo(_810,_811);
|
|
}
|
|
}
|
|
_810=_810||{};
|
|
return this.each(function(){
|
|
var _813=$.data(this,"datebox");
|
|
if(_813){
|
|
$.extend(_813.options,_810);
|
|
}else{
|
|
$.data(this,"datebox",{options:$.extend({},$.fn.datebox.defaults,$.fn.datebox.parseOptions(this),_810)});
|
|
}
|
|
_800(this);
|
|
});
|
|
};
|
|
$.fn.datebox.methods={options:function(jq){
|
|
var opts=$.data(jq[0],"datebox").options;
|
|
opts.originalValue=jq.combo("options").originalValue;
|
|
return opts;
|
|
},calendar:function(jq){
|
|
return $.data(jq[0],"datebox").calendar;
|
|
},setValue:function(jq,_814){
|
|
return jq.each(function(){
|
|
_809(this,_814);
|
|
});
|
|
},reset:function(jq){
|
|
return jq.each(function(){
|
|
var opts=$(this).datebox("options");
|
|
$(this).datebox("setValue",opts.originalValue);
|
|
});
|
|
}};
|
|
$.fn.datebox.parseOptions=function(_815){
|
|
var t=$(_815);
|
|
return $.extend({},$.fn.combo.parseOptions(_815),{});
|
|
};
|
|
$.fn.datebox.defaults=$.extend({},$.fn.combo.defaults,{panelWidth:180,panelHeight:"auto",keyHandler:{up:function(){
|
|
},down:function(){
|
|
},enter:function(){
|
|
_80a(this);
|
|
},query:function(q){
|
|
_807(this,q);
|
|
}},currentText:"Today",closeText:"Close",okText:"Ok",formatter:function(date){
|
|
var y=date.getFullYear();
|
|
var m=date.getMonth()+1;
|
|
var d=date.getDate();
|
|
return m+"/"+d+"/"+y;
|
|
},parser:function(s){
|
|
var t=Date.parse(s);
|
|
if(!isNaN(t)){
|
|
return new Date(t);
|
|
}else{
|
|
return new Date();
|
|
}
|
|
},onSelect:function(date){
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
function _816(_817){
|
|
var _818=$.data(_817,"datetimebox");
|
|
var opts=_818.options;
|
|
$(_817).datebox($.extend({},opts,{onShowPanel:function(){
|
|
var _819=$(_817).datetimebox("getValue");
|
|
_81c(_817,_819,true);
|
|
opts.onShowPanel.call(_817);
|
|
},formatter:$.fn.datebox.defaults.formatter,parser:$.fn.datebox.defaults.parser}));
|
|
$(_817).removeClass("datebox-f").addClass("datetimebox-f");
|
|
$(_817).datebox("calendar").calendar({onSelect:function(date){
|
|
opts.onSelect.call(_817,date);
|
|
}});
|
|
var _81a=$(_817).datebox("panel");
|
|
if(!_818.spinner){
|
|
var p=$("<div style=\"padding:2px\"><input style=\"width:80px\"></div>").insertAfter(_81a.children("div.datebox-calendar-inner"));
|
|
_818.spinner=p.children("input");
|
|
var _81b=_81a.children("div.datebox-button");
|
|
var ok=$("<a href=\"javascript:void(0)\" class=\"datebox-ok\"></a>").html(opts.okText).appendTo(_81b);
|
|
ok.hover(function(){
|
|
$(this).addClass("datebox-button-hover");
|
|
},function(){
|
|
$(this).removeClass("datebox-button-hover");
|
|
}).click(function(){
|
|
_821(_817);
|
|
});
|
|
}
|
|
_818.spinner.timespinner({showSeconds:opts.showSeconds,separator:opts.timeSeparator}).unbind(".datetimebox").bind("mousedown.datetimebox",function(e){
|
|
e.stopPropagation();
|
|
});
|
|
_81c(_817,opts.value);
|
|
};
|
|
function _81d(_81e){
|
|
var c=$(_81e).datetimebox("calendar");
|
|
var t=$(_81e).datetimebox("spinner");
|
|
var date=c.calendar("options").current;
|
|
return new Date(date.getFullYear(),date.getMonth(),date.getDate(),t.timespinner("getHours"),t.timespinner("getMinutes"),t.timespinner("getSeconds"));
|
|
};
|
|
function _81f(_820,q){
|
|
_81c(_820,q,true);
|
|
};
|
|
function _821(_822){
|
|
var opts=$.data(_822,"datetimebox").options;
|
|
var date=_81d(_822);
|
|
_81c(_822,opts.formatter.call(_822,date));
|
|
$(_822).combo("hidePanel");
|
|
};
|
|
function _81c(_823,_824,_825){
|
|
var opts=$.data(_823,"datetimebox").options;
|
|
$(_823).combo("setValue",_824);
|
|
if(!_825){
|
|
if(_824){
|
|
var date=opts.parser.call(_823,_824);
|
|
$(_823).combo("setValue",opts.formatter.call(_823,date));
|
|
$(_823).combo("setText",opts.formatter.call(_823,date));
|
|
}else{
|
|
$(_823).combo("setText",_824);
|
|
}
|
|
}
|
|
var date=opts.parser.call(_823,_824);
|
|
$(_823).datetimebox("calendar").calendar("moveTo",date);
|
|
$(_823).datetimebox("spinner").timespinner("setValue",_826(date));
|
|
function _826(date){
|
|
function _827(_828){
|
|
return (_828<10?"0":"")+_828;
|
|
};
|
|
var tt=[_827(date.getHours()),_827(date.getMinutes())];
|
|
if(opts.showSeconds){
|
|
tt.push(_827(date.getSeconds()));
|
|
}
|
|
return tt.join($(_823).datetimebox("spinner").timespinner("options").separator);
|
|
};
|
|
};
|
|
$.fn.datetimebox=function(_829,_82a){
|
|
if(typeof _829=="string"){
|
|
var _82b=$.fn.datetimebox.methods[_829];
|
|
if(_82b){
|
|
return _82b(this,_82a);
|
|
}else{
|
|
return this.datebox(_829,_82a);
|
|
}
|
|
}
|
|
_829=_829||{};
|
|
return this.each(function(){
|
|
var _82c=$.data(this,"datetimebox");
|
|
if(_82c){
|
|
$.extend(_82c.options,_829);
|
|
}else{
|
|
$.data(this,"datetimebox",{options:$.extend({},$.fn.datetimebox.defaults,$.fn.datetimebox.parseOptions(this),_829)});
|
|
}
|
|
_816(this);
|
|
});
|
|
};
|
|
$.fn.datetimebox.methods={options:function(jq){
|
|
var opts=$.data(jq[0],"datetimebox").options;
|
|
opts.originalValue=jq.datebox("options").originalValue;
|
|
return opts;
|
|
},spinner:function(jq){
|
|
return $.data(jq[0],"datetimebox").spinner;
|
|
},setValue:function(jq,_82d){
|
|
return jq.each(function(){
|
|
_81c(this,_82d);
|
|
});
|
|
},reset:function(jq){
|
|
return jq.each(function(){
|
|
var opts=$(this).datetimebox("options");
|
|
$(this).datetimebox("setValue",opts.originalValue);
|
|
});
|
|
}};
|
|
$.fn.datetimebox.parseOptions=function(_82e){
|
|
var t=$(_82e);
|
|
return $.extend({},$.fn.datebox.parseOptions(_82e),$.parser.parseOptions(_82e,["timeSeparator",{showSeconds:"boolean"}]));
|
|
};
|
|
$.fn.datetimebox.defaults=$.extend({},$.fn.datebox.defaults,{showSeconds:true,timeSeparator:":",keyHandler:{up:function(){
|
|
},down:function(){
|
|
},enter:function(){
|
|
_821(this);
|
|
},query:function(q){
|
|
_81f(this,q);
|
|
}},formatter:function(date){
|
|
var h=date.getHours();
|
|
var M=date.getMinutes();
|
|
var s=date.getSeconds();
|
|
function _82f(_830){
|
|
return (_830<10?"0":"")+_830;
|
|
};
|
|
var _831=$(this).datetimebox("spinner").timespinner("options").separator;
|
|
var r=$.fn.datebox.defaults.formatter(date)+" "+_82f(h)+_831+_82f(M);
|
|
if($(this).datetimebox("options").showSeconds){
|
|
r+=_831+_82f(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 _832=$(this).datetimebox("spinner").timespinner("options").separator;
|
|
var tt=dt[1].split(_832);
|
|
var hour=parseInt(tt[0],10)||0;
|
|
var _833=parseInt(tt[1],10)||0;
|
|
var _834=parseInt(tt[2],10)||0;
|
|
return new Date(d.getFullYear(),d.getMonth(),d.getDate(),hour,_833,_834);
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
function init(_835){
|
|
var _836=$("<div class=\"slider\">"+"<div class=\"slider-inner\">"+"<a href=\"javascript:void(0)\" class=\"slider-handle\"></a>"+"<span class=\"slider-tip\"></span>"+"</div>"+"<div class=\"slider-rule\"></div>"+"<div class=\"slider-rulelabel\"></div>"+"<div style=\"clear:both\"></div>"+"<input type=\"hidden\" class=\"slider-value\">"+"</div>").insertAfter(_835);
|
|
var name=$(_835).hide().attr("name");
|
|
if(name){
|
|
_836.find("input.slider-value").attr("name",name);
|
|
$(_835).removeAttr("name").attr("sliderName",name);
|
|
}
|
|
return _836;
|
|
};
|
|
function _837(_838,_839){
|
|
var opts=$.data(_838,"slider").options;
|
|
var _83a=$.data(_838,"slider").slider;
|
|
if(_839){
|
|
if(_839.width){
|
|
opts.width=_839.width;
|
|
}
|
|
if(_839.height){
|
|
opts.height=_839.height;
|
|
}
|
|
}
|
|
if(opts.mode=="h"){
|
|
_83a.css("height","");
|
|
_83a.children("div").css("height","");
|
|
if(!isNaN(opts.width)){
|
|
_83a.width(opts.width);
|
|
}
|
|
}else{
|
|
_83a.css("width","");
|
|
_83a.children("div").css("width","");
|
|
if(!isNaN(opts.height)){
|
|
_83a.height(opts.height);
|
|
_83a.find("div.slider-rule").height(opts.height);
|
|
_83a.find("div.slider-rulelabel").height(opts.height);
|
|
_83a.find("div.slider-inner")._outerHeight(opts.height);
|
|
}
|
|
}
|
|
_83b(_838);
|
|
};
|
|
function _83c(_83d){
|
|
var opts=$.data(_83d,"slider").options;
|
|
var _83e=$.data(_83d,"slider").slider;
|
|
var aa=opts.mode=="h"?opts.rule:opts.rule.slice(0).reverse();
|
|
if(opts.reversed){
|
|
aa=aa.slice(0).reverse();
|
|
}
|
|
_83f(aa);
|
|
function _83f(aa){
|
|
var rule=_83e.find("div.slider-rule");
|
|
var _840=_83e.find("div.slider-rulelabel");
|
|
rule.empty();
|
|
_840.empty();
|
|
for(var i=0;i<aa.length;i++){
|
|
var _841=i*100/(aa.length-1)+"%";
|
|
var span=$("<span></span>").appendTo(rule);
|
|
span.css((opts.mode=="h"?"left":"top"),_841);
|
|
if(aa[i]!="|"){
|
|
span=$("<span></span>").appendTo(_840);
|
|
span.html(aa[i]);
|
|
if(opts.mode=="h"){
|
|
span.css({left:_841,marginLeft:-Math.round(span.outerWidth()/2)});
|
|
}else{
|
|
span.css({top:_841,marginTop:-Math.round(span.outerHeight()/2)});
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
function _842(_843){
|
|
var opts=$.data(_843,"slider").options;
|
|
var _844=$.data(_843,"slider").slider;
|
|
_844.removeClass("slider-h slider-v slider-disabled");
|
|
_844.addClass(opts.mode=="h"?"slider-h":"slider-v");
|
|
_844.addClass(opts.disabled?"slider-disabled":"");
|
|
_844.find("a.slider-handle").draggable({axis:opts.mode,cursor:"pointer",disabled:opts.disabled,onDrag:function(e){
|
|
var left=e.data.left;
|
|
var _845=_844.width();
|
|
if(opts.mode!="h"){
|
|
left=e.data.top;
|
|
_845=_844.height();
|
|
}
|
|
if(left<0||left>_845){
|
|
return false;
|
|
}else{
|
|
var _846=_855(_843,left);
|
|
_847(_846);
|
|
return false;
|
|
}
|
|
},onStartDrag:function(){
|
|
opts.onSlideStart.call(_843,opts.value);
|
|
},onStopDrag:function(e){
|
|
var _848=_855(_843,(opts.mode=="h"?e.data.left:e.data.top));
|
|
_847(_848);
|
|
opts.onSlideEnd.call(_843,opts.value);
|
|
}});
|
|
function _847(_849){
|
|
var s=Math.abs(_849%opts.step);
|
|
if(s<opts.step/2){
|
|
_849-=s;
|
|
}else{
|
|
_849=_849-s+opts.step;
|
|
}
|
|
_84a(_843,_849);
|
|
};
|
|
};
|
|
function _84a(_84b,_84c){
|
|
var opts=$.data(_84b,"slider").options;
|
|
var _84d=$.data(_84b,"slider").slider;
|
|
var _84e=opts.value;
|
|
if(_84c<opts.min){
|
|
_84c=opts.min;
|
|
}
|
|
if(_84c>opts.max){
|
|
_84c=opts.max;
|
|
}
|
|
opts.value=_84c;
|
|
$(_84b).val(_84c);
|
|
_84d.find("input.slider-value").val(_84c);
|
|
var pos=_84f(_84b,_84c);
|
|
var tip=_84d.find(".slider-tip");
|
|
if(opts.showTip){
|
|
tip.show();
|
|
tip.html(opts.tipFormatter.call(_84b,opts.value));
|
|
}else{
|
|
tip.hide();
|
|
}
|
|
if(opts.mode=="h"){
|
|
var _850="left:"+pos+"px;";
|
|
_84d.find(".slider-handle").attr("style",_850);
|
|
tip.attr("style",_850+"margin-left:"+(-Math.round(tip.outerWidth()/2))+"px");
|
|
}else{
|
|
var _850="top:"+pos+"px;";
|
|
_84d.find(".slider-handle").attr("style",_850);
|
|
tip.attr("style",_850+"margin-left:"+(-Math.round(tip.outerWidth()))+"px");
|
|
}
|
|
if(_84e!=_84c){
|
|
opts.onChange.call(_84b,_84c,_84e);
|
|
}
|
|
};
|
|
function _83b(_851){
|
|
var opts=$.data(_851,"slider").options;
|
|
var fn=opts.onChange;
|
|
opts.onChange=function(){
|
|
};
|
|
_84a(_851,opts.value);
|
|
opts.onChange=fn;
|
|
};
|
|
function _84f(_852,_853){
|
|
var opts=$.data(_852,"slider").options;
|
|
var _854=$.data(_852,"slider").slider;
|
|
if(opts.mode=="h"){
|
|
var pos=(_853-opts.min)/(opts.max-opts.min)*_854.width();
|
|
if(opts.reversed){
|
|
pos=_854.width()-pos;
|
|
}
|
|
}else{
|
|
var pos=_854.height()-(_853-opts.min)/(opts.max-opts.min)*_854.height();
|
|
if(opts.reversed){
|
|
pos=_854.height()-pos;
|
|
}
|
|
}
|
|
return pos.toFixed(0);
|
|
};
|
|
function _855(_856,pos){
|
|
var opts=$.data(_856,"slider").options;
|
|
var _857=$.data(_856,"slider").slider;
|
|
if(opts.mode=="h"){
|
|
var _858=opts.min+(opts.max-opts.min)*(pos/_857.width());
|
|
}else{
|
|
var _858=opts.min+(opts.max-opts.min)*((_857.height()-pos)/_857.height());
|
|
}
|
|
return opts.reversed?opts.max-_858.toFixed(0):_858.toFixed(0);
|
|
};
|
|
$.fn.slider=function(_859,_85a){
|
|
if(typeof _859=="string"){
|
|
return $.fn.slider.methods[_859](this,_85a);
|
|
}
|
|
_859=_859||{};
|
|
return this.each(function(){
|
|
var _85b=$.data(this,"slider");
|
|
if(_85b){
|
|
$.extend(_85b.options,_859);
|
|
}else{
|
|
_85b=$.data(this,"slider",{options:$.extend({},$.fn.slider.defaults,$.fn.slider.parseOptions(this),_859),slider:init(this)});
|
|
$(this).removeAttr("disabled");
|
|
}
|
|
_842(this);
|
|
_83c(this);
|
|
_837(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,_85c){
|
|
return jq.each(function(){
|
|
_837(this,_85c);
|
|
});
|
|
},getValue:function(jq){
|
|
return jq.slider("options").value;
|
|
},setValue:function(jq,_85d){
|
|
return jq.each(function(){
|
|
_84a(this,_85d);
|
|
});
|
|
},enable:function(jq){
|
|
return jq.each(function(){
|
|
$.data(this,"slider").options.disabled=false;
|
|
_842(this);
|
|
});
|
|
},disable:function(jq){
|
|
return jq.each(function(){
|
|
$.data(this,"slider").options.disabled=true;
|
|
_842(this);
|
|
});
|
|
}};
|
|
$.fn.slider.parseOptions=function(_85e){
|
|
var t=$(_85e);
|
|
return $.extend({},$.parser.parseOptions(_85e,["width","height","mode",{reversed:"boolean",showTip:"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,value:0,min:0,max:100,step:1,rule:[],tipFormatter:function(_85f){
|
|
return _85f;
|
|
},onChange:function(_860,_861){
|
|
},onSlideStart:function(_862){
|
|
},onSlideEnd:function(_863){
|
|
}};
|
|
})(jQuery);
|
|
|
|
|