if(typeof (_localeLookup)=="undefined"){
_localeLookup=function(s){
return null;
};
}
function loc(){
var _2=_localeLookup(arguments[0]);
if(!_2){
_2=arguments[0].replace(/\[_(\d+)\]/g,"&$1");
}
for(var i=1;i<arguments.length;++i){
var _4=new RegExp("&"+i,"g");
_2=_2.replace(_4,arguments[i]);
}
return _2;
}
std={};
std.browser={isFF:null,isIE:null,isMoz:null,isOpera:null,isAppleWebKit:null,isSupport:null,major:null,minor:null,gecko:null,isSafariWin:null,isSafariMobile:null};
std.browser.platform={};
std.browser.applewebkit={};
std.browser.applewebkit.parseVersion=function(_5){
var _6=_5.split(".");
var _7=(_5[_5.length-1]=="+");
if(_7){
var _8="+";
}else{
var _8=parseInt(_6[1]);
if(isNaN(_8)){
_8="";
}
}
return {major:parseInt(_6[0]),minor:_8,is_nightly:_7};
};
std.browser.applewebkit.getVersion=function(){
var _9=new RegExp("\\(.*\\) AppleWebKit/(.*) \\((.*)");
var _a=_9.exec(navigator.userAgent);
if(_a){
var _b=std.browser.applewebkit.parseVersion(_a[1]);
}
return {major:_b["major"],minor:_b["minor"],is_nightly:_b["is_nightly"]};
};
(function(){
var i,_d;
var ua=navigator.userAgent;
if((std.browser.isOpera=(i=ua.indexOf("Opera"))>=0)){
std.browser.major=parseFloat(ua.substr(i+6));
}else{
if((std.browser.isAppleWebKit=((i=ua.indexOf("AppleWebKit"))>=0))){
var _f=std.browser.applewebkit.getVersion();
std.browser.major=_f["major"];
std.browser.minor=_f["minor"];
std.browser.isSafariWin=navigator.platform.indexOf("Win")==0;
std.browser.isSafariMobile=(ua.indexOf("Mobile")!=-1);
std.browser.isChrome=(ua.indexOf("Chrome")!=-1);
}else{
if((std.browser.isIE=(i=ua.indexOf("MSIE "))>=0)){
std.browser.major=parseFloat(ua.substr(i+5));
}else{
if(std.browser.isMoz=(_d=/^Mozilla.+ rv:([0-9]+\.[0-9]+)(\.[0-9]+(?:\.[0-9]+)?)?/.exec(ua))!=null){
std.browser.major=_d[1];
std.browser.minor=_d[2];
std.browser.isFF=ua.indexOf("Firefox/")!=-1;
_d=/Gecko\/([0-9]+)/.exec(ua);
if(_d){
std.browser.gecko=_d[1];
}
}
}
}
}
std.browser.platform.isWin=navigator.platform.indexOf("Win")==0;
std.browser.platform.isMacOS=(ua.indexOf("Mac OS")!=-1);
std.browser.isSupport=(std.browser.isIE&&std.browser.major>=6)||(std.browser.isMoz&&std.browser.major>=1.7&&std.browser.gecko!="20060127")||(std.browser.isOpera&&std.browser.major>=9)||(std.browser.isAppleWebKit&&std.browser.major>=3);
std.browser.isIEQuirksMode=(document.compatMode=="BackCompat"&&std.browser.isIE);
std.browser.isBorderBox=!(document.compatMode=="CSS1Compat"&&std.browser.isIE)||(std.browser.isAppleWebKit&&std.browser.major<3);
})();
std.browser.no={};
std.browser.buggy={};
(std.browser.recalcRules=function(){
if(std.browser.isSafariMobile){
std.browser.no.ondblclick=true;
}
})();
std.array={};
std.array.from=function(_10){
var arr=[];
for(var i=0;i<_10.length;i++){
arr.push(_10[i]);
}
return arr;
};
std.array.contains=function(_13,_14){
for(var i=0;i<_13.length;i++){
if(_13[i]==_14){
return true;
}
}
return false;
};
std.array.without=function(_16,_17,_18){
var _19=new Array();
if(_18){
for(var i=0;i<_16.length;i++){
if(!_18(_16[i],_17)){
_19.push(_16[i]);
}
}
}else{
for(var i=0;i<_16.length;i++){
if(_16[i]!=_17){
_19.push(_16[i]);
}
}
}
return _19;
};
std.event={KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46};
std.event.observers=false;
std.event._observeAndCache=function(_1b,_1c,_1d,_1e){
if(!this.observers){
this.observers=[];
}
if(_1b.addEventListener){
this.observers.push([_1b,_1c,_1d,_1e]);
_1b.addEventListener(_1c,_1d,_1e);
}else{
if(_1b.attachEvent){
this.observers.push([_1b,_1c,_1d,_1e]);
_1b.attachEvent("on"+_1c,_1d);
}
}
};
std.event.unloadCache=function(){
if(!std.event.observers){
return;
}
for(var i=0;i<std.event.observers.length;i++){
std.event.stopObserving.apply(this,std.event.observers[i]);
std.event.observers[i][0]=null;
}
std.event.observers=false;
};
std.event.nativeSetObserved=function(_20,_21,_22,_23,_24){
return _20?std.event.nativeObserve(_21,_22,_23,_24):std.event.nativeStopObserving(_21,_22,_23,_24);
};
std.event.nativeObserve=function(_25,_26,_27,_28){
_25=typeof (_25)=="string"?document.getElementById(_25):_25;
_25.tagName;
_28=_28||false;
std.event._observeAndCache(_25,_26,_27,_28);
};
std.event.nativeStopObserving=function(_29,_2a,_2b,_2c){
_29=typeof (_29)=="string"?document.getElementById(_29):_29;
_2c=_2c||false;
if(_29.removeEventListener){
_29.removeEventListener(_2a,_2b,_2c);
}else{
if(_29.detachEvent){
_29.detachEvent("on"+_2a,_2b);
}
}
};
std.event.observe=function(_2d,_2e,_2f,_30){
if(_2e=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||document.attachEvent)){
_2e="keydown";
}
std.event.nativeObserve(_2d,_2e,_2f,_30);
};
std.event.stopObserving=function(_31,_32,_33,_34){
if(_32=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||document.detachEvent)){
_32="keydown";
}
std.event.nativeStopObserving(_31,_32,_33,_34);
};
std.event.observe(window,"unload",std.event.unloadCache,false);
std.event.listener=function(obj,_36){
var _37=std.array.from(arguments);
var obj=_37.shift();
var _36=_37.shift();
_36.prototype;
if(typeof _36!="function"){
throw "Invalid method: "+_36;
}
return function(e){
return _36.apply(obj,[e||window.event].concat(_37));
};
};
std.event.KeyCodes={};
std.event.KeyCodes.generic={KEY_BACKSPACE:8,KEY_TAB:9,KEY_ENTER:13,KEY_SHIFT:16,KEY_CTRL:17,KEY_ALT:18,KEY_PAUSE:19,KEY_CAPS_LOCK:20,KEY_ESCAPE:27,KEY_SPACE:32,KEY_PAGE_UP:33,KEY_PAGE_DOWN:34,KEY_END:35,KEY_HOME:36,KEY_LEFT_ARROW:37,KEY_UP_ARROW:38,KEY_RIGHT_ARROW:39,KEY_DOWN_ARROW:40,KEY_INSERT:45,KEY_DELETE:46,KEY_LEFT_WINDOW:91,KEY_RIGHT_WINDOW:92,KEY_SELECT:93,KEY_F1:112,KEY_F2:113,KEY_F3:114,KEY_F4:115,KEY_F5:116,KEY_F6:117,KEY_F7:118,KEY_F8:119,KEY_F9:120,KEY_F10:121,KEY_F11:122,KEY_F12:123,KEY_NUM_LOCK:144,KEY_SCROLL_LOCK:145,KEY_CMD:224,KEY_IME:229};
std.event.KeyCodes.webkit418={KEY_BACKSPACE:8,KEY_TAB:9,KEY_ENTER:13,KEY_SHIFT:16,KEY_CTRL:17,KEY_ALT:18,KEY_PAUSE:63250,KEY_CAPS_LOCK:20,KEY_ESCAPE:27,KEY_SPACE:32,KEY_PAGE_UP:63276,KEY_PAGE_DOWN:63277,KEY_END:63275,KEY_HOME:63273,KEY_LEFT_ARROW:63234,KEY_UP_ARROW:63232,KEY_RIGHT_ARROW:63235,KEY_DOWN_ARROW:63233,KEY_INSERT:63302,KEY_DELETE:63272,KEY_LEFT_WINDOW:91,KEY_RIGHT_WINDOW:92,KEY_SELECT:93,KEY_F1:63236,KEY_F2:63237,KEY_F3:63238,KEY_F4:63239,KEY_F5:63240,KEY_F6:63241,KEY_F7:63242,KEY_F8:63243,KEY_F9:63244,KEY_F10:63245,KEY_F11:63246,KEY_F12:63247,KEY_NUM_LOCK:144,KEY_SCROLL_LOCK:145};
std.event.KeyMap={AppleWebKit:{63250:19,63276:33,63277:34,63275:35,63273:36,63234:37,63232:38,63235:39,63233:40,63302:45,63272:46,63236:112,63237:113,63238:114,63239:115,63240:116,63241:117,63242:118,63243:119,63244:120,63245:121,63246:122,63247:123}};
std.event.getKeyCodes=function(e){
if(e&&e.type!="keypress"){
return std.event.KeyCodes.generic;
}
if(std.browser.isAppleWebKit&&!std.browser.isSafariWin){
return std.event.KeyCodes.webkit418;
}
return std.event.KeyCodes.generic;
};
std.event.getKeyCode=function(e){
if(std.browser.isSafariWin&&std.browser.major>=3){
var key=e.keyIdentifier.toLowerCase();
var _3c=std.event.getKeyCodes(e);
var _3d={"up":_3c.KEY_UP_ARROW,"down":_3c.KEY_DOWN_ARROW,"left":_3c.KEY_LEFT_ARROW,"right":_3c.KEY_RIGHT_ARROW,"home":_3c.KEY_HOME,"end":_3c.KEY_END,"pageup":_3c.KEY_PAGE_UP,"pagedown":_3c.KEY_PAGE_DOWN,"insert":_3c.KEY_INSERT,"u+00007f":_3c.KEY_DELETE,"f2":_3c.KEY_F2};
if(_3d[key]){
return _3d[key];
}
}
return e.keyCode||e.which;
};
std.event.getChar=function(e){
var _3f=std.browser.isIE||std.browser.isOpera?e.keyCode:e.charCode;
if(std.browser.isAppleWebKit){
if(e.ctrlKey&&_3f<96){
_3f+=96;
}
}
return String.fromCharCode(_3f).toUpperCase();
};
std.event.getCharCode=function(e){
return std.browser.isIE?e.keyCode:std.browser.isOpera?e.which:e.charCode;
};
std.event.getOffset=function(e){
return {x:e.offsetX||e.layerX,y:e.offsetY||e.layerY};
};
std.event.listener=function(){
var _42=std.array.from(arguments);
var obj=_42.shift(),_44=_42.shift();
if(!_44||typeof (_44)!="function"){
null.assert;
}
if(_42.length==0){
return function listener(e){
return _44.call(obj,e||window.event);
};
}else{
return function listener(e){
return _44.apply(obj,[e||window.event].concat(_42));
};
}
};
std.event.element=function(_47){
return _47.target||_47.srcElement;
};
std.event.toElement=function(_48){
return _48.relatedTarget||_48.toElement;
};
std.event.fromElement=function(_49){
return _49.relatedTarget||_49.fromElement;
};
std.event.isLeftClick=function(_4a){
return (((_4a.which)&&(_4a.which==1))||((_4a.button)&&(_4a.button==1)));
};
std.event.isCmdDown=function(_4b){
return _4b.metaKey&&std.browser.platform.isMacOS;
};
std.event.pointerX=function(_4c){
return _4c.pageX||(_4c.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));
};
std.event.pointerY=function(_4d){
return _4d.pageY||(_4d.clientY+(document.documentElement.scrollTop||document.body.scrollTop));
};
std.event.vanish=function(_4e){
std.event.stop(_4e);
std.event.preventDefault(_4e);
};
std.event.stop=function(_4f){
_4f=_4f||window.event;
if(_4f.stopPropagation){
_4f.stopPropagation();
}else{
_4f.cancelBubble=true;
}
};
std.event.dispatchMouseEvent=function(_50,_51,evt){
if(_50.dispatchEvent){
if(evt==null){
evt={bubbles:true,cancelable:true,view:window,detail:0,screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:false,altKey:false,shiftKey:false,metaKey:false,button:0,relatedTarget:null};
}
var e=document.createEvent("MouseEvents");
e.initMouseEvent(_51,evt.bubbles,evt.cancelable,evt.view,evt.detail,evt.screenX,evt.screenY,evt.clientX,evt.clientY,evt.ctrlKey,evt.altKey,evt.shiftKey,evt.metaKey,evt.button,evt.relatedTarget);
return _50.dispatchEvent(e);
}
return true;
};
std.event.preventDefault=function(_54){
_54=_54||window.event;
if(_54.preventDefault){
_54.preventDefault();
}else{
_54.returnValue=false;
}
};
std.event.ObserverChain=function(_55,_56){
this.clz=std.event.ObserverChain;
this.element=_55;
this.name=_56;
this.observers=[];
this.listener=std.event.listener(this,this._observer);
std.event.observe(_55,_56,this.listener,false);
};
std.event.ObserverChain._instances=[];
std.event.ObserverChain.getInstance=function(_57,_58){
var _59=std.event.ObserverChain._instances;
for(var i=0;i<_59.length;i++){
var _5b=_59[i];
if(_5b.element==_57&&_5b.name==_58){
return _5b;
}
}
var _5b=new std.event.ObserverChain(_57,_58);
_59.push(_5b);
return _5b;
};
std.event.ObserverChain.removeInstance=function(_5c){
std.event.ObserverChain._instances=std.array.without(std.event.ObserverChain._instances,_5c);
};
std.event.ObserverChain.prototype.addObserver=function(_5d){
this.observers.push(_5d);
};
std.event.ObserverChain.prototype.removeObserver=function(_5e){
this.observers=std.array.without(this.observers,_5e);
if(this.observers.length==0){
std.event.stopObserving(this.listener);
this.clz.removeInstance(this);
}
};
std.event.ObserverChain.prototype._observer=function(e){
for(var i=0;i<this.observers.length;i++){
this.observers[i](e);
}
};
std.event.chainObserve=function(_61,_62,_63){
std.event.ObserverChain.getInstance(_61,_62).addObserver(_63);
};
std.event.stopChainObserving=function(_64,_65,_66){
std.event.ObserverChain.getInstance(_64,_65).removeObserver(_66);
};
std.event.keyObserve=function(_67,_68,_69,_6a){
return std.event.keySetObserved(true,_67,_68,_69,_6a);
};
std.event.keyStopObserving=function(_6b,_6c,_6d,_6e){
return std.event.keySetObserved(false,_6b,_6c,_6d,_6e);
};
std.event.keySetObserved=function(_6f,_70,_71,_72,_73){
var _74=null;
var _75;
if((_75=this._keyListenerTable[_71])==null){
_75=this._keyListenerTable[_71]=[];
}
if(_6f){
_74=std.event._keyListener(_72,_71);
_75.push({observer:_72,keyObserver:_74});
}else{
for(var i=0;i<_75.length;++i){
if(_75[i]&&_75[i].observer===_72){
_74=_75[i].keyObserver;
_75[i]=null;
break;
}
}
if(_74==null){
return;
}
}
switch(_71){
case "keydown":
case "keyup":
std.event.nativeSetObserved(_6f,_70,_71,_74,_73);
break;
case "keypress":
if(std.browser.isIE){
std.event.nativeSetObserved(_6f,_70,"keydown",_74,_73);
}else{
if(std.browser.isAppleWebKit){
if(std.browser.major<=525&&std.browser.platform.IsMacOS){
std.event.nativeSetObserved(_6f,_70,"keypress",_74,_73);
std.event.nativeSetObserved(_6f,_70,"keydown",_74,_73);
}else{
std.event.nativeSetObserved(_6f,_70,"keydown",_74,_73);
}
}else{
std.event.nativeSetObserved(_6f,_70,"keypress",_74,_73);
}
}
break;
case "keyinput":
if(std.browser.isAppleWebKit&&std.browser.platform.isMacOS){
if(std.browser.major==522){
std.event.nativeSetObserved(_6f,_70,"keydown",_74,_73);
}
std.event.nativeSetObserved(_6f,_70,"keypress",_74,_73);
}else{
if(std.browser.isAppleWebKit){
std.event.nativeSetObserved(_6f,_70,"keypress",_74,_73);
}else{
std.event.nativeSetObserved(_6f,_70,"keypress",_74,_73);
}
}
break;
default:
throw "Unsupported event: "+_71;
}
};
std.event._keyListenerTable={};
std.event._keyListener=function(_77,_78){
return function(e){
var ke={keyIdentifier:null,evt:e||window.event};
switch(_78){
case "keydown":
case "keyup":
if(std.browser.isFF){
if(ke.evt.keyCode==59){
ke.keyIdentifier=186;
}else{
ke.keyIdentifier=ke.evt.keyCode;
}
}else{
if(std.browser.isOpera){
if(ke.evt.keyCode==44){
ke.keyIdentifier=188;
}else{
if(ke.evt.keyCode==47){
ke.keyIdentifier=191;
}else{
if(ke.evt.keyCode==59){
ke.keyIdentifier=186;
}else{
if(ke.evt.keyCode==96){
ke.keyIdentifier=192;
}else{
ke.keyIdentifier=ke.evt.keyCode;
}
}
}
}
}else{
ke.keyIdentifier=ke.evt.keyCode;
}
}
break;
case "keypress":
if(std.browser.isFF){
if(ke.evt.keyCode){
ke.keyIdentifier=ke.evt.keyCode;
}else{
if(ke.evt.charCode==59){
ke.keyIdentifier=186;
}else{
if(ke.evt.charCode==32||(ke.evt.charCode>=65&&ke.evt.charCode<=90)||(ke.evt.charCode>=48&&ke.evt.charCode<=57)){
ke.keyIdentifier=ke.evt.charCode;
}else{
if(ke.evt.charCode>=97&&ke.evt.charCode<=122){
ke.keyIdentifier=ke.evt.charCode-32;
}else{
ke.keyIdentifier=0;
}
}
}
}
}else{
if(std.browser.isAppleWebKit){
if(ke.evt.type=="keydown"){
ke.keyIdentifier=ke.evt.keyCode;
}else{
if(ke.evt.charCode==32||(ke.evt.charCode>=65&&ke.evt.charCode<=90)||(ke.evt.charCode>=48&&ke.evt.charCode<=57)){
ke.keyIdentifier=ke.evt.charCode;
}else{
if(ke.evt.charCode>=97&&ke.evt.charCode<=122){
ke.keyIdentifier=ke.evt.charCode-32;
}else{
ke.keyIdentifier=std.event.KeyMap.AppleWebKit[ke.evt.charCode]||0;
}
}
}
}else{
if(std.browser.isOpera){
if(!ke.evt.which){
ke.keyIdentifier=ke.evt.keyCode;
}else{
if(ke.evt.keyCode==59){
ke.keyIdentifier=186;
}else{
if(ke.evt.keyCode==32||(ke.evt.keyCode>=65&&ke.evt.keyCode<=90)||(ke.evt.keyCode>=48&&ke.evt.keyCode<=57)){
ke.keyIdentifier=ke.evt.keyCode;
}else{
if(ke.evt.keyCode>=97&&ke.evt.keyCode<=122){
ke.keyIdentifier=ke.evt.keyCode-32;
}else{
ke.keyIdentifier=ke.evt.keyCode;
}
}
}
}
}else{
ke.keyIdentifier=ke.evt.keyCode;
}
}
}
break;
case "keyinput":
if(std.browser.isIE){
ke.keyIdentifier=ke.evt.keyCode;
}else{
if(std.browser.isOpera){
ke.keyIdentifier=ke.evt.keyCode==ke.evt.which?ke.evt.keyCode:0;
}else{
ke.keyIdentifier=ke.evt.charCode;
}
}
break;
default:
throw "Illegal event: "+_78;
}
return _77(ke);
};
};
std.event.onContextMenu=function(_7b,_7c,_7d){
var _7e=std.event.listener(null,function(e){
var _80=std.dom.getEventTarget(e);
if(_80.tagName.match(/^a$/i)||(_80.tagName.match(/input/i)&&_80.type.match(/button/i))){
return;
}
if(e.button==0&&e.ctrlKey){
_7c(e);
}
});
std.event.observe(_7b,"mousedown",_7e,_7d);
std.event.observe(_7b,"contextmenu",_7c,_7d);
};
std.event.getEventTarget=function(_81){
return _81.target||_81.srcElement;
};
std.event.afterLoaded=function(_82){
std.event.observe(window,"load",_82,false);
};
std.lang={};
std.lang.bind=function(){
var _83=std.array.from(arguments);
var obj=_83.shift(),_85=_83.shift();
if(!_85||typeof (_85)!="function"){
null.assert;
}
if(_83.length==0){
return function binded(){
return arguments.length?_85.apply(obj,arguments):_85.call(obj);
};
}else{
return function binded(){
if(arguments.length==0){
return _85.apply(obj,_83);
}else{
var _86=_83.concat();
for(var i=0;i<arguments.length;i++){
_86.push(arguments[i]);
}
return _85.apply(obj,_86);
}
};
}
};
std.lang.later=function(){
var _88=std.array.from(arguments);
var _89=_88.shift(),obj=_88.shift(),_8b=_88.shift();
return setTimeout(function(){
return _8b.apply(obj,_88);
},_89);
};
std.lang.defaultize=function(_8c,_8d){
return typeof (_8c)=="undefined"?_8d:_8c;
};
std.lang.evaluate=function(ref){
return typeof (ref)=="function"?ref():ref;
};
std.lang.undef=function(val){
return typeof (val)=="undefined";
};
std.lang.isArray=function(val){
for(var i=0;i<arguments.length;i++){
var val=arguments[i];
if(typeof (val)=="undefined"||val==null||val.constructor!=Array){
return false;
}
}
return true;
};
std.lang.isString=function(val){
return (typeof (val)=="string")||(val instanceof String);
};
std.list={};
std.list.iterate=function(_93,_94){
if(typeof (_93.forEach)=="function"){
_93.forEach(_94);
}else{
for(var i=0;i<_93.length;i++){
_94(_93[i],i);
}
}
};
std.list.map=function(_96,_97){
if(typeof (_96.map)=="function"){
return _96.map(_97);
}else{
var _98=new Array();
for(var i=0;i<_96.length;i++){
_98.push(_97(_96[i],i));
}
return _98;
}
};
std.list.grep=function(_9a,_9b){
if(typeof (_9a.filter)=="function"){
return _9a.filter(_9b);
}else{
var _9c=new Array();
for(var i=0;i<_9a.length;i++){
if(_9b(_9a[i],i)){
_9c.push(_9a[i]);
}
}
return _9c;
}
};
std.list.max=function(_9e,_9f){
var max=Number.NEGATIVE_INFINITY;
for(var i=0;i<_9e.length;i++){
if(_9e[i]!=null){
max=Math.max(max,_9f(_9e[i]));
}
}
return max;
};
std.list.min=function(_a2,_a3){
var min=Number.POSITIVE_INFINITY;
for(var i=0;i<_a2.length;i++){
if(_a2[i]!=null){
min=Math.min(min,_a3(_a2[i]));
}
}
return min;
};
std.list.find=function(_a6,_a7){
for(var i=0;i<_a6.length;i++){
if(_a7(_a6[i],i)){
return _a6[i];
}
}
return null;
};
std.list.findIndex=function(_a9,_aa){
if(typeof (_a9.indexOf)=="function"){
return _a9.indexOf(_aa);
}else{
for(var i=0;i<_a9.length;i++){
if(_a9[i]==_aa){
return i;
}
}
return -1;
}
};
std.string={};
std.string._scriptFragment="(?:<script.*?>)((\n|\r|.)*?)(?:</script>)";
std.string.enclose=function(_ac,_ad,end,_af){
return _af?_ad+_ac+end:_ac;
};
std.string.stripTags=function(_b0){
return _b0.replace(/<\/?[^>]+>/gi,"");
};
std.string.stripScripts=function(_b1){
return _b1.replace(new RegExp(std.string._scriptFragment,"img"),"");
};
std.string.extractScripts=function(_b2){
var _b3=new RegExp(std.string._scriptFragment,"img");
var _b4=new RegExp(std.string._scriptFragment,"im");
return std.list.map(_b2.match(_b3)||[],function(_b5){
return (_b5.match(_b4)||["",""])[1];
});
};
std.string.evalScripts=function(_b6){
return std.list.map(std.string.extractScripts(_b6),function(_b7){
eval(_b7);
});
};
std.string.escapeHTML=function(s){
return String(s).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");
};
std.string.fullEscapeHTML=function(s){
return std.string.escapeHTML(s).replace(/\n/g,"<br/>").replace(/  /g,"&nbsp; ");
};
std.string.autoLink=function(s){
s=s.replace(/([\d\w-+]+:\/\/[\S]+)/g,"<a href=\"$1\" target=\"_blank\" title=\"link\">$1</a>");
s=s.replace(/([\d\w-+]+@[\d\w-]+\.[\d\w-\.]{2,})/g,"<a href=\"mailto:$1\" title=\"email\">$1</a>");
return s;
};
std.string.autoLink2=function(s){
return s.replace(/\b((?:(?:http|https|ftp|news|file):\/\/)[^, \r\n"\(\)'<>]+)/g,"<a\thref=\"$1\"\ttarget=\"_blank\">$1</a>").replace(/\b([\w!#\$\%&'\*\+\-\/=\?\^`\{\|\}~\.]*[\w!#\$\%&'\*\+\-\/=\?\^`\{\|\}~]@[\w\-]+(?:\.[\w\-]+)+)/g,"<a\thref=\"mailto:$1\"\ttarget=\"_blank\">$1</a>");
};
std.string.isWhiteListURL=function(url){
return url.indexOf("#")==0||url.match(/^(http|https|ftp|news|file|mailto||editgrid):/i);
};
std.string.unescapeHTML=function(_bd){
var div=document.createElement("div");
div.innerHTML=std.string.stripTags(_bd);
return div.childNodes[0]?div.childNodes[0].nodeValue:"";
};
std.string.htmlEntities=function(s){
var div=document.createElement("div");
var _c1=document.createTextNode(s);
div.appendChild(_c1);
return div.innerHTML;
};
std.string.encodeUTF8=function(_c2){
_c2=_c2.replace(/\r\n/g,"\n");
var _c3=[],ac=0;
for(var n=0;n<_c2.length;n++){
var c=_c2.charCodeAt(n);
if(c<128){
_c3[ac++]=String.fromCharCode(c);
}else{
if((c>127)&&(c<2048)){
_c3[ac++]=String.fromCharCode((c>>6)|192);
_c3[ac++]=String.fromCharCode((c&63)|128);
}else{
_c3[ac++]=String.fromCharCode((c>>12)|224);
_c3[ac++]=String.fromCharCode(((c>>6)&63)|128);
_c3[ac++]=String.fromCharCode((c&63)|128);
}
}
}
return _c3.join("");
};
std.string.decodeUTF8=function(_c7){
var _c8=[],i=ac=c=c1=c2=0;
while(i<_c7.length){
c=_c7.charCodeAt(i);
if(c<128){
_c8[ac++]=String.fromCharCode(c);
i++;
}else{
if((c>191)&&(c<224)){
c2=_c7.charCodeAt(i+1);
_c8[ac++]=String.fromCharCode(((c&31)<<6)|(c2&63));
i+=2;
}else{
c2=_c7.charCodeAt(i+1);
c3=_c7.charCodeAt(i+2);
_c8[ac++]=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));
i+=3;
}
}
}
return _c8.join("");
};
std.string.toArray=function(_ca){
return _ca.split("");
};
std.string.camelize=function(_cb){
var _cc=_cb.split("-");
if(_cc.length==1){
return _cc[0];
}
var _cd=_cb.indexOf("-")==0?_cc[0].charAt(0).toUpperCase()+_cc[0].substring(1):_cc[0];
for(var i=1,len=_cc.length;i<len;i++){
var s=_cc[i];
_cd+=s.charAt(0).toUpperCase()+s.substring(1);
}
return _cd;
};
std.string.capitalize=function(_d1){
return _d1.charAt(0).toUpperCase()+_d1.substring(1);
};
std.string.trim=function(_d2){
return _d2.replace(/^\s*(.*)\s*$/,"$1");
};
std.string.parsePosition=function(s){
s=s.split(" ");
p={top:0,bottom:0,left:0,right:0};
for(var i=0;i<s.length;i++){
switch(s[i]){
case "top":
if(!p.bottom){
p.top=1;
}
break;
case "bottom":
if(!p.top){
p.bottom=1;
}
break;
case "left":
if(!p.right){
p.left=1;
}
break;
case "right":
if(!p.left){
p.right=1;
}
break;
}
}
return p;
};
std.string.printPosition=function(p){
s=[];
if(p.top){
s.push("top");
}else{
if(p.bottom){
s.push("bottom");
}
}
if(p.left){
s.push("left");
}else{
if(p.right){
s.push("right");
}
}
return s.join(" ");
};
std.string.times=function(s,_d7){
for(var i=1;i<_d7;i<<=1){
s=s+s;
}
return s.substr(0,_d7);
};
std.string.lpad=function(s,len,c){
var _dc=std.string.times(c,len-s.length);
return _dc+s;
};
std.string.right=function(s,len){
return s.length<len?s:s.substr(s.length-len,len);
};
std.dom={};
std.dom.element=function(_df){
if(_df){
return typeof (_df)=="string"?document.getElementById(_df):_df;
}else{
return null;
}
};
std.css={};
std.css.bulkset=function(){
var _e0=arguments[0];
for(var i=1;i<arguments.length;i++){
var _e2=arguments[i];
var _e3=_e2[0];
for(var j=1;j<_e2.length;j++){
std.dom.element(_e2[j]).style[_e0]=_e3;
}
}
};
std.css.getStyle=function(_e5,_e6){
std.css.getElementStyle(std.dom.element(_e5),_e6);
};
std.css.getElementStyle=function(_e7,_e8){
var _e9=_e7.style[std.string.camelize(_e8)];
if(!_e9){
if(document.defaultView&&document.defaultView.getComputedStyle){
var css=document.defaultView.getComputedStyle(_e7,null);
_e9=css?css.getPropertyValue(_e8):null;
}else{
if(_e7.currentStyle){
_e9=_e7.currentStyle[std.string.camelize(_e8)];
}
}
}
if(window.opera&&(_e8=="left"||_e8=="top"||_e8=="right"||_e8=="bottom")){
if(std.css.getStyle(_e7,"position")=="static"){
_e9="auto";
}
}
return _e9=="auto"?null:_e9;
};
std.css.setStyle=function(_eb,_ec){
_eb=std.dom.element(_eb);
for(name in _ec){
_eb.style[std.string.camelize(name)]=_ec[name];
}
};
std.css.includeClass=function(_ed,_ee){
var _ef=_ed.className.split(" ");
var _f0=0;
for(var i=0;i<_ef.length;i++){
if(_ef[i]==_ee){
_f0=1;
break;
}
}
if(!_f0){
_ef.push(_ee);
_ed.className=_ef.join(" ");
}
};
std.css.excludeClass=function(_f2,_f3){
var _f4=_f2.className.split(" ");
var _f5=[];
for(var i=0;i<_f4.length;i++){
if(_f4[i]!=_f3){
_f5.push(_f4[i]);
}
}
if(_f4.length!=_f5.length){
_f2.className=_f5.join(" ");
}
};
std.css._switchOnEvent=function(_f7,_f8,_f9,_fa){
std.css.includeClass(_f7,_f9);
if(!_f7[_f8]){
if(_fa){
std.event.observe(_f7,_fa,std.lang.bind(null,std.css.excludeClass,_f7,_f9));
}
_f7[_f8]=true;
}
};
std.css.hoverClass=function(_fb,_fc){
std.css._switchOnEvent(_fb,"std.css.hoverClass.set",_fc,"mouseout");
};
std.css.clickClass=function(_fd,_fe){
std.css._switchOnEvent(_fd,"std.css.clickClass.set",_fe,"mouseup");
};
std.css.focusClass=function(_ff,_100){
std.css._switchOnEvent(_ff,"std.css.focusClass.set",_100,"blur");
};
std.dom.newElement=function(_101,_102,_103,_104,doc){
var ele=(doc||document).createElement(_101);
if(_103){
for(var key in _103){
ele[key]=_103[key];
}
}
if(_104){
for(var key in _104){
ele.style[key]=_104[key];
}
}
if(_102){
_102.appendChild(ele);
}
return ele;
};
std.dom.newTree=function(html){
var node=std.dom.newElement("div");
node.innerHTML=html;
return node.firstChild;
};
std.dom.setStyles=function(node,_10b){
for(var key in _10b){
node.style[key]=_10b[key];
}
};
std.dom.update=function(_10d,html){
std.dom.element(_10d).innerHTML=std.string.stripScripts(html);
setTimeout(function(){
std.string.evalScripts(html);
},10);
};
std.dom.remove=function(_10f){
_10f=std.dom.element(_10f);
_10f.parentNode.removeChild(_10f);
};
std.dom.getDimensions=function(_110){
_110=std.dom.element(_110);
if(_110==document.body){
return std.dom.getBodyExtent();
}
if(std.css.getStyle(_110,"display")!="none"){
return {width:_110.offsetWidth,height:_110.offsetHeight};
}
var els=_110.style;
var _112=els.visibility;
var _113=els.position;
els.visibility="hidden";
els.position="absolute";
els.display="";
var _114=_110.clientWidth;
var _115=_110.clientHeight;
els.display="none";
els.position=_113;
els.visibility=_112;
return {width:_114,height:_115};
};
std.dom.newDiv=function(_116,_117,_118,doc){
return std.dom.newElement("div",_116,_117,_118,doc);
};
std.dom.newText=function(data,_11b,doc){
doc=doc||document;
var node=doc.createTextNode(data);
if(_11b){
_11b.appendChild(node);
}
return node;
};
std.dom.newComment=function(data,_11f,doc){
doc=doc||document;
var node=doc.createComment(data);
if(_11f){
_11f.appendChild(node);
}
return node;
};
std.dom.parentForm=function(_122){
_122=std.dom.element(_122);
while(_122.parentNode){
_122=_122.parentNode;
if(_122.tagName.toLowerCase()=="form"){
return _122;
}
}
return null;
};
std.dom.backtrack=function(_123,func){
_123=std.dom.element(_123);
while(_123&&func(_123)){
_123=_123.parentNode;
}
return _123;
};
std.dom.findPrev=function(_125,func){
_125=std.dom.element(_125);
do{
_125=_125.previousSibling;
}while(_125&&!func(_125));
return _125;
};
std.dom.findNext=function(_127,func){
_127=std.dom.element(_127);
do{
_127=_127.nextSibling;
}while(_127&&!func(_127));
return _127;
};
std.dom.show=function(_129){
_129=std.dom.element(_129);
_129.style.display="";
_129._showAtTime=new Date();
};
std.dom.hide=function(_12a,_12b){
var now=new Date();
_12b=_12b||0;
_12a=std.dom.element(_12a);
if(_12b>0){
var _12d=_12a._showAtTime||0;
var _12e=now-_12a._showAtTime;
if(_12e>=_12b){
_12a.style.display="none";
}else{
setTimeout(std.lang.bind(null,std.dom.hide,_12a,0),_12b-_12e);
}
}else{
_12a.style.display="none";
}
};
std.dom.toggleShowHide=function(_12f,_130){
_12f=std.dom.element(_12f);
if(_12f.style.display=="none"){
this.show(_12f);
}else{
this.hide(_12f,_130);
}
};
std.dom.Builder=function(_131,doc){
this.current=_131;
this.doc=doc;
};
std.dom.Builder.prototype.push=function(_133,_134,_135){
return this.current=this.append(_133,_134,_135);
};
std.dom.Builder.prototype.pushElement=function(_136){
return this.push(std.lang.isString(_136)?[_136]:_136);
};
std.dom.Builder.prototype.pop=function(){
var node=this.current;
this.current=this.current.parentNode;
return node;
};
std.dom.Builder.prototype.peek=function(){
return this.current;
};
std.dom.Builder.prototype.next=function(_138,_139,_13a){
this.pop();
return this.push(_138,_139,_13a);
};
std.dom.Builder.prototype.nextElement=function(_13b){
return this.next(std.lang.isString(_13b)?[_13b]:_13b);
};
std.dom.Builder.prototype.append=function(_13c,_13d,_13e){
if(typeof (_13c.join)=="function"){
return std.dom.newText(_13c.join("\n"),this.current,this.doc);
}else{
if(typeof (_13c.nodeType)=="number"){
this.current.appendChild(_13c);
return _13c;
}else{
if(_13c){
return std.dom.newElement(_13c,this.current,_13d,_13e,this.doc);
}
}
}
};
std.dom.Builder.prototype.appendElement=function(_13f){
return this.append(std.lang.isString(_13f)?[_13f]:_13f);
};
std.dom.Builder.prototype.reset=function(){
this.current=null;
};
std.dom.addOption=function(_140,_141){
if(_140.options&&_140.options.add){
_140.options.add(_141);
}else{
_140.add(_141,null);
}
};
std.dom.clearOptions=function(_142){
while(_142.length){
_142.remove(0);
}
};
std.dom.clearChildren=function(node){
if(std.browser.isIE){
var _144;
while(_144=node.lastChild){
node.removeChild(_144);
}
}else{
node.innerHTML="";
}
};
std.dom.appendChildren=function(node,_146){
if(!std.lang.isArray(_146)){
_146=[_146];
}
for(var i=0;i<_146.length;i++){
node.appendChild(_146[i]);
}
};
std.dom.setChildren=function(node,_149){
std.dom.clearChildren(node);
std.dom.appendChildren(node,_149);
};
std.dom.opacity=function(_14a,op){
_14a=std.dom.element(_14a);
if(std.browser.isIE){
_14a.style.filter=op==1?"":"progid:DXImageTransform.Microsoft.Alpha(opacity="+parseInt(op*100)+")";
}else{
_14a.style.opacity=op;
}
};
std.dom.extractAttachmentPoints=function(root,_14d){
root=std.dom.element(root);
var _14e=_14d?_14d:"attachPoint";
var _14f=root.getElementsByTagName("*");
var map={};
for(var i=_14f.length-1;i>=0;i--){
var node=_14f.item(i);
var attr=node.getAttribute(_14e);
if(attr){
if(map[attr]){
if(map[attr] instanceof Array){
map[attr].push(node);
}else{
map[attr]=[map[attr],node];
}
}else{
map[attr]=node;
}
}
}
if(root.getAttribute(_14e)){
map[root.getAttribute(_14e)]=root;
}
return map;
};
std.dom.getEventTarget=function(e){
var e=e?e:window.event;
return e.target?e.target:e.srcElement;
};
std.dom.getTargetPos=function(_155){
var pos={x:0,y:0};
if(_155.x&&_155.y){
pos.x+=_155.x;
pos.y+=_155.y;
}else{
do{
pos.x+=_155.offsetLeft||0;
pos.y+=_155.offsetTop||0;
_155=_155.offsetParent;
if(_155&&_155!=document.body){
pos.x-=_155.scrollLeft;
pos.y-=_155.scrollTop;
}
}while(_155);
}
return pos;
};
std.dom.getBounds=function(node){
var pos=std.dom.getTargetPos(node);
var size=std.dom.getDimensions(node);
return {top:pos.y,left:pos.x,bottom:pos.y+size.height-1,right:pos.x+size.width-1,height:size.height,width:size.width};
};
std.dom.getEventPos=function(e){
return std.dom.getTargetPos(std.dom.getEventTarget(e));
};
std.dom.getOffsetMid=function(node){
return node.offsetLeft+parseInt(node.offsetWidth/2);
};
std.dom.getOffset=function(node){
return node.offsetLeft;
};
std.dom.getBodyExtent=function(){
if(std.browser.isSafariMobile){
return {width:window.innerWidth,height:window.innerHeight};
}else{
if(!std.dom._bodyExtendProbe){
std.dom._bodyExtendProbe=std.dom.newElement("div",document.body,null,{position:"absolute",top:"100%",left:"100%",visibility:"hidden"});
}
var pos=std.dom.getTargetPos(std.dom._bodyExtendProbe);
return {width:pos.x,height:pos.y};
}
};
std.dom.noselect=function(node){
node.style.MozUserSelect="none";
node.unselectable="on";
};
std.hash={};
std.hash.merge=function(){
var _15f=std.array.from(arguments);
var dest={};
for(var i=0;i<_15f.length;i++){
var hash=_15f[i];
for(var name in hash){
dest[name]=hash[name];
}
}
return dest;
};
std.hash.iterate=function(hash,_165){
for(var k in hash){
_165(k,hash[k]);
}
};
std.hash.keys=function(hash){
var keys=[];
for(var k in hash){
keys.push(k);
}
return keys;
};
std.hash.values=function(hash){
var vals=[];
for(var k in hash){
vals.push(hash[k]);
}
return vals;
};
std.hash.map=function(list,_16e){
var hash={};
for(var i=0;i<list.length;i++){
var _171=_16e(list[i],i);
hash[_171[0]]=_171[1];
}
return hash;
};
std.hash.size=function(hash){
var cnt=0;
for(var k in hash){
cnt++;
}
return cnt;
};
std.hash.notEmpty=function(hash){
for(var k in hash){
return true;
}
return false;
};
std.hash.empty=function(hash){
for(var k in hash){
return false;
}
return true;
};
std.conv={};
std.conv._hexTab=[48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70];
std.conv.intToRGB=function(num){
return String.fromCharCode(this._hexTab[(num>>20)&15],this._hexTab[(num>>16)&15],this._hexTab[(num>>12)&15],this._hexTab[(num>>8)&15],this._hexTab[(num>>4)&15],this._hexTab[num&15]);
};
std.conv.hexToInt=function(c){
var _17b=c.toUpperCase().charCodeAt(0);
if(48<=_17b&&_17b<=58){
return _17b-48;
}
if(65<=_17b&&_17b<=70){
return _17b-65+10;
}
return 0;
};
std.conv.rgbToIntArray=function(s){
if(s===null){
return null;
}
if(s===undefined||!s.charAt){
return undefined;
}
return [16*std.conv.hexToInt(s.charAt(0))+std.conv.hexToInt(s.charAt(1)),16*std.conv.hexToInt(s.charAt(2))+std.conv.hexToInt(s.charAt(3)),16*std.conv.hexToInt(s.charAt(4))+std.conv.hexToInt(s.charAt(5))];
};
std.conv.rgbToInt=function(s){
var arr=std.conv.rgbToIntArray(s);
if(!arr){
return undefined;
}
return arr[0]*65536+arr[1]*256+arr[2];
};
std.conv.rgbArrayToInt=function(r,g,b){
return r*65536+g*256+b;
};
std.conv.anyRGBToInt=function(any){
if(any===undefined){
return any;
}else{
if(any===null||any===-1){
return -1;
}else{
if(typeof any=="number"){
return any;
}else{
if(typeof any=="string"){
return std.conv.rgbToInt(any);
}else{
if(typeof any=="object"){
if(any.r!==undefined&&any.g!==undefined&&any.b!==undefined){
return std.conv.rgbArrayToInt(any.r,any.g,any.b);
}else{
if(any[0]!==undefined&&any[1]!==undefined&&any[2]!==undefined){
return std.conv.rgbArrayToInt(any[0],any[1],any[2]);
}
}
}
}
}
}
}
throw new Error("Cannot convert ["+any+"] into an integer");
};
std.ajax={};
std.ajax._processorCount=0;
std.ajax._jsonpProcessors={};
std.ajax._emptyFunction=function(){
};
std.ajax.obtainProcessorId=function(){
if(std.ajax._processorCount>100000){
std.ajax._processorCount=0;
}
return std.ajax._processorCount++;
};
std.ajax.registerJsonpProcessor=function(id,_184){
std.ajax._jsonpProcessors[id]=_184;
};
std.ajax.removeJsonpProcessor=function(id){
delete std.ajax._jsonpProcessors[id];
};
std.ajax.jsonp=function(_186,_187,_188,_189){
if(typeof _188=="undefined"){
_188=200;
}
if(typeof _189=="undefined"){
_189="";
}
std.ajax._jsonpProcessors[_186](_188,_189,_187);
};
std.ajax.ScriptTagRequest=function(){
this._jsonpId=std.ajax.obtainProcessorId();
this._tag=null;
this._url=null;
this._content=null;
this._responseSuccess=false;
this._processError=false;
this.onreadystatechange=null;
this.readyState=0;
this.responseText="";
this.status=0;
this.statusText="";
this._headers=null;
this._maxLength=std.ajax.ScriptTagRequest.MAX_LENGTH;
};
std.ajax.ScriptTagRequest.MAX_LENGTH=1800;
std.ajax.ScriptTagRequest._idPrefix=Math.random()+"."+new Date().getTime();
std.ajax.ScriptTagRequest.prototype._reset=function(){
this._removeScriptTag();
this._content=null;
this._responseSuccess=false;
this._processError=false;
this.readyState=0;
this.responseText="";
this.status=0;
this.statusText="";
this._headers=null;
this._maxLength=std.ajax.ScriptTagRequest.MAX_LENGTH;
};
std.ajax.ScriptTagRequest.prototype._removeScriptTag=function(){
if(this._tag){
document.getElementsByTagName("HEAD")[0].removeChild(this._tag);
}
this._tag=null;
if(this._jsonpId){
std.ajax.removeJsonpProcessor(this._jsonpId);
}
};
std.ajax.ScriptTagRequest.prototype._createScriptTag=function(_18a,_18b,last){
this._removeScriptTag();
this._responseSuccess=false;
this._processError=false;
std.ajax.registerJsonpProcessor(this._jsonpId,std.lang.bind(this,this._processResponse));
this._tag=document.createElement("script");
this._tag.type="text/javascript";
this._tag.charset="utf-8";
var url=this._url+(this._url.indexOf("?")==-1?"?":"&")+"i="+std.ajax.ScriptTagRequest._idPrefix;
url+="&jsonp="+this._jsonpId;
url+="&c="+_18a;
if(_18b){
url+="&f=1";
}
if(last){
url+="&l=1";
}
this._tag.src=url;
std.event.observe(this._tag,"load",std.event.listener(this,this._onload));
std.event.observe(this._tag,"error",std.event.listener(this,this._onerror));
std.event.observe(this._tag,"readystatechange",std.event.listener(this,this._onreadystatechange));
document.getElementsByTagName("HEAD")[0].appendChild(this._tag);
};
std.ajax.ScriptTagRequest.prototype._onload=function(){
this._removeScriptTag();
if(!this._responseSuccess){
this._onerror();
}else{
this._sendContent();
}
};
std.ajax.ScriptTagRequest.prototype._onerror=function(){
this._removeScriptTag();
if(!this._processError){
this._processError=true;
this.status=500;
this.statusText="Error";
this.readyState=4;
this.responseText="";
if(this.onreadystatechange&&typeof this.onreadystatechange=="function"){
this.onreadystatechange();
}
}
};
std.ajax.ScriptTagRequest.prototype._onreadystatechange=function(){
if(this._tag&&this._tag.readyState&&this._tag.readyState=="loaded"){
this._onload();
}
};
std.ajax.ScriptTagRequest.prototype._sendContent=function(_18e){
if(_18e==null&&this._content==null){
return;
}
var _18f=(_18e!=null);
var last;
if(_18f){
this._content=_18e;
}
var c;
if(this._content.length>this._maxLength){
var _192=this._getMaxLength();
c=this._content.substring(0,_192);
this._content=this._content.substring(_192);
last=false;
}else{
c=this._content;
this._content=null;
last=true;
}
this._createScriptTag(c,_18f,last);
};
std.ajax.ScriptTagRequest.prototype._getMaxLength=function(){
var _193=this._maxLength;
var _194=this._content;
while(true){
if(_194.charAt(_193-1)=="%"){
_193-=1;
}else{
if(_194.charAt(_193-2)=="%"){
_193-=2;
}else{
if(_194.charAt(_193-3)=="%"){
var _195=std.conv.hexToInt(_194.charAt(_193-2));
if(_195<=7){
break;
}
if(_195>=8&&_195<=11){
_193-=3;
}
if(_195>=12){
_193-=3;
break;
}
}else{
break;
}
}
}
}
return _193;
};
std.ajax.ScriptTagRequest.prototype._processResponse=function(_196,_197,_198){
this._responseSuccess=true;
if(_196!=-1){
this.status=_196;
this._headers=_197;
this.responseText=_198;
this.readyState=4;
if(this.onreadystatechange&&typeof this.onreadystatechange=="function"){
this.onreadystatechange();
}
}
};
std.ajax.ScriptTagRequest.prototype.open=function(_199,url,_19b,_19c,_19d){
this._reset();
this._url=url;
this._maxLength-=url.length;
};
std.ajax.ScriptTagRequest.prototype.send=function(_19e){
this._reset();
_19e=_19e==null?"":encodeURIComponent(_19e);
this._sendContent(_19e);
};
std.ajax.ScriptTagRequest.prototype.setRequestHeader=function(){
};
std.ajax.ScriptTagRequest.prototype.getAllResponseHeaders=function(){
return this._headers;
};
std.ajax.ScriptTagRequest.prototype.getResponseHeader=function(key){
if(!key){
return null;
}
var _1a0=null;
key=key.toLowerCase()+":";
var _1a1=this._headers.toLowerCase();
var i=-1;
if((i=_1a1.indexOf(key))!=-1){
_1a0=this._headers.substring(i+key.length,this._headers.indexOf("\n",i));
_1a0=std.string.trim(_1a0);
}
return _1a0;
};
std.ajax.ScriptTagRequest.prototype.abort=function(){
this._removeScriptTag();
};
std.ajax.getTransport=function(_1a3){
if(typeof _1a3=="string"){
return eval(_1a3)();
}
return std.ajax.getDefaultTransport();
};
std.ajax.getScriptTagTransport=function(){
return new std.ajax.ScriptTagRequest();
};
std.ajax.getDefaultTransport=function(){
try{
return new XMLHttpRequest();
}
catch(e){
}
finally{
}
try{
return new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){
}
finally{
}
try{
return new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){
}
finally{
}
return false;
};
std.ajax._activeRequestCount=0;
std.ajax.responders={};
std.ajax.responders._list=[];
std.ajax.responders._register=function(_1a4){
if(!std.array.contains(this._list,_1a4)){
this._list.push(_1a4);
}
};
std.ajax.responders._unregister=function(_1a5){
this._list=std.array.without(this._list,_1a5);
};
std.ajax.responders._dispatch=function(_1a6,_1a7,_1a8,json){
std.list.iterate(this._list,function(_1aa){
if(_1aa[_1a6]&&typeof _1aa[_1a6]=="function"){
try{
_1aa[_1a6].apply(_1aa,[_1a7,_1a8,json]);
}
catch(e){
}
}
});
};
std.ajax.responders._register({onCreate:function(){
std.ajax._activeRequestCount++;
},onComplete:function(){
std.ajax._activeRequestCount--;
}});
std.ajax.Base=function(){
};
std.ajax.Base.prototype.setOptions=function(_1ab){
this.options={method:"post",asynchronous:true,parameters:""};
if(_1ab){
this.options=std.hash.merge(this.options,_1ab);
}
};
std.ajax.Base.prototype.responseIsSuccess=function(){
return this.transport.status==undefined||this.transport.status==0||(this.transport.status>=200&&this.transport.status<300);
};
std.ajax.Base.prototype.responseIsFailure=function(){
return !this.responseIsSuccess();
};
std.ajax.Request=function(url,_1ad){
this.setOptions(_1ad);
this.transport=std.ajax.getTransport(this.options.transportFactory);
this.request(url);
};
std.ajax.Request.prototype=new std.ajax.Base();
std.ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];
std.ajax.Request.prototype.request=function(url){
var _1af=this.options.parameters||"";
if(_1af.length>0){
_1af+="&_=";
}
try{
this.url=url;
if(this.options.method=="get"&&_1af.length>0){
this.url+=(this.url.match(/\?/)?"&":"?")+_1af;
}
std.ajax.responders._dispatch("onCreate",this,this.transport);
this.transport.open(this.options.method,this.url,this.options.asynchronous);
if(this.options.asynchronous){
this.transport.onreadystatechange=std.lang.bind(this,this.onStateChange);
setTimeout(std.lang.bind(this,function(){
this.respondToReadyState(1);
}),10);
}
this.setRequestHeaders();
var body=this.options.postBody?this.options.postBody:_1af;
this.transport.send(this.options.method.toLowerCase()=="post"||this.options.method.toLowerCase()=="put"?body:null);
}
catch(e){
this.dispatchException(e);
}
};
std.ajax.Request.prototype.setRequestHeaders=function(){
var _1b1=[];
if(this.options.method.toLowerCase()=="post"){
_1b1.push("Content-type",this.options.contentType?this.options.contentType:"application/x-www-form-urlencoded");
if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){
_1b1.push("Connection","close");
}
}
if(this.options.requestHeaders){
_1b1.push.apply(_1b1,this.options.requestHeaders);
}
for(var i=0;i<_1b1.length;i+=2){
this.transport.setRequestHeader(_1b1[i],_1b1[i+1]);
}
};
std.ajax.Request.prototype.onStateChange=function(){
var _1b3=this.transport.readyState;
if(_1b3!=1){
this.respondToReadyState(this.transport.readyState);
}
};
std.ajax.Request.prototype.header=function(name){
try{
return this.transport.getResponseHeader(name);
}
catch(e){
}
};
std.ajax.Request.prototype.evalJSON=function(){
try{
return eval(this.header("X-JSON"));
}
catch(e){
}
};
std.ajax.Request.prototype.evalResponse=function(){
try{
return eval(this.transport.responseText);
}
catch(e){
this.dispatchException(e);
}
};
std.ajax.Request.prototype.respondToReadyState=function(_1b5){
if(typeof (std)=="undefined"){
return;
}
var _1b6=std.ajax.Request.Events[_1b5];
var _1b7=this.transport,json=this.evalJSON();
if(_1b6=="Complete"){
try{
(this.options["on"+this.transport.status]||this.options["on"+(this.responseIsSuccess()?"Success":"Failure")]||std.ajax._emptyFunction)(_1b7,json);
}
catch(e){
this.dispatchException(e);
}
if((this.header("Content-type")||"").match(/^text\/javascript/i)){
this.evalResponse();
}
}
try{
(this.options["on"+_1b6]||std.ajax._emptyFunction)(_1b7,json);
std.ajax.responders._dispatch("on"+_1b6,this,_1b7,json);
}
catch(e){
this.dispatchException(e);
}
if(_1b6=="Complete"){
this.transport.onreadystatechange=std.ajax._emptyFunction;
}
};
std.ajax.Request.prototype.dispatchException=function(_1b9){
(this.options.onException||std.ajax._emptyFunction)(this,_1b9);
std.ajax.responders._dispatch("onException",this,_1b9);
};
std.ajax.Updater=function(_1ba,url,_1bc){
this.containers={success:_1ba.success?std.dom.element(_1ba.success):std.dom.element(_1ba),failure:_1ba.failure?std.dom.element(_1ba.failure):(_1ba.success?null:std.dom.element(_1ba))};
this.transport=std.ajax.getTransport();
this.setOptions(_1bc);
var _1bd=this.options.onComplete||std.ajax._emptyFunction;
this.options.onComplete=std.lang.bind(this,function(_1be,_1bf){
this.updateContent();
_1bd(_1be,_1bf);
});
this.request(url);
};
std.ajax.Updater.prototype=new std.ajax.Request();
std.ajax.Updater.prototype.updateContent=function(){
var _1c0=this.responseIsSuccess()?this.containers.success:this.containers.failure;
var _1c1=this.transport.responseText;
if(!this.options.evalScripts){
_1c1=std.string.stripScripts(_1c1);
}
if(_1c0){
if(this.options.insertion){
new this.options.insertion(_1c0,_1c1);
}else{
std.dom.update(_1c0,_1c1);
}
}
if(this.responseIsSuccess()){
if(this.onComplete){
setTimeout(std.lang.bind(this,this.onComplete),10);
}
}
};
std.ajax.getText=function(url,_1c3){
var ajax=new std.ajax.Request(url,{method:_1c3||"post",asynchronous:false});
return ajax.transport.responseText;
};
std.ajax.newTree=function(url){
var text=std.ajax.getText(url);
return std.dom.newTree(text);
};
std.ajax.ping=function(url,_1c8){
new std.ajax.Request(url,std.hash.merge(_1c8,{method:"post",asynchronous:true}));
};
std.ajax.loadMap=function(map,_1ca,_1cb){
var len=0;
var dst={};
for(var i in map){
len++;
}
for(var i in map){
(function(idx){
new std.ajax.Request(map[i],std.hash.merge(_1cb,{onSuccess:function(_1d0){
dst[idx]={responseText:_1d0.responseText};
if(!--len){
_1ca(dst);
}
}}));
})(i);
}
};
var mesgLoaded=false;
var privateMessageBoxOpened=false;
std.event.observe(window,"load",function(){
if(window.unreadHighMesg!=undefined&&unreadHighMesg>0){
displayPrivateMessageBox();
}
});
function showNextPrivateMessage(){
if(curMesg<maxMesg){
curMesg++;
updatePrivateMessageBox();
}
}
function showPrevPrivateMessage(){
if(curMesg>1){
curMesg--;
updatePrivateMessageBox();
}
}
function updatePrivateMessageBox(){
for(var i=1;i<=maxMesg;i++){
document.getElementById("PrivateMessage_N"+i).style.display=(i==curMesg)?"block":"none";
}
if(curMesg>1){
document.getElementById("PrevPrivateMesg").className="PrivateMessageButton";
}else{
document.getElementById("PrevPrivateMesg").className="PrivateMessageButtonDisabled";
}
if(curMesg<maxMesg){
document.getElementById("NextPrivateMesg").className="PrivateMessageButton";
}else{
document.getElementById("NextPrivateMesg").className="PrivateMessageButtonDisabled";
}
document.getElementById("TotalMesgCount").innerHTML=maxMesg;
document.getElementById("CurMesgNum").innerHTML=curMesg;
var _1d2=document.getElementById("PrivateMessage_N"+curMesg);
if(_1d2.getAttribute("priority")>1){
document.getElementById("PrivateMessageBoxCriticalHead").style.display="block";
}else{
if(!_1d2.setRead){
setMessageRead(_1d2.getAttribute("private_mesg_id"));
unreadMesg--;
_1d2.setRead=true;
}
document.getElementById("PrivateMessageBoxCriticalHead").style.display="none";
}
}
var privateMessageBox;
function displayPrivateMessageBox(){
var _1d3=document.getElementById("PrivateMessageIndicator");
if(!privateMessageBox){
privateMessageBox=new ui.hintbox.HintBox({content:std.dom.element("PrivateMessageBox"),anchor:_1d3,align:"bottom left",snap:"top left",offsetX:-230,offsetY:0,style:{padding:"0px",width:"220px"}});
}
var _1d4=document.getElementById("PrivateMessageBox");
var _1d5=document.getElementById("PrivateMessageIndicator");
if(_1d4){
privateMessageBoxOpened=true;
_1d4.style.display="block";
if(!mesgLoaded){
ajax=new std.ajax.Updater("PrivateMessageContent",base_uri+"privatemesg/private_mesg_box",{evalScripts:true});
mesgLoaded=true;
}
}
var p=std.lang.bind(privateMessageBox,privateMessageBox.show);
p();
}
function closePrivateMessageBox(){
privateMessageBox.fade();
var _1d7=document.getElementById("PrivateMessageBox");
var _1d8=document.getElementById("PrivateMessageIndicator");
var _1d9=document.getElementById("PrivateMessageIndicatorCount");
if(_1d7){
privateMessageBoxOpened=false;
if(curMesg>0){
for(var i=1;i<=maxMesg;i++){
var _1db=document.getElementById("PrivateMessage_N"+i);
if(_1db.getAttribute("priority")>1&&!_1db.setRead){
setMessageRead(_1db.getAttribute("private_mesg_id"));
unreadMesg--;
_1db.setRead=true;
}
}
}
if(_1d9){
if(unreadMesg){
_1d9.innerHTML=unreadMesg;
}else{
var link=document.getElementById("PrivateMessageIndicatorLink");
link.innerHTML=loc("No New Message");
link.style.color="black";
}
}
}
if(unreadMesg==0){
document.getElementById("PrivateMessageIndicator").style.display="none";
}
}
function setMessageRead(_1dd){
ajax=new std.ajax.Request(base_uri+"privatemesg/set_private_mesg_read?private_mesg_id="+_1dd);
}
var userModeSwitchingBox;
function displayModeSwitchingBox(){
var _1de=document.getElementById("UserModeIndicator");
if(!userModeSwitchingBox){
userModeSwitchingBox=new ui.hintbox.HintBox({content:std.dom.element("UserModeSwitchingBox"),anchor:_1de,align:"bottom right",snap:"top left",offsetX:0,offsetY:0,style:{padding:"0px",width:"480px"}});
}
var p=std.lang.bind(userModeSwitchingBox,userModeSwitchingBox.show);
p();
}
function closeModeSwitchingBox(){
userModeSwitchingBox.fade();
}
std.host={};
std.host.bookmark=function(_1e0,url){
if(window.sidebar){
window.sidebar.addPanel(_1e0,url,"");
}else{
if(window.external){
window.external.AddFavorite(url,_1e0);
}else{
if(window.opera&&window.print){
return true;
}
}
}
};
std.host.open=function(url,_1e3){
if(_1e3){
if(typeof (_1e3)=="string"){
var w=window.open(url,_1e3);
w.focus();
}else{
window.open(url);
}
}else{
window.location.href=url;
}
};
std.host.reload=function(){
window.location.href=window.location.href;
};
std.jexpr={};
std.jexpr.evaluate=function(_1e5){
var _1e6=typeof (_1e5);
if(_1e6=="function"){
return _1e5.call();
}else{
if(_1e6=="number"||_1e6=="boolean"||_1e6=="string"||_1e6=="undefined"||_1e5==null){
return _1e5;
}else{
if(typeof (_1e5.not)!="undefined"){
return !std.jexpr.evaluate(_1e5.not);
}else{
if(typeof (_1e5.and)=="object"){
_1e5=_1e5.and;
for(var i=0;i<_1e5.length;i++){
if(!std.jexpr.evaluate(_1e5[i])){
return false;
}
}
return true;
}else{
_1e5=typeof (_1e5.or)=="object"?_1e5.or:_1e5;
for(var i=0;i<_1e5.length;i++){
if(std.jexpr.evaluate(_1e5[i])){
return true;
}
}
return false;
}
}
}
}
};
std.jexpr.functor=function(_1e8){
return function(){
return std.jexpr.evaluate(_1e8);
};
};
std.keytable={BACKSPACE:[8,"Backspace"],TAB:[9,"Tab"],ENTER:[13,"Enter"],SHIFT:[16,"Shift"],CTRL:[17,"Ctrl"],ALT:[18,"Alt"],PAUSE:[19,"Pause"],CAPS_LOCK:[20,"Caps"],ESCAPE:[27,"Esc"],SPACE:[32,"Space"],PAGE_UP:[33,"Page Up"],PAGE_DOWN:[34,"Page Down"],END:[35,"End"],HOME:[36,"Home"],LEFT_ARROW:[37,"Left"],UP_ARROW:[38,"Up"],RIGHT_ARROW:[39,"Right"],DOWN_ARROW:[40,"Down"],INSERT:[45,"Ins"],DELETE:[46,"Del"],LEFT_WINDOW:[91,""],RIGHT_WINDOW:[92,""],SELECT:[93,""],NUM_LOCK:[144,""],SCROLL_LOCK:[145,""],";":[186,";"],"=":[187,"="],",":[188,","],".":[190,"."],"/":[191,"/"],"`":[192,"`"],"[":[219,"["],"\\":[220,"\\"],"]":[221,"]"],"'":[222,"'"],CMD:[224,""],IME:[229,""]};
for(var i=48;i<=57;i++){
std.keytable[String.fromCharCode(i)]=[i,String.fromCharCode(i)];
}
for(var i=65;i<=90;i++){
std.keytable[String.fromCharCode(i)]=[i,String.fromCharCode(i)];
}
for(var i=112;i<=123;i++){
std.keytable["F"+(i-111)]=[i,"F"+(i-111)];
}
std.action={};
std.action.AbstractAction=function(){
};
std.action.AbstractAction.prototype._initAbstractAction=function(_1e9){
_1e9=_1e9||{};
this._icon=_1e9.icon||"";
this._text=_1e9.text||"";
this._mnemonic=_1e9.mnemonic||"";
this._selected=_1e9.selected||"";
this._disabled=_1e9.disabled||false;
this.setShortcutList(_1e9.shortcutList||[]);
};
std.action.AbstractAction.prototype.getIcon=function(){
return std.lang.evaluate(this._icon);
};
std.action.AbstractAction.prototype.getText=function(){
return std.lang.evaluate(this._text);
};
std.action.AbstractAction.prototype.getMnemonic=function(){
return std.lang.evaluate(this._mnemonic);
};
std.action.AbstractAction.prototype.isSelected=function(){
return std.jexpr.evaluate(this._selected);
};
std.action.AbstractAction.prototype.setSelected=function(_1ea){
this._selected=_1ea;
};
std.action.AbstractAction.prototype.getShortcutList=function(){
return this._shortcutList;
};
std.action.AbstractAction.prototype.setShortcutList=function(list){
if(list instanceof Array){
this._shortcutList=list;
}else{
this._shortcutList=std.action.KeyComb.fromString(list);
}
};
std.action.AbstractAction.prototype.addShortcut=function(_1ec){
if(_1ec instanceof std.action.KeyComb){
this._shortcutList.push(_1ec);
}else{
this._shortcutList.push(new std.action.KeyComb(_1ec));
}
};
std.action.AbstractAction.prototype.isDisabled=function(){
return std.jexpr.evaluate(this._disabled);
};
std.action.AbstractAction.prototype.setDisabled=function(_1ed){
this._disabled=_1ed;
};
std.action.AbstractAction.prototype.getValue=function(){
return this._value;
};
std.action.AbstractAction.prototype.setValue=function(_1ee){
this._value=_1ee;
};
std.action.AbstractAction.prototype.performAction=function(){
};
std.action.Nil=function(_1ef){
this._initAbstractAction(_1ef);
};
std.action.Nil.prototype=new std.action.AbstractAction();
std.action.Script=function(_1f0){
this._initAbstractAction(_1f0);
this._script=_1f0.script;
};
std.action.Script.prototype=new std.action.AbstractAction();
std.action.Script.prototype.performAction=function(){
var args=[this];
for(var i=0;i<arguments.length;i++){
args.push(arguments[i]);
}
this._script.apply(null,args);
};
std.action.Url=function(_1f3){
this._initAbstractAction(_1f3);
this._url=_1f3.url;
this._popup=_1f3.popup;
};
std.action.Url.prototype=new std.action.AbstractAction();
std.action.Url.prototype.performAction=function(){
std.host.open(std.lang.evaluate(this._url),this._popup);
};
std.action.KeyComb=function(keys){
this._key=null;
this._reqCtrl=false;
this._reqAlt=false;
this._reqShift=false;
std.list.iterate(keys.toUpperCase().split(" "),std.lang.bind(this,function(key){
switch(key){
case "CTRL":
this._reqCtrl=true;
break;
case "ALT":
this._reqAlt=true;
break;
case "SHIFT":
this._reqShift=true;
break;
default:
if(key){
this._key=std.keytable[key];
}
}
}));
};
std.action.KeyComb.fromString=function(str){
var keys=[];
std.list.iterate(str.split(";;"),function(part){
part=std.string.trim(part);
if(part){
keys.push(new std.action.KeyComb(part));
}
});
return keys;
};
std.action.KeyComb.prototype.toString=function(){
if(!this._string){
var keys=[];
if(this._reqCtrl){
keys.push("Ctrl");
}
if(this._reqAlt){
keys.push("Alt");
}
if(this._reqShift){
keys.push("Shift");
}
keys.push(this._key[1]);
this._string=keys.join("+");
}
return this._string;
};
std.action.KeyComb.prototype.check=function(_1fa,_1fb,_1fc,_1fd,_1fe){
_1fb=_1fb?true:false;
_1fc=_1fc?true:false;
_1fd=_1fd?true:false;
return (_1fb==this._reqCtrl||(std.browser.platform.isMacOS&&(_1fe==this._reqCtrl)))&&_1fc==this._reqAlt&&_1fd==this._reqShift&&_1fa==this._key[0];
};
std.customfocus={};
std.customfocus.Manager=function(){
this._focusList={next:null};
this._docFocusListenerList=[];
this._docBlurListenerList=[];
std.event.observe(document,"mousedown",std.event.listener(this,this._onDocMouseDown));
};
std.customfocus.Manager.prototype.newDelegator=function(_1ff,_200,_201){
return new std.customfocus.Delegator(this,_1ff,_200,_201);
};
std.customfocus.Manager.prototype.focus=function(obj,_203,_204){
this.detach(obj);
var _205=this._focusList.next;
var _206={obj:obj,onfocus:_203,onblur:_204,next:this._focusList.next};
this._focusList.next=_206;
if(_205&&_205.onblur){
_205.onblur.call();
}
if(_206.onfocus){
_206.onfocus.call();
}
};
std.customfocus.Manager.prototype.blur=function(obj){
if(this.isFocused(obj)){
var _208=this._focusList.next;
var _209=this._focusList.next.next;
this._focusList.next=_209;
if(_208.onblur){
_208.onblur.call();
}
if(_209&&_209.onfocus){
_209.onfocus.call();
}
}
};
std.customfocus.Manager.prototype.detach=function(obj){
for(var edge=this._focusList;edge.next;edge=edge.next){
if(edge.next.obj==obj){
edge.next=edge.next.next;
return;
}
}
};
std.customfocus.Manager.prototype.focusOnEvent=function(obj,_20d,_20e){
if(!this._inEvent){
this._inEvent=true;
setTimeout(std.lang.bind(this,this._afterEvent),0);
this.focus(obj,_20d,_20e);
}
};
std.customfocus.Manager.prototype._afterEvent=function(){
this._inEvent=false;
};
std.customfocus.Manager.prototype.isFocused=function(obj){
return this._focusList.next&&this._focusList.next.obj==obj;
};
std.customfocus.Manager.prototype.attachDocFocusListener=function(_210){
this._docFocusListenerList.push(_210);
};
std.customfocus.Manager.prototype.attachDocBlurListener=function(_211){
this._docBlurListenerList.push(_211);
};
std.customfocus.Manager.prototype.detachDocFocusListener=function(_212){
for(var i=0;i<this._docFocusListenerList.length;i++){
if(this._docFocusListenerList[i]==_212){
this._docFocusListenerList.splice(i,1);
break;
}
}
};
std.customfocus.Manager.prototype.detachDocBlurListener=function(_214){
for(var i=0;i<this._docBlurListenerList.length;i++){
if(this._docBlurListenerList[i]==_214){
this._docBlurListenerList.splice(i,1);
break;
}
}
};
std.customfocus.Manager.prototype._onDocMouseDown=function(e){
this.focusOnEvent(document,std.lang.bind(this,this._onDocFocus),std.lang.bind(this,this._onDocBlur));
};
std.customfocus.Manager.prototype._onDocFocus=function(){
std.list.iterate(this._docFocusListenerList,function(_217){
_217.call();
});
};
std.customfocus.Manager.prototype._onDocBlur=function(){
std.list.iterate(this._docBlurListenerList,function(_218){
_218.call();
});
};
std.customfocus.getManager=function(){
return std.customfocus._manager||(std.customfocus._manager=new std.customfocus.Manager());
};
std.customfocus.Delegator=function(_219,_21a,_21b,_21c){
this._manager=_219;
this._relative=_21a;
this._onfocus=_21b;
this._onblur=_21c;
};
std.customfocus.Delegator.prototype.focus=function(){
this._manager.focus(this,this._onfocus,this._onblur);
};
std.customfocus.Delegator.prototype.focusOnEvent=function(){
this._manager.focusOnEvent(this,this._onfocus,this._onblur);
};
std.customfocus.Delegator.prototype.blur=function(){
this._manager.blur(this);
};
std.customfocus.Delegator.prototype.isFocused=function(){
return this._manager.isFocused(this);
};
std.customfocus.Delegator.prototype.detach=function(){
this._manager.detach(this);
};
var ui={};
ui.menu={};
ui.menu.ItemGroup=function(_21d,_21e){
_21d=_21d||{};
this.setHeader(_21d.header||null);
this.setHeaderStyle(_21d.headerStyle||{});
this._itemList=_21e||[];
};
ui.menu.ItemGroup.prototype.setHeader=function(_21f){
this._header=_21f;
};
ui.menu.ItemGroup.prototype.getHeader=function(){
return this._header;
};
ui.menu.ItemGroup.prototype.setHeaderStyle=function(_220){
this._headerStyle=_220;
};
ui.menu.ItemGroup.prototype.getHeaderStyle=function(){
return this._headerStyle;
};
ui.menu.ItemGroup.prototype.getList=function(){
return this._itemList;
};
ui.menu.ItemGroup.prototype._indexOf=function(ref){
if(typeof (ref)=="string"){
ref=this.get(ref);
}
return std.list.findIndex(this._itemList,ref);
};
ui.menu.ItemGroup.prototype.locate=function(path){
path=path||"";
path=path.replace("^/","");
path=path.replace("/$","");
path=path.split("/");
var id=path.shift();
var item=this.get(id);
return item?(path.length?item.locate(path.join("/")):item):null;
};
ui.menu.ItemGroup.prototype.get=function(pos){
return typeof (pos)=="number"?this._itemList[pos]:std.list.find(this._itemList,function(item){
return item.getId()==pos;
});
};
ui.menu.ItemGroup.prototype.add=function(_227){
if(!(_227 instanceof Array)){
_227=[_227];
}
var _228=this._itemList;
std.list.iterate(_227,function(item){
_228.push(item);
});
};
ui.menu.ItemGroup.prototype.insert=function(pos,_22b){
if(typeof (pos)!="number"){
pos=this._indexOf(pos);
}
if(!(_22b instanceof Array)){
_22b=[_22b];
}
var _22c=this._itemList;
std.list.iterate(_22b,function(item){
_22c.splice(pos,0,item);
pos++;
});
};
ui.menu.ItemGroup.prototype.remove=function(ref){
this._itemList.splice(typeof (ref)=="number"?ref:this._indexOf(ref),1);
};
ui.menu.MenuItem=function(type,_230){
_230=_230||{};
if(typeof (type)!="undefined"&&type!="button"&&type!="checkbox"&&type!="radio"&&type!="menu"){
throw "Invalid MenuItem type: "+type;
}
this._type=type;
this.setId(_230.id||null);
this.setIcon(_230.icon||null);
this.setAdditionalIcons(_230.additionalIcons||null);
this.setText(_230.text||null);
this.setMnemonic(_230.mnemonic||null);
this.setStyle(_230.style||{});
this.setDisabled(_230.disabled||null);
this.setHidden(_230.hidden||false);
this.setAction(_230.action||null);
this.setValue(_230.value||null);
this.setShortcut(_230.shortcut||null);
this.setGroup(_230.group||null);
};
ui.menu.MenuItem.prototype.getType=function(){
return this._type;
};
ui.menu.MenuItem.prototype.getId=function(){
return this._id;
};
ui.menu.MenuItem.prototype.setId=function(id){
this._id=id;
};
ui.menu.MenuItem.prototype.setIcon=function(icon){
this._icon=icon;
};
ui.menu.MenuItem.prototype.getIcon=function(){
return std.lang.evaluate(this._firstSet(this._icon,this._action.getIcon()));
};
ui.menu.MenuItem.prototype.setAdditionalIcons=function(icon){
this._additionalIcons=icon;
};
ui.menu.MenuItem.prototype.getAdditionalIcons=function(){
return this._additionalIcons;
};
ui.menu.MenuItem.prototype.setText=function(text){
this._text=text;
};
ui.menu.MenuItem.prototype.getText=function(){
return std.lang.evaluate(this._firstSet(this._text,this._action.getText()));
};
ui.menu.MenuItem.prototype.setMnemonic=function(_235){
this._mnemonic=_235;
};
ui.menu.MenuItem.prototype.getMnemonic=function(){
return std.lang.evaluate(this._firstSet(this._mnemonic,this._action.getMnemonic()));
};
ui.menu.MenuItem.prototype.setStyle=function(_236){
this._style=_236;
};
ui.menu.MenuItem.prototype.getStyle=function(){
return std.lang.evaluate(this._style);
};
ui.menu.MenuItem.prototype.setDisabled=function(bool){
this._disabled=bool;
};
ui.menu.MenuItem.prototype.isDisabled=function(bool){
return std.lang.evaluate(this._firstSet(this._disabled,this._action.isDisabled()));
};
ui.menu.MenuItem.prototype.setHidden=function(bool){
this._hidden=bool;
};
ui.menu.MenuItem.prototype.isHidden=function(){
return std.lang.evaluate(this._hidden);
};
ui.menu.MenuItem.prototype.setShortcut=function(_23a){
this._shortcut=_23a;
};
ui.menu.MenuItem.prototype.getShortcut=function(){
return std.lang.evaluate(this._firstSet(this._shortcut,(this._action.getShortcutList()||[])[0]));
};
ui.menu.MenuItem.prototype.setGroup=function(_23b){
this._group=_23b;
};
ui.menu.MenuItem.prototype.getGroup=function(){
return std.lang.evaluate(this._group);
};
ui.menu.MenuItem.prototype.setParent=function(_23c){
this._parent=_23c;
};
ui.menu.MenuItem.prototype.getParent=function(){
return this._parent;
};
ui.menu.MenuItem.prototype.getRoot=function(){
var root=this._parent;
while(root&&root._parent){
root=root._parent;
}
return root;
};
ui.menu.MenuItem.prototype.setAction=function(_23e){
this._action=_23e||new std.action.Nil();
};
ui.menu.MenuItem.prototype.setValue=function(_23f){
this._value=_23f;
};
ui.menu.MenuItem.prototype.isSelected=function(){
return this._action&&this._action.isSelected();
};
ui.menu.MenuItem.prototype.setSelected=function(_240){
if(this._action){
this._action.setSelected(_240);
}
};
ui.menu.MenuItem.prototype.performAction=function(){
switch(this._type){
case "checkbox":
case "radio":
this._action.setSelected(!this._action.isSelected());
}
this._action.setValue(std.lang.evaluate(this._value));
this._action.performAction();
if(this._parent.onChildActionPerformed){
this._parent.onChildActionPerformed();
}
};
ui.menu.MenuItem.prototype._firstSet=function(){
for(var i=0;i<arguments.length;i++){
var arg=arguments[i];
if((typeof (arg)!="undefined")&&(arg!=null)){
return arg;
}
}
return null;
};
ui.menu.Menu=function(_243,_244){
_243=_243||{};
ui.menu.MenuItem.call(this,"menu",_243);
this._delay=_243.delay||250;
this._visible=false;
this._itemGroupList=[];
if(_244){
std.list.iterate(_244,std.lang.bind(this,this.add));
}
this._focusDelegator=std.customfocus.getManager().newDelegator(this,std.lang.bind(this,this._onFocus),std.lang.bind(this,this._onBlur));
};
ui.menu.Menu.prototype=new ui.menu.MenuItem();
ui.menu.Menu.prototype._createView=function(){
var _245={};
var _246=new std.dom.Builder();
_245.root=_246.push("div",{className:"PopupMenu"});
if(std.browser.isIE&&std.browser.major<7){
_245.hackIFrame=_246.append("iframe",{frameBorder:0,scrolling:"no",src:"javascript:'';"});
}
_245.pane=_246.push("div",{className:"PopupMenuPane"});
_246.push("div",{className:"PopupMenuShadow"});
_245.cavity=_246.push("div",{className:"PopupMenuBorder"});
std.event.observe(_245.pane,"mousedown",std.event.listener(this,this._onMenuMouseDown));
std.event.observe(_245.pane,"mouseover",std.event.listener(this,this._onButtonMouseOver));
std.event.observe(_245.pane,"mouseout",std.event.listener(this,this._onButtonMouseOut));
std.event.observe(_245.pane,"mousedown",std.event.listener(this,this._onButtonMouseDown));
std.event.observe(_245.pane,"click",std.event.listener(this,this._onButtonClick));
return _245;
};
ui.menu.Menu.prototype._getNodes=function(){
return this._nodes||(this._nodes=this._createView());
};
ui.menu.Menu.prototype.updateUI=function(){
this._elementList=[];
var html=[];
html.push("<table><tbody>");
var _248=0;
for(var i=0;i<this._itemGroupList.length;i++){
var _24a=this._itemGroupList[i];
var _24b=_24a.getList();
var _24c=0;
for(var j=0;j<_24b.length;j++){
if(!_24b[j].isHidden()){
_24c++;
}
}
if(_24c==0){
continue;
}
if(i>0){
html.push("<tr class=\"PopupMenuSep\">");
html.push("<td colspan=\"6\"><div><!-- --></div></td>");
html.push("</tr>");
}
if(_24a.getHeader()){
html.push("<tr class=\"PopupMenuSection\">");
html.push("<td colspan=\"6\">"+std.string.fullEscapeHTML(_24a.getHeader())+"</td>");
html.push("</tr>");
}
for(var j=0;j<_24b.length;j++){
var item=_24b[j];
if(item.isHidden()){
continue;
}
var _24f={item:item,type:item.getType(),index:_248++,iconStyle:null,additionalIconsStyle:[],nodes:{}};
this._elementList.push(_24f);
item.setParent(this);
var _250=item.getShortcut();
html.push("<tr class=\""+(item.isDisabled()?"PopupMenuDisabledItem":"PopupMenuItem")+"\">");
html.push("<td class=\"PopupMenuItemIcon\">");
var _251=null;
switch(_24f.type){
case "checkbox":
_251=item.isSelected()?"PopupMenuIcon PopupMenuIconCheckBox":"PopupMenuIcon";
break;
case "radio":
_251=item.isSelected()?"PopupMenuIcon PopupMenuIconRadio":"PopupMenuIcon";
break;
default:
var icon=item.getIcon();
if(icon){
_251="PopupMenuIcon";
if(typeof (icon)=="string"){
_24f.iconStyle={backgroundImage:"url("+icon+")"};
}else{
if(icon.className){
_251=_251+" "+icon.className;
}
_24f.iconStyle=icon;
}
}
break;
}
html.push("<div"+(_251?(" class=\""+_251+"\""):"")+"><!-- --></div>");
html.push("</td>");
html.push("<td class=\"PopupMenuItemAdditionalIcons\">");
var _253=item.getAdditionalIcons();
if(_253){
var _254=std.lang.isArray(_253)?_253:[_253];
var _255="PopupMenuAdditionalIcons";
for(var x=0;x<_254.length;x++){
var _257=_254[x];
if(_257==null){
continue;
}
var _258="PopupMenuAdditionalIcons_"+x;
if(typeof (_257)=="string"){
_24f.additionalIconsStyle[x]={backgroundImage:"url("+_257+")"};
}else{
if(_257.className){
_258=_258+" "+_257.className;
}
_24f.additionalIconsStyle[x]=_257;
}
html.push("<div class=\""+_255+" "+_258+"\"><!-- --></div>");
}
}else{
html.push("<div><!-- --></div>");
}
html.push("</td>");
html.push("<td class=\"PopupMenuItemName\""+(_250?"":" colspan=\"2\"")+">");
var text=item.getText();
var _25a=item.getMnemonic();
var _25b=_25a?text.toLowerCase().indexOf(_25a.toLowerCase()):text.length;
var _25c=_25b>=0?text.substr(0,_25b):"";
var _25d=_25b>=0?text.substr(_25b,1):"";
var _25e=text.substr(_25b+1);
if(_25c){
html.push(std.string.fullEscapeHTML(_25c));
}
if(_25d){
html.push("<span style=\"text-decoration: underline\">"+std.string.fullEscapeHTML(_25d)+"</span>");
}
if(_25e){
html.push(std.string.fullEscapeHTML(_25e));
}
html.push("</td>");
if(_250){
html.push("<td class=\"PopupMenuItemShortcut\">");
html.push(std.string.fullEscapeHTML(_250.toString()||""));
html.push("</td>");
}
html.push("<td class=\"PopupMenuItemExpand\">");
if(_24f.type=="menu"){
html.push("<div class=\"PopupMenuIcon PopupMenuIconExpand\"><!-- --></div>");
}
html.push("</td>");
html.push("</tr>");
}
}
html.push("</tbody></table>");
var _25f=this._getNodes().cavity;
_25f.innerHTML=html.join("");
var _260=this._elementList;
var _261=0;
std.list.iterate(_25f.getElementsByTagName("tr"),function(row){
if(row.className=="PopupMenuItem"||row.className=="PopupMenuDisabledItem"){
row._index=_261;
var _263=_260[_261];
_263.nodes.root=row;
std.list.iterate(row.getElementsByTagName("td"),function(td){
std.dom.noselect(td);
});
if(_263.iconStyle){
std.list.iterate(row.getElementsByTagName("div"),function(div){
if(div.className.match(/\bPopupMenuIcon\b/)){
std.dom.setStyles(div,_263.iconStyle);
}
});
}
if(_263.additionalIconsStyle&&std.lang.isArray(_263.additionalIconsStyle)){
for(var x=0;x<_263.additionalIconsStyle.length;x++){
var _267=_263.additionalIconsStyle[x];
std.list.iterate(row.getElementsByTagName("div"),function(div){
var re=new RegExp("PopupMenuAdditionalIcons_"+x);
if(div.className.match(re)){
std.dom.setStyles(div,_267);
}
});
}
}
if(_263.item.getStyle()){
std.dom.setStyles(row,_263.item.getStyle());
}
_261++;
}
});
};
ui.menu.Menu.prototype.locate=function(path){
path=path||"";
path=path.replace("^/","");
path=path.replace("/$","");
path=path.split("/");
var id=path.shift();
var item=(id==parseInt(id))?this.getList()[parseInt(id)]:this.getItem(id);
return item?(path.length?item.locate(path.join("/")):item):null;
};
ui.menu.Menu.prototype.getList=function(){
return this._itemGroupList;
};
ui.menu.Menu.prototype.getItem=function(id){
for(var i=0;i<this._itemGroupList.length;i++){
var item=this._itemGroupList[i].get(id);
if(item){
return item;
}
}
return null;
};
ui.menu.Menu.prototype._indexOf=function(ref){
return std.list.findIndex(this._itemGroupList,ref);
};
ui.menu.Menu.prototype.get=function(pos){
return this._itemGroupList[pos];
};
ui.menu.Menu.prototype.add=function(_272){
if(_272 instanceof ui.menu.MenuItem){
if(this._itemGroupList.length==0){
this._itemGroupList[0]=new ui.menu.ItemGroup();
}
this._itemGroupList[this._itemGroupList.length-1].add(_272);
}else{
this._itemGroupList.push(_272);
}
};
ui.menu.Menu.prototype.insert=function(pos,_274){
this._itemGroupList.splice(typeof (pos)=="number"?pos:this._indexOf(pos),0,_274);
};
ui.menu.Menu.prototype.remove=function(pos){
this._itemGroupList.splice(typeof (pos)=="number"?pos:this._indexOf(pos),1);
};
ui.menu.Menu.prototype.removeItem=function(id){
for(var i=0;i<this._itemGroupList.length;i++){
var item=this._itemGroupList[i].get(id);
if(item){
this._itemGroupList[i].remove(item);
}
}
};
ui.menu.Menu.prototype.select=function(_279){
var _27a=typeof (_279)=="number"?this._elementList[_279]:null;
if(this._selectedElement&&this._selectedElement!=_27a){
this._selectedElement.nodes.root.className=this._selectedElement.item.isDisabled()?"PopupMenuDisabledItem":"PopupMenuItem";
}
this._selectedElement=_27a;
if(this._selectedElement){
ui.menu.getMenuManager().setActiveMenu(this);
this._selectedElement.nodes.root.className=this._selectedElement.item.isDisabled()?"PopupMenuDisabledItemHover":"PopupMenuItemHover";
}
};
ui.menu.Menu.prototype.selectOffset=function(_27b){
var _27c=this._selectedElement?this._selectedElement.index:0;
_27c=(_27c+_27b+this._elementList.length)%this._elementList.length;
this.select(_27c);
};
ui.menu.Menu.prototype.getSelectedItem=function(){
return this._selectedElement?this._selectedElement.item:null;
};
ui.menu.Menu.prototype.setExpanded=function(bool){
var _27e=this._getExpandedElement();
if(_27e&&(!bool||_27e!=this._selectedElement)){
_27e.item.hide();
_27e.item.setParent(null);
}
if(bool&&this._selectedElement&&this._selectedElement.item.getType()=="menu"&&_27e!=this._selectedElement){
var _27f=std.dom.getBounds(this._selectedElement.nodes.root);
this._selectedElement.item.setParent(this);
this._selectedElement.item.show(_27f.right,_27f.top,"top left");
}
};
ui.menu.Menu.prototype._getExpandedElement=function(){
for(var i=0;i<this._elementList.length;i++){
var _281=this._elementList[i];
if(_281.item.getType()=="menu"&&_281.item.isVisible()){
return _281;
}
}
return null;
};
ui.menu.Menu.prototype.getMnemonicIndex=function(_282){
for(var i=0;i<this._elementList.length;i++){
if(this._elementList[i].item.getMnemonic().toLowerCase()==_282.toLowerCase()){
return i;
}
}
return -1;
};
ui.menu.Menu.prototype.isVisible=function(){
return this._visible;
};
ui.menu.Menu.prototype.onChildActionPerformed=function(){
if(this.getParent()){
this.getParent().onChildActionPerformed();
}else{
this.hide();
}
};
ui.menu.Menu.prototype._onFocus=function(){
ui.menu.getMenuManager().menuFocused();
};
ui.menu.Menu.prototype._onBlur=function(){
ui.menu.getMenuManager().menuBlurred();
this.hide();
};
ui.menu.Menu.prototype.getActivator=function(){
return this._activator||(this._activator=new ui.menu.Activator(this));
};
ui.menu.Menu.prototype._findEventElement=function(e){
return std.dom.backtrack(std.event.element(e),function(ele){
return ele.tagName!="TR";
});
};
ui.menu.Menu.prototype._onMenuMouseDown=function(e){
if(this._visible){
std.event.vanish(e);
}
};
ui.menu.Menu.prototype._onButtonMouseOver=function(e){
var node=this._findEventElement(e);
if(node){
this.select(node._index);
this.buttonHoverTimer=setTimeout(std.lang.bind(this,this._onButtonHover),this._delay);
}
};
ui.menu.Menu.prototype._onButtonMouseOut=function(e){
var node=this._findEventElement(e);
if(node){
if(!this._getExpandedElement()){
this.select(null);
}
clearTimeout(this.buttonHoverTimer);
}
};
ui.menu.Menu.prototype._onButtonMouseDown=function(e){
var node=this._findEventElement(e);
if(node){
this.setExpanded(true);
}
};
ui.menu.Menu.prototype._onButtonClick=function(e){
var node=this._findEventElement(e);
if(node){
var item=this._elementList[node._index].item;
switch(item.getType()){
case "button":
case "radio":
case "checkbox":
if(!item.isDisabled()){
item.performAction();
}
}
}
};
ui.menu.Menu.prototype._onButtonHover=function(){
this.setExpanded(true);
};
ui.menu.Menu.prototype.relocate=function(x,y,_292){
var _293=this._getNodes();
var dim=std.dom.getDimensions(_293.pane);
var posX=x-(/right/.test(_292)?(dim.width-1):0);
var posY=y-(/bottom/.test(_292)?(dim.height-1):0);
_293.root.style.left=posX+"px";
_293.root.style.top=posY+"px";
if(_293.hackIFrame){
_293.hackIFrame.style.width=dim.width+"px";
_293.hackIFrame.style.height=dim.height+"px";
}
};
ui.menu.Menu.prototype.show=function(x,y,_299){
if(!this._visible){
this._visible=true;
var root=this._getNodes().root;
this.updateUI();
root.style.left="-10000px";
root.style.top="-10000px";
root.style.visibility="hidden";
document.body.appendChild(root);
this.relocate(x,y,_299);
root.style.visibility="";
ui.menu.getMenuManager().setActiveMenu(this);
if(!(this._parent instanceof ui.menu.Menu)){
this._focusDelegator.focus();
}
}else{
this.relocate(x,y,_299);
}
};
ui.menu.Menu.prototype.hide=function(){
if(this._visible){
this._visible=false;
if(this._getExpandedElement()){
this._getExpandedElement().item.hide();
}
this._selectedElement=null;
document.body.removeChild(this._getNodes().root);
this._focusDelegator.blur();
this._focusDelegator.detach();
}
};
ui.menu.Menu.prototype.toggle=function(x,y,_29d){
if(this._visible){
this.hide();
}else{
this.relocate(x,y,_29d);
}
};
ui.menu.Menu.prototype.populateWith=function(data){
for(var i=0;i<data.items.length;i++){
var _2a0=data.items[i];
var _2a1=new ui.menu.ItemGroup();
this.add(_2a1);
for(var j=0;j<_2a0.length;j++){
var item=_2a0[j];
if(data.children&&data.children[item.id]){
var _2a4=new ui.menu.Menu({id:item.id,text:item.display,mnemonic:item.mnemonic,icon:item.icon});
_2a1.add(_2a4);
_2a4.populateWith(data.children[item.id]);
}else{
var _2a5=null;
switch(typeof (item.action)){
case "string":
_2a5=new std.action.Url({url:item.action});
break;
case "function":
_2a5=new std.action.Script({script:item.action});
break;
case "object":
_2a5=item.action||new std.action.Nil();
break;
}
var type=item.type||"button";
_2a1.add(new ui.menu.MenuItem(type,{id:item.id,text:item.display,mnemonic:item.mnemonic,icon:item.icon,additionalIcons:item.additionalIcons,style:item.style,disabled:item.disabled,hidden:item.hidden,action:_2a5,value:item.value,group:item.group}));
}
}
}
};
ui.menu.Activator=function(menu){
this._menu=menu;
};
ui.menu.Activator.prototype.getMenu=function(){
return this._menu;
};
ui.menu.Activator.prototype.getSrcDomNode=function(){
return this._srcDomNode;
};
ui.menu.Activator.prototype.observe=function(_2a8,_2a9,_2aa){
_2a8=std.dom.element(_2a8);
var _2ab=std.event.listener(this,this._onEventObserved,_2a8,_2aa);
std.event.observe(_2a8,_2a9,_2ab);
return _2ab;
};
ui.menu.Activator.prototype.stopObserving=function(_2ac,_2ad,_2ae){
std.event.stopObserving(_2ac,_2ad,_2ae);
};
ui.menu.Activator.prototype._onEventObserved=function(e,_2b0,_2b1){
var _2b2=this._srcDomNode;
this._srcDomNode=_2b0;
if(!this._menu.isVisible()||_2b2!=_2b0){
setTimeout(std.lang.bind(this,this._showMenu,_2b1),0);
}
};
ui.menu.Activator.prototype._showMenu=function(_2b3){
var ret=_2b3(this);
if(ret){
var x=ret.shift();
var y=ret.shift();
var _2b7=ret.shift();
this._menu.show(x,y,_2b7);
}
};
ui.menu.MenuBar=function(_2b8,_2b9){
_2b8=_2b8||{};
ui.menu.ItemGroup.call(this,_2b8,_2b9);
std.event.observe(document,"mousedown",std.lang.bind(this,this.select,null));
std.event.keyObserve(document,"keydown",std.event.listener(this,this._onKeyDown,null));
};
ui.menu.MenuBar.prototype=new ui.menu.ItemGroup();
ui.menu.MenuBar.prototype._createView=function(){
var _2ba={};
_2ba.root=std.dom.newElement("div");
_2ba.cavity=_2ba.root;
return _2ba;
};
ui.menu.MenuBar.prototype._getNodes=function(){
if(!this._nodes){
this._nodes=this._createView();
this.updateUI();
}
return this._nodes;
};
ui.menu.MenuBar.prototype.getRoot=function(){
return this._getNodes().root;
};
ui.menu.MenuBar.prototype.updateUI=function(){
this._elementList=[];
var _2bb=this._getNodes().cavity;
std.dom.clearChildren(_2bb);
var _2bc=new std.dom.Builder(_2bb);
for(var i=0,_2be=0;i<this._itemList.length;i++){
var item=this._itemList[i];
if(!item.isHidden()){
var _2c0={item:item,index:_2be,nodes:{}};
this._elementList.push(_2c0);
_2c0.nodes.root=_2bc.push("div",{className:"MenuBarItem"});
_2c0.nodes.root._index=_2be;
_2be++;
_2c0.nodes.icon=_2bc.push("div");
_2bc.appendElement(std.dom.newComment(" "));
_2bc.pop();
_2c0.nodes.text=_2bc.push("div");
_2bc.appendElement(std.dom.newText(_2c0.item.getText()));
_2bc.pop();
std.dom.noselect(_2c0.nodes.icon);
std.dom.noselect(_2c0.nodes.text);
std.event.observe(_2c0.nodes.root,"mouseover",std.event.listener(this,this._onButtonMouseOver,_2c0));
std.event.observe(_2c0.nodes.root,"mouseout",std.event.listener(this,this._onButtonMouseOut,_2c0));
std.event.observe(_2c0.nodes.root,"mousedown",std.event.listener(this,this._onButtonMouseDown,_2c0));
if(_2c0.item.getStyle()){
std.dom.setStyles(_2c0.nodes.root,_2c0.item.getStyle());
}
_2bc.pop();
}
}
};
ui.menu.MenuBar.prototype.select=function(_2c1){
var _2c2=this._selectedElement;
var _2c3=typeof (_2c1)=="number"?this._elementList[_2c1]:null;
if(_2c2!=_2c3){
var _2c4=this.isExpanded();
if(_2c2){
if(_2c4){
_2c2.item.hide();
_2c2.item.setParent(null);
}
_2c2.nodes.root.className="MenuBarItem";
}
if(_2c3){
if(_2c4){
var _2c5=std.dom.getBounds(_2c3.nodes.root);
_2c3.item.setParent(this);
_2c3.item.show(_2c5.left,_2c5.bottom,"top left");
_2c3.nodes.root.className="MenuBarItemActive";
}else{
_2c3.nodes.root.className="MenuBarItemHover";
}
}
this._selectedElement=_2c3;
}
};
ui.menu.MenuBar.prototype.selectOffset=function(_2c6){
var _2c7=this._selectedElement?this._selectedElement.index:0;
_2c7=(_2c7+_2c6+this._elementList.length)%this._elementList.length;
this.select(_2c7);
};
ui.menu.MenuBar.prototype.setExpanded=function(bool){
if(this._selectedElement){
var _2c9=this.isExpanded();
if(bool&&!_2c9){
var _2ca=std.dom.getBounds(this._selectedElement.nodes.root);
this._selectedElement.item.setParent(this);
this._selectedElement.item.show(_2ca.left,_2ca.bottom,"top left");
this._selectedElement.nodes.root.className="MenuBarItemActive";
}else{
if(!bool&&_2c9){
this._selectedElement.item.hide();
this._selectedElement.item.setParent(null);
this._selectedElement.nodes.root.className="MenuBarItemHover";
}
}
}
};
ui.menu.MenuBar.prototype.getSelectedItem=function(){
return this._selectedElement?this._selectedElement.item:null;
};
ui.menu.MenuBar.prototype.isExpanded=function(){
return this._selectedElement&&this._selectedElement.item.isVisible();
};
ui.menu.MenuBar.prototype.onChildActionPerformed=function(){
this.setExpanded(false);
this.select(null);
};
ui.menu.MenuBar.prototype._onButtonMouseOver=function(e,_2cc){
this.select(_2cc.index);
};
ui.menu.MenuBar.prototype._onButtonMouseOut=function(e,_2ce){
if(!this.isExpanded()){
this.select(null);
}
};
ui.menu.MenuBar.prototype._onButtonMouseDown=function(e,_2d0){
this.setExpanded(!this.isExpanded());
std.event.vanish(e);
};
ui.menu.MenuBar.prototype._onKeyDown=function(ke){
if(ke.keyIdentifier==std.event.KeyCodes.generic.KEY_ESCAPE){
this.select(null);
}
};
ui.menu.MenuBar.prototype.populateWith=function(data){
for(var i=0;i<data.items.length;i++){
var item=data.items[i];
var _2d5=new ui.menu.Menu({id:item.id,text:item.display,mnemonic:item.mnemonic,style:item.style,disabled:item.disabled,hidden:item.hidden});
this.add(_2d5);
_2d5.populateWith(data.children[item.id]);
}
};
ui.menu.MenuManager=function(){
std.event.keyObserve(document,"keypress",std.lang.bind(this,this._onKeyPress));
std.event.keyObserve(document,"keydown",std.event.listener(this,this._onKeyDown));
};
ui.menu.MenuManager.prototype.setActiveMenu=function(menu){
this._activeMenu=menu;
};
ui.menu.MenuManager.prototype.select=function(_2d7){
if(this._activeMenu&&this._activeMenu.isVisible()){
var menu=this._activeMenu;
var _2d9=menu.getSelectedItem();
switch(_2d7){
case "up":
menu.selectOffset(-1);
break;
case "down":
_2d9?menu.selectOffset(1):menu.select(0);
break;
case "left":
if(menu.getParent()){
var _2da=menu.getParent();
if(_2da instanceof ui.menu.Menu){
menu.hide();
_2da.selectOffset(0);
}else{
if(_2da instanceof ui.menu.MenuBar){
_2da.selectOffset(-1);
_2da.setExpanded(true);
_2da.getSelectedItem().select(0);
}
}
}
break;
case "right":
if(!_2d9){
menu.select(0);
}else{
if(_2d9 instanceof ui.menu.Menu){
menu.setExpanded(true);
_2d9.select(0);
}else{
if(menu.getRoot()&&(menu.getRoot() instanceof ui.menu.MenuBar)){
var _2db=menu.getRoot();
_2db.selectOffset(1);
_2db.setExpanded(true);
_2db.getSelectedItem().select(0);
}
}
}
break;
}
}
};
ui.menu.MenuManager.prototype.doAction=function(){
if(this._activeMenu&&this._activeMenu.isVisible()){
var menu=this._activeMenu;
var _2dd=menu.getSelectedItem();
switch(_2dd.getType()){
case "menu":
menu.setExpanded(true);
_2dd.select(0);
break;
default:
if(!_2dd.isDisabled()){
_2dd.performAction();
}
break;
}
}
};
ui.menu.MenuManager.prototype._onKeyPress=function(ke){
if(this._activeMenu&&this._activeMenu.isVisible()&&this._hasFocusedMenu){
var k=ke.keyIdentifier;
var e=ke.evt;
var _2e1=std.event.KeyCodes.generic;
switch(k){
case _2e1.KEY_LEFT_ARROW:
this.select("left");
std.event.vanish(e);
break;
case _2e1.KEY_RIGHT_ARROW:
this.select("right");
std.event.vanish(e);
break;
case _2e1.KEY_UP_ARROW:
this.select("up");
std.event.vanish(e);
break;
case _2e1.KEY_DOWN_ARROW:
this.select("down");
std.event.vanish(e);
break;
case _2e1.KEY_ENTER:
this.doAction();
std.event.vanish(e);
break;
default:
var _2e2=std.event.getChar(e);
var _2e3=this._activeMenu.getMnemonicIndex(_2e2);
if(_2e3>=0){
this._activeMenu.select(_2e3);
this.doAction();
}
std.event.vanish(e);
break;
}
}
};
ui.menu.MenuManager.prototype._onKeyDown=function(ke){
if(this._activeMenu&&this._activeMenu.isVisible()){
if(ke.keyIdentifier==std.event.KeyCodes.generic.KEY_ESCAPE){
this._activeMenu.hide();
}
}
};
ui.menu.MenuManager.prototype.menuFocused=function(){
this._hasFocusedMenu=true;
};
ui.menu.MenuManager.prototype.menuBlurred=function(){
this._hasFocusedMenu=false;
};
ui.menu.getMenuManager=function(){
if(!this._menuManager){
this._menuManager=new ui.menu.MenuManager();
}
return this._menuManager;
};
ui.menu2=ui.menu;
var editgrid=editgrid||{};
editgrid.auth={};
editgrid.auth.AuthForm=function(form,base,_2e7,_2e8){
this._form=form;
this._base=base;
this._onError=_2e7;
this._onLoading=_2e8;
std.event.observe(form,"submit",std.event.listener(this,function(e){
this._onSubmit();
std.event.preventDefault(e);
return false;
}));
};
editgrid.auth.AuthForm.prototype.setUsernameGetter=function(_2ea){
this._usernameGetter=_2ea;
};
editgrid.auth.AuthForm.prototype.submit=function(){
this._onSubmit();
};
editgrid.auth.AuthForm.prototype._onSubmit=function(){
var _2eb=this._usernameGetter?this._usernameGetter(this._form):this._form.elements["username"].value;
var _2ec=this._form.elements["password"].value;
var _2ed=this._form.elements["remember"].checked?"1":"";
var _2ee=this._form.elements["return"].value;
var _2ef=this._form.elements["direct"].value;
new std.ajax.Request(this._base+"login/ajax_check",{parameters:"username="+encodeURIComponent(_2eb)+"&password="+encodeURIComponent(_2ec)+"&remember="+encodeURIComponent(_2ed)+"&return="+encodeURIComponent(_2ee)+"&direct="+encodeURIComponent(_2ef),method:"post",asynchronous:true,onSuccess:std.lang.bind(this,function(_2f0,json){
var _2f2=eval(_2f0.responseText);
if(_2f2.success){
location.href=_2f2.redirect;
return;
}else{
if(this._onError){
this._onError(_2f2.error);
this._form.elements["password"].focus();
}
}
}),onFailure:std.lang.bind(this,function(){
})});
this._onLoading(loc("processing..."));
};
std.date={};
std.date.fromSqlUTC=function(str){
var time=Date.UTC(str.substr(0,4),str.substr(4,2)-1,str.substr(6,2),str.substr(8,2),str.substr(10,2),str.substr(12,2));
return new Date(time);
};
std.date.asTimeStrUTC=function(date){
return date.toUTCString().split(" ")[4]+(date.getUTCMilliseconds()/1000).toFixed(3).substring(1);
};
std.date.format=function(dt,fmt){
var _2f8={y:"getFullYear",M:"getMonth",d:"getDate",H:"getHours",m:"getMinutes",s:"getSeconds"};
var _2f9={};
var _2fa=["yyyy","yy","MM","dd","HH","mm","ss"];
var _2fb=[4,2,2,2,2,2,2];
var _2fc=[0,0,1,0,0,0,0];
var _2fd=[12,1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11];
var _2fe=[1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0];
var _2ff=["","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
var val,res;
while(fmt.indexOf("MMM")!=-1){
if(val==null){
val=""+_2ff[_2f9["M"]=dt.getMonth()+1];
}
fmt=fmt.replace("MMM",val);
}
val=null;
while(fmt.indexOf("hh")!=-1){
if(val==null){
val=dt.getHours();
}
fmt=fmt.replace("hh",_2fd[val]);
}
while(fmt.indexOf("a")!=-1){
if(val==null){
val=dt.getHours();
}
fmt=fmt.replace("a",_2fe[val]?"AM":"PM");
}
for(var i=0;i<_2fa.length;++i){
var pat=_2fa[i],val=null;
while(fmt.indexOf(pat)!=-1){
if(val==null){
var c=pat.charAt(0);
var r=_2fb[i];
if((res=_2f9[c])==null){
res=_2f9[c]=""+((dt[_2f8[c]]()-0)+_2fc[i]);
}
val=std.string.lpad(std.string.right(res,r),r,"0");
}
fmt=fmt.replace(pat,val);
}
}
return fmt;
};
dojo.provide("jstalyst.component.ApplicationState");
dojo.declare("jstalyst.component.ApplicationState",null,{dataFields:[],application:null,constructor:function(_306,_307,app){
if(_306==null){
_306={};
}
this.application=app;
this.stateData={};
this.changeUrl=false;
this.callback=_307||null;
this._buildGetters();
this._initStateData(_306);
this._setUrl();
},getStateId:function(){
return this.changeUrl;
},_buildGetters:function(){
var _309=this;
dojo.forEach(this.dataFields,function(_30a){
var _30b=_30a.name.charAt(0).toUpperCase()+_30a.name.substring(1);
_309["get"+_30b]=function(){
return _309.stateData[_30a.name];
};
});
},_initStateData:function(_30c){
var _30d=this;
dojo.forEach(this.dataFields,function(_30e){
_30d.stateData[_30e.name]=_30c[_30e.name];
});
},_setUrl:function(){
var _30f="";
var _310=this;
dojo.forEach(this.dataFields,function(_311,i){
var data=_310.stateData[_311.name];
if(typeof (_311.serializer)=="function"){
var _314=std.lang.bind(_310,_311.serializer);
data=_314(data);
}
var hide=false;
if(typeof (_311.hideInUrl)=="function"){
var _316=std.lang.bind(_310,_311.hideInUrl);
hide=_316(data);
}
if(!hide){
_30f+=data;
}
if(i<_310.dataFields.length){
_30f+="/";
}
});
_30f=_30f.replace(/\/+$/,"");
if(_30f){
this.changeUrl=_30f;
}
},cloneStateData:function(){
var _317={};
var _318=this;
dojo.forEach(this.dataFields,function(_319){
var _31a=_319.name.charAt(0).toUpperCase()+_319.name.substring(1);
_317[_319.name]=_318["get"+_31a]();
});
return _317;
},clearUrl:function(){
this.changeUrl=false;
},back:function(){
if(this.callback){
this.callback(this,"back");
}
},forward:function(){
if(this.callback){
this.callback(this,"forward");
}
},mapStateDataFromUrl:function(){
var _31b="";
var _31c=window.location.href.split("#");
if(_31c.length>1){
_31b=unescape(_31c[_31c.length-1]);
}
if(_31b){
var _31d=_31b.split("/");
var _31e=this;
dojo.forEach(_31d,function(data,i){
var _321=_31e.dataFields[i];
_31e.stateData[_321.name]=data;
if(typeof (_321.deserializer)=="function"){
var _322=std.lang.bind(_31e,_321.deserializer);
_31e.stateData[_321.name]=_322(data);
}
});
}
return this.stateData;
}});
dojo.provide("jstalyst.component.Model");
dojo.require("dojo.data.ItemFileWriteStore");
dojo.declare("jstalyst.component.Model",null,{name:"unnamed",enableLogging:true,store:null,modelTopics:[{topic:"ModelLoadStart",type:"asap"},{topic:"ModelLoadComplete",type:"final"},{topic:"ModelLoadError",type:"asap"},{topic:"ModelItemsUpdate",type:"final"},{topic:"ModelItemInsert",type:"final"},{topic:"ModelItemsDelete",type:"final"}],_objectTopics:{},_currentFetchParams:null,constructor:function(_323,name){
this.classType=_323;
this.name=name;
if(this.enableLogging){
this._logger=new jstalyst.component.Logger({namespace:"Model("+this.name+")"});
}
},destroy:function(){
for(var id in this._objectTopics){
var _326=this._objectTopics[id];
dojo.forEach(_326,function(_327){
dojo.unsubscribe(_327);
});
}
this.inherited(arguments);
},addSubscriber:function(id,obj){
if(!id||!obj){
return;
}
if(typeof (obj.dispatchModelTopic)=="function"){
if(this._objectTopics[id]!=null){
dojo.forEach(this._objectTopics[id],function(h){
dojo.unsubscribe(h);
});
}
this._objectTopics[id]=new Array();
for(var i=0;i<this.modelTopics.length;i++){
var _32c=this.modelTopics[i].topic;
var h=dojo.subscribe(_32c,obj,obj.dispatchModelTopic);
this._objectTopics[id].push(h);
}
}
},_getTopicType:function(_32e){
var _32f=dojo.filter(this.modelTopics,function(t){
return t.topic==_32e;
})[0];
return _32f.type;
},onLoadStart:function(_331){
if(this._logger){
this._logger.write("ModelLoadStart: "+_331);
}
dojo.publish("ModelLoadStart",["ModelLoadStart",this._getTopicType("ModelLoadStart"),this.name]);
},onLoadComplete:function(_332,_333){
var _334={query:_333.query,sort:_333.sort,queryOptions:_333.queryOptions,pageOffset:_333.pageOffset,pageSize:_333.pageSize};
if(this._logger){
this._logger.write("ModelLoadComplete: "+dojo.toJson(_334));
}
_334=std.hash.merge(_334,_333);
if(parseInt(_333.pageOffset)==_333.pageOffset&&parseInt(_333.pageSize)==_333.pageSize){
_334.start=_334.pageOffset;
_334.count=_334.pageSize;
_334.total=_332.length;
if(_334.start>=_334.total){
_334.start=Math.ceil(_334.total/_334.count-1)*_334.count;
}
var _335=_334.start?_334.start:0;
var _336=_334.count?(_335+_334.count):_332.length;
_332=_332.slice(_335,_336);
}
var _337=this.bindItems(_332);
dojo.publish("ModelLoadComplete",["ModelLoadComplete",this._getTopicType("ModelLoadComplete"),this.name,_337,_334]);
},onLoadError:function(_338,_339){
if(this._logger){
var _33a={query:_339.query,sort:_339.sort,queryOptions:_339.queryOptions,pageOffset:_339.pageOffset,pageSize:_339.pageSize};
this._logger.write("ModelLoadError: "+dojo.toJson(_33a));
}
dojo.publish("ModelLoadError",["ModelLoadError",this._getTopicType("ModelLoadError"),this.name,_338,_339]);
},onItemsUpdate:function(_33b,_33c){
if(this._logger){
this._logger.write("ModelItemsUpdate: "+dojo.toJson(_33b));
}
var _33d=this.bindItems(_33c);
dojo.publish("ModelItemsUpdate",["ModelItemsUpdate",this._getTopicType("ModelItemsUpdate"),this.name,_33d,_33b]);
},onItemInsert:function(item){
if(this._logger){
this._logger.write("ModelItemInsert");
}
var _33f=this.bindItems([item]);
dojo.publish("ModelItemInsert",["ModelItemInsert",this._getTopicType("ModelItemInsert"),this.name,_33f[0]]);
},onItemsDelete:function(_340,_341){
if(this._logger){
this._logger.write("ModelItemsDelete"+dojo.toJson(_340));
}
dojo.publish("ModelItemsDelete",["ModelItemsDelete",this._getTopicType("ModelItemsDelete"),this.name,_341,_340]);
},load:function(_342){
this.loadFromRemote(_342);
},loadFromRemote:function(_343){
if(_343==null){
_343={};
}
if(this.store){
this.store.close();
}
this.store=new this.classType({url:_343.url});
this._currentFetchParams={query:{type:this.name},sort:_343.sort,onComplete:this.onLoadComplete,onError:this.onLoadError,scope:this,_url:_343.url,pageOffset:_343.pageOffset||0,pageSize:_343.pageSize||0};
if(_343.query){
this._currentFetchParams.query=std.hash.merge(this._currentFetchParams.query,_343.query);
}
if(_343.queryOptions){
this._currentFetchParams.queryOptions=this._currentFetchParams.queryOptions||{};
this._currentFetchParams.queryOptions=std.hash.merge(this._currentFetchParams.queryOptions,_343.queryOptions);
}
this.onLoadStart("load");
this.store.fetch(this._currentFetchParams);
},loadFromLocal:function(_344){
if(_344==null){
_344={};
}
if(!this.store||(this._currentFetchParams&&this._currentFetchParams._url!=_344.url)){
return this.loadFromRemote(_344);
}
this._currentFetchParams={query:{type:this.name},sort:_344.sort,onComplete:this.onLoadComplete,onError:this.onLoadError,scope:this,_url:_344.url,pageOffset:_344.pageOffset||0,pageSize:_344.pageSize||0};
if(_344.query){
this._currentFetchParams.query=std.hash.merge(this._currentFetchParams.query,_344.query);
}
if(_344.queryOptions){
this._currentFetchParams.queryOptions=this._currentFetchParams.queryOptions||{};
this._currentFetchParams.queryOptions=std.hash.merge(this._currentFetchParams.queryOptions,_344.queryOptions);
}
this.onLoadStart("load-local");
this.store.fetch(this._currentFetchParams);
},sort:function(_345,_346){
if(!this._currentFetchParams||!_345){
return;
}
if(_346==null){
_346={};
}
this._currentFetchParams.sort=_345;
if(_346.mixinFetchParams){
this._currentFetchParams=std.hash.merge(this._currentFetchParams,_346.mixinFetchParams);
}
this.onLoadStart("sort");
this.store.fetch(this._currentFetchParams);
},filter:function(_347,_348){
if(!this._currentFetchParams){
return;
}
if(_347==null){
_347={};
}
if(_348==null){
_348={};
}
this._currentFetchParams.query=std.hash.merge(this._currentFetchParams.query,_347);
if(_348.reset){
this._currentFetchParams.query={type:this.name};
}
if(_348.mixinFetchParams){
this._currentFetchParams=std.hash.merge(this._currentFetchParams,_348.mixinFetchParams);
}
this.onLoadStart("filter");
this.store.fetch(this._currentFetchParams);
},query:function(_349,_34a,_34b){
if(!_349){
return;
}
var _34c=this;
var _34d=function(_34e,_34f){
var _350=_34e;
if(!_34b){
_350=_34c.bindItems(_34e);
}
_34a(_350);
};
this.store.fetch({query:_349,onComplete:_34d});
},countIf:function(_351,_352){
if(!_351){
return;
}
var _353=this;
var _354=function(_355,_356){
_352(_355.length);
};
this.store.fetch({query:_351,onComplete:_354});
},updateOn:function(_357,_358,_359){
var _35a=this;
var _35b=function(_35c){
dojo.forEach(_35c,function(item){
if(_35a.store.isItem(item)){
_35a._updateItem(item,_358,_359);
}
});
if(_35a.store.isDirty()){
_35a.store.save();
_35a.onItemsUpdate(_357,_35c);
}
};
this.query(_357,_35b,true);
},_updateItem:function(item,_35f,_360){
if(_360==null){
_360={};
}
for(var key in _35f){
var _362=this.store.getIdentityAttributes(item);
var _363=dojo.some(_362,function(k){
return k==key;
});
if(_363){
continue;
}
if(this._containReference(_35f[key])){
if(!_360.resolveReference){
continue;
}
_35f[key]=this._resolveReference(_35f[key]);
}
this.store.setValue(item,key,_35f[key]);
}
},insert:function(_365,_366){
if(_366==null){
_366={};
}
var _367=this;
var _368=false;
var func=function(item){
if(_367.store.isItem(item)){
_368=true;
if(_366.updateIfExists){
_367._updateItem(item,_365,_366);
}
}
};
var _36b=this.store.getFeatures()["dojo.data.api.Identity"];
this.store.fetchItemByIdentity({identity:_365[_36b],onItem:func});
if(!_368){
if(_366.resolveReference){
for(var key in _365){
if(this._containReference(_365[key])){
_365[key]=this._resolveReference(_365[key]);
}
}
}
var item=this.store.newItem(_365);
}
if(this.store.isDirty()){
this.store.save();
this.onItemInsert(item);
}
},deleteOn:function(_36e,_36f){
var _370=this;
var _371=function(_372){
var _373=_370.bindItems(_372);
dojo.forEach(_372,function(item){
if(_370.store.isItem(item)){
_370.store.deleteItem(item);
}
});
if(_370.store.isDirty()){
_370.store.save();
_370.onItemsDelete(_36e,_373);
}
};
this.query(_36e,_371,true);
},_containReference:function(obj){
if(obj&&typeof (obj)=="object"){
if(obj._reference){
return true;
}
if(std.lang.isArray(obj)){
var _376=this;
return dojo.some(obj,function(o){
return _376._containReference(o);
});
}
for(var k in obj){
if(this._containReference(obj[k])){
return true;
}
}
}
return false;
},_resolveReference:function(obj){
if(typeof (obj)=="object"){
if(obj._reference){
if(this.store._itemsByIdentity){
obj=this.store._itemsByIdentity[obj._reference];
}
return obj;
}
if(std.lang.isArray(obj)){
var _37a=this;
return dojo.map(obj,function(o){
return _37a._resolveReference(o);
});
}
for(var k in obj){
obj[k]=this._resolveReference(obj[k]);
}
}
return obj;
},bindItems:function(_37d){
var _37e=[];
var _37f=this.store;
for(var i=0;i<_37d.length;i++){
var _381={};
this._items2Params(_37d[i],_381);
_381._identityAttr=_37f.getIdentityAttributes(_37d[i])[0];
_381[_381._identityAttr]=_37f.getIdentity(_37d[i]);
_37e.push(_381);
}
return _37e;
},_items2Params:function(item,_383){
if(!item){
return;
}
var _384=this;
var _385=this.store;
var _386=_385.getAttributes(item);
dojo.forEach(_386,function(_387){
var _388=_385.getValues(item,_387);
if(_388.length==0){
_383[_387]=[];
}
for(var i=0;i<_388.length;i++){
var _38a=_388[i];
var _38b=(_388.length==1);
if(_385.isItem(_38a)){
if(_385.isItemLoaded(_38a)){
var _38c=_38a;
if(_38b){
_383[_387]={};
_384._items2Params(_38c,_383[_387]);
}else{
if(_383[_387]==null||i==0){
_383[_387]=[];
}
_383[_387].push({});
_384._items2Params(_38c,_383[_387][(_383[_387].length-1)]);
}
}
}else{
if(_38b){
_383[_387]=_38a;
}else{
_383[_387]=[];
_383[_387].push(_38a);
}
}
}
});
}});
jstalyst.component.model={};
jstalyst.component.model.createReadWriteModel=function(name){
if(!name){
return null;
}
return new jstalyst.component.Model(dojo.data.ItemFileWriteStore,name);
};
dojo.provide("jstalyst.component.Widget");
dojo.declare("jstalyst.component.Widget",null,{myApplication:null,myWidgetId:null,requestProfile:null,stash:null,ready4Update:true,deferredTopics:[],_forceReady:false,setApplication:function(app,myId){
this.myApplication=app;
this.myWidgetId=myId;
if(this._forceReady){
this.iAmReady();
}
},iAmReady:function(){
this._forceReady=true;
if(this.myApplication&&this.myWidgetId){
this.myApplication.setWidgetReady(this.myWidgetId);
}
},dispatchApplicationTopic:function(_390,_391,_392,_393){
this.requestProfile=_392;
this.stash=_393;
this["_W_"+_391+"TopicType"](_390,_391);
this.requestProfile=null;
this.stash=null;
},dispatchModelTopic:function(){
var args=std.array.from(arguments);
var _395=args[0];
var _396=args[1];
var _397=this["_W_"+_396+"TopicType"];
_397.apply(this,args);
},_dispatchActualTopicHandler:function(args){
var _399=args[0];
var _39a=this["on"+_399];
if(typeof (_39a)=="function"){
_39a.apply(this,args.slice(2));
}
},_W_resetTopicType:function(){
this.ready4Update=false;
this.deferredTopics=new Array();
this._dispatchActualTopicHandler(std.array.from(arguments));
},_W_normalTopicType:function(){
this._dispatchActualTopicHandler(std.array.from(arguments));
this.ready4Update=true;
if(this.deferredTopics){
var _39b=this;
dojo.forEach(this.deferredTopics,function(_39c){
_39b._dispatchActualTopicHandler(_39c);
});
}
},_W_asapTopicType:function(){
this._dispatchActualTopicHandler(std.array.from(arguments));
},_W_finalTopicType:function(){
if(this.ready4Update){
this._dispatchActualTopicHandler(std.array.from(arguments));
}else{
this.deferredTopics.push(std.array.from(arguments));
}
}});
dojo.provide("jstalyst.component.Dialog");
dojo.require("dijit.Dialog");
var _jstalyst_dialog_onload_elem2focus=null;
dojo.declare("jstalyst.component.Dialog",dijit.Dialog,{myApplication:null,myDialogId:null,_myForms:{},title:"",href:"",duration:200,constructor:function(_39d){
if(_39d==null){
_39d={};
}
this.myApplication=_39d.application;
this.myDialogId=_39d.id;
},getDialogNodes:function(id){
if(id){
return dojo.query("[dialogAttachPoint=\""+id+"\"]",this.domNode);
}else{
return dojo.query("[dialogAttachPoint]",this.domNode);
}
},registerWidgets:function(){
var _39f=this;
var _3a0=this.getDescendants();
dojo.forEach(_3a0,function(_3a1){
_3a1.myDialog=_39f;
_39f[_3a1.id]=_3a1;
});
},registerAttachPoints:function(_3a2){
if(_3a2==null){
_3a2={};
}
var _3a3=this;
var _3a4=this.getDialogNodes();
if(_3a2.resetFirst){
dojo.forEach(_3a4,function(node){
nodeName=node.getAttribute("dialogAttachPoint");
_3a3[nodeName]=null;
delete (_3a3[nodeName]);
});
}
dojo.forEach(_3a4,function(node){
nodeName=node.getAttribute("dialogAttachPoint");
if(_3a3[nodeName]!=null){
if(!std.lang.isArray(_3a3[nodeName])){
var _3a7=_3a3[nodeName];
_3a3[nodeName]=new Array();
_3a3[nodeName].push(_3a7);
}
_3a3[nodeName].push(node);
}else{
_3a3[nodeName]=node;
}
node.myDialog=_3a3;
});
},_focusFirstFormElement:function(){
var _3a8=null;
var _3a9=dojo.query(".dijitDialogDefaultFocus",this.containerNode)[0];
if(!_3a9){
_3a9=dojo.query("input, textarea, select, button",this.containerNode)[0];
}
if(_3a9){
_3a8=_3a9;
var _3aa=dijit.getEnclosingWidget(_3a9);
if(_3aa&&typeof (_3aa.focus)=="function"){
_3a8=_3aa;
}
if(std.browser.isIE){
_jstalyst_dialog_onload_elem2focus=_3a8;
window.setTimeout("if (_jstalyst_dialog_onload_elem2focus) _jstalyst_dialog_onload_elem2focus.focus()",100);
window.setTimeout("if (_jstalyst_dialog_onload_elem2focus) _jstalyst_dialog_onload_elem2focus.focus()",120);
}else{
_3a8.focus();
}
}
},onLoad:function(){
this.registerWidgets();
this.registerAttachPoints();
this._focusFirstFormElement();
this.customOnLoad(arguments);
this._position();
},customOnLoad:function(){
},show:function(){
this.inherited(arguments);
this.onShow();
},onShow:function(){
},hide:function(){
this.onHide();
this.inherited(arguments);
this._finally();
},onHide:function(){
},_finally:function(){
},validate:function(){
return true;
},getForm:function(id){
if(id&&this._myForms[id]){
return this._myForms[id];
}
var _3ac=this;
var _3ad=function(e){
if(this.validate()&&_3ac.validate(this.getValues(),this.id)){
_3ac.execute(this.getValues(),this.id);
}
return false;
};
this._myForms={};
var _3af=this.getDescendants();
var _3b0=null;
dojo.forEach(_3af,function(_3b1){
if(_3b1.declaredClass=="dijit.form.Form"){
_3ac._myForms[_3b1.id]=_3b1;
_3b1.onSubmit=_3ad;
if(_3b0==null){
_3b0=_3b1;
}
}
});
if(id==null){
return _3b0;
}
return this._myForms[id];
},setSubmitButtonsDisabled:function(flag){
var _3b3=this.getDescendants();
dojo.forEach(_3b3,function(_3b4){
if(_3b4.declaredClass=="dijit.form.Button"&&_3b4.type=="submit"){
_3b4.setAttribute("disabled",flag);
}
});
},execute:function(_3b5,_3b6){
try{
this.onSubmitting(_3b5,_3b6);
}
catch(err){
this.myApplication.handleException(err);
}
},onSubmitting:function(){
this.hide();
}});
dojo.provide("jstalyst.component.AdvanceTemplated");
dojo.require("dijit._Templated");
dojo.declare("jstalyst.component.AdvanceTemplated",dijit._Templated,{myself:null,useTemplateMacro:false,_emptyVar:"",staticVars:{_tokenizedTplStr:null,_lastTokenizedTplStr:""},constructor:function(){
this.myself=this;
},runTemplateMacro:function(){
this.templateString=this._parseJSTemplate(this.templateString);
},_parseJSTemplate:function(tmpl){
var _3b8=tmpl;
eval("var _this = this;");
_3b8=_3b8.replace(/#init\((.*?)\)#/g,function(_3b9,code){
code=code.replace(/this\./g,"_this.");
code+=";\"\";";
code=code.replace(";",";\n");
return eval(code);
});
var _3bb={bExpr:[true],trueValues:[""],falseValues:[""]};
var _3bc={col:"trueValues",row:0};
var _3bd=[];
var _3be={isActive:false,atRow:0};
var _3bf;
if(this.staticVars._tokenizedTplStr&&(this.staticVars._lastTokenizedTplStr==_3b8)){
_3bf=this.staticVars._tokenizedTplStr;
}else{
_3bf=this._tokenizeIfThenElse(_3b8);
this.staticVars._tokenizedTplStr=_3bf;
this.staticVars._lastTokenizedTplStr=_3b8;
}
for(var i=0;i<_3bf.length;i++){
var _3c1=_3bf[i];
var _3c2=_3c1.match(/#if\(\s*(.*?)\s*\)#/);
if(_3c2){
_3c2=_3c2[1];
}
if(_3c2){
var _3c3=_3bc;
_3bd.push(_3c3);
_3bc={col:"trueValues",row:_3c3.row+1};
_3c2=_3c2.replace(/this\./g,"_this.");
if((_3bb.bExpr[_3c3.row]&&_3c3.col=="falseValues")||(!_3bb.bExpr[_3c3.row]&&_3c3.col=="trueValues")){
_3be.isActive=true;
_3be.atRow=_3c3.row;
}
if(!_3be.isActive){
_3bb.bExpr[_3bc.row]=Boolean(eval(_3c2));
}else{
_3bb.bExpr[_3bc.row]=_3c2;
}
_3bb.trueValues[_3bc.row]="";
_3bb.falseValues[_3bc.row]="";
}else{
if(_3c1.match(/#else#/)){
var _3c3=_3bc;
_3bd.push(_3c3);
_3bc={col:"falseValues",row:_3c3.row};
}else{
if(_3c1.match(/#end#/)){
var row=_3bc.row;
if(_3be.isActive&&((_3be.atRow+1)==row)){
_3be.isActive=false;
}
if(_3bb.bExpr[row]==null||_3bb.trueValues[row]==null){
throw new SyntaxError(loc("Invalid boolean expressions in widget template."));
}
if(_3bb.falseValues[row]==null){
_3bb.falseValues="";
}
var _3c5=_3bc;
_3bc=_3bd.pop();
if(_3c5.col=="falseValues"){
_3bc=_3bd.pop();
}
if(_3bc==null){
throw new SyntaxError(loc("Unmatched if-then-else statements in widget template"));
}
if(_3bb.bExpr[_3c5.row]){
_3bb[_3bc.col][_3bc.row]+=_3bb.trueValues[_3c5.row];
}else{
_3bb[_3bc.col][_3bc.row]+=_3bb.falseValues[_3c5.row];
}
_3bb.bExpr[_3c5.row]=null;
_3bb.trueValues[_3c5.row]=null;
_3bb.falseValues[_3c5.row]=null;
}else{
_3bb[_3bc.col][_3bc.row]+=_3c1;
}
}
}
}
_3b8=_3bb.trueValues[0];
_3b8=_3b8.replace(/#eval\((.*?)\)#/g,function(_3c6,code){
code=code.replace(/this\./g,"_this.");
code=code.replace(";",";\n");
return eval(code);
});
_3b8=_3b8.replace(/#exec\((.*?)\)#/g,function(_3c8,code){
code=code.replace(/this\./g,"_this.");
code+=";\"\";";
code=code.replace(";",";\n");
return eval(code);
});
var _3ca=function(_3cb,_3cc){
var _3cd="";
if(_3cb){
var _3ce=dojo.isArray(_3cb)?_3cb:[_3cb];
dojo.forEach(_3ce,function(item){
_3cd+=_3cc.replace(/%\{(.*?)\}/g,function(_3d0,code){
if(!code){
code="item";
}else{
code="item."+code;
}
return eval(code);
});
_3cd=_3cd.replace(/%eval\{(.*?)\}/g,function(_3d2,code){
code=code.replace(/this\./g,"item.");
code=code.replace(";",";\n");
return eval(code);
});
});
}
return _3cd;
};
_3b8=_3b8.replace(/#each\(\s*(.*?)\s*,\s*'(.*?)'\s*\)#/g,function(_3d4,_3d5,_3d6){
_3d5=_3d5.replace(/this\./g,"_this.");
return _3ca(eval(_3d5),_3d6);
});
return _3b8;
},_tokenizeIfThenElse:function(str){
var _3d8=[];
var _3d9=str.split(/#if\(\s*.*?\s*\)#|#else#|#end#/g);
var _3da=str.match(/#if\(\s*.*?\s*\)#|#else#|#end#/g);
var j=0;
for(var i=0;i<_3d9.length;i++){
_3d8.push(_3d9[i]);
if(_3da&&j<_3da.length){
_3d8.push(_3da[j++]);
}
}
return _3d8;
}});
dojo.provide("jstalyst.component.QualityFeedbackAgent");
dojo.declare("jstalyst.component.QualityFeedbackAgent",null,{constructor:function(_3dd){
if(_3dd==null){
_3dd={};
}
this.namespace=_3dd.namespace||"";
this.request={};
this.request.uri=_3dd.requestUri;
this.request.method=_3dd.requestMethod||"post";
this.request.contentType=_3dd.requestContentType||"text/plain";
this.logger=new jstalyst.component.Logger({namespace:this.namespace});
},submit:function(_3de){
if(!this.request.uri){
return;
}
if(typeof (_3de)!="function"){
_3de=function(){
};
}
var _3df={url:this.request.uri,handleAs:"text",contentType:this.request.contentType,timeout:10000,load:_3de,error:function(){
}};
if(this.request.method.match(/get/i)){
_3df.content=this.logger.getString();
dojo.xhrGet(_3df);
}else{
if(this.request.method.match(/post/i)){
_3df.postData=this.logger.getString();
dojo.rawXhrPost(_3df);
}
}
}});
dojo.provide("jstalyst.component.Logger");
dojo.declare("jstalyst.component.Logger",null,{_static:{buffer:[],max:500,start:0,next:0},constructor:function(_3e0){
if(_3e0==null){
_3e0={};
}
this.namespace=_3e0.namespace||"";
},write:function(_3e1){
this._static.buffer[this._static.next]={namespace:this.namespace,time:new Date(),message:_3e1};
this._static.next=(this._static.next+1)%this._static.max;
if(this._static.start==this._static.next){
this._static.start=(this._static.start+1)%this._static.max;
}
return _3e1;
},getString:function(){
var text=[];
var n=(this._static.next-this._static.start+this._static.max)%this._static.max;
for(var i=0;i<n;i++){
var _3e5=this._static.buffer[(this._static.start+i)%this._static.max];
text.push(std.date.asTimeStrUTC(_3e5.time)+" "+_3e5.namespace+" - "+_3e5.message);
}
return text.join("\n");
}});
dojo.provide("jstalyst.dialog.StandardError");
dojo.require("dijit.Dialog");
dojo.declare("jstalyst.dialog.StandardError",dijit.Dialog,{title:loc("Sorry, an error has occurred"),duration:200,footer:loc("We will figure out how to resolve the problem. You may wish to [_1]reload this page[_2] to continue your work.","<a href=\"javascript: void(0)\" title=\"reload\" onclick=\"window.location.reload()\">","</a>"),useFooter:true,dialogTemplate:"<div class=\"dijitDialogContentHolder tundra\"><h4>${codeMessage}</h4><p>${message}</p><p>${footer}</p><p><button dojoType=\"dijit.form.Button\" type=\"submit\">${okbutton}</button></p></div>",constructor:function(_3e6){
if(_3e6==null){
_3e6={};
}
this.code=_3e6.code;
this.message=_3e6.message;
if(_3e6.useFooter==false){
this.useFooter=false;
}
if(!this.code){
this.code="custom";
}
if(!this.message){
this.message="";
}
},_getCodeMessage:function(code){
switch(code){
case 404:
return loc("404 - Not found");
break;
case 403:
return loc("403 - Forbidden");
break;
case 500:
return loc("500 - Internal server error");
break;
case "custom":
return loc("Application error");
break;
case "timeout":
return loc("Request aborted");
break;
}
},_buildContent:function(){
var _3e8=this.dialogTemplate;
_3e8=_3e8.replace(/\$\{codeMessage\}/,this._getCodeMessage(this.code));
_3e8=_3e8.replace(/\$\{message\}/,this.message);
if(this.useFooter){
_3e8=_3e8.replace(/\$\{footer\}/,this.footer);
}else{
_3e8=_3e8.replace(/\$\{footer\}/,"");
}
_3e8=_3e8.replace(/\$\{okbutton\}/,loc("OK"));
return _3e8;
},show:function(){
this.setContent(this._buildContent());
this.inherited(arguments);
}});
dojo.provide("jstalyst.core.Controller");
dojo.require("dojo.back");
dojo.require("dojo.io.iframe");
dojo.require("jstalyst.component.ApplicationState");
dojo.require("jstalyst.component.Model");
dojo.require("jstalyst.component.Widget");
dojo.require("jstalyst.component.Dialog");
dojo.require("jstalyst.component.AdvanceTemplated");
dojo.require("jstalyst.component.QualityFeedbackAgent");
dojo.require("jstalyst.dialog.StandardError");
dojo.declare("jstalyst.core.Controller",null,{defaultXhrTimeout:10000,base:"/",appName:"A JStalyst Application",defaultState:{},initialState:{},currentState:null,stateClass:jstalyst.component.ApplicationState,stash:{},requestProfile:{},actionsProfile:{},applicationTopics:[{topic:"ApplicationRequestStart",type:"reset"},{topic:"ApplicationRequestComplete",type:"normal"},{topic:"ApplicationRequestError",type:"asap"}],_widgets:{},_dialogClasses:{},_dialogArgs:{},_dialogs:{},_preRequisites:{},_widgetTopics:{},constructor:function(_3e9){
if(_3e9==null){
_3e9={};
}
if(_3e9["base"]){
this.base=_3e9["base"];
}
if(_3e9["appName"]){
this.appName=_3e9["appName"];
}
if(_3e9["defaultState"]){
this.defaultState=_3e9["defaultState"];
}
},registerWidget:function(id,obj,_3ec){
if(!id||!obj){
return;
}
this._widgets[id]=obj;
if(_3ec&&_3ec.startingPreRequisite){
this._addPreRequisite(id);
}
if(typeof (obj.setApplication)=="function"){
obj.setApplication(this,id);
}
this._subscribeWidget(id);
},widget:function(id){
return this._widgets[id];
},_subscribeWidget:function(_3ee){
var _3ef=this.widget(_3ee);
if(!_3ef){
return;
}
if(typeof (_3ef.dispatchApplicationTopic)=="function"){
if(this._widgetTopics[_3ee]!=null){
dojo.forEach(this._widgetTopics[_3ee],function(h){
dojo.unsubscribe(h);
});
}
this._widgetTopics[_3ee]=new Array();
for(var i=0;i<this.applicationTopics.length;i++){
var _3f2=this.applicationTopics[i].topic;
var h=dojo.subscribe(_3f2,_3ef,_3ef.dispatchApplicationTopic);
this._widgetTopics[_3ee].push(h);
}
}
},_publishApplicationTopic:function(_3f4){
var _3f5=false;
var _3f6="";
for(var i=0;i<this.applicationTopics.length;i++){
if(this.applicationTopics[i].topic==_3f4){
_3f5=true;
_3f6=this.applicationTopics[i].type;
break;
}
}
if(_3f5){
dojo.publish(_3f4,[_3f4,_3f6,this.requestProfile,this.stash]);
}
},runOnBehalfOf:function(obj,_3f9){
var args=std.array.from(arguments).slice(2);
var _3fb=obj;
if(_3fb&&typeof (_3fb[_3f9])=="function"){
return _3fb[_3f9].apply(_3fb,args);
}
_3fb=dijit.getEnclosingWidget(obj);
if(_3fb&&typeof (_3fb[_3f9])=="function"){
return _3fb[_3f9].apply(_3fb,args);
}
},_addPreRequisite:function(id){
this._preRequisites[id]=false;
},_markPreRequisite:function(id,flag){
var boo=true;
if(flag!=null&&!flag){
boo=false;
}
this._preRequisites[id]=boo;
},setWidgetReady:function(id){
this._markPreRequisite(id);
},_readyToStart:function(){
for(var k in this._preRequisites){
if(!this._preRequisites[k]){
return false;
}
}
return true;
},start:function(){
jstalyst.core.controller.currentApp=this.appName;
jstalyst.core.controller.scheduledApps[this.appName]=this;
jstalyst.core.controller.startAppTimer();
},initialize:function(){
if(this.qfAgentProfile&&this.qfAgentProfile.requestPath&&!dojo.config.isDebug){
this.qfAgentProfile.namespace=this.appName;
this.qfAgentProfile.requestUri=this.base+this.qfAgentProfile.requestPath;
this.qfAgent=new jstalyst.component.QualityFeedbackAgent(this.qfAgentProfile);
}
for(var k in this.defaultState){
if(this.initialState[k]==null){
this.initialState[k]=this.defaultState[k];
}
}
var _403=new this.stateClass(null,std.lang.bind(this,this.changeToState),this);
var _404=_403.mapStateDataFromUrl();
this.setInitialState(_404);
var _405=true;
this.markState(this.initialState,_405);
},finalize:function(){
for(var _406 in this._widgetTopics){
var _407=this._widgetTopics[_406];
dojo.forEach(_407,function(_408){
dojo.unsubscribe(_408);
});
}
},markState:function(data,_40a,_40b){
if(data==null){
data={};
}
var _40c=new this.stateClass(data,std.lang.bind(this,this.changeToState),this);
var _40d=function(){
if(_40a){
_40c.clearUrl();
dojo.back.setInitialState(_40c);
}else{
dojo.back.addToHistory(_40c);
}
};
if(!_40b){
_40d();
}else{
this._deferredMarkState=_40d;
}
this.currentState=_40c;
},updateState:function(_40e,_40f){
var _410=this.currentState.cloneStateData();
var data=std.hash.merge(_410,_40e);
this.markState(data,_40f,true);
},setInitialState:function(_412){
this.initialState=_412;
},changeToState:function(_413,_414){
},_request:function(_415,_416,_417,_418){
var _419=this[_415];
var _41a=null;
this.requestProfile={action:_415,params:_416};
try{
if(typeof (_419)=="function"){
this._controlLocking=_418?true:false;
this.stash={};
this.onRequestStart();
this._publishApplicationTopic("ApplicationRequestStart");
if(this.qfAgent){
this.qfAgent.logger.write("ApplicationRequestStart: "+_415+", Parameters: "+dojo.toJson(_416));
}
_41a=this[_415](_416);
if(_41a!=false&&!_417){
this._controlLocking=false;
this.onRequestComplete();
if(typeof (this._deferredMarkState)=="function"){
this._deferredMarkState();
delete (this._deferredMarkState);
}
if(this.qfAgent){
this.qfAgent.logger.write("ApplicationRequestComplete: (sync) "+_415+", ReturnValue: "+dojo.toJson(_41a));
}
this._publishApplicationTopic("ApplicationRequestComplete");
}
}else{
throw new Error(loc("Invalid request"));
}
}
catch(err){
this.handleException(err);
}
return _41a;
},request:function(_41b,_41c){
if(this.currentState==null){
return;
}
if(this._controlLocking){
return;
}
var _41d=this.actionsProfile[_41b];
var _41e=(_41d&&_41d.controlLock)?true:false;
if(_41d&&_41d.asynchronous){
this._request(_41b,_41c,true,_41e);
}else{
this._request(_41b,_41c,false,_41e);
}
},completeAsyncAction:function(){
this._controlLocking=false;
this.onRequestComplete();
if(typeof (this._deferredMarkState)=="function"){
this._deferredMarkState();
delete (this._deferredMarkState);
}
if(this.qfAgent){
this.qfAgent.logger.write("ApplicationRequestComplete: (async) "+this.requestProfile.action);
}
this._publishApplicationTopic("ApplicationRequestComplete");
},onRequestStart:function(){
},onRequestComplete:function(){
},_prepareRemoteRequest:function(_41f){
var _420=this;
if(!_41f){
return;
}
if(_41f.handleAs==null){
_41f.handleAs="json";
}
if(_41f.customError==null){
_41f.customError=function(_421){
_420.showErrorDialog("custom",_421);
};
}
var _422={url:_41f.url,handleAs:_41f.handleAs,timeout:_41f.timeout||this.defaultXhrTimeout,content:_41f.content,load:std.lang.bind(this,function(_423){
var _424=true;
if(_41f.handleAs=="text"&&_423){
var _425=null;
try{
_425=dojo.fromJson(_423);
}
catch(err){
}
if(_425&&typeof (_425)=="object"){
if(_425.successful){
_424=false;
}
}else{
_424=false;
}
}
if(_41f.handleAs=="json"&&_423.successful){
_424=false;
}
if(_424){
if(typeof (_41f.customError)=="function"){
_41f.customError(_423);
}
_420._publishApplicationTopic("ApplicationRequestError");
}else{
var _426=std.lang.bind(this,_41f.load);
_426(_423);
}
return _423;
}),error:function(_427,_428){
if(_427.dojoType=="timeout"){
_420.showErrorDialog("timeout",_427.message);
}else{
if(_428.xhr){
var _429=_427.message;
try{
_429=eval(_428.xhr.responseText);
}
catch(err){
}
_420.showErrorDialog(_428.xhr.status,_429);
}else{
_420.showErrorDialog("custom",_427.message);
}
}
_420._publishApplicationTopic("ApplicationRequestError");
},form:_41f.form};
if(_41f.noTimeout){
_422.timeout=null;
}
return _422;
},xhrGet:function(_42a){
var _42b=this._prepareRemoteRequest(_42a);
dojo.xhrGet(_42b);
},xhrPost:function(_42c){
var _42d=this._prepareRemoteRequest(_42c);
dojo.xhrPost(_42d);
},iframeSend:function(_42e){
if(!_42e){
return;
}
if(_42e.method==null){
_42e.method="post";
}
if(_42e.handleAs==null){
_42e.handleAs="text";
}
_42e.noTimeout=true;
var _42f=this._prepareRemoteRequest(_42e);
dojo.io.iframe.send(_42f);
},handleException:function(_430){
if(!_430){
return;
}
var _431="";
var _432=false;
if(typeof (_430)=="object"){
var _433=false;
if(_430.responseText){
try{
var _434=eval(_430.responseText);
if(typeof (_434)=="object"){
if(_434.redirect){
window.location.href=_434.redirect;
return;
}
}else{
_431+=_434.slice(0,1023);
}
_432=true;
_433=true;
}
catch(err){
}
}
if(!_433){
_431+=loc("Application name")+": "+this.appName+"<br/>\n";
_431+=loc("Requested action")+": "+this.requestProfile.action+"<br/>\n";
var _435=_430.message.slice(0,1023);
_431+=_430.name+": "+_435+(_430.message.length>1024?"...":"");
}
}else{
_431=_430;
}
var _436="custom";
if(std.browser.isFF&&_430.status==0){
if(typeof (this._fixAbortedXhr)=="function"){
this._fixAbortedXhr(_430);
return;
}
}
if(_430.status){
_436=_430.status;
}
var _437=std.lang.bind(this,function(_438){
if(_438){
var _439=parseInt(_438);
if(!isNaN(_439)){
_431+="<br/>\n"+loc("Quality feedback ticket ID")+": #"+_439+"<br/>\n";
}
}
this.showErrorDialog(_436,_431,{noFooter:_432});
});
if(this.qfAgent){
this.qfAgent.logger.write("ErrorCode: "+_436+", Exception: "+_431);
this.qfAgent.submit(_437);
}else{
_437();
}
if(console){
console.warn(_430);
}
},showErrorDialog:function(_43a,_43b,_43c){
if(_43c==null){
_43c={};
}
var _43d={code:_43a,message:_43b};
if(_43c.noFooter){
_43d.useFooter=false;
}
var _43e=new jstalyst.dialog.StandardError(_43d);
_43e.show();
},registerDialog:function(id,_440,args){
if(!id||!_440){
return;
}
this._dialogClasses[id]=_440;
this._dialogArgs[id]=args||{};
},openDialog:function(id,_443,_444){
if(!id){
return;
}
if(_444==null){
_444={};
}
if(_444.forceReload==null){
_444.forceReload=true;
}
if(_444.forceReload&&this._dialogs[id]){
this._dialogs[id].destroyRecursive();
this._dialogs[id]=null;
}
if(!this._dialogs[id]){
var _445=this._dialogClasses[id];
if(typeof (_445)=="function"){
if(_443==null){
_443={};
}
_443.application=this;
_443.id=id;
_443=std.hash.merge(this._dialogArgs[id],_443);
this._dialogs[id]=new _445(_443);
}
}
if(_444.forceReload&&this._dialogs[id]){
var _app=this;
this._dialogs[id]._finally=std.lang.bind(this._dialogs[id],function(){
this.destroyRecursive();
delete (_app._dialogs[id]);
});
}
this._dialogs[id].show();
}});
jstalyst.core.controller={};
jstalyst.core.controller.currentApp=null;
jstalyst.core.controller.scheduledApps=[];
jstalyst.core.controller.startAppTimer=function(){
var app=jstalyst.core.controller.scheduledApps[jstalyst.core.controller.currentApp];
if(!app){
throw new Error(loc("Cannot start JStalyst application properly!"));
}
if(app._readyToStart()){
app.initialize();
}else{
setTimeout("jstalyst.core.controller.startAppTimer()",200);
}
};
dojo.provide("explorer.lib.util");
explorer.lib.util.onResizeAppLayout=function(_448,_449,_44a){
var _44b=dojo.byId(_448);
var _44c=std.dom.getBodyExtent().width;
_44b.style.width=_44c+"px";
var _44d=(_44c-dijit.byId(_449).domNode.clientWidth)+"px";
dijit.byId(_44a).domNode.style.width=_44d;
};
explorer.lib.util.toggleSiteNavigation=function(_44e,_44f){
var _450=dojo.byId(_44e);
var _451=dojo.byId(_44f);
if(_450.style.display=="none"){
_450.style.display="block";
_451.className+="Expanded";
}else{
if(_450.style.display!="none"){
_450.style.display="none";
_451.className=_451.className.substr(0,_451.className.length-"Expanded".length);
}
}
explorer.lib.util.positionSiteNavigation(_450,_451);
};
explorer.lib.util.positionSiteNavigation=function(_452,_453){
var _454=dojo.byId(_452);
var _455=dojo.byId(_453);
if(_454.style.display=="none"){
return;
}
var _456=std.dom.getBodyExtent().height;
var _457=_455.clientHeight;
var _458=(_456-_454.clientHeight-_457);
if(_458<0){
_458=0;
}
_454.style.top=_458+"px";
};
explorer.lib.util.togglePrivateMesg=function(_459,_45a){
togglePrivateMessageBox();
var _45b=dojo.byId(_459);
var _45c=dojo.byId(_45a);
if(_45b.style.display=="none"){
_45b.style.display="block";
}
var _45d=std.dom.getBodyExtent().height;
var _45e=_45c.clientHeight;
var _45f=(_45d-_45b.clientHeight-_45e);
if(_45f<0){
_45f=0;
}
_45b.style.top=_45f+"px";
};
dojo.extend(dijit.layout._Splitter,{_cleanupHandlers:function(){
this.onSplitterResize();
dojo.forEach(this._handlers,dojo.disconnect);
delete this._handlers;
},onSplitterResize:function(){
}});
dojo.provide("explorer.widget.TabContainer");
dojo.require("dijit.layout.TabContainer");
dojo.require("dijit.layout.LinkPane");
dojo.require("jstalyst.component.Widget");
dojo.declare("explorer.widget.TabContainer",[dijit.layout.TabContainer,jstalyst.component.Widget],{onApplicationRequestComplete:function(){
if(!this.stash.tabProfiles){
return;
}
var _460=this;
var _461=this.stash.tabProfiles;
var tabs=this.getChildren();
dojo.forEach(_461,function(_463,i){
var tab=tabs[i];
if(!tab){
tab=new dijit.layout.LinkPane({},dojo.doc.createElement("div"));
_460.addChild(tab);
tab.startup();
}
if(typeof (_463.onLoad)=="function"){
tab.onLoad=_463.onLoad;
}
if(_463.title){
tab.controlButton.setLabel(_463.title);
}
tab.setHref(_463.url);
if(_463.selected){
_460.selectChild(tab);
}
if(_463.hidden){
_460.closeChild(tab);
}
});
}});
dojo.provide("explorer.widget.NavigationList");
dojo.require("jstalyst.component.Widget");
dojo.declare("explorer.widget.NavigationList",[dijit._Widget,dijit._Templated,jstalyst.component.Widget],{onApplicationRequestComplete:function(){
if(!this.stash.activeAction){
return;
}else{
if(this.stash.activeAction==null){
dojo.query(".dijitActionNode",this.domNode).removeClass("dijitActionNodeActive");
}else{
dojo.query(".dijitActionNode",this.domNode).removeClass("dijitActionNodeActive");
dojo.addClass(dojo.query("div[actionName=\""+this.stash.activeAction+"\"]",this.domNode)[0],"dijitActionNodeActive");
}
}
}});
dojo.provide("explorer.widget.AccordionList");
dojo.require("dijit.layout.AccordionContainer");
dojo.require("jstalyst.component.Widget");
dojo.declare("explorer.widget.AccordionList",[dijit.layout.AccordionContainer,jstalyst.component.Widget],{onApplicationRequestComplete:function(){
if(!this.stash.activeAction){
return;
}else{
if(this.stash.activeAction==null){
dojo.query(".dijitAccordionItem",this.domNode).removeClass("dijitAccordionItemActive");
}else{
dojo.query(".dijitAccordionItem",this.domNode).removeClass("dijitAccordionItemActive");
dojo.addClass(dojo.query("div[actionName=\""+this.stash.activeAction+"\"]",this.domNode)[0],"dijitAccordionItemActive");
var _466=this.getChildren();
for(var i=0;i<_466.length;i++){
var pane=_466[i];
if(dojo.query("div[actionName=\""+this.stash.activeAction+"\"]",pane.domNode).length>0){
this.selectChild(pane);
}
}
}
}
}});
dojo.provide("explorer.lib.data.applicationstate");
dojo.provide("explorer.lib.data.ApplicationState");
dojo.require("jstalyst.component.ApplicationState");
dojo.declare("explorer.lib.data.ApplicationState",jstalyst.component.ApplicationState,{dataFields:[{name:"type"}]});
dojo.provide("explorer.controller.Data");
dojo.require("jstalyst.core.Controller");
dojo.require("explorer.lib.util");
dojo.require("explorer.widget.TabContainer");
dojo.require("explorer.widget.AccordionList");
dojo.require("explorer.lib.data.ApplicationState");
dojo.declare("explorer.controller.Data",jstalyst.core.Controller,{appName:"Data Explorer",stateClass:explorer.lib.data.ApplicationState,actionsProfile:{},qfAgentProfile:{requestPath:"qualityfeedback/JStalystTrace"},initialize:function(){
this.inherited(arguments);
this.registerWidget("accordionList",dijit.byId("accordionList"));
this.registerWidget("mainTabContainer",dijit.byId("mainTabContainer"));
this.request("loadCurrentType");
if(dojo.byId("preloadScreen")){
dojo.byId("preloadScreen").style.display="none";
}
},setInitialState:function(_469){
var type=_469.type;
if(type){
var _46b=this._validateType(type);
if(_46b){
this.initialState.type=type;
}
}
},changeToState:function(_46c,_46d){
this.currentState=_46c;
this.request("loadCurrentType");
},openGrid:function(book){
if(editgrid.toolbox){
editgrid.toolbox.Toolbox.prototype.useIFrameHack=false;
}
var grid=null;
grid=new editgrid.Grid({transportFactory:"std.ajax.getDefaultTransport",jsonPath:"cmd/json/5",eventdClientFactory:"eventd.createDefaultClient",eventdDomainSuffix:2,isRemoteGrid:0});
grid.unsavedBlocker.disable();
grid.unsavedBlocker.enable=function(){
};
var _470=grid.getStandardLayout();
_470.doLayout(document.getElementById("gridContainer"),grid);
grid.openBook(book);
},toggleFunctionDetails:function(id){
var _472=document.getElementById("FunctionDetail"+id);
var _473=document.getElementById("FunctionHeader"+id);
if(_472.style.display=="none"){
_473.className="Expanded";
_472.style.display="";
}else{
_473.className="Collapsed";
_472.style.display="none";
}
},loadType:function(_474){
this.updateState({type:_474.type});
if(this.currentState.getType()!=0){
this.stash.activeAction=this.currentState.getType();
}else{
this.stash.activeAction=null;
}
this.stash.tabProfiles=this._getTabProfiles();
},loadCurrentType:function(){
if(this.currentState.getType()!=0){
this.stash.activeAction=this.currentState.getType();
}
this.stash.tabProfiles=this._getTabProfiles();
},_validateType:function(type){
return true;
},_getTabProfiles:function(){
var _476=this;
var type=this.currentState.getType();
if(type==0){
return [{url:this.base+"data/listing",title:loc("Data On Demand"),selected:true},{url:this.base+"data/listing",title:loc("Data On Demand"),hidden:true}];
}else{
return [{url:this.base+"data/summary/"+type,title:loc("Summary"),selected:true},{url:this.base+"data/functions/"+type,title:loc("Functions")},{url:this.base+"data/sandbox/"+type,title:loc("Sandbox"),onLoad:function(){
var _478=dojo.byId("datapackTrialUrl").innerHTML;
var _479=editgrid.workspace.copyBook({path:_478},_476.openGrid);
}}];
}
}});

