if(!("console" in window)||!("firebug" in console)){
var names=["log","debug","info","warn","error","assert","dir","dirxml","group","groupEnd","time","timeEnd","count","trace","profile","profileEnd"];
window.console={};
var errors=[];
for(var i=0;i<names.length;++i){
window.console[names[i]]=function(){
};
}
window.console.error=function(_1){
var i=errors.length;
errors.push([_1,arguments]);
};
console.getErrors=function(){
return errors;
};
}
if(typeof (Nethrom)=="undefined"){
Nethrom={};
}
if(typeof (Nethrom)!="object"){
throw new Error("Nethrom is not an object. Nethrom.Dispatcher has not been created.");
}
Nethrom.Utils={isInitialized:false,initialize:function(){
this._initKeyTable();
this.processScripts("onInit");
var _3=this.getCookie("locale");
document.cookie="locale="+_3+"; expires=Fri, 13-Apr-1970 00:00:00 GMT;path=/projapi/store/";
this.isInitialized=true;
},Hotkey:function(_4,_5,_6,_7){
if(typeof (_4)=="object"&&_4.keyCode){
this.keyCode=_4.keyCode;
this.ctrlKey=_4.ctrlKey;
this.altKey=_4.altKey;
this.shiftKey=_4.shiftKey;
}else{
if(typeof (_4)=="string"){
_4=_4.toUpperCase();
if(_4.indexOf("CTRL+")>-1){
_5=true;
}
if(_4.indexOf("ALT+")>-1){
_6=true;
}
if(_4.indexOf("SHIFT+")>-1){
_7=true;
}
_4=_4.replace(/CTRL\+/g,"").replace(/ALT\+/g,"").replace(/SHIFT\+/g,"");
}
this.keyCode=_4;
this.ctrlKey=(_5)?true:false;
this.altKey=(_6)?true:false;
this.shiftKey=(_7)?true:false;
}
},keyCodeTable:{},engines:{Explorer:"Trident",Firefox:"Mozilla",iCab:"iCab",Konqueror:"KHTML",Mozilla:"Mozilla",Netscape:"Mozilla",Opera:"Presto",Safari:"KHTML"},addToParent:function(_8){
if(_8.options.parent.firstChild){
return _8.options.parent.insertBefore(_8.element,_8.options.parent.firstChild);
}else{
return _8.options.parent.appendChild(_8.element);
}
},addEvent:function(_9,_a,_b){
var _c=_9[_a];
if(typeof (_b)=="string"){
_b=new Function("event",_b);
}
if(!_c){
_9[_a]=_b.bindAsEventListener(_9);
}else{
_9[_a]=function(_d){
_d=_d||window.event;
_b(_d);
_c(_d);
};
}
},createEvent:function(_e,_f){
try{
asdf();
_f[_e]();
}
catch(e1){
try{
_f.fireEvent("on"+_e);
}
catch(e){
var evt=document.createEvent("MouseEvents");
evt.initMouseEvent("click",true,true,window,0,0,0,0,0,false,false,false,false,0,null);
_f.dispatchEvent(evt);
}
}
},setUniqueSiblingClass:function(_11,_12,_13,_14){
var i;
var t=_14;
Element.addClassName(t,_13);
t=_14.previousSibling;
for(i=_11;(i>0)&&t;i--){
if(Element.hasClassName(t,_13)){
Element.removeClassName(t,_13);
}
t=t.previousSibling;
}
t=_14.nextSibling;
for(i=_11+1;(i<_12)&&t;i++){
if(Element.hasClassName(t,_13)){
Element.removeClassName(t,_13);
}
t=t.nextSibling;
}
},setCookie:function(_17,_18,_19){
var old=Nethrom.Utils.getCookie(_17);
if(!(_19&&_19<0)&&old){
Nethrom.Utils.setCookie(_17,old,-1);
}
if(_19){
var _1b=new Date();
_1b.setTime(_1b.getTime()+(_19*24*60*60*1000));
var _1c="; expires="+_1b.toGMTString();
}else{
var _1c="";
}
document.cookie=_17+"="+_18+_1c+"; path=/";
},appendCookie:function(_1d,_1e,_1f){
var old=Nethrom.Utils.getCookie(_1d);
if(old){
_1e=old+_1e;
}
Nethrom.Utils.setCookie(_1d,_1e,_1f);
},getCookie:function(_21){
var _22=_21+"=";
var ca=document.cookie.split(";");
for(var i=0;i<ca.length;i++){
var c=ca[i];
while(c.charAt(0)==" "){
c=c.substring(1,c.length);
}
if(c.indexOf(_22)==0){
return c.substring(_22.length,c.length);
}
}
return null;
},removeCookie:function(_26){
Nethrom.Utils.setCookie(_26,"",-1);
},_initKeyTable:function(){
var _27,_28,x;
with(Nethrom.Utils){
try{
_28=charCodeTable[engines[BrowserDetect.browser]];
for(_27 in _28){
if(_28[_27].keyCode){
charCodeTable.common[_27]=_28[_27];
}
}
_28=charCodeTable.common;
for(_27 in _28){
if(_28[_27].keyCode){
x=_28[_27].keyCode;
if(!keyCodeTable[x]){
keyCodeTable[x]=[];
}
keyCodeTable[x].push(_27);
}
}
}
finally{
charCodeTable=charCodeTable.common;
delete _initKeyTable;
}
}
},processScripts:function(_2a){
var i,txt,a,_2e;
var _2f=document.scripts||document.getElementsByTagName("script");
for(i=0;i<_2f.length;i++){
txt=_2f[i].innerHTML;
var _30=_2f[i];
eval("scriptRX = /(?:<"+_2a+">)((?:[^<]|(?:<(?!\\/)))*?)(?:<\\/"+_2a+">)/g;");
while(a=_2e.exec(txt)){
eval(a[1]);
}
}
}};
Nethrom.Utils.charCodeTable={common:{"INS":new Nethrom.Utils.Hotkey(45),"DEL":new Nethrom.Utils.Hotkey(46),"HOME":new Nethrom.Utils.Hotkey(36),"END":new Nethrom.Utils.Hotkey(35),"PGUP":new Nethrom.Utils.Hotkey(33),"PGDN":new Nethrom.Utils.Hotkey(34),"F1":new Nethrom.Utils.Hotkey(112),"F10":new Nethrom.Utils.Hotkey(121),"LEFT":new Nethrom.Utils.Hotkey(37),"UP":new Nethrom.Utils.Hotkey(38),"RIGHT":new Nethrom.Utils.Hotkey(39),"DOWN":new Nethrom.Utils.Hotkey(40),"ENTER":new Nethrom.Utils.Hotkey(13),"`":new Nethrom.Utils.Hotkey(192,false,false,false),"/":new Nethrom.Utils.Hotkey(191,false,false,false),"?":new Nethrom.Utils.Hotkey(191,false,false,true)},Presto:{"`":new Nethrom.Utils.Hotkey(96,false,false,false),"/":new Nethrom.Utils.Hotkey(47,false,false,false),"?":new Nethrom.Utils.Hotkey(47,false,false,true)}};
Nethrom.Utils.Hotkey.prototype.equals=function(_31){
return this.keyCode==_31.keyCode&&this.ctrlKey==_31.ctrlKey&&this.altKey==_31.altKey&&this.shiftKey==_31.shiftKey;
};
Nethrom.Utils.Hotkey.prototype.toString=function(){
var i,_33;
if(Nethrom.Utils.keyCodeTable[this.keyCode]){
for(i in Nethrom.Utils.keyCodeTable[this.keyCode]){
_33=Nethrom.Utils.keyCodeTable[this.keyCode][i];
if(Nethrom.Utils.charCodeTable[_33]&&this.equals(Nethrom.Utils.charCodeTable[_33])){
return _33;
}
}
}
var s="";
if(this.ctrlKey){
s+="Ctrl+";
}
if(this.altKey){
s+="Alt+";
}
if(this.shiftKey){
s+="Shift+";
}
s+=this.keyCode;
return s;
};
if(typeof Projapi=="undefined"){
var Projapi={};
}
if(typeof Projapi.Links=="undefined"){
Projapi.Links={};
}
Projapi.Links.Container={LinkName:"Container",InitializeObject:"initializeObject",HideObject:"hideObject",ViewObject:"viewObject",DestroyObject:"destroyObject",EnableObject:"enableObject",DisableObject:"disableObject",ConfirmExit:"confirmExit",ConfirmCancel:"confirmCancel",ConfirmOk:"confirmOk",ExitObject:"exitObject",CreateObjects:"createObjects",Resize:"resize"};
Projapi.Links.Container.SourceEvents=[Projapi.Links.Container.InitializeObject,Projapi.Links.Container.HideObject,Projapi.Links.Container.ViewObject,Projapi.Links.Container.DestroyObject,Projapi.Links.Container.EnableObject,Projapi.Links.Container.DisableObject,Projapi.Links.Container.ConfirmExit,Projapi.Links.Container.ConfirmCancel,Projapi.Links.Container.ConfirmOk,Projapi.Links.Container.Resize];
Projapi.Links.Container.TargetEvents=[Projapi.Links.Container.ExitObject];
Projapi.Links.Data={LinkName:"Data",DataAvailable:"dataAvailable",QueryPosition:"queryPosition",DeleteComplete:"deleteComplete",FetchDataSet:"fetchDataSet",UpdateState:"updateState"};
Projapi.Links.Data.SourceEvents=[Projapi.Links.Data.DataAvailable,Projapi.Links.Data.QueryPosition,Projapi.Links.Data.DeleteComplete,Projapi.Links.Data.FetchDataSet];
Projapi.Links.Data.TargetEvents=[Projapi.Links.Data.UpdateState];
Projapi.Links.Page={LinkName:"Page",SelectFolderPage:"selectFolderPage",ChangeFolderPage:"changeFolderPage",DeleteFolderPage:"deleteFolderPage"};
Projapi.Links.Page.SourceEvents=[];
Projapi.Links.Page.TargetEvents=[Projapi.Links.Page.ChangeFolderPage,Projapi.Links.Page.DeleteFolderPage];
Projapi.Links.Navigation={LinkName:"Navigation",FetchFirst:"fetchFirst",FetchNext:"fetchNext",FetchPrev:"fetchPrev",FetchLast:"fetchLast",StartFilter:"startFilter",QueryPosition:"queryPosition",UpdateState:"updateState",LinkState:"linkState",FilterState:"filterState"};
Projapi.Links.Navigation.SourceEvents=[Projapi.Links.Navigation.FetchFirst,Projapi.Links.Navigation.FetchNext,Projapi.Links.Navigation.FetchPrev,Projapi.Links.Navigation.FetchLast,Projapi.Links.Navigation.StartFilter];
Projapi.Links.Navigation.TargetEvents=[Projapi.Links.Navigation.QueryPosition,Projapi.Links.Navigation.UpdateState,Projapi.Links.Navigation.LinkState,Projapi.Links.Navigation.FilterState];
Projapi.Links.TableIO={LinkName:"TableIO",AddRecord:"addRecord",UpdateRecord:"updateRecord",CopyRecord:"copyRecord",DeleteRecord:"deleteRecord",ResetRecord:"resetRecord",CancelRecord:"cancelRecord",UpdateMode:"updateMode",QueryPosition:"queryPosition",UpdateState:"updateState",LinkState:"linkState"};
Projapi.Links.TableIO.SourceEvents=[Projapi.Links.TableIO.AddRecord,Projapi.Links.TableIO.UpdateRecord,Projapi.Links.TableIO.CopyRecord,Projapi.Links.TableIO.DeleteRecord,Projapi.Links.TableIO.ResetRecord,Projapi.Links.TableIO.CancelRecord,Projapi.Links.TableIO.UpdateMode];
Projapi.Links.TableIO.TargetEvents=[Projapi.Links.TableIO.QueryPosition,Projapi.Links.TableIO.UpdateState,Projapi.Links.TableIO.LinkState];
Projapi.Links.Commit={LinkName:"Commit",CommitTransaction:"commitTransaction",UndoTransaction:"undoTransaction",RowObjectState:"rowObjectState"};
Projapi.Links.Commit.SourceEvents=[Projapi.Links.Commit.CommitTransaction,Projapi.Links.Commit.UndoTransaction];
Projapi.Links.Commit.TargetEvents=[Projapi.Links.Commit.RowObjectState];
Projapi.Links.Action={LinkName:"Action",ActionPerformed:"actionPerformed",ValueChanged:"valueChanged",DataModified:"dataModified",StateChanged:"stateChanged"};
Projapi.Links.Action.SourceEvents=[Projapi.Links.Action.ActionPerformed,Projapi.Links.Action.ValueChanged,Projapi.Links.Action.DataModified,Projapi.Links.Action.StateChanged];
Projapi.Links.Action.TargetEvents=[];
if(typeof Projapi=="undefined"){
var Projapi={};
}
Projapi.PJRegister=function(){
this._nameRegister=[];
this._nameHash={};
this._objectRegister=[];
this._objectWindowName=[];
this._objectDOFieldName=[];
};
Projapi.PJRegister.prototype.add=function(_35,_36,_37,_38){
if(!_36){
_36=_35._objectName;
}
if(!_37){
_37=_35.getDOColumnName&&_35.getDOColumnName()||_36;
}
if(this._nameHash[_36]&&this._nameHash[_36]!=_35){
console.error("Duplicate ID detected: '"+_36+"' already exists!");
throw new Error("Duplicate ID!");
}
var _39=this._objectRegister.indexOf(_35);
if(_39!=-1){
this._nameRegister[_39]=_36;
this._objectWindowName[_39]=_35.getWindowName()?_35.getWindowName():this._getWindowName(_38);
this._objectDOFieldName[_39]=_37||null;
}else{
this._nameHash[_36]=_35;
this._nameRegister.push(_36);
this._objectRegister.push(_35);
this._objectWindowName.push(_35.getWindowName()?_35.getWindowName():this._getWindowName(_38));
this._objectDOFieldName.push(_37||null);
Projapi.Controller._indexed[_36]={_reverse:{}};
}
return _35;
};
Projapi.PJRegister.prototype._getWindowName=function(_3a){
if(!_3a){
return null;
}
if(typeof _3a=="string"){
var win=this.get(_3a);
if(!win){
return null;
}
if(win.getObjectType()=="SmartWindow"){
return _3a;
}
var _3c=_3a.getContainerSource();
while(_3c){
if(_3c.getObjectType()=="SmartWindow"){
return _3a;
}
_3c=_3a.getContainerSource();
}
return null;
}
if(typeof _3a=="object"){
if(_3a.getObjectType()=="SmartWindow"){
return _3a.getObjectName();
}
var _3c=_3a.getContainerSource();
while(_3c){
if(_3c.getObjectType()=="SmartWindow"){
return _3c.getObjectName();
}
_3c=_3c.getContainerSource();
}
return null;
}
return null;
};
Projapi.PJRegister.prototype.getFieldObject=function(_3d,_3e){
var _3f=this._objectDOFieldName.indexOf(_3d);
var _40=this._objectDOFieldName.length;
_3e=this._getWindowName(_3e);
if(this._objectWindowName[_3f]==_3e){
return this._objectRegister[_3f];
}
_3f++;
for(;_3f<_40;_3f++){
if(this._objectWindowName[_3f]==_3e){
return this._objectRegister[_3f];
}
}
};
Projapi.PJRegister.prototype.get=function(_41){
if(this._nameHash[_41]){
return this._nameHash[_41];
}
var _42=this._nameRegister.indexOf(_41);
if(_42!=-1){
return this._objectRegister[_42];
}
return null;
};
$P=function(_43){
var i,_45=arguments[0];
for(i=1;i<arguments.length;i++){
_45+="___"+arguments[i];
}
return Projapi.Register.get(_45);
};
Projapi.PJRegister.prototype.remove=function(_46){
if(typeof _46=="object"&&_46 instanceof Projapi.Base.iPJSmartObject){
_46=_46.getObjectName();
}
var _47=this._nameRegister.indexOf(_46);
if(_47!=-1){
delete this._nameHash[_46];
this._objectRegister[_47]=null;
this._nameRegister[_47]=null;
this._objectWindowName[_47]=null;
this._objectDOFieldName[_47]=null;
this._nameRegister.splice(_47,1);
this._objectRegister.splice(_47,1);
this._objectWindowName.splice(_47,1);
this._objectDOFieldName.splice(_47,1);
}
};
Projapi.PJRegister.prototype.contains=function(_48){
return this._nameRegister.indexOf(_48)!=-1;
};
Projapi.Register=new Projapi.PJRegister();
Projapi.Controller={};
Projapi.Controller._indexed={};
Projapi.Controller._executeOnInit={};
Projapi.Controller._indexedAdd=function(_49,_4a,_4b,_4c){
var _4d,_4e;
_4d=this._indexed[_49._objectName];
_4e=this._indexed[_4b._objectName]._reverse;
if(!_4d[_4a]){
_4d[_4a]=[_4c];
}else{
_4d[_4a].push(_4c);
}
if(!_4e[_4a]){
_4e[_4a]=[_4c];
}else{
_4e[_4a].push(_4c);
}
};
Projapi.Controller._indexedFind=function(_4f,_50){
var _51=null,i,t1,t2;
if((_51=this._indexed[_4f._objectName])&&(_51=_51[_50])){
return _51;
}
return [];
};
Projapi.Controller._indexedRemove=function(_55,_56,_57){
var _58,i,vec=[],obj,_5c,_5d,i2;
if(arguments.length==1){
if(this._indexed[_55._objectName]){
obj=this._indexed[_55._objectName]._reverse;
for(_5c in obj){
if(!{}[_5c]){
_58=obj[_5c];
for(i=0;i<_58.length;i++){
vec.push(_58[i]);
_5d=this._indexed[_58[i]._sourceObject._objectName][_5c];
for(i2=0;i2<_5d.length;i2++){
if(_5d[i2]==_58[i]){
_5d.splice(i2,1);
break;
}
}
_58.splice(i,1);
}
}
}
obj=this._indexed[_55._objectName];
for(_5c in obj){
if(!{}[_5c]){
_58=obj[_5c];
for(i=0;i<_58.length;i++){
vec.push(_58[i]);
_5d=this._indexed[_58[i]._sourceObject._objectName][_5c];
for(i2=0;i2<_5d.length;i2++){
if(_5d[i2]==_58[i]){
_5d.splice(i2,1);
break;
}
}
_58.splice(i,1);
}
}
}
}else{
if((_58=this._indexed[_55._objectName])&&(_58=_58[_56])){
for(i=0;i<_58.length;i++){
if(_58[i].equals(_55,_56,_57)){
_5d=this._indexed[_57._objectName]._reverse[_56];
for(i2=0;i2<_5d.length;i2++){
if(_5d[i2]==_58[i]){
_5d.splice(i2,1);
break;
}
}
vec=_58.splice(i,1);
break;
}
}
}
}
}
if(vec.length==0&&arguments.length>1){
console.warn("IndexedRemove did not find anything to remove: %s %s %s",_55,_56,_57);
}
return vec;
};
Projapi.Controller._indexedRemoveLink=function(_5f,_60,_61){
var _62=[],i,i1,i2,_66,_67;
for(i in Projapi.Links[_60]){
if(typeof Projapi.Links[_60][i]=="string"&&Projapi.Links[_60][i]!=_60){
_62.push(Projapi.Links[_60][i]);
}
}
for(i=0;i<_62.length;i++){
if((_66=this._indexed[_5f._objectName])&&(_66=_66[_62[i]])){
for(i1=0;i1<_66.length;i1++){
if(_66[i1].equals(_5f,_60,_61)){
_67=this._indexed[_61._objectName]._reverse[_62[i]];
for(i2=0;i2<_67.length;i2++){
if(_67[i2]==_66[i]){
_67.splice(i2,1);
break;
}
}
_66.splice(i1,1);
break;
}
}
}
}
};
Projapi.Controller.subscribe=function(_68,_69,_6a,_6b){
var _6c,_6d=null,_6e=null,_6f,_70=0,_71;
var _72=(typeof _6a=="string"&&_6a.indexOf("/")!=-1);
if(typeof _68=="string"){
if(Projapi.Register.contains(_68)){
_68=Projapi.Register.get(_68);
}else{
console.debug("Time out for %o",_68);
setTimeout(Projapi.Controller.subscribe.bind(this,_68,_69,_6a,_6b),100);
return;
}
}
if(!_72&&typeof _6a=="string"){
if(Projapi.Register.contains(_6a)){
_6a=Projapi.Register.get(_6a);
}else{
console.debug("Time out for %o",_6a);
setTimeout(Projapi.Controller.subscribe.bind(this,_68,_69,_6a,_6b),100);
return;
}
}
if(typeof _69=="string"){
if(Projapi.Links[_69]){
this._subscribeLink(_68,Projapi.Links[_69],_6a);
}else{
if(_72){
this._indexedAdd(_68,_69,_6a,new Projapi.Controller.Item(_68,null,_69,_6a,_6b));
}else{
this._subscribeEvent(_68,_69,_6a);
}
}
}else{
if(typeof _69=="object"&&_69["LinkName"]){
this._subscribeLink(_68,_69,_6a);
}else{
throw new Error("Unsupported event type ("+typeof _69+") in Projapi.Controller.subscribe!");
}
}
};
Projapi.Controller._subscribeEvent=function(_73,_74,_75){
var _76=null,_77=null;
_76=_74==Projapi.Links.Container.CreateObjects?this._getSetterName(_75,"Container",true):this._getSetterName(_75,_74,true);
if(_76){
_76.call(_75,_73);
}
_targetSetterFunc=_74==Projapi.Links.Container.CreateObjects?this._getSetterName(_73,"Container",false):this._getSetterName(_73,_74,false);
if(_targetSetterFunc){
_targetSetterFunc.call(_73,_75);
}
this._indexedAdd(_73,_74,_75,new Projapi.Controller.Item(_73,null,_74,_75));
};
Projapi.Controller._subscribeLink=function(_78,_79,_7a,_7b){
var _7c,_7d=null,_7e=null,_7f,_80=0,_81,_82=null,_83=null;
_7c=_79.LinkName;
if(_7a[_7c+"SourceEvents"]){
_7d=_7a[_7c+"SourceEvents"];
}
if(_78[_7c+"TargetEvents"]){
_7e=_78[_7c+"TargetEvents"];
}
_82=this._getSetterName(_7a,_7c,true);
if(_82){
_82.call(_7a,_78);
}
_targetSetterFunc=this._getSetterName(_78,_7c,false);
if(_targetSetterFunc){
_targetSetterFunc.call(_78,_7a);
}
if(_7d&&_7d instanceof Array){
for(_80=0,_81=_7d.length;_80<_81;_80++){
_7f=_7d[_80];
this._indexedAdd(_78,_7f,_7a,new Projapi.Controller.Item(_78,_7c,_7f,_7a));
}
}
if(_7e&&_7e instanceof Array){
for(_80=0,_81=_7e.length;_80<_81;_80++){
_7f=_7e[_80];
this._indexedAdd(_7a,_7f,_78,new Projapi.Controller.Item(_7a,_7c,_7f,_78));
}
}
};
Projapi.Controller._getSetterName=function(_84,_85,_86){
var _87=_85+(_86&&"Source"||"Target");
return _84["set"+_87]||_84["add"+_87]||null;
};
Projapi.Controller.deregister=function(_88,_89,_8a){
var _8b;
if(typeof _89=="string"){
if(Projapi.Links[_89]){
this._deregisterLink(_88,_89,_8a);
}else{
_8b=this._indexedRemove(_88,_89,_8a);
for(var i=0;i<_8b.length;i++){
this._removeEventObjects(_8b[i]._targetObject,_8b[i]._event,true,_8b[i]._sourceObject);
this._removeEventObjects(_8b[i]._sourceObject,_8b[i]._event,false,_8b[i]._targetObject);
}
}
}else{
if(typeof _89=="object"&&_89["LinkName"]){
this._deregisterLink(_88,_89.LinkName,_8a);
}else{
if(typeof _89=="undefined"){
_8b=this._indexedRemove(_88);
for(var i=0;i<_8b.length;i++){
this._removeEventObjects(_8b[i]._targetObject,_8b[i]._link||_8b[i]._event,true,_8b[i]._sourceObject);
this._removeEventObjects(_8b[i]._sourceObject,_8b[i]._link||_8b[i]._event,false,_8b[i]._targetObject);
}
}
}
}
};
Projapi.Controller._deregisterLink=function(_8d,_8e,_8f){
this._removeEventObjects(_8f,_8e,true,_8d);
this._removeEventObjects(_8d,_8e,false,_8f);
this._indexedRemoveLink(_8d,_8e,_8f);
};
Projapi.Controller._removeEventObjects=function(_90,_91,_92,_93){
var _94=_92?"Source":"Target",_95;
if(_91==Projapi.Links.Container.CreateObjects){
_91=Projapi.Links.Container.LinkName;
}
_95=_90["set"+_91+_94];
if(_95&&typeof _95=="function"){
_95.call(_90,null);
return;
}
_95=_90["remove"+_91+_94];
if(_95&&typeof _95=="function"){
_95.call(_90,_93);
return;
}
};
Projapi.Controller.publish=function(_96,_97){
if(typeof _97=="undefined"){
throw new Error("Undefined event published by "+_96.getObjectName());
}
var lst=this._indexedFind(_96,_97);
if(lst.length){
lst=lst.clone();
var _99=[];
for(var i=2;i<arguments.length;i++){
_99.push(arguments[i]);
}
for(var i=0;i<lst.length;i++){
lst[i].invoke(_99);
}
}
};
Projapi.Controller.executeOnInit=function(_9b,_9c){
if(!this._executeOnInit[_9b]){
this._executeOnInit[_9b]=[];
}
this._executeOnInit[_9b].push(_9c);
};
Projapi.Controller.objectInit=function(_9d){
var _9e,_9f,_a0,_a1;
_a1=this._executeOnInit[_9d.getObjectName()];
if(_a1){
var _fu=function(_a3){
eval(_a3);
};
for(_9e=0,_9f=_a1.length;_9e<_9f;_9e++){
_a0=_a1[_9e];
if(typeof _a0=="string"){
_fu.call(_9d,_a0);
}
if(typeof _a0=="function"){
_a0.bind(_9d)();
}
}
delete this._executeOnInit[_9d.getObjectName()];
}
};
Projapi.Controller._remotePublish=function(_a4){
var _a5="",_a6;
var _a7=["sourceObject=",_a4._sourceObject.getObjectName(),"&link=",(_a4._link?_a4._link.LinkName:""),"&event=",(_a4._event?_a4._event:"")];
if(_a4._properties){
for(_a6 in _a4._properties){
_a7.push("&"+_a6+"=");
_a7.push(encodeURIComponent(_a4._properties[_a6]));
}
}
new Projapi.Request(_a4._targetObject,{method:"post",postBody:_a7.join(""),asynchronous:true,onComplete:Projapi.Controller._remoteResponse});
};
Projapi.Controller._remoteResponse=function(_a8){
if(!_a8||_a8.status!=200){
return;
}
eval(_a8.responseText);
};
Projapi.Controller.Item=function(_a9,_aa,_ab,_ac,_ad){
this._sourceObject=_a9;
this._link=_aa;
this._event=_ab;
this._targetObject=_ac;
this._serverAction=typeof this._targetObject=="string"&&this._targetObject.indexOf("/")>-1;
this._properties=_ad;
};
Projapi.Controller.Item.prototype.invoke=function(_ae){
var _af=this._targetObject[this._event];
if(!this._serverAction){
if(_af&&typeof _af=="function"){
_af.apply(this._targetObject,_ae);
}
}else{
Projapi.Controller._remotePublish(this);
}
};
Projapi.Controller.Item.prototype.equals=function(_b0,_b1,_b2){
if(typeof _b2!="undefined"&&_b2!=null){
return this._sourceObject==_b0&&(this._link==_b1||this._event==_b1)&&this._targetObject==_b2;
}else{
return this._sourceObject==_b0&&this._event==_b1;
}
};
Projapi.Controller.Item.prototype.toString=function(){
var s=[this._sourceObject._objectName," -> ",this._targetObject._objectName];
if(this._event){
s.push(" [");
s.push(this._event);
s.push("]");
}
if(this._link){
s.push(" (");
s.push(this._link);
s.push(")");
}
return s.join("");
};
Projapi.FocusManager={focusedWindow:null,prevFocusedWindow:null,focusedObject:null,setFocusedObject:function(_b4){
this.focusedObject=_b4.getObjectName();
if(_b4.getWindowName&&this.focusedWindow&&_b4.getWindowName()!=this.focusedWindow.getWindowName()){
if(this.focusedWindow){
this.focusedWindow.applyEntry();
}else{
this.setFocusedWindow(_b4.getWindowName());
}
}else{
if(this.focusedWindow&&_b4){
this.focusedWindow._lastFocusedObject=_b4;
}
}
},getFocusedObject:function(){
return this.focusedObject;
},setFocusedWindow:function(_b5){
if(_b5!=null&&typeof _b5=="string"){
_b5=Projapi.Register.get(_b5);
}
if(_b5){
this.prevFocusedWindow=this.focusedWindow;
}else{
if(this.prevFocusedWindow&&this.prevFocusedWindow._lastFocusedObject){
this.focusedWindow=this.prevFocusedWindow;
_b5=this.prevFocusedWindow;
this.prevFocusedWindow._lastFocusedObject.applyEntry();
}
}
this.focusedWindow=_b5;
},getFocusedWindow:function(){
return this.focusedWindow;
},applyEntry:function(_b6,_b7){
if(typeof _b7=="undefined"||_b7===0){
if(typeof _b6=="string"){
_b6=Projapi.Register.get(_b6);
}
if(_b6){
_b6.applyEntry();
}
}else{
setTimeout("Projapi.FocusManager.applyEntry('"+_b6+"')",_b7);
}
}};
(function(){
var _b8=alert;
window.alert=function(){
var obj=Projapi.Util.$(Projapi.FocusManager.focusedObject);
obj.blur();
_b8.apply(null,$A(arguments));
obj.focus();
};
})();
if(typeof Projapi=="undefined"){
var Projapi={};
}
if(typeof Projapi.Base=="undefined"){
Projapi.Base={};
}
Projapi.extend=function(_ba,_bb,_bc){
var _bd=function(){
};
_bd.prototype=_bb.prototype;
_ba.prototype=new _bd();
_ba.prototype.constructor=_ba;
_ba.superclass=_bb.prototype;
if(_bb.prototype.constructor==Object.prototype.constructor){
_bb.prototype.constructor=_bb;
}
if(_bc){
for(var _be in _bc){
_ba.prototype[_be]=_bc[_be];
}
}
};
Projapi.Base.iPJSmartObject=function(_bf,_c0){
this._objectName=_bf;
this._objectCreated=false;
this._objectInitialized=false;
this._objectType="SmartObject";
this._objectHidden=true;
this._objectEnabled=true;
this._properties=_c0||{};
this._objectPage=parseInt(this._properties.objectPage||0);
this._containerSource=null;
this.ContainerSourceEvents=Projapi.Links.Container.SourceEvents;
this._messageBundle={};
this._hasFocus=false;
this._canFocus=false;
this._windowName=null;
Projapi.Register.add(this);
};
Projapi.Base.iPJSmartObject.prototype.setContainerSource=function(_c1){
this._containerSource=_c1;
};
Projapi.Base.iPJSmartObject.prototype.getContainerSource=function(){
return this._containerSource;
};
Projapi.Base.iPJSmartObject.prototype.getWindowName=function(){
return this._windowName;
};
Projapi.Base.iPJSmartObject.prototype.createObjects=function(){
};
Projapi.Base.iPJSmartObject.prototype.initializeObject=function(){
};
Projapi.Base.iPJSmartObject.prototype.publish=function(_c2){
var _c3=[this],idx=0,_c5=arguments.length;
for(idx;idx<_c5;idx++){
_c3.push(arguments[idx]);
}
Projapi.Controller.publish.apply(Projapi.Controller,_c3);
};
Projapi.Base.iPJSmartObject.prototype.hideObject=function(){
};
Projapi.Base.iPJSmartObject.prototype.viewObject=function(){
};
Projapi.Base.iPJSmartObject.prototype.enableObject=function(){
Projapi.Util.Trigger(this,"onEnableObject");
if(this._properties.disable){
return;
}
this._objectEnabled=true;
};
Projapi.Base.iPJSmartObject.prototype.disableObject=function(){
Projapi.Util.Trigger(this,"onDisableObject");
this._objectEnabled=false;
};
Projapi.Base.iPJSmartObject.prototype.isObjectEnabled=function(){
return this._objectEnabled;
};
Projapi.Base.iPJSmartObject.prototype.confirmExit=function(){
return false;
};
Projapi.Base.iPJSmartObject.prototype.confirmCancel=function(){
return true;
};
Projapi.Base.iPJSmartObject.prototype.confirmOk=function(){
return true;
};
Projapi.Base.iPJSmartObject.prototype.isObjectCreated=function(){
return this._objectCreated;
};
Projapi.Base.iPJSmartObject.prototype.isObjectInitialized=function(){
return this._objectInitialized;
};
Projapi.Base.iPJSmartObject.prototype.applyEntry=function(){
};
Projapi.Base.iPJSmartObject.prototype.canFocus=function(){
return this._canFocus;
};
Projapi.Base.iPJSmartObject.prototype.hasFocus=function(){
return this._hasFocus;
};
Projapi.Base.iPJSmartObject.prototype.destroyObject=function(){
try{
Projapi.Util.Trigger(this,"onDestroy");
}
catch(e){
console.error("Error in onDestroy handler of %o: %o",this,e);
}
Projapi.Register.remove(this);
Projapi.Controller.deregister(this);
Projapi.Util.removeObserver(this);
};
Projapi.Base.iPJSmartObject.prototype.getObjectPage=function(){
return this._objectPage;
};
Projapi.Base.iPJSmartObject.prototype.exitObject=function(){
};
Projapi.Base.iPJSmartObject.prototype.addLink=function(_c6,_c7){
Projapi.Controller.subscribe(this,_c6,_c7);
};
Projapi.Base.iPJSmartObject.prototype.removeLink=function(_c8,_c9){
Projapi.Controller.deregister(this,_c8,_c9);
};
Projapi.Base.iPJSmartObject.prototype.changeCursor=function(_ca){
};
Projapi.Base.iPJSmartObject.prototype.getObjectName=function(){
return this._objectName;
};
Projapi.Base.iPJSmartObject.prototype.setObjectName=function(_cb){
this._objectName=_cb;
};
Projapi.Base.iPJSmartObject.prototype._processObjectProperties=function(){
if(this._properties.messageBundle){
this.setMessageBundle(this._properties.messageBundle);
}
};
Projapi.Base.iPJSmartObject.prototype._processVisualObjectProperties=function(){
if(this._properties.disableOnInit){
this.disableObject();
}
if(this._properties.hotkey){
this.setHotkey(this._properties.hotkey);
}
};
Projapi.Base.iPJSmartObject.prototype.getProperties=function(){
return this._properties||{};
};
Projapi.Base.iPJSmartObject.prototype.getProperty=function(_cc,_cd,_ce){
var val;
if(!(_ce||false)){
var _d0="get"+_cc.charAt(0).toUpperCase()+_cc.substring(1);
if(this[_d0]&&typeof (val=this[_d0]())!=undefined){
return val;
}
}
if(typeof this._properties[_cc]=="undefined"){
if(typeof _cd==undefined){
return null;
}else{
return _cd;
}
}
return this._properties[_cc];
};
Projapi.Base.iPJSmartObject.prototype.setProperty=function(_d1,_d2,_d3){
_d3=_d3||false;
var _d4="set"+_d1.charAt(0).toUpperCase()+_d1.substring(1);
if(!_d3&&this[_d4]){
this[_d4](_d2);
}else{
this._properties[_d1]=_d2;
}
};
Projapi.Base.iPJSmartObject.prototype.getObjectType=function(){
return this._objectType;
};
Projapi.Base.iPJSmartObject.prototype.getMessageBundle=function(){
return this._messageBundle;
};
Projapi.Base.iPJSmartObject.prototype.setMessageBundle=function(_d5){
if(typeof _d5=="undefined"){
_d5={};
}
this._messageBundle=_d5;
};
Projapi.Base.iPJSmartObject.prototype.getMessage=function(_d6){
if(this._messageBundle[_d6]){
return this._messageBundle[_d6];
}else{
if(this._containerSource&&this._containerSource.getMessage(_d6)!==_d6){
return this._containerSource.getMessage(_d6);
}else{
if(this._staticMessageBundle&&this._staticMessageBundle[_d6]){
return this._staticMessageBundle[_d6];
}
}
}
return _d6;
};
Projapi.Base.iPJSmartObject.prototype._propagateWindowName=function(){
if(!this.getContainerTarget){
return;
}
var arr=this.getContainerTarget();
if(!(arr instanceof Array)){
arr=[arr];
}
for(var i=0;i<arr.length;i++){
if(arr[i]&&arr[i]._objectType!="SmartWindow"){
arr[i]._windowName=this._windowName;
arr[i]._propagateWindowName();
}
}
};
Projapi.Base.iPJVisualObject=function(_d9,_da){
Projapi.Base.iPJVisualObject.superclass.constructor.call(this,_d9,_da);
this._objectValue=null;
this._displayMode="";
this._domNode=null;
};
Projapi.extend(Projapi.Base.iPJVisualObject,Projapi.Base.iPJSmartObject);
Projapi.Base.iPJVisualObject.prototype.createObjects=function(){
this._objectCreated=true;
};
Projapi.Base.iPJVisualObject.prototype.destroyObject=function(){
var _db=this.getDOMNode();
if(_db&&_db.domNode&&_db.domNode.parentNode){
_db.domNode.parentNode.removeChild(_db.domNode);
}
if(this._domNode){
this._domNode=null;
}
Projapi.Base.iPJVisualObject.superclass.destroyObject.call(this);
};
Projapi.Base.iPJVisualObject.prototype.hideObject=function(){
if(this._objectHidden){
return;
}
Projapi.Util.Trigger(this,"onHideObject");
var _dc=this._containerSource;
var _dd;
if((_dd=this._domNode)&&(!_dc||(!_dc._objectHidden&&(typeof _dc._currentPage=="undefined"||_dc._currentPage==this._objectPage))||!_dc._domNode)){
if(_dd instanceof Projapi.UI.Element){
_dd.domNode.style.display="none";
}else{
_dd.style.display="none";
}
}
this._objectHidden=true;
};
Projapi.Base.iPJVisualObject.prototype.viewObject=function(){
if(this._properties.hide||!this._objectHidden){
return;
}
Projapi.Util.Trigger(this,"onViewObject");
var _de=this._domNode;
if(_de){
if(_de instanceof Projapi.UI.Element){
_de.domNode.style.display=this._displayMode;
}else{
_de.style.display=this._displayMode;
}
}
this._objectHidden=false;
};
Projapi.Base.iPJVisualObject.prototype.setHide=function(_df){
if(this._properties.hide==_df){
return;
}
this._properties.hide=_df;
if(this._objectInitialized){
if(_df&&!this._objectHidden){
this.hideObject();
}else{
if(!_df&&this._objectHidde){
this.viewObject();
}
}
}
};
Projapi.Base.iPJVisualObject.prototype.isObjectHidden=function(){
return this._objectHidden;
};
Projapi.Base.iPJVisualObject.prototype.getObjectValue=function(){
return this._objectValue;
};
Projapi.Base.iPJVisualObject.prototype.resize=function(){
};
Projapi.Base.iPJVisualObject.prototype.setObjectValue=function(_e0){
this._objectValue=_e0;
};
Projapi.Base.iPJVisualObject.prototype.setDOMNode=function(_e1){
var _e2;
this._domNode=_e1;
if(_e2=this._properties["class"]){
this._domNode.domNode.className+=" "+_e2;
}
if(!(_e1 instanceof Projapi.UI.Element)){
console.log("setDOMNode called with HTMLElement, not UI.Element. I am %o",this);
}
};
Projapi.Base.iPJVisualObject.prototype.getDOMNode=function(){
return this._domNode;
};
Projapi.Base.iPJVisualObject.prototype.getTooltip=function(){
return (this._properties.tooltip||this._properties.label||"")+(this._properties.hotkey?(" - "+this._properties.hotkey):"");
};
Projapi.Base.iPJVisualObject.prototype.setTooltip=function(_e3){
this._properties.tooltip=_e3;
if(this._objectInitialized&&this._domNode){
this._domNode.domNode.title=_e3;
}
};
Projapi.Base.iPJVisualObject.prototype.getHotkey=function(){
if(this._properties.hotkey){
return this._properties.hotkey;
}
return null;
};
Projapi.Base.iPJVisualObject.prototype.setHotkey=function(_e4){
var _e5=this.click||this.applyEntry||Prototype.EmptyFunction;
if(_e5==Prototype.EmptyFunction){
if(this._actions){
_e5=this._actions.click||this._actions.onClick||Prototype.EmptyFunction;
if(_e5!=Prototype.EmptyFunction){
_e5=_e5.bind(this);
}
}
}else{
_e5=_e5.bind(this);
}
this._properties.hotkey=Projapi.Hotkeys.addAccessKey(this,_e4,_e5,"",null);
return this._properties.hotkey;
};
Projapi.Base.iPJVisualObject.prototype.setHotkeyAction=function(_e6){
this._properties.hotkey.action=_e6||Prototype.EmptyFunction;
return this._properties.hotkey;
};
Projapi.Base.iPJVisualObject.prototype.setHotkeyDescription=function(_e7){
this._properties.hotkey.description=_e7||"";
return this._properties.hotkey;
};
Projapi.Base.iPJVisualObject.prototype.setHotkeyReadableKey=function(_e8){
this._properties.hotkey.readableKey=_e8||null;
return this._properties.hotkey;
};
if(typeof Projapi=="undefined"){
var Projapi={};
}
(function(){
var _e9=0;
Projapi.UI={GenerateId:function(_ea){
_ea=_ea||"pjagid_";
_e9++;
return _ea+_e9;
}};
})();
Projapi.UI.BlockElements=/^(?:address|blockquote|center|dir|div|dl|fieldset|form|h\d|hr|isindex|menu|ol|ul|p|pre|table|dd|dt|li|tbody|tr|td|thead|tfoot|iframe)$/i;
Projapi.UI.Borders={l:"border-left-width",r:"border-right-width",t:"border-top-width",b:"border-bottom-width"};
Projapi.UI.Paddings={l:"padding-left",r:"padding-right",t:"padding-top",b:"padding-bottom"};
Projapi.UI.Margins={l:"margin-left",r:"margin-right",t:"margin-top",b:"margin-bottom"};
Projapi.UI.PropertyCache=[];
Projapi.UI.CreateFormElement=function(_eb,_ec,_ed){
var _ee,_ef=document.createElement("DIV");
_ee="<"+_eb;
if(typeof _ed=="string"){
_ee+=" type=\""+_ed+"\"";
}
_ee+=" name=\""+_ec+"\"></"+_eb+">";
_ef.innerHTML=_ee;
return _ef.firstChild;
};
Projapi.UI.ConvertToCamel=function(_f0){
if(_f0.indexOf("-")<0){
return _f0;
}
if(Projapi.UI.PropertyCache[_f0]){
return Projapi.UI.PropertyCache[_f0];
}
var m,_f2=_f0;
while(m=Projapi.UI.ConvertToCamel.rx.exec(_f0)){
_f0=_f0.replace(m[1],Projapi.UI.ConvertToCamel.chr[m[1][1]]);
}
Projapi.UI.PropertyCache[_f2]=_f0;
return _f0;
};
Projapi.UI.ConvertToCamel.rx=/(-[a-z])/i;
Projapi.UI.ConvertToCamel.chr={};
(function(){
var _f3="a".charCodeAt(0),_f4="A".charCodeAt(0),to1="z".charCodeAt(0);
for(i=0;_f3+i<=to1;i++){
Projapi.UI.ConvertToCamel.chr[String.fromCharCode(_f3+i)]=String.fromCharCode(_f4+i);
}
})();
Projapi.UI.GetStyle=function(_f6,_f7){
if(typeof _f6=="string"){
_f6=document.getElementById(_f6);
}
var _f8=null;
if(_f6.currentStyle){
_f8=_f6.currentStyle[Projapi.UI.ConvertToCamel(_f7)];
}else{
if(document.defaultView&&document.defaultView.getComputedStyle){
_f8=document.defaultView.getComputedStyle(_f6,null).getPropertyValue(_f7);
}
}
return _f8;
};
Projapi.UI.SetStyle=function(_f9,_fa,_fb){
if(typeof _f9=="string"){
_f9=document.getElementById(_f9);
}
_f9.style[Projapi.UI.ConvertToCamel(_fa)]=_fb;
};
Projapi.UI.GetElementsBy=function(_fc,_fd,_fe){
_fd=_fd||"*";
_fe=$(_fe)||document;
var _ff=[];
var _100=_fe.getElementsByTagName(_fd);
var _idx,_102;
if(!_100.length&&(_fd=="*"&&_fe.all)){
_100=_fe.all;
}
for(_idx=0,_102=_100.length;_idx<_102;++idx){
if(_fc(_100[_idx])){
_ff.push(_100[_idx]);
}
}
return _ff;
};
Projapi.UI.GetViewportHeight=function(){
if(self.innerHeight){
return self.innerHeight;
}
return (document.compatMode=="CSS1Compat")?document.documentElement.clientHeight:document.body.clientHeight;
};
Projapi.UI.GetViewportWidth=function(){
if(self.innerWidth){
return self.innerWidth;
}
return (document.compatMode=="CSS1Compat")?document.documentElement.clientWidth:document.body.clientWidth;
};
Projapi.UI.CreateNode=function(_103){
if(!_103){
return null;
}
var _104=document.createElement(_103.tag),k;
if(_103.id){
_104.id=_103.id;
}
if(_103.className){
_104.className=_103.className;
}
if(_103.style){
for(k in _103.style){
_104.style[k]=_103.style[k];
}
}
return _104;
};
Projapi.UI.CreateNodeElement=function(_106){
return Projapi.UI.Element.get(Projapi.UI.CreateNode(_106));
};
Projapi.UI.Element=function(_107){
this.domNode=typeof _107=="string"?document.getElementById(_107):_107;
this.domNode.Element=this;
this.initialDisplay=this.domNode.style.display=="none"?"":this.domNode.style.display;
};
Projapi.UI.Element.get=function(_108){
if(!_108){
return null;
}
var node;
if(_108 instanceof Projapi.UI.Element){
return _108;
}else{
if(typeof _108=="string"){
if(node=$(_108)){
return node.Element||new Projapi.UI.Element(node);
}else{
return null;
}
}else{
return _108.Element||new Projapi.UI.Element(_108);
}
}
};
Projapi.UI.Element.DOMfromString=function(str){
Projapi.UI.Element.fromString.tmpNode.innerHTML=str;
return Projapi.UI.Element.fromString.tmpNode.firstChild;
};
Projapi.UI.Element.fromString=function(str){
Projapi.UI.Element.fromString.tmpNode.innerHTML=str;
var node=Projapi.UI.Element.fromString.tmpNode.firstChild;
Projapi.UI.Element.fromString.tmpNode.removeChild(node);
return new Projapi.UI.Element(node);
};
Projapi.UI.Element.fromString.tmpNode=document.createElement("div");
Projapi.UI.Element.fromTemplate=function(_10d,_10e){
var str=_10d,m,idx=0;
while(m=str.match(/{([0-9a-zA-Z_]+)}/)){
str=str.replace(m[0],_10e[m[1]]||_10e[idx]);
idx++;
}
return Projapi.UI.Element.fromString(str);
};
Projapi.UI.Element.prototype.getStyle=function(name){
return Projapi.UI.GetStyle(this.domNode,name);
};
Projapi.UI.Element.prototype.setStyle=function(name,_114){
Projapi.UI.SetStyle(this.domNode,name,_114);
};
Projapi.UI.Element.prototype.sumStylesValue=function(_115,_116){
var _117=0,_val=0;
for(var i=0,len=_115.length;i<len;i++){
_val=parseInt(this.getStyle(_116[_115.charAt(i)]),10);
if(!isNaN(_val)){
_117+=_val;
}
}
return _117;
};
Projapi.UI.Element.prototype.getBorderWidth=function(side){
return this.sumStylesValue(side,Projapi.UI.Borders);
};
Projapi.UI.Element.prototype.getPadding=function(side){
return this.sumStylesValue(side,Projapi.UI.Paddings);
};
Projapi.UI.Element.prototype.getMargins=function(side){
if(!side){
return {top:parseInt(this.getStyle("margin-top"),10)||0,left:parseInt(this.getStyle("margin-left"),10)||0,bottom:parseInt(this.getStyle("margin-bottom"),10)||0,right:parseInt(this.getStyle("margin-right"),10)||0};
}else{
return this.sumStylesValue(side,Projapi.UI.Margins);
}
};
Projapi.UI.Element.prototype.getHeight=function(_11e){
var h=this.domNode.offsetHeight;
return _11e!==true?h:h-this.getBorderWidth("tb")-this.getPadding("tb");
};
Projapi.UI.Element.prototype.getWidth=function(_120){
var w=this.domNode.offsetWidth;
return _120!==true?w:w-this.getBorderWidth("lr")-this.getPadding("lr");
};
Projapi.UI.Element.prototype.setWidth=function(_122){
if(typeof _122!="number"){
return;
}
_122-=(this.getBorderWidth("lr")+this.getPadding("lr"));
if(_122<0){
_122=0;
}
this.setStyle("width",""+_122+"px");
};
Projapi.UI.Element.prototype.setHeight=function(_123){
if(typeof _123!="number"){
return;
}
_123-=(this.getBorderWidth("tb")+this.getPadding("tb"));
if(_123<0){
_123=0;
}
this.setStyle("height",""+_123+"px");
};
Projapi.UI.Element.prototype.setX=function(x){
if(typeof x!="number"){
return;
}
this.setStyle("left",""+x+"px");
};
Projapi.UI.Element.prototype.setY=function(y){
if(typeof y!="number"){
return;
}
this.setStyle("top",""+y+"px");
};
Projapi.UI.Element.prototype.getChildsByTagName=function(_126){
var _127=this.domNode.getElementsByTagName(_126);
var _len=_127.length;
var _129=new Array(_len);
for(var idx=0;idx<_len;idx++){
_129[idx]=Projapi.UI.Element.get(_127[idx]);
}
return _129;
};
Projapi.UI.Element.prototype.getChilsdByClassName=function(_12b,_12c){
var _12d=function(elem){
return Element.hasClassName(elem,_12b);
};
var _12f=Projapi.UI.GetElementsBy(_12d,_12c,this.domNode);
var _idx,_131=_12f.length;
var _132=new Array(_131);
for(_idx=0;_idx<_131;_idx++){
_132[_idx]=Projapi.UI.Element.get(_childrs[_idx]);
}
return _132;
};
Projapi.UI.Element.prototype.isDisplayed=function(){
return Projapi.UI.GetStyle(this.domNode,"display")!="none";
};
Projapi.UI.Element.prototype.setDisplayed=function(_133){
_133=String(_133);
this.domNode.style.display=_133=="true"?this.initialDisplay:_133=="false"?"none":_133;
};
Projapi.UI.Element.prototype.setAttribute=function(_134,_135){
if(this.domNode.getAttributeNode(_134)){
this.domNode.getAttributeNode(_134).value=_135;
}else{
var attr=document.createAttribute(_134);
attr.value=_135;
this.domNode.setAttributeNode(attr);
}
};
Projapi.UI.Element.prototype.removeChildrens=function(){
var _idx,_len,_139=this.domNode.childNodes;
for(_idx=0,_len=_139.length;_idx<_len;_idx++){
this.domNode.removeChild(_139[_idx]);
}
};
Projapi.UI.Element.prototype.addClassName=function(_13a){
if(!this.hasClassName(_13a)){
this.domNode.className+=" "+_13a;
}
};
Projapi.UI.Element.prototype.removeClassName=function(_13b){
this.domNode.className=this.domNode.className.replace(new RegExp("\\b"+_13b+"\\b","g"),"");
};
Projapi.UI.Element.prototype.hasClassName=function(_13c){
return !!this.domNode.className.match(new RegExp("\\b"+String(_13c)+"\\b"));
};
Projapi.UI.Border={NONE:"NONE",RAISED:"RAISED",SUNKEN:"SUNKEN",RIDGE:"RIDGE",GROOVE:"GROOVE",SHADOW:"SHADOW",SOLID:"SOLID",DrawBorder:function(_13d,_13e,_13f,_140){
if(!_13d||_13d.length<3){
return;
}
_13f=_13f||Projapi.Theme.BorderColor;
_140=typeof _140=="undefined"?1:_140;
switch(_13e.toUpperCase()){
case Projapi.UI.Border.NONE:
_13d[0].domNode.style.border="none";
_13d[1].domNode.style.border="none";
_13d[2].domNode.style.border="none";
break;
case Projapi.UI.Border.RAISED:
_13d[0].domNode.style.border="none";
_13d[1].domNode.style.border="1px solid";
_13d[1].domNode.style.borderColor=Projapi.Theme.BorderHighlight+Projapi.Theme.BorderShadow+" "+Projapi.Theme.BorderShadow+" "+Projapi.Theme.BorderHighlight;
_13d[2].domNode.style.border="none";
break;
case Projapi.UI.Border.SUNKEN:
_13d[0].domNode.style.border="none";
_13d[1].domNode.style.border="1px solid";
_13d[1].domNode.style.borderColor=Projapi.Theme.BorderShadow+" "+Projapi.Theme.BorderHighlight+" "+Projapi.Theme.BorderHighlight+" "+Projapi.Theme.BorderShadow;
_13d[2].domNode.style.border="none";
break;
case Projapi.UI.Border.RIDGE:
_13d[0].domNode.style.border="1px solid";
_13d[0].domNode.style.borderColor=Projapi.Theme.BorderHighlight+" "+Projapi.Theme.BorderShadow+" "+Projapi.Theme.BorderShadow+" "+Projapi.Theme.BorderHighlight;
_13d[1].domNode.style.border="1px solid";
_13d[1].domNode.style.borderColor=Projapi.Theme.BorderHighlight+" "+Projapi.Theme.BorderShadow+" "+Projapi.Theme.BorderShadow+" "+Projapi.Theme.BorderHighlight;
_13d[2].domNode.style.border="1px solid";
_13d[2].domNode.style.borderColor=Projapi.Theme.BorderShadow+" "+Projapi.Theme.BorderHighlight+" "+Projapi.Theme.BorderHighlight+" "+Projapi.Theme.BorderShadow;
break;
case Projapi.UI.Border.GROOVE:
_13d[0].domNode.style.border="1px solid";
_13d[0].domNode.style.borderColor=Projapi.Theme.BorderShadow+" "+Projapi.Theme.BorderHighlight+" "+Projapi.Theme.BorderHighlight+" "+Projapi.Theme.BorderShadow;
_13d[1].domNode.style.border="1px solid";
_13d[1].domNode.style.borderColor=Projapi.Theme.BorderHighlight+" "+Projapi.Theme.BorderShadow+" "+Projapi.Theme.BorderShadow+" "+Projapi.Theme.BorderHighlight;
_13d[2].domNode.style.border="none";
break;
case Projapi.UI.Border.SHADOW:
_13d[0].domNode.style.border="1px solid";
_13d[0].domNode.style.borderTop="none";
_13d[0].domNode.style.borderLeft="none";
_13d[0].domNode.style.borderColor="transparent #E3E3DF #E3E3DF transparent";
_13d[1].domNode.style.border="1px solid";
_13d[1].domNode.style.borderColor="#A5ACB2 #D0CEBF #D0CEBF #A5ACB2";
_13d[2].domNode.style.border="1px solid";
_13d[2].domNode.style.borderColor="#FCFCFE #A5ACB2 #A5ACB2 #FCFCFE";
break;
case Projapi.UI.Border.SOLID:
_13d[0].domNode.style.border="none";
_13d[1].domNode.style.border=_140+"px solid "+_13f;
_13d[2].domNode.style.border="none";
break;
}
}};
if(!Projapi){
var Projapi={};
}
if(!Projapi.Util){
Projapi.Util={};
}
Projapi.Util.WeekdayTrigger=function(_141,_142){
Projapi.Util.WeekdayTrigger.superclass.constructor.call(this,_141,_142);
this._actionSources=[];
this._actionTargets=[];
this.ActionSourceEvents=[Projapi.Links.Action.ValueChanged];
this._messageBundle={"weekdays":"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday"};
this._weekDays=null;
};
Projapi.extend(Projapi.Util.WeekdayTrigger,Projapi.Base.iPJSmartObject);
Projapi.Util.WeekdayTrigger.prototype.valueChanged=function(_fld,_144){
if(this._weekDays==null){
this._weekDays=this.getMessage("weekdays").split(",");
}
if(!this._weekDays||this._weekDays.length!=7){
return;
}
var res=Projapi.Util.GetDateValue(_fld);
if(res&&res.date&&this._weekDays[res.date.getDay()]){
res=this._weekDays[res.date.getDay()];
}else{
res="";
}
this.publish(Projapi.Links.Action.ValueChanged,this,res);
};
Projapi.Util.WeekdayTrigger.prototype.getActionSource=function(){
return this._actionSources;
};
Projapi.Util.WeekdayTrigger.prototype.addActionSource=function(_146){
this._actionSources.push(_146);
};
Projapi.Util.WeekdayTrigger.prototype.removeActionSource=function(_147){
var i=0;
while((this._actionTargets[i]!=null)&&(this._actionTargets[i]!=_147)){
++i;
}
this._actionTargets.splice(i,1);
};
Projapi.Util.WeekdayTrigger.prototype.getActionTarget=function(){
return this._actionTargets;
};
Projapi.Util.WeekdayTrigger.prototype.addActionTarget=function(_149){
this._actionTargets.push(_149);
};
Projapi.Util.WeekdayTrigger.prototype.removeActionTarget=function(_14a){
var i=0;
while((this._actionTargets[i]!=null)&&(this._actionTargets[i]!=_14a)){
++i;
}
this._actionTargets.splice(i,1);
};
Projapi.Util.FillWithObject=function(_14c,_14d){
var _14e=_14c;
for(var _14f in _14d){
var _150="{"+_14f+"}";
var _151=0;
var _152=_14e.indexOf(_150,_151);
while(_152!=-1){
_14e=_14e.substring(0,_152)+_14d[_14f]+_14e.substring(_152+_150.length,_14e.length);
_151=_152+_14d[_14f].length;
_152=_14e.indexOf(_150,_151);
}
}
return _14e;
};
Projapi.Util.FillWithArray=function(_153,_154){
var _155=_153;
var _idx=0,_157=_154.length;
for(;_idx<_157;++_idx){
var _158="{"+_idx.toString()+"}";
var _159=0;
var _15a=_155.indexOf(_158,_159);
while(_15a!=-1){
_155=_155.substring(0,_15a)+_154[_idx]+_155.substring(_15a+_158.length,_155.length);
_159=_15a+_154[_idx].length;
_15a=_155.indexOf(_158,_159);
}
}
return _155;
};
Projapi.Util.EvalUrl=function(url,_15c,_15d,_15e,_15f){
var obj;
if(typeof _15f=="string"&&(obj=$P(_15f))){
obj.viewObject();
return;
}
var node=$("_pjxTmpEvalUrl");
if(!node){
node=document.body.appendChild(Projapi.UI.Element.DOMfromString("<div id=\"_pjxTmpEvalUrl\" style=\"display:none\"> </div>"));
}else{
node.innerHTML="";
}
var _162=false;
var req={url:url};
if(!_15d){
_162=true;
_15d=function(){
Projapi.Util.EvalUrl.ReqInProgress.splice(Projapi.Util.EvalUrl.ReqInProgress.indexOf(req),1);
};
}
if(Projapi.Util.EvalUrl.ReqInProgress.pluck("url").indexOf(url)==-1){
var _164=_15d;
if(typeof _15e!="undefined"&&_15e){
_164=function(_165){
Projapi.Util.BlockWindow(document.body,3);
try{
_15d();
}
catch(e){
console.error("Exception while executing EvalUrl callback: %o",e);
}
Projapi.Util.EvalUrl.lastReqHiding=req;
setTimeout(function(){
if(Projapi.Util.EvalUrl.lastReqHiding!=req){
return;
}
Projapi.Util.ClearWindow(document.body);
},100);
};
Projapi.Util.BlockWindow(document.body,2);
}
req.updater=new Projapi.Request.Updater(node,url,{method:"get",parameters:_15c,asynchronous:true,evalScripts:true,onComplete:_164});
}
if(_162){
Projapi.Util.EvalUrl.ReqInProgress.push(req);
}
};
Projapi.Util.EvalUrl.lastReqHiding=null;
Projapi.Util.EvalUrl.ReqInProgress=[];
Projapi.Util.BlockWindow=function(wnd,_167,_168,_169){
if(wnd._domNode){
wnd=wnd._domNode;
}
if(wnd.domNode){
wnd=wnd.domNode;
}
if(!_167){
_167=1;
}
var node,i;
if(!_168&&_167>1){
for(i=0;i<Projapi.Util.BlockWindow.blocked.length;i++){
if(Projapi.Util.BlockWindow.blocked[i].wnd==wnd&&parseInt(Projapi.Util.BlockWindow.blocked[i].node.className.match(/\bloading(\d)\b/)[1])<_167){
node=Projapi.Util.BlockWindow.blocked[i].node;
}
}
}
if(node){
node.className=node.className.replace(/loading\d/,"loading"+_167);
}else{
var pos=Position.page(wnd);
var _16d;
if(_169){
_16d=_169;
}else{
var tmp=wnd;
while(!tmp.className.match(/\bdialog\b/)&&tmp!=document.body&&tmp.parentNode){
tmp=tmp.parentNode;
}
if(tmp.style.zIndex){
_16d=parseInt(tmp.style.zIndex)+1;
}else{
_16d=10000;
}
}
node=document.body.appendChild(document.createElement("div"));
node.style.position="absolute";
node.className="overlay_"+(Projapi.Theme.WindowClassName||"alphacube")+" loading"+_167;
node.style.left=pos[0]+"px";
node.style.top=pos[1]+"px";
node.style.height=wnd.offsetHeight+"px";
node.style.width=wnd.offsetWidth+"px";
node.style.zIndex=_16d;
Projapi.Util.BlockWindow.blocked.push({wnd:wnd,node:node});
}
};
Projapi.Util.BlockWindow.blocked=[];
Projapi.Util.ClearWindow=function(wnd){
if(wnd._domNode){
wnd=wnd._domNode;
}
if(wnd.domNode){
wnd=wnd.domNode;
}
var node,i,_172=false;
for(i=Projapi.Util.BlockWindow.blocked.length-1;i>=0;i--){
if(Projapi.Util.BlockWindow.blocked[i].wnd==wnd){
node=Projapi.Util.BlockWindow.blocked[i].node;
node.parentNode.removeChild(node);
Projapi.Util.BlockWindow.blocked.splice(i,1);
_172=true;
break;
}
}
if(!_172){
console.warn("Projapi.Util.ClearWindow called but no overlay was found. Element is %o",wnd);
}
};
Projapi.Util.Serialize=function(_173){
if(!_173){
return "";
}
var _174,_175=[];
for(_174 in _173){
if(!(_173[_174] instanceof Function)){
_175.push(encodeURIComponent(_174)+"="+encodeURIComponent(_173[_174]));
}
}
return _175.join("&");
};
Projapi.Util.Trigger=function(_176,_177,_178){
var _179=false;
if(!_176||!_177){
console.error("Projapi.Util.Trigger called but no smart object instance or event passed.");
return;
}
var args,val=_176._properties[_177+"Eval"];
if(val){
try{
Projapi.Util.EvalUrl(val);
}
catch(e){
console.error(e);
}
}
val=_176._properties[_177+"Execute"];
if(val){
try{
if(eval(val)){
_179=true;
}
}
catch(e){
console.error(e);
}
}
val=_176._properties[_177+"Publish"];
if(val){
try{
_args=[val];
if(_178){
_args.concat(_178);
}
_176.publish.apply(_176,_args);
}
catch(e){
console.error(e);
}
}
return _179;
};
Projapi.Profiler={contexts:{},contextsArr:[],inProgress:[],totalTime:0,Start:function(_17c){
if(!this.contexts[_17c]){
this.contexts[_17c]={calls:0,minTime:9999999,maxTime:0,totalTime:0,minDes:"",maxDes:"",ownMinTime:9999999,ownMaxTime:0,ownTotalTime:0,name:_17c};
this.contextsArr.push(this.contexts[_17c]);
}
this.contexts[_17c].calls++;
this.inProgress.push([_17c,lastEntry=new Date().getTime(),0]);
if(this.tracing.length>0){
this.tracing.push({name:_17c,flow:[]});
this.tracing[this.tracing.length-2].flow.push(this.tracing[this.tracing.length-1]);
}
},Stop:function(_17d,_des){
var _ctx=this.contexts[_17d];
var idx=this.inProgress.length-1;
while(idx>-1&&this.inProgress[idx][0]!=_17d){
idx--;
}
if(idx==-1){
console.error("Profiler.Stop called but there was no previous Profiler.Start call for this context: "+_17d);
return;
}
if(idx<this.inProgress.length-1){
var _181=[];
while(idx<this.inProgress.length-1){
_181.push(this.inProgress.last()[0]);
this.inProgress.pop();
}
console.warn("Profiler.Stop was not called for the contexts: "+_181.reverse().join(", ")+". Parent context: "+_17d);
}
var _len=new Date().getTime()-this.inProgress[this.inProgress.length-1][1];
var _183=_len-this.inProgress[this.inProgress.length-1][2];
this.inProgress.pop();
if(this.inProgress.length>0){
this.inProgress[this.inProgress.length-1][2]+=_len;
}
if(_len<_ctx.minTime){
_ctx.minTime=_len;
_ctx.minDes=_des;
}
if(_len>_ctx.maxTime){
_ctx.maxTime=_len;
_ctx.maxDes=_des;
}
_ctx.totalTime+=_len;
if(_183<_ctx.ownMinTime){
_ctx.ownMinTime=_183;
}
if(_183>_ctx.ownMaxTime){
_ctx.ownMaxTime=_183;
}
_ctx.ownTotalTime+=_183;
this.totalTime+=_183;
if(this.tracing.length>0){
idx=this.tracing.length-1;
while(idx>=0&&this.tracing[idx].name!=_17d){
idx--;
}
if(idx<0){
console.log("Unable to find and end trace structure for \""+_17d+"\".");
return;
}
while(this.tracing.length>idx+1){
console.log("Trace structure for \""+this.tracing[this.tracing.length-1].name+"\" was not closed properly.");
this.tracing.pop();
}
this.tracing[idx].ownTime=_183;
this.tracing[idx].totalTime=_len;
this.tracing.pop();
}
},Show:function(){
var _184,_ctx,_res=[],_val;
for(_184 in this.contexts){
_ctx=this.contexts[_184];
_val=[_184,_ctx.calls,_ctx.totalTime,_ctx.minTime,_ctx.maxTime,(_ctx.totalTime/_ctx.calls),_ctx.minDes,_ctx.maxDes].join(",");
}
},Reset:function(){
this.contexts={};
this.contextsArr=[];
this.inProgress=[];
this.totalTime=0;
},Top:function(_188,_189){
if(typeof _188=="number"&&typeof _189=="undefined"){
_189=_188;
_188=null;
}
if(typeof _188=="undefined"||!_188){
_188="ownTotalTime";
}
if(typeof _189=="undefined"){
_189=0;
}
this.contextsArr.sort(function(a,b){
return b[_188]-a[_188];
});
var i,_18d={name:"Total",calls:0,ownTotalTime:0,ownMinTime:"",ownMaxTime:"",totalTime:this.totalTime,minTime:"",maxTime:""};
this._printHeader(_188,_189);
if(!_189){
for(i=0;i<this.contextsArr.length;i++){
if(this.contextsArr[i][_188]>0){
this.Print(this.contextsArr[i],_18d);
}
}
}else{
for(i=0;i<_189&&i<this.contextsArr.length;i++){
this.Print(this.contextsArr[i],_18d);
}
}
this.Print(_18d);
return null;
},_printHeader:function(_18e,_18f){
var _190=function(str,_192){
var x=_192-String(str).length;
if(!x){
return String(str);
}
return "<span>"+(new Array(x+1)).join("&nbsp;")+String(str)+"</span>";
};
var _194=function(str,_196){
var x=_196-String(str).length;
if(!x){
return String(str);
}
return "<span>"+String(str)+(new Array(x+1)).join("&nbsp;")+"</span>";
};
var _198=_194("Name",40)+_190("Calls",10)+_190("Percent",10)+_190("Own Total Time",18)+_190("Total Time",18)+_190("Own Min Time",18)+_190("Own Max Time",18)+_190("Min Time",18)+_190("Max Time",18);
sortStr="Sorting by calls/ownTotalTime/totalTime/ownMinTime/ownMaxTime/minTime/maxTime.";
sortStr=sortStr.replace(_18e,"<span style=\"font-weight: bold\">"+_18e+"</span>");
_18e=_18e.charAt(0).toUpperCase()+_18e.substr(1).replace(/[A-Z]/g," $&");
if(_18e=="Name"){
_198=_198.replace(/^Name /,"Name*");
}else{
_198=_198.replace(" "+_18e,_18e+"*");
}
console.log(" %o",{toString:function(){
return "</span><span class=\"logRow\">"+sortStr;
}});
console.log(" %o",{toString:function(){
return "</span><span class=\"logRow-command\">"+_198;
}});
},Print:function(name,_19a){
var obj;
if(typeof name=="string"){
obj=this.contexts[name];
}else{
obj=name;
}
var _19c=function(str,_19e){
var x=_19e-String(str).length;
if(!x){
return String(str);
}
return "<span>"+(new Array(x+1)).join("&nbsp;")+String(str)+"</span>";
};
var _1a0=function(str,_1a2){
var x=_1a2-String(str).length;
if(!x){
return String(str);
}
return "<span>"+String(str)+(new Array(x+1)).join("&nbsp;")+"</span>";
};
var _1a4=function(_1a5){
var m=String(_1a5).match(/\d+(\.(\d\d?)?)?/);
if(m[1].length>=3){
return m[0];
}else{
if(m[1].length==2){
return m[0]+"0";
}else{
if(m[1].length==1){
return m[0]+"00";
}else{
return m[0]+".00";
}
}
}
};
if(_19a){
_19a.calls+=obj.calls;
_19a.ownTotalTime+=obj.ownTotalTime;
}
console.log(" %o",{toString:function(){
return "</span><span class=\"logRow-command\">"+_1a0(obj.name,40)+"<span class=\"objectBox-number\">"+_19c(obj.calls,10)+_19c(_1a4(obj.ownTotalTime*100/Projapi.Profiler.totalTime)+"%",10)+_19c(obj.ownTotalTime,18)+_19c(obj.totalTime,18)+_19c(obj.ownMinTime,18)+_19c(obj.ownMaxTime,18)+_19c(obj.minTime,18)+_19c(obj.maxTime,18)+"</span>";
}});
},tracing:[],Trace:function(name){
this.tracing.push({name:name,flow:[],begin:new Date()});
if(this.tracing.length>1){
this.tracing[this.tracing.length-2].flow.push(this.tracing[this.tracing.length-1]);
}
},tracedOnce:[],TraceOnce:function(name){
if(this.tracedOnce.indexOf(name)>-1){
return;
}
this.tracedOnce.push(name);
this.Trace(name);
},EndTrace:function(name){
var i=this.tracing.length-1,j,t=new Date();
while(i>=0&&this.tracing[i].name!=name){
i--;
}
if(i<0){
console.error("Unable to end trace because no such trace is active. Name: "+name);
return;
}
while(i<this.tracing.length-1){
console.warn("Trace \""+this.tracing[this.tracing.length-1].name+"\" not closed, but parent \""+name+"\" has ended.");
this.tracing.pop();
}
this.tracing[i].ownTime=this.tracing[i].totalTime=t-this.tracing[i].begin;
for(j=0;j<this.tracing[i].length;j++){
this.tracing[i].ownTime-=this.tracing[i].flow[j].totalTime;
}
this.PrintTrace(this.tracing[i]);
this.tracing.pop();
},EndTraceOnce:function(name){
var i=this.tracing.length-1,j,t=new Date();
while(i>=0&&this.tracing[i].name!=name){
i--;
}
if(i>=0){
this.EndTrace(name);
}
},PrintTrace:function(_1b1){
if(_1b1.flow.length==0){
console.log(_1b1.name+" ( own: "+_1b1.ownTime+"ms, total: "+_1b1.totalTime+"ms ) - No activity to profile");
return;
}
console.group(_1b1.name+" ( own: "+_1b1.ownTime+"ms, total: "+_1b1.totalTime+"ms ) ");
for(var i=0;i<_1b1.flow.length;i++){
this.PrintTrace(_1b1.flow[i]);
}
console.groupEnd();
}};
Projapi.Calendars={calendars:[],create:function(_1b3,_1b4,_1b5,_1b6){
var _1b7;
if(_1b6=="dmy"){
_1b7=_1b5.replace(/99(.)99(.)/,"%d$1%m$2");
}else{
if(_1b6!="mdy"){
throw "Projapi.Calendars.create - unknown dateFormat: "+_1b6;
}
_1b7=_1b5.replace(/99(.)99(.)/,"%m$1%d$2");
}
_1b7=_1b7.replace(/9999/,"%Y");
_1b7=_1b7.replace(/99/,"%y");
var cal=Calendar.setup({inputField:_1b3,button:_1b4,firstDay:1,ifFormat:_1b7});
this.calendars.push(cal);
},getCalendar:function(id){
return this.calendars.detect(function(d){
return d.inputField==id;
});
}};
Projapi.Util.SetTheme=function(_1bb){
var _1bc=$("skinJS");
var _1bd=$("skinCSS");
var _1be=$("appCSS");
var _1bf=Projapi.Globals&&Projapi.Globals.DEP_PATH?Projapi.Globals.DEP_PATH:"";
if(_1bf.charAt(_1bf.length)!="/"){
_1bf+="/";
}
_1bf+="templates/"+_1bb;
if(_1bd){
var par=_1bd.parentNode;
par.removeChild(_1bd);
_1bd=document.createElement("LINK");
_1bd.type="text/css";
_1bd.id="skinCSS";
_1bd.media="all";
_1bd.rel="stylesheet";
_1bd.href=_1bf+"/css/pjdefault.css";
par.appendChild(_1bd);
}
if(_1bc){
var par=_1bc.parentNode;
par.removeChild(_1bc);
_1bc=document.createElement("SCRIPT");
_1bc.type="text/javascript";
_1bc.id="skinJS";
_1bc.src=_1bf+"/js/pjtheme.js";
par.appendChild(_1bc);
}
if(_1be){
var par=_1be.parentNode;
var _1c1=_1be.href;
par.removeChild(_1be);
_1bd=document.createElement("LINK");
_1bd.type="text/css";
_1bd.id="appCSS";
_1bd.media="all";
_1bd.rel="stylesheet";
_1bd.href=_1c1;
par.appendChild(_1bd);
}
};
Projapi.Util.SetSkin=function(_1c2,_1c3){
var _1c4=$("skinJS");
if(typeof _1c2!="undefined"&&$("skinCSS")){
$("skinCSS").href=_1c2;
}
if(typeof _1c3!="undefined"&&_1c4){
var par=_1c4.parentNode;
par.removeChild(_1c4);
_1c4=document.createElement("SCRIPT");
_1c4.type="text/javascript";
_1c4.id="skinJS";
_1c4.src=_1c3;
par.appendChild(_1c4);
}
};
Projapi.Util.BrowserInfo={};
Projapi.Util.BrowserInfo.name=BrowserDetect.browser;
Projapi.Util.BrowserInfo._engines={Explorer:"Trident",Firefox:"Mozilla",iCab:"iCab",Konqueror:"KHTML",Mozilla:"Mozilla",Netscape:"Mozilla",Opera:"Presto",Safari:"KHTML"};
Projapi.Util.BrowserInfo.engine=Projapi.Util.BrowserInfo._engines[Projapi.Util.BrowserInfo.name]||"unknown";
Projapi.Util.GetNumericValue=function(fld,_1c7){
var obj=(typeof fld=="object")?fld:Projapi.Register.get(fld);
_1c7=(typeof _1c7!="undefined")?_1c7:Projapi.Globals.LOCALE_NUM_FORMAT;
var val=obj.getObjectValue();
if(_1c7=="European"){
val=val.replace(".","");
val=val.replace(",",".");
}
val=parseFloat(val);
if(isNaN(val)){
val=0;
}
return val;
};
Projapi.Util.GetDateValue=function(fld,mask,_1cc){
var obj=(typeof fld=="object")?fld:Projapi.Register.get(fld);
mask=(typeof mask!="undefined")?mask:obj.getProperty("mask","99-99-9999",true);
_1cc=(typeof _1cc!="undefined")?_1cc:obj.getProperty("dateFormat",Projapi.Globals.LOCALE_DATE_FORMAT,true);
var res={year:"",month:"",day:"",date:null};
var val=obj.getObjectValue();
var _1d0=mask.split(/[9]+/);
if(_1d0[0].length==0){
_1d0.splice(0,1);
}
var _1d1=mask.split(_1d0[0]);
_1d1[_1cc.indexOf("d")]=_1d1[_1cc.indexOf("d")].replace(/9/g,"d");
_1d1[_1cc.indexOf("m")]=_1d1[_1cc.indexOf("m")].replace(/9/g,"m");
_1d1[_1cc.indexOf("y")]=_1d1[_1cc.indexOf("y")].replace(/9/g,"y");
mask=_1d1[0]+_1d0[0]+_1d1[1]+_1d0[0]+_1d1[2];
for(var idx=0,len=mask.length;idx<len;idx++){
switch(mask.charAt(idx)){
case "d":
res.day+=val.charAt(idx);
break;
case "m":
res.month+=val.charAt(idx);
break;
case "y":
res.year+=val.charAt(idx);
break;
}
}
res.day=parseInt(res.day,10);
res.month=parseInt(res.month,10);
res.year=parseInt(res.year,10);
res.date=new Date(res.year,res.month-1,res.day);
return res;
};
Projapi.Util.ConvertToMap=function(_1d4){
var res={},_1d6,_1d7,key,val;
if(!_1d4){
return res;
}
_1d6=_1d4.split(",");
for(var idx=0,len=_1d6.length;idx<len;idx++){
_1d7=_1d6[idx].split(":");
key=_1d7[0].strip();
if(_1d7.length>1){
val=_1d7[1].strip();
}else{
val=null;
}
if(key==""){
key=val;
}
if(key!=null){
res[key]=val;
}
}
return res;
};
Projapi.Util.PrintDispositionTrigger=function(_1dc,_1dd){
this._sourceObject=typeof (_1dc)=="object"?_1dc:Projapi.Register.get(_1dc);
this._targetObject=typeof (_1dd)=="object"?_1dd:Projapi.Register.get(_1dd);
this._mediaMap=["PDF","HTML","XLS","DOC","PPT","PS"];
this._browserMap={"default":[null,null,null,null,null,null],"Trident":[null,null,null,null,null,"attachment"],"Mozilla":[null,null,"attachment","attachment","attachment","attachment"],"Presto":[null,null,"attachment","attachment","attachment","attachment"],"KHTML":[null,null,"attachment","attachment","attachment","attachment"]};
console.log("Source object value %s",this._sourceObject.getObjectValue());
if(this._sourceObject.getObjectValue()){
var idx=this._mediaMap.indexOf(this._sourceObject.getObjectValue());
if(idx>=0){
if(typeof (this._browserMap[Projapi.Util.BrowserInfo.engine])!="undefined"){
var res=this._browserMap[Projapi.Util.BrowserInfo.engine][idx];
console.log("Media %s, browser %s, result %s",this._sourceObject.getObjectValue(),Projapi.Util.BrowserInfo.engine,res);
if(res!=null){
this._targetObject.setObjectValue(res);
this._targetObject.disableObject();
}else{
this._targetObject.setObjectValue("inline");
this._targetObject.enableObject();
}
}else{
var res=this._browserMap["default"][idx];
if(res!=null){
this._targetObject.setObjectValue(res);
this._targetObject.disableObject();
}else{
this._targetObject.setObjectValue("inline");
this._targetObject.enableObject();
}
}
}
}
};
Projapi.Util.MessageBox=function(_1e0,_1e1,_1e2,_1e3){
if(arguments.length<3){
throw new Error("Projapi.Util.MessageBox() requires at least three parameters!");
}
if(arguments.length<4){
_1e3=_1e0;
}
if(_1e1.length==0){
_1e1=["Ok"];
}
var win;
if(Projapi.Util.MessageBox.avail.length){
win=Projapi.Util.MessageBox.avail[0];
Projapi.Util.MessageBox.avail.splice(0,1);
}else{
var _1e5="_generated_MessageBox_",i=0;
while($P(_1e5+i)){
i++;
}
var win=new Projapi.Widgets.PJSmartWindow(_1e5+i,{title:_1e3,closable:false,closeOnOK:false,closeOnCancel:false,hideOnInit:true,hideOnClose:true,layout:"LineLayout",layoutTableRows:2,layoutCellSpacing:0,minimizable:false,width:300,height:100,windowType:"internal"});
win.textBlock=new Projapi.Widgets.PJHTMLBlock(_1e5+i+"_block",{layoutRow:0});
win.buttons=[];
win.addLink(Projapi.Links.Container.CreateObjects,win.textBlock);
win.createObjects();
win.initializeObject();
}
while(win.buttons.length>_1e1.length){
win.buttons[win.buttons.length-1].destroyObject();
win.buttons.splice(win.buttons.length-1,1);
}
win.callback=_1e2;
for(var i=0;i<win.buttons.length;i++){
win.buttons[i].setLabel(_1e1[i]);
}
while(win.buttons.length<_1e1.length){
win.buttons.push(new Projapi.Widgets.PJButton(win._objectName+"_button"+win.buttons.length,{layoutRow:1,label:String(_1e1[win.buttons.length]),onClickExecute:function(){
win.hideObject();
Projapi.Util.MessageBox.avail.push(win);
win.callback(win.buttons.indexOf(this));
}}));
win.addLink(Projapi.Links.Container.CreateObjects,win.buttons[win.buttons.length-1]);
if(win.buttons.length==1){
win.buttons[0].getDOMNode().domNode.parentNode.style.textAlign="center";
}
}
win.textBlock.setContent(_1e0);
win._internalWindow.setTitle(_1e3);
win.viewObject();
};
Projapi.Util.MessageBox.avail=[];
Projapi.Util.Extend=function(_1e7,_1e8){
var f=function(){
};
f.prototype=_1e8;
var obj=new f();
for(var name in _1e7){
if(_1e7.hasOwnProperty(name)){
obj[name]=_1e7[name];
}
}
return obj;
};
Projapi.Util.bindAsEventListener=function(){
var _1ec=this,args=arguments,_1ee=args[0];
return function(_1ef){
args[0]=_1ef||window.event;
return _1ec.apply(_1ee,args);
};
};
Function.prototype.bindAsEventListener=Projapi.Util.bindAsEventListener;
Projapi.Util.$=function(){
if(arguments.length==1){
return typeof arguments[0]=="string"?document.getElementById(arguments[0]):arguments[0];
}else{
var vec=[];
for(var i=0;i<arguments.length;i++){
vec.push(typeof arguments[i]=="string"?document.getElementById(arguments[i]):arguments[i]);
}
return vec;
}
};
Projapi.Util.disableResize=function(){
Projapi.Util.noresize=true;
document.body.onresize=function(){
};
};
Projapi.Util.getEventHandler=function(name){
var _1f3=name+"_h";
if(!Projapi.Util.getEventHandler.cache[name]){
Projapi.Util.getEventHandler.cache[name]=function(_1f4){
if(name=="onresize"&&Projapi.Util.noresize){
return;
}
var i,ev=_1f4||window.event||{type:name,target:this};
var val=null;
Projapi.Util._stopEvent=false;
var arr=this[_1f3].concat([]);
for(i=0;i<arr.length;i++){
val=arr[i].call(this,ev);
if(Projapi.Util._stopEvent){
break;
}
}
return val;
};
}
return Projapi.Util.getEventHandler.cache[name];
};
Projapi.Util.getEventHandler.cache={};
Projapi.Util._observe=function(_1f9,name,_1fb,_1fc,_1fd){
var prop="on"+name,_1ff=prop+"_h";
if(_1fd){
if(!Projapi.Util.observe.map[_1fd._objectName]){
Projapi.Util.observe.map[_1fd._objectName]=[];
}
Projapi.Util.observe.map[_1fd._objectName].push([_1f9,name,_1fb]);
}
if(!_1f9[_1ff]){
if(_1f9[prop]){
_1f9[_1ff]=[_1f9[prop]];
}else{
_1f9[_1ff]=[];
}
_1f9[prop]=Projapi.Util.getEventHandler(prop);
}
_1f9[_1ff].push(_1fb);
};
Projapi.Util._stopObserving=function(_200,name,_202){
var _203="on"+name+"_h",idx;
if(_200[_203]&&((idx=_200[_203].indexOf(_202))>-1)){
if(_200[_203].length>1){
_200[_203].splice(idx,1);
}else{
_200[_203]=null;
_200["on"+name]=null;
}
}
};
Projapi.Util.stopEvent=function(ev){
Projapi.Util._stopEvent=true;
if(ev.preventDefault){
ev.preventDefault();
ev.stopPropagation();
}else{
ev.returnValue=false;
ev.cancelBubble=true;
}
};
Projapi.Util.removeObserver=function(_206){
var v=Projapi.Util.observe.map[_206._objectName];
if(v){
for(var i=0;i<v.length;i++){
Projapi.Util.stopObserving.apply(this,v[i]);
}
delete Projapi.Util.observe.map[_206._objectName];
}
};
Projapi.Util.observe=function(_209,name,_20b){
if(Prototype.Browser.WebKit){
var _20c=Projapi.Util.getEventHandler("onmousedown");
Projapi.Util.getEventHandler.cache.onmousedown=function(evt){
if(evt!=Event.lastClickEvt){
Event.lastClickEvt=evt;
Event.lastClickedNode=Event.element(evt);
}
_20c.call(this,evt);
};
document.observe=(Element.observe=Element.Methods.observe=Event.observe=Projapi.Util.observe=function(el,name,h){
if(name=="keypress"){
name="keydown";
}
if(name=="keydown"&&!el.onkeydown_h&&!el.onmousedown_h){
Event.observe(el,"mousedown",function(){
});
}
Projapi.Util._observe(el,name,h);
}).methodize();
document.stopObserving=(Element.stopObserving=Element.Methods.stopObserving=Event.stopObserving=Projapi.Util.stopObserving=function(el,name,h){
if(name=="keypress"){
name="keydown";
}
Projapi.Util._stopObserving(el,name,h);
}).methodize();
Event.observe(document.body,"keydown",function(evt){
var node=Event.lastClickedNode||null;
var evnt={target:Event.lastClickedNode,__proto__:evt};
while(node&&node!=document.body){
if(node.onkeydown){
node.onkeydown(evnt);
}
if(Projapi.Util._stopEvent){
break;
}
node=node.parentNode;
}
});
}else{
if(_209.attachEvent){
Event.observe=Projapi.Util.observe=function(el,name,h){
if(name=="keypress"){
name="keydown";
}
Projapi.Util._observe(el,name,h);
};
Event.stopObserving=Projapi.Util.stopObserving=function(el,name,h){
if(name=="keypress"){
name="keydown";
}
Projapi.Util._stopObserving(el,name,h);
};
}else{
Event.observe=Projapi.Util.observe=Projapi.Util._observe;
Event.stopObserving=Projapi.Util.stopObserving=Projapi.Util._stopObserving;
}
}
Projapi.Util.observe.map={};
Projapi.Util.observe(_209,name,_20b);
};
document.observe=(Element.observe=Element.Methods.observe=Event.observe=Projapi.Util.observe).methodize();
Event.stop=Projapi.Util.stopEvent;
if(typeof Projapi=="undefined"){
var Projapi={};
}
if(typeof Projapi.Widgets=="undefined"){
Projapi.Widgets={};
}
Projapi.Widgets.PJWarning=function(_21d,_21e){
this.warningType=isNaN(_21d.type)?Projapi.Widgets.PJWarningManager.TYPE_UNKNOWN:_21d.type;
this.warningColumn=_21d.column;
this.warningObjectName=_21d.objectName;
this.warningMessage=_21d.msg?_21d.msg:" ";
this.window=_21e;
};
Projapi.Widgets.PJWarningManager=function(_21f,_220){
this._items={};
this._widgets={};
};
Projapi.Widgets.PJWarningManager.TYPE_ERROR=0;
Projapi.Widgets.PJWarningManager.TYPE_WARNING=1;
Projapi.Widgets.PJWarningManager.TYPE_INFO=2;
Projapi.Widgets.PJWarningManager.TYPE_DEBUG=3;
Projapi.Widgets.PJWarningManager.TYPE_UNKNOWN=4;
Projapi.Widgets.PJWarningManager.GLOBAL_WARNING="__GLOBAL__";
Projapi.Widgets.PJWarningManager.prototype.addWarning=function(_221){
var _222,_223,_224;
_222=_221.window?_221.window:Projapi.Widgets.PJWarningManager.GLOBAL_WARNING;
if(!this._items[_222]){
this._items[_222]={};
}
_223=_221.warningObjectName?_221.warningObjectName:_221.warningColumn?_221.warningColumn:Projapi.Widgets.PJWarningManager.GLOBAL_WARNING;
if(!this._items[_222][_223]){
this._items[_222][_223]={};
}
if(!this._items[_222][_223][_221.warningType]){
this._items[_222][_223][_221.warningType]=[];
}
this._items[_222][_223][_221.warningType].push(_221);
_224=Projapi.Register.get(_223,_222);
if(_224&&!this._widgets[_224.getObjectName()]){
this._widgets[_224.getObjectName()]={infoWidg:null,infoOver:null,column:_223,window:_222};
}
};
Projapi.Widgets.PJWarningManager.prototype.clearWarnings=function(_225,_226){
_226=typeof (_226)=="undefined"?null:_226;
var _225=this._getWindowName(_225);
var _227,_228,_229,_22a;
if(_226){
if(this._items[_225]&&this._items[_225][_226]){
delete this._items[_225][_226];
}
for(_228 in this._widgets){
_227=this._widgets[_228];
if(_227&&_227.column&&_227.column==_226){
if(_227.infoOver){
this.hideTooltip(_227.column);
_227.infoOver.destroyObject();
}
if(_227.infoWidg){
Event.stopObserving(_227.infoWidg.domNode,"click",this.toogleTooltip);
Event.stopObserving(_227.infoWidg.domNode,"keydown",this.handleKeyEvents);
_227.infoWidg.domNode.parentNode.removeChild(_227.infoWidg.domNode);
}
delete this._widgets[_228];
}
}
}else{
if(this._items[_225]){
delete this._items[_225];
}
for(_228 in this._widgets){
_227=this._widgets[_228];
if(_227&&_227.window&&_227.window==_225){
if(_227.infoOver){
this.hideTooltip(_227.column);
_227.infoOver.destroyObject();
}
if(_227.infoWidg){
Event.stopObserving(_227.infoWidg.domNode,"click",this.toogleTooltip);
Event.stopObserving(_227.infoWidg.domNode,"keydown",this.handleKeyEvents);
if(_227.infoWidg.domNode.parentNode){
_227.infoWidg.domNode.parentNode.removeChild(_227.infoWidg.domNode);
}
}
delete this._widgets[_228];
}
}
}
};
Projapi.Widgets.PJWarningManager.prototype.getWindowWarnings=function(_22b){
_22b=this._getWindowName(_22b);
var _22c=_22b?_22b:"__GLOBAL__";
if(this._items[_22c]){
return this._items[_22c];
}else{
return null;
}
};
Projapi.Widgets.PJWarningManager.prototype.getColumnWarnings=function(_22d,_22e){
var _22f=_22e?_22e:"__GLOBAL__";
var _230=this.getWindowWarnings(_22d);
if(_230&&_230[_22f]){
return _230[_22f];
}else{
return null;
}
};
Projapi.Widgets.PJWarningManager.prototype.hasMessageType=function(_231,_232,_233){
var _234,_235;
_233=typeof (_233)=="undefined"?null:_233;
_232=typeof (_232=="object")?this._getWindowName(_232):_232;
_231=_231?_231:0;
if(_233){
_234=this.getColumnWarnings(_232,_233);
return (_234&&_234[_231]&&_234[_231].length>0);
}else{
_234=this.getWindowWarnings(_232);
for(_235 in _234){
if(_234&&_234[_235][_231]&&_234[_235][_231].length>0){
return true;
}
}
}
return false;
};
Projapi.Widgets.PJWarningManager.prototype.hasMessage=function(_236,_237){
return (this.hasMessageType(Projapi.Widgets.PJWarningManager.TYPE_ERROR,_236,_237)||this.hasMessageType(Projapi.Widgets.PJWarningManager.TYPE_WARNING,_236,_237)||this.hasMessageType(Projapi.Widgets.PJWarningManager.TYPE_INFO,_236,_237));
};
Projapi.Widgets.PJWarningManager.prototype.isSuccess=function(_238,_239){
return !this.hasMessageType(Projapi.Widgets.PJWarningManager.TYPE_ERROR,_238,_239);
};
Projapi.Widgets.PJWarningManager.prototype.hasError=function(_23a,_23b){
return this.hasMessageType(Projapi.Widgets.PJWarningManager.TYPE_ERROR,_23a,_23b);
};
Projapi.Widgets.PJWarningManager.prototype.hasWarning=function(_23c,_23d){
return this.hasMessageType(Projapi.Widgets.PJWarningManager.TYPE_WARNING,_23c,_23d);
};
Projapi.Widgets.PJWarningManager.prototype.hasInfo=function(_23e,_23f){
return this.hasMessageType(Projapi.Widgets.PJWarningManager.TYPE_INFO,_23e,_23f);
};
Projapi.Widgets.PJWarningManager.prototype.hasDebug=function(_240,_241){
return this.hasMessageType(Projapi.Widgets.PJWarningManager.TYPE_DEBUG,_240,_241);
};
Projapi.Widgets.PJWarningManager.prototype.process=function(_242,_243){
if(typeof (_242)!="object"||!(_242 instanceof Array)){
console.warn("Got into warning process but exiting typeof _messages is %o",_242);
return;
}
var _idx=0,_len=_242.length,_246,_itm;
_243=this._getWindowName(_243);
for(;_idx<_len;_idx++){
_246=_242[_idx];
_itm=new Projapi.Widgets.PJWarning(_246,_243);
this.addWarning(_itm);
}
};
Projapi.Widgets.PJWarningManager.prototype.toogleTooltip=function(_248){
if(typeof _248=="string"||_248 instanceof Projapi.Base.iPJSmartObject){
var _249=null;
if(typeof _248=="object"){
_249=_248;
_248=_249.getObjectName?_249.getObjectName():null;
}else{
_249=Projapi.Register.get(_248);
}
if(!_249||!_249.getObjectName||!this._widgets[_248]){
return;
}
var _24a=this._widgets[_248].infoOver;
if(!_24a||_24a.isObjectHidden()){
this.showTooltip(_249);
}else{
this.hideTooltip(_249);
}
}else{
if(Projapi.FocusManager.focusedWindow){
var _24b=this.getWindowWarnings(Projapi.FocusManager.focusedWindow.getObjectName());
for(var _24c in _24b){
this.toogleTooltip(_24c);
}
}
}
};
Projapi.Widgets.PJWarningManager.prototype.showTooltip=function(_24d){
if(!_24d){
return;
}
var _24e=this._widgets[_24d.getObjectName()].infoOver;
var pos=Position.cumulativeOffset(this._widgets[_24d.getObjectName()].infoWidg.domNode);
if(_24e){
if(_24e.isObjectHidden()){
_24e.getContentDOMNode().domNode.innerHTML=this._getColumnDisplayHTML(_24d.getWindowName(),_24d.getObjectName());
_24e.viewObject();
}
}else{
_24e=new Projapi.Widgets.iPJOverlay(null,{});
_24e.createObjects();
this._widgets[_24d.getObjectName()].infoOver=_24e;
_24e.getContentDOMNode().domNode.innerHTML=this._getColumnDisplayHTML(_24d.getWindowName(),_24d.getObjectName());
_24e.attachTo(this._widgets[_24d.getObjectName()].infoWidg,"RIGHT");
_24e.viewObject();
}
};
Projapi.Widgets.PJWarningManager.prototype.hideTooltip=function(_250){
if(typeof _250=="string"){
_250=Projapi.Register.get(_250);
}
if(!_250){
return;
}
var _251=this._widgets[_250.getObjectName()].infoOver;
if(_251&&!_251.isObjectHidden()){
_251.hideObject();
}
};
Projapi.Widgets.PJWarningManager.prototype.mark=function(_252,_253,_254){
var _255=this._getWindowName(_252);
var _256,_257;
_254=true;
if(typeof _253=="unknown"){
_253=null;
}
if(typeof _254=="unknown"){
_254=false;
}
if(_253){
if(this.hasMessage(_255,_253)){
this._markObject(_254==true?Projapi.Register.get(_253):Projapi.Register.getFieldObject(_253,_255));
}
return;
}
if(_255){
if(this.hasMessage(_255)){
_256=this.getWindowWarnings(_255);
for(_257 in _256){
this.mark(_255,_257);
}
if(this.hasMessage(_255,Projapi.Widgets.PJWarningManager.GLOBAL_WARNING)){
this._markWindow(_255);
}
}
}
};
Projapi.Widgets.PJWarningManager.prototype._markWindow=function(_258){
var _259=Projapi.Register.get(_258);
if(!_259||_259.getObjectType()!="SmartWindow"){
return;
}
var _25a=this.getColumnWarnings(_258,Projapi.Widgets.PJWarningManager.GLOBAL_WARNING);
var _25b=[];
var _idx,_len,_25e;
_25e=_25a[Projapi.Widgets.PJWarningManager.TYPE_ERROR];
if(_25e){
for(_idx=0,_len=_25e.length;_idx<_len;_idx++){
_25b.push(_25e[_idx].warningMessage);
}
}
_25e=_25a[Projapi.Widgets.PJWarningManager.TYPE_WARNING];
if(_25e){
for(_idx=0,_len=_25e.length;_idx<_len;_idx++){
_25b.push(_25e[_idx].warningMessage);
}
}
_25e=_25a[Projapi.Widgets.PJWarningManager.TYPE_INFO];
if(_25e){
for(_idx=0,_len=_25e.length;_idx<_len;_idx++){
_25b.push(_25e[_idx].warningMessage);
}
}
alert(_25b.join("\r\n"));
};
Projapi.Widgets.PJWarningManager.prototype._markObject=function(_25f){
if(!_25f||!_25f instanceof Projapi.Base.iPJSmartObject){
return;
}
var _260=_25f.getInfoElement?_25f.getInfoElement():null;
if(!_260){
return;
}
var _261=this._widgets[_25f.getObjectName()].infoWidg;
if(!_261){
var _262=_25f.getDOColumnName();
var _263=_25f.getWindowName();
if(!this.hasMessage(_263,_262)){
_262=_25f.getObjectName();
if(!this.hasMessage(_263,_262)){
return;
}
}
_261=Projapi.UI.CreateNodeElement({tag:"IMG",className:"pjWarnWidg"});
if(this.hasError(_263,_262)){
_261.domNode.src=Projapi.Theme.WarningsImageError;
}else{
if(this.hasWarning(_263,_262)){
_261.domNode.src=Projapi.Theme.WarningsImageWarning;
}else{
if(this.hasInfo(_263,_262)){
_261.domNode.src=Projapi.Theme.WarningsImageInfo;
}
}
}
_261.domNode.alt="";
_261.domNode.tabIndex=0;
Event.observe(_261.domNode,"click",this.toogleTooltip.bind(this,_25f.getObjectName()));
Event.observe(_261.domNode,"keydown",this.handleKeyEvents.bindAsEventListener(this,_25f.getObjectName()));
this._widgets[_25f.getObjectName()].infoWidg=_261;
_260.domNode.appendChild(_261.domNode);
}
if(!_261.isDisplayed()){
_261.setDisplayed(true);
}
};
Projapi.Widgets.PJWarningManager.prototype.handleKeyEvents=function(_264,_265){
if(_264.keyCode==Event.KEY_RETURN||_264.keyCode==32||_264.keyCode==0){
this.toogleTooltip(_265);
}
};
Projapi.Widgets.PJWarningManager.prototype._getColumnDisplayHTML=function(_266,_267){
var _268=this.getColumnWarnings(_266,_267);
var _269=[];
var _idx,_len,_26c;
_26c=_268[Projapi.Widgets.PJWarningManager.TYPE_ERROR];
if(_26c){
for(_idx=0,_len=_26c.length;_idx<_len;_idx++){
_269.push("<div class=\"pjWarnMessError\">"+_26c[_idx].warningMessage+"</div>");
}
}
_26c=_268[Projapi.Widgets.PJWarningManager.TYPE_WARNING];
if(_26c){
for(_idx=0,_len=_26c.length;_idx<_len;_idx++){
_269.push("<div class=\"pjWarnMessWarning\">"+_26c[_idx].warningMessage+"</div>");
}
}
_26c=_268[Projapi.Widgets.PJWarningManager.TYPE_INFO];
if(_26c){
for(_idx=0,_len=_26c.length;_idx<_len;_idx++){
_269.push("<div class=\"pjWarnMessInfo\">"+_26c[_idx].warningMessage+"</div>");
}
}
return _269.join("");
};
Projapi.Widgets.PJWarningManager.prototype._getWindowName=function(_26d){
if(!_26d){
return null;
}
if(typeof _26d=="string"){
var win=Projapi.Register.get(_26d);
if(!win){
return null;
}
if(win.getObjectType()=="SmartWindow"){
return _26d;
}
var _26f=_26d.getContainerSource();
while(_26f){
if(_26f.getObjectType()=="SmartWindow"){
return _26d;
}
_26f=_26d.getContainerSource();
}
return null;
}
if(typeof _26d=="object"){
if(_26d.getObjectType()=="SmartWindow"){
return _26d.getObjectName();
}
var _26f=_26d.getContainerSource();
while(_26f){
if(_26f.getObjectType()=="SmartWindow"){
return _26f.getObjectName();
}
_26f=_26f.getContainerSource();
}
return null;
}
return null;
};
Projapi.WarningManager=new Projapi.Widgets.PJWarningManager("pjWarningManager");
if(typeof Projapi=="undefined"){
var Projapi={};
}
if(typeof Projapi.Valid=="undefined"){
Projapi.Valid={};
}
Projapi.Valid.Manager=function(){
this._items={};
this._sequence=0;
};
Projapi.Valid.Manager.prototype.add=function(_270){
if(!_270){
return;
}
if(_270.Id==null){
_270.Id="val"+this._sequence++;
}
if(!this._items[_270.RefObjectName]){
this._items[_270.RefObjectName]={};
}
if(!this._items[_270.RefObjectName][_270.TriggerOn]){
this._items[_270.RefObjectName][_270.TriggerOn]=[];
}
this._items[_270.RefObjectName][_270.TriggerOn].push(_270);
};
Projapi.Valid.Manager.prototype.initialize=function(_271){
if(!_271||!this._items[_271]){
return;
}
var prop,idx,len;
for(prop in this._items[_271]){
if(prop instanceof Array&&prop.length>0){
for(idx=0,len=prop.length;idx<len;idx++){
if(prop[idx]&&prop[idx].initialize){
prop[idx].initialize();
}
}
}
}
};
Projapi.Valid.Manager.prototype.run=function(_275,_276){
if(!_275){
return true;
}
if(typeof _275=="object"){
_275=_275.getObjectName();
}
if(typeof _276=="undefined"||_276==null){
_276="GENERIC";
}
if(!this._items[_275]||!this._items[_275][_276]){
return true;
}
var prop=true,idx,len,_27a,_27b;
for(idx=0,len=this._items[_275][_276].length;idx<len;idx++){
_27b=this._items[_275][_276][idx];
_27a=_27b.validate();
if(!_27a&&_27b.stopChain()){
return false;
}
prop=_27a&&prop;
}
return prop;
};
Projapi.Valid.Manager.prototype.get=function(_27c,_27d){
if(!_27c){
return true;
}
if(typeof _27c=="object"){
_27c=_27c.getObjectName();
}
if(typeof _27d=="undefined"||_27d==null){
_27d="GENERIC";
}
if(!this._items[_27c]||!this._items[_27c][_27d]){
return [];
}else{
return this._items[_27c][_27d];
}
};
Projapi.Valid.Manager.prototype.remove=function(_27e,_27f,_280){
if(typeof _280=="undefined"){
_280="GENERIC";
}
if(!_27e||!this._items[_27e]||!this._items[_27e][_280]){
return;
}
for(var idx=0,len=this._items[_27e][_280].length;idx<len;idx++){
if(this._items[_27e][_280][idx]&&this._items[_27e][_280][idx].Id==_27f){
this._items[_27e][_280].splice(idx,1);
return;
}
}
};
Projapi.ValidationManager=new Projapi.Valid.Manager();
Projapi.Valid.AbstractValidator=function(_283,_284){
this._properties=_284;
this.Id=this.getProperty("id",null);
this.RefObjectName=_283||"GENERIC";
this.RefObject=null;
this.TriggerOn=this.getProperty("triggerOn","GENERIC");
this.initialize();
this._stopChain=false;
this._messageStore={0:[],1:[],2:[]};
this._messageBundle={};
};
Projapi.Valid.AbstractValidator.prototype.getProperty=function(_285,_286){
if(typeof _286==undefined){
_286=null;
}
if(!this._properties||typeof this._properties[_285]=="undefined"){
return _286;
}
return this._properties[_285];
};
Projapi.Valid.AbstractValidator.prototype.initialize=function(){
this.RefObject=Projapi.Register.get(this.RefObjectName);
if(this.getProperty("messageBundle",false)){
this._messageBundle=this.getProperty("messageBundle");
}
};
Projapi.Valid.AbstractValidator.prototype.validate=function(){
this.mark();
return this.isValid();
};
Projapi.Valid.AbstractValidator.prototype.isValid=function(){
return !this.hasError();
};
Projapi.Valid.AbstractValidator.prototype.hasError=function(){
return (this._messageStore&&this._messageStore[Projapi.Widgets.PJWarningManager.TYPE_ERROR].length>0);
};
Projapi.Valid.AbstractValidator.prototype.hasWarning=function(){
return (this._messageStore&&this._messageStore[Projapi.Widgets.PJWarningManager.TYPE_WARNING].length>0);
};
Projapi.Valid.AbstractValidator.prototype.hasInfo=function(){
return (this._messageStore&&this._messageStore[Projapi.Widgets.PJWarningManager.TYPE_INFO].length>0);
};
Projapi.Valid.AbstractValidator.prototype.addWarning=function(_287,_288){
var warn=new Projapi.Widgets.PJWarning({type:_287,column:null,objectName:this.RefObject.getObjectName(),msg:_288},this.RefObject.getWindowName());
this._messageStore[_287].push(warn);
};
Projapi.Valid.AbstractValidator.prototype.clear=function(){
this._messageStore={0:[],1:[],2:[]};
Projapi.WarningManager.clearWarnings(this.RefObject.getWindowName(),this.RefObject.getObjectName());
};
Projapi.Valid.AbstractValidator.prototype.mark=function(){
var _28a=this.getProperty("alertType","default").toLowerCase();
_28a="mark"+_28a.charAt(0).toUpperCase()+_28a.substring(1);
if(this[_28a]&&typeof this[_28a]=="function"){
this[_28a]();
}
};
Projapi.Valid.AbstractValidator.prototype.markDefault=function(){
var idx,len,_28d;
if(this.hasError()){
_28d=Projapi.Widgets.PJWarningManager.TYPE_ERROR;
for(idx=0,len=this._messageStore[_28d].length;idx<len;idx++){
Projapi.WarningManager.addWarning(this._messageStore[_28d][idx]);
}
}
if(this.hasWarning()){
_28d=Projapi.Widgets.PJWarningManager.TYPE_WARNING;
for(idx=0,len=this._messageStore[_28d].length;idx<len;idx++){
Projapi.WarningManager.addWarning(this._messageStore[_28d][idx]);
}
}
if(this.hasInfo()){
_28d=Projapi.Widgets.PJWarningManager.TYPE_INFO;
for(idx=0,len=this._messageStore[_28d].length;idx<len;idx++){
Projapi.WarningManager.addWarning(this._messageStore[_28d][idx]);
}
}
if(this.RefObject&&this.RefObject.getWindowName()){
Projapi.WarningManager.mark(this.RefObject.getWindowName(),this.RefObject.getObjectName(),true);
}
};
Projapi.Valid.AbstractValidator.prototype.markAlert=function(){
var idx,len,_290,_291=[],_292=false,_293=false;
if(_292=this.hasError()){
_290=Projapi.Widgets.PJWarningManager.TYPE_ERROR;
for(idx=0,len=this._messageStore[_290].length;idx<len;idx++){
_291.push("-"+this._messageStore[_290][idx].warningMessage);
}
}
if(_293=this.hasWarning()){
_290=Projapi.Widgets.PJWarningManager.TYPE_WARNING;
for(idx=0,len=this._messageStore[_290].length;idx<len;idx++){
_291.push("-"+this._messageStore[_290][idx].warningMessage);
}
}
if(this.hasInfo()){
_290=Projapi.Widgets.PJWarningManager.TYPE_INFO;
for(idx=0,len=this._messageStore[_290].length;idx<len;idx++){
_291.push("-"+this._messageStore[_290][idx].warningMessage);
}
}
if(_292){
alert(_291.join("\r\n"));
}else{
if(_293){
return !confirm(this.getProperty("continueMessage","Continue?"));
}else{
if(_291.length){
alert(_291.join("\r\n"));
}
}
}
return this._stopChain;
};
Projapi.Valid.AbstractValidator.prototype.markTrigger=function(){
if(this.hasError()){
Projapi.Util.Trigger(this,"onError");
}
if(this.hasWarning()){
Projapi.Util.Trigger(this,"onWarning");
}
if(this.hasInfo()){
Projapi.Util.Trigger(this,"onInfo");
}
if(this.isValid()){
Projapi.Util.Trigger(this,"onSuccess");
}else{
Projapi.Util.Trigger(this,"onFailure");
}
};
Projapi.Valid.AbstractValidator.prototype.stopChain=function(){
return this._stopChain;
};
Projapi.Valid.AbstractValidator.prototype.getMessageStore=function(){
return this._messageStore;
};
Projapi.Valid.AbstractValidator.prototype.getMessageBundle=function(){
return this._messageBundle;
};
Projapi.Valid.AbstractValidator.prototype.setMessageBundle=function(_294){
if(typeof _294=="undefined"){
_294={};
}
this._messageBundle=_294;
};
Projapi.Valid.AbstractValidator.prototype.getMessage=function(_295){
if(this.RefObject&&this.RefObject.getMessage(_295)!=_295){
return this.RefObject.getMessage(_295);
}else{
if(this._messageBundle[_295]){
return this._messageBundle[_295];
}else{
if(this._staticMessageBundle&&this._staticMessageBundle[_295]){
return this._staticMessageBundle[_295];
}
}
}
return _295;
};
Projapi.Valid.EmptyField=function(_296,_297){
Projapi.Valid.EmptyField.superclass.constructor.call(this,_296,_297);
this._staticMessageBundle={"msg_val_fld_required":"The value of this field is required."};
this._stopChain=true;
};
Projapi.extend(Projapi.Valid.EmptyField,Projapi.Valid.AbstractValidator);
Projapi.Valid.EmptyField.prototype.validate=function(){
if(!this.RefObject){
return true;
}
this.clear();
if(this.RefObject.getObjectValue()==""||this.RefObject.getObjectValue()==null){
this.addWarning(Projapi.Widgets.PJWarningManager.TYPE_ERROR,this.getMessage("msg_val_fld_required"));
}
this.mark();
return this.isValid();
};
if(typeof Projapi=="undefined"){
Projapi={};
}
if(!Projapi.Base){
Projapi.Base={};
}
Projapi.Base.RequestManager=function(name,_299){
Projapi.Base.RequestManager.superclass.constructor.call(this,name,_299);
this._objectType="PJRequestManager";
this.domains={};
this._processObjectProperties();
};
Projapi.extend(Projapi.Base.RequestManager,Projapi.Base.iPJSmartObject);
Projapi.Base.RequestManager.notExplorable=true;
Projapi.Base.RequestManager.prototype.addRequest=function(url,_29b){
var _29c;
var _29d="unknown";
if(_29b.domain){
_29d=Projapi.Widgets.PJWarningManager.prototype._getWindowName(_29b.domain);
}
if(!this.domains[_29d]){
this.domains[_29d]=[0,0];
}
_29d=this.domains[_29d];
_29d[0]++;
_29d[1]++;
var item=[url,_29b];
var _29f=_29b.onComplete||null;
var _2a0=_29b.handlesServerError||false;
var _2a1=this;
var _2a2=new Date();
_29b.onComplete=function(req){
if(!req||(req.readyState<4)){
return;
}
_29d[1]--;
var _2a4=new Date();
if(req.status>=200&&req.status<300){
var user=req.getResponseHeader("X-Projapi-User")||"";
var mtch=user.match(/("|')((?:.|\s)*)\1/);
if(mtch){
user=mtch[2];
}
if(_2a1.getProperty("checkUser",true,true)&&!user&&!_2a1.isLoginPage(url)){
_2a1.goToLogin();
}else{
if(_29f){
_29f(_29c.transport);
}
}
}else{
if(_29f){
_29f(_29c.transport);
}
if(!_2a0){
_2a1.handleServerError(req.status,req.getResponseHeader("X-Projapi-Server-Error-Msg"));
}
}
var end=new Date();
if(_29f){
console.log(["Request done in ",Math.floor((_2a4-_2a2)/1000),"s ",(_2a4-_2a2)%1000,"ms, ","processed in ",Math.floor((end-_2a4)/1000),"s ",(end-_2a4)%1000,"ms: ",url].join(""));
}else{
console.log(["Request done in ",Math.floor((_2a4-_2a2)/1000),"s ",(_2a4-_2a2)%1000,"ms: ",url].join(""));
}
};
_29c=new Ajax.Request(url,_29b);
return _29c;
};
Projapi.Base.RequestManager.prototype.getDomainActiveRequests=function(_2a8){
if(typeof _2a8!="string"){
_2a8=Projapi.Widgets.PJWarningManager.prototype._getWindowName(_2a8);
}
if(this.domains[_2a8]){
return this.domains[_2a8][1];
}else{
return 0;
}
};
Projapi.Base.RequestManager.prototype.getDomainTotalRequests=function(_2a9){
if(typeof _2a9!="string"){
_2a9=Projapi.Widgets.PJWarningManager.prototype._getWindowName(_2a9);
}
if(this.domains[_2a9]){
return this.domains[_2a9][0];
}else{
return 0;
}
};
Projapi.Base.RequestManager.prototype.getWindowActiveRequests=Projapi.Base.RequestManager.prototype.getDomainActiveRequests;
Projapi.Base.RequestManager.prototype.getWindowTotalRequests=Projapi.Base.RequestManager.prototype.getDomainTotalRequests;
Projapi.Base.RequestManager.prototype.isLoginPage=function(url){
var cur=(typeof (url)=="undefined")?String(window.location):String(url);
var _2ac=String(Projapi.Globals.LOGIN_PATH);
if(_2ac.length==0){
return true;
}
if(_2ac.indexOf("://")==-1){
if(_2ac.charAt(0)!="/"){
return false;
}
if(cur.match(/.*?:\/\/[^\/]*/)!=null){
_2ac=cur.match(/.*?:\/\/[^\/]*/)[0]+_2ac;
}
}
return cur.indexOf(_2ac)==0;
};
Projapi.Base.RequestManager.prototype.goToLogin=function(){
if(Projapi.Globals.LOGIN_PATH){
window.location=Projapi.Globals.LOGIN_PATH;
}else{
console.log("[RequestManager.goToLogin] Login path not set, assuming public access.");
}
};
Projapi.Base.RequestManager.prototype.handleServerError=function(_2ad,msg){
if(!msg){
msg=this.httpMessages[_2ad]||this.httpStatusClasses[parseInt(_2ad/100)]||"Server returned error code "+_2ad+".";
}
Projapi.WarningManager.process([{msg:msg,type:0,warningColumn:"PJRequest"}],Projapi.Globals.ROOT_WINDOW);
Projapi.WarningManager.mark(Projapi.Globals.ROOT_WINDOW);
Projapi.WarningManager.clearWarnings(Projapi.Globals.ROOT_WINDOW,"PJRequest");
};
(function(){
var _2af=[null,"Informational","Successful","Redirection","Client error","Server error"];
var _2b0=[];
_2b0[100]="Continue";
_2b0[101]="Switching Protocols";
_2b0[200]="OK";
_2b0[201]="Created";
_2b0[202]="Accepted";
_2b0[203]="Non-Authoritative Information";
_2b0[204]="No Content";
_2b0[205]="Reset Content";
_2b0[206]="Partial Content";
_2b0[300]="Multiple Choices";
_2b0[301]="Moved Permanently";
_2b0[302]="Found";
_2b0[303]="See Other";
_2b0[304]="Not Modified";
_2b0[305]="Use Proxy";
_2b0[307]="Temporary Redirect";
_2b0[400]="Bad Request";
_2b0[401]="Unauthorized";
_2b0[402]="Payment Required";
_2b0[403]="Forbidden";
_2b0[404]="Not Found";
_2b0[405]="Method Not Allowed";
_2b0[406]="Not Acceptable";
_2b0[407]="Proxy Authentication Required";
_2b0[408]="Request Timeout";
_2b0[409]="Conflict";
_2b0[410]="Gone";
_2b0[411]="Length Required";
_2b0[412]="Precondition Failed";
_2b0[413]="Request Entity Too Large";
_2b0[414]="Request-URI Too Long";
_2b0[415]="Unsupported Media Type";
_2b0[416]="Requested Range Not Satisfiable";
_2b0[417]="Expectation Failed";
_2b0[500]="Internal Server Error";
_2b0[501]="Not Implemented";
_2b0[502]="Bad Gateway";
_2b0[503]="Service Unavailable";
_2b0[504]="Gateway Timeout";
_2b0[505]="HTTP Version Not Supported";
Projapi.Base.RequestManager.prototype.httpMessages=_2b0;
Projapi.Base.RequestManager.prototype.httpStatusClasses=_2af;
})();
Projapi.Request=function(url,_2b2){
var mgr=Projapi.Request.Manager;
if(_2b2.requestManager){
mgr=_2b2.requestManager;
delete _2b2.requestManager;
}
this.url=url;
this.options=_2b2;
this.prototypeRequest=mgr.addRequest(url,_2b2);
};
Projapi.Request.Updater=function(node,url,_2b6){
var _2b7=_2b6.onComplete||Prototype.emptyFunction;
_2b6.onComplete=function(_2b8){
var txt=_2b8.responseText.replace(/<![^>]+>/g,"");
if(!_2b6.evalScripts){
txt=txt.stripScripts();
}
if(_2b6.insertion){
new _2b6.insertion($(node),txt);
}else{
$(node).innerHTML=txt.stripScripts();
txt.evalScripts();
}
_2b7(_2b8);
};
this.url=url;
this.options=_2b6;
this.request=new Projapi.Request(url,_2b6);
};
Projapi.Request.WebService=function(url,_2bb,_2bc){
var _2bd=_2bc.onComplete||Prototype.emptyFunction;
_2bc.onComplete=function(_2be){
if(_2bc.onResponseString&&_2be.responseXML&&_2be.responseXML.documentElement){
var node=_2be.responseXML.documentElement;
if(node.nodeName=="string"&&node.firstChild&&node.firstChild==node.lastChild&&node.firstChild.nodeType==3){
_2bc.onResponseString(node.firstChild.nodeValue);
}
}
_2bd(_2be);
};
var id;
if(!_2bc.postBody){
_2bc.postBody="";
}
if(_2bc.params){
for(id in _2bc.params){
if(!{}[id]&&typeof _2bc.params[id]!="function"){
_2bc.postBody+="&"+encodeURIComponent(id)+"="+encodeURIComponent(String(_2bc.params[id]));
}
}
}
if(_2bc.paramNames&&_2bc.paramValues){
for(id=0;id<_2bc.paramNames.length;id++){
_2bc.postBody+="&"+encodeURIComponent(String(_2bc.paramNames[id]))+"="+encodeURIComponent(String(_2bc.paramValues[id]));
}
}
if(_2bc.postBody.charAt(0)=="&"){
_2bc.postBody=_2bc.postBody.substr(1);
}
this.options=Object.extend({method:"post",asynchronous:true},_2bc);
this.url=url+"/"+_2bb;
this.request=new Projapi.Request(this.url,this.options);
};
Ajax.Responders.register({onException:function(req,e){
console.error("Request %o encountered exception %o.",req,e);
}});
Projapi.Request.Manager=new Projapi.Base.RequestManager("DefaultRequestManager",{checkUser:true});
if(typeof Projapi=="undefined"){
var Projapi={};
}
if(typeof Projapi.Layout=="undefined"){
Projapi.Layout={};
}
Projapi.Layout.Layout=function(_2c3){
this.container=_2c3;
};
Projapi.Layout.Layout.prototype.add=function(_2c4){
if(!_2c4._domNode){
return;
}
var _2c5=_2c4._objectPage||0;
var _2c6=(this.container._pageNode&&this.container._pageNode[_2c5])?this.container._pageNode[_2c5]:(this.container.getContentDOMNode&&this.container.getContentDOMNode())||this.container._domNode||document.body;
if(_2c6 instanceof Projapi.UI.Element){
_2c6=_2c6.domNode;
}
if(_2c4._domNode instanceof Projapi.UI.Element){
if(_2c6&&_2c4._domNode.domNode.parentNode!=_2c6){
_2c6.appendChild(_2c4._domNode.domNode);
}
}else{
if(_2c6&&_2c4._domNode.parentNode!=_2c6){
_2c6.appendChild(_2c4._domNode);
}
}
};
Projapi.Layout.Layout.prototype.remove=function(_2c7){
var node=_2c7._domNode;
if(node&&node.parentNode){
node.parentNode.removeChild(node);
}
};
Projapi.Layout.Layout.prototype.layout=function(){
};
Projapi.Layout.Layout.prototype.destroy=function(){
};
Projapi.Layout.LineLayout=function(_2c9){
this.container=_2c9;
};
Projapi.Layout.LineLayout.prototype.add=function(_2ca){
if(!_2ca._domNode){
return;
}
var tmp;
var _2cc=_2ca._objectPage||0;
var _2cd=(this.container._pageNode&&this.container._pageNode[_2cc])?this.container._pageNode[_2cc]:(this.container.getContentDOMNode&&(tmp=this.container.getContentDOMNode()))?tmp:this.container._domNode||document.body;
if(_2cd instanceof Projapi.UI.Element){
_2cd=_2cd.domNode;
}
var _2ce=_2ca._domNode;
if(_2ce instanceof Projapi.UI.Element){
_2ce=_2ce.domNode;
}
var _2cf=_2ca._properties.layoutRow||null;
if(_2cf==null){
if(!_2ce.parentNode||!_2ce.parentNode.parentNode||_2ce.parentNode.parentNode!=_2cd){
_2cd.appendChild(document.createElement("div")).appendChild(_2ce);
}
}else{
while(_2cd.childNodes.length<_2cf){
_2cd.appendChild(document.createElement("div")).innerHTML="&nbsp;";
}
if(_2cd.childNodes.length==_2cf){
_2cd.appendChild(document.createElement("div"));
}else{
console.warn("Suboptimal object placement order. For best performance, add children from lowest layoutRow to highest. Container: %o, cihld: %o",this.container._objectName,_2ca._objectName);
if(_2cd.childNodes[_2cf].innerHTML=="&nbsp;"){
_2cd.childNodes[_2cf].innerHTML="";
}
}
_2cd.childNodes[_2cf].appendChild(_2ce);
}
var _2d0=_2ca._properties.align||"left";
if(_2d0&&!_2ca._properties.hide){
_2ce.parentNode.align=_2d0.toLowerCase();
}
};
Projapi.Layout.LineLayout.prototype.layout=function(){
};
Projapi.Layout.LineLayout.prototype.destroy=function(){
};
Projapi.Layout.TableLayout=function(_2d1,_2d2){
if(_2d1=="someClass"){
return;
}
Projapi.Layout.TableLayout.superclass.constructor.call(this,_2d1);
this._rowNr=_2d1.getProperty("layoutTableRows",1);
this._colNr=_2d1.getProperty("layoutTableCols",1);
this._cellSpacing=_2d1.getProperty("layoutCellSpacing",0);
if(this.container._properties.letBrowserAdjustLayout){
this.layout=Projapi.Layout.TableLayout.prototype.checkLayout;
}
this._tableNode;
this._page=_2d2||0;
this._parrentNode=null;
this._componentNameTable=[];
this._cellMap=[];
if(!this._scanUI()){
this._buildUI();
}
};
Projapi.extend(Projapi.Layout.TableLayout,Projapi.Layout.Layout);
Projapi.Layout.TableLayout.prototype._scanUI=function(){
};
Projapi.Layout.TableLayout.prototype._buildUI=function(){
var idx=0,_2d4=this._rowNr,_2d5,_2d6,_2d7=[],dm,tmp;
var _2da=(this.container._pageNode&&this.container._pageNode[this._page])?((this.container._pageNode[this._page].domNode.firstChild&&this.container._pageNode[this._page].domNode.firstChild.className.match(/\bpjPageInner\b/))?this.container._pageNode[this._page].domNode.firstChild:this.container._pageNode[this._page]):(this.container.getContentDOMNode&&(tmp=this.container.getContentDOMNode()))?tmp:this.container._domNode||document.body;
if(_2da instanceof Projapi.UI.Element){
_2da=_2da.domNode;
}
dm=document.createElement("DIV");
_2d7.push("<table class=\"pjlytable\" cellspacing=\"");
_2d7.push(this._cellSpacing);
if(this.container._properties.letBrowserAdjustLayout){
_2d7.push("\" style=\"width: auto");
}
_2d7.push("\"><tbody>");
var arrL=this._rowNr+1;
if(arrL<2){
arrL=2;
}
_2d7.push((new Array(arrL)).join("<tr class=\"pjlytr\">"+(new Array(this._colNr+1)).join("<td class=\"pjlycl\"></td>")+"</tr>"));
_2d7.push("</tbody></table>");
dm.innerHTML=_2d7.join("");
this._tableNode=new Projapi.UI.Element(dm.firstChild);
this._dupNode=dm.firstChild.tBodies[0].firstChild.cloneNode(true);
if(_2da){
_2da.appendChild(this._tableNode.domNode);
}
var node=this._tableNode.domNode;
for(idx=0;idx<node.rows.length;idx++){
this._cellMap[idx]=[];
this._componentNameTable[idx]=[];
for(_2d5=0;_2d5<this._colNr;_2d5++){
this._cellMap[idx][_2d5]=node.rows[idx].cells[_2d5];
}
}
};
Projapi.Layout.TableLayout.prototype._buildRow=function(_2dd){
var idx=0,_2df=this._colNr,_2e0,_2e1;
var node=this._tableNode.domNode;
if(node.tBodies&&node.tBodies[0]){
node=node.tBodies[0];
}
while(node.rows.length<=_2dd){
_2e1=node.appendChild(this._dupNode.cloneNode(true));
if(!this._cellMap[node.rows.length-1]){
this._cellMap[node.rows.length-1]=[];
}
this._componentNameTable[node.rows.length-1]=[];
for(idx=0;idx<_2df;idx++){
this._cellMap[node.rows.length-1][idx]=_2e1.cells[idx];
}
}
if(_2e1.cells.length==this._colNr){
return;
}
return _2e1;
};
Projapi.Layout.TableLayout.prototype.add=function(_2e3){
var _2e4=_2e3._properties.layoutRow||0;
var _2e5=_2e3._properties.layoutCol||0;
var _2e6=_2e3._properties.align||"left";
var _2e7=_2e3._properties.valign||null;
var _2e8=_2e3._properties.layoutColSpan||1;
var _2e9=_2e3._properties.layoutRowSpan||1;
var _2ea,_2eb;
var idx,_2ed,idx2,_2ef;
if(!_2e3._domNode||!this._tableNode){
return;
}
if(_2e3._properties.ignoreLayoutPosition==true){
if(Projapi.Globals.ROOT_WINDOW&&Projapi.Globals.ROOT_WINDOW._domNode){
Projapi.Globals.ROOT_WINDOW._domNode.domNode.appendChild(_2e3._domNode.domNode);
}else{
document.body.appendChild(_2e3._domNode.domNode);
}
return;
}
if(this._tableNode.domNode.rows.length<_2e4+_2e9){
this._buildRow(_2e4+_2e9-1);
}
if(!this._componentNameTable[_2e4][_2e5]||!this._componentNameTable[_2e4][_2e5].length){
this._componentNameTable[_2e4][_2e5]=[_2e3._objectName];
}else{
if(this._componentNameTable[_2e4][_2e5].length){
if(!_2e3._properties.hide){
console.warn("Table layout of %s, already has on row %s, column %s the component(s) %s adding component %s",this.container._objectName,_2e4,_2e5,this._componentNameTable[_2e4][_2e5].join(", "),_2e3._objectName);
}
this._componentNameTable[_2e4][_2e5].push(_2e3._objectName);
}
}
_2ea=this._cellMap[_2e4][_2e5];
if(!_2ea){
console.error("Object %s can not be placed at row %i col %i we only have cells %i",_2e3.getObjectName(),_2e4,_2e5,this._tableNode.domNode.rows[_2e4].cells.length);
return;
}
if(_2e6&&!_2e3._properties.hide){
_2ea.align=_2e6.toLowerCase();
}
if(_2e7){
_2ea.vAlign=_2e7.toLowerCase();
}
if(_2e3._objectType=="SmartBrowse"&&this.container._tabPane){
this._tableNode.domNode.style.tableLayout="fixed";
}
_2ed=_2e4+_2e9;
_2ef=_2e5+_2e8;
for(idx=_2e4+1;idx<_2ed;idx++){
if(this._cellMap[idx][_2e5]&&this._cellMap[idx][_2e5]!=_2ea){
while(this._cellMap[idx][_2e5].firstChild){
_2ea.appendChild(this._cellMap[idx][_2e5].firstChild);
}
this._cellMap[idx][_2e5].parentNode.removeChild(this._cellMap[idx][_2e5]);
}
this._cellMap[idx][_2e5]=_2ea;
}
for(idx=_2e4;idx<_2ed;idx++){
for(idx2=_2e5+1;idx2<_2ef;idx2++){
if(this._cellMap[idx][idx2]&&this._cellMap[idx][idx2]!=_2ea){
while(this._cellMap[idx][idx2].firstChild){
_2ea.appendChild(this._cellMap[idx][idx2].firstChild);
}
this._cellMap[idx][idx2].parentNode.removeChild(this._cellMap[idx][idx2]);
}
this._cellMap[idx][idx2]=_2ea;
}
}
_2ea.colSpan=_2e8||1;
_2ea.rowSpan=_2e9||1;
if(_2ea){
var node=_2e3._domNode;
if(node instanceof Projapi.UI.Element){
_2ea.appendChild(node.domNode);
}else{
_2ea.appendChild(node);
}
}
};
Projapi.Layout.TableLayout.prototype.remove=function(_2f1){
Projapi.Layout.TableLayout.superclass.remove.call(this,object);
var row=_2f1._properties.layoutRow||0;
var col=_2f1._properties.layoutCol||0;
var _2f4=_2f1._properties.layoutColSpan||1;
var _2f5=_2f1._properties.layoutRowSpan||1;
var vec=this._componentNameTable[_layoutRow][_layoutCol];
vec.splice(vec.indexOf(_2f1._objectName),1);
if(vec.length==0){
this._cellMap[row][col].colSpan=1;
this._cellMap[row][col].rowSpan=1;
if(_2f4>1){
var cols=col+_2f4-2;
while(cols>=col){
this._cellMap[row][cols]=this._cellMap[row][cols+1].parentNode.insertBefore(document.createElement("td"),this._cellMap[row][cols+1]);
this._cellMap[row][cols].className="pjlycl";
cols--;
}
}
if(_2f5>1){
var rows=row+_2f5-1;
while(rows>row){
if(this._cellMap[rows].length>col+_2f4){
this._cellMap[rows][col+_2f4-1]=this._cellMap[rows][cols+1].parentNode.insertBefore(document.createElement("td"),this._cellMap[rows][cols+1]);
}else{
this._cellMap[rows][col+_2f4-1]=this._cellMap[0][0].parentNode.parentNode.rows[rows].appendChild(document.createElement("td"));
}
this._cellMap[rows][col+_2f4-1].className="pjlycl";
if(_2f4>1){
var cols=col+_2f4-2;
while(cols>=col){
this._cellMap[rows][cols]=this._cellMap[rows][cols+1].parentNode.insertBefore(document.createElement("td"),this._cellMap[rows][cols+1]);
this._cellMap[rows][cols].className="pjlycl";
cols--;
}
}
rows--;
}
}
}
};
Projapi.Layout.TableLayout.prototype.destroy=function(){
if(this._tableNode){
this._tableNode.domNode.parentNode.removeChild(this._tableNode.domNode);
}
};
Projapi.Layout.TableLayout.prototype.checkLayout=function(){
if(this._cellMap[0].length==1){
console.warn("%o does not need TableLayout on page %i, use %o. element: %o",this.container._objectName,this._page,"LineLayout",this._tableNode.domNode);
}else{
if(this._cellMap.length==1){
console.warn("%o does not need TableLayout on page %i, use (simple) %o. element: %o",this.container._objectName,this._page,"Layout",this._tableNode.domNode);
}
}
};
Projapi.Layout.TableLayout.prototype.layout=function(){
if(!this._tableNode){
return;
}
this.checkLayout();
var map=[],res,_2fb,_2fc,j,_2fe,node=this._tableNode.domNode,row=node.rows[0],cell;
this.processAllCells(map);
res=this.breakSpansAndGetSizes(map);
var sum=0;
for(_2fb=0;_2fb<res.cols.length;_2fb++){
sum+=res.cols[_2fb];
}
if(sum>node.clientWidth){
var _303=[],_304=[];
this.enforcedWidths=true;
_2fb=0,_2fc=0;
while(_2fb<res.cols.length){
cell=row.cells[_2fc++];
if(cell){
sum=0;
j=_2fb+(cell.colSpan||1);
while(_2fb<j){
sum+=res.cols[_2fb];
_2fb++;
}
_303.push(cell);
_304.push(sum);
}else{
break;
}
}
for(j=0;j<_303.length;j++){
_303[j].style.width=_304[j]+"px";
}
}else{
this.enforcedWidths=false;
}
};
Projapi.Layout.TableLayout.prototype.processAllCells=function(m){
var row,cell,ir=-1,ic,i,j,tr,td,_30e=[];
var _30f=this._tableNode.domNode.className;
this._tableNode.domNode.className+=" forceBlockKids";
for(tr=this._tableNode.domNode.rows[0];tr;tr=tr.nextSibling){
ir++;
ic=-1;
if(m.length<ir+1){
m.push([]);
}
for(td=tr.cells[0];td;td=td.nextSibling){
ic++;
while(ir<m[ir].length&&m[ir][ic]){
ic++;
}
this.processCell(td,m,ir,ic);
}
}
this._tableNode.domNode.className=_30f;
if(this.enforcedWidths){
for(td=this._tableNode.domNode.rows[0].cells[0];td;td=td.nextSibling){
td.style.width="";
}
}
};
Projapi.Layout.TableLayout.prototype.processCell=function(td,m,ir,ic){
var obj={w:0,h:0,cs:(td.colSpan||1)-0,rs:(td.rowSpan||1)-0,x:ic,y:ir};
var node=td.firstChild,i,j;
var _318=this._tableNode.domNode.parentNode;
var ref1,ref2;
while(node){
ref1=node.style;
ref2=node.currentStyle||document.defaultView.getComputedStyle(node,null)||{};
i=node.offsetLeft;
if((ref1.textAlign||ref2.textAlign||"").indexOf("right")>-1){
i=0;
}
if((i=i+this.getSize(node,_318,ref1,ref2,"Width"))>obj.w){
obj.w=i;
}
if((i=node.offsetTop+this.getSize(node,_318,ref1,ref2,"Height"))>obj.h){
obj.h=i;
}
node=node.nextSibling;
}
for(i=ir;i<ir+obj.rs;i++){
while(m.length<i+1){
m.push([]);
}
for(j=ic;j<ic+obj.cs;j++){
m[i][j]=obj;
}
}
};
Projapi.Layout.TableLayout.prototype.pxSize=/^(\d+)px/i;
Projapi.Layout.TableLayout.prototype.prSize=/^(\d+)%/i;
Projapi.Layout.TableLayout.prototype.getSize=function(node,axe,ref1,ref2){
var mn=ref1["min"+axe]||ref2["min"+axe]||null,sz=null;
if(mn){
if(sz=mn.match(this.pxSize)){
sz=sz[1]-0;
}else{
if(sz=mn.match(this.prSize)){
sz=Math.round(parent["client"+axe]*(sz[1]-0)/100);
}else{
sz=null;
}
}
}
return sz||node["offset"+axe];
};
Projapi.Layout.TableLayout.prototype.breakSpansAndGetSizes=function(m){
var i,j,o,k,s,d,cols=[],rows=[];
for(i=0;i<m.length;i++){
rows.push(0);
while(cols.length<m[i].length){
cols.push(0);
}
for(j=0;j<m[i].length;j++){
if(m[i][j]&&m[i][j].cs==1&&m[i][j].rs==1){
if(m[i][j].w>cols[j]){
cols[j]=m[i][j].w;
}
if(m[i][j].h>rows[i]){
rows[i]=m[i][j].h;
}
}
}
}
for(i=0;i<m.length;i++){
for(j=0;j<m[i].length;j++){
if(o=m[i][j]){
if(o.cs>1){
s=o.w;
for(k=o.x;k<o.x+o.cs;k++){
s-=cols[k].w;
}
if(s>0){
d=Math.floor(s/o.cs);
for(k=o.x+1;k<o.x+o.cs;k++){
cols[k]+=d;
}
s-=d*(o.cs-1);
cols[j]+=s;
}
}
if(o.rs>1){
}
}
}
}
var ret={cols:cols,rows:rows};
return ret;
};
Projapi.Layout.WindowLayout=function(_32b,_32c){
Projapi.Layout.WindowLayout.superclass.constructor.call(this,_32b);
this.containerLayout=_32c;
};
Projapi.extend(Projapi.Layout.WindowLayout,Projapi.Layout.Layout);
Projapi.Layout.WindowLayout.prototype.add=function(_32d){
if(!_32d._domNode){
return;
}
if(_32d==this.container.getMenubar()&&this.container._nodes.menuHolder){
var _32e=this.container._nodes.menuHolder;
_32e.removeChildrens();
if(_32d._domNode.domNode.parentNode){
_32d._domNode.domNode.parentNode.removeChild(_32d._domNode.domNode);
}
_32e.domNode.appendChild(_32d._domNode.domNode);
_32e.domNode.parentNode.parentNode.style.height="1px";
return;
}
if(_32d==this.container.getToolbar()&&this.container._nodes.toolbarHolder){
var _32e=this.container._nodes.toolbarHolder;
_32e.removeChildrens();
if(_32d._domNode.domNode.parentNode){
_32d._domNode.domNode.parentNode.removeChild(_32d._domNode.domNode);
}
_32e.domNode.appendChild(_32d._domNode.domNode);
_32e.domNode.parentNode.parentNode.style.height="1px";
return;
}
if(_32d==this.container.getStatusBar()&&this.container._nodes.statusbarHolder){
var _32e=this.container._nodes.statusbarHolder;
_32e.removeChildrens();
if(_32d._domNode.domNode.parentNode){
_32d._domNode.domNode.parentNode.removeChild(_32d._domNode.domNode);
}
_32e.domNode.appendChild(_32d._domNode.domNode);
_32e.domNode.parentNode.parentNode.style.height="1px";
return;
}
this.containerLayout.add(_32d);
};
Projapi.Layout.WindowLayout.prototype.layout=function(){
};
Projapi.Layout.WindowLayout.prototype.destroy=function(){
};
Projapi.Widgets.PJLookup=function(_32f,_330,_331){
Projapi.Widgets.PJLookup.superclass.constructor.call(this,_32f,_331);
var _idx,_333=_330;
this.ActionSourceEvents=[Projapi.Links.Action.ValueChanged];
this.DataSourceEvents=[Projapi.Links.Data.DataAvailable,Projapi.Links.Data.QueryPosition];
this._rows=[];
this._rows.length=_330;
this._dataSource=null;
this._actionSources=[];
this._fieldMask=[];
this._requestColValues=[];
this._DOMClassPrefix="pjLookup";
this._processObjectProperties();
};
Projapi.extend(Projapi.Widgets.PJLookup,Projapi.Base.iPJVisualObject);
Projapi.Widgets.PJLookup.prototype.createObjects=function(){
this._buildUI();
};
Projapi.Widgets.PJLookup.prototype.initializeObject=function(){
Projapi.Widgets.PJLookup.superclass.initializeObject.call(this);
this._objectInitialized=true;
var t;
if((t=this._dataSource)&&(t.isDataAvailable())){
this.dataAvailable();
}
};
Projapi.Widgets.PJLookup.prototype._processObjectProperties=function(){
if((!this._properties)||(!this._properties.lineMask)){
return;
}
var _idx=0,_336=this._properties.lineMask.length,_337="",_338=0,_339=0;
for(;_idx<_336;++_idx){
_337=this._properties.lineMask[_idx];
this._fieldMask[_idx]=_337;
_338=_337.indexOf("{",_339);
_339=_337.indexOf("}",_339+1);
while(_338!=-1){
this._requestColValues.push(_337.substring(_338+1,_339));
_338=_337.indexOf("{",_339);
_339=_337.indexOf("}",_339+1);
}
}
};
Projapi.Widgets.PJLookup.prototype._extractDSCols=function(_33a){
var _idx=0,_33c=_33a.length,_33d="",_33e=0,_33f=0,_340={fieldMask:[],requestColValues:[]};
for(;_idx<_33c;++_idx){
_33d=_33a[_idx];
_340.fieldMask[_idx]=_33d;
_33e=_33d.indexOf("{",_33f);
_33f=_33d.indexOf("}",_33f+1);
while(_33e!=-1){
_340.requestColValues.push(_33d.substring(_33e+1,_33f));
_33e=_33d.indexOf("{",_33f);
_33f=_33d.indexOf("}",_33f+1);
}
}
return _340;
};
Projapi.Widgets.PJLookup.prototype.getDataSource=function(){
return this._dataSource;
};
Projapi.Widgets.PJLookup.prototype.setDataSource=function(_341){
return this._dataSource=_341;
};
Projapi.Widgets.PJLookup.prototype.getActionSource=function(){
return this._actionSources;
};
Projapi.Widgets.PJLookup.prototype.addActionSource=function(_342){
this._actionSources.push(_342);
};
Projapi.Widgets.PJLookup.prototype.removeActionSource=function(_343){
var i=0;
while((this._actionSources[i]!=null)&&(this._actionSources[i]!=_343)){
++i;
}
this._actionSources.splice(i,1);
};
Projapi.Widgets.PJLookup.prototype.valueChanged=function(_345,_346){
if(_346 instanceof Array){
this.setObjectValue(_346);
}else{
var _347=this.getProperty("altDO",null,true);
var _348=this.getProperty("altDOColumns",null,true);
if(_347&&_348&&Projapi.Register.get(_347)){
var _349=Projapi.Register.get(_347).colValues(_348);
this.setObjectValue(_349);
}else{
this.setObjectValue([_346]);
}
}
};
Projapi.Widgets.PJLookup.prototype.dataAvailable=function(){
if(this._requestColValues.length==0||this._dataSource==null){
return;
}
var _idx=0,_34b=this._requestColValues.length;
var _34c=this._dataSource.colValues(this._requestColValues);
var _34d={};
for(;_idx<_34b;++_idx){
_34d[this._requestColValues[_idx]]=_34c[_idx];
}
_idx=0;
_34b=this._fieldMask.length;
var _34e=[];
for(;_idx<_34b;++_idx){
_34e.push(Projapi.Util.FillWithObject(this._fieldMask[_idx],_34d));
}
this.setObjectValue(_34e);
};
Projapi.Widgets.PJLookup.prototype.queryPosition=function(_34f){
if(_34f=="NoRecordAvailable"){
var _idx=0,_351=this._fieldMask.length,_352=[];
for(;_idx<_351;++_idx){
_352.push("");
}
this.setObjectValue(_352);
}
};
Projapi.Widgets.PJLookup.prototype._buildUI=function(){
if(!this._domNode){
var str=["<div class=\"",this._DOMClassPrefix,"\" id=\"",this._objectName,this._properties.size?"\" style=\"width: "+this._properties.size+"em":"","\"><div class=\"",this._DOMClassPrefix,"\">"];
for(var i=0;i<this._rows.length;i++){
str.push("<div class=\"");
str.push(this._DOMClassPrefix);
str.push("_row_");
str.push(i+1);
str.push("\"></div>");
}
str.push("</div></div>");
this._domNode=Projapi.UI.Element.fromString(str.join(""));
for(var i=0;i<this._rows.length;i++){
this._rows[i]=this._domNode.domNode.firstChild.childNodes[i];
}
if(this._containerSource){
this._containerSource.getLayoutManager(this._objectPage).add(this);
}
}
};
Projapi.Widgets.PJLookup.prototype.setObjectValue=function(_355){
Projapi.Util.Trigger(this,"onObjectValue",[this,_355]);
if(_355 instanceof Array){
var _idx=0,_357=(_355.length>this._rows.length?this._rows.length:_355.length);
for(;_idx<_357;++_idx){
this._rows[_idx].innerHTML=_355[_idx];
this._rows[_idx].title=_355[_idx];
}
}
};
if(typeof Projapi=="undefined"){
Projapi={};
}
if(!Projapi.Base){
Projapi.Base={};
}
Projapi.Base.PJDataObject=function(name,_359){
Projapi.Base.PJDataObject.superclass.constructor.call(this,name,_359);
this._objectType="PJDataObject";
var _35a=this;
this._staticMessageBundle={msg_dataobject_save_error:"There was an error while attemptig to save changes on the server. Please fix any network issues and try again.",msg_dataobject_timeout:"Communication with server timed-out.",msg_dataobject_server_save_error:"Server error while saving, http code %d",msg_dataobject_server_error:"Server error, http code %d"};
this.daoId=this._properties.daoId;
delete this._properties.daoId;
this._queryPosition=null;
this._properties=Object.extend({autoSync:true,batchSize:100,columns:[],margin:10,url:null,params:{},readOnly:false,threadTimeout:300000,OpenOnInit:true,rules:[],sendFilterEveryTime:false,hasFirstRow:false,hasLastRow:false,currentIndex:-1,requestedIndex:-1/0,__DataObjectReference:this,_selfStruct:{hasFirstRow:{readOnly:true},hasLastRow:{readOnly:true},params:{type:"dictionary"},url:{type:"string"}}},this._properties);
this._properties.params["dao-id"]=this.daoId;
Object.extend(this._properties,{onCursorMove:function(_35b,_35c){
if(_35a._publishingCursorMove){
throw new Error("Already publishing cursor move!");
}
_35a._publishingCursorMove=true;
var pos="",dO=_35a.dataProxy;
if(dO.cache.length==0){
pos="NoRecordAvailable";
}else{
if(dO.cache.length==1&&dO.options.hasFirstRow&&dO.options.hasLastRow){
pos="OnlyRecordAvailable";
}else{
if(_35c==0&&dO.options.hasFirstRow){
pos="FirstRecord";
}else{
if(_35c==dO.cache.length-1&&dO.options.hasLastRow){
pos="LastRecord";
}else{
pos="NotFirstOrLast";
}
}
}
}
_35a._queryPosition=pos;
try{
_35a.publish(Projapi.Links.Navigation.QueryPosition,pos);
_35a.publish(Projapi.Links.Data.DataAvailable);
Projapi.Util.Trigger(_35a,"afterDataAvailable");
}
catch(e){
console.error("Someone listening to QueryPosition or DataAvailable from Data Object %o threw %o",_35a,e);
}
_35a._publishingCursorMove=false;
},onAfterSync:function(){
_35a.publish("transactionOk");
},onAfterDelete:function(){
_35a.publish(Projapi.Links.Data.DeleteComplete);
}});
this._publishingCursorMove=false;
this.hdoFKParent=null;
this.dataTargets=[];
this.DataSourceEvents=Projapi.Links.Data.SourceEvents;
this.DataTargetEvents=Projapi.Links.Data.TargetEvents;
this.ActionSourceEvents=[Projapi.Links.Action.ValueChanged];
this._actionSources=[];
this._navigationSource=[];
this._updateSource=null;
this.NavigationSourceEvents=Projapi.Links.Navigation.SourceEvents;
this.commitTargets=[];
this._updateState=0;
var _35f=this.dataProxy=new Projapi.Base.PJDataObject.DataProxy(this._objectName,this._properties);
this._getDataObject=function(){
return _35f;
};
this._notifyOnRequest=[];
for(var i=0;i<this._properties.columns.length;i++){
if(this._properties.columns[i].translate){
this._properties.columns[i].translate=this._properties.columns[i].translate.parseJSON();
}else{
this._properties.columns[i].translate={};
}
}
this._processObjectProperties();
Projapi.Base.PJDataObject.instances.push(this);
this._mustRefreshFK=false;
};
Projapi.extend(Projapi.Base.PJDataObject,Projapi.Base.iPJSmartObject);
Projapi.Base.PJDataObject.instances=[];
Projapi.Base.PJDataObject.logRequests=false;
Projapi.Base.PJDataObject.prototype.disableObject=function(){
var _idx,_len,_obj;
this._objectEnabled=false;
for(_idx=0,_len=this._navigationSource.length;_idx<_len;_idx++){
_obj=this._navigationSource[_idx];
if(_obj){
_obj.disableObject();
}
}
if(this._updateSource){
var _364=this._updateSource.getTableIOSource();
for(_idx=0,_len=_364.length;_idx<_len;_idx++){
_obj=_364[_idx];
if(_obj){
_obj.disableObject();
}
}
}
};
Projapi.Base.PJDataObject.prototype.enableObject=function(){
var _idx,_len,_obj;
this._objectEnabled=true;
for(_idx=0,_len=this._navigationSource.length;_idx<_len;_idx++){
_obj=this._navigationSource[_idx];
if(_obj){
_obj.enableObject();
}
}
if(this._updateSource){
var _368=this._updateSource.getTableIOSource();
for(_idx=0,_len=_368.length;_idx<_len;_idx++){
_obj=_368[_idx];
if(_obj){
_obj.enableObject();
}
}
}
};
Projapi.Base.PJDataObject.prototype.getDataSource=function(){
return this.hdoFKParent;
};
Projapi.Base.PJDataObject.prototype.removeDataSource=function(){
this.rgFKMap=null;
this.hdoFKParent=null;
};
Projapi.Base.PJDataObject.prototype.setDataSource=function(_369){
this.setFK(_369);
};
Projapi.Base.PJDataObject.prototype.getActionSource=function(){
return this._actionSources;
};
Projapi.Base.PJDataObject.prototype.addActionSource=function(_36a){
this._actionSources.push(_36a);
};
Projapi.Base.PJDataObject.prototype.removeActionSource=function(_36b){
var i=0;
while((this._actionSources[i]!=null)&&(this._actionSources[i]!=_36b)){
++i;
}
this._actionSources.splice(i,1);
};
Projapi.Base.PJDataObject.prototype.addDataTarget=function(_36d){
this.dataTargets.push(_36d);
if(_36d&&_36d.getObjectType&&_36d.getObjectType()=="SmartDataView"){
this._updateSource=_36d;
}
};
Projapi.Base.PJDataObject.prototype.getDataTarget=function(){
return this.dataTargets;
};
Projapi.Base.PJDataObject.prototype.removeDataTarget=function(_36e){
this.dataTargets=this.dataTargets.without(_36e);
};
Projapi.Base.PJDataObject.prototype.addNavigationSource=function(_36f){
this._navigationSource.push(_36f);
};
Projapi.Base.PJDataObject.prototype.getNavigationSource=function(){
return this._navigationSource;
};
Projapi.Base.PJDataObject.prototype.removeNavigationSource=function(_370){
this._navigationSource=this._navigationSource.without(_370);
};
Projapi.Base.PJDataObject.prototype.addCommitTarget=function(_371){
this.commitTargets.push(_371);
};
Projapi.Base.PJDataObject.prototype.getCommitTarget=function(){
return this.commitTargets;
};
Projapi.Base.PJDataObject.prototype.removeCommitTarget=function(_372){
this.navTargets=this.commitTargets.without(oldTarget);
};
Projapi.Base.PJDataObject.prototype.createObjects=function(){
Projapi.Base.PJDataObject.superclass.createObjects.call(this);
this._objectCreated=true;
};
Projapi.Base.PJDataObject.prototype.initializeObject=function(){
if(this._objectInitialized){
return;
}
Projapi.Base.PJDataObject.superclass.initializeObject.call(this);
this._objectInitialized=true;
if(this._properties.serverData){
var req;
if(typeof this._properties.serverData=="string"){
req={status:200,responseText:this._properties.serverData.toJSONString()};
}else{
req=this._properties.serverData;
req.status=200;
req.parsed=true;
}
delete this._properties.serverData;
this.dataProxy._onRequestComplete(req);
}
this.dataProxy.initializeObject();
var fld;
if(fld=this.getProperty("fkField",null,true)){
if(typeof fld=="string"){
fld=fld.split(",");
if(fld.length==1){
fld=fld[0];
}
}
if(typeof fld=="string"){
fld=[fld,fld];
}
var map={};
var i;
for(i=0;i<fld.length;i+=2){
map[fld[i]]=fld[i+1];
}
this.setFK(null,map);
}
if(this._mustRefreshFK){
this.dataAvailable();
}
};
Projapi.Base.PJDataObject.prototype.destroyObject=function(){
Projapi.Base.PJDataObject.superclass.destroyObject.call(this);
var i;
for(i=0;i<Projapi.Base.PJDataObject.instances.length;i++){
if(Projapi.Base.PJDataObject.instances[i]==this){
Projapi.Base.PJDataObject.instances.splice(i,1);
break;
}
}
};
Projapi.Base.PJDataObject.prototype.addRow=function(_378){
var i,dO=this.dataProxy,_37b=dO.options.columns,row=[];
for(i=0;i<_37b.length;i++){
row.push(_37b[i].defaultValue||"");
}
this.dataProxy.appendRow(row);
dO.options.requestedIndex=-1;
if(dO.options.onCacheChange){
dO.options.onCacheChange();
}
dO._checkCursor();
var ret=[];
for(i=0;i<_378.length;i++){
ret.push(row[dO.options.columns.indexByName[_378[i]]]);
}
return ret;
};
Projapi.Base.PJDataObject.prototype.selectRow=function(_37e,_37f){
var i,dO=this.dataProxy;
i=dO._findRowByColumn(_37e,_37f);
if(i!=null){
dO.moveCursor(i);
}else{
dO.moveFirst();
}
};
Projapi.Base.PJDataObject.prototype.assignQuerySelection=function(_382){
if(!this.canMove()){
return;
}
this.dataProxy.setFilters(_382);
};
Projapi.Base.PJDataObject.prototype.autoCommit=function(_383){
if(typeof _383!="undefined"){
this.dataProxy.options.autoSync=_383;
}
return this.dataProxy.options.autoSync;
};
Projapi.Base.PJDataObject.prototype.cancelRow=function(){
this.dataProxy.undoAll({all:true});
};
Projapi.Base.PJDataObject.prototype.canMove=function(){
switch(this._updateState){
case 0:
return true;
break;
case 1:
return false;
break;
case 2:
return false;
break;
case 3:
return false;
break;
default:
throw new Error("[Projapi.Base.PJDataObject.canMove] Private field in an unknown state (_updateState)");
}
};
Projapi.Base.PJDataObject.prototype.colValues=function(_384){
var col=this.dataProxy.getCurrentRow(),_386=this.dataProxy.options.columns;
var i,ret=[];
for(i=0;i<_384.length;i++){
ret.push(col[_386.indexByName[_384[i]]]);
}
return ret;
};
Projapi.Base.PJDataObject.prototype.collectColumn=function(_389){
var col=this.dataProxy.options.columns.indexByName[_389];
var _38b=this.dataProxy.cache;
var i,vals=[];
for(i=0;i<_38b.length;i++){
vals.push(_38b[i][col].value);
}
return vals;
};
Projapi.Base.PJDataObject.prototype.commitTransaction=function(){
this.submitCommit();
};
Projapi.Base.PJDataObject.prototype.copyRow=function(_38e){
var dO=this.dataProxy,cols=dO.options.columns;
var row1=dO.getCurrentRow();
var i,row=[];
for(i=0;i<row1.length;i++){
if(!(cols[i].primary||cols[i].name=="rowid")){
row.push(row1[i]);
}else{
row.push("");
}
}
dO.appendRow(row);
dO.options.requestedIndex=-1;
if(dO.options.onCacheChange){
dO.options.onCacheChange();
}
dO._checkCursor();
var ret=[];
for(i=0;i<_38e.length;i++){
ret.push(row[dO.options.columns.indexByName[_38e[i]]]);
}
return ret;
};
Projapi.Base.PJDataObject.prototype.dataAvailable=function(){
if(!this.canMove()){
return;
}
if(!this.hdoFKParent||!this.rgFKMap){
return;
}
this._mustRefreshFK=false;
var cols=[],i;
for(i in this.rgFKMap){
if(!{}[i]&&typeof this.rgFKMap[i]=="string"){
cols.push(i);
}
}
var _397=this.hdoFKParent.colValues(cols),_398=[];
for(i=0;i<cols.length;i++){
_398.push([this.rgFKMap[cols[i]],"eq",_397[i]]);
}
this._lastFKValues=_397;
this.assignQuerySelection(_398);
};
Projapi.Base.PJDataObject.prototype.valueChanged=function(_399,_39a){
if(!this.hdoFKParent||!this.rgFKMap){
return;
}
if(!this.canMove()){
return;
}
var cols=[],i,_39d=true,_39e=[];
for(i in this.rgFKMap){
if(!{}[i]&&typeof this.rgFKMap[i]=="string"){
cols.push(i);
}
}
if(_39a instanceof Array&&cols.length>1){
_39d=(this._lastFKValues&&this._lastFKValues.length==_39a.length);
for(i=0;i<cols.length;i++){
_39e.push([this.rgFKMap[cols[i]],"eq",_39a[i]]);
if(_39d&&_39a[i]!=this._lastFKValues[i]){
_39d=false;
}
}
}else{
var _39f=-1;
if(_399&&_399.getDOColumnName()){
_39f=cols.indexOf(_399.getDOColumnName());
}
if(_39f==-1){
_39e.push([_399.getDOColumnName(),"eq",_39a]);
_39d=false;
}else{
_39e.push([this.rgFKMap[cols[_39f]],"eq",_39a]);
_39d=(this._lastFKValues&&this._lastFKValues.length==1&&this._lastFKValues[0]==_39a);
}
}
if(!_39d){
this._lastFKValues=_39a;
this.assignQuerySelection(_39e);
}
};
Projapi.Base.PJDataObject.prototype.deleteRow=function(_3a0){
this.dataProxy.deleteRow(_3a0||this.dataProxy.getCursor());
};
Projapi.Base.PJDataObject.prototype.emptyRowSet=function(){
this.dataProxy.moveFirst();
this.dataProxy.invalidateCache();
};
Projapi.Base.PJDataObject.prototype.fetchBatch=function(_3a1){
if(!this.canMove()){
return;
}
var dO=this.dataProxy;
if(_3a1&&dO.nextReq){
dO.options.requestedIndex=1;
if(dO.nextReq.parsed){
dO._onRequestComplete.call(dO,dO.nextReq);
}else{
dO.nextReq.makeCurrent=true;
dO._lockThread();
}
return;
}
if(!_3a1&&dO.prevReq){
dO.options.requestedIndex=-1;
if(dO.prevReq.parsed){
dO._onRequestComplete.call(dO,dO.prevReq);
}else{
dO.prevReq.makeCurrent=true;
dO._lockThread();
}
return;
}
var from,dir;
if(_3a1){
from=dO.cache.last();
dir=1;
}else{
from=dO.cache[0];
dir=-1;
}
if(dir==1&&dO.options.hasLastRow){
return;
}else{
if(dir==-1&&dO.options.hasFirstRow){
return;
}
}
if(!from){
return;
}
from=from[dO.options.columns.indexByName.rowid].value;
dO.options.requestedIndex=dir;
dO.getBatch(from,dir);
};
Projapi.Base.PJDataObject.prototype.refresh=function(){
this.dataProxy.refresh();
};
Projapi.Base.PJDataObject.prototype.fetchByVal=function(_3a5,_3a6){
var obj,i;
if(typeof _3a5=="string"){
obj={name:_3a5,value:_3a6};
}else{
for(i in _3a5){
if(!{}[i]){
obj={name:i,value:_3a5[i]};
break;
}
}
}
if(this.canMove()){
this.dataProxy.getBatch(obj,1);
}
};
Projapi.Base.PJDataObject.prototype.fetchFirst=function(){
if(this.canMove()){
this.dataProxy.moveFirst();
}
};
Projapi.Base.PJDataObject.prototype.fetchLast=function(){
if(this.canMove()){
this.dataProxy.moveLast();
}
};
Projapi.Base.PJDataObject.prototype.fetchNext=function(){
if(this.canMove()){
this.dataProxy.moveNext();
}
};
Projapi.Base.PJDataObject.prototype.fetchPrev=function(){
if(this.canMove()){
this.dataProxy.movePrev();
}
};
Projapi.Base.PJDataObject.prototype.fetchRow=function(_3a9){
if(this.canMove()){
this.dataProxy.moveCursor(_3a9);
}
};
Projapi.Base.PJDataObject.prototype.getColumnInfo=function(_3aa){
var cols=this.dataProxy.options.columns;
if(typeof _3aa=="number"){
return cols[_3aa];
}else{
if(typeof _3aa=="string"){
return cols[cols.indexByName[_3aa]];
}else{
throw new Error("[Projapi.Base.PJDataObject.getColumnInfo] Bad parameter");
}
}
};
Projapi.Base.PJDataObject.prototype.getColumns=function(){
return this.dataProxy.options.columns;
};
Projapi.Base.PJDataObject.prototype.getValues=function(){
var m=[],_3ad=this.dataProxy.cache,i,j;
for(i=0;i<_3ad.length;i++){
m[i]=[];
for(j=0;j<_3ad[i].length;j++){
m[i][j]=_3ad[i][j].value;
}
}
return m;
};
Projapi.Base.PJDataObject.prototype.getValuesWithMetadata=function(){
return this.dataProxy.cache;
};
Projapi.Base.PJDataObject.prototype.getHdoFKParent=function(){
return this.hdoFKParent;
};
Projapi.Base.PJDataObject.prototype.getIndex=function(){
return this.dataProxy.getCursor();
};
Projapi.Base.PJDataObject.prototype.getFKMap=function(){
return this.rgFKMap;
};
Projapi.Base.PJDataObject.prototype.getQueryPosition=function(){
return this._queryPosition;
};
Projapi.Base.PJDataObject.prototype.isDataAvailable=function(){
return this._properties.currentIndex>-1&&this.dataProxy.cache.length>0;
};
Projapi.Base.PJDataObject.prototype.queryPosition=function(_3b0){
if(_3b0=="NoRecordAvailable"){
if(!this.hdoFKParent||!this.rgFKMap){
return;
}
var _3b1=[],i;
for(i in this.rgFKMap){
if(!{}[i]&&typeof this.rgFKMap[i]=="string"){
_3b1.push("");
}
}
this._lastFKValues=_3b1;
this.dataProxy._onRequestComplete({parsed:true,status:200,rows:[],info:{hasFirstRow:true,hasLastRow:true}});
this.disableObject();
}else{
if(!this.isObjectEnabled()){
this.enableObject();
}
}
};
Projapi.Base.PJDataObject.prototype.setDefaultValue=function(_3b3,_3b4){
var dO=this.dataProxy;
dO.options.columns[dO.options.columns.indexByName[_3b3]].defaultValue=_3b4;
};
Projapi.Base.PJDataObject.prototype.setDefaultValues=function(_3b6){
var dO=this.dataProxy,i;
if(_3b6.length){
for(i=0;i<_3b6.length;i++){
dO.options.columns[i].defaultValue=_3b6[i];
}
}else{
for(i in _3b6){
if(!{rowid:true}[i]){
dO.options.columns[dO.options.columns.indexByName[i]].defaultValue=_3b6[i];
}
}
}
};
Projapi.Base.PJDataObject.prototype.setQuerySort=function(_3b9){
if(!this.canMove()){
return;
}
this.dataProxy.setSorting(_3b9);
};
Projapi.Base.PJDataObject.prototype.setFK=function(_3ba,_3bb){
if(_3ba){
this.hdoFKParent=_3ba;
}
if(_3bb){
this.rgFKMap={};
for(i in _3bb){
if(!{}[i]&&typeof _3bb[i]=="string"){
this.rgFKMap[i]=_3bb[i];
}
}
}
if(this._lastFKValues){
delete this._lastFKValues;
}
if(this.hdoFKParent&&this.hdoFKParent._objectInitialized&&this.hdoFKParent._properties.currentIndex>-1&&this.rgFKMap){
if(this._objectInitialized){
this.dataAvailable();
}else{
this._mustRefreshFK=true;
}
}
};
Projapi.Base.PJDataObject.prototype.submitCommit=function(_3bc,_3bd){
this.dataProxy.sync();
};
Projapi.Base.PJDataObject.prototype.submitRow=function(_3be,_3bf){
var dO=this.dataProxy;
if(dO.options.currentIndex==-1){
dO.moveFirst();
}
if(_3be){
dO.changeRow(_3be,_3bf);
}else{
dO.changed.append={after:dO.cache[dO.cache.length-1]=dO.rowObjectToVector(_3bf,dO.options.currentIndex)};
}
this.submitCommit();
};
Projapi.Base.PJDataObject.prototype.undoTransaction=function(){
this.cancelRow();
};
Projapi.Base.PJDataObject.prototype.updateRow=function(_3c1){
var obj=this.dataProxy;
var _3c3=obj.getCurrentRow();
for(i in _3c1){
if(!{rowid:true}[i]){
_3c3[obj.options.columns.indexByName[i]]=_3c1[i];
}
}
obj.changeRow(this.dataProxy.getCursor(),_3c3);
};
Projapi.Base.PJDataObject.prototype.updateState=function(_3c4){
this._updateState=["UpdateComplete","UpdateBegin","Update","UpdateEnd"].indexOf(_3c4);
if(this._updateSource&&this._updateSource.getObjectMode()!="View"){
this.publish(Projapi.Links.Data.UpdateState,_3c4);
if(_3c4=="UpdateBegin"||_3c4=="Update"){
for(var idx=0,len=this.dataTargets.length;idx<len;idx++){
if(this.dataTargets[idx].getObjectType()=="PJDataObject"){
this.dataTargets[idx].disableObject();
}
}
}else{
for(var idx=0,len=this.dataTargets.length;idx<len;idx++){
if(this.dataTargets[idx].getObjectType()=="PJDataObject"&&this._queryPosition!="NoRecordAvailable"){
this.dataTargets[idx].enableObject();
}
}
}
}else{
if(_3c4=="UpdateBegin"||_3c4=="Update"){
this.disableObject();
}else{
this.enableObject();
}
}
};
Projapi.Base.PJDataObject.DataProxy=function(name,_3c8){
this.name=name;
this.options=_3c8;
this.cache=[];
this.changed={deleted:[]};
this.requestPending=false;
this.prevReq=null;
this.nextReq=null;
this.options.columns.getByName={};
this.options.columns.indexByName={};
for(var i=0;i<this.options.columns.length;i++){
this.options.columns.getByName[this.options.columns[i].name]==this.options.columns[i];
this.options.columns.indexByName[this.options.columns[i].name]=i;
}
this._filterStr="";
if(this.options.url==""){
this.options.url=null;
}
this._onRequestComplete=this.__onRequestComplete.bind(this);
};
Projapi.Base.PJDataObject.DataProxy.prototype.initializeObject=function(){
if(this.options.OpenOnInit){
if(this.cache&&this.cache.length>0){
if(this.options.currentIndex==-1){
this._checkCursor();
}
}else{
if(!this._requestPending){
this.invalidateCache();
}
}
}
};
Projapi.Base.PJDataObject.DataProxy.prototype.rowObjectToVector=function(obj,_3cb){
var row=[],i;
if(typeof _3cb!="undefined"){
if(typeof _3cb=="string"){
_3cb=this._findRowByColumn("rowid",_3cb);
}
for(i=0;i<this.cache[_3cb].length;i++){
row.push(this.cache[_3cb][i]);
}
}else{
for(i=0;i<this.options.columns.length;i++){
row.push({value:this.options.columns[i].defaultValue||""});
}
}
for(i in obj){
if(!{rowid:true}[i]){
row[this.options.columns.indexByName[i]]={value:obj[i]};
}
}
return row;
};
Projapi.Base.PJDataObject.DataProxy.prototype.appendRow=function(_3ce){
var i;
if(this.options.readOnly){
throw new Error("[Projapi.Base.PJDataObject.DataProxy.appendRow] Cannot append data in read-only mode (readOnly = "+this.options.readOnly+")");
}
if(this.changed.append&&this.options.url){
throw new Error("[Projapi.Base.PJDataObject.DataProxy.appendRow] An appended row is already waiting to be commited. Sync with server first.");
}
if(_3ce.length){
this.changed.append={after:[]};
for(i=0;i<_3ce.length;i++){
this.changed.append.after[i]={value:_3ce[i]};
}
}else{
var row=[];
for(i=0;i<this.options.columns.length;i++){
row.push({value:this.options.columns[i].defaultValue||""});
}
for(i in _3ce){
if(!{rowid:true}[i]){
row[this.options.columns.indexByName[i]]={value:_3ce[i]};
}
}
this.changed.append={after:row};
}
this.cache.push(this.changed.append.after);
};
Projapi.Base.PJDataObject.DataProxy.prototype.changeRow=function(_3d1,_3d2){
var _3d3=_3d1,i,v;
if(typeof _3d1=="string"){
_3d1=this._findRowByColumn("rowid",_3d1);
}else{
_3d3=this.cache[_3d1][this.options.columns.indexByName.rowid].value;
}
if(this.options.readOnly){
throw new Error("[Projapi.Base.PJDataObject.DataProxy.changeRow] Cannot change data in read-only mode ("+this.options.readOnly+")");
}
if(_3d2.length){
for(i=0;i<_3d2.length;i++){
if(typeof _3d2[i]=="string"){
_3d2[i]={value:_3d2[i]};
}
}
for(i=_3d2.length;i<this.cache[_3d1].length;i++){
_3d2.push(this.cache[_3d1][i]);
}
v=_3d2;
}else{
v=[];
for(i=0;i<this.cache[_3d1].length;i++){
v.push(this.cache[_3d1][i]);
}
for(i in _3d2){
if(!{rowid:true}[i]){
v[this.options.columns.indexByName[i]]=(typeof _3d2[i]=="string")?{value:_3d2[i]}:_3d2[i];
}
}
}
if(this.changed.append&&this.cache[_3d1]==this.changed.append.after){
this.changed.append.after=v;
}else{
if(!this.changed[_3d3]){
this.changed[_3d3]={before:this.cache[_3d1]};
}
this.changed[_3d3].after=v;
}
v.before=true;
v.after=true;
this.cache[_3d1]=v;
for(v in this.changed[_3d3]){
if(typeof this.cache[_3d1][v]=="undefined"){
this.cache[_3d1][v]=this.changed[_3d3][v];
}
}
for(i=0;i<this.cache[_3d1].length;i++){
for(v in this.changed[_3d3].before[i]){
if(typeof this.cache[_3d1][i][v]=="undefined"){
this.cache[_3d1][i][v]=this.changed[_3d3].before[i][v];
}
}
}
};
Projapi.Base.PJDataObject.DataProxy.prototype.changeRowColumn=function(_3d6,_3d7,_3d8){
if(typeof _3d6=="string"){
_3d6=this._findRowByColumn("rowid",_3d6);
}
if(!this.cache[_3d6]){
throw new Error("[Projapi.Base.PJDataObject.DataProxy.changeRowColumn] Cannot modify a single row column without first loading the row. Try again after you view the row.");
}
if(this.options.readOnly){
throw new Error("[Projapi.Base.PJDataObject.DataProxy.changeRowColumn] Cannot change data in read-only mode ("+this.options.readOnly+")");
}
var idx=(typeof _3d7=="string")?this.options.columns.indexByName[_3d7]:_3d7;
var i,row=[];
for(i=0;i<idx;i++){
row.push(this.cache[_3d6][i]);
}
row.push((typeof _3d8=="string")?{value:_3d8}:_3d8);
for(i=idx+1;i<this.cache[_3d6].length;i++){
row.push(this.cache[_3d6][i]);
}
this.changeRow(_3d6,row);
};
Projapi.Base.PJDataObject.DataProxy.prototype.deleteRow=function(_3dc){
var i,_3de=_3dc,b4;
if(typeof _3dc!="string"){
_3dc=this.cache[_3dc][this.options.columns.indexByName.rowid].value;
}else{
_3de=this._findRowByColumn("rowid",_3dc);
}
if(this.changed.deleted){
for(i=this.changed.deleted.length-1;i>=0;i--){
if(this.changed.deleted[i].rowId==_3dc){
throw new Error("[Projapi.Base.PJDataObject.DataProxy.deleteRow] Row '"+_3dc+"' has alredy been marked for deletion");
}
}
}
if(this.options.readOnly){
throw new Error("[Projapi.Base.PJDataObject.DataProxy.deleteRow] Cannot delete data in read-only mode ("+this.options.readOnly+")");
}
if(this.changed[_3dc]){
b4=this.changed[_3dc].before;
delete this.changed[_3dc];
}else{
b4=this.cache[_3de];
}
if(!this.changed.deleted){
this.changed.deleted=[];
}
this.changed.deleted.push({rowId:_3dc,rowIdx:_3de,before:b4});
if(this.options.autoSync){
this.sync();
}
};
Projapi.Base.PJDataObject.DataProxy.prototype._makeFetchHead=function(_3e0){
var head=["<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n","<dao-msg>\n","\t<head>\n"];
var i,_3e3={prefetch:false};
Object.extend(_3e3,_3e0);
Object.extend(_3e3,this.options.params);
for(i in _3e3){
if(!{}[i]){
head.push("\t\t<");
head.push(i);
head.push(">");
head.push(_3e3[i]);
head.push("</");
head.push(i);
head.push(">\n");
}
}
return head.join("");
};
Projapi.Base.PJDataObject.DataProxy.prototype.getBatch=function(_3e4,dir,_3e6){
var i;
this._lockThread();
if(_3e4=="first"){
this.options.requestedIndex=-1/0;
}else{
if(_3e4=="last"){
this.options.requestedIndex=1/0;
}
}
if(typeof _3e6=="undefined"){
_3e6=(typeof _3e4=="string")&&(["first","last"].indexOf(_3e4)==-1);
}
this.dirtyCache=this.cache;
this.cache=[];
var _3e8={action:"sendRows",batchSize:dir*this.options.batchSize,skipRow:_3e6};
if(typeof _3e4=="string"){
_3e8.startRowId=_3e4;
}else{
this.options.requestedIndex=0;
_3e8.findColumnName=_3e4.name;
_3e8.findColumnValue=_3e4.value;
}
if(Projapi.Base.PJDataObject.logRequests){
console.log("DAO \""+this.options.__DataObjectReference._objectName+"\" -> request from getBatch");
}
this.finalizeRequest("xml="+encodeURIComponent([this._makeFetchHead(_3e8),"\t</head>\n",this._filterStr,"</dao-msg>"].join("")),this._onRequestComplete);
};
Projapi.Base.PJDataObject.DataProxy.prototype.refresh=function(){
if(this.cache.length>0){
this.getBatch(this.cache[0][this.options.columns.indexByName.rowid].value,1,false);
}else{
this.getBatch("first",1);
}
};
Projapi.Base.PJDataObject.DataProxy.prototype.getCurrentRow=function(){
if(this.options.currentIndex==-1){
this.moveFirst();
}
var i,row=[],from=this.cache[this.options.currentIndex];
if(from){
for(i=0;i<from.length;i++){
row.push(from[i].value);
}
}else{
for(i=0;i<this.options.columns.length;i++){
row.push("");
}
}
return row;
};
Projapi.Base.PJDataObject.DataProxy.prototype.getCursor=function(){
if(this.options.currentIndex==-1){
this.moveFirst();
}
return this.options.currentIndex;
};
Projapi.Base.PJDataObject.DataProxy.prototype.invalidateCache=function(){
if(!this.options.url){
return;
}
this.options.hasFirstRow=false;
this.options.hasLastRow=false;
this.getBatch("first",1);
};
Projapi.Base.PJDataObject.DataProxy.prototype.lock=function(_3ec){
this.options.readOnly=String(_3ec);
};
Projapi.Base.PJDataObject.DataProxy.prototype.moveCursor=function(_3ed){
if(typeof _3ed=="string"){
_3ed=this._findRowByColumn("rowid",_3ed);
}
if(this.cache.length==0||this.options.currentIndex==_3ed){
return;
}
if(_3ed<0){
if(this.options.hasFirstRow){
_3ed=0;
}else{
this.options.requestedIndex=_3ed;
if(this.prevReq){
if(this.prevReq.parsed){
this._onRequestComplete(this.prevReq);
}else{
this._lockThread();
this.prevReq.makeCurrent=true;
}
}else{
this.getBatch(this.cache[0][this.options.columns.indexByName.rowid].value,-1);
}
return;
}
}else{
if(_3ed>=this.cache.length){
if(this.options.hasLastRow){
_3ed=this.cache.length-1;
}else{
this.options.requestedIndex=_3ed-this.cache.length+1;
if(this.nextReq){
if(this.nextReq.parsed){
this._onRequestComplete(this.nextReq);
}else{
this._lockThread();
this.nextReq.makeCurrent=true;
}
}else{
this.getBatch(this.cache.last()[this.options.columns.indexByName.rowid].value,1);
}
return;
}
}
}
this._checkCursor(_3ed);
};
Projapi.Base.PJDataObject.DataProxy.prototype.moveFirst=function(){
if(this.options.hasFirstRow){
if(this.cache.length>0){
this.moveCursor(0);
}
}else{
this.invalidateCache();
}
};
Projapi.Base.PJDataObject.DataProxy.prototype.moveLast=function(){
if(this.options.hasLastRow){
this.moveCursor(this.cache.length-1);
}else{
this.getBatch("last",-1);
this._checkCursor();
}
};
Projapi.Base.PJDataObject.DataProxy.prototype.moveNext=function(){
if(this.options.currentIndex==-1){
this.moveFirst();
}
if(this.options.currentIndex==this.cache.length-1){
if(this.options.hasLastRow){
return;
}else{
if(this.cache.length==0){
return;
}
this.options.requestedIndex=1;
if(this.nextReq){
if(this.nextReq.parsed){
this._onRequestComplete(this.nextReq);
}else{
this._lockThread();
this.nextReq.makeCurrent=true;
}
}else{
this.getBatch(this.cache.last()[this.options.columns.indexByName.rowid].value,1);
}
}
}else{
this.moveCursor(this.options.currentIndex+1);
}
};
Projapi.Base.PJDataObject.DataProxy.prototype.movePrev=function(){
if(this.options.currentIndex==-1){
this.moveFirst();
}
if(this.options.currentIndex==0){
if(this.options.hasFirstRow){
return;
}else{
if(this.cache.length==0){
return;
}
this.options.requestedIndex=-1;
if(this.prevReq){
if(this.prevReq.parsed){
this._onRequestComplete(this.prevReq);
}else{
this._lockThread();
this.prevReq.makeCurrent=true;
}
}else{
this.getBatch(this.cache[0][this.options.columns.indexByName.rowid].value,-1);
}
}
}else{
this.moveCursor(this.options.currentIndex-1);
}
};
Projapi.Base.PJDataObject.DataProxy.prototype.setFilters=function(_3ee){
if(!this.options.url){
throw new Error("[Projapi.Base.PJDataObject.DataProxy.setFilters] You can't filter local data.");
}
var i,xml=[this._makeFetchHead({action:"sendRows",startRowId:"first",batchSize:this.options.batchSize,skipRow:false}),"\t</head>\n"],fXml=["\t<filter>\n"];
var _3f2={},_3f3=this._lastFilters||{},diff=false,name;
for(i=0;i<_3ee.length;i++){
name=_3ee[i][0];
fXml.push("\t\t<col name=\"");
fXml.push(name);
fXml.push("\" op=\"");
fXml.push(_3ee[i][1]);
fXml.push("\">");
fXml.push(_3ee[i][2]);
fXml.push("</col>\n");
if(!_3f3[name]){
_3f3[name]=[name,_3ee[i][1],"null"];
}
_3f2[name]=[_3ee[i][0],_3ee[i][1],_3ee[i][2]];
if((_3f2[name][1]!=_3f3[name][1])||((_3f2[name][2]!=_3f3[name][2])&&(!!_3f3[name][2]||!/^(null|[\x01-\x09])*$/.test(_3f2[name][2])))){
diff=true;
}
}
if(!diff){
return;
}
this._lockThread();
this._lastFilters=_3f2;
fXml.push("\t</filter>\n");
xml.push(fXml=fXml.join(""));
if(this.options.sendFilterEveryTime){
this._filterStr=fXml;
}
xml.push("</dao-msg>");
xml="xml="+encodeURIComponent(xml.join(""));
this.sync();
this.options.requestedIndex=-1/0;
if(Projapi.Base.PJDataObject.logRequests){
console.log("DAO \""+this.options.__DataObjectReference._objectName+"\" -> request from apply filters");
}
this.finalizeRequest(xml,this._onRequestComplete);
};
Projapi.Base.PJDataObject.DataProxy.prototype.setRequestParam=function(_3f6,_3f7){
this.options.params[String(_3f6)]=String(_3f7);
};
Projapi.Base.PJDataObject.DataProxy.prototype.setSorting=function(_3f8){
if(!this.options.url){
throw new Error("You can't sort local data.");
}
var i,xml=[this._makeFetchHead({action:"sendRows",startRowId:"first",batchSize:this.options.batchSize,skipRow:false}),"\t</head>\n",this._filterStr,"\t<sort>\n"];
for(i=0;i<_3f8.length;i++){
xml.push("\t\t<col name=\"");
xml.push(_3f8[i][0]);
xml.push("\">");
xml.push(_3f8[i][1]);
xml.push("</col>\n");
}
xml.push("\t</sort>\n");
xml.push("</dao-msg>");
xml="xml="+encodeURIComponent(xml.join(""));
this.sync();
this.options.requestedIndex=-1/0;
if(Projapi.Base.PJDataObject.logRequests){
console.log("DAO \""+this.options.__DataObjectReference._objectName+"\" -> request from apply sorting");
}
this.finalizeRequest(xml,this._onRequestComplete);
};
Projapi.Base.PJDataObject.DataProxy.prototype.sync=function(){
var _3fb,i;
if(!this.options.url){
if(this.changed.append){
delete this.changed.append;
}
if(this.changed.deleted){
for(i=0;i<this.changed.deleted.length;i++){
for(j=0;j<this.cache.length;j++){
if(this.cache[j]==this.changed.deleted[i].before){
this.cache.splice(j,1);
break;
}
}
}
}
this.changed={deleted:[]};
if(!this.options.requestedIndex){
this.options.requestedIndex=0;
}
this._checkCursor();
if(this.options.onCacheChange){
try{
this.options.onCacheChange();
}
catch(e){
console.debug("Exception in onCacheChange handler: %o",e);
}
}
return;
}
var cols=this.options.columns;
var srid=(this.cache&&this.cache.length>0)?this.cache[0][cols.indexByName.rowid].value:"first";
var xml=[this._makeFetchHead({action:"submitCommit",startRowId:srid,batchSize:this.options.batchSize,skipRow:false}),"\t</head>\n",this._filterStr,"\t<rows>\n"];
var _400=function(row){
var i;
if(row.before){
xml.push("\t\t\t<rowImage when=\"before\">\n");
for(i=0;i<row.before.length;i++){
xml.push("\t\t\t\t<col name=\"");
xml.push(cols[i].name);
xml.push("\">");
xml.push(row.before[i].value.replace(/&/g,"&amp;").replace(/</g,"&lt;"));
xml.push("</col>\n");
}
xml.push("\t\t\t</rowImage>\n");
}
if(row.after){
xml.push("\t\t\t<rowImage when=\"after\">\n");
for(i=0;i<row.after.length;i++){
xml.push("\t\t\t\t<col name=\"");
xml.push(cols[i].name);
xml.push("\">");
xml.push(row.after[i].value.replace(/&/g,"&amp;").replace(/</g,"&lt;"));
xml.push("</col>\n");
}
xml.push("\t\t\t</rowImage>\n");
}
};
for(_3fb in this.changed){
if(!{append:true,deleted:true}[_3fb]){
xml.push("\t\t<row>\n\t\t\t<rowId>");
xml.push(_3fb);
xml.push("</rowId>\n");
xml.push("\t\t\t<rowState>2</rowState>\n");
_400(this.changed[_3fb]);
xml.push("\t\t</row>\n");
}
}
if(this.changed.deleted){
for(i=0;i<this.changed.deleted.length;i++){
xml.push("\t\t<row>\n\t\t\t<rowId>");
xml.push(this.changed.deleted[i].rowId);
xml.push("</rowId>\n");
xml.push("\t\t\t<rowState>3</rowState>\n");
_400(this.changed.deleted[i]);
xml.push("\t\t</row>\n");
}
}
if(this.changed.append){
xml.push("\t\t<row>\n");
xml.push("\t\t\t<rowId></rowId>\n");
xml.push("\t\t\t<rowState>1</rowState>\n");
_400(this.changed.append);
xml.push("\t\t</row>\n");
}
if(xml.last()=="\t<rows>\n"){
if(this.options.onAfterSync){
this.options.onAfterSync();
}
return;
}
xml.push("\t</rows>\n");
xml.push("</dao-msg>");
xml="xml="+encodeURIComponent(xml.join(""));
if(!this.options.requestedIndex){
this.options.requestedIndex=0;
}
this.options.readOnly="Synchronizing with server";
this._lockThread(true);
var _403=this;
var _404=setTimeout(function(){
_404=setTimeout(function(){
_403.options.readOnly=false;
alert(_403.options.__DataObjectReference.getMessage("msg_dataobject_save_error"));
}.bind(this),this.options.threadTimeout);
}.bind(this),10);
if(Projapi.Base.PJDataObject.logRequests){
console.log("DAO \""+this.options.__DataObjectReference._objectName+"\" -> request from sync");
}
this.finalizeRequest(xml,(function(_405){
if(!_405){
return;
}
clearTimeout(_404);
this.options.readOnly=false;
if(this.requestPending){
clearTimeout(this.requestPending);
this.requestPending=null;
var vec=this.options.__DataObjectReference._notifyOnRequest.clone();
for(var i=0;i<vec.length;i++){
vec[i](false);
}
}
if(_405.status>=300){
alert(_403.options.__DataObjectReference.getMessage("msg_dataobject_server_save_error").replace(/%d/,String(_405.status)));
return;
}
if(true||this.options.readOnly!="Synchronizing with server"){
this.dirtyCache=this.cache;
this.cache=[];
}
var i,_408;
if(this._onRequestComplete(_405,true,true).updateSuccess){
for(i in this.changed){
if(!{deleted:true}[i]){
delete this._lastFilters;
break;
}
}
_408={deleted:false};
if(this.changed.deleted&&this.changed.deleted.length>0){
_408.deleted=true;
}
this.changed={deleted:[]};
if(this.options.onAfterSync){
this.options.onAfterSync();
}
if(_408.deleted&&this.options.onAfterDelete){
this.options.onAfterDelete();
}
for(i=0;i<Projapi.Base.PJDataObject.instances.length;i++){
if(Projapi.Base.PJDataObject.instances[i]!=this.options.__DataObjectReference&&Projapi.Base.PJDataObject.instances[i]._properties.url==this.options.url){
Projapi.Base.PJDataObject.instances[i].refresh();
}
}
}else{
if(this.options.autoSync){
this.undoAll({deleted:true});
}
}
}).bind(this),true);
};
Projapi.Base.PJDataObject.DataProxy.prototype.undoAll=function(_409){
var chd=false,i,_40c,_40d,_40e;
if(typeof _409=="undefined"){
_40c=_40d=_40e=true;
}else{
_40c=!!_409.appended||!!_409.all;
_40d=!!_409.changed||!!_409.all;
_40e=!!_409.deleted||!!_409.all;
}
this.options.requestedIndex="repos";
if(this.changed.append&&_40c){
delete this.changed.append;
this.cache.pop();
chd=true;
}
if(_40e&&this.changed.deleted&&this.changed.deleted.length>0){
this.changed.deleted=[];
}
if(_40d){
for(i in this.changed){
if(!{deleted:true}[i]){
chd=true;
this.cache[this._findRowByColumn("rowid",i)]=this.changed[i].before;
}
}
}
if(chd){
this.changed={deleted:[]};
if(this.options.onCacheChange){
this.options.onCacheChange();
}
this._checkCursor(null,true);
}
};
Projapi.Base.PJDataObject.DataProxy.prototype.unlock=function(){
this.options.readOnly=false;
};
Projapi.Base.PJDataObject.DataProxy.prototype._checkCursor=function(_40f,_410){
var _411=this;
if(!this.options.__DataObjectReference._objectInitialized){
return;
}
if((this.cache.length==0)&&(typeof _410=="undefined"||!_410)){
return;
}
var _412=this.options.currentIndex;
switch(this.options.requestedIndex){
case -1/0:
this.options.currentIndex=0;
break;
case 1/0:
this.options.currentIndex=this.cache.length-1;
break;
default:
if(this.options.requestedIndex<0){
this.options.currentIndex=this.cache.length+this.options.requestedIndex;
}else{
if(this.options.requestedIndex>0){
this.options.currentIndex=this.options.requestedIndex-1;
}else{
if(typeof _40f!="number"){
_40f=this.options.currentIndex;
}
this.options.currentIndex=Math.min(_40f,this.cache.length-1);
}
}
}
if(this.options.onCursorMove&&((typeof _40f=="number")||(this.options.requestedIndex!=null))){
this.options.onCursorMove(_412,this.options.currentIndex);
}
this.options.requestedIndex=null;
this._preparePosition(this.options.currentIndex);
};
Projapi.Base.PJDataObject.DataProxy.prototype._preparePosition=function(_413){
if(this.cache.length==0||!this.options.url){
return;
}
var xml=[];
var req1,req2;
if(!this.prevReq&&!this.options.hasFirstRow&&(_413-this.options.margin<0)){
if(Projapi.Base.PJDataObject.logRequests){
console.log("DAO \""+this.options.__DataObjectReference._objectName+"\" -> request from prefetch-behind");
}
this.prevReq=req1=this.finalizeRequest("xml="+encodeURIComponent([this._makeFetchHead({action:"sendRows",startRowId:this.cache[0][this.options.columns.indexByName.rowid].value,batchSize:0-this.options.batchSize,skipRow:true,prefetch:true}),"\t</head>\n",this._filterStr,"</dao-msg>"].join("")),(function(_417){
if(!_417||_417.status>=300||this.prevReq!=req1){
this.prevReq=null;
return;
}
var _418=this.prevReq.makeCurrent;
if(_417.parsed){
this.prevReq=_417;
}else{
this.prevReq=_417.responseText.parseJSON();
this.prevReq.status=_417.status;
this.prevReq.parsed=true;
}
if(this.cache.length&&this._findRowByColumn("rowid",this.cache[0][this.options.columns.indexByName.rowid].value,this.prevReq.rows)==null){
this.prevReq.nextReq={rows:this.cache,info:{hasFirstRow:this.options.hasFirstRow,hasLastRow:this.options.hasLastRow},status:200,parsed:true};
this.prevReq.nextReq.prevReq=this.prevReq;
}
if((this.options.requestedIndex<0&&!this.requestPending)||_418){
this._onRequestComplete(this.prevReq);
}else{
if(this.prevReq.info.hasLastRow){
this.prevReq.info.newPosition=this._findRowByColumn("rowid",this.cache[this.options.currentIndex][this.options.columns.indexByName.rowid].value,this.prevReq.rows);
this._onRequestComplete(this.prevReq);
}
}
}).bind(this));
}
if(!this.nextReq&&!this.options.hasLastRow&&(_413+this.options.margin>=this.cache.length)){
if(Projapi.Base.PJDataObject.logRequests){
console.log("DAO \""+this.options.__DataObjectReference._objectName+"\" -> request from prefetch-ahead");
}
this.nextReq=req2=this.finalizeRequest("xml="+encodeURIComponent([this._makeFetchHead({action:"sendRows",startRowId:this.cache.last()[this.options.columns.indexByName.rowid].value,batchSize:this.options.batchSize,skipRow:true}),"\t</head>\n",this._filterStr,"</dao-msg>"].join("")),(function(_419){
if(!_419||_419.status!=200||this.nextReq!=req2){
this.nextReq=null;
return;
}
var _41a=this.nextReq.makeCurrent;
if(_419.parsed){
this.nextReq=_419;
}else{
this.nextReq=_419.responseText.parseJSON();
this.nextReq.status=200;
this.nextReq.parsed=true;
}
if(this.cache.length&&this._findRowByColumn("rowid",this.cache.last()[this.options.columns.indexByName.rowid].value,this.nextReq.rows)==null){
this.nextReq.prevReq={rows:this.cache,info:{hasFirstRow:this.options.hasFirstRow,hasLastRow:this.options.hasLastRow},status:200,parsed:true};
this.nextReq.prevReq.nextReq=this.nextReq;
}
if((this.options.requestedIndex>0&&!this.requestPending)||_41a){
this._onRequestComplete(this.nextReq);
}
}).bind(this));
}
};
Projapi.Base.PJDataObject.DataProxy.prototype._findRowByColumn=function(_41b,_41c,_41d){
if(typeof _41d=="undefined"||!_41d){
_41d=this.cache;
}
if(typeof _41b=="string"){
_41b=this.options.columns.indexByName[_41b];
}
if(_41b<0){
throw new Error("[DataObject.DataProxy._findRowByColumn] Column not found.");
}
var i=this.options.currentIndex;
if(_41d[i]&&_41d[i].length>_41b&&_41d[i][_41b].value==_41c){
return i;
}
for(i=0;i<_41d.length;i++){
if(_41d[i]&&_41d[i].length>_41b&&_41d[i][_41b].value==_41c){
return i;
}
}
return null;
};
Projapi.Base.PJDataObject.DataProxy.prototype.finalizeRequest=function(_41f,_420,_421){
return new Projapi.Request(this.options.url,{method:"post",asynchronous:true,onComplete:_420,postBody:_41f,domain:this.options.__DataObjectReference._updateSource||this.options.__DataObjectReference,handlesServerError:true});
};
Projapi.Base.PJDataObject.DataProxy.prototype._lockThread=function(_422){
var _423=this;
var i;
if(this.options.threadTimeout){
if(this.requestPending){
console.error("[Projapi.Base.PJDataObject.DataProxy._lockThread] DataObject \""+_423.options.__DataObjectReference._objectName+"\" cannot create server reqest, working in single-threaded mode.");
}else{
if(typeof _422=="undefined"||!_422){
this.options.__DataObjectReference.publish(Projapi.Links.Navigation.QueryPosition,"BusyBufferReloading");
}
var vec=this.options.__DataObjectReference._notifyOnRequest.clone();
for(i=0;i<vec.length;i++){
vec[i](true);
}
this.requestPending=setTimeout(function(){
_423.requestPending=setTimeout(function(){
_423.requestPending=null;
for(i=0;i<vec.length;i++){
vec[i](false);
}
alert(_423.options.__DataObjectReference.getMessage("msg_dataobject_timeout"));
},_423.options.threadTimeout);
},10);
}
}
};
Projapi.Base.PJDataObject.DataProxy.prototype.__onRequestComplete=function(_426,_427,_428){
if(!_426){
return;
}
if(this.requestPending){
clearTimeout(this.requestPending);
this.requestPending=null;
var vec=this.options.__DataObjectReference._notifyOnRequest.clone();
for(var i=0;i<vec.length;i++){
vec[i](false);
}
}
if(_426.status>=300){
alert(this.options.__DataObjectReference.getMessage("msg_dataobject_server_error").replace(/%d/,String(_426.status)));
return;
}
var _42b=false;
var _42c=null;
if(this.cache&&this.options.currentIndex>-1&&this.options.currentIndex<this.cache.length){
_42c=this.cache[this.options.currentIndex][this.options.columns.indexByName.rowid].value;
}
var resp,ret={};
if(!_426.parsed){
resp=_426.responseText.parseJSON();
}else{
resp=_426;
}
if(resp.rows){
if(_426.parsed){
this.prevReq=_426.prevReq||null;
this.nextReq=_426.nextReq||null;
}else{
this.prevReq=null;
this.nextReq=null;
}
}
var max=0;
var i,j,k;
if(resp.rows){
this.cache=resp.rows;
for(i=0;i<this.cache.length;i++){
if(this.cache[i].cells){
for(k in this.cache[i]){
if(typeof this.cache[i].cells[k]=="undefined"){
this.cache[i].cells[k]=this.cache[i][k];
}
}
this.cache[i]=this.cache[i].cells;
}
for(j=0;j<this.cache[i].length;j++){
if(typeof this.cache[i][j]=="string"){
this.cache[i][j]={value:this.cache[i][j]};
}
}
}
this._applyRules();
}else{
if(this.dirtyCache){
_42b=true;
this.cache=this.dirtyCache;
this.options.requestedIndex=0;
}
}
if(this.dirtyCache){
delete this.dirtyCache;
}
if(resp.rows&&resp.info){
this.options.hasLastRow=!!resp.info.hasLastRow;
this.options.hasFirstRow=!!resp.info.hasFirstRow;
}
if(!resp.messages){
ret.updateSuccess=true;
}else{
if(Projapi.WarningManager&&this.options.__DataObjectReference._updateSource){
try{
if(this.options.__DataObjectReference._updateSource&&this.options.__DataObjectReference._updateSource.translateColumnsInMessage){
this.options.__DataObjectReference._updateSource.translateColumnsInMessage(resp.messages);
}
Projapi.WarningManager.process(resp.messages,this.options.__DataObjectReference._updateSource);
Projapi.WarningManager.mark(this.options.__DataObjectReference._updateSource);
ret.updateSuccess=Projapi.WarningManager.isSuccess(this.options.__DataObjectReference._updateSource);
}
catch(e){
console.error(e);
}
}
}
if(!_42b&&((typeof _428=="undefined")||!_428||!ret.updateSuccess)){
this._applyChanges();
}
var p=null;
if(resp.info&&resp.info.newPosition){
p=resp.info.newPosition;
if(typeof p=="string"){
if(p.match(/^\d+$/)){
p=parseInt(p);
}else{
p=this._findRowByColumn("rowid",p);
}
}
resp.info.newPosition=null;
}else{
if(_42c!=null){
p=this._findRowByColumn("rowid",_42c);
}
}
if(typeof p=="number"){
this.options.requestedIndex=null;
this._checkCursor(p);
}else{
this._checkCursor(null,true);
}
if((resp.rows||(typeof _427!="undefined"&&_427&&ret.updateSuccess))&&this.options.onCacheChange){
try{
this.options.onCacheChange();
}
catch(e){
console.debug("Exception in onCacheChange handler: %o",e);
}
}
return ret;
};
Projapi.Base.PJDataObject.DataProxy.prototype._syncd=function(){
for(i in this.changed){
if(!{deleted:true}[i]){
return false;
}
}
if(this.changed.deleted&&this.changed.deleted.length>0){
return false;
}
return true;
};
Projapi.Base.PJDataObject.DataProxy.prototype._applyChanges=function(){
var _433=this.options.columns.indexByName.rowid,i,idx,_436,k;
if(this.changed.append&&this.changed.append.after!=this.cache[this.cache.length-1]){
this.cache.push(this.changed.append.after);
}
for(_436 in this.changed){
if(!{append:true,deleted:true}[i]){
for(i=0;i<this.cache.length;i++){
if(this.cache[i][_433].value==_436){
for(idx=0;idx<this.cache[i].length;idx++){
if(this.changed[_436].before[idx].value==this.changed[_436].after[idx].value){
this.changed[_436].after[idx]={};
for(k in this.cache[i][idx]){
this.changed[_436].after[idx][k]=this.cache[i][idx][k];
}
}
}
this.changed[_436].before=this.cache[i];
this.cache[i]=this.changed[_436].after;
break;
}
}
}
}
if(this.changed.deleted){
for(i=0;i<this.changed.deleted.length;i++){
this.changed.deleted[i].rowIdx=0;
for(idx=0;idx<this.cache.length;idx++){
if(this.cache[idx][_433].value==this.changed.deleted[i].rowId){
this.changed.deleted[i].rowIdx=idx;
this.changed.deleted[i].before=this.cache[idx];
break;
}
}
}
}
};
Projapi.Base.PJDataObject.DataProxy.prototype._applyRules=function(_438){
var _439,i,j,k;
if(typeof _438=="undefined"){
_439=this.options.rules;
}else{
if(typeof _438.length=="undefined"){
_439=[_438];
}else{
_439=_438;
}
}
try{
for(k=0;k<_439.length;k++){
if(!_439[k].compiled){
this._compileRule(_439[k]);
}
if(_439[k].type=="row"){
for(i=0;i<this.cache.length;i++){
_439[k].compiled(this.cache[i],null,i,null);
}
}else{
if(_439[k].type=="cell"){
for(i=0;i<this.cache.length;i++){
for(j=0;j<this.cache[i].length;j++){
_439[k].compiled(this.cache[i],this.cache[i][j],i,j);
}
}
}
}
}
}
catch(e){
console.log("rule error: %o",e);
}
};
Projapi.Base.PJDataObject.DataProxy.prototype._compileRule=function(rule){
var vars=[],varz="",i,j,m,dO=this,_444=Projapi.Base.PJDataObject.DataProxy.ruleVariables;
for(i in _444){
if(_444[i].regex&&(m=rule.code.match(_444[i].regex))){
if(!_444[i].scope||_444[i].scope==rule.type){
vars.push(i);
rule.code=rule.code.replace(_444[i].regex,_444[i].code);
}else{
console.error("Unable to use variable in rule because scope is not compatible. Variable: %s (%o)",i,_444[i]);
}
}
}
eval("rule.compiled = function (row, cell, rowIdx, cellIdx) {\n"+rule.code+"\n}");
};
Projapi.Base.PJDataObject.DataProxy.ruleVariables={_prepare:function(){
var i;
for(i in this){
if(this[i].code){
this[i].regex=new RegExp("([^a-zA-Z0-9._])"+i+"\\b","g");
this[i].code="$1"+this[i].code;
}
}
delete this._prepare;
},cellDate:{code:"((row[cellIdx].value)? row[cellIdx].value.match(/\\d+/g)[Projapi.Globals.LOCALE_DATE_FORMAT.indexOf('d')] : NaN)",desc:"date from cell",scope:"cell"},cellMonth:{code:"((row[cellIdx].value)? row[cellIdx].value.match(/\\d+/g)[Projapi.Globals.LOCALE_DATE_FORMAT.indexOf('m')] : NaN)",desc:"month from cell",scope:"cell"},cellYear:{code:"((row[cellIdx].value)? row[cellIdx].value.match(/\\d+/g)[Projapi.Globals.LOCALE_DATE_FORMAT.indexOf('y')] : NaN)",desc:"year from cell",scope:"cell"},column:{code:"dO.options.columns[cellIdx]",desc:"column structure",scope:"cell"},columns:{code:"dO.options.columns",desc:"all columns structure"},curDate:{code:"new Date().getDate()",desc:"current year"},curMonth:{code:"new Date().getMonth()+1",desc:"current year"},curYear:{code:"new Date().getFullYear()",desc:"current year"},defVal:{code:"dO.options.columns[cellIdx].defaultValue",scope:"cell"},emptyCell:{code:"row[cellIdx].value==''",scope:"cell"},type:{code:"dO.options.columns[cellIdx].type",scope:"cell"},value:{code:"row[cellIdx].value",desc:"value of current cell",scope:"cell"}};
Projapi.Base.PJDataObject.DataProxy.ruleVariables._prepare();
if(typeof Projapi=="undefined"){
Projapi={};
}
if(!Projapi.Base){
Projapi.Base={};
}
Projapi.Base.iPJDataView=function(_446,_447){
Projapi.Base.iPJDataView.superclass.constructor.call(this,_446,_447);
this.DataSourceEvents=Projapi.Links.Data.SourceEvents;
this._dataSource=null;
this.TableIOSourceEvents=Projapi.Links.TableIO.SourceEvents;
this._tableIOSource=[];
this._queryPosition="NoRecordAvailable";
this._objectMode="View";
this._dataModified=false;
this._fields=[];
this._actionSources=[];
this.ActionSourceEvents=[Projapi.Links.Action.DataModified];
this._fieldNames=[];
this._fieldDOColumnNames=[];
this._fieldParams={};
this._objectType="SmartDataView";
this._modifiedFields=[];
this._updateInProgress=false;
this._updatePublished=false;
this._rowId=null;
this._newRecord=false;
this._recordCanceled=false;
this._exitRequested=false;
this._enabledFields=[];
this._state="UpdateComplete";
this._focusedObject=null;
this._staticMessageBundle={"msg_dataview_confirm_save":"Current values have not been saved. Save values before exit?","msg_dataview_confirm_delete":"Delete current record?"};
};
Projapi.extend(Projapi.Base.iPJDataView,Projapi.Base.iPJVisualObject);
Projapi.Base.iPJDataView.prototype.createObjects=function(){
this._processObjectProperties();
Projapi.Base.iPJDataView.superclass.createObjects.call(this);
this._objectCreated=true;
};
Projapi.Base.iPJDataView.prototype._processVisualObjectProperties=function(){
Projapi.Base.iPJDataView.superclass._processVisualObjectProperties.call(this);
if(this.getProperty("fields",[],true)){
var _idx=0,_449=this.getProperty("fields",[],true),_len=_449.length;
for(;_idx<_len;_idx++){
this.addField(_449[_idx]);
}
}
};
Projapi.Base.iPJDataView.prototype.initializeObject=function(){
Projapi.Base.iPJDataView.superclass.initializeObject.call(this);
this._objectInitialized=true;
this._processVisualObjectProperties();
if(this.isSaveMode()){
if(this.getProperty("fieldsDisabledOnUpdate",false,true)){
this.disableFields(this.getProperty("fieldsDisabledOnUpdate",[],true));
}
}
if(this._dataSource._objectInitialized&&this._dataSource._properties.currentIndex>-1){
this.dataAvailable();
}
};
Projapi.Base.iPJDataView.prototype.confirmCancel=function(){
if(this._state=="Update"||this._state=="UpdateBegin"){
this.cancelRecord();
}
return true;
};
Projapi.Base.iPJDataView.prototype.confirmOk=function(){
if(this._dataSource&&this._dataSource.getQueryPosition()=="NoRecordAvailable"){
return true;
}
if(this._state=="Update"||this._state=="UpdateBegin"){
this.updateRecord();
return false;
}else{
this.updateMode("UpdateBegin");
return false;
}
};
Projapi.Base.iPJDataView.prototype.confirmExit=function(_44b){
this._exitRequested=false;
if(this.isDataModified()||this._newRecord){
if(confirm(this.getMessage("msg_dataview_confirm_save"))){
this._exitRequested=true;
this.updateRecord();
return true;
}else{
this.cancelRecord();
return false;
}
}
if(this._state=="UpdateBegin"){
this.cancelRecord();
return false;
}
return false;
};
Projapi.Base.iPJDataView.prototype.addRecord=function(){
this._recordCanceled=false;
this._newRecord=true;
this._dataSource.addRow([]);
this._rowId=null;
this.updateMode("UpdateBegin");
this.setDataModified(true);
};
Projapi.Base.iPJDataView.prototype.copyRecord=function(){
this._recordCanceled=false;
this._newRecord=true;
this._dataSource.copyRow([]);
this._rowId=null;
this.updateMode("UpdateBegin");
this.setDataModified(true);
};
Projapi.Base.iPJDataView.prototype.updateRecord=function(){
Projapi.WarningManager.clearWarnings(this);
if(this.validateFields()){
this.collectChanges();
if(this._dataSource){
if(this.isDataModified()){
this._updateInProgress=true;
this._dataSource.submitRow(this._rowId,this._fieldParams);
}else{
this.updateMode("UpdateEnd");
}
}
}
};
Projapi.Base.iPJDataView.prototype.deleteRecord=function(){
if(this._dataSource&&this._rowId){
if(confirm(this.getMessage("msg_dataview_confirm_delete"))){
Projapi.WarningManager.clearWarnings(this);
this._dataSource.deleteRow(this._rowId);
}
}
};
Projapi.Base.iPJDataView.prototype.deleteComplete=function(){
};
Projapi.Base.iPJDataView.prototype.resetRecord=function(){
Projapi.WarningManager.clearWarnings(this);
for(var _idx=0,_len=this._fields.length;_idx<_len;_idx++){
if(this._fields[_idx].resetRecord){
this._fields[_idx].resetRecord();
}
}
this.setDataModified(false);
this._updatePublished=false;
if(!this._recordCanceled){
if(Projapi.Util.Trigger(this,"onUpdateBegin",[this,Projapi.Links.Action.StateChanged,this._state])){
this.cancelRecord();
}else{
this._state="UpdateBegin";
this.publish(Projapi.Links.TableIO.UpdateState,"UpdateBegin");
}
}
};
Projapi.Base.iPJDataView.prototype.cancelRecord=function(){
Projapi.WarningManager.clearWarnings(this);
this._recordCanceled=true;
this.resetRecord();
this.updateMode("UpdateEnd");
this._dataSource.cancelRow();
this._recordCanceled=false;
};
Projapi.Base.iPJDataView.prototype.collectChanges=function(){
this.publish("collectChanges");
var _44e;
for(var _idx=0,_len=this._fields.length;_idx<_len;_idx++){
_44e=this._fields[_idx];
if(_44e.isReadOnly&&_44e.isReadOnly()&&this._fieldParams[_44e.getDOColumnName()]){
delete this._fieldParams[_44e.getDOColumnName()];
}else{
this._fieldParams[_44e.getDOColumnName()]=String(_44e.getObjectValue());
}
}
};
Projapi.Base.iPJDataView.prototype.updateMode=function(_451){
switch(_451){
case "UpdateBegin":
if(Projapi.Util.Trigger(this,"onUpdateBegin",[this,Projapi.Links.Action.StateChanged,this._state])){
return;
}
this._objectMode="Modify";
this._recordCanceled=false;
if(this.isSaveMode()){
if(this.getProperty("fieldsDisabledOnUpdate",false,true)){
if(this._newRecord){
this.enableFields(this.getProperty("fieldsDisabledOnUpdate",[],true));
}else{
this.disableFields(this.getProperty("fieldsDisabledOnUpdate",[],true));
}
}
}else{
this.enableFields("all");
if(this.getProperty("fieldsDisabledOnUpdate",false,true)&&!this._newRecord){
this.disableFields(this.getProperty("fieldsDisabledOnUpdate",[],true));
}
}
this._state="UpdateBegin";
this.publish(Projapi.Links.TableIO.UpdateMode,"UpdateBegin");
this.publish(Projapi.Links.TableIO.UpdateState,"UpdateBegin");
this._focusedObject=Projapi.FocusManager.focusedWindow?Projapi.FocusManager.focusedWindow._lastFocusedObject:null;
var _452=this.getProperty("applyEntryTo",false,true);
if(_452){
_452=Projapi.Register.get(_452);
}
if(!this._newRecord&&this.getProperty("applyEntryOnUpdateTo",false,true)){
_452=Projapi.Register.get(this.getProperty("applyEntryOnUpdateTo",false,true));
}
if(_452&&_452.canFocus&&_452.canFocus()){
_452.applyEntry();
}else{
if(this._fields.length>0){
var _453=this.getProperty("fieldsDisabledOnUpdate",[],true);
if(this._newRecord||_453.length==0){
_452=this._fields[0];
}else{
for(var idx=0,len=this._fields.length;idx<len;idx++){
_452=this._fields[idx];
if(_453.indexOf(_452.getObjectName())==-1){
break;
}
_452=null;
}
}
if(_452&&_452.canFocus&&_452.canFocus()){
_452.applyEntry();
}else{
_452.getContainerSource().applyEntry();
}
}
}
break;
case "UpdateEnd":
if(this.isSaveMode()){
if(this.getProperty("fieldsDisabledOnUpdate",false,true)){
this.disableFields(this.getProperty("fieldsDisabledOnUpdate",[],true));
}
}else{
this.disableFields("all");
}
this._newRecord=false;
this._updateInProgress=false;
this._updatePublished=false;
this.setDataModified(false);
this._state="UpdateComplete";
this.publish(Projapi.Links.TableIO.UpdateMode,"UpdateEnd");
this.publish(Projapi.Links.TableIO.UpdateState,"UpdateComplete");
if(this._focusedObject&&this._focusedObject.applyEntry){
this._focusedObject.applyEntry();
}
if(Projapi.Util.Trigger(this,"onUpdateComplete",[this,Projapi.Links.Action.StateChanged,this._state])){
return;
}
this._objectMode="View";
if(this._exitRequested){
this._exitRequested=false;
this.publish(Projapi.Links.Container.ExitObject);
}
break;
}
};
Projapi.Base.iPJDataView.prototype.queryPosition=function(_456){
this._queryPosition=_456;
Projapi.Util.Trigger(this,"onQueryPosition",[_456]);
if(this._updateInProgress&&!this._recordCanceled){
if(Projapi.WarningManager.isSuccess(this)){
this.updateMode("UpdateEnd");
}
}
this.publish(Projapi.Links.TableIO.QueryPosition,_456);
if(this._exitRequested&&this._state=="UpdateComplete"){
this._exitRequested=false;
this.publish(Projapi.Links.Container.ExitObject);
}
};
Projapi.Base.iPJDataView.prototype.getQueryPosition=function(){
return this._queryPosition;
};
Projapi.Base.iPJDataView.prototype.dataAvailable=function(_457){
if(!this._dataSource){
return;
}
var _458=this._dataSource.colValues(this._fieldDOColumnNames),_idx=0,_len;
var _45b=this._dataSource.colValues(["rowid"])[0];
if(_45b.strip()==""){
_45b=null;
}
if(this._rowId!=_45b){
Projapi.WarningManager.clearWarnings(this);
}
this._rowId=_45b;
if(_458&&_458 instanceof Array){
for(_len=_458.length;_idx<_len;_idx++){
this._fields[_idx].setObjectValue(_458[_idx]);
}
}
};
Projapi.Base.iPJDataView.prototype.enableFields=function(_45c){
var _45d,_idx,_len;
if(typeof _45c=="undefined"||_45c=="all"){
for(_idx=0,_len=this._fieldNames.length;_idx<_len;_idx++){
if(this._fields[_idx]&&this._fields[_idx].enableObject){
this._fields[_idx].enableObject();
this._enabledFields.push(this._fieldNames[_idx]);
}
}
}else{
if(typeof _45c=="string"){
_idx=_45c.indexOf(",");
while(_idx!=-1){
_45d=_45c.substring(0,_idx);
_fldIdx=this._fieldNames.indexOf(_45c[_idx]);
if(_idx!=-1){
this._fields[_fldIdx].disableObject();
if(this._enabledFields.indexOf(_45d)==-1){
this._enabledFields.push(_45d);
}
}
_idx=_45c.indexOf(",",idx+1);
}
}else{
if(_45c instanceof Array){
for(_idx=0,_len=_45c.length;_idx<_len;_idx++){
_fldIdx=this._fieldNames.indexOf(_45c[_idx]);
if(_idx!=-1){
this._fields[_fldIdx].enableObject();
if(this._enabledFields.indexOf(_45c[_idx])==-1){
this._enabledFields.push(_45c[_idx]);
}
}
}
}
}
}
};
Projapi.Base.iPJDataView.prototype.disableFields=function(_460){
var _461,_idx,_len,_464,_465;
if(typeof _460=="undefined"||_460=="all"){
for(_idx=0,_len=this._fields.length;_idx<_len;_idx++){
if(this._fields[_idx]&&this._fields[_idx].disableObject){
this._fields[_idx].disableObject();
_465=this._enabledFields.indexOf(this._fields[_idx].getDOColumnName());
if(_465!=-1){
this._enabledFields.slice(_465);
}
}
}
}else{
if(typeof _460=="string"){
_idx=_460.indexOf(",");
while(_idx!=-1){
_461=_460.substring(0,_idx);
_464=this._fieldNames.indexOf(_460[_idx]);
if(_idx!=-1){
this._fields[_464].disableObject();
_465=this._enabledFields.indexOf(this._fields[_464].getDOColumnName());
if(_465!=-1){
this._enabledFields.slice(_465);
}
}
_idx=_460.indexOf(",",idx+1);
}
}else{
if(_460 instanceof Array){
for(_idx=0,_len=_460.length;_idx<_len;_idx++){
_464=this._fieldNames.indexOf(_460[_idx]);
if(_idx!=-1){
this._fields[_464].disableObject();
_465=this._enabledFields.indexOf(this._fields[_464].getDOColumnName());
if(_465!=-1){
this._enabledFields.slice(_465);
}
}
}
}
}
}
};
Projapi.Base.iPJDataView.prototype.validateFields=function(_466){
var _idx,_len,_469,_46a=true,_46b;
for(_idx=0,_len=this._fields.length;_idx<_len;_idx++){
_469=this._fields[_idx];
if(_469&&_469.validate){
_46b=_469.validate();
_46a=_46a&&_46b;
}
}
return _46a;
};
Projapi.Base.iPJDataView.prototype.getObjectMode=function(){
return this._objectMode;
};
Projapi.Base.iPJDataView.prototype.isDataModified=function(){
return this._dataModified;
};
Projapi.Base.iPJDataView.prototype.isNewRecord=function(){
return this._isNewRecord;
};
Projapi.Base.iPJDataView.prototype.dataModified=function(_46c,_46d){
if(!_46c||this._recordCanceled){
return;
}
if(this._fieldNames.indexOf(_46c.getObjectName())!=-1){
if(_46d===true){
if(this._modifiedFields.indexOf(_46c.getObjectName())==-1){
this._modifiedFields.push(_46c.getObjectName());
}
this.setDataModified(true);
}else{
if(this._modifiedFields.indexOf(_46c.getObjectName())!=-1){
this._modifiedFields.splice(this._modifiedFields.indexOf(_46c.getObjectName()),1);
}
if(this._modifiedFields.length==0){
this.setDataModified(false);
}else{
this.setDataModified(true);
}
}
}
};
Projapi.Base.iPJDataView.prototype.setDataModified=function(_46e){
if(_46e){
this._objectMode="Modify";
this._state="Update";
if(!this._updatePublished){
Projapi.Util.Trigger(this,"onUpdate",[this,Projapi.Links.Action.StateChanged,this._state]);
this.publish(Projapi.Links.TableIO.UpdateState,"Update");
this._updatePublished=true;
}
}else{
if(!this._recordCanceled){
this._modifiedFields=[];
this._updatePublished=false;
this._state="UpdateBegin";
this.publish(Projapi.Links.TableIO.UpdateState,"UpdateBegin");
}
}
this._dataModified=_46e;
};
Projapi.Base.iPJDataView.prototype.disableObject=function(){
this._objectEnabled=false;
var _46f=this._enabledFields;
for(var idx=0,len=this._tableIOSource.length;idx<len;idx++){
this._tableIOSource[idx].disableObject();
}
this._enabledFields=_46f;
};
Projapi.Base.iPJDataView.prototype.enableObject=function(){
this._objectEnabled=true;
console.log("DataView %s.enableObject()",this._objectName);
for(var idx=0,len=this._tableIOSource.length;idx<len;idx++){
this._tableIOSource[idx].enableObject();
}
if(this._enabledFields){
this.enableFields(this._enabledFields);
}
};
Projapi.Base.iPJDataView.prototype.getDataSource=function(){
return this._dataSource;
};
Projapi.Base.iPJDataView.prototype.setDataSource=function(_474){
return this._dataSource=_474;
};
Projapi.Base.iPJDataView.prototype.getTableIOSource=function(){
return this._tableIOSource;
};
Projapi.Base.iPJDataView.prototype.addTableIOSource=function(_475){
return this._tableIOSource.push(_475);
};
Projapi.Base.iPJDataView.prototype.removeTableIOSource=function(_476){
var idx=this._tableIOSource.indexOf(_476);
if(idx!=1){
this._tableIOSource.splice(idx,1);
}
};
Projapi.Base.iPJDataView.prototype.isSaveMode=function(){
if(this._tableIOSource[0]&&this._tableIOSource[0].isSaveType){
return this._tableIOSource[0].isSaveType();
}
return false;
};
Projapi.Base.iPJDataView.prototype.translateColumnsInMessage=function(_478){
if(!_478){
return _478;
}
var _idx=0,_len=_478.length,_47b,_pos;
for(;_idx<_len;_idx++){
_47b=_478[_idx];
_pos=this._fieldDOColumnNames.indexOf(_47b.column);
if(_pos!=-1){
_47b.objectName=this._fieldNames[_pos];
}
}
};
Projapi.Base.iPJDataView.prototype.addField=function(_47d){
if(!_47d){
return;
}
var _fld=_47d;
if(typeof _47d=="string"){
var _fld=Projapi.Register.get(_47d);
}
if(_fld&&_fld.getDOColumnName){
if(!this.isSaveMode()){
_fld.disableObject();
}else{
_fld.enableObject();
}
this._fieldNames.push(_fld.getObjectName());
this._fieldDOColumnNames.push(_fld.getDOColumnName());
this._fields.push(_fld);
this._fieldParams[_fld.getDOColumnName()]=null;
_fld.addLink(Projapi.Links.Action,this);
if(!_fld.getProperty("format",false,true)&&this._dataSource){
var _47f=this._dataSource.getColumnInfo(_fld.getDOColumnName());
if(_47f.format){
_fld.setDataFormat(_47f.format);
}
}
}else{
console.warn("Field %o of type %s added to data view %s, but unable to lookup field in register or it is not a field ",_47d,typeof _47d,this.getObjectName());
}
};
Projapi.Base.iPJDataView.prototype.removeField=function(_480){
if(!_480){
return;
}
var _481=null,_idx=-1,_fld=_480;
if(typeof _480=="string"){
_fld=Projapi.Register.get(_480);
}
if(_fld&&_fld.getDOColumnName){
delete this._fieldParams[_fld.getDOColumnName()];
_idx=this._fieldNames.indexOf(_fld.getObjectName());
if(_idx!=-1){
this._fields.splice(_idx,1);
this._fieldNames.splice(_idx,1);
this._fieldDOColumnNames.splice(_idx,1);
}
}else{
console.warn("Field %o removed from data view %s, but unable to lookup field in register or it is not a field ",_480,this.getObjectName());
}
};
Projapi.Base.iPJDataView.prototype.getActionSource=function(){
return this._actionSources;
};
Projapi.Base.iPJDataView.prototype.addActionSource=function(_484){
this._actionSources.push(_484);
};
Projapi.Base.iPJDataView.prototype.removeActionSource=function(_485){
var i=0;
while((this._actionSources[i]!=null)&&(this._actionSources[i]!=_485)){
++i;
}
this._actionSources.splice(i,1);
};
if(typeof Projapi=="undefined"){
Projapi={};
}
if(!Projapi.Base){
Projapi.Base={};
}
Projapi.Base.iPJFormView=function(_487,_488){
Projapi.Base.iPJFormView.superclass.constructor.call(this,_487,_488);
this._dataModified=false;
this._fields=[];
this._actionSources=[];
this.ActionSourceEvents=Projapi.Links.Action.SourceEvents;
this._fieldNames=[];
this._fieldParams={};
this._modifiedFields=[];
this._confirmOkRequested=false;
};
Projapi.extend(Projapi.Base.iPJFormView,Projapi.Base.iPJVisualObject);
Projapi.Base.iPJFormView.prototype.createObjects=function(){
this._processObjectProperties();
Projapi.Base.iPJFormView.superclass.createObjects.call(this);
};
Projapi.Base.iPJFormView.prototype._processVisualObjectProperties=function(){
Projapi.Base.iPJFormView.superclass._processVisualObjectProperties.call(this);
if(this.getProperty("fields",[],true)){
var _idx=0,_48a=this.getProperty("fields",[],true),_len=_48a.length;
for(;_idx<_len;_idx++){
this.addField(_48a[_idx]);
}
}
};
Projapi.Base.iPJFormView.prototype.initializeObject=function(){
Projapi.Base.iPJFormView.superclass.initializeObject.call(this);
this._objectInitialized=true;
this._processVisualObjectProperties();
};
Projapi.Base.iPJFormView.prototype.confirmOk=function(){
this._confirmOkRequested=false;
this.submitRecord();
return false;
};
Projapi.Base.iPJFormView.prototype.resetRecord=function(){
Projapi.WarningManager.clearWarnings(this);
for(var _idx=0,_len=this._fields.length;_idx<_len;_idx++){
if(this._fields[_idx].resetRecord){
this._fields[_idx].resetRecord();
}
}
this.setDataModified(false);
};
Projapi.Base.iPJFormView.prototype.cancelRecord=function(){
Projapi.WarningManager.clearWarnings(this);
this.resetRecord();
};
Projapi.Base.iPJFormView.prototype.submitRecord=function(){
Projapi.WarningManager.clearWarnings(this);
this.collectChanges();
Projapi.Util.Trigger(this,"beforeSubmit",[this]);
if(this.validateFields()){
var url=this.getProperty("url",null);
if(url){
new Projapi.Request(url,{method:this.getProperty("method","post"),asynchronous:this.getProperty("asynchronous",true),parameters:Projapi.Util.Serialize(this._fieldParams),evalScripts:true,onComplete:this._onRequestComplete.bind(this)});
Projapi.Util.Trigger(this,"afterSubmit",[this]);
}
}
};
Projapi.Base.iPJFormView.prototype._onRequestComplete=function(_48f){
if(!_48f||_48f.status!=200){
return;
}
var resp;
Projapi.Util.Trigger(this,"onSubmitComplete",[this,_48f]);
if(typeof (_48f.parsed)=="undefined"){
resp=_48f.responseText.parseJSON();
if(!resp){
try{
resp=_48f.responseText.evalScripts();
}
catch(e){
console.debug(e);
}
}
}else{
if(!_48f.parsed){
resp=_48f.responseText.parseJSON();
}else{
resp=_48f;
}
}
if(typeof resp=="object"){
if(resp.messages){
Projapi.WarningManager.process(resp.messages,this);
Projapi.WarningManager.mark(this);
if(Projapi.WarningManager.isSuccess(this)){
if(resp.evalURL){
Projapi.Util.EvalUrl(resp.evalURL);
}else{
if(this.getProperty("exitOnSuccess",false)){
this.publish(Projapi.Links.Container.ExitObject);
}
}
}
}else{
if(resp.redirectURL){
try{
if(resp.redirectURL.charAt(0)=="/"){
resp.redirectURL=window.location.toString().substring(0,window.location.toString().indexOf("/",9))+resp.redirectURL;
}
window.location=resp.redirectURL;
}
catch(e){
}
}else{
if(resp.evalURL){
try{
Projapi.Util.EvalUrl(resp.evalURL);
if(this.getProperty("exitOnSuccess",false)){
this.publish(Projapi.Links.Container.ExitObject);
}
}
catch(e){
console.debug(e);
}
}
}
}
}else{
if(this.getProperty("exitOnSuccess",false)){
this.publish(Projapi.Links.Container.ExitObject);
}
}
};
Projapi.Base.iPJFormView.prototype.collectChanges=function(){
for(var _idx=0,_len=this._fields.length;_idx<_len;_idx++){
if(this._fields[_idx]["getObjectValue"]){
this._fieldParams[this._fieldNames[_idx]]=this._fields[_idx].getObjectValue();
this._fields[_idx].setObjectValue(this._fields[_idx].getObjectValue());
}
}
};
Projapi.Base.iPJFormView.prototype.dataModified=function(_493,_494){
if(!_493){
return;
}
if(this._fields.indexOf(_493)>0){
if(_494===true){
if(this._modifiedFields.indexOf(_493.getObjectName())==-1){
this._modifiedFields.push(_493.getObjectName());
}
this.setDataModified(true);
}else{
if(this._modifiedFields.indexOf(_493.getObjectName())!=-1){
this._modifiedFields.splice(this._modifiedFields.indexOf(_493.getObjectName()),1);
}
if(this._modifiedFields.length==0){
this.setDataModified(false);
}else{
this.setDataModified(true);
}
}
}
};
Projapi.Base.iPJFormView.prototype.actionPerformed=function(_495){
switch(_495){
case "submit":
this.submitRecord();
break;
case "cancel":
this.cancelRecord();
break;
case "reset":
this.resetRecord();
break;
}
};
Projapi.Base.iPJFormView.prototype.enableFields=function(_496){
var _497,_idx,_len;
if(typeof _496=="undefined"||_496=="all"){
for(_idx=0,_len=this._fieldNames.length;_idx<_len;_idx++){
if(this._fields[_idx]&&this._fields[_idx].enableObject){
this._fields[_idx].enableObject();
}
}
}else{
if(typeof _496=="string"){
_idx=_496.indexOf(",");
while(_idx!=-1){
_497=_496.substring(0,_idx);
if(_497&&this._fields[_fieldname]&&this._fields[_497].enableObject){
this._fields[_497].enableObject();
}
_idx=_496.indexOf(",",idx+1);
}
}else{
if(isArray(_496)){
for(_idx=0,_len=_496.length;_idx<_len;_idx++){
_497=_fieldnameList[_idx];
if(this._fields[_fieldname]&&this._fields[_497].enableObject){
this._fields[_fieldname].enableObject();
}
}
}
}
}
};
Projapi.Base.iPJFormView.prototype.disableFields=function(_49a){
var _49b,_idx,_len;
if(typeof _49a=="undefined"||_49a=="all"){
for(_idx=0,_len=this._fields.length;_idx<_len;_idx++){
if(this._fields[_idx]&&this._fields[_idx].disableObject){
this._fields[_idx].disableObject();
}
}
}else{
if(typeof _49a=="string"){
_idx=_49a.indexOf(",");
while(_idx!=-1){
_49b=_49a.substring(0,_idx);
if(_49b&&this._fields[_fieldname]&&this._fields[_49b].disableObject){
this._fields[_49b].disableObject();
}
_idx=_49a.indexOf(",",idx+1);
}
}else{
if(isArray(_49a)){
for(_idx=0,_len=_49a.length;_idx<_len;_idx++){
_49b=_fieldnameList[_idx];
if(this._fields[_fieldname]&&this._fields[_49b].disableObject){
this._fields[_fieldname].disableObject();
}
}
}
}
}
};
Projapi.Base.iPJFormView.prototype.validateFields=function(_49e){
var _idx,_len,_4a1,_4a2=true,_4a3;
for(_idx=0,_len=this._fields.length;_idx<_len;_idx++){
_4a1=this._fields[_idx];
if(_4a1&&_4a1.validate){
_4a3=_4a1.validate();
_4a2=_4a2&&_4a3;
}
}
return _4a2;
};
Projapi.Base.iPJFormView.prototype.getDataModified=function(){
return this._dataModified;
};
Projapi.Base.iPJFormView.prototype.setDataModified=function(_4a4){
this._dataModified=_4a4;
if(!_4a4){
this._modifiedFields=[];
}
};
Projapi.Base.iPJFormView.prototype.addField=function(_4a5){
if(!_4a5){
return;
}
var _fld=_4a5;
if(typeof _4a5=="string"){
var _fld=Projapi.Register.get(_4a5);
}
if(_fld&&_fld.getDOColumnName){
this._fieldNames.push(_fld.getObjectName());
this._fields.push(_fld);
this._fieldParams[_fld.getDOColumnName()]=null;
_fld.addLink(Projapi.Links.Action,this);
}else{
console.warn("Field %o added to data view %s, but unable to lookup field in register or it is not a field ",_4a5,this.getObjectName());
}
};
Projapi.Base.iPJFormView.prototype.removeField=function(_4a7){
if(!_4a7){
return;
}
var _4a8=null,_idx=-1,_fld=_4a7;
if(typeof _4a7=="string"){
_fld=Projapi.Register.get(_4a7);
}
if(_fld&&_fld.getDOColumnName){
delete this._fieldParams[_fld.getDOColumnName()];
_idx=this._fieldNames.indexOf(_fld.getObjectName());
if(_idx!=-1){
this._fields.splice(_idx,1);
this._fieldNames.splice(_idx,1);
}
}else{
console.warn("Field %o removed from data view %s, but unable to lookup field in register or it is not a field ",_4a7,this.getObjectName());
}
};
Projapi.Base.iPJFormView.prototype.getActionSource=function(){
return this._actionSources;
};
Projapi.Base.iPJFormView.prototype.addActionSource=function(_4ab){
this._actionSources.push(_4ab);
};
Projapi.Base.iPJFormView.prototype.removeActionSource=function(_4ac){
var i=0;
while((this._actionSources[i]!=null)&&(this._actionSources[i]!=_4ac)){
++i;
}
this._actionSources.splice(i,1);
};
if(typeof Projapi=="undefined"){
Projapi={};
}
if(!Projapi.Base){
Projapi.Base={};
}
Projapi.Base.iPJFilterView=function(_4ae,_4af){
Projapi.Base.iPJFilterView.superclass.constructor.call(this,_4ae,_4af);
this.DataSourceEvents=Projapi.Links.Data.SourceEvents;
this._dataSource=null;
this._dataModified=false;
this._fields=[];
this._fieldNames=[];
this._filterParams=[];
this._modifiedFields=[];
this._actionSources=[];
this._domNode=null;
this._nodes=[];
this._doColumnName=null;
this.ActionSourceEvents=Projapi.Links.Action.SourceEvents;
this._confirmOkRequested=false;
this.Separator=String.fromCharCode(2);
this._staticMessageBundle={"msg_filterview_confirm_apply":"Current values have not been applied. Apply values before exit?"};
};
Projapi.extend(Projapi.Base.iPJFilterView,Projapi.Base.iPJSmartObject);
Projapi.Base.iPJFilterView.prototype.createObjects=function(){
this._processObjectProperties();
Projapi.Base.iPJFilterView.superclass.createObjects.call(this);
};
Projapi.Base.iPJFilterView.prototype._processVisualObjectProperties=function(){
Projapi.Base.iPJFilterView.superclass._processVisualObjectProperties.call(this);
if(this.getProperty("fields",[],true)){
var _idx=0,_4b1=this.getProperty("fields",[],true),_len=_4b1.length;
for(;_idx<_len;_idx++){
this.addField(_4b1[_idx]);
}
}
};
Projapi.Base.iPJFilterView.prototype._buildUI=function(){
var _4b3,_4b4,_idx,_len;
if(!this._domNode){
_4b3=document.getElementById(this.getObjectName());
if(_4b3){
this._domNode=Projapi.UI.Element.get(_4b3);
}else{
_4b3=document.createElement("FORM");
_4b3.id=this.getObjectName();
_4b3.className="pjForm";
_4b3.action=this.getProperty("url","",true);
_4b3.method=this.getProperty("method","post",true);
_4b3.name=this.getDOColumnName();
if(this.getProperty("target",false,true)){
_4b3.target=this.getProperty("target","",true);
}
if(this.getProperty("enctype",false,true)){
_4b3.enctype=this.getProperty("enctype","",true);
}
this._domNode=Projapi.UI.Element.get(_4b3);
this._domNode.setDisplayed(false);
}
}
if(this.getContainerSource()){
_4b4=this.getContainerSource().getDOMNode();
}
if(!_4b4){
_4b4=window.document.body;
}
_4b4.domNode.appendChild(this._domNode.domNode);
_4b3=Projapi.UI.CreateFormElement("input","xml","hidden");
this._nodes["xml"]=_4b3;
this._domNode.domNode.appendChild(_4b3);
for(_idx=0,_len=this._filterParams.length;_idx<_len;_idx++){
_4b3=Projapi.UI.CreateFormElement("input",this._filterParams[_idx][0],"hidden");
_4b3.value=this._filterParams[_idx][2];
this._nodes[this._filterParams[_idx][0]]=_4b3;
this._domNode.domNode.appendChild(_4b3);
}
};
Projapi.Base.iPJFilterView.prototype.destroyObject=function(){
if(this._domNode&&this._domNode.domNode&&this._domNode.domNode.parentNode){
this._domNode.domNode.parentNode.removeChild(this._domNode.domNode);
}
this._domNode=null;
this._nodes=[];
Projapi.Base.iPJFilterView.superclass.destroyObject.call(this);
};
Projapi.Base.iPJFilterView.prototype.initializeObject=function(){
Projapi.Base.iPJFilterView.superclass.initializeObject.call(this);
this._objectInitialized=true;
this._processVisualObjectProperties();
if(this.getProperty("url",false,true)){
this._buildUI();
}
if(this.getProperty("applyOnInit",true,true)){
this.applyFilter();
}
};
Projapi.Base.iPJFilterView.prototype.confirmOk=function(){
this.applyFilter();
return !this.getProperty("trapOK",false,true);
};
Projapi.Base.iPJFilterView.prototype.confirmCancel=function(){
this.cancelRecord();
return true;
};
Projapi.Base.iPJFilterView.prototype.confirmExit=function(_4b7){
if(this.getDataSource()!=null&&this.getDataModified()===true){
if(confirm(this.getMessage("msg_filterview_confirm_apply"))){
this.applyFilter();
}else{
this.cancelRecord();
}
}
return _4b7;
};
Projapi.Base.iPJFilterView.prototype.resetRecord=function(){
Projapi.WarningManager.clearWarnings(this);
for(var _idx=0,_len=this._fields.length;_idx<_len;_idx++){
if(this._fields[_idx].resetRecord){
this._fields[_idx].resetRecord();
}
}
this.applyFilter();
this.setDataModified(false);
};
Projapi.Base.iPJFilterView.prototype.cancelRecord=function(){
Projapi.WarningManager.clearWarnings(this);
this.resetRecord();
};
Projapi.Base.iPJFilterView.prototype.clearFilter=function(){
Projapi.WarningManager.clearWarnings(this);
for(var _idx=0,_len=this._fields.length;_idx<_len;_idx++){
this._fields[_idx].setObjectValue(null);
}
this.applyFilter();
this.setDataModified(false);
};
Projapi.Base.iPJFilterView.prototype.applyFilter=function(){
Projapi.WarningManager.clearWarnings(this);
this.collectChanges();
if(this.validateFields()){
var _idx,_len,_res=[];
for(_idx=0,_len=this._filterParams.length;_idx<_len;_idx++){
_res.push(this._filterParams[_idx]);
}
if(this.getDataSource()){
this.getDataSource().assignQuerySelection(this._filterParams);
}
var url=this.getProperty("url",null,true);
if(url){
this._submitDirectFilterRequest();
}
}
this.setDataModified(false);
};
Projapi.Base.iPJFilterView.prototype._submitDirectFilterRequest=function(){
var _idx,_len,_4c2,_4c3,xml=[];
xml.push("<?xml version=\"1.0\"?><dao-msg><filter>");
for(_idx=0,_len=this._filterParams.length;_idx<_len;_idx++){
if(this._filterParams[_idx][1]!="none"){
xml.push("<col name=\"");
xml.push(this._filterParams[_idx][0]);
xml.push("\" op=\"");
xml.push(this._filterParams[_idx][1]);
xml.push("\">");
xml.push(this._filterParams[_idx][2]);
xml.push("</col>");
}
if(this._nodes[this._filterParams[_idx][0]]){
this._nodes[this._filterParams[_idx][0]].value=this._filterParams[_idx][2];
}
}
xml.push("</filter></dao-msg>");
if(this._nodes["xml"]){
this._nodes["xml"].value=xml.join("");
}
if(this._domNode){
this._domNode.domNode.submit();
}
};
Projapi.Base.iPJFilterView.prototype.collectChanges=function(){
var _idx,_len,_4c7,_4c8,_val,_4ca,_4cb,_4cc;
for(_idx=0,_len=this._fields.length;_idx<_len;_idx++){
_4c8=this._fields[_idx];
if(_4c8.getObjectValue){
_4c8.setObjectValue(_4c8.getObjectValue());
_4c7=this._fieldNames.indexOf(_4c8.getDOColumnName());
if(_4c7!=-1){
if(this._filterParams[_4c7][1]!="between"){
this._filterParams[_4c7][2]=_4c8.getObjectValue();
if(this._filterParams[_4c7][2]==""){
this._filterParams[_4c7][2]="null";
}
}else{
_val=this._filterParams[_4c7][2];
_4ca=_val.indexOf(this.Separator);
if(_4ca==-1){
_4cb=_val;
}else{
_4cb=_val.substring(0,_4ca);
_4cc=_val.substring(_4ca+1);
}
if(_4c8.getProperty("filterMaxValue",false,true)){
_4cc=_4c8.getObjectValue();
}else{
_4cb=_4c8.getObjectValue();
}
if(_4cb==null||_4cb==""){
_4cb="null";
}
if(_4cc==null||_4cc==""){
_4cc="null";
}
this._filterParams[_4c7][2]=_4cb+this.Separator+_4cc;
}
}
}
}
};
Projapi.Base.iPJFilterView.prototype.dataModified=function(_4cd,_4ce){
if(!_4cd){
return;
}
var idx=this._fields.indexOf(_4cd);
if(idx!=-1&&this._fields[idx].getProperty("filterOperator",false,true)!="none"){
if(_4ce===true){
if(this._modifiedFields.indexOf(_4cd.getObjectName())==-1){
this._modifiedFields.push(_4cd.getObjectName());
}
this.setDataModified(true);
}else{
if(this._modifiedFields.indexOf(_4cd.getObjectName())!=-1){
this._modifiedFields.splice(this._modifiedFields.indexOf(_4cd.getObjectName()),1);
}
if(this._modifiedFields.length==0){
this.setDataModified(false);
}else{
this.setDataModified(true);
}
}
}
};
Projapi.Base.iPJFilterView.prototype.actionPerformed=function(_4d0){
switch(_4d0){
case "submit":
this.applyFilter();
break;
case "apply":
this.applyFilter();
break;
case "cancel":
this.cancelRecord();
break;
case "reset":
this.resetRecord();
break;
case "clear":
this.clearFilter();
break;
}
};
Projapi.Base.iPJFilterView.prototype.validateFields=function(_4d1){
var _idx,_len,_4d4,_4d5=true,_4d6;
for(_idx=0,_len=this._fields.length;_idx<_len;_idx++){
_4d4=this._fields[_idx];
if(_4d4&&_4d4.validate){
_4d6=_4d4.validate();
_4d5=_4d5&&_4d6;
}
}
return _4d5;
};
Projapi.Base.iPJFilterView.prototype.getDataModified=function(){
return this._dataModified;
};
Projapi.Base.iPJFilterView.prototype.setDataModified=function(_4d7){
this._dataModified=_4d7;
if(!_4d7){
this._modifiedFields=[];
}
};
Projapi.Base.iPJFilterView.prototype.addField=function(_4d8){
if(!_4d8){
return;
}
if(typeof _4d8=="object"){
this._addField(_4d8.getDOColumnName(),_4d8);
}
if(typeof _4d8=="string"){
if(!Projapi.Register){
return;
}
var _fld=Projapi.Register.get(_4d8);
if(_fld){
this._addField(_fld.getDOColumnName(),_fld);
}
}
};
Projapi.Base.iPJFilterView.prototype.removeField=function(_4da){
if(!_4da){
return;
}
var _4db=null,_idx=-1;
if(typeof _4da=="object"&&_4da.getDOColumnName&&_4da.getDOColumnName()){
_4db=_4da.getDOColumnName();
}
if(!_4db&&typeof _4da=="string"){
if(!Projapi.Register){
return;
}
_fld=Projapi.Register.getFieldObject(_4da);
if(_fld&&_fld.getDOColumnName&&_fld.getDOColumnName()){
_4db=_fld.getDOColumnName();
}
if(!_4db){
_fld=Projapi.Register.getFieldObject(_4da);
if(_fld&&_fld.getDOColumnName&&_fld.getDOColumnName()){
_4db=_fld.getDOColumnName();
}
}
}
if(_4db){
this._fields[_4db]=null;
this._fields.splice(this._fields.indexOf(_4db),1);
_idx=this._fieldNames.indexOf(_4db);
if(_idx!=-1){
this._fields.splice(_idx,1);
}
}
};
Projapi.Base.iPJFilterView.prototype._addField=function(_4dd,_4de){
this._fields.push(_4de);
if(this._fieldNames.indexOf(_4dd)==-1){
this._fieldNames.push(_4dd);
this._filterParams.push([_4dd,_4de.getProperty("filterOperator","eq",true),""+_4de.getProperty("defaultValue",null,true)]);
}
_4de.addLink(Projapi.Links.Action,this);
};
Projapi.Base.iPJFilterView.prototype.getActionSource=function(){
return this._actionSources;
};
Projapi.Base.iPJFilterView.prototype.addActionSource=function(_4df){
this._actionSources.push(_4df);
};
Projapi.Base.iPJFilterView.prototype.removeActionSource=function(_4e0){
var i=0;
while((this._actionSources[i]!=null)&&(this._actionSources[i]!=_4e0)){
++i;
}
this._actionSources.splice(i,1);
};
Projapi.Base.iPJFilterView.prototype.getDataSource=function(){
return this._dataSource;
};
Projapi.Base.iPJFilterView.prototype.setDataSource=function(_4e2){
return this._dataSource=_4e2;
};
Projapi.Base.iPJFilterView.prototype.setDOColumnName=function(_4e3){
this._doColumnName=_4e3;
Projapi.Register.add(this,this.getObjectName(),this.getDOColumnName(),this.getContainerSource());
};
Projapi.Base.iPJFilterView.prototype.getDOColumnName=function(){
return this._doColumnName||this.getObjectName();
};
if(typeof Projapi=="undefined"){
Projapi={};
}
if(!Projapi.Widgets){
Projapi.Widgets={};
}
Projapi.Widgets.PJDataBrowse=function(_4e4,_4e5){
Projapi.Widgets.PJDataBrowse.inheritDataView();
Projapi.Widgets.PJDataBrowse.superclass.constructor.call(this,_4e4,_4e5);
this._objectType="SmartBrowse";
if(!this._properties){
this._properties={};
}
Object.extend(this._properties,{_allFixed:null,columns:_4e5.columns,_lockScroll:null,multiSelect:_4e5.multiSelect||false,editable:false,rows:_4e5.rows||5,maxHeight:_4e5.maxHeight||null,maxWidth:_4e5.maxWidth||null,minWidth:_4e5.minWidth||"51px",_selfStruct:{maxHeight:{type:"number"},maxWidth:{type:"number"}}});
this.navigationTarget=null;
this._tableIOSource=[];
this._dataSource=null;
this.toolbar=null;
this.popup=null;
this.layoutManager=_4e5.layoutManager||new Projapi.Widgets.PJDataBrowse.createDefaultLayoutManager(this);
this.NavigationSourceEvents=Projapi.Links.Navigation.SourceEvents;
this.NavigationTargetEvents=[Projapi.Links.Navigation.UpdateState];
this.DataSourceEvents=Projapi.Links.Data.SourceEvents;
this.TableIOSourceEvents=Projapi.Links.TableIO.SourceEvents;
this.ContainerTargetEvents=Projapi.Links.Container.TargetEvents;
this.ContainerSourceEvents=Projapi.Links.Container.SourceEvents;
this.domNodes={contentDiv:null,contentTable:null,emptyQueryDiv:null,headerDiv:null,scrollTH:null,sortImg:null,editDiv:null};
this.hasBefore=false;
this.hasAfter=false;
this._checkBorders=this.__checkBorders;
this.selection=[];
this._scrolledSinceSelect=true;
this._lastWidths=[];
this._resize={resizing:null};
this._onBeginResizeCol=this._beginResizeCol.bind(this);
this._onUpdateResizeCol=this._updateResizeCol.bind(this);
this._onEndResizeCol=this._endResizeCol.bind(this);
this._staticMessageBundle={msg_smartbrowse_empty:"There are no rows to display. Either the table is empty or the filters didn't let anything through.",msg_dataview_confirm_save:"Current values have not been saved. Save values before exit?",msg_dataview_confirm_delete:"Delete current record?"};
this._canFocus=true;
this._disabledSource=false;
this._visualBlock=false;
this._row0=[];
this._row0.base="";
this._resetScroll=false;
this._moreRows=null;
this._lastTheme=null;
this._objectMode="View";
this._dataModified=false;
this._fields=[];
this._actionSources=[];
this.ActionSourceEvents=[Projapi.Links.Action.DataModified];
this._modifiedFields=[];
this._updateInProgress=false;
this._updatePublished=false;
this._rowId=null;
this._newRecord=false;
this._recordCanceled=false;
this._exitRequested=false;
this._enabledFields=[];
this._state="UpdateComplete";
this._focusedObject=null;
this._queryPosition="NoRecordAvailable";
this._fieldNames=[];
this._fieldDOColumnNames=[];
this._fieldParams={};
this._disableFields=false;
if(typeof this._properties.fieldsDisabledOnUpdate=="undefined"){
this._disableFields=true;
this._properties.fieldsDisabledOnUpdate=[];
}
this._fieldsFKpositioned=false;
};
Projapi.extend(Projapi.Widgets.PJDataBrowse,Projapi.Base.iPJVisualObject);
Projapi.Widgets.PJDataBrowse.prototype._sizes={lastTheme:null};
Projapi.Widgets.PJDataBrowse.prototype.createObjects=function(){
this._processObjectProperties();
if(!this._dataSource){
console.warn("DataSource not set for PJDataBrowse before createObjects was called. ( %o )",this);
return;
}
var _4e6=this;
Projapi.Widgets.PJDataBrowse.superclass.createObjects.call(this);
var i,_4e8=this._dataSource.dataProxy.options,cols=_4e8.columns;
this._columns=[];
for(i=0;i<this._properties.columns.length;i++){
this._columns.push(cols.indexByName[this._properties.columns[i].name]);
}
this._buildUI();
this._initHandlers();
var _4ea=_4e8.onCacheChange;
_4e8.onCacheChange=function(){
if(_4ea){
_4ea();
}
_4e6._refreshUI();
};
this.publish(Projapi.Links.Container.CreateObjects);
this._objectCreated=true;
this._processVisualObjectProperties();
};
Projapi.Widgets.PJDataBrowse.prototype._processObjectProperties=function(){
Projapi.Widgets.PJDataBrowse.superclass._processObjectProperties.call(this);
if(this._properties.editable){
this._properties.editable=false;
this.setEditable(true);
}
};
Projapi.Widgets.PJDataBrowse.prototype._processVisualObjectProperties=function(){
Projapi.Widgets.PJDataBrowse.superclass._processVisualObjectProperties.call(this);
};
Projapi.Widgets.PJDataBrowse.prototype.initializeObject=function(){
if(!this._dataSource){
console.error("[Error] DataSource not set for PJDataBrowse before initializeObject was called. ( %o )",this);
return;
}
if(!this._objectCreated){
this.createObjects();
}
Projapi.Widgets.PJDataBrowse.superclass.initializeObject.call(this);
this._applySizes();
this._objectInitialized=true;
if(this.toolbar){
if(!this.toolbar._objectInitialized){
this.toolbar.initializeObject();
}
if(!this.popup&&this._properties.generatePopup){
this._generatePopupFromToolbar(this.toolbar);
}
}
if(this.popup&&!this.popup._objectInitialized){
this.popup.initializeObject();
}
if(this._dataSource.dataProxy.cache&&this._dataSource.dataProxy.cache.length>0){
this._refreshUI();
}
Event.observe(this.domNodes.contentDiv,"scroll",this._onScroll.bindAsEventListener(this),false);
this._dataSource._notifyOnRequest.push(this._actions.onRequestNotify);
if(this._properties.editable){
for(var i=0;i<this._fields.length;i++){
if(this._properties.columns[i].isNumber){
this._fields[i]._fieldRepr._fieldElement.domNode.style.textAlign="right";
}
}
if(this.isSaveMode()&&this._properties.fieldsDisabledOnUpdate){
this.disableFields(this._properties.fieldsDisabledOnUpdate||[]);
}
}
};
Projapi.Widgets.PJDataBrowse.prototype._generatePopupFromToolbar=function(_4ec){
this.popup=new Projapi.Widgets.PJPopupMenu("generated-popup-for-"+this._objectName,{});
var _4ed,btn,list=[],i;
for(_4ed=0;_4ed<_4ec._containerTarget.length;_4ed++){
list.push(_4ec._containerTarget[_4ed]);
}
for(_4ed=0;_4ed<list.length;_4ed++){
if((btn=list[_4ed])=="separator"){
Projapi.Controller.subscribe(this.popup,Projapi.Links.Container.CreateObjects,new Projapi.Widgets.PJMenuItem("generated-mi-"+_4ed+"-for-"+this._objectName,{label:""}));
}else{
if(btn instanceof Projapi.Widgets.PJToolGroup){
if(!this.getProperty("parseButtonGroupsToPopup",true,true)){
continue;
}
btn=btn._containerTarget;
list.splice(_4ed+1,0,"separator");
for(i=btn.length-1;i>=0;i--){
list.splice(_4ed+1,0,btn[i]);
}
}else{
if(btn instanceof Projapi.Widgets.PJToolButton){
var _4f1={label:btn._properties.label||"(No label given)",image:btn._properties.image||null,hoverImage:btn._properties.hoverImage||btn._properties.hooverImage||null,disabledImage:btn._properties.disabledImage||null,clickTarget:btn};
if(btn._properties.hotkey){
_4f1.___hotkeyText=String(btn._properties.hotkey);
}
var mi=new Projapi.Widgets.PJMenuItem("generated-mi-"+_4ed+"-for-"+this._objectName,_4f1);
btn._properties.onDisableObjectPublish=Projapi.Links.Container.DisableObject;
btn._properties.onEnableObjectPublish=Projapi.Links.Container.EnableObject;
Projapi.Controller.subscribe(btn,Projapi.Links.Container.DisableObject,mi);
Projapi.Controller.subscribe(btn,Projapi.Links.Container.EnableObject,mi);
Projapi.Controller.subscribe(this.popup,Projapi.Links.Container.CreateObjects,mi);
if(btn._popup){
Projapi.Controller.subscribe(mi,Projapi.Links.Container.CreateObjects,btn._popup);
}
}
}
}
}
this.addLink(Projapi.Links.Container,this.popup);
if(this._objectCreated){
this.popup.createObjects();
}
if(this._objectInitialized){
this.popup.initializeObject();
}
};
Projapi.Widgets.PJDataBrowse.prototype.enableObject=function(){
this._canFocus=true;
Projapi.Widgets.PJDataBrowse.superclass.enableObject.call(this);
if(!this._disabledSource){
this.enable();
}
};
Projapi.Widgets.PJDataBrowse.prototype.enable=function(){
this._properties._lockScroll=null;
this._domNode.domNode.className=this._domNode.domNode.className.replace(" disabled","");
if(this.popup){
this.popup.enableObject();
}
};
Projapi.Widgets.PJDataBrowse.prototype.disableObject=function(){
this._canFocus=false;
Projapi.Widgets.PJDataBrowse.superclass.disableObject.call(this);
if(!this._disabledSource){
this.disable();
}
};
Projapi.Widgets.PJDataBrowse.prototype.disable=function(){
this._properties._lockScroll=this.domNodes.contentDiv.scrollTop;
this._domNode.domNode.className+=" disabled";
if(this.popup){
this.popup.disableObject();
}
};
Projapi.Widgets.PJDataBrowse.prototype._buildUI=function(){
var _4f3=this;
this.makeSizes();
var node=this.getDOMNode();
if(node){
if(node.domNode){
node=node.domNode;
}else{
this.setDOMNode(Projapi.UI.Element.get(node));
}
}
if(!node){
if(node=$(this._objectName)){
this.setDOMNode(Projapi.UI.Element.get(node));
}
}
if(node){
if(!node.className.match(/\bpjDataBrowse\b/)){
if(node.className){
node.className+=" pjDataBrowse";
}else{
node.className="pjDataBrowse";
}
}
}else{
node=Projapi.UI.Element.fromString("<div id=\""+this._objectName+"\" class=\"pjDataBrowse\"></div>");
this.setDOMNode(node);
node=node.domNode;
}
var _4f5=document.createElement("table");
var i,cols=this._dataSource.dataProxy.options.columns;
_4f5.className="pjDataBrowseHeader";
_4f5.cellSpacing=0;
_4f5.insertRow(0).style.width="100%";
this._properties.columns.cntAuto=0;
for(i=0;;i++){
if(i>=this._columns.length){
this._properties._allFixed=true;
_4f5.style.width="auto";
break;
}else{
if(!this._properties.columns[i].size||this._properties.columns[i].size=="*"){
break;
}
}
}
for(i=0;i<this._columns.length;i++){
this._makeColumn(_4f5.rows[0].appendChild(document.createElement("th")),cols[this._columns[i]],this._properties.columns[i]);
}
while(this._fields.length<this._columns.length){
this._fields.push(null);
}
this.domNodes.scrollTH=_4f5.rows[0].appendChild(document.createElement("td"));
this.domNodes.scrollTH.style.visibility="hidden";
this.domNodes.scrollTH.style.display="none";
this.domNodes.scrollTH.className="spacer";
this.domNodes.scrollTH.innerHTML="&nbsp;";
this._tableHeaderRow=_4f5.rows[0];
node.appendChild(this.domNodes.headerDiv=document.createElement("div")).appendChild(_4f5);
this.domNodes.headerDiv.className="pjDataBrowseHeaderDiv";
var _4f8=Projapi.UI.Element.DOMfromString("<table class=\"pjDataBrowseBody\" cellSpacing=\"0\"><tbody>"+(new Array(5).join("<tr class=\"pjDataBrowseRow\">"+(new Array(this._columns.length+1)).join("<td class=\"pjDataBrowseCell\">&nbsp;</td>"))+"</tr>")+"</tbody></table>");
this.domNodes.contentTable=_4f5=_4f8;
node.appendChild(document.createElement("div"));
this.domNodes.contentDiv=node.lastChild;
this.domNodes.contentDiv.className="pjDataBrowseContent";
this.domNodes.contentDiv.ref=this;
this.domNodes.emptyQueryDiv=Projapi.UI.Element.DOMfromString("<div class=\"pjDataBrowseEmptyQuery\">"+this.getMessage("msg_smartbrowse_empty")+"</div>");
this.domNodes.contentDiv.appendChild(_4f5);
this.domNodes.contentDiv.appendChild(this.domNodes.emptyQueryDiv);
this.domNodes.editDiv=this._domNode.domNode.appendChild(document.createElement("div"));
this.domNodes.editDiv.style.display="none";
this.domNodes.editDiv.style.position="absolute";
this.domNodes.editDiv.style.whiteSpace="pre";
this.domNodes.editDiv.style.overflow="hidden";
Event.observe(this.domNodes.contentDiv,"dblclick",function(_4f9){
if(_4f3.isObjectEnabled()){
Projapi.Util.Trigger(_4f3,"onDblClick");
}
},false);
this.domNodes.sortImg=document.createElement("span");
this.domNodes.sortImg.className="sortImg";
if(typeof this._properties.minWidth=="string"){
node.style.minWidth=this._properties.minWidth;
}else{
node.style.minWidth=this._properties.minWidth+"em";
}
if(typeof this._properties.maxWidth=="string"){
node.style.maxWidth=this._properties.maxWidth;
}else{
if(typeof this._properties.maxWidth=="number"){
node.style.maxWidth=this._properties.maxWidth+"em";
}
}
if(typeof this._properties.maxHeight=="string"){
node.style.maxHeight=this._properties.maxHeight;
}else{
if(typeof this._properties.maxHeight=="number"){
node.style.maxHeight=this._properties.maxHeight+"em";
}
}
if(this.getContainerSource()){
var _4fa=this.getContainerSource().getLayoutManager(this.getObjectPage());
_4fa.add(this);
}
Event.observe(this.domNodes.contentDiv,"contextmenu",function(ev){
var ev=ev||event;
if(_4f3.popup){
_4f3.popup.pop(ev);
}
},false);
Event.observe(this.domNodes.contentDiv,"click",function(ev){
var ev=ev||event;
if(ev.altKey&&_4f3.popup){
_4f3.popup.pop(ev);
_4f3.popup._ignoreNextClick=true;
}
},false);
if(window.opera){
var _4fd=-1,_4fe=-1;
Event.observe(this.domNodes.contentDiv,"mousedown",function(ev){
if(ev.button==2&&ev.which==3){
_4fd=Event.pointerX(ev);
_4fe=Event.pointerY(ev);
}else{
_4fd=-1;
_4fe=-1;
}
});
Event.observe(this.domNodes.contentDiv,"mouseup",function(ev){
if(ev.button==2&&ev.which==3&&_4fd==Event.pointerX(ev)&&_4fe==Event.pointerY(ev)){
_4fd=-1;
_4fe=-1;
if(_4f3.popup){
_4f3.popup.pop(ev);
Event.stop(ev);
}
}
});
}
};
Projapi.Widgets.PJDataBrowse.prototype.makeSizes=function(){
if(!Projapi.Theme||this._sizes.lastTheme==Projapi.Theme){
return;
}
this._sizes.lastTheme=Projapi.Theme;
var node=document.body.appendChild(document.createElement("div"));
node.className="pjDataBrowse";
node.innerHTML="<div class=\"pjDataBrowseHeaderDiv\"><table cellspacing=\"0\" class=\"pjDataBrowseHeader\"><tbody><th style=\"width: 1em;\">M</th><th style=\"width: 2em;\">MM</th><th></th></tr></tbody></table></div>"+"<div class=\"pjDataBrowseContent\" style=\"height: 80px; width: 80px\"><table cellspacing=\"0\" class=\"pjDataBrowseBody\"><tbody>"+"<tr class=\"pjDataBrowseRow\"><td class=\"pjDataBrowseCell\" style=\"width: 1px;\">M</td><td class=\"pjDataBrowseCell\">0</td></tr>"+"<tr class=\"pjDataBrowseRow\"><td class=\"pjDataBrowseCell\" style=\"width: 1px;\">M</td><td class=\"pjDataBrowseCell number\">0</td></tr>"+"</tbody></table><div style=\"height: 50px; width: 90px;\">a</div></div>";
var _502=node.firstChild.firstChild.rows[0];
this._sizes.deltaW=_502.cells[0].offsetWidth*2-_502.cells[1].offsetWidth;
this._sizes.emW=_502.cells[1].offsetWidth-_502.cells[0].offsetWidth;
this._sizes.cellDeltaW=node.lastChild.firstChild.rows[0].cells[0].offsetWidth-1;
this._sizes.rowHeight=node.lastChild.firstChild.rows[0].offsetHeight;
this._sizes.rowHeightN=node.lastChild.firstChild.rows[1].offsetHeight;
this._sizes.spacerW=node.lastChild.offsetWidth-node.lastChild.clientWidth;
this._sizes.spacerH=node.lastChild.offsetHeight-node.lastChild.clientHeight;
this._sizes.canOverflowY=typeof document.body.style.overflowY=="string";
node.parentNode.removeChild(node);
};
Projapi.Widgets.PJDataBrowse.prototype._applySizes=function(){
if(this._lastTheme!=Projapi.Theme){
this.makeSizes();
this._lastTheme=this._sizes.lastTheme;
this.domNodes.contentDiv.style.height=(this._properties.rows*(this._hasNumbers?this._sizes.rowHeightN:this._sizes.rowHeight))+"px";
this.domNodes.scrollTH.style.width=this._sizes.spacerW+"px";
}
};
Projapi.Widgets.PJDataBrowse.prototype._refreshUI=function(){
if(!this._objectInitialized){
return;
}
var _503=this;
var _504=this.domNodes.contentTable,rows=_504.rows,row=rows[2];
var rdo=this._dataSource.dataProxy,_508=rdo.cache,_509=rdo.options.hasFirstRow,_50a=rdo.options.hasLastRow;
var col,i=0,j,k,_50f=rows.length,_510,_511,val,_513=rdo.options.currentIndex;
if(_508.length==0){
this.domNodes.emptyQueryDiv.style.display="";
_504.style.display="none";
this.domNodes.scrollTH.style.display="none";
this._moreRows=null;
}else{
var rws=_508.length+(_509?0:2)+(_50a?0:2),_515;
if(!this._objectHidden){
_515=this._tableHeaderRow.offsetWidth;
if(rws>=this._properties.rows||this._sizes.canOverflowY){
_515-=this._sizes.spacerW;
}
}
this.domNodes.emptyQueryDiv.style.display="none";
this.selection=[];
this._actions.highlighted=null;
Projapi.Profiler.Start("DataBrowse_populate_table");
var tbl=["<table class=\"pjDataBrowseBody\" cellSpacing=\"0\""];
if(!this._objectHidden){
tbl.push(" style=\"width: ");
tbl.push(_515);
tbl.push("px\"");
}
tbl.push("><tbody>");
for(i=1;i<1+2;i++){
tbl.push("<tr class=\"pjDataBrowseRow");
if(i%2==1){
tbl.push(" alt");
}
if(_509){
tbl.push("\" style=\"display: none");
}
tbl.push("\">");
for(j=0;j<this._columns.length;j++){
tbl.push(this._row0[j].str);
tbl.push("&nbsp;");
tbl.push("</td>");
}
tbl.push("</tr>");
}
for(i=0;i<_508.length;i++){
_510=_508[i];
tbl.push("<tr class=\"pjDataBrowseRow");
if(i%2==1){
tbl.push(" alt");
}
if(_513==i){
tbl.push(" selected highlight");
this.selection.push([null,_510[rdo.options.columns.indexByName.rowid].value,i,_510]);
}
tbl.push("\" oncontextmenu=\"Projapi.Widgets.PJDataBrowse.prototype.handleRowContextMenu.call(this, event);\" onmousedown=\"Projapi.Widgets.PJDataBrowse.prototype.handleRowMouseDown.call(this, event);\" onmouseup=\"Projapi.Widgets.PJDataBrowse.prototype.handleRowMouseUp.call(this, event);\" onmouseover=\"Projapi.Widgets.PJDataBrowse.prototype.handleRowMouseOver.call(this, event);\" onclick=\"Projapi.Widgets.PJDataBrowse.prototype.handleRowClick.call(this, event);\">");
for(j=0;j<this._columns.length;j++){
_510=_508[i][this._columns[j]];
tbl.push(this._row0[j].str);
val=this._properties.columns[j].doColumn.translate[_510.value]||_510.value;
tbl.push(val.replace(/ /g,"&nbsp;").replace(/</g,"&lt;")||"&nbsp;");
tbl.push("</td>");
}
tbl.push("</tr>");
}
for(i=_508.length;i<this._properties.rows;i++){
tbl.push("<tr class=\"pjDataBrowseRow disabled");
if(i%2==1){
tbl.push(" alt");
}
tbl.push("\">");
tbl.push(this._row0.base);
tbl.push("</tr>");
}
for(i=1;i<1+2;i++){
tbl.push("<tr class=\"pjDataBrowseRow");
if(i%2==0){
tbl.push(" alt");
}
if(_50a){
tbl.push("\" style=\"display: none");
}
tbl.push("\">");
for(j=0;j<this._columns.length;j++){
tbl.push(this._row0[j].str);
tbl.push("&nbsp;");
tbl.push("</td>");
}
tbl.push("</tr>");
}
tbl.push("</tbody></table>");
var _517=Projapi.UI.Element.DOMfromString(tbl.join(""));
if(!this._objectHidden){
this.disable();
}
this.domNodes.contentDiv.removeChild(this.domNodes.contentTable);
this.domNodes.contentDiv.insertBefore(_517,this.domNodes.emptyQueryDiv);
_504=this.domNodes.contentTable=this.domNodes.contentDiv.firstChild;
rows=_504.rows;
row=rows[2];
for(i=0;i<_508.length;i++){
if(_508[i].style){
for(k in _508[i].style){
_504.rows[i+2].style[k]=_508[i].style[k];
}
}
for(j=0;j<this._columns.length;j++){
if(_508[i][j].style){
for(k in _508[i][j].style){
_504.rows[i+2].cells[j].style[k]=_508[i][j].style[k];
}
}
}
}
this._resetBorders();
if(!this._objectHidden){
this.enable();
}
Projapi.Profiler.Stop("DataBrowse_populate_table","");
if(rws<this._properties.rows&&!this._sizes.canOverflowY){
this._moreRows=null;
this.domNodes.scrollTH.style.display="none";
this.domNodes.contentDiv.style.overflowY="hidden";
}else{
this.domNodes.contentDiv.style.overflowY="";
if(this._moreRows=rws>this._properties.rows){
this.domNodes.scrollTH.style.display="";
}
}
if(this.selection.length>0){
this.selection[0][0]=this._actions.highlighted=_504.rows[this.selection[0][2]+2];
}
}
if(this._objectHidden){
this._resetScroll=true;
}else{
if(!_509){
this.domNodes.contentDiv.scrollTop=rows[2].offsetTop;
}
}
this.resize();
};
Projapi.Widgets.PJDataBrowse.prototype._makeColumn=function(_518,_519,_51a){
var _51b=this;
if(!_519){
throw new Error("DataBrowse %o is unable to find column %o in DataObject %o",this._objectName,_51a.name,this._dataSource._objectName);
}
_51a.doColumn=_519;
_51a.elem=_518;
_518.innerHTML=_51a.label||_519.name;
if(!_51a.minSize||_51a.minSize=="*"){
_51a.minSize="";
_51a.minWidth=this._sizes.emW;
}else{
_518.style.minWidth=(_51a.minWidth=this._sizes.emW*_51a.minSize)+"px";
}
if(!_51a.size||_51a.size=="*"){
_51a.size="";
this._properties.columns.cntAuto++;
}else{
_518.style.width=(_51a.width=this._sizes.emW*_51a.size)+"px";
}
if(_519.sortable&&!(_519.sortable==="false")){
_518.className="sortable";
_518.sorting=2;
Event.observe(_518,"click",function(_51c){
if(!_51b._objectEnabled){
return;
}
var th=_518;
var px=Event.pointerX(_51c);
var x=Position.page(th)[0];
if((px-x<5&&th.previousSibling)||(px>x+th.offsetWidth-10&&th.nextSibling&&th.nextSibling.nextSibling)){
return;
}
var _520=_518.sorting;
for(var i=0;i<_51b._tableHeaderRow.cells.length;i++){
_51b._tableHeaderRow.cells[i].sorting=2;
}
if(_520){
_518.sorting=0;
}else{
_518.sorting=1;
}
_51b.domNodes.sortImg.className=["sortImg asc","sortImg desc"][_518.sorting];
_518.appendChild(_51b.domNodes.sortImg);
_51b._dataSource.setQuerySort([[_519.name,_518.sorting]]);
},false);
}
if(_519.type=="number"||_519.type=="decimal"||_519.type=="integer"){
this._hasNumbers=_51a.isNumber=true;
}
var _pre="<td class=\"pjDataBrowseCell";
if(_51a.isNumber){
_pre+=" number";
}
_pre+="\" style=\"";
this._row0.push({str:_pre+"\">",base:_pre});
this._row0.base+=_pre+"\">&nbsp;</td>";
Event.observe(_518,"mousedown",this._onBeginResizeCol,false);
Event.observe(_518,"mousemove",function(_523){
var px=Event.pointerX(_523);
var th=_518;
var x=Position.page(th)[0];
if((px-x<5&&th.previousSibling)||(px>x+th.offsetWidth-10&&th.nextSibling)){
_518.style.cursor="w-resize";
}else{
_518.style.cursor="";
}
},false);
Event.observe(_518,"mouseout",function(_527){
_518.style.cursor="";
},false);
};
Projapi.Widgets.PJDataBrowse.prototype._onScroll=function(_528){
var rows=this.domNodes.contentTable.rows,div=this.domNodes.contentDiv;
this.domNodes.headerDiv.scrollLeft=div.scrollLeft;
this.domNodes.editDiv.scrollLeft=div.scrollLeft;
if(this._properties._lockScroll!=null){
div.scrollTop=this._properties._lockScroll;
}else{
this._scrolledSinceSelect=true;
if(rows[0].offsetHeight>0&&div.scrollTop<=rows[0].offsetHeight){
this._dataSource.fetchBatch(0);
}else{
if(rows[rows.length-1].offsetHeight>0&&div.scrollTop+div.clientHeight>=rows[rows.length-1].offsetTop){
this._dataSource.fetchBatch(1);
}
}
}
var h=rows[2].offsetHeight;
if(h){
var dO=this._dataSource.dataProxy;
dO._preparePosition(Math.floor(div.scrollTop/h)-2);
dO._preparePosition(Math.ceil((div.scrollTop+div.offsetHeight)/h)-2);
}
this._checkBorders();
};
Projapi.Widgets.PJDataBrowse.prototype._resetBorders=function(){
this.hasBefore=false;
this.hasAfter=false;
this._checkBorders=this.__checkBorders;
};
Projapi.Widgets.PJDataBrowse.prototype.__checkBorders=function(){
var dO=this._dataSource.dataProxy;
var rows=this.domNodes.contentTable.rows,l=rows.length-2,col,from,to,val;
if(!this.hasBefore&&dO.prevReq&&dO.prevReq.rows){
from=dO.prevReq.rows.last();
to=rows[1].cells;
for(col=0;col<this._columns.length;col++){
val=from[this._columns[col]].value||from[this._columns[col]];
to[col].innerHTML=this._properties.columns[col].doColumn.translate[val]||val;
}
if(dO.prevReq.rows.length>1){
from=dO.prevReq.rows[dO.prevReq.rows.length-2];
to=rows[0].cells;
for(col=0;col<this._columns.length;col++){
val=from[this._columns[col]].value||from[this._columns[col]];
to[col].innerHTML=this._properties.columns[col].doColumn.translate[val]||val;
}
}
this.hasBefore=true;
}
if(!this.hasAfter&&dO.nextReq&&dO.nextReq.rows){
from=dO.nextReq.rows[0];
to=rows[l].cells;
for(col=0;col<this._columns.length;col++){
val=from[this._columns[col]].value||from[this._columns[col]];
to[col].innerHTML=this._properties.columns[col].doColumn.translate[val]||val;
}
if(dO.nextReq.rows.length>1){
from=dO.nextReq.rows[1];
to=rows[l+1].cells;
for(col=0;col<this._columns.length;col++){
val=from[this._columns[col]].value||from[this._columns[col]];
to[col].innerHTML=this._properties.columns[col].doColumn.translate[val]||val;
}
}
this.hasAfter=true;
}
if(this.hasBefore&&this.hasAfter){
this._checkBorders=Prototype.emptyFunction;
}
};
Projapi.Widgets.PJDataBrowse.prototype.destroyObject=function(){
var obj,i;
if(obj=this._dataSource){
i=obj._notifyOnRequest.indexOf(this._actions.onRequestNotify);
if(i>-1){
obj._notifyOnRequest.splice(i,1);
}
}
this.publish(Projapi.Links.Container.DestroyObject);
if(this.getDOMNode()&&this.getDOMNode().domNode.parentNode){
this.getDOMNode().domNode.parentNode.removeChild(this.getDOMNode().domNode);
}
Projapi.Widgets.PJDataBrowse.superclass.destroyObject.call(this);
};
Projapi.Widgets.PJDataBrowse.prototype.dataAvailable=function(){
if(!this._objectInitialized){
return;
}
var dO=this._dataSource.dataProxy,rows=this.domNodes.contentTable.rows,pos;
if(dO.cache.length>0&&dO.options.currentIndex<rows.length-4){
if(!this._actions.highlighted||this._actions.highlighted.rowIndex!=dO.options.currentIndex+2){
this._actions.highlight(dO.options.currentIndex);
}
if(this._actions.highlighted){
if(!this._actions.highlighted.className.match(/\bselected\b/)){
this._actions.select(dO.options.currentIndex,false,true);
this._scrolledSinceSelect=true;
}
if(this._scrolledSinceSelect){
if(this._actions.highlighted.offsetTop<this.domNodes.contentDiv.scrollTop){
this.domNodes.contentDiv.scrollTop=this._actions.highlighted.offsetTop;
}else{
if(this.domNodes.contentDiv.scrollTop<(pos=this._actions.highlighted.offsetTop+this._actions.highlighted.offsetHeight-this.domNodes.contentDiv.clientHeight)){
this.domNodes.contentDiv.scrollTop=pos;
}
}
this._scrolledSinceSelect=false;
}
}
}
Projapi.Base.iPJDataView.prototype.dataAvailable.apply(this,arguments);
};
Projapi.Widgets.PJDataBrowse.prototype.getSelection=function(_539){
var i,j,cols=[],_53d=this._dataSource.dataProxy.options.columns;
for(i=0;i<_539.length;i++){
cols.push(_53d.getByName[_539[i]]);
}
var res=[],r;
for(i=0;i<this.selection.length;i++){
r=[];
for(j=0;j<cols.length;j++){
r.push(this.selection[i][3][cols[j]]);
}
res.push(r);
}
return res;
};
Projapi.Widgets.PJDataBrowse.prototype.updateState=function(_540){
if(_540=="UpdateComplete"){
this.enableObject();
}else{
this.disableObject();
}
};
Projapi.Widgets.PJDataBrowse.prototype.fetchDataSet=function(){
};
Projapi.Widgets.PJDataBrowse.prototype.handleRowClick=function(_541){
this.parentNode.parentNode.parentNode.ref._actions.select(this.rowIndex-2,_541.ctrlKey);
};
Projapi.Widgets.PJDataBrowse.prototype.handleRowContextMenu=function(_542){
this.parentNode.parentNode.parentNode.ref._actions.select(this.rowIndex-2,_542.ctrlKey);
};
Projapi.Widgets.PJDataBrowse.prototype.handleRowMouseOver=function(_543){
this.parentNode.parentNode.parentNode.ref._actions.highlight(this.rowIndex-2);
};
Projapi.Widgets.PJDataBrowse.prototype.handleRowMouseDown=function(_544){
if(window.opera){
this.mousex=Event.pointerX(_544);
this.mousey=Event.pointerY(_544);
}
};
Projapi.Widgets.PJDataBrowse.prototype.handleRowMouseUp=function(_545){
if(window.opera){
if((this.mousex||-1)==Event.pointerX(_545)&&(this.mousey||-1)==Event.pointerY(_545)){
this.parentNode.parentNode.parentNode.ref._actions.select(this.rowIndex-2,_545.ctrlKey);
}
}
};
Projapi.Widgets.PJDataBrowse.prototype._initHandlers=function(){
this._actions={select:Projapi.Widgets.PJDataBrowse._actions._select.bind(this),highlight:Projapi.Widgets.PJDataBrowse._actions._highlight.bind(this),updateSelectionStatus:Projapi.Widgets.PJDataBrowse._actions._updateSelectionStatus.bind(this),onKeyDown:Projapi.Widgets.PJDataBrowse._actions._onKeyDown.bindAsEventListener(this),onBlur:Projapi.Widgets.PJDataBrowse._actions._onBlur.bindAsEventListener(this),onFocus:Projapi.Widgets.PJDataBrowse._actions._onFocus.bindAsEventListener(this),onRequestNotify:Projapi.Widgets.PJDataBrowse._actions._onRequestNotify.bind(this)};
Event.observe(this.getDOMNode().domNode,"mouseout",(function(){
this._actions.highlight(this._dataSource.getIndex());
}).bind(this),false);
Event.observe(this.getDOMNode().domNode,"blur",this._actions.onBlur,false);
Event.observe(this.getDOMNode().domNode,"focus",this._actions.onFocus,false);
this.getDOMNode().domNode.tabIndex=this.getProperty("tabIndex",0,true);
Event.observe(this.getDOMNode().domNode,"keydown",this._actions.onKeyDown,false);
};
Projapi.Widgets.PJDataBrowse.prototype.applyEntry=function(){
if(this.getDOMNode()&&this.isObjectEnabled()){
this.getDOMNode().domNode.focus();
}
return this.hasFocus();
};
Projapi.Widgets.PJDataBrowse._actions={};
Projapi.Widgets.PJDataBrowse._actions._select=function(_546,_547,_548){
if((typeof _548=="undefined"||!_548)&&!this._objectEnabled){
return;
}
_547=_547&&this._properties.multiSelect;
var dO=this._dataSource.dataProxy,row=this.domNodes.contentTable.rows[_546+2];
if(!dO.cache[_546]){
return;
}
var _54b=dO.cache[_546][dO.options.columns.indexByName.rowid].value,i,_54d=false;
this._actions.highlight(_546);
if(!_547){
if(this.selection.length==1&&this.selection[0][0]&&this.selection[0][0].rowIndex==_546+2){
return;
}
for(i=0;i<this.selection.length;i++){
if(this.selection[i][0]){
this.selection[i][0].className=this.selection[i][0].className.replace(" selected","");
}
}
this.selection=[[row,_54b,_546,dO.cache[_546]]];
row.className+=" selected";
}else{
for(i=0;i<this.selection.length;i++){
if(this.selection[i][1]==_54b){
_54d=true;
row.className=row.className.replace(" selected","");
this.selection.splice(i,1);
}
}
if(!_54d){
this.selection.push([row,_54b,_546,dO.cache[_546]]);
row.className+=" selected";
}
}
this._dataSource.fetchRow(_546);
this.publish("SelectionChanged");
this._scrolledSinceSelect=false;
};
Projapi.Widgets.PJDataBrowse._actions._highlight=function(_54e){
if(this._actions.highlighted){
if(this._actions.highlighted.rowIndex-2==_54e){
return;
}else{
this._actions.highlighted.className=this._actions.highlighted.className.replace(" highlight","");
}
}
if((_54e>=this.domNodes.contentTable.rows.length-4)||(_54e>=this._dataSource.dataProxy.cache.length)){
this._actions.highlighted=null;
return;
}
this._actions.highlighted=this.domNodes.contentTable.rows[_54e+2];
this._actions.highlighted.className+=" highlight";
};
Projapi.Widgets.PJDataBrowse._actions._updateSelectionStatus=function(){
var i,j,dO=this._dataSource.dataProxy,_552=dO.options.columns.indexByName.rowid,rows=this.domNodes.contentTable.rows;
for(i=0;i<this.selection.length;i++){
for(j=0;j<dO.cache.length;j++){
if(dO.cache[j][_552].value==this.selection[i][1]){
this.selection[i][0]=rows[j+2];
rows[j+2].className+=" selected";
break;
}
}
}
};
Projapi.Widgets.PJDataBrowse._actions._onKeyDown=function(_554){
var key=_554.keyCode?_554.keyCode:_554.which;
var _556=false,src=this._dataSource;
if(Prototype.Browser.WebKit&&key>=33&&key<=40){
var _558=this,scrl=this.domNodes.contentDiv.scrollTop;
setTimeout(function(){
_558.domNodes.contentDiv.scrollTop=scrl;
},10);
}
if(this.isObjectEnabled()){
switch(key){
case 38:
this.publish(Projapi.Links.Navigation.FetchPrev);
break;
case 40:
this.publish(Projapi.Links.Navigation.FetchNext);
break;
case 33:
src.fetchRow(src._properties.currentIndex-(this._properties.rows-1));
break;
case 34:
src.fetchRow(src._properties.currentIndex+(this._properties.rows-1));
break;
case 36:
this.publish(Projapi.Links.Navigation.FetchFirst);
break;
case 35:
this.publish(Projapi.Links.Navigation.FetchLast);
break;
case 13:
this._actions.select(this._dataSource.getIndex(),_554.ctrlKey);
this._scrolledSinceSelect=true;
Projapi.Util.Trigger(this,"onEnter");
if(!this.getProperty("onEnterExecute",false,true)&&!this.getProperty("onEnterEval",false,true)&&!this.getProperty("onEnterPublish",false,true)){
_556=true;
}
break;
default:
_556=true;
}
}else{
_556=true;
}
if(_556){
return true;
}
Event.stop(_554);
return false;
};
Projapi.Widgets.PJDataBrowse._actions._onKeyUp=function(){
};
Projapi.Widgets.PJDataBrowse._actions._onBlur=function(){
this._hasFocus=false;
};
Projapi.Widgets.PJDataBrowse._actions._onFocus=function(){
this._hasFocus=true;
Projapi.Util.Trigger(this,"onApplyEntry");
Projapi.FocusManager.setFocusedObject(this);
};
Projapi.Widgets.PJDataBrowse._actions._onRequestNotify=function(_55a){
this._disabledSource=!!_55a;
if(this._disabledSource){
if(!this._objectHidden){
this._visualBlock=true;
var zI=parseInt($P(this._windowName)._domNode.domNode.style.zIndex||0)+1;
Projapi.Util.BlockWindow(this.domNodes.contentDiv,2,false,zI);
}
if(this._objectEnabled){
this.disable();
}
}else{
if(this._visualBlock){
this._visualBlock=false;
Projapi.Util.ClearWindow(this.domNodes.contentDiv);
}
if(this._objectEnabled){
this.enable();
}
}
};
Projapi.Widgets.PJDataBrowse.prototype.isMultiSelect=function(){
return this._properties.multiSelect;
};
Projapi.Widgets.PJDataBrowse.prototype.setMultiSelect=function(_55c){
this._properties.multiSelect=_55c;
};
Projapi.Widgets.PJDataBrowse.prototype.addContainerTarget=function(_55d){
if(_55d.getObjectType){
switch(_55d.getObjectType()){
case "SmartToolbar":
this.setToolbar(_55d);
break;
case "PopupMenu":
this.setPopup(_55d);
break;
default:
if(this._fields.indexOf(_55d)>-1){
break;
}
console.log("[Warning] Attempt to link unsupported object to DataBrowse. The alien object is %o",_55d);
}
}else{
console.log("[Warning] Attempt to link unsupported object to DataBrowse. The alien object is %o",_55d);
}
if(_55d._objectType!="SmartWindow"){
_55d._windowName=this._windowName;
_55d._propagateWindowName();
}
if(this._objectCreated&&!_55d._objectCreated){
_55d.createObjects();
}
if(this._objectInitialized&&!_55d._objectInitialized){
_55d.initializeObject();
}
};
Projapi.Widgets.PJDataBrowse.prototype.getContainerTarget=function(){
return this.getToolbar();
};
Projapi.Widgets.PJDataBrowse.prototype.removeContainerTarget=function(_55e){
if(_55e.getObjectType){
switch(_55e.getObjectType()){
case "SmartToolbar":
this.removeToolbar(_55e);
break;
case "PopupMenu":
this.removePopup(_55e);
break;
}
}
};
Projapi.Widgets.PJDataBrowse.prototype.getDataSource=function(){
return this._dataSource;
};
Projapi.Widgets.PJDataBrowse.prototype.removeDataSource=function(){
this._dataSource=null;
};
Projapi.Widgets.PJDataBrowse.prototype.setDataSource=function(_55f){
this._dataSource=_55f;
};
Projapi.Widgets.PJDataBrowse.prototype.getNavigationTarget=function(){
return this.navigationTarget;
};
Projapi.Widgets.PJDataBrowse.prototype.removeNavigationTarget=function(){
this.navigationTarget=null;
};
Projapi.Widgets.PJDataBrowse.prototype.setNavigationTarget=function(_560){
this.navigationTarget=_560;
};
Projapi.Widgets.PJDataBrowse.prototype.getLayoutManager=function(){
return this.layoutManager;
};
Projapi.Widgets.PJDataBrowse.prototype.removeLayoutManager=function(){
this.layoutManager=new Projapi.Widgets.PJDataBrowse.createDefaultLayoutManager(this);
};
Projapi.Widgets.PJDataBrowse.prototype.setLayoutManager=function(_561){
this.layoutManager=_561;
};
Projapi.Widgets.PJDataBrowse.prototype.getPopup=function(){
return this.popup;
};
Projapi.Widgets.PJDataBrowse.prototype.removePopup=function(){
this.popup=null;
};
Projapi.Widgets.PJDataBrowse.prototype.setPopup=function(_562){
if(this.popup==_562){
return;
}
this.popup=_562;
if(this._objectCreated&&!this.popup._objectCreated){
this.popup.createObjects();
}
if(this._objectInitialized&&!this.popup._objectInitialized){
this.popup.initializeObject();
}
};
Projapi.Widgets.PJDataBrowse.prototype.getToolbar=function(){
return this.toolbar;
};
Projapi.Widgets.PJDataBrowse.prototype.removeToolbar=function(){
if(this.toolbar){
this.toolbar.removeLink(Projapi.Links.TableIO,this);
this.toolbar=null;
}
};
Projapi.Widgets.PJDataBrowse.prototype.setToolbar=function(_563){
if(this.toolbar==_563){
return;
}
this.toolbar=_563;
if(this.toolbar){
if(this.toolbar.getContainerSource()&&this.toolbar.getContainerSource()!=this){
this.toolbar.getContainerSource().removeLink(Projapi.Links.Container,this.toolbar);
}
if(!this._windowName){
this._windowName=Projapi.Register._getWindowName(this.getContainerSource());
}
_563._windowName=this._windowName;
this.addLink(Projapi.Links.Container,this.toolbar);
if(this.isObjectCreated()&&!this.toolbar.isObjectCreated()){
this.toolbar.createObjects();
}
if(this.isObjectInitialized()&&!this.toolbar.isObjectInitialized()){
this.toolbar.initializeObject();
}
this.toolbar.addLink(Projapi.Links.TableIO,this);
}
};
Projapi.Widgets.PJDataBrowse.createDefaultLayoutManager=function(_564){
var add=(function(obj){
var _567=false;
if(obj.getObjectType){
switch(obj.getObjectType()){
case "SmartToolbar":
_567=true;
break;
}
}
var what=obj.getDOMNode(),_569=this.getDOMNode();
if(obj instanceof Projapi.Widgets.PJField){
_569=this.domNodes.editDiv;
}
if(!what){
console.debug("LayoutManager.add called, but the object requesting does not have a DOM Node: %o",obj);
return;
}
if(what.domNode){
what=what.domNode;
}
if(_569.domNode){
_569=_569.domNode;
}
if(what.parentNode==_569){
return;
}
if(!_567||!_569.firstChild){
_569.appendChild(what);
}else{
_569.insertBefore(what,_569.firstChild);
}
}).bind(_564);
return {add:add};
};
Projapi.Widgets.PJDataBrowse.prototype.hideObject=function(){
Projapi.Widgets.PJDataBrowse.superclass.hideObject.call(this);
if(this.toolbar){
this.toolbar.hideObject();
}
if(this.popup){
this.popup.hideObject();
}
if(this._disabledSource){
if(this._visualBlock){
this._visualBlock=false;
Projapi.Util.ClearWindow(this.domNodes.contentDiv);
}
}
};
Projapi.Widgets.PJDataBrowse.prototype.viewObject=function(){
Projapi.Util.Trigger(this,"onViewObject");
if(this._properties.hide){
return;
}
if(this._objectHidden){
this._objectHidden=false;
this._domNode.domNode.style.display="";
}
this._resizeFct();
if(this._properties._allFixed){
this._domNode.domNode.style.maxWidth=this._tableHeaderRow.offsetWidth+"px";
}
if(this._resetScroll){
this.domNodes.contentDiv.scrollTop=this.domNodes.contentTable.rows[2].offsetTop;
this._resetScroll=false;
}
if(this.toolbar){
this.toolbar.viewObject();
}
if(this._disabledSource){
this._visualBlock=true;
var zI=parseInt($P(this._windowName)._domNode.domNode.style.zIndex||0)+1;
Projapi.Util.BlockWindow(this.domNodes.contentDiv,2,false,zI);
}
};
Projapi.Widgets.PJDataBrowse.prototype.exitObject=function(){
this.publish(Projapi.Links.Container.ExitObject);
};
Projapi.Widgets.PJDataBrowse.prototype.resize=function(){
if(this._objectHidden){
return;
}
setTimeout(this._resizeFct.bind(this),10);
this.publish("resize");
};
Projapi.Widgets.PJDataBrowse.prototype._resizeFct=function(){
var cw=this._tableHeaderRow.offsetWidth;
var ccw=this.domNodes.contentTable.style.width;
if(cw==0){
return;
}
if(this._moreRows==false){
if(this._tableHeaderRow.offsetWidth>this.domNodes.contentDiv.offsetWidth){
if(this.domNodes.scrollTH.style.display=="none"){
this.domNodes.scrollTH.style.display="";
}
cw-=this._sizes.spacerW;
}else{
if(this.domNodes.scrollTH.style.display!="none"){
this.domNodes.scrollTH.style.display="none";
}
}
}else{
if(this._moreRows){
cw-=this._sizes.spacerW;
}
}
if(ccw!=cw+"px"){
this.domNodes.contentTable.style.width=cw+"px";
this._copyColWidths();
}
};
Projapi.Widgets.PJDataBrowse.prototype._beginResizeCol=function(_56d){
this._resize.pointer=[Event.pointerX(_56d),Event.pointerY(_56d)];
var th=Event.element(_56d);
while(th.parentNode&&th.tagName!="TH"){
th=th.parentNode;
}
if(th.tagName!="TH"){
return;
}
this._resize.multiply=1;
this._resize.bubble=true;
var x=Position.page(th)[0];
if(this._resize.pointer[0]-x<5){
if(th.previousSibling){
th=th.previousSibling;
}else{
return;
}
}else{
if(this._resize.pointer[0]<=x+th.offsetWidth-10){
return;
}else{
if(th.nextSibling.className.match(/\bspacer\b/)){
return;
}
}
}
if(!th.style.width&&th.nextSibling.style.width){
th=th.nextSibling;
this._resize.multiply=-1;
this._resize.bubble=false;
}
this._resize.resizing=th;
this._resize.resizingIdx=0;
var th1=th,i;
while(th1.previousSibling){
this._resize.resizingIdx++;
th1=th1.previousSibling;
}
if(!th.style.width){
if(this._properties.columns.cntAuto>1){
th.style.width=th.offsetWidth-this._sizes.deltaW;
this._properties.columns[this._resize.resizingIdx].size=true;
}else{
return;
}
}
this._resize.origWidth=th.offsetWidth;
this._resize.availAfter=0;
this._resize.availBefore=0;
for(i=this._resize.resizingIdx+1;i<this._properties.columns.length;i++){
this._resize.availAfter+=this._properties.columns[i].elem.offsetWidth-this._properties.columns[i].minWidth;
}
for(i=this._resize.resizingIdx-1;i>=0;i--){
this._resize.availBefore+=this._properties.columns[i].elem.offsetWidth-this._properties.columns[i].minWidth;
}
i=this._resize.resizingIdx;
if(this._resize.multiply>0){
this._resize.availBefore+=this._properties.columns[i].elem.offsetWidth-this._properties.columns[i].minWidth;
}else{
if(this._resize.multiply<0){
this._resize.availAfter+=this._properties.columns[i].elem.offsetWidth-this._properties.columns[i].minWidth;
}
}
Event.observe(document,"mousemove",this._onUpdateResizeCol,false);
Event.observe(document,"mouseup",this._onEndResizeCol,false);
document.body.ondrag=function(){
return false;
};
document.body.onselectstart=function(){
return false;
};
Event.stop(_56d);
};
Projapi.Widgets.PJDataBrowse.prototype._updateResizeCol=function(_572){
var ptr=[Event.pointerX(_572),Event.pointerY(_572)];
var dx=(ptr[0]-this._resize.pointer[0]),newW;
dx=Math.max(Math.min(dx,this._resize.availAfter),-this._resize.availBefore);
dx*=this._resize.multiply;
if(this._properties.columns[this._resize.resizingIdx].minWidth){
newW=Math.max(this._resize.origWidth+dx,this._properties.columns[this._resize.resizingIdx].minWidth);
}else{
newW=Math.max(this._resize.origWidth+dx,this._sizes.deltaW);
}
dx=newW-this._resize.origWidth;
this._resize.resizing.style.width=(newW-this._sizes.deltaW)+"px";
var th1=this._resize.resizing.nextSibling;
var id1=this._resize.resizingIdx+1;
if(this._resize.bubble){
if(dx<0){
if(th1.style.width){
th1.style.width=(this._properties.columns[id1].width-dx-this._sizes.deltaW)+"px";
}
}else{
while(1){
var tcol=this._properties.columns[id1];
if(!tcol){
break;
}
var dd=0;
if(th1.style.width){
dd=Math.min(dx,(tcol.width||tcol.elem.offsetWidth)-tcol.minWidth);
if(!tcol.width){
console.log("%o",tcol);
}
th1.style.width=((tcol.width||tcol.elem.offsetWidth)-dd-this._sizes.deltaW)+"px";
}
dx-=dd;
id1++;
th1=th1.nextSibling;
}
}
}
if(typeof opera!="undefined"&&opera.postError){
this._resize.resizing.style.display="none";
this._resize.resizing.style.display="";
}
Event.stop(_572);
};
Projapi.Widgets.PJDataBrowse.prototype._endResizeCol=function(_57a){
var cols=this._properties.columns,id1=this._resize.resizingIdx,th1=this._resize.resizing;
while(id1<cols.length){
if(th1.style.width){
cols[id1].width=th1.offsetWidth;
}
id1++;
th1=th1.nextSibling;
}
this._copyColWidths();
Event.stopObserving(document,"mousemove",this._onUpdateResizeCol,false);
Event.stopObserving(document,"mouseup",this._onEndResizeCol,false);
document.body.ondrag=null;
document.body.onselectstart=null;
Event.stop(_57a);
};
Projapi.Widgets.PJDataBrowse.prototype._copyColWidths=function(vec){
var i,rows=this.domNodes.contentTable.rows,_581=this._tableHeaderRow.cells,row0=rows[0],rowL=rows[rows.length-1],row2=rowL;
var _585=rows.length>0;
if(rows.length>4){
row2=rows[2];
}
var _586=new Array(_581.length-1),dif=false,last;
for(i=0;i<_581.length-1;i++){
if(vec){
last=vec[i]-this._sizes.cellDeltaW+"px";
}else{
last=(_581[i].offsetWidth||(parseInt(_581[i].style.width)+this._sizes.deltaW))-this._sizes.cellDeltaW+"px";
}
if(last!=this._lastWidths[i]){
dif=true;
}
_586[i]=last;
}
if(dif){
this._lastWidths=_586;
var _589=this.domNodes.headerDiv.scrollLeft;
if(this._fields[0]){
this._setEditorsWidth();
}
for(i=0;i<_581.length-1;i++){
this._row0[i].str=this._row0[i].base+"width: "+_586[i]+"\">";
if(_585){
row2.cells[i].style.width=rowL.cells[i].style.width=row0.cells[i].style.width=_586[i];
}
}
this.domNodes.headerDiv.scrollLeft=_589;
this.domNodes.contentDiv.scrollLeft=_589;
}
};
Projapi.Widgets.PJDataBrowse.inheritDataView=function(){
var o1=Projapi.Base.iPJDataView,p1=o1.prototype,o2=Projapi.Widgets.PJDataBrowse,p2=o2.prototype;
for(var i in p1){
if(!p2[i]||(p1[i]!=p2[i]&&p2[i]==o1.superclass[i])){
Projapi.Widgets.PJDataBrowse.prototype[i]=Projapi.Base.iPJDataView.prototype[i];
}
}
Projapi.Widgets.PJDataBrowse.inheritDataView=function(){
};
};
Projapi.Widgets.PJDataBrowse.prototype.setEditable=function(_58f){
if(this._properties.editable==_58f){
return;
}
this._properties.editable=_58f;
var col;
if(_58f){
for(var i=0;i<this._columns.length;i++){
if(!this._fields[i]){
col=this._properties.columns[i];
this._fieldNames[i]=this._objectName+"-editor-"+i;
this._fields[i]=new Projapi.Widgets.PJField(this._fieldNames[i],Projapi.Util.Extend({layoutCol:i,hide:true,required:!!col.required,doColumnName:col.doColumn.name},col.doColumn));
if(this._disableFields&&(this._properties.columns[i].editable==false)){
this._properties.fieldsDisabledOnUpdate.push(this._fieldNames[i]);
}
this.addLink(Projapi.Links.Container.CreateObjects,this._fields[i]);
this._fields[i].addLink(Projapi.Links.Action,this);
this._fieldDOColumnNames.push(col.doColumn.name);
this._fieldParams[col.doColumn.name]=null;
if(col.isNumber&&this._objectInitialized){
this._fields[i]._fieldRepr._fieldElement.domNode.style.textAlign="right";
}
if(!this.isSaveMode()){
this._fields[i].disableObject();
}else{
this._fields[i].enableObject();
}
}
}
if(this._objectInitialized){
Projapi.Base.iPJDataView.prototype.dataAvailable.call(this);
}
this._setEditorsWidth();
}
};
Projapi.Widgets.PJDataBrowse.prototype.enableFields=function(){
Projapi.Base.iPJDataView.prototype.enableFields.apply(this,arguments);
var left,top,_594,i;
if(this.domNodes.editDiv.style.display=="none"){
left=Position.page(this._actions.highlighted);
_594=Position.page($P(this._windowName).getDOMNode().domNode);
top=left[1]-_594[1]-(this._resize.editorOffset||0);
left=left[0]-_594[0];
i=this.domNodes.editDiv.previousSibling.offsetWidth;
if(this.domNodes.editDiv.offsetLeft!=left){
this.domNodes.editDiv.style.left=left+"px";
this.domNodes.editDiv.style.top=top+"px";
}else{
if(this.domNodes.editDiv.offsetTop!=top){
this.domNodes.editDiv.style.top=top+"px";
}
}
this.domNodes.editDiv.style.width=i+"px";
this.domNodes.editDiv.style.display="";
for(i=0;i<this._fields.length;i++){
this._fields[i]._properties.hide=false;
this._fields[i].viewObject();
}
if(this._resize.editorOffset==null){
i=(this._fields[0]._fieldRepr._fieldElement.domNode.offsetHeight-this._actions.highlighted.offsetHeight)/2;
this._resize.editorOffset=i;
if(i!=0){
this.domNodes.editDiv.style.top=top-i+"px";
}
}
if(this._fieldsFKpositioned==false){
this._fieldsFKpositioned=true;
var _596=this._fields[0]._fieldRepr._fieldElement.domNode.offsetHeight;
this.domNodes.editDiv.style.height=_596+this.domNodes.editDiv.offsetHeight+"px";
for(i=0;i<this._fields.length;i++){
if(this._fields[i]._fkToolbutton){
var node=this._fields[i]._nodes.chooser.domNode;
node.style.marginLeft=-node.offsetWidth+"px";
node.style.top=_596+"px";
node.style.position="absolute";
}
}
}
}
};
Projapi.Widgets.PJDataBrowse.prototype.disableFields=function(){
Projapi.Base.iPJDataView.prototype.disableFields.apply(this,arguments);
if(this.domNodes.editDiv.style.display!="none"){
var hide=true;
for(var i=0;i<this._fields.length;i++){
if(this._fields[i]&&this._fields[i]._objectEnabled){
hide=false;
break;
}
}
if(hide){
this.domNodes.editDiv.style.display="none";
for(var i=0;i<this._fields.length;i++){
this._fields[i]._properties.hide=true;
this._fields[i].hideObject();
}
}
}
};
Projapi.Widgets.PJDataBrowse.prototype._setEditorsWidth=function(){
var i;
var _59b=this._tableHeaderRow.cells;
var _59c=[],left=[];
for(i=0;i<_59b.length;i++){
_59c[i]=(_59b[i].offsetWidth||(parseInt(_59b[i].style.width)+this._sizes.deltaW))-4+"px";
left[i]=_59b[i].offsetLeft;
}
for(i=0;i<this._fields.length;i++){
this._fields[i]._fieldRepr._fieldElement.domNode.style.width=_59c[i];
}
var _59e=this._fields[0]._fieldRepr._fieldElement.domNode.offsetHeight;
for(i=0;i<this._fields.length;i++){
if(this._fields[i]._fkToolbutton){
var node=this._fields[i]._nodes.chooser.domNode;
node.style.left=left[i+1]+"px";
}
}
};
if(typeof Projapi=="undefined"){
var Projapi={};
}
if(typeof Projapi.Base=="undefined"){
Projapi.Base={};
}
Projapi.Base.iPJSmartContainer=function(_5a0,_5a1){
Projapi.Base.iPJSmartContainer.superclass.constructor.call(this,_5a0,_5a1);
this._containerTarget=[];
this._pageN=[];
this._currentPage=-1;
this._pageNode=[];
this._titles=[];
this._contentDOMNode=null;
this.ContainerTargetEvents=Projapi.Links.Container.TargetEvents;
this._DOMClassPrefix="pjSmartContainer";
this._layoutManagers=[];
this._layed=[];
this._objectType="SmartContainer";
this._canFocus=true;
this._processObjectProperties();
};
Projapi.extend(Projapi.Base.iPJSmartContainer,Projapi.Base.iPJVisualObject);
Projapi.Base.iPJSmartContainer.prototype.createObjects=function(){
try{
var _5a2,idx=0,_5a4=this._containerTarget.length,_5a5,idx2=0,_5a7;
if(!this._isUIBuilt()){
this._buildUI();
}
_5a4=this._pageN.length;
for(idx=0;idx<_5a4;idx++){
_5a5=this._pageN[idx];
idx2=0;
_5a7=_5a5.length;
if(this._layoutManagers[idx]){
this.setLayoutManager(this._getLayoutManagerInstance(this._layoutManagers[idx],idx),idx);
}else{
this.setLayoutManager(this._getLayoutManagerInstance(null,idx),idx);
}
}
this.publish(Projapi.Links.Container.CreateObjects);
this._objectCreated=true;
if(!this.getContainerSource()){
this.initializeObject();
}
}
catch(e){
console.error(e);
}
};
Projapi.Base.iPJSmartContainer.prototype._isUIBuilt=function(){
var _5a8="pjContent_"+this._objectName;
if(this._domNode&&this.getContentDOMNode()&&this._arePagesUIBuilt()){
return true;
}
if(!this._domNode){
if($(this._objectName)){
this.setDOMNode(Projapi.UI.Element.get($(this._objectName)));
if(this._containerSource){
this._containerSource.getLayoutManager(this._objectPage).add(this);
}
}
}
if(!this.getContentDOMNode()){
if(this._properties.singlePage){
this.setContentDOMNode(this._domNode);
}else{
if($(_5a8)){
this.setContentDOMNode(Projapi.UI.Element.get($(_5a8)));
}
}
}
if(this._containerSource&&!this._containerSource.getLayoutManager()){
console.warn("Container %s does not have a layout manager ",this.getContainerSource().getObjectName());
}
return (this._domNode&&this.getContentDOMNode()&&this._arePagesUIBuilt());
};
Projapi.Base.iPJSmartContainer.prototype._arePagesUIBuilt=function(){
var idx=0,_5aa=this._pageN.length;
for(idx;idx<_5aa;idx++){
if(!this._pageNode[idx]){
if(!this._UIScanForPage(idx)){
return false;
}
}
}
return true;
};
Projapi.Base.iPJSmartContainer.prototype._UIScanForPage=function(_5ab){
var _5ac;
if(_5ab==0){
if(!this.getContentDOMNode()){
return false;
}
if(this._properties.singlePage){
this._pageNode[0]=this._domNode;
return true;
}
_5ac=this.getContentDOMNode().domNode.firstChild;
while(_5ac){
if(_5ac&&_5ac.nodeName=="DIV"&&_5ac.className.match(/\bpjPage\b/)){
this._pageNode[_5ab]=Projapi.UI.Element.get(_5ac);
return true;
}
_5ac=_5ac.nextSibling;
}
return false;
}else{
_5ac=this._pageNode[_5ab-1];
if(_5ac){
_5ac=_5ac.domNode.nextSibling;
while(_5ac){
if(_5ac&&_5ac.nodeName=="DIV"&&_5ac.className.match(/\bpjPage\b/)){
this._pageNode[_5ab]=Projapi.UI.Element.get(_5ac);
return true;
}
_5ac=_5ac.nextSibling;
}
return false;
}else{
this._UIScanForPage(_5ab-1);
}
}
};
Projapi.Base.iPJSmartContainer.prototype._UIBuildPage=function(_5ad){
var idx=0,_5af=this._pageN.length,_5b0,_5b1;
if(this._pageNode[_5ad]){
return;
}
_5b0=Projapi.UI.Element.fromString("<div class=\"pjPage\" style=\"display: none\"></div>");
if(_5ad==0){
this._contentDOMNode.domNode.appendChild(_5b0.domNode);
}else{
_5b1=this._pageNode[_5ad-1];
if(_5b1){
this._contentDOMNode.domNode.insertBefore(_5b0.domNode,_5b1.nextSibling||null);
}else{
this._UIBuildPage(_5ad-1);
}
}
this._pageNode[_5ad]=_5b0;
if(this._windowType!="inline"&&this._objectType!="ToolGroup"&&this._objectType!="SmartToolbar"){
Projapi.Hotkeys.registerContext(_5b0.domNode);
}
};
Projapi.Base.iPJSmartContainer.prototype._buildUI=function(){
};
Projapi.Base.iPJSmartContainer.prototype.initializeObject=function(){
Projapi.Base.iPJSmartContainer.superclass.initializeObject.call(this);
this._processVisualObjectProperties();
this.publish(Projapi.Links.Container.InitializeObject);
this._objectInitialized=true;
if(!this._properties.hideOnInit){
if(this._objectType=="SmartWindow"){
this.viewObject();
}
this.selectPage(this._properties.initPage||0);
}
Projapi.Controller.objectInit(this);
};
Projapi.Base.iPJSmartContainer.prototype._getLayoutManagerInstance=function(_5b2,_5b3){
if(typeof _5b2=="undefined"||_5b2==null){
_5b2=this.getProperty("layout","Layout");
}
if(typeof _5b3=="undefined"){
_5b3=0;
}
if(typeof _5b2=="object"){
return _5b2;
}
if(typeof _5b2=="string"){
if(Projapi.Layout[_5b2]){
return new Projapi.Layout[_5b2](this,_5b3);
}else{
console.warn("Unable to find layout manager %s for container %s",_5b2,this.getObjectName());
return new Projapi.Layout.Layout(this,_5b3);
}
}else{
if(typeof _5b2=="function"){
try{
return new _5b2(this,_5b3);
}
catch(e){
console.warn("Unable to load and create layout manager %s for container %s",_5b2,this.getObjectName());
return new Projapi.Layout.Layout(this,_5b3);
}
}else{
console.warn("Unable to understand layout manager %s for container %s",_5b2,this.getObjectName());
return new Projapi.Layout.Layout(this,_5b3);
}
}
};
Projapi.Base.iPJSmartContainer.prototype.addPage=function(_5b4,_5b5,_5b6){
if(isNaN(_5b4)||(_5b4<0)||(_5b4>this._pageN.length)){
return false;
}
if(!this._pageN[_5b4]){
this._pageN[_5b4]=[];
}
if(_5b6){
this._titles[_5b4]=_5b6;
}
if(this._objectCreated){
if(this._objectInitialized){
this._buildUI();
}
this.setLayoutManager(this._getLayoutManagerInstance(_5b5,_5b4),_5b4);
if(_5b4==0){
this.selectPage(0);
}
}else{
this._layoutManagers[_5b4]=_5b5;
}
};
Projapi.Base.iPJSmartContainer.prototype.selectPage=function(_5b7){
if(!this.isObjectInitialized()||(_5b7<0)||(_5b7>this._pageN.length-1)||(isNaN(_5b7))||_5b7==this._currentPage||(!this._objectEnabled&&this._currentPage>-1)){
return;
}
var idx=0,_5b9,_obj;
this.publish(Projapi.Links.Page.SelectFolderPage);
var _5bb=this._currentPage;
this._currentPage=_5b7;
if(this._pageN[_5bb]){
_5b9=this._pageN[_5bb].length;
if(!this._objectHidden){
for(;idx<_5b9;++idx){
this._pageN[_5bb][idx].hideObject();
}
}
this._pageNode[_5bb].domNode.style.display="none";
}
if(!this._pageNode[_5b7]){
return;
}
this._pageNode[_5b7].domNode.style.display="";
idx=0;
_5b9=this._pageN[_5b7].length;
if(!this._objectHidden){
for(;idx<_5b9;++idx){
_obj=this._pageN[_5b7][idx];
if(_obj&&_obj._objectType!="SmartWindow"){
_obj.viewObject();
}
}
}
if(!this._objectHidden&&!this._layed[this._currentPage]){
this._layoutManagers[this._currentPage].layout();
this._layed[this._currentPage]=true;
}
};
Projapi.Base.iPJSmartContainer.prototype.deletePage=function(_5bc){
if((_5bc>this._pageN.length-1)||(isNaN(_5bc))){
console.warn("Unable to delete page "+_5bc);
return false;
}
if(this.confirmExit(false,_5bc)){
return false;
}
var idx=0,_5be=this._pageN[_5bc].length;
this.publish(this,Projapi.Links.Page.DeleteFolderPage);
if(_5bc==this._currentPage){
if(_5bc<this._pageN.length-1){
this.selectPage(_5bc+1);
}else{
this.selectPage(_5bc-1);
}
}
for(;idx<_5be;++idx){
this._pageN[_5bc][idx].destroyObject();
}
for(idx=_5bc+1;idx<this._pageN.length;idx++){
for(var i=0;i<this._pageN[idx].length;i++){
this._pageN[idx][i]._objectPage--;
}
}
this._layoutManagers[_5bc].destroy();
this._layoutManagers[_5bc]=null;
this._layoutManagers.splice(_5bc,1);
this._pageN.splice(_5bc,1);
this._pageNode[_5bc].domNode.parentNode.removeChild(this._pageNode[_5bc].domNode);
this._pageNode.splice(_5bc,1);
return true;
};
Projapi.Base.iPJSmartContainer.prototype.getContainerTarget=function(){
return this._containerTarget;
};
Projapi.Base.iPJSmartContainer.prototype.addContainerTarget=function(_5c0){
if(this._containerTarget.indexOf(_5c0)!=-1){
return;
}
this._containerTarget.push(_5c0);
if(!(_5c0 instanceof Projapi.Widgets.PJPopupMenu)){
var pg=_5c0._objectPage;
while(this._pageN.length<=pg||this._pageN[pg]==null){
this.addPage(this._pageN.length,null,"Page "+this._pageN.length);
}
this._pageN[pg].push(_5c0);
this._layed[pg]=false;
}
if(this._objectType!="SmartWindow"){
_5c0._properties.hideOnInit=true;
}
this.addLink(Projapi.Links.Container,_5c0);
if(_5c0._objectType!="SmartWindow"){
_5c0._windowName=this._windowName;
_5c0._propagateWindowName();
}
if(this._objectCreated){
_5c0.createObjects();
}
if(this._objectInitialized){
_5c0.initializeObject();
if(!this._objectHidden&&pg==this._currentPage){
_5c0.viewObject();
}else{
_5c0.hideObject();
}
}
};
Projapi.Base.iPJSmartContainer.prototype.removeContainerTarget=function(_5c2){
var idx=this._containerTarget.indexOf(_5c2);
if(idx!=-1){
this._containerTarget.splice(idx,1);
}
if(!(_5c2 instanceof Projapi.Widgets.PJPopupMenu)){
var pg=_5c2.getObjectPage();
if(this._pageN[pg]&&(idx=this._pageN[pg].indexOf(_5c2))>-1){
this._pageN[pg].splice(idx,1);
this._layed[pg]=false;
}
}
};
Projapi.Base.iPJSmartContainer.prototype.enableObject=function(){
Projapi.Base.iPJSmartContainer.superclass.enableObject.call(this);
this.publish(Projapi.Links.Container.EnableObject);
};
Projapi.Base.iPJSmartContainer.prototype.disableObject=function(){
Projapi.Base.iPJSmartContainer.superclass.disableObject.call(this);
this.publish(Projapi.Links.Container.DisableObject);
};
Projapi.Base.iPJSmartContainer.prototype.hideObject=function(){
Projapi.Base.iPJSmartContainer.superclass.hideObject.call(this);
this.publish(Projapi.Links.Container.HideObject);
};
Projapi.Base.iPJSmartContainer.prototype.viewObject=function(_5c5){
Projapi.Base.iPJSmartContainer.superclass.viewObject.call(this);
if(this._currentPage==-1){
this.selectPage(0);
}else{
for(var idx=0,_5c7=this._pageN[this._currentPage].length;idx<_5c7;++idx){
if(this._pageN[this._currentPage][idx]._objectType!="SmartWindow"){
this._pageN[this._currentPage][idx].viewObject();
}
}
}
};
Projapi.Base.iPJSmartContainer.prototype.applyEntry=function(){
if(this.getProperty("firstEntryField",false,true)){
var _5c8=Projapi.Register.get(this.getProperty("firstEntryField",null,true));
if(_5c8){
_5c8.applyEntry();
}
}else{
var idx=0,_obj,_res;
var _5cc=this._pageN[this._currentPage].length;
for(;idx<_5cc;++idx){
_obj=this._pageN[this._currentPage][idx];
if(_obj&&_obj._objectType!="SmartWindow"&&_obj.canFocus()){
_res=_obj.applyEntry();
if(typeof _res=="undefined"||_res===true){
return true;
}
}
}
if(this.getToolbar&&this.getToolbar()){
return this.getToolbar().applyEntry();
}
return false;
}
};
Projapi.Base.iPJSmartContainer.prototype.destroyObject=function(){
try{
this.publish(Projapi.Links.Container.DestroyObject);
}
catch(e){
console.error(e);
}
if(this._domNode&&this._domNode.domNode.parentNode){
this._domNode.domNode.parentNode.removeChild(this._domNode.domNode);
}
Projapi.Base.iPJSmartContainer.superclass.destroyObject.call(this);
};
Projapi.Base.iPJSmartContainer.prototype._handleKeyEvents=function(_5cd){
if(_5cd.keyCode==Event.KEY_RETURN){
if(!this.confirmOk()||this._objectType=="SmartWindow"){
Event.stop(_5cd);
}
}else{
if(_5cd.keyCode==Event.KEY_ESC){
if(!this.confirmCancel()||this._objectType=="SmartWindow"){
Event.stop(_5cd);
}
}
}
};
Projapi.Base.iPJSmartContainer.prototype.confirmExit=function(_5ce,_5cf){
var idx1=0,_5d1=this._pageN.length,idx2=0,_5d3,_5d4;
if(typeof _5cf!="undefined"){
if(_5cf>-1&&_5cf<_5d1){
idx1=_5cf,_5d1=_5cf+1;
}else{
throw new Error("Invalid page number passed to iSmartContainer.confirmExit: %o",_5cf);
}
}
_5ce=false;
for(;idx1<_5d1;++idx1){
_5d3=this._pageN[idx1].length;
for(idx2=0;idx2<_5d3&&!_5ce;idx2++){
_5d4=this._pageN[idx1][idx2].confirmExit(_5ce);
if(typeof _5d4!="undefined"){
_5ce=_5ce||_5d4;
}
}
}
return _5ce;
};
Projapi.Base.iPJSmartContainer.prototype.confirmCancel=function(){
var idx1=0,_5d6=this._pageN.length,idx2=0,_5d8;
var _5d9=true;
for(;idx1<_5d6;++idx1){
_5d8=this._pageN[idx1].length;
for(idx2=0;idx2<_5d8&&_5d9;idx2++){
_5d9=(_5d9&&(this._pageN[idx1][idx2].confirmCancel()===true));
if(!_5d9){
return false;
}
}
}
return _5d9;
};
Projapi.Base.iPJSmartContainer.prototype.confirmOk=function(){
var idx1=0,_5db=this._pageN.length,idx2=0,_5dd;
var _5de=true;
if(this._currentPage>0){
_5dd=this._pageN[this._currentPage].length;
for(idx2=0;idx2<_5dd&&_5de;idx2++){
try{
_5de=_5de&&((this._pageN[this._currentPage][idx2].confirmOk&&this._pageN[this._currentPage][idx2].confirmOk()===true));
if(!_5de){
return false;
}
}
catch(e){
console.error(e);
}
}
}
for(;idx1<_5db;idx1++){
if(idx1==this._currentPage&&idx1!=0){
continue;
}
_5dd=this._pageN[idx1].length;
for(idx2=0;idx2<_5dd&&_5de;idx2++){
try{
_5de=_5de&&((this._pageN[idx1][idx2].confirmOk&&this._pageN[idx1][idx2].confirmOk()===true));
if(!_5de){
return false;
}
}
catch(e){
console.error(e);
}
}
}
return _5de;
};
Projapi.Base.iPJSmartContainer.prototype.exitObject=function(){
this.publish(Projapi.Links.Container.ExitObject);
};
Projapi.Base.iPJSmartContainer.prototype.setContentDOMNode=function(_5df){
if(typeof _5df=="string"){
_5df=Projapi.UI.Element.get(_5df);
}
this._contentDOMNode=_5df;
};
Projapi.Base.iPJSmartContainer.prototype.getContentDOMNode=function(){
return this._contentDOMNode;
};
Projapi.Base.iPJSmartContainer.prototype.getObjectsByType=function(_5e0){
var res=[],idx,len,_5e4;
for(idx=0,len=this._containerTarget.length;idx<len;idx++){
_5e4=this._containerTarget[idx];
if(_5e4._objectType==_5e0){
res.push(_5e4);
}
if(_5e4._objectType=="SmartContainer"){
res=res.concat(_5e4.getObjectsByType(_5e0));
}
}
return res;
};
Projapi.Base.iPJSmartContainer.prototype.setLayoutManager=function(_5e5,_5e6){
if(!_5e6){
_5e6=0;
}
this._layoutManagers[_5e6]=_5e5;
this._layed[_5e6]=false;
};
Projapi.Base.iPJSmartContainer.prototype.getLayoutManager=function(_5e7){
if(!_5e7){
_5e7=0;
}
return this._layoutManagers[_5e7];
};
Projapi.Base.iPJSmartContainer.resizes=0;
Projapi.Base.iPJSmartContainer.prototype.resize=function(){
if(!this._objectCreated){
return;
}
Projapi.Base.iPJSmartContainer.resizes++;
console.group("( %o ) resizing %o",Projapi.Base.iPJSmartContainer.resizes,this._objectName);
var i,node=this._domNode.domNode,x=node.offsetWidth,y=node.offsetHeight,_5ec=this.getContentDOMNode,cx,cy;
if(_5ec&&(_5ec=this.getContentDOMNode())!=this._domNode){
cx=_5ec.domNode.offsetWidth;
cy=_5ec.domNode.offsetHeight;
}else{
cx=-1;
cy=-1;
}
if(this._resizeInfo&&this._resizeInfo.lastWidth==x&&this._resizeInfo.lastHeight==y&&this._resizeInfo.lastContentWidth==cx&&this._resizeInfo.lastContentHeight==cy){
console.groupEnd();
return;
}
if(this._layoutManagers[this._currentPage]&&this._layoutManagers[this._currentPage].layout){
this._layoutManagers[this._currentPage].layout();
this._layed[this._currentPage]=true;
}
this._resizeInfo={lastWidth:x,lastHeight:y,lastContentWidth:cx,lastContentHeight:cy};
if(this._pageN[this._currentPage]){
for(i=0;i<this._pageN[this._currentPage].length;i++){
if(this._pageN[this._currentPage][i].resize&&this._pageN[this._currentPage][i]._objectType!="SmartWindow"){
this._pageN[this._currentPage][i].resize();
}
}
}
console.groupEnd();
};
if(typeof Projapi=="undefined"){
var Projapi={};
}
if(typeof Projapi.Widgets=="undefined"){
Projapi.Widgets={};
}
Projapi.Widgets.PJSmartContainer=function(_5ef,_5f0){
Projapi.Widgets.PJSmartContainer.superclass.constructor.call(this,_5ef,_5f0);
this._borders=[];
this._borderType=Projapi.UI.Border.NONE;
};
Projapi.extend(Projapi.Widgets.PJSmartContainer,Projapi.Base.iPJSmartContainer);
Projapi.Widgets.PJSmartContainer.prototype._isUIBuilt=function(){
return Projapi.Widgets.PJSmartContainer.superclass._isUIBuilt.call(this)&&(this._properties.noBorder||this._borders.length==3);
};
Projapi.Widgets.PJSmartContainer.prototype.createObjects=function(){
Projapi.Widgets.PJSmartContainer.superclass.createObjects.call(this);
};
Projapi.Widgets.PJSmartContainer.prototype._buildUI=function(){
var _5f1,_5f2,idx=0,_5f4=this._pageN.length,tmp;
if(!this._domNode){
this.setDOMNode(Projapi.UI.Element.fromString(["<div class=\"",this._DOMClassPrefix,"\" id=\"",this._objectName,"\" style=\"",(this._properties.hideOnInit||this._properties.hide)?"display:none":"","\"></div>"].join("")));
if(this._containerSource){
this._containerSource.getLayoutManager(this._objectPage).add(this);
}
}else{
this._domNode.domNode.style.display="none";
}
_5f1=this._domNode.domNode;
if(!this.getContentDOMNode()){
if(!this._properties.noBorder){
this._borders[0]=Projapi.UI.Element.fromString("<div class=\""+this._DOMClassPrefix+"B1\"><div class=\""+this._DOMClassPrefix+"B2\"><div class=\""+this._DOMClassPrefix+"B3\"></div></div></div>");
this._domNode.domNode.appendChild(this._borders[0].domNode);
this._borders[1]=new Projapi.UI.Element(this._borders[0].domNode.firstChild);
this._borders[2]=new Projapi.UI.Element(this._borders[1].domNode.firstChild);
}
if(this._properties.singlePage){
_5f1=this._domNode;
}else{
_5f1=document.createElement("DIV");
_5f1.id="pjContent"+this._objectName;
_5f1.className=this._DOMClassPrefix+"Content";
if(!this._properties.noBorder){
this._borders[2].domNode.appendChild(_5f1);
}else{
this._domNode.domNode.appendChild(_5f1);
}
}
this.setContentDOMNode(Projapi.UI.Element.get(_5f1));
}
if(this._objectType!="SmartWindow"){
this._domNode.domNode.style.minWidth=this.getProperty("minWidth",51)+"px";
}
Event.observe(this._domNode.domNode,"keydown",this._handleKeyEvents.bindAsEventListener(this));
for(idx;idx<_5f4;++idx){
if(!this._UIScanForPage(idx)){
this._UIBuildPage(idx);
}
}
};
Projapi.Widgets.PJSmartContainer.prototype._processVisualObjectProperties=function(){
Projapi.Widgets.PJSmartContainer.superclass._processVisualObjectProperties.call(this);
if(this._properties.border){
if(this._properties.border==Projapi.UI.Border.SOLID){
this.setBorder(Projapi.UI.Border.SOLID,this._properties.borderColor||Projapi.Theme.BorderColor,this._properties.borderWidth||1);
}else{
this.setBorder(this._properties.border||Projapi.UI.Border.NONE);
}
}
this.setBackgroundColor(this._properties.backgroundColor||Projapi.Theme.PanelBackground);
};
Projapi.Widgets.PJSmartContainer.prototype.setBorder=function(_5f6,_5f7,_5f8){
if(this._borders.length==0){
return;
}
if(this._properties["class"]&&Projapi.Theme.NoBorderForClass&&Projapi.Theme.NoBorderForClass.indexOf(this._properties["class"])!=-1){
return;
}
if(typeof _5f7=="string"&&_5f7.indexOf("Projapi")!=-1){
_5f7=eval(_5f7);
}
Projapi.UI.Border.DrawBorder(this._borders,_5f6,_5f7,_5f8);
this._borderType=_5f6;
};
Projapi.Widgets.PJSmartContainer.prototype.getBorderType=function(){
return this._borderType;
};
Projapi.Widgets.PJSmartContainer.prototype.setBackgroundColor=function(_5f9){
if(this._properties["class"]&&Projapi.Theme.NoBackgroundForClass&&Projapi.Theme.NoBackgroundForClass.indexOf(this._properties["class"])!=-1){
return;
}
if(typeof _5f9=="string"&&_5f9.indexOf("Projapi")!=-1){
_5f9=eval(_5f9);
}
this._properties.backgroundColor=_5f9;
var t;
if(t=this.getContentDOMNode()){
t.domNode.style.background=_5f9;
}
};
Projapi.Widgets.PJSmartContainer.prototype.getBackgroundColor=function(){
return this._properties.backgroundColor||Projapi.Theme.PanelBackground;
};
Projapi.Widgets.PJSmartFolder=function(_5fb,_5fc){
Projapi.Widgets.PJSmartFolder.superclass.constructor.call(this,_5fb,_5fc);
this._tabPane=null;
this._DOMClassPrefix="pjSmartFolder";
};
Projapi.extend(Projapi.Widgets.PJSmartFolder,Projapi.Base.iPJSmartContainer);
Projapi.Widgets.PJSmartFolder.prototype._buildUI=function(){
var _5fd,_5fe,idx=0,_600=this._pageN.length;
var _601;
if(this.getDOMNode()){
if(!((_5fd=this.getDOMNode()) instanceof Projapi.UI.Element)){
this.setDOMNode(_5fd=Projapi.UI.Element.get(_5fd));
}
if(this.getContainerSource()){
this.getContainerSource().getLayoutManager(this.getObjectPage()).add(this);
}
}else{
_5fd=document.createElement("DIV");
_5fd.className=this._DOMClassPrefix;
_5fd.id=this.getObjectName();
_5fd.tabIndex=-1;
this.setDOMNode(_5fd=Projapi.UI.Element.get(_5fd));
if(this.getContainerSource()){
this.getContainerSource().getLayoutManager(this.getObjectPage()).add(this);
}
}
if($("pjContent_"+this.getObjectName())){
this.setContentDOMNode(Projapi.UI.Element.get("pjContent_"+this.getObjectName()));
}
this.getDOMNode().domNode.style.minWidth=this.getProperty("minWidth",51)+"px";
Event.observe(this.getDOMNode().domNode,"keydown",this._handleKeyEvents.bindAsEventListener(this));
for(idx;idx<_600;++idx){
if(!this._UIScanForPage(idx)){
this._UIBuildPage(idx);
}
}
if(!this._isUIBuilt){
throw new Error("Container "+this.getObjectName()+" unable to create DOM reprezentation");
}
};
Projapi.Widgets.PJSmartFolder.prototype.createObjects=function(){
this._domNode=Projapi.UI.Element.fromString("<div class=\""+this._DOMClassPrefix+"\" id=\""+this._objectName+"\" tabindex=\"-1\"><div class=\"tab-pane "+this._DOMClassPrefix+"Content\" tabindex=\"-1\" id=\"pjContent_"+this._objectName+"\"></div></div>");
this.setContentDOMNode(new Projapi.UI.Element(this._domNode.domNode.firstChild));
this._tabPane=new WebFXTabPane(this.getContentDOMNode().domNode,this);
Projapi.Widgets.PJSmartFolder.superclass.createObjects.call(this);
this._applyCloseableTabs();
};
Projapi.Widgets.PJSmartFolder.prototype._UIBuildPage=function(_602){
this._pageNode[_602]=Projapi.UI.Element.fromString("<div class=\"pjPage tab-page\" style=\"display: none\"><div class=\"pjPageInner\"></div><span class=\"tab\">"+(this._titles[_602]||"")+"</span></div>");
this._contentDOMNode.domNode.appendChild(this._pageNode[_602].domNode);
this._tabPane.addTabPage(this._pageNode[_602].domNode,_602);
Projapi.Hotkeys.registerContext(this._pageNode[_602].domNode);
};
Projapi.Widgets.PJSmartFolder.prototype.getFolderPage=function(){
return this._currentPage;
};
Projapi.Widgets.PJSmartFolder.prototype.getHContainer=function(){
return this.getContentDOMNode();
};
Projapi.Widgets.PJSmartFolder.prototype.enableObject=function(){
Projapi.Widgets.PJSmartFolder.superclass.enableObject.call(this);
this.publish(Projapi.Links.Container.EnableObject);
this._tabPane._enabled=true;
};
Projapi.Widgets.PJSmartFolder.prototype.disableObject=function(){
Projapi.Widgets.PJSmartFolder.superclass.disableObject.call(this);
this.publish(Projapi.Links.Container.DisableObject);
this._tabPane._enabled=false;
};
Projapi.Widgets.PJSmartFolder.prototype.hideObject=function(){
Projapi.Widgets.PJSmartFolder.superclass.hideObject.call(this);
if(this._tabPane.popup){
this._tabPane.popup.hideObject();
}
};
Projapi.Widgets.PJSmartFolder.prototype.addPage=function(_603,_604,_605){
if(this._objectInitialized&&this._pageN.length==0){
this._domNode.domNode.style.visibility="";
}
Projapi.Widgets.PJSmartFolder.superclass.addPage.call(this,_603,_604,_605);
};
Projapi.Widgets.PJSmartFolder.prototype.selectPage=function(_606){
var _607=this._currentPage==-1,wnd;
Projapi.Widgets.PJSmartFolder.superclass.selectPage.call(this,_606);
if(_607&&(wnd=$P(this._windowName))&&wnd._objectInitialized&&!wnd._objectHidden&&!this._objectHidden&&this._objectInitialized){
wnd.scheduleResize();
}
if((_606<0)||(_606>this._pageN.length-1)||(isNaN(_606))){
return;
}
if(!this._objectEnabled){
return;
}
if(!this._objectHidden&&!this._layed[_606]){
this._layoutManagers[_606].layout();
}
this._tabPane._setSelectedIndex(_606);
};
Projapi.Widgets.PJSmartFolder.prototype.deletePage=function(_609){
var _idx=_609+1,_60b=this._tabPane.pages.length;
if(typeof _609=="number"&&_609>=0&&_609<_60b){
if(!Projapi.Widgets.PJSmartFolder.superclass.deletePage.call(this,_609)){
return false;
}
if(this._tabPane.selectedIndex>=_609){
--this._currentPage;
}
this._tabPane.deletePage(_609);
}
if(this._objectInitialized&&this._pageN.length==0){
this._domNode.domNode.style.visibility="hidden";
}
return true;
};
Projapi.Widgets.PJSmartFolder.prototype.setCloseableTabs=function(_60c){
if(this._properties.closeableTabs==_60c){
return;
}
this._properties.closeableTabs=_60c;
this._applyCloseableTabs();
};
Projapi.Widgets.PJSmartFolder.prototype._applyCloseableTabs=function(){
var node,_60e;
if((node=this.getDOMNode())&&node.domNode.firstChild&&(_60e=node.domNode.firstChild.firstChild)&&(_60e=_60e.nextSibling)){
if(this.getProperty("closeableTabs")){
if(!_60e.className.match(/\bcloseableTabs\b/)){
_60e.className+=" closeableTabs";
}else{
if(_60e.className.match(/\bcloseableTabs\b/)){
_60e.className=_60e.className.replace(" closeableTabs","");
}
}
}
}
};
if(typeof Projapi=="undefined"){
Projapi={};
}
if(!Projapi.Widgets){
Projapi.Widgets={};
}
Projapi.Widgets.PJSplitter=function(_60f,_610){
Projapi.Widgets.PJSplitter.superclass.constructor.call(this,_60f,_610);
this._objectType="Splitter";
this._classPrefix="pjSplitter";
if(!this._properties){
this._properties={};
}
this._properties=Object.extend({canHide:[true,true],containers:[null,null],direction:"h",mainContainerIdx:0,maxSize:[null,null],minSize:[null,null],resizable:true,size:[null,null],width:null,height:null,titles:[null,null],_selfStruct:{containers:{type:"iPJSmartContainer[]"},height:{type:"size"},width:{type:"size"}}},this._properties);
var name,m;
if(typeof this._properties.titles=="string"){
this._properties.titles=this._properties.titles.split(",");
for(var i=0;i<this._properties.titles.length;i++){
if(this._properties.titles[i]=="null"){
this._properties.titles[i]=null;
}
}
}
this._checkSize("size");
this._checkSize("maxSize");
this._checkSize("minSize");
this._layoutNodes=[];
this._contentNodes=[];
this._resizeNodes=[];
this._showBars=[];
this.ContainerTargetEvents=Projapi.Links.Container.TargetEvents;
this.ContainerSourceEvents=Projapi.Links.Container.SourceEvents;
this._resize={h:{name:"Width",sname:"width",a:"Left",b:"Right",ptr:"pointerX",idx:0,cursor:"e-resize"},v:{name:"Height",sname:"height",a:"Top",b:"Bottom",ptr:"pointerY",idx:1,cursor:"s-resize"},resizing:false,expectingClick:false,nodeIdx:null,backupSize:null,startPos:null,startSize:null};
this._resize.h.other=this._resize.v;
this._resize.v.other=this._resize.h;
this._onBeginResizeCol=this._beginResize.bind(this);
this._onUpdateResizeCol=this._updateResize.bind(this);
this._onEndResizeCol=this._endResize.bind(this);
this._onCancelResizeCol=this._cancelResize.bind(this);
this._onClick=this._eventClick.bind(this);
this._onShowBarClick=this._showBarClick.bind(this);
this._onShowButtonClick=this._showButtonClick.bind(this);
this._onHideButtonClick=this._hideButtonClick.bind(this);
this._processObjectProperties();
this._canFocus=false;
for(name in this._properties){
if(m=name.match(/^container(\d+)$/)){
while(this._properties.containers.length<parseInt(m[1])){
this._properties.containers.push(null);
}
this._properties.containers[parseInt(m[1])]=this._properties[name];
delete this._properties[name];
}
}
this._lastTheme=null;
};
Projapi.extend(Projapi.Widgets.PJSplitter,Projapi.Base.iPJVisualObject);
Projapi.Widgets.PJSplitter.prototype._sizes={dividerWidth:5,showBarWidth:20,showBarDeltaHeight:4,lastTheme:null};
Projapi.Widgets.PJSplitter.prototype.createObjects=function(){
Projapi.Widgets.PJSplitter.superclass.createObjects.call(this);
if(!this._sizes.lastTheme){
this._makeSizes();
}
this._buildUI();
this._objectCreated=true;
this._processVisualObjectProperties();
var i;
for(i=0;i<this._properties.containers.length;i++){
if(this._properties.containers[i]&&typeof this._properties.containers[i]=="object"){
this._properties.containers[i]._windowName=this._windowName;
this._properties.containers[i]._propagateWindowName();
this._properties.containers[i].createObjects();
}
}
};
Projapi.Widgets.PJSplitter.prototype.initializeObject=function(){
Projapi.Widgets.PJSplitter.superclass.initializeObject.call(this);
this._initHandlers();
this._objectInitialized=true;
var i;
for(i=0;i<this._properties.containers.length;i++){
if(this._properties.containers[i]&&typeof this._properties.containers[i]=="object"){
this._properties.containers[i].initializeObject();
}
}
if(!this.getProperty("hideOnInit",false,true)){
this.viewObject();
}
};
Projapi.Widgets.PJSplitter.prototype._makeSizes=function(){
this._sizes.lastTheme=Projapi.Theme;
var node=document.body.appendChild(document.createElement("div"));
node.innerHTML="<table class=\"pjSplitter\" cellspacing=\"0\" style=\"width: auto\"><tbody><tr><td>"+"<div class=\"resizer\" style=\"height: 20px\"></div>"+"<div class=\"pageSplit\" style=\"height: 20px, width: 20px\"><div class=\"pageHead vertical\"></div></div>"+"<div class=\"showBar\" style=\"height: 20px\"><div class=\"right pjToolButton\">&#187;</div></div>"+"</td><td><div>&nbsp;</div></td></tr></tbody></table>";
var divs=node.getElementsByTagName("div");
this._sizes.dividerWidth=divs[0].offsetWidth;
var stl=divs[0].currentStyle||document.defaultView.getComputedStyle(divs[0],null);
this._sizes.dividerWidth+=parseInt(stl.marginLeft)+parseInt(stl.marginRight);
this._sizes.pageDeltaHeight=divs[1].offsetHeight-20;
this._sizes.pageDeltaWidth=divs[1].offsetWidth-20;
this._sizes.showBarWidth=divs[3].offsetWidth;
this._sizes.showBarDeltaHeight=divs[3].offsetHeight-20;
node.parentNode.removeChild(node);
};
Projapi.Widgets.PJSplitter.prototype._buildUI=function(){
var i;
var node=this.getDOMNode();
if(node){
if(node.domNode){
node=node.domNode;
}
}else{
if(!(node=$(this._objectName))){
node=document.createElement("table");
node.cellSpacing="0";
node.id=this._objectName;
this.setDOMNode(Projapi.UI.Element.get(node));
}
}
if(!node.className.match(/\bpjSplitter\b/)){
if(node.className){
node.className+=" pjSplitter";
}else{
node.className="pjSplitter";
}
}
if(this._properties.height){
node.style.height=this._properties.height;
}
if(this._properties.width){
node.style.width=this._properties.width;
}
node=node.appendChild(document.createElement("tbody"));
var _61b,resN,_61d;
if(this._properties.direction=="h"){
node.appendChild(document.createElement("tr"));
for(i=0;i<this._properties.containers.length;i++){
this._layoutNodes.push(node.rows[0].appendChild(document.createElement("td")));
this._contentNodes.push(_61b=node.rows[0].lastChild.appendChild(document.createElement("div")));
_61b.className="pageSplit";
this._showBars.push(_61d=_61b.parentNode.appendChild(document.createElement("div")));
_61d.innerHTML="<div class=\"right pjToolButton\">&#187;</div>";
_61d.className="showBar";
_61d.style.display="none";
_61d.containerIndex=i;
Event.observe(_61d,"click",this._onShowBarClick,false,this);
Event.observe(_61d.firstChild,"click",this._onShowButtonClick,false,this);
if(i>0){
this._resizeNodes.push(resN=_61b.parentNode.insertBefore(document.createElement("div"),_61b));
resN.className="resizer";
Event.observe(resN,"mousedown",this._onBeginResizeCol,false,this);
}
}
}else{
for(i=0;i<this._properties.containers.length;i++){
this._layoutNodes.push(node.appendChild(document.createElement("tr")));
node.rows[i].appendChild(document.createElement("td"));
this._contentNodes.push(_61b=node.rows[i].cells[0].appendChild(document.createElement("div")));
_61b.className="pageSplit";
if(i>0){
this._resizeNodes.push(resN=_61b.parentNode.insertBefore(document.createElement("div"),_61b));
resN.className="resizer";
Event.observe(resN,"mousedown",this._onBeginResizeCol,false,this);
}
}
}
for(i=0;i<this._contentNodes.length;i++){
if(typeof this._properties.titles[i]=="string"){
if(i!=this._properties.mainContainerIdx){
this._contentNodes[i].innerHTML="<div class=\"pageHead vertical\"><div class=\"hideBtn left pjToolButton\">&#171;</div>"+this._properties.titles[i]+"</div>";
this._contentNodes[i].firstChild.firstChild.containerIndex=i;
Event.observe(this._contentNodes[i].firstChild.firstChild,"click",this._onHideButtonClick,false,this);
}else{
this._contentNodes[i].innerHTML="<div class=\"pageHead vertical\">"+this._properties.titles[i]+"</div>";
}
}
}
Event.observe(this.getDOMNode().domNode,"contextmenu",this._onCancelResizeCol,false,this);
Event.observe(this.getDOMNode().domNode,"click",this._onClick,false,this);
this._updateSizes();
if(this.getContainerSource()){
var _61e=this.getContainerSource().getLayoutManager(this.getObjectPage());
_61e.add(this);
if(this._properties.direction=="v"){
this._domNode.domNode.parentNode.className+=" verticalSplitterHolder";
}
}
};
Projapi.Widgets.PJSplitter.prototype._initHandlers=function(){
};
Projapi.Widgets.PJSplitter.prototype._getContentNodes=function(){
return this._contentNodes;
};
Projapi.Widgets.PJSplitter.prototype.getLayoutManager=function(){
var obj={add:(function(_620){
var idx=this._properties.containers.indexOf(_620);
if(idx==-1){
idx=this._properties.containers.indexOf(_620.getObjectName());
if(idx==-1){
idx=this._properties.containers.indexOf(null);
}
if(idx==-1){
this.addLink(Projapi.Links.Container.CreateObjects,_620);
return;
}
this._properties.containers[idx]=_620;
}
this._getContentNodes()[idx].appendChild(_620.getDOMNode().domNode);
}).bind(this),layout:function(){
}};
return obj;
};
Projapi.Widgets.PJSplitter.prototype._checkSize=function(_622){
var i;
if(typeof this._properties[_622]=="string"){
this._properties[_622]=this._properties[_622].replace(/\s+/,"").split(",");
}
for(i=0;i<this._properties[_622].length;i++){
if(this._properties[_622][i]!=null&&!this._properties[_622][i].match(/^[0-9.]+(\%|px)$/)){
this._properties[_622][i]=null;
}
}
while(this._properties[_622].length<this._properties.containers.length){
this._properties[_622].push(null);
}
};
Projapi.Widgets.PJSplitter.prototype._updateSizes=function(){
var i,rs=this._resize[this._properties.direction];
var prop=rs.name,_627=rs.sname;
var _628=this._sizes["divider"+prop];
var _629=this._resize.fullSize||this._domNode.domNode["offset"+prop];
if(_629<1){
return;
}
var _62a=function(_62b){
if(!_62b){
return null;
}
var m;
if(m=_62b.match(/^([0-9.]+)\%$/)){
return Math.floor(_629*parseFloat(m[1])/100);
}
if(m=_62b.match(/^([0-9.]+)px$/)){
return parseInt(m[1]);
}
console.warn("[PJSplitter._updateSize] Unrecognized size: %o",_62b);
return null;
};
var sz,tmp,_62f=0;
for(i=0;i<this._properties.minSize.length;i++){
if(this._contentNodes[i].style.display=="none"){
_62f--;
}else{
tmp=_62a(this._properties.minSize[i]);
if(tmp){
_62f+=tmp;
}
}
}
_62f+=1+(_628+1)*(this._properties.size.length-1);
var used=0;
var _631=0;
var _632=0;
var _633=[];
var _634=[];
for(i=0;i<this._contentNodes.length;i++){
if(this._contentNodes[i].style.display!="none"){
sz=null;
if(this._properties.size[i]==null){
_631++;
continue;
}else{
_632++;
}
sz=_62a(this._properties.size[i]);
if(this._properties.maxSize[i]!=null){
tmp=_62a(this._properties.maxSize[i]);
if(sz>tmp){
sz=tmp;
}
}
if(sz+_62f>_629){
sz=_629-_62f;
}
if(this._properties.minSize[i]!=null){
tmp=_62a(this._properties.minSize[i]);
if(tmp>sz){
sz=tmp;
}
}
used+=sz;
if(i>0){
sz-=_628;
}
_633[i]=sz;
}else{
if(this._showBars[i].style.display!="none"){
sz=this._sizes["showBar"+rs.name];
used+=sz;
}else{
used+=_628+1;
}
}
}
sz=_629-used;
if(_631){
for(i=0;i<this._contentNodes.length&&_631;i++){
if(this._properties.size[i]==null&&this._contentNodes[i].style.display!="none"){
var tmp=Math.floor(sz/_631);
sz-=sz/_631;
if(i>0){
tmp-=_628;
}
_633[i]=tmp;
_631--;
}
}
}else{
if(_632){
for(i=0;i<_633.length&&_632;i++){
if(_633[i]){
var tmp=Math.floor(sz/_632);
sz-=tmp;
_633[i]+=tmp;
_632--;
}
}
}
}
var _635=-1;
if(BrowserDetect.browser=="Explorer"&&BrowserDetect.version<7){
_635--;
}
for(i=0;i<_633.length;i++){
if(_633[i]){
this._contentNodes[i].style[_627]=_633[i]+_635+"px";
}
}
this._remakeDividerSizes();
};
Projapi.Widgets.PJSplitter.prototype._remakeDividerSizes=function(){
if(this._properties.direction=="h"){
var _636=this._sizes["showBarDelta"+this._resize[this._properties.direction].other.name];
this._domNode.domNode.backupClass=this._domNode.domNode.className;
this._domNode.domNode.className+=" resizing";
var _637=this._domNode.domNode.offsetHeight;
for(var i=0;i<this._resizeNodes.length;i++){
this._resizeNodes[i].style.height=_637+"px";
}
_637-=_636;
for(var i=0;i<this._showBars.length;i++){
this._showBars[i].style.height=_637+"px";
}
this._domNode.domNode.className=this._domNode.domNode.backupClass;
}
};
Projapi.Widgets.PJSplitter.prototype.resize=function(){
if(this._sizes.lastTheme!=Projapi.Theme){
this._makeSizes();
}
var prop=this._resize[this._properties.direction].name;
var tmp,chop=0;
if((tmp=this._containerSource.getLayoutManager(this._objectPage))&&(tmp=tmp.containerLayout)&&tmp instanceof Projapi.Layout.TableLayout&&(tmp=tmp._tableNode)){
chop+=2*tmp.domNode.offsetLeft;
if(tmp.domNode.tBodies[0]){
chop+=2*tmp.domNode.tBodies[0].offsetLeft;
}
}
var _63c=this._containerSource.getContentDOMNode?this._containerSource.getContentDOMNode():this._containerSource.getDOMNode();
if(_63c.domNode){
_63c=_63c.domNode;
}
var _63d=_63c["client"+prop]||_63c["offset"+prop];
this._domNode.domNode.style.display="none";
var _63e=_63c["client"+prop]||_63c["offset"+prop];
this._domNode.domNode.style.display="";
if(_63d==0||_63e<_63d){
_63d=_63e;
}
_63d-=chop;
if(_63d>0&&_63d!=this._resize.fullSize||this._lastTheme!=this._sizes.lastTheme){
this._lastTheme=this._sizes.lastTheme;
this._resize.fullSize=_63d;
this.actualResize();
}else{
this._remakeDividerSizes();
}
};
Projapi.Widgets.PJSplitter.prototype.actualResize=function(){
var prop=this._resize[this._properties.direction].name;
var _640=prop.toLowerCase();
this._domNode.domNode.style[_640]=this._resize.fullSize+"px";
this._updateSizes();
this.publishResize();
};
Projapi.Widgets.PJSplitter.prototype.viewObject=function(){
Projapi.Widgets.PJSplitter.superclass.viewObject.call(this);
if(!this._objectHidden){
this._updateSizes();
var i;
for(i=0;i<this._properties.containers.length;i++){
if(this._properties.containers[i]&&(typeof this._properties.containers[i]=="object")&&this._properties.containers[i].viewObject){
this._properties.containers[i].viewObject();
}
}
}
};
Projapi.Widgets.PJSplitter.prototype.hideObject=function(){
if(this._objectHidden){
return;
}
Projapi.Widgets.PJSplitter.superclass.hideObject.call(this);
this._updateSizes();
var i;
for(i=0;i<this._properties.containers.length;i++){
if(this._properties.containers[i]&&(typeof this._properties.containers[i]=="object")&&this._properties.containers[i].hideObject){
this._properties.containers[i].hideObject();
}
}
};
Projapi.Widgets.PJSplitter.prototype.setContainerSource=function(_643){
Projapi.Widgets.PJSplitter.superclass.setContainerSource.call(this,_643);
if(this.getDOMNode()){
if(this._containerSource!=null){
this._containerSource.getLayoutManager(this.getObjectPage()).add(this);
}else{
if(this.getDOMNode().domNode.parentNode){
this.getDOMNode().domNode.parentNode.removeChild(this.getDOMNode().domNode);
}
}
}
};
Projapi.Widgets.PJSplitter.prototype.addContainerTarget=function(_644){
var idx;
idx=this._properties.containers.indexOf(_644);
if(idx==-1){
idx=this._properties.containers.indexOf(_644.getObjectName());
if(idx==-1){
idx=this._properties.containers.indexOf(null);
}
if(idx!=-1){
this._properties.containers[idx]=_644;
}else{
idx=this._properties.containers.length;
this._properties.containers.push(_644);
this._properties.size.push(null);
this._properties.minSize.push(null);
this._properties.maxSize.push(null);
if(this._objectCreated){
var node;
if(this._properties.direction=="h"){
node=this.getDOMNode().domNode.tBodies[0].rows[0].appendChild(document.createElement("td"));
this._layoutNodes.push(node);
}else{
node=this.getDOMNode().domNode.tBodies[0].appendChild(document.createElement("tr"));
this._layoutNodes.push(node);
node=node.appendChild(document.createEledment("td"));
}
node.appendChild(document.createElement("div"));
var resN;
this._contentNodes.push(node=node.firstChild);
node.className="pageSplit";
if(idx>0){
this._resizeNodes.push(resN=node.parentNode.insertBefore(document.createElement("div"),node));
resN.className="resizer";
Event.observe(resN,"mousedown",this._onBeginResizeCol,false,this);
}
}
}
}
if(this._objectCreated){
if(!_644._objectCreated){
_644.createObjects();
}
this._contentNodes[idx].appendChild(_644.getDOMNode().domNode);
this._updateSizes();
}
if(this._objectInitialized){
_644.initializeObject();
}
};
Projapi.Widgets.PJSplitter.prototype.getContainerTarget=function(){
var v=this._properties.containers.concat([]);
for(var i=v.length-1;i>=0;i--){
if(!v[i]||typeof v[i]=="string"){
v.splice(i,1);
}
}
return v;
};
Projapi.Widgets.PJSplitter.prototype.removeContainerTarget=function(_64a){
var idx=this._properties.containers.indexOf(_64a);
if(idx==-1){
console.warn("ContainerTarget not found: %o",_64a);
return;
}
this._properties.containers.splice(idx,1);
this._properties.size.splice(idx,1);
this._properties.minSize.splice(idx,1);
this._properties.maxSize.splice(idx,1);
if(this._contentNodes[idx]){
var node=this._contentNodes[idx].parentNode;
if(this._properties.direction=="h"){
node.parentNode.removeChild(node);
}else{
node.parentNode.parentNode.removeChild(node.parentNode);
}
this._contentNodes.splice(idx,1);
}
};
Projapi.Widgets.PJSplitter.prototype._showBarClick=function(_64d){
var idx=Event.element(_64d).containerIndex;
if(typeof idx!="number"){
return;
}
this._contentNodes[idx].className+=" peek";
this._showBars[idx].style.visibility="hidden";
this._contentNodes[idx].timeout=setTimeout((function(){
this._contentNodes[idx].className="pageSplit";
this._contentNodes[idx].timeout=null;
this._showBars[idx].style.visibility="";
}).bind(this),5*1000);
};
Projapi.Widgets.PJSplitter.prototype._showButtonClick=function(_64f){
var idx=Event.element(_64f).parentNode.containerIndex;
this._contentNodes[idx].style.display="";
this._showBars[idx].style.display="none";
this._updateSizes();
this.publishResize();
};
Projapi.Widgets.PJSplitter.prototype._hideButtonClick=function(_651){
var idx=Event.element(_651).containerIndex;
if(this._contentNodes[idx].className.match(/\bpeek\b/)){
this._contentNodes[idx].className="pageSplit";
clearTimeout(this._contentNodes[idx].timeout);
this._contentNodes[idx].timeout=null;
this._showBars[idx].style.visibility="";
}else{
this._contentNodes[idx].style.display="none";
this._showBars[idx].style.display="";
this._updateSizes();
}
this.publishResize();
};
Projapi.Widgets.PJSplitter.prototype._eventClick=function(_653){
if(this._resize.expectingClick){
this._resize.expectingClick=false;
return;
}
var _654=this._resize[this._properties.direction];
var pos=Event[_654.ptr](_653);
var i,bgn;
var ofs=[];
for(i=0;i<this._layoutNodes.length;i++){
if(i>0&&this._contentNodes[i].style.display=="none"){
bgn=Position.page(this._contentNodes[i].previousSibling)[_654.idx]+this._contentNodes[i].previousSibling["offset"+_654.name]+1;
}else{
bgn=Position.page(this._contentNodes[i])[_654.idx];
}
ofs.push([bgn+(parseInt(this._contentNodes[i].style["margin"+_654.a])||0),this._layoutNodes[i]["offset"+_654.name]-(parseInt(this._contentNodes[i].style["margin"+_654.a])||0)-(parseInt(this._contentNodes[i].style["margin"+_654.b])||0)]);
}
for(i=0;i<this._contentNodes.length-1;i++){
if((ofs[i][0]+ofs[i][1]<pos)&&(ofs[i+1][0]>pos)){
if(i>=this._properties.mainContainerIdx){
if(i==this._properties.containers.length-1){
return;
}else{
i++;
}
}
if(i>this._properties.containers.length-1){
i=this._properties.containers.length-1;
}
if(this._contentNodes[i].style.display=="none"){
this._contentNodes[i].style.display="";
}else{
this._contentNodes[i].style.display="none";
}
this._showBars[i].style.display="none";
this._updateSizes();
this.publishResize();
break;
}
}
};
Projapi.Widgets.PJSplitter.prototype._beginResize=function(_659){
if(this._resize.resizing){
this._onEndResizeCol(_659);
return;
}
if(!this._properties.resizable){
return;
}
var cnt=0;
for(var i=0;i<this._contentNodes.length;i++){
if(this._contentNodes[i].style.display!="none"){
cnt++;
}
}
if(cnt<2){
return;
}
var _65c=this._resize[this._properties.direction];
this._resize.startPos=Event[_65c.ptr](_659);
this._resize.nodeIdx=this._resizeNodes.indexOf(Event.element(_659));
Event.observe(this._domNode.domNode,"mousemove",this._onUpdateResizeCol,false,this);
Event.observe(this._domNode.domNode,"mouseup",this._onEndResizeCol,false,this);
this._resize.resizing=true;
this._resize.backupSize=this._properties.size.clone();
this._resize.multiply=1;
if(!this._properties.size[this._resize.nodeIdx]){
if(this._properties.size[this._resize.nodeIdx+1]){
this._resize.nodeIdx++;
this._resize.multiply=-1;
}else{
this._properties.size[this._resize.nodeIdx]=this._layoutNodes[this._resize.nodeIdx]["offset"+_65c.name]+"px";
}
}
this._resize.startSize=this._layoutNodes[this._resize.nodeIdx]["offset"+_65c.name];
};
Projapi.Widgets.PJSplitter.prototype._updateResize=function(_65d){
var _65e=this._resize[this._properties.direction];
var pos=Event[_65e.ptr](_65d);
var _660=pos-this._resize.startPos;
if(this._properties.size[this._resize.nodeIdx].match(/^[0-9.]+px$/)){
this._properties.size[this._resize.nodeIdx]=this._resize.startSize+(_660*this._resize.multiply)+"px";
}else{
if(this._properties.size[this._resize.nodeIdx].match(/^[0-9.]+%$/)){
this._properties.size[this._resize.nodeIdx]=((this._resize.startSize+_660*this._resize.multiply)*100/this._domNode.domNode["offset"+_65e.name])+"%";
}
}
this._updateSizes();
this._domNode.domNode.parentNode.title=String(this._properties.size).replace(/^,/g,"*,").replace(/,$/,",*").replace(/,,/g,",*,").replace(/(\.\d)\d+/g,"$1").replace(/,/g,", ");
};
Projapi.Widgets.PJSplitter.prototype._endResize=function(_661){
if(!this._resize.resizing){
return;
}
this._resize.resizing=false;
var _662=this._resize[this._properties.direction];
var pos=Event[_662.ptr](_661);
var _664=pos-this._resize.startPos;
if(_664!=0){
this._resize.expectingClick=true;
}
this._domNode.domNode.parentNode.title="";
Event.stopObserving(this.getDOMNode().domNode,"mousemove",this._onUpdateResizeCol,false);
Event.stopObserving(this.getDOMNode().domNode,"mouseup",this._onEndResizeCol,false);
this.publishResize();
};
Projapi.Widgets.PJSplitter.prototype._cancelResize=function(_665){
if(!this._resize.resizing){
return;
}
this._properties.size=this._resize.backupSize.without();
this._resize.expectingClick=true;
this._domNode.domNode.parentNode.title="";
Event.stopObserving(this.getDOMNode().domNode,"mousemove",this._onUpdateResizeCol,false);
Event.stopObserving(this.getDOMNode().domNode,"mouseup",this._onEndResizeCol,false);
};
Projapi.Widgets.PJSplitter.prototype.publishResize=function(){
for(var i=0;i<this._properties.containers.length;i++){
if(this._properties.containers[i]&&this._properties.containers[i] instanceof Projapi.Base.iPJSmartObject&&!this._properties.containers[i]._objectHidden){
this._properties.containers[i].resize();
}
}
};
Projapi.Widgets.PJSplitter.prototype.disableObject=function(){
Projapi.Widgets.PJSplitter.superclass.disableObject.call(this);
var i;
for(i=0;i<this._properties.containers.length;i++){
if(this._properties.containers[i]&&(typeof this._properties.containers[i]=="object")&&this._properties.containers[i].disableObject){
this._properties.containers[i].disableObject();
}
}
};
Projapi.Widgets.PJSplitter.prototype.enableObject=function(){
Projapi.Widgets.PJSplitter.superclass.disableObject.call(this);
var i;
for(i=0;i<this._properties.containers.length;i++){
if(this._properties.containers[i]&&(typeof this._properties.containers[i]=="object")&&this._properties.containers[i].enableObject){
this._properties.containers[i].enableObject();
}
}
};
Projapi.Widgets.PJSplitter.prototype.destroyObject=function(){
if(this._resize.resizing){
this._onEndResizeCol({});
}
for(var i=this._properties.containers.length-1;i>=0;i--){
if(this._properties.containers[i]&&(typeof this._properties.containers[i]=="object")&&this._properties.containers[i].destroyObject){
this._properties.containers[i].destroyObject();
}
}
if(this._objectCreated){
Event.stopObserving(this.getDOMNode().domNode,"contextmenu",this._onCancelResizeCol,false);
Event.stopObserving(this.getDOMNode().domNode,"click",this._onClick,false);
}
Projapi.Widgets.PJSplitter.superclass.destroyObject.call(this);
};
Projapi.Widgets.PJSplitter.prototype.confirmExit=function(){
Projapi.Widgets.PJSplitter.superclass.confirmExit.call(this);
var i;
for(i=0;i<this._properties.containers.length;i++){
if(this._properties.containers[i]&&(typeof this._properties.containers[i]=="object")&&this._properties.containers[i].confirmExit){
if(this._properties.containers[i].confirmExit()!=true){
return false;
}
}
}
return true;
};
Projapi.Widgets.PJSplitter.prototype.confirmCancel=function(){
Projapi.Widgets.PJSplitter.superclass.confirmCancel.call(this);
var i;
for(i=0;i<this._properties.containers.length;i++){
if(this._properties.containers[i]&&(typeof this._properties.containers[i]=="object")&&this._properties.containers[i].confirmCancel){
if(this._properties.containers[i].confirmCancel()!==true){
return false;
}
}
}
return true;
};
Projapi.Widgets.PJSplitter.prototype.confirmOk=function(){
Projapi.Widgets.PJSplitter.superclass.confirmOk.call(this);
var i;
for(i=0;i<this._properties.containers.length;i++){
if(this._properties.containers[i]&&(typeof this._properties.containers[i]=="object")&&this._properties.containers[i].confirmOk){
if(this._properties.containers[i].confirmOk()!==true){
return false;
}
}
}
return true;
};
if(typeof Projapi=="undefined"){
Projapi={};
}
if(!Projapi.Widgets){
Projapi.Widgets={};
}
Projapi.Widgets.PJAccordion=function(_66d,_66e){
Projapi.Widgets.PJAccordion.superclass.constructor.call(this,_66d,_66e);
if(!this._properties.direction||["h","v"].indexOf(this._properties.direction)==-1){
this._properties.direction="v";
}
this._properties._direction={v:"vertical",h:"horizontal"}[this._properties.direction];
this._properties.placeHeaderAfter=!!this._properties.placeHeaderAfter;
this._properties.showAll=!!this._properties.showAll;
this._properties.toggleMode=this._properties.toggleMode||this._properties.showAll||false;
this._objectType="Accordion";
this._DOMClassPrefix="pjAccordion pjSmartContainer";
this._headerNodes=[];
};
Projapi.extend(Projapi.Widgets.PJAccordion,Projapi.Widgets.PJSmartContainer);
Projapi.Widgets.PJAccordion.prototype._buildUI=function(){
var node,_670;
if(node=this._domNode){
node.domNode.style.minWidth=this.getProperty("minWidth",51)+"px";
}else{
if(node=$(this._objectName)){
node.style.minWidth=this.getProperty("minWidth",51)+"px";
this.setDOMNode(node=Projapi.UI.Element.get(node));
}else{
this.setDOMNode(node=Projapi.UI.Element.fromString("<div id=\""+this._objectName+"\" class=\""+this._DOMClassPrefix+"\" style=\"min-width: "+this.getProperty("minWidth",51)+"px\"></div>"));
if(_670=this.getContainerSource()){
_670.getLayoutManager(this.getObjectPage()).add(this);
}
}
}
this.setContentDOMNode(node);
Event.observe(node.domNode,"keydown",this._handleKeyEvents.bindAsEventListener(this));
for(var idx=0;idx<this._pageN.length;idx++){
if(!this._UIScanForPage(idx)){
this._UIBuildPage(idx);
}
}
};
Projapi.Widgets.PJAccordion.prototype.initializeObject=function(){
Projapi.Widgets.PJAccordion.superclass.initializeObject.call(this);
this._objectInitialized=true;
if(this._properties.showAll){
for(var i=0;i<this._pageNode.length;i++){
this._pageNode[i].domNode.style.display="";
this._headerNodes[i].className=this._headerNodes[i].className+" selected";
}
this.publish(Projapi.Links.Container.ViewObject);
}
};
Projapi.Widgets.PJAccordion.prototype._UIBuildPage=function(_673){
var _674=document.createElement("span");
_674.className="pageHead "+this._properties._direction;
_674.innerHTML=this._titles[_673]||("Page "+(_673-0+1));
if(this._properties.direction=="h"){
_674.innerHTML=_674.innerHTML.split("").join("<br />");
}
Event.observe(_674,"click",(function(evt){
this.selectPage(_673);
}).bind(this),false);
if(!this._properties.placeHeaderAfter){
this.getContentDOMNode().domNode.appendChild(_674);
}
Projapi.Widgets.PJAccordion.superclass._UIBuildPage.call(this,_673);
this._pageNode[_673].initialDisplay="";
if(this._properties.placeHeaderAfter){
this.getContentDOMNode().domNode.appendChild(_674);
_674.previousSibling.className+=" "+this._properties._direction;
}else{
_674.nextSibling.className+=" "+this._properties._direction;
}
this._headerNodes.push(_674);
};
Projapi.Widgets.PJAccordion.prototype.selectPage=function(_676){
var _677=this._headerNodes[_676]&&this._headerNodes[_676].className.match(/\bselected\b/);
if(this._properties.toggleMode&&_677){
this._headerNodes[_676].className=this._headerNodes[_676].className.replace(/ selected\b/,"");
var idx,_679=this._pageN[_676].length;
for(idx=0;idx<_679;idx++){
this._pageN[_676][idx].hideObject();
}
this._pageNode[_676].setDisplayed(false);
}else{
if(!_677){
var _67a=this._currentPage;
if(this._properties.toggleMode){
_67a=this._currentPage=-1;
}
Projapi.Widgets.PJAccordion.superclass.selectPage.call(this,_676);
var _67b=this._currentPage;
if(_67a!=_67b){
if(this._headerNodes[_67a]){
this._headerNodes[_67a].className=this._headerNodes[_67a].className.replace(/ selected\b/,"");
}
if(this._headerNodes[_67b]){
this._headerNodes[_67b].className=this._headerNodes[_67b].className+" selected";
}
}
}
}
};
Projapi.Widgets.PJAccordion.prototype.hidePage=function(_67c){
if(!(_67c>-1)){
_67c=this._currentPage;
}
if(!this._headerNodes[_67c]){
return;
}
};
Projapi.Widgets.PJAccordion.prototype.setPlaceHeaderAfter=function(_67d){
if(!!_67d==this._properties.placeHeaderAfter){
return;
}
this._properties.placeHeaderAfter=!!_67d;
var i;
var _67f=this.getContentDOMNode().domNode;
if(this._properties.placeHeaderAfter){
for(i=0;i<this._headerNodes.length-1;i++){
_67f.insertBefore(this._headerNodes[i],this._headerNodes[i+1]);
}
i=this._headerNodes.length-1;
if(i>=0){
_67f.appendChild(this._headerNodes[i]);
}
}else{
for(i=0;i<this._headerNodes.length-1;i++){
_67f.insertBefore(this._headerNodes[i],this._headerNodes[i].previousSibling);
}
}
};
Projapi.Widgets.PJAccordion.prototype.setDirection=function(_680){
if(_680==this._properties.direction||["h","v"].indexOf(_680)==-1){
return;
}
this._properties.direction=_680;
var _681={h:"vertical",v:"horizontal"}[_680];
var _682={h:"horizontal",v:"vertical"}[_680];
this._properties._direction=_682;
var _683=new RegExp("\\b"+_681+"\\b");
var item=this.getContentDOMNode().domNode.firstChild;
while(item){
if(item.className){
item.className=item.className.replace(_683,_682);
}
item=item.nextSibling;
}
if(this._properties.direction=="h"){
for(item=0;item<this._headerNodes.legth;item++){
this._headerNodes[i].innerHTML=this._headerNodes[i].innerHTML.innerHTML.split("").join("<br />");
}
}else{
for(item=0;item<this._headerNodes.legth;item++){
this._headerNodes[i].innerHTML=this._headerNodes[i].innerHTML.innerHTML.replace(/<\\?br>/g,"");
}
}
};

if(typeof Projapi=="undefined"){
var Projapi={};
}
if(typeof Projapi.Widgets=="undefined"){
Projapi.Widgets={};
}
Projapi.Widgets.iPJOverlay=function(_1,_2){
_1=_1||Projapi.UI.GenerateId();
Projapi.Widgets.iPJOverlay.superclass.constructor.call(this,_1,_2);
this._contentDOMNode=null;
this._title="";
this._zIndex=0;
this._nodes={};
this.ClassPrefix="pjOverlay";
};
Projapi.extend(Projapi.Widgets.iPJOverlay,Projapi.Base.iPJVisualObject);
Projapi.Widgets.iPJOverlay.prototype._processObjectProperties=function(){
Projapi.Widgets.iPJOverlay.superclass._processObjectProperties.call(this);
if(this.getProperty("doColumnName",null,true)){
this.setDOColumnName(this.getProperty("doColumnName",null,true));
}
};
Projapi.Widgets.iPJOverlay.prototype._processVisualObjectProperties=function(){
Projapi.Widgets.iPJOverlay.superclass._processVisualObjectProperties.call(this);
if(this.getProperty("title",false,true)){
this.setTitle(this.getProperty("title","",true));
}
if(this.getProperty("width",false,true)){
this.setSize(this.getProperty("width",0,true),null);
}
if(this.getProperty("height",false,true)){
this.setSize(null,this.getProperty("height",0,true));
}
if(this.getProperty("x",false,true)){
this.setLocation(this.getProperty("x",0,true),null);
}
if(this.getProperty("y",false,true)){
this.setLocation(null,this.getProperty("y",0,true));
}
if(!this.getProperty("hiden",false,true)&&!this.getProperty("hideOnInit",false,true)){
this.viewObject();
}
};
Projapi.Widgets.iPJOverlay.prototype.createObjects=function(){
this._processObjectProperties();
this._buildUI();
this._objectCreated=true;
return this;
};
Projapi.Widgets.iPJOverlay.prototype._buildUI=function(){
var _3;
if(!this._domNode){
this._domNode=Projapi.UI.CreateNodeElement({tag:"DIV",id:this.getObjectName(),className:this.ClassPrefix});
if(this._zIndex>0){
this._domNode.setStyle("zIndex",this._zIndex);
}
this._domNode.setStyle("position","absolute");
this._domNode.setDisplayed(false);
this._nodes.header=Projapi.UI.CreateNodeElement({tag:"DIV",className:this.ClassPrefix+"_Header"});
this._domNode.domNode.appendChild(this._nodes.header.domNode);
this._nodes.title=Projapi.UI.CreateNodeElement({tag:"DIV",className:this.ClassPrefix+"_Title"});
this._nodes.header.domNode.appendChild(this._nodes.title.domNode);
this._nodes.body=Projapi.UI.CreateNodeElement({tag:"DIV",className:this.ClassPrefix+"_Body"});
this._domNode.domNode.appendChild(this._nodes.body.domNode);
this._nodes.footer=Projapi.UI.CreateNodeElement({tag:"DIV",className:this.ClassPrefix+"_Footer"});
this._domNode.domNode.appendChild(this._nodes.footer.domNode);
if(this.getProperty("showShadow",true,true)){
this._nodes.shadow=Projapi.UI.CreateNodeElement({tag:"DIV",className:this.ClassPrefix+"_Shadow"});
if(this._zIndex>0){
this._nodes.shadow.setStyle("zIndex",this._zIndex);
}
this._nodes.shadow.setStyle("position","absolute");
this._nodes.shadow.setDisplayed(false);
document.body.appendChild(this._nodes.shadow.domNode);
}
document.body.appendChild(this._domNode.domNode);
}
};
Projapi.Widgets.iPJOverlay.prototype.initializeObject=function(){
Projapi.Widgets.iPJOverlay.superclass.initializeObject.call(this);
this._objectInitialized=true;
this._processVisualObjectProperties();
return this;
};
Projapi.Widgets.iPJOverlay.prototype.getContentDOMNode=function(){
return this._nodes.body;
};
Projapi.Widgets.iPJOverlay.prototype.setTitle=function(_4){
if(!this.isObjectCreated()){
this.createObjects();
}
if(!this.isObjectInitialized()){
this.initializeObject();
}
this._title=_4;
if(this._nodes.title){
this._nodes.title.domNode.innerHTML=this._title;
}
};
Projapi.Widgets.iPJOverlay.prototype.getTitle=function(){
return _title;
};
Projapi.Widgets.iPJOverlay.prototype.setSize=function(_5,_6){
if(!this.isObjectCreated()){
this.createObjects();
}
if(!this.isObjectInitialized()){
this.initializeObject();
}
if(typeof _5!="undefined"&&_5!==null){
this._properties.width=_5;
if(this._domNode){
this._domNode.setWidth(_5);
}
if(this._nodes.shadow){
this._nodes.shadow.setWidth(_5);
}
}
if(typeof _6!="undefined"&&_6!==null){
this._properties.height=_6;
if(this._domNode){
this._domNode.setHeight(_6);
}
if(this._nodes.shadow){
this._nodes.shadow.setHeight(_6);
}
}
};
Projapi.Widgets.iPJOverlay.prototype.setLocation=function(x,y){
if(!this.isObjectCreated()){
this.createObjects();
}
if(!this.isObjectInitialized()){
this.initializeObject();
}
if(typeof x!="undefined"&&x!==null){
this._properties.x=x;
if(this._domNode){
this._domNode.setX(x);
}
if(this._nodes.shadow){
this._nodes.shadow.setX(x+2);
}
}
if(typeof y!="undefined"&&y!==null){
this._properties.y=y;
if(this._domNode){
this._domNode.setY(y);
}
if(this._nodes.shadow){
this._nodes.shadow.setY(y+2);
}
}
};
Projapi.Widgets.iPJOverlay.positions=[["TOP","BOTTOM","LEFT","RIGHT","INSIDE"],["pjOverlayDownArrow","pjOverlayUpArrow","pjOverlayRightArrow","pjOverlayLeftArrow",""],["after","before","after","before","before"],];
Projapi.Widgets.iPJOverlay.prototype.attachTo=function(_9,_a){
if(!this.isObjectCreated()){
this.createObjects();
}
if(!this.isObjectInitialized()){
this.initializeObject();
}
var _b=_a.toUpperCase(),_c;
if(typeof _b=="undefined"||!_b){
throw new Error("Unknown position: "+_a);
}
_c=Projapi.Widgets.iPJOverlay.positions[0].indexOf(_b);
if(_c==-1){
_c=["UP","DOWN"].indexOf(_b);
}
if(_c==-1){
_c=["ABOVE","BELOW"].indexOf(_b);
}
if(_b==-1){
throw new Error("Unknown position: "+_a);
}
this._attached={elem:_9.domNode||_9,pos:_c};
this._nodes.arrow=Projapi.UI.CreateNodeElement({tag:"DIV",className:Projapi.Widgets.iPJOverlay.positions[1][_c]});
if(Projapi.Widgets.iPJOverlay.positions[2][_c]=="after"){
this._domNode.domNode.appendChild(this._nodes.arrow.domNode);
}else{
this._domNode.domNode.insertBefore(this._nodes.arrow.domNode,this._domNode.domNode.firstChild);
}
this.reposition();
};
Projapi.Widgets.iPJOverlay.prototype.reposition=function(){
if(!this._attached||this._objectHidden){
return;
}
var _d=this.getDOMNode(),_e=this._attached.elem,x,y,_11=0,_12=0;
if(_d.domNode){
_d=_d.domNode;
}
var _13=Position.page(_e);
_13.push(_e.offsetWidth);
_13.push(_e.offsetHeight);
switch(this._attached.pos){
case 0:
x=_13[0];
y=_13[1]-_d.offsetHeight-12;
break;
case 1:
x=_13[0];
y=_13[1]+_13[3]+12;
break;
case 2:
x=_13[0]-_d.offsetWidth-12;
y=_13[1];
if(_d.offsetHeight>_13[3]){
y-=Math.floor((_d.offsetHeight-_13[3])/2);
}
_11=_d.offsetHeight+"px";
_12=(_d.offsetWidth-2)+"px";
break;
case 3:
x=_13[0]+_13[2]+12;
y=_13[1];
if(_d.offsetHeight>_13[3]){
y-=Math.floor((_d.offsetHeight-_13[3])/2);
}
_11=_d.offsetHeight+"px";
break;
case 4:
x=_13[0]+5;
y=_13[1]+5;
break;
default:
throw new Error("Unknown position: "+this._attached.pos);
}
if(x+_d.offsetWidth>document.body.offsetWidth){
x=x+x+_d.offsetWidth-document.body.offsetWidth;
}
x=Math.max(x,0);
if(y+_d.offsetHeight>document.body.offsetHeight){
y=y+y+_d.offsetHeight-document.body.offsetHeight;
}
y=Math.max(y,0);
if(_12){
this._nodes.arrow.domNode.style.left=_12;
}
if(_11){
this._nodes.arrow.domNode.style.height=_11;
}
_d.style.left=x+"px";
_d.style.top=y+"px";
if(this._nodes.shadow){
this._nodes.shadow.setX(x+2);
this._nodes.shadow.setY(y+2);
}
var _14=0;
while(_e!=document&&((_e&&_e.style.zIndex)||_14<1)){
_14=_e.style.zIndex;
_e=_e.parentNode;
}
if(_14>0&&this._zIndex<_14){
this._zIndex=parseInt(_14)+1;
this._domNode.setStyle("zIndex",this._zIndex);
if(this._nodes.shadow){
this._nodes.shadow.setStyle("zIndex",this._zIndex);
}
}
};
Projapi.Widgets.iPJOverlay.prototype.hideObject=function(){
if(!this.getDOMNode()){
return;
}
if(this.getDOMNode() instanceof Projapi.UI.Element){
this.getDOMNode().setDisplayed(false);
if(this._nodes.shadow){
this._nodes.shadow.setDisplayed(false);
}
}else{
this._displayMode=this.getDOMNode().style.display==""?"inline":this.getDOMNode().style.display;
this.getDOMNode().style.display="none";
}
this._objectHidden=true;
};
Projapi.Widgets.iPJOverlay.prototype.viewObject=function(){
if(this.getProperty("hide",false,true)||!this.getDOMNode()){
return;
}
if(this.getDOMNode() instanceof Projapi.UI.Element){
this.getDOMNode().setDisplayed(true);
if(this._nodes.shadow){
this._nodes.shadow.setWidth(this._domNode.getWidth());
this._nodes.shadow.setHeight(this._domNode.getHeight());
this._nodes.shadow.setDisplayed(true);
}
}else{
this.getDOMNode().style.display=this._displayMode;
}
this._objectHidden=false;
this.reposition();
};
Projapi.Widgets.iPJOverlay.prototype.resize=function(){
Projapi.Widgets.iPJOverlay.superclass.resize.call(this);
this.reposition();
};
if(typeof Projapi=="undefined"){
var Projapi={};
}
if(typeof Projapi.Widgets=="undefined"){
Projapi.Widgets={};
}
Projapi.Widgets.PJSmartWindow=function(_15,_16){
Projapi.Widgets.PJSmartWindow.superclass.constructor.call(this,_15,_16);
this._DOMClassPrefix="pjWindow";
this._objectType="SmartWindow";
this._menubar=null;
this._toolbar=null;
this._statusBar=null;
this._nodes=[];
this._UIBuilt=false;
this._windowType="inline";
this._iternalWindow=null;
this._windowName=_15;
this._lastFocusedObject=null;
this._processObjectProperties();
this._popup=null;
this.ContainerSourceEvents=[Projapi.Links.Container.InitializeObject,Projapi.Links.Container.HideObject,Projapi.Links.Container.DestroyObject,Projapi.Links.Container.DisableObject,Projapi.Links.Container.ConfirmExit,Projapi.Links.Container.ConfirmCancel,Projapi.Links.Container.ConfirmOk,Projapi.Links.Container.Resize];
this._actionTargets=[];
this.ActionSourceEvents=[Projapi.Links.Action.ValueChanged];
this.FireValueChangedOnExit=null;
this._staticMessageBundle={context_info_show_info:"Show Info"};
this._autoCenter=this.__autoCenter.bind(this);
if(this._properties.windowType=="overlay"){
this._properties.noBorder=true;
}
};
Projapi.extend(Projapi.Widgets.PJSmartWindow,Projapi.Widgets.PJSmartContainer);
Projapi.Widgets.PJSmartWindow.prototype.createObjects=function(){
if(this._objectCreated){
return;
}
var _17=this;
if(this._properties.windowType=="internal"&&this.getProperty("noBorder",null,true)===null){
this.setProperty("noBorder",true);
}
this._buildWindowUI();
Projapi.Widgets.PJSmartWindow.superclass.createObjects.call(this);
var i=0;
if(this._toolbar){
while((this._pageN[0][i]!=null)&&(this._pageN[0][i]!=this._toolbar)){
++i;
}
this._pageN[0].splice(i,1);
}
if(this._menubar){
while((this._pageN[0][i]!=null)&&(this._pageN[0][i]!=this._menubar)){
++i;
}
this._pageN[0].splice(i,1);
}
if(this._statusBar){
while((this._pageN[0][i]!=null)&&(this._pageN[0][i]!=this._statusBar)){
++i;
}
this._pageN[0].splice(i,1);
}
if(this._menubar){
this.setMenubar(this._menubar);
}
if(this._windowType!="inline"){
Projapi.Hotkeys.addAccessKey(this._domNode.domNode,"ALT+i",Projapi.WarningManager.toogleTooltip.bind(Projapi.WarningManager),this.getMessage("context_info_show_info"),"Alt+i");
}
if(this._popup&&!this._popup._objectCreated){
this._popup.createObjects();
}
Event.observe(this._contentDOMNode.domNode,"contextmenu",function(ev){
var ev=ev||event;
if(_17._popup){
_17._popup.pop(ev);
}
},false);
};
Projapi.Widgets.PJSmartWindow.prototype._processObjectProperties=function(){
Projapi.Widgets.PJSmartWindow.superclass._processObjectProperties.call(this);
if(this._properties.windowType){
this._windowType=this._properties.windowType;
}
};
Projapi.Widgets.PJSmartWindow.prototype._buildWindowUI=function(){
var _1a,_1b;
if(!this._domNode){
if(this._windowType=="inline"){
if(_1a=$(this._objectName)){
this.setDOMNode(Projapi.UI.Element.get(_1a));
if(!this._domNode.hasClassName(this._DOMClassPrefix)){
this._domNode.addClassName(this._DOMClassPrefix);
}
}else{
_1a=Projapi.UI.Element.fromString("<div id=\""+this._objectName+"\" class=\""+this._DOMClassPrefix+"\"></div>");
if(this._containerSource&&this._containerSource.domNode){
this._containerSource.domNode.appendChild(_1a.domNode);
}else{
document.body.appendChild(_1a.domNode);
if(this._properties.title){
document.title=this._properties.title;
}
}
this.setDOMNode(_1a);
}
}else{
if(this._windowType=="internal"){
this._properties.resizable=true;
Projapi.Profiler.Start("newPrototypeWindow");
this._internalWindow=new Window(this._objectName,Object.extend({className:Projapi.Theme.WindowClassName?Projapi.Theme.WindowClassName:"alphacube",wiredDrag:false,recenterAuto:true,closeCallback:this.canClose.bind(this)},this._properties));
Projapi.Profiler.Stop("newPrototypeWindow",this._objectName);
Windows.addObserver({onEndResize:function(_1c,win){
if(win==this._internalWindow){
try{
this.resize();
}
catch(e){
console.error("Error on window resize: %o",e);
}
}
}.bind(this)});
if(!this.getProperty("hideOnClose",false)){
this._internalWindow.setDestroyOnClose();
}
_1a=Projapi.UI.Element.fromString("<div id=\""+this._objectName+"_pjWindow_outer\" class=\""+this._DOMClassPrefix+"\" style=\"display: none\"></div>");
document.body.appendChild(_1a.domNode);
this._nodes.contentRoot=_1a;
this.setDOMNode(_1a);
}else{
if(this._windowType=="overlay"){
if(_1a=$(this._objectName)){
this.setDOMNode(_1a=Projapi.UI.Element.get(_1a));
}else{
var str,i,_20=["minWidth","width","maxWidth","minHeight","height","maxHeight","top","left","right","bottom"],_21=["min-width","width","max-width","min-height","height","max-height","top","left","right","bottom"];
str=["<div id=\"",this._objectName,"\" class=\"pjOverlay\" style=\"display: none; "];
for(i=0;i<_20.length;i++){
if(this._properties[_20[i]]){
str.push(_21[i]);
str.push(": ");
str.push(this._properties[_20[i]]);
str.push("px; ");
}
}
str.push("\"></div>");
this.setDOMNode(_1a=Projapi.UI.Element.fromString(str.join("")));
}
this._nodes.rootNode=_1a=this._domNode.domNode;
document.body.appendChild(this._domNode.domNode);
Event.observe(window,"resize",this._autoCenter,false,this);
if(this._properties.showShadow!=false){
this._domNode.domNode.innerHTML+="<div class=\"shadow right\">&nbsp;</div><div class=\"shadow bottom\">&nbsp;</div>";
}
if(this._properties.title||(this._properties.closable!=false)){
this._domNode.domNode.innerHTML+="<div class=\""+(Projapi.Theme.WindowClassName||"alphacube")+"_title title_window\">"+(this._properties.title||"")+(this._properties.closable!=false?"<div class=\"closeBtn\" onclick=\"$P('"+this._objectName+"').exitObject();\">&nbsp;</div>":"")+"</div>";
}
}else{
throw new Error("Unknown window type: "+this._windowType);
}
}
}
}
if(!this._nodes.contentRoot){
this._nodes.contentRoot=this._domNode;
}
var txt=["<table class=\"{class}\" cellspacing=\"0\" cellpadding=\"0\"><tbody><tr class=\"{class}\" style=\"",this._menubar?"height: 1px":"display: none","\"><td class=\"{class}\" valign=\"top\"><div class=\"{class}_menubar\"></div></td></tr><tr class=\"{class}\" style=\"",this._toolbar?"height: 1px":"display: none","\"><td class=\"{class}\" valign=\"top\"><div class=\"{class}_toolbar\"></div></td></tr>","<tr class=\"{class}\"><td class=\"{class}\" valign=\"top\"><div class=\"{class}_container\"></div></td></tr><tr class=\"{class}\" style=\"",this._statusBar?"height: 1px":"display: none","\"><td class=\"{class}\"><div class=\"{class}_statusbar\"></div></td></tr></tbody></table>"];
this._nodes.windowTable=Projapi.UI.Element.fromString(txt.join("").replace(/{class}/g,this._DOMClassPrefix));
this._nodes.contentRoot.domNode.appendChild(this._nodes.windowTable.domNode);
this._nodes.menuCell=new Projapi.UI.Element(this._nodes.windowTable.domNode.rows[0].cells[0]);
this._nodes.menubarHolder=new Projapi.UI.Element(this._nodes.menuCell.domNode.firstChild);
this._nodes.toolbarCell=new Projapi.UI.Element(this._nodes.windowTable.domNode.rows[1].cells[0]);
this._nodes.toolbarHolder=new Projapi.UI.Element(this._nodes.toolbarCell.domNode.firstChild);
this._nodes.containerCell=new Projapi.UI.Element(this._nodes.windowTable.domNode.rows[2].cells[0]);
this._nodes.containerHolder=new Projapi.UI.Element(this._nodes.containerCell.domNode.firstChild);
this._nodes.statusbarCell=new Projapi.UI.Element(this._nodes.windowTable.domNode.rows[3].cells[0]);
this._nodes.statusbarHolder=new Projapi.UI.Element(this._nodes.statusbarCell.domNode.firstChild);
this._UIBuilt=true;
var _23=this._domNode;
this._domNode=this._nodes.containerHolder;
this._buildUI();
this._domNode=_23;
if(this._windowType=="internal"){
this._internalWindow.setContent(this._nodes.contentRoot.domNode.id);
this._domNode=Projapi.UI.Element.get(this._objectName);
}else{
if(this._windowType=="overlay"){
if(this._nodes.rootNode!=this._domNode.domNode){
this._nodes.rootNode.appendChild(this._domNode.domNode);
}
}else{
Projapi.Globals.ROOT_WINDOW=this;
}
}
$(this._objectName).tabIndex=-1;
if(this._windowType!="inline"){
Projapi.Hotkeys.registerContext(this._domNode.domNode);
}else{
if(this._properties.height=="auto"){
if(document.body.style.overflowY){
document.body.style.overflowY="auto";
}else{
document.body.style.overflow="auto";
}
}
}
};
Projapi.Widgets.PJSmartWindow.prototype.initializeObject=function(){
if(this._objectInitialized){
return;
}
Projapi.Widgets.PJSmartWindow.superclass.initializeObject.call(this);
if(this._toolbar){
if(!this._toolbar.isObjectInitialized()){
this._toolbar.initializeObject();
}
if(!this._popup&&this.getProperty("generatePopup",true,true)){
this._generatePopupFromToolbar(this._toolbar);
}
}
if(this._popup&&!this._popup._objectInitialized){
this._popup.initializeObject();
}
};
Projapi.Widgets.PJSmartWindow.prototype.getMenubar=function(){
return this._menubar;
};
Projapi.Widgets.PJSmartWindow.prototype.setMenubar=function(_24){
var _25=this._nodes["menubarHolder"];
this._menubar=_24;
if(!this.isObjectCreated()){
return;
}
if(this._menubar&&this._menubar._containerSource!=this){
if(this._menubar._containerSource){
this._menubar._containerSource.removeLink(Projapi.Links.Container,this._menubar);
}
this.addLink(Projapi.Links.Container,this._menubar);
}
if(!this._menubar.isObjectCreated()){
this._menubar._windowName=this._windowName;
this._menubar._propagateWindowName();
this._menubar.createObjects();
}
if(_25){
_25.removeChildrens();
if(this._menubar&&_24._domNode){
if(_24._domNode.domNode.parentNode){
_24._domNode.domNode.parentNode.removeChild(_24._domNode.domNode);
}
_25.domNode.appendChild(_24._domNode.domNode);
_25.domNode.parentNode.parentNode.style.height="1px";
_25.domNode.parentNode.parentNode.style.display="";
}else{
_25.domNode.parentNode.parentNode.style.height="";
_25.domNode.parentNode.parentNode.style.display="none";
}
}
};
Projapi.Widgets.PJSmartWindow.prototype.getToolbar=function(){
return this._toolbar;
};
Projapi.Widgets.PJSmartWindow.prototype.setToolbar=function(_26){
var _27=this._nodes["toolbarHolder"];
this._toolbar=_26;
if(_26&&this._toolbar._containerSource!=this){
if(this._toolbar._containerSource){
this._toolbar._containerSource.removeLink(Projapi.Links.Container,this._toolbar);
}
this.addLink(Projapi.Links.Container,this._toolbar);
}
if(_27){
_27.removeChildrens();
if(_26&&_26._domNode){
if(_26._domNode.domNode.parentNode){
_26.domNode.parentNode.removeChild(_26.domNode);
}
_27.domNode.appendChild(_26._domNode.domNode);
_27.domNode.parentNode.parentNode.style.height="1px";
_27.domNode.parentNode.parentNode.style.display="";
}else{
_27.domNode.parentNode.parentNode.style.height="";
_27.domNode.parentNode.parentNode.style.display="none";
}
}
};
Projapi.Widgets.PJSmartWindow.prototype.getStatusBar=function(){
return this._statusBar;
};
Projapi.Widgets.PJSmartWindow.prototype.setStatusBar=function(_28){
var _29=this._nodes["statusbarHolder"];
this._statusBar=_28;
if(this._statusBar&&this._statusBar._containerSource!=this){
if(this._statusBar._containerSource){
this._statusBar._containerSource.removeLink(Projapi.Links.Container,this._statusBar);
}
this.addLink(Projapi.Links.Container,this._statusBar);
}
if(_29){
_29.removeChildrens();
if(this._menubar&&_28._domNode){
if(_28._domNode.domNode.parentNode){
_28.domNode.parentNode.removeChild(_28.domNode);
}
_29.domNode.appendChild(_28._domNode.domNode);
_29.domNode.parentNode.parentNode.style.height="1px";
_29.domNode.parentNode.parentNode.style.display="";
}else{
_29.domNode.parentNode.parentNode.style.height="";
_29.domNode.parentNode.parentNode.style.display="none";
}
}
};
Projapi.Widgets.PJSmartWindow.prototype.addContainerTarget=function(_2a){
if(this._containerTarget.indexOf(_2a)!=-1){
return;
}
if(_2a._objectType){
switch(_2a._objectType){
case "SmartToolbar":
this.setToolbar(_2a);
break;
case "MenuBar":
this.setMenubar(_2a);
break;
case "SmartStatusbar":
this.setStatusBar(_2a);
break;
}
}
Projapi.Widgets.PJSmartWindow.superclass.addContainerTarget.call(this,_2a);
};
Projapi.Widgets.PJSmartWindow.prototype.removeContainerTarget=function(_2b){
if(_2b._objectType){
switch(_2b._objectType){
case "SmartToolbar":
this.setToolbar(null);
break;
case "SmartMenu":
this.setMenubar(null);
break;
case "SmartStatusbar":
this.setStatusBar(null);
break;
}
}
Projapi.Widgets.PJSmartWindow.superclass.removeContainerTarget.call(this,_2b);
};
Projapi.Widgets.PJSmartWindow.prototype.setLayoutManager=function(_2c,_2d){
if(_2c instanceof Projapi.Layout.WindowLayout){
alert("E window layout ");
}
Projapi.Widgets.PJSmartWindow.superclass.setLayoutManager.call(this,new Projapi.Layout.WindowLayout(this,_2c),_2d);
};
Projapi.Widgets.PJSmartWindow.prototype.getWindowType=function(){
return this._windowType;
};
Projapi.Widgets.PJSmartWindow.prototype.setBackgroundColor=function(_2e){
if(typeof _2e=="string"&&_2e.indexOf("Projapi")!=-1){
_2e=eval(_2e);
}
this._properties.backgroundColor=_2e;
var _2f;
switch(this._windowType){
case "inline":
if(_2f=this._domNode){
if(_2f.domNode){
_2f=_2f.domNode;
}
_2f.style.background=_2e;
}
break;
case "overlay":
if((_2f=this._domNode.domNode)&&(_2f=_2f.lastChild)){
_2f.style.background=_2e;
}
break;
case "internal":
if(_2f=this._nodes.contentRoot){
if(_2f.domNode){
_2f=_2f.domNode;
}
_2f.style.backgroundImage="none";
_2f.style.background=_2e;
}
if(_2f=$(this._objectName+"_table_content")){
_2f.style.background=_2e;
}
break;
}
};
Projapi.Widgets.PJSmartWindow.prototype.getBackgroundColor=function(){
return this.getProperty("backgroundColor",Projapi.Theme.PanelBackground,true);
};
Projapi.Widgets.PJSmartWindow.prototype.exitObject=function(){
if(!this.confirmExit()){
if(this.getProperty("FireValueChangedOnExit",false,true)){
if(this.getObjectValue()!=null){
this.publish(Projapi.Links.Action.ValueChanged,this,this.getObjectValue());
this.setObjectValue(null);
}
for(var _30=0,_31=this._actionTargets.length;_30<_31;_30++){
this.removeLink(Projapi.Links.Action,this._actionTargets[_30]);
}
}
this.destroyObject();
}
};
Projapi.Widgets.PJSmartWindow.prototype.canClose=function(_32){
this.exitObject();
return false;
};
Projapi.Widgets.PJSmartWindow.prototype.viewObject=function(_33){
if(this._properties.hide||!this._domNode||!this._objectInitialized){
return;
}
if(!this._objectHidden){
return;
}
if(this._currentPage==-1){
this.selectPage(0);
}
this._nodes.containerHolder.domNode.style.display="";
if(this._internalWindow){
Projapi.FocusManager.setFocusedWindow(this);
this._internalWindow.showCenter(!!this._properties.modal);
if(this.getProperty("maximizeOnInit",false)){
this._internalWindow.maximize();
this.setProperty("maximizeOnInit",false);
}
}else{
if(this._windowType=="overlay"){
Windows.maxZIndex++;
if(this._properties.modal){
Projapi.Util.BlockWindow(document.body,10,true,Windows.maxZIndex);
Windows.maxZIndex++;
this._blockModalObj=Projapi.Util.BlockWindow.blocked.last();
}
this._domNode.domNode.style.zIndex=Windows.maxZIndex;
}
}
Projapi.Widgets.PJSmartWindow.superclass.viewObject.call(this);
if(this._toolbar){
this._toolbar.viewObject();
}
if(this._menubar){
this._menubar.viewObject();
}
if(this._statusBar){
this._statusBar.viewObject();
}
this.resize(false,true);
Projapi.FocusManager.applyEntry(this._objectName,10);
};
Projapi.Widgets.PJSmartWindow.prototype.hideObject=function(){
if(!this.getProperty("hideOnClose",false)){
this.destroyObject();
return;
}
if(this._internalWindow){
if(Projapi.FocusManager.getFocusedWindow()==this){
this._lastFocusedObject=null;
Projapi.FocusManager.setFocusedWindow(null);
}
this._internalWindow.hide();
}else{
if(this._windowType=="overlay"){
if(this._properties.modal){
if(Projapi.Util.BlockWindow.blocked.last()!=this._blockModalObj){
Projapi.Util.BlockWindow.blocked.splice(Projapi.Util.BlockWindow.blocked.indexOf(this._blockModalObj),1);
Projapi.Util.BlockWindow.blocked.push(this._blockModalObj);
}
Projapi.Util.ClearWindow(document.body);
}
}
}
Projapi.Widgets.PJSmartWindow.superclass.hideObject.call(this);
if(this._toolbar){
this._toolbar.hideObject();
}
if(this._menubar){
this._menubar.hideObject();
}
if(this._statusBar){
this._statusBar.hideObject();
}
};
Projapi.Widgets.PJSmartWindow.prototype.destroyObject=function(){
if(this.getProperty("hideOnClose",false)){
this.hideObject();
}else{
if(Projapi.FocusManager.getFocusedWindow()==this.getWindowName()){
Projapi.FocusManager.setFocusedWindow(null);
}
if(this._internalWindow){
this._internalWindow.hide();
}
Projapi.Widgets.PJSmartWindow.superclass.destroyObject.call(this);
if(this._nodes["contentRoot"]&&this._nodes["contentRoot"].domNode.parentNode){
this._nodes["contentRoot"].domNode.parentNode.removeChild(this._nodes["contentRoot"].domNode);
}
if(this._internalWindow){
this._internalWindow.destroy();
}else{
if(this._windowType=="overlay"){
if(this._properties.modal){
if(Projapi.Util.BlockWindow.blocked.last()!=this._blockModalObj){
Projapi.Util.BlockWindow.blocked.splice(Projapi.Util.BlockWindow.blocked.indexOf(this._blockModalObj),1);
Projapi.Util.BlockWindow.blocked.push(this._blockModalObj);
}
Projapi.Util.ClearWindow(document.body);
}
this._domNode.domNode.parentNode.removeChild(this._domNode.domNode);
}
}
}
};
Projapi.Widgets.PJSmartWindow.prototype.confirmCancel=function(){
var _34=Projapi.Widgets.PJSmartWindow.superclass.confirmCancel.call(this);
if(_34){
if(this.getProperty("closeOnCancel",true,true)){
this.exitObject();
}
}
return _34;
};
Projapi.Widgets.PJSmartWindow.prototype.confirmOk=function(){
var _35=Projapi.Widgets.PJSmartWindow.superclass.confirmOk.call(this);
if(_35){
if(this.getProperty("closeOnOk",true,true)){
this.exitObject();
}
}
return _35;
};
Projapi.Widgets.PJSmartWindow.prototype.__autoCenter=function(){
if(this._properties.recenterAuto){
var _36;
if(typeof this._properties.recenterObject=="string"){
if($P(this._properties.recenterObject)){
this._properties.recenterObject=$P(this._properties.recenterObject);
}else{
if($(this._properties.recenterObject)){
this._properties.recenterObject=$(this._properties.recenterObject);
}
}
}
if(this._properties.recenterObject){
if(this._properties.recenterObject._domNode){
_36=this._properties.recenterObject._domNode.domNode;
}else{
if(this._properties.recenterObject.tagName){
_36=this._properties.recenterObject;
}else{
_36=document.body;
}
}
}else{
_36=document.body;
}
var pos=Position.page(_36);
pos[0]+=_36.scrollLeft+_36.offsetWidth/2;
pos[1]+=_36.scrollTop+_36.offsetHeight/2;
pos[0]-=this._domNode.domNode.offsetWidth/2;
pos[1]-=this._domNode.domNode.offsetHeight/2;
this._domNode.domNode.style.top=pos[1]+"px";
this._domNode.domNode.style.left=pos[0]+"px";
}
};
Projapi.Widgets.PJSmartWindow.prototype.scheduleResize=function(){
if(this._resizeTimeout){
return;
}
var _38=this;
this._resizeTimeout=setTimeout(function(){
_38.resize(true);
_38._resizeTimeout=null;
},100);
};
Projapi.Widgets.PJSmartWindow.prototype.resize=function(_39,_3a){
if(this._resizeTimeout&&!_39){
return;
}
if(this._objectHidden){
return;
}
if(this._properties.height!="auto"){
var _3b=document.body.offsetHeight;
if(this._internalWindow){
_3b-=this._domNode.domNode.offsetHeight-this._internalWindow.content.offsetHeight;
}
this._contentDOMNode.domNode.style.maxHeight=_3b-this._nodes.menuCell.domNode.offsetHeight-this._nodes.toolbarCell.domNode.offsetHeight-this._nodes.statusbarCell.domNode.offsetHeight+"px";
switch(this._windowType){
case "inline":
this._contentDOMNode.domNode.style.height=this._contentDOMNode.domNode.style.maxHeight;
break;
case "internal":
this._internalWindow.updateWidth();
this._internalWindow.updateHeight();
break;
case "overlay":
break;
}
}
if(!_3a){
Projapi.Widgets.PJSmartWindow.superclass.resize.call(this);
}
if(this._properties.height!="auto"&&this._internalWindow){
setTimeout(this._internalWindow.updateWidth.bind(this._internalWindow),50);
setTimeout(this._internalWindow.updateHeight.bind(this._internalWindow),60);
}
this.__autoCenter();
};
Projapi.Widgets.PJSmartWindow.prototype.getActionTarget=function(){
return this._actionTargets;
};
Projapi.Widgets.PJSmartWindow.prototype.addActionTarget=function(_3c){
this._actionTargets.push(_3c);
};
Projapi.Widgets.PJSmartWindow.prototype.removeActionTarget=function(_3d){
var i=0;
while((this._actionTargets[i]!=null)&&(this._actionTargets[i]!=_3d)){
++i;
}
this._actionTargets.splice(i,1);
};
Projapi.Widgets.PJSmartWindow.getFocusedWindowName=function(){
return Projapi.FocusManager.getFocusedWindow();
};
Projapi.Widgets.PJSmartWindow.getFocusedObject=function(){
return Projapi.FocusManager.getFocusedObject();
};
Projapi.Widgets.PJSmartWindow.prototype._generatePopupFromToolbar=function(_3f){
this._popup=new Projapi.Widgets.PJPopupMenu("generated-popup-for-"+this._objectName,{});
var _40,btn,_42=[],i;
for(_40=0;_40<_3f._containerTarget.length;_40++){
_42.push(_3f._containerTarget[_40]);
}
for(_40=0;_40<_42.length;_40++){
if((btn=_42[_40])=="separator"){
Projapi.Controller.subscribe(this._popup,Projapi.Links.Container.CreateObjects,new Projapi.Widgets.PJMenuItem("generated-mi-"+_40+"-for-"+this._objectName,{label:""}));
}else{
if(btn instanceof Projapi.Widgets.PJToolGroup){
if(!this.getProperty("parseButtonGroupsToPopup",true,true)){
continue;
}
btn=btn._containerTarget;
_42.splice(_40+1,0,"separator");
for(i=btn.length-1;i>=0;i--){
_42.splice(_40+1,0,btn[i]);
}
}else{
if(btn instanceof Projapi.Widgets.PJToolButton){
var _44={label:btn._properties.label||"(No label given)",image:btn._properties.image||null,hoverImage:btn._properties.hoverImage||btn._properties.hooverImage||null,disabledImage:btn._properties.disabledImage||null,clickTarget:btn};
if(btn._properties.hotkey){
_44.___hotkeyText=String(btn._properties.hotkey);
}
var mi=new Projapi.Widgets.PJMenuItem("generated-mi-"+_40+"-for-"+this._objectName,_44);
btn._properties.onDisableObjectPublish=Projapi.Links.Container.DisableObject;
btn._properties.onEnableObjectPublish=Projapi.Links.Container.EnableObject;
Projapi.Controller.subscribe(btn,Projapi.Links.Container.DisableObject,mi);
Projapi.Controller.subscribe(btn,Projapi.Links.Container.EnableObject,mi);
Projapi.Controller.subscribe(this._popup,Projapi.Links.Container.CreateObjects,mi);
if(btn._popup){
Projapi.Controller.subscribe(mi,Projapi.Links.Container.CreateObjects,btn._popup);
}
}
}
}
}
this.addLink(Projapi.Links.Container,this._popup);
if(this._objectCreated){
this._popup.createObjects();
}
if(this._objectInitialized){
this._popup.initializeObject();
}
};
Projapi.Widgets.PJSmartWindow.prototype.getPopup=function(){
return this._popup;
};
Projapi.Widgets.PJSmartWindow.prototype.removePopup=function(){
this._popup=null;
};
Projapi.Widgets.PJSmartWindow.prototype.setPopup=function(_46){
if(this._popup==_46){
return;
}
this._popup=_46;
if(this._objectCreated&&!this._popup._objectCreated){
this._popup.createObjects();
}
if(this._objectInitialized&&!this._popup._objectInitialized){
this._popup.initializeObject();
}
};
if(typeof Projapi=="undefined"){
var Projapi={};
}
if(typeof Projapi.Widgets=="undefined"){
Projapi.Widgets={};
}
Projapi.Widgets.PJToolbar=function(_47,_48){
Projapi.Widgets.PJToolbar.superclass.constructor.call(this,_47,_48);
this._properties=Object.extend({showSomeLabels:true,showAllLabels:false},this._properties);
this._DOMClassPrefix="pjToolbar";
this._objectType="SmartToolbar";
if(this._properties.noBorder!=false){
this._properties.noBorder=true;
}
if(this._properties.singlePage!=false){
this._properties.singlePage=true;
}
};
Projapi.extend(Projapi.Widgets.PJToolbar,Projapi.Widgets.PJSmartContainer);
Projapi.Widgets.PJToolbar.prototype.setBackgroundColor=function(){
};
Projapi.Widgets.PJToolbar.prototype._buildUI=function(){
Projapi.Widgets.PJToolbar.superclass._buildUI.apply(this,arguments);
var cls="";
if(this._properties.showSomeLabels){
cls+=" showPreferred";
}
if(this._properties.showAllLabels){
cls+=" forceLabel";
}
if(cls){
this._domNode.domNode.className+=cls;
}
};
Projapi.Widgets.PJToolbar.prototype.setShowSomeLabels=function(_4a){
if(this._properties.showSomeLabels==_4a){
return;
}
this._properties.showSomeLabels=_4a;
if(this._domNode){
if(_4a){
this._domNode.domNode.className+=" showPreferred";
}else{
this._domNode.domNode.className=this._domNode.domNode.className.replace(/ showPreferred\b/,"");
}
}
};
Projapi.Widgets.PJToolbar.prototype.setShowAllLabels=function(_4b){
if(this._properties.showAllLabels==_4b){
return;
}
this._properties.showAllLabels=_4b;
if(this._domNode){
if(_4b){
this._domNode.domNode.className+=" forceLabel";
}else{
this._domNode.domNode.className=this._domNode.domNode.className.replace(/ forceLabel\b/,"");
}
}
};
Projapi.Widgets.PJToolbar.prototype.resize=function(){
};
if(typeof Projapi=="undefined"){
var Projapi={};
}
if(typeof Projapi.Widgets=="undefined"){
Projapi.Widgets={};
}
Projapi.Widgets.PJToolGroup=function(_4c,_4d){
if(false&&!_4d.layout){
_4d.layout="TableLayout";
_4d.layoutTableRows=1;
_4d.layoutTableCols=1;
_4d.layoutCellSpacing=0;
}
Projapi.Widgets.PJToolGroup.superclass.constructor.call(this,_4c,_4d);
this._DOMClassPrefix="pjToolGroup";
this._displayMode="inline";
this._properties=Object.extend({showSomeLabels:true,showAllLabels:false},this._properties);
this._properties.noBorder=true;
this._properties.singlePage=true;
this._objectType="ToolGroup";
};
Projapi.extend(Projapi.Widgets.PJToolGroup,Projapi.Widgets.PJSmartContainer);
Projapi.Widgets.PJToolGroup.prototype.initializeObject=function(){
Projapi.Widgets.PJToolGroup.superclass.initializeObject.call(this);
var len=this._containerTarget.length;
var _4f=[];
for(var idx=0;idx<len;idx++){
if(!this._containerTarget[idx]._properties.hide){
_4f.push(this._containerTarget[idx]);
}
}
len=_4f.length;
if(len<3){
if(len==2){
this._containerTarget[0]._domNode.domNode.className+=" tbF";
this._containerTarget[1]._domNode.domNode.className+=" tbL";
}else{
this._containerTarget[0]._domNode.domNode.className+=" tbF";
}
}else{
this._containerTarget[0]._domNode.domNode.className+=" tbF";
this._containerTarget[len-1]._domNode.domNode.className+=" tbL";
for(idx=1;idx<len-1;idx++){
this._containerTarget[idx]._domNode.domNode.className+=" tbM";
}
}
};
Projapi.Widgets.PJToolGroup.prototype.setBackgroundColor=function(){
};
Projapi.Widgets.PJToolGroup.prototype._buildUI=function(){
Projapi.Widgets.PJToolGroup.superclass._buildUI.apply(this,arguments);
var cls="";
if(this._properties.showSomeLabels){
cls+=" showPreferred";
}
if(this._properties.showAllLabels){
cls+=" forceLabel";
}
if(cls){
this._domNode.domNode.className+=cls;
}
};
Projapi.Widgets.PJToolGroup.prototype.setShowSomeLabels=function(_52){
if(this._properties.showSomeLabels==_52){
return;
}
this._properties.showSomeLabels=_52;
if(this._domNode){
if(_52){
this._domNode.domNode.className+=" showPreferred";
}else{
this._domNode.domNode.className=this._domNode.domNode.className.replace(/ showPreferred\b/,"");
}
}
};
Projapi.Widgets.PJToolGroup.prototype.setShowAllLabels=function(_53){
if(this._properties.showAllLabels==_53){
return;
}
this._properties.showAllLabels=_53;
if(this._domNode){
if(_53){
this._domNode.domNode.className+=" forceLabel";
}else{
this._domNode.domNode.className=this._domNode.domNode.className.replace(/ forceLabel\b/,"");
}
}
};
Projapi.Widgets.PJToolGroup.prototype.resize=function(){
};
if(typeof Projapi=="undefined"){
var Projapi={};
}
if(typeof Projapi.Widgets=="undefined"){
Projapi.Widgets={};
}
Projapi.Widgets.PJStatusPanel=function(_54,_55){
if(false&&!_55.layout){
_55.layout="TableLayout";
_55.layoutTableRows=1;
_55.layoutTableCols=1;
_55.layoutCellSpacing=0;
}
Projapi.Widgets.PJStatusPanel.superclass.constructor.call(this,_54,_55);
this._DOMClassPrefix="pjStatusPanel";
this._displayMode="block";
this._objectType="SmartStatusbar";
};
Projapi.extend(Projapi.Widgets.PJStatusPanel,Projapi.Widgets.PJSmartContainer);
if(typeof Projapi=="undefined"){
var Projapi={};
}
if(typeof Projapi.Widgets=="undefined"){
Projapi.Widgets={};
}
Projapi.Widgets.PJHTMLBlock=function(_56,_57){
_56=_56||Projapi.UI.GenerateId();
Projapi.Widgets.PJHTMLBlock.superclass.constructor.call(this,_56,_57);
this._contentDOMNode=null;
this.ClassPrefix="pjHTMLBlock";
this._displayMode="block";
this._doColumnName=null;
this._dataSource=null;
};
Projapi.extend(Projapi.Widgets.PJHTMLBlock,Projapi.Base.iPJVisualObject);
Projapi.Widgets.PJHTMLBlock.prototype.DataSourceEvents=[Projapi.Links.Data.DataAvailable];
Projapi.Widgets.PJHTMLBlock.prototype._processObjectProperties=function(){
Projapi.Widgets.PJHTMLBlock.superclass._processObjectProperties.call(this);
if(this._properties.doColumnName!=false){
this.setDOColumnName(this._properties.doColumnName||this._objectName);
}
};
Projapi.Widgets.PJHTMLBlock.prototype._processVisualObjectProperties=function(){
Projapi.Widgets.PJHTMLBlock.superclass._processVisualObjectProperties.call(this);
var _58=this._properties.width||null,_59=this._properties.height||null;
if(_58||_59){
this.setSize(_58,_59);
}
if(this._dataSource){
this.dataAvailable();
}else{
this.setContent(this._properties.content||"&nbsp;");
}
if(!(this._properties.hidden==true)&&!(this._properties.hideOnInit==true)){
this.viewObject();
}
};
Projapi.Widgets.PJHTMLBlock.prototype.createObjects=function(){
this._objectCreated=true;
this._processObjectProperties();
this._buildUI();
return this;
};
Projapi.Widgets.PJHTMLBlock.prototype._buildUI=function(){
var _5a;
if(!this._domNode){
var _5b=typeof this._properties.content=="string"?this._properties.content:"";
this.setDOMNode(Projapi.UI.Element.fromString("<div id=\""+this._objectName+"\" class=\""+this.ClassPrefix+"\" style=\"display:none\">"+_5b+"</div>"));
this._contentDOMNode=this._domNode;
if(typeof this._properties.content=="object"){
this._contentDOMNode.domNode.appendChild(this._properties.content);
}
this._lastContent=this._properties.content;
if(this._containerSource){
var _5c=this._containerSource.getLayoutManager(this._objectPage);
if(_5c){
_5c.add(this);
}
}
}
};
Projapi.Widgets.PJHTMLBlock.prototype.initializeObject=function(){
Projapi.Widgets.PJHTMLBlock.superclass.initializeObject.call(this);
this._objectInitialized=true;
this._processVisualObjectProperties();
return this;
};
Projapi.Widgets.PJHTMLBlock.prototype.getContentDOMNode=function(){
return this._contentDOMNode;
};
Projapi.Widgets.PJHTMLBlock.prototype.setContent=function(_5d){
if(_5d==this._lastContent){
return;
}
if(this._contentDOMNode){
this._lastContent=_5d;
if(typeof _5d=="string"){
this._contentDOMNode.domNode.innerHTML=_5d;
}else{
if(typeof _5d=="object"){
while(this._contentDOMNode.domNode.firstChild){
this._contentDOMNode.domNode.removeChild(this._contentDOMNode.domNode.firstChild);
}
this._contentDOMNode.domNode.appendChild(_5d);
}
}
if(navigator.appVersion.indexOf("MSIE")>-1&&(navigator.appVersion.indexOf("MSIE 6")>-1||navigator.appVersion.indexOf("MSIE 5")>-1)){
var _5e=this._contentDOMNode.domNode.getElementsByTagName("img"),i;
for(i=0;i<_5e.length;i++){
if(_5e[i].src.match(/\.png$/i)){
_5e[i].onload=Projapi.Widgets.onPNGLoad;
}
}
}
if(this._containerSource&&this._containerSource.objectInitialized&&!this._containerSource._objectHidden){
this._containerSource.resize();
}
}
};
Projapi.Widgets.PJHTMLBlock.prototype.setSize=function(_60,_61){
if(typeof _60!="undefined"&&_60!==null){
this._properties.width=_60;
if(this._domNode){
this._domNode.setWidth(_60);
}
}
if(typeof _61!="undefined"&&_61!==null){
this._properties.height=_61;
if(this._domNode){
this._domNode.setHeight(_61);
}
}
};
Projapi.Widgets.PJHTMLBlock.prototype.setDOColumnName=function(_62){
this._doColumnName=_62;
Projapi.Register.add(this,this._objectName,this.getDOColumnName(),this._containerSource);
};
Projapi.Widgets.PJHTMLBlock.prototype.getDOColumnName=function(){
return this._doColumnName||this._objectName;
};
Projapi.Widgets.PJHTMLBlock.prototype.getDataSource=function(){
return this._dataSource;
};
Projapi.Widgets.PJHTMLBlock.prototype.setDataSource=function(dO){
this._dataSource=dO;
if(dO&&this._objectInitialized){
this.dataAvailable();
}
};
Projapi.Widgets.PJHTMLBlock.prototype.dataAvailable=function(){
if(this._dataSource._properties.currentIndex<0){
this.setContent(this._properties.noRecordContent||"");
}else{
var str=this._properties.content,m,idx=0;
var dO=this._dataSource._getDataObject(),col=dO.getCurrentRow(),_69=dO.options.columns;
while(m=str.match(/{([-0-9a-zA-Z_]+)}/)){
str=str.replace(m[0],col[_69.indexByName[m[1]]]);
}
this.setContent(str);
}
};
if(typeof Projapi=="undefined"){
var Projapi={};
}
if(typeof Projapi.Widgets=="undefined"){
Projapi.Widgets={};
}
Projapi.Widgets.PJToolButton=function(_6a,_6b){
Projapi.Widgets.PJToolButton.superclass.constructor.call(this,_6a,_6b);
this._properties=Object.extend({preferLabel:false,forceLabel:false},this._properties);
this._contentDOMNode=null;
this._imageElement=null;
this._labelElement=null;
this.onClickPublish=Projapi.Links.Action.ActionPerformed;
this.onClickEval=null;
this.onClickExecute=null;
this._actionTarget=[];
this.actionTargetEvents=[];
this._canFocus=true;
this._hasFocus=false;
this._isHoover=false;
this._popup=null;
this._popupImg=null;
};
Projapi.extend(Projapi.Widgets.PJToolButton,Projapi.Base.iPJVisualObject);
Projapi.Widgets.PJToolButton.prototype.createObjects=function(){
this._processObjectProperties();
if(!this._isUIBuilt()){
this._buildUI();
}
Projapi.Widgets.PJToolButton.superclass.createObjects.call(this);
if(this._popup&&!this._popup._objectCreated){
this._popup.createObjects();
}
this._objectCreated=true;
this._processVisualObjectProperties();
if(this._properties.hotkey&&!this._properties.hotkeyDescription&&this._properties.label){
this.setHotkeyDescription(this._properties.label);
}
};
Projapi.Widgets.PJToolButton.prototype._processObjectProperties=function(){
Projapi.Widgets.PJToolButton.superclass._processObjectProperties.call(this);
if(this._properties.onClickPublish){
this.onClickPublish=this._properties.onClickPublish;
}
if(this._properties.onClickEval){
this.onClickEval=this._properties.onClickEval;
}
if(this._properties.onClickExecute){
this.onClickExecute=this._properties.onClickExecute;
}
};
Projapi.Widgets.PJToolButton.prototype._isUIBuilt=function(){
return (this.getDOMNode()&&this._imageElement);
};
Projapi.Widgets.PJToolButton.prototype._buildUI=function(){
var _6c,_6d,_6e,tmp;
var _70="<img class=\"pjToolButtonImg\" alt=\"\" border=\"0\" vspace=\"0\" hspace=\"0\" title=\""+(this._properties.tooltip||"")+"\" src=\""+(this._objectEnabled?this._properties.image||"":this._properties.disabledImage||this._properties.image||"")+"\"/><span class=\"label\">"+(this._properties.label||"")+"</span>";
var _71=false;
var _72=this._domNode;
if(!_72){
if(_72=$(this._objectName)){
this.setDOMNode(_72=Projapi.UI.Element.get(_72));
_72.domNode.style.display="none";
this._contentDOMNode=_6d=_72.domNode;
}else{
this.setDOMNode(_72=Projapi.UI.Element.fromString(["<span class=\"pjToolButton",Projapi.Theme.ImageBase&&(tmp=Projapi.Theme.ImageBase.getWithSource(this._properties.image))&&tmp.image&&tmp.image.width&&(" tbtb"+tmp.image.width)||"",this._properties.preferLabel?" preferLabel":"",this._properties.forceLabel?" forceLabel":"",this._objectEnabled==false?" disabled":"","\" id=\"",this._objectName,(tmp=this._properties.tooltip)?"\" title=\""+tmp:"","\" tabindex=\"",this._properties.tabIndex||0,this._properties.hooverImage?"\" onmouseover=\"$P(this.id)._handlerMouseOver()\" onmouseout=\"$P(this.id)._handlerMouseOut()":"","\" onclick=\"$P(this.id).click();\" onkeydown=\"$P(this.id)._handleKeyEvents(arguments[0] || window.event)\" onblur=\"$P(this.id)._focusLost()\" onfocus=\"$P(this.id)._focusGained()","\" style=\"display:none;\">",_70,"</span>"].join("")));
this._contentDOMNode=_6d=_72.domNode;
this._imageElement=_72.domNode.firstChild;
this._labelElement=_72.domNode.lastChild;
_71=true;
}
}else{
_72.domNode.style.display="none";
_6d=this.getContentDOMNode();
if(!_6d){
this._contentDOMNode=_6d=_72.domNode;
}
if(this._objectEnabled==false){
this._imageElement.setSrc(this._properties.disabledImage||this._properties.image);
}else{
this._imageElement.setSrc(this._properties.image);
}
}
if(this._popup){
this._openPopup=this.__openPopup.bindAsEventListener(this);
this._popupImg=document.createElement("span");
if(this._properties.onClickPublish||this._properties.onClickEval||this._properties.onClickExecute){
this._popupImg.className="popupOpen";
Event.observe(this._popupImg,"click",this._openPopup,false);
}else{
this._popupImg.className="popupOpen popupDefault";
Event.observe(this._domNode,"click",this._openPopup,false);
}
_6d.appendChild(this._popupImg);
}
this._imageElement.setSrc=Projapi.Widgets.PJToolButton.setImgSrc;
if(_71&&(tmp=this._containerSource)){
if(tmp instanceof Projapi.Base.iPJSmartContainer){
tmp.getLayoutManager(this._objectPage).add(this);
}else{
if(tmp instanceof Projapi.UI.Element){
tmp.domNode.appendChild(_72.domNode);
}
}
}
};
if(navigator.appVersion.indexOf("MSIE")>-1&&(navigator.appVersion.indexOf("MSIE 6")>-1||navigator.appVersion.indexOf("MSIE 5")>-1)){
Projapi.Widgets.PJToolButton.setImgSrc=function(_73){
var _74=this;
if(!(this.style.width||this.style.height)){
this.onload=Projapi.Widgets.onPNGLoad;
this.src=_73;
}else{
this.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\""+_73+"\", sizingMethod=\"scale\")";
}
};
Projapi.Widgets.onPNGLoad=function(ev){
var x=this.offsetWidth,y=this.offsetHeight;
this.onload=null;
if(this.src.indexOf("/spacer.gif")>-1){
return;
}
if(x>0&&y>0){
this.style.width=x+"px";
this.style.height=y+"px";
var x1=this.offsetWidth,y1=this.offsetHeight;
if(x1!=x){
this.style.width=(x+x-x1)+"px";
}
if(y1!=y){
this.style.height=(y+y-y1)+"px";
}
this.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\""+this.src+"\", sizingMethod=\"scale\")";
this.src=Projapi.Globals.DEP_PATH+"/templates/default/images/spacer.gif";
}else{
setTimeout(Projapi.Widgets.onPNGLoad.bind(this),200);
}
};
}else{
Projapi.Widgets.PJToolButton.setImgSrc=function(_7a){
if(this.src!=_7a){
this.src=_7a;
}
};
}
Projapi.Widgets.PJToolButton.prototype._handlerMouseOver=function(_7b){
this._isHoover=this._imageElement&&this._properties.hooverImage;
if(this._objectEnabled){
if(this._isHoover){
this._imageElement.setSrc(this._properties.hooverImage);
}
}
};
Projapi.Widgets.PJToolButton.prototype._handlerMouseOut=function(_7c){
this._isHoover=false;
if(this._objectEnabled&&this._imageElement&&this.getImage()){
this._imageElement.setSrc(this.getImage());
}
};
Projapi.Widgets.PJToolButton.prototype.initializeObject=function(){
Projapi.Widgets.PJToolButton.superclass.initializeObject.call(this);
if(this._popup&&!this._popup._objectInitialized){
this._popup.initializeObject();
}
this._objectInitialized=true;
if(this._properties.hideOnInit||this._properties.hide){
this.hideObject();
}else{
this.viewObject();
}
};
Projapi.Widgets.PJToolButton.prototype.viewObject=function(){
Projapi.Util.Trigger(this,"onViewObject");
if(this._properties.hide||!this._domNode){
return;
}
Projapi.Widgets.PJToolButton.superclass.viewObject.call(this);
this._objectHidden=false;
};
Projapi.Widgets.PJToolButton.prototype.applyEntry=function(){
if(this._domNode&&this.isObjectEnabled()){
this._domNode.domNode.focus();
}
};
Projapi.Widgets.PJToolButton.prototype._focusLost=function(){
if(!this._hasFocus){
return;
}
this._hasFocus=false;
if(this._domNode){
this._domNode.domNode.className=this._domNode.domNode.className.replace(" focused","");
}
Projapi.Util.Trigger(this,"onFocusLost");
};
Projapi.Widgets.PJToolButton.prototype._focusGained=function(){
if(this._hasFocus){
return;
}
this._hasFocus=true;
if(this._domNode){
this._domNode.domNode.className+=" focused";
}
Projapi.Util.Trigger(this,"onApplyEntry");
Projapi.FocusManager.setFocusedObject(this);
};
Projapi.Widgets.PJToolButton.prototype._handleKeyEvents=function(_7d){
if(_7d.keyCode==Event.KEY_RETURN||_7d.keyCode==32||_7d.keyCode==0){
this.click();
Event.stop(_7d);
}
};
Projapi.Widgets.PJToolButton.prototype.click=function(){
if(!this.isObjectEnabled()){
return;
}
if(this.onClickEval){
var _7e=$("_pjxTmpEvalUrl");
if(!_7e){
new Insertion.Bottom(document.body,"<div id=\"_pjxTmpEvalUrl\" style=\"display:none\"> </div>");
_7e=$("_pjxTmpEvalUrl");
}else{
_7e.innerHTML="";
}
new Ajax.Updater(_7e,this.onClickEval,{method:"post",parameters:params,asynchronous:true,evalScripts:true});
}
if(this.onClickExecute){
if(typeof this.onClickExecute=="function"){
this.onClickExecute.call(this);
}else{
eval(this.onClickExecute);
}
}
if(this.onClickPublish&&this.getActionCommand()){
if(this.onClickPublish==Projapi.Links.Container.ExitObject){
setTimeout((function(){
this.publish(this.onClickPublish,this.getActionCommand());
}).bind(this),10);
}else{
this.publish(this.onClickPublish,this.getActionCommand());
}
}
};
Projapi.Widgets.PJToolButton.prototype.__openPopup=function(_7f){
var pos=Position.cumulativeOffset(this._domNode.domNode);
this._popup.pop(pos[0],pos[1]+this._domNode.domNode.offsetHeight);
this._popup._ignoreNextClick=true;
};
Projapi.Widgets.PJToolButton.prototype.getImage=function(){
if(this._properties["image"]&&this._properties.image){
return this._properties.image;
}
return null;
};
Projapi.Widgets.PJToolButton.prototype.setImage=function(_81){
this._properties.image=_81;
};
Projapi.Widgets.PJToolButton.prototype.getDisabledImage=function(){
return this._properties.disabledImage||null;
};
Projapi.Widgets.PJToolButton.prototype.setDisabledImage=function(_82){
this._properties.disabledImage=_82;
};
Projapi.Widgets.PJToolButton.prototype.getLabel=function(){
return this._properties.label||null;
};
Projapi.Widgets.PJToolButton.prototype.setLabel=function(_83){
this._properties.label=_83;
this._labelElement.innerHTML=_83;
};
Projapi.Widgets.PJToolButton.prototype.getTooltip=function(){
if(this._properties.tooltip){
return this._properties.tooltip+(this._properties.hotkey?(" - "+this._properties.hotkey):"");
}
return null;
};
Projapi.Widgets.PJToolButton.prototype.setTooltip=function(_84){
this._properties.tooltip=_84;
this._imageElement.title=_84;
};
Projapi.Widgets.PJToolButton.prototype.getHooverImage=function(){
return this._properties.hooverImage||null;
};
Projapi.Widgets.PJToolButton.prototype.setHooverImage=function(_85){
this._properties.hooverImage=_85;
};
Projapi.Widgets.PJToolButton.prototype.getActionCommand=function(){
return this._properties.actionCommand||null;
};
Projapi.Widgets.PJToolButton.prototype.setActionCommand=function(_86){
this._properties.actionCommand=_86;
};
Projapi.Widgets.PJToolButton.prototype.getActionKey=function(){
return this._properties.actionKey||null;
};
Projapi.Widgets.PJToolButton.prototype.setActionKey=function(_87){
this._properties.actionKey=_87;
};
Projapi.Widgets.PJToolButton.prototype.isActionKeyGlobal=function(){
return !!this._properties.globalKey;
};
Projapi.Widgets.PJToolButton.prototype.setActionKeyGlobal=function(_88){
if(_88){
this._properties.actionKey=true;
}else{
this._properties.actionKey=false;
}
};
Projapi.Widgets.PJToolButton.prototype.setContentDOMNode=function(_89){
if(typeof _89=="string"){
_89=$(_89);
}
this._contentDOMNode=_89;
};
Projapi.Widgets.PJToolButton.prototype.getContentDOMNode=function(){
return this._contentDOMNode;
};
Projapi.Widgets.PJToolButton.prototype.enableObject=function(){
if(this._objectEnabled){
return;
}
if(Projapi.Util.Trigger(this,"onEnableObject")){
return;
}
if(this._domNode){
this._domNode.domNode.className=this._domNode.domNode.className.replace(" disabled","");
}
this._objectEnabled=true;
if(!this._objectCreated){
return;
}
if(this._imageElement){
if(this._isHoover&&this._properties.hooverImage){
this._imageElement.setSrc(this._properties.hooverImage);
}else{
if(this.getImage()){
this._imageElement.setSrc(this.getImage());
}
}
this._domNode.domNode.tabIndex=this._properties.tabIndex||0;
this._canFocus=true;
}
};
Projapi.Widgets.PJToolButton.prototype.disableObject=function(){
if(this._objectEnabled==false){
return;
}
if(Projapi.Util.Trigger(this,"onDisableObject")){
return;
}
this._objectEnabled=false;
if(!this._objectCreated){
return;
}
if(this._domNode){
this._domNode.domNode.className=(this._hasFocus?this._domNode.domNode.className.replace(" focused",""):this._domNode.domNode.className)+" disabled";
}
var img;
if(this._imageElement&&(img=this.getDisabledImage())){
this._imageElement.setSrc(img);
this._domNode.domNode.tabIndex=-1;
this._canFocus=false;
}
};
Projapi.Widgets.PJToolButton.prototype.destroyObject=function(){
if(this._contentDOMNode){
this._contentDOMNode.onmouseover=null;
this._contentDOMNode.onmouseout=null;
this._contentDOMNode.onmouseup=null;
this._contentDOMNode.onmousedown=null;
}
Projapi.Widgets.PJToolButton.superclass.destroyObject.call(this);
};
Projapi.Widgets.PJToolButton.prototype.getActionTarget=function(){
return this._actionTarget;
};
Projapi.Widgets.PJToolButton.prototype.addActionTarget=function(_8b){
this._actionTarget.push(_8b);
};
Projapi.Widgets.PJToolButton.prototype.removeActionTarget=function(_8c){
var i=0;
while((this._actionTarget[i]!=null)&&(this._actionTarget[i]!=_8c)){
++i;
}
this._actionTarget.splice(i,1);
};
Projapi.Widgets.PJToolButton.prototype.addContainerTarget=function(_8e){
if(_8e.getObjectType){
switch(_8e.getObjectType()){
case "PopupMenu":
this.setPopup(_8e);
break;
default:
console.log("[Warning] Attempt to link unsupported object to ToolButton. The alien object is %o",_8e);
}
}else{
console.log("[Warning] Attempt to link unsupported object to ToolButton. The alien object is %o",_8e);
}
};
Projapi.Widgets.PJToolButton.prototype.getContainerTarget=function(){
if(this._popup){
return [this._popup];
}
return [];
};
Projapi.Widgets.PJToolButton.prototype.removeContainerTarget=function(_8f){
if(this._popup&&this._popup==_8f){
this.removePopup();
}
};
Projapi.Widgets.PJToolButton.prototype.setPopup=function(_90){
if(this._popup==_90){
return;
}
if(this._popup){
this.removePopup();
}
this._popupImg=document.createElement("span");
if(this._properties.onClickPublish||this._properties.onClickEval||this._properties.onClickExecute){
this._popupImg.className="popupOpen";
Event.observe(this._popupImg,"click",this._openPopup,false);
}else{
this._popupImg.className="popupOpen popupDefault";
Event.observe(this._domNode,"click",this._openPopup,false);
}
this._contentDOMNode.appendChild(this._popupImg);
this._popup=_90;
};
Projapi.Widgets.PJToolButton.prototype.removePopup=function(){
if(this._popup){
this._popupImg.parentNode.removeChild(this._popupImg);
if(this._properties.onClickPublish||this._properties.onClickEval||this._properties.onClickExecute){
Event.stopObserving(this._popupImg,"click",this._openPopup,false);
}else{
Event.stopObserving(this._domNode,"click",this._openPopup,false);
}
this._popupImg=null;
this._popup=null;
}
};
if(typeof Projapi=="undefined"){
var Projapi={};
}
if(typeof Projapi.Widgets=="undefined"){
Projapi.Widgets={};
}
Projapi.Widgets.PJButton=function(_91,_92){
Projapi.Widgets.PJButton.superclass.constructor.call(this,_91,_92);
this._contentDOMNode=null;
this._imageElement=null;
this.onClickPublish=Projapi.Links.Action.ActionPerformed;
this.onClickEval=null;
this.onClickExecute=null;
this._actionTarget=[];
this.actionTargetEvents=[];
};
Projapi.extend(Projapi.Widgets.PJButton,Projapi.Base.iPJVisualObject);
Projapi.Widgets.PJButton.prototype.createObjects=function(){
this._processObjectProperties();
if(!this._isUIBuilt()){
this._buildUI();
}
Projapi.Widgets.PJButton.superclass.createObjects.call(this);
};
Projapi.Widgets.PJButton.prototype._processObjectProperties=function(){
Projapi.Widgets.PJButton.superclass._processObjectProperties.call(this);
if(this._properties["onClickPublish"]&&this._properties.onClickPublish){
this.onClickPublish=this._properties.onClickPublish;
}
if(this._properties["onClickEval"]&&this._properties.onClickEval){
this.onClickEval=this._properties.onClickEval;
}
if(this._properties["onClickExecute"]&&this._properties.onClickExecute){
this.onClickExecute=this._properties.onClickExecute;
}
};
Projapi.Widgets.PJButton.prototype._isUIBuilt=function(){
return (this.getDOMNode()&&this.getContentDOMNode()&&this._imageElement);
};
Projapi.Widgets.PJButton.prototype._buildUI=function(){
var _93,_94,_95;
if(!this.getDOMNode()){
if($(this.getObjectName())){
this.setDOMNode(Projapi.UI.Element.get(this.getObjectName()));
this.getContainerSource().getLayoutManager(this.getObjectPage()).add(this.getDOMNode());
}else{
_93=Projapi.UI.CreateFormElement("INPUT",this.getObjectName(),"button");
_93.className="pjButton";
_93.value=this.getLabel();
_93=Projapi.UI.Element.get(_93);
this.setDOMNode(_93);
this.getContainerSource().getLayoutManager(this.getObjectPage()).add(this);
}
}
if(this.getDOMNode()){
if(this.getTooltip()){
this.getDOMNode().domNode.title=this.getTooltip();
}
Event.observe(this.getDOMNode().domNode,"click",this._handlerClick.bindAsEventListener(this));
}
};
Projapi.Widgets.PJButton.prototype._handlerClick=function(e){
if(!e){
var e=window.event;
}
if(this._objectEnabled){
this.click();
}
};
Projapi.Widgets.PJButton.prototype.initializeObject=function(){
Projapi.Widgets.PJButton.superclass.initializeObject.call(this);
this._objectInitialized=true;
};
Projapi.Widgets.PJButton.prototype.click=function(){
if(this.onClickPublish&&this.getActionCommand()){
this.publish(this.onClickPublish,this.getActionCommand());
}
if(this.onClickExecute){
if(typeof this.onClickExecute=="function"){
this.onClickExecute.call(this);
}else{
eval(this.onClickExecute);
}
}
if(this.onClickEval){
var _97=$("_pjxTmpEvalUrl");
if(!_97){
new Insertion.Bottom(document.body,"<div id=\"_pjxTmpEvalUrl\" style=\"display:none\"> </div>");
_97=$("_pjxTmpEvalUrl");
}else{
_97.innerHTML="";
}
new Ajax.Updater(_97,this.onClickEval,{method:"post",parameters:params,asynchronous:true,evalScripts:true});
}
};
Projapi.Widgets.PJButton.prototype.getLabel=function(){
if(this._properties["label"]&&this._properties.label){
return this._properties.label;
}
return null;
};
Projapi.Widgets.PJButton.prototype.setLabel=function(_98){
this._properties.label=_98;
if(this._domNode){
this._domNode.domNode.value=_98;
}
};
Projapi.Widgets.PJButton.prototype.getTooltip=function(){
if(this._properties["tooltip"]&&this._properties.tooltip){
return this._properties.tooltip;
}
return null;
};
Projapi.Widgets.PJButton.prototype.setTooltip=function(_99){
this._properties.tooltip=_99;
if(this._objectInitialized){
this._buildUI();
}
};
Projapi.Widgets.PJButton.prototype.getActionCommand=function(){
if(this._properties["actionCommand"]&&this._properties.actionCommand){
return this._properties.actionCommand;
}
return null;
};
Projapi.Widgets.PJButton.prototype.setActionCommand=function(_9a){
this._properties.actionCommand=_9a;
};
Projapi.Widgets.PJButton.prototype.getActionKey=function(){
if(this._properties["actionKey"]&&this._properties.actionKey){
return this._properties.actionKey;
}
return null;
};
Projapi.Widgets.PJButton.prototype.setActionKey=function(_9b){
this._properties.actionKey=_9b;
};
Projapi.Widgets.PJButton.prototype.isActionKeyGlobal=function(){
if(this._properties["globalKey"]&&this._properties.globalKey){
return true;
}
return false;
};
Projapi.Widgets.PJButton.prototype.setActionKeyGlobal=function(_9c){
if(_9c){
this._properties.actionKey=true;
}else{
this._properties.actionKey=false;
}
};
Projapi.Widgets.PJButton.prototype.setContentDOMNode=function(_9d){
if(typeof _9d=="string"){
_9d=$(_9d);
}
this._contentDOMNode=_9d;
};
Projapi.Widgets.PJButton.prototype.getContentDOMNode=function(){
return this._contentDOMNode;
};
Projapi.Widgets.PJButton.prototype.enableObject=function(){
if(!this.isObjectInitialized()){
return;
}
if(this._imageElement&&this.getImage()){
this._imageElement.src=this.getImage();
}
this._objectEnabled=true;
};
Projapi.Widgets.PJButton.prototype.disableObject=function(){
if(!this.isObjectInitialized()){
return;
}
if(this._imageElement&&this.getDisabledImage()){
this._imageElement.src=this.getDisabledImage();
}
this._objectEnabled=false;
};
Projapi.Widgets.PJButton.prototype.destroyObject=function(){
if(this._contentDOMNode){
this._contentDOMNode.onclick=null;
}
Projapi.Widgets.PJButton.superclass.destroyObject.call(this);
};
Projapi.Widgets.PJButton.prototype.getActionTarget=function(){
return this._actionTarget;
};
Projapi.Widgets.PJButton.prototype.addActionTarget=function(_9e){
this._actionTarget.push(_9e);
};
Projapi.Widgets.PJButton.prototype.removeActionTarget=function(_9f){
var i=0;
while((this._actionTarget[i]!=null)&&(this._actionTarget[i]!=_9f)){
++i;
}
this._actionTarget.splice(i,1);
};
if(typeof Projapi=="undefined"){
var Projapi={};
}
if(typeof Projapi.Widgets=="undefined"){
Projapi.Widgets={};
}
Projapi.Widgets.PJUpdateToolbar=function(_a1,_a2){
Projapi.Widgets.PJUpdateToolbar.superclass.constructor.call(this,_a1,_a2);
this.BtAdd=null;
this.BtCopy=null;
this.BtUpdate=null;
this.BtDelete=null;
this.BtSave=null;
this.BtReset=null;
this.BtCancel=null;
this.ActionSourceEvents=[Projapi.Links.Action.ActionPerformed];
this._actionSource=[];
this.TableIOSourceEvents=Projapi.Links.TableIO.SourceEvents;
this.TableIOTargetEvents=Projapi.Links.TableIO.TargetEvents;
this._tableIOTarget;
this.DataSourceEvents=Projapi.Links.Data.SourceEvents;
this._dataSource=null;
this._saveType=false;
this._prevToolbarState=null;
this._state=null;
};
Projapi.extend(Projapi.Widgets.PJUpdateToolbar,Projapi.Widgets.PJToolGroup);
Projapi.Widgets.PJUpdateToolbar.prototype._processObjectProperties=function(){
Projapi.Widgets.PJField.superclass._processObjectProperties.call(this);
if(this.getProperty("saveType",false,true)){
this._saveType=true;
}
};
Projapi.Widgets.PJUpdateToolbar.prototype.createObjects=function(){
this._processObjectProperties();
var _a3={image:Projapi.Theme.PJUpdateToolbarAddImage,disabledImage:Projapi.Theme.PJUpdateToolbarAddImageDisabled,hooverImage:Projapi.Theme.PJUpdateToolbarAddImageHoover,actionCommand:"add",label:"Add",tooltip:"Add record",hotkey:"INS"};
if(this._properties.add){
Object.extend(_a3,this._properties.add);
}
this.BtAdd=new Projapi.Widgets.PJToolButton(this._objectName+"_BtAdd",_a3);
this.addLink(Projapi.Links.Container.CreateObjects,this.BtAdd);
this.BtAdd.addLink(Projapi.Links.Action,this);
_a3={image:Projapi.Theme.PJUpdateToolbarCopyImage,disabledImage:Projapi.Theme.PJUpdateToolbarCopyImageDisabled,hooverImage:Projapi.Theme.PJUpdateToolbarCopyImageHoover,actionCommand:"copy",label:"Copy",tooltip:"Copy record"};
if(this._properties.copy){
Object.extend(_a3,this._properties.copy);
}
this.BtCopy=new Projapi.Widgets.PJToolButton(this._objectName+"_BtCopy",_a3);
this.addLink(Projapi.Links.Container.CreateObjects,this.BtCopy);
this.BtCopy.addLink(Projapi.Links.Action,this);
_a3={image:Projapi.Theme.PJUpdateToolbarUpdateImage,disabledImage:Projapi.Theme.PJUpdateToolbarUpdateImageDisabled,hooverImage:Projapi.Theme.PJUpdateToolbarUpdateImageHoover,actionCommand:"edit",label:"Update",tooltip:"Update record",hotkey:"CTRL+e"};
if(this._saveType){
_a3.hide=true;
}
if(this._properties.update){
Object.extend(_a3,this._properties.update);
}
if(this._saveType){
_a3.hide=true;
}
this.BtUpdate=new Projapi.Widgets.PJToolButton(this._objectName+"_BtUpdate",_a3);
this.addLink(Projapi.Links.Container.CreateObjects,this.BtUpdate);
this.BtUpdate.addLink(Projapi.Links.Action,this);
_a3={image:Projapi.Theme.PJUpdateToolbarDeleteImage,disabledImage:Projapi.Theme.PJUpdateToolbarDeleteImageDisabled,hooverImage:Projapi.Theme.PJUpdateToolbarDeleteImageHoover,actionCommand:"delete",label:"Delete",tooltip:"Delete record",hotkey:"DEL"};
if(this._properties["delete"]){
Object.extend(_a3,this._properties["delete"]);
}
this.BtDelete=new Projapi.Widgets.PJToolButton(this._objectName+"_BtDelete",_a3);
this.addLink(Projapi.Links.Container.CreateObjects,this.BtDelete);
this.BtDelete.addLink(Projapi.Links.Action,this);
_a3={image:Projapi.Theme.PJUpdateToolbarSaveImage,disabledImage:Projapi.Theme.PJUpdateToolbarSaveImageDisabled,hooverImage:Projapi.Theme.PJUpdateToolbarSaveImageHoover,label:"Save",actionCommand:"save",tooltip:"Save record",hotkey:"CTRL+s"};
if(this._properties.save){
Object.extend(_a3,this._properties.save);
}
this.BtSave=new Projapi.Widgets.PJToolButton(this._objectName+"_BtSave",_a3);
this.addLink(Projapi.Links.Container.CreateObjects,this.BtSave);
this.BtSave.addLink(Projapi.Links.Action,this);
_a3={image:Projapi.Theme.PJUpdateToolbarResetImage,disabledImage:Projapi.Theme.PJUpdateToolbarResetImageDisabled,hooverImage:Projapi.Theme.PJUpdateToolbarResetImageHoover,label:"Reset",actionCommand:"reset",tooltip:"Reset record",hotkey:"CTRL+z"};
if(this._properties.reset){
Object.extend(_a3,this._properties.reset);
}
this.BtReset=new Projapi.Widgets.PJToolButton(this._objectName+"_BtReset",_a3);
this.addLink(Projapi.Links.Container.CreateObjects,this.BtReset);
this.BtReset.addLink(Projapi.Links.Action,this);
_a3={image:Projapi.Theme.PJUpdateToolbarCancelImage,disabledImage:Projapi.Theme.PJUpdateToolbarCancelImageDisabled,hooverImage:Projapi.Theme.PJUpdateToolbarCancelImageHoover,label:"Cancel",actionCommand:"cancel",tooltip:"Cancel operation",hotkey:"ESC"};
if(this._properties.cancel){
Object.extend(_a3,this._properties.cancel);
}
this.BtCancel=new Projapi.Widgets.PJToolButton(this._objectName+"_BtCancel",_a3);
this.addLink(Projapi.Links.Container.CreateObjects,this.BtCancel);
this.BtCancel.addLink(Projapi.Links.Action,this);
Projapi.Widgets.PJUpdateToolbar.superclass.createObjects.call(this);
};
Projapi.Widgets.PJUpdateToolbar.prototype.initializeObject=function(){
Projapi.Widgets.PJUpdateToolbar.superclass.initializeObject.call(this);
if(this.getTableIOTarget()){
this.updateState("UpdateComplete");
}else{
this.updateState("Disable-all");
}
if(this.getDataSource()){
this.queryPosition(this.getDataSource().getQueryPosition());
}
this._objectInitialized=true;
};
Projapi.Widgets.PJUpdateToolbar.prototype.actionPerformed=function(_a4){
switch(_a4){
case "add":
this.publish(Projapi.Links.TableIO.AddRecord);
break;
case "copy":
this.publish(Projapi.Links.TableIO.CopyRecord);
break;
case "edit":
this.publish(Projapi.Links.TableIO.UpdateMode,"UpdateBegin");
break;
case "save":
this.publish(Projapi.Links.TableIO.UpdateRecord);
break;
case "delete":
this.publish(Projapi.Links.TableIO.DeleteRecord);
break;
case "reset":
this.publish(Projapi.Links.TableIO.ResetRecord);
break;
case "cancel":
this.publish(Projapi.Links.TableIO.CancelRecord);
break;
}
};
Projapi.Widgets.PJUpdateToolbar.prototype.setButtons=function(_a5){
if(!this._objectCreated){
return;
}
this._prevToolbarState=_a5;
switch(_a5){
case "Initial-TableIO":
this.BtAdd.enableObject();
this.BtCopy.enableObject();
this.BtUpdate.enableObject();
this.BtDelete.enableObject();
this.BtSave.disableObject();
this.BtReset.disableObject();
this.BtCancel.disableObject();
break;
case "Update":
this.BtAdd.disableObject();
this.BtCopy.disableObject();
this.BtUpdate.disableObject();
this.BtDelete.disableObject();
this.BtSave.enableObject();
this.BtReset.enableObject();
this.BtCancel.disableObject();
break;
case "Modal-Update":
this.BtAdd.disableObject();
this.BtCopy.disableObject();
this.BtUpdate.disableObject();
this.BtDelete.disableObject();
this.BtSave.disableObject();
this.BtReset.disableObject();
this.BtCancel.enableObject();
break;
case "Modal-Update-Modified":
this.BtAdd.disableObject();
this.BtCopy.disableObject();
this.BtUpdate.disableObject();
this.BtDelete.disableObject();
this.BtSave.enableObject();
this.BtReset.enableObject();
this.BtCancel.enableObject();
break;
case "Delete-Only":
this.BtAdd.disableObject();
this.BtCopy.disableObject();
this.BtUpdate.disableObject();
this.BtDelete.enableObject();
this.BtSave.disableObject();
this.BtReset.disableObject();
this.BtCancel.disableObject();
break;
case "Add-Only":
this.BtAdd.enableObject();
this.BtCopy.disableObject();
this.BtUpdate.disableObject();
this.BtDelete.disableObject();
this.BtSave.disableObject();
this.BtReset.disableObject();
this.BtCancel.disableObject();
break;
case "Update-Only":
this.BtAdd.disableObject();
this.BtCopy.disableObject();
this.BtUpdate.enableObject();
this.BtDelete.disableObject();
this.BtSave.disableObject();
this.BtReset.disableObject();
this.BtCancel.disableObject();
break;
case "Disable-tableio":
this.BtAdd.disableObject();
this.BtCopy.disableObject();
this.BtUpdate.disableObject();
this.BtDelete.disableObject();
this.BtSave.disableObject();
this.BtReset.disableObject();
this.BtCancel.disableObject();
break;
default:
console.warn("Toolbar %s got default state of %s",this.getObjectName(),_a5);
this.BtAdd.disableObject();
this.BtCopy.disableObject();
this.BtUpdate.disableObject();
this.BtDelete.disableObject();
this.BtSave.disableObject();
this.BtReset.disableObject();
this.BtCancel.disableObject();
break;
}
};
Projapi.Widgets.PJUpdateToolbar.prototype.queryPosition=function(_a6){
if(this._state&&(this._state=="UpdateBegin"||this._state=="Update")){
this.updateState(this._state);
}else{
switch(_a6){
case "NoRecordAvailable":
this.setButtons("Add-Only");
break;
default:
this.setButtons("Initial-TableIO");
break;
}
}
};
Projapi.Widgets.PJUpdateToolbar.prototype.updateState=function(_a7){
this._state=_a7;
switch(_a7){
case "UpdateBegin":
this.setButtons("Modal-Update");
break;
case "Update":
this.setButtons("Modal-Update-Modified");
break;
case "UpdateComplete":
case "UpdateEnd":
this.setButtons("Initial-TableIO");
break;
default:
this.setButtons("Disable-tableio");
break;
}
};
Projapi.Widgets.PJUpdateToolbar.prototype.enableObject=function(){
Projapi.Widgets.PJUpdateToolbar.superclass.enableObject.call(this);
this.setButtons(this._prevToolbarState);
};
Projapi.Widgets.PJUpdateToolbar.prototype.getActionSource=function(){
return this._actionSource;
};
Projapi.Widgets.PJUpdateToolbar.prototype.addActionSource=function(_a8){
this._actionSource.push(_a8);
};
Projapi.Widgets.PJUpdateToolbar.prototype.removeActionSource=function(_a9){
var i=0;
while((this._actionSource[i]!=null)&&(this._actionSource[i]!=_a9)){
++i;
}
this._actionSource.splice(i,1);
};
Projapi.Widgets.PJUpdateToolbar.prototype.getTableIOTarget=function(){
return this._tableIOTarget;
};
Projapi.Widgets.PJUpdateToolbar.prototype.setTableIOTarget=function(_ab){
this._tableIOTarget=_ab;
};
Projapi.Widgets.PJUpdateToolbar.prototype.isSaveType=function(){
return this._saveType;
};
Projapi.Widgets.PJUpdateToolbar.prototype.getDataSource=function(){
return this._dataSource;
};
Projapi.Widgets.PJUpdateToolbar.prototype.setDataSource=function(_ac){
return this._dataSource=_ac;
};
if(typeof Projapi=="undefined"){
var Projapi={};
}
if(typeof Projapi.Widgets=="undefined"){
Projapi.Widgets={};
}
Projapi.Widgets.PJNavigationToolbar=function(_ad,_ae){
Projapi.Widgets.PJNavigationToolbar.superclass.constructor.call(this,_ad,_ae);
this.BtFirst=null;
this.BtPrev=null;
this.BtNext=null;
this.BtLast=null;
this.ActionSourceEvents=[Projapi.Links.Action.ActionPerformed];
this._actionSource=[];
this.NavigationSourceEvents=Projapi.Links.Navigation.SourceEvents;
this.NavigationTargetEvents=[Projapi.Links.Navigation.QueryPosition,Projapi.Links.Navigation.UpdateState];
this._navigationTarget;
this._prevQueryPosition=null;
this._prevUpdateState=null;
};
Projapi.extend(Projapi.Widgets.PJNavigationToolbar,Projapi.Widgets.PJToolGroup);
Projapi.Widgets.PJNavigationToolbar.prototype.createObjects=function(){
var _af={image:Projapi.Theme.PJNavigationToolbarFirstImage,disabledImage:Projapi.Theme.PJNavigationToolbarFirstImageDisabled,hooverImage:Projapi.Theme.PJNavigationToolbarFirstImageHoover,actionCommand:"first",label:"First",tooltip:"Jump to first item",hotkey:"HOME"};
if(this._properties.first){
Object.extend(_af,this._properties.first);
}
this.BtFirst=new Projapi.Widgets.PJToolButton(this._objectName+"_BtFirst",_af);
this.addLink(Projapi.Links.Container.CreateObjects,this.BtFirst);
this.BtFirst.addLink(Projapi.Links.Action,this);
_af={image:Projapi.Theme.PJNavigationToolbarPrevImage,disabledImage:Projapi.Theme.PJNavigationToolbarPrevImageDisabled,hooverImage:Projapi.Theme.PJNavigationToolbarPrevImageHoover,actionCommand:"prev",label:"Prev",tooltip:"Jump to previous item",hotkey:"UP"};
if(this._properties.prev){
Object.extend(_af,this._properties.prev);
}
this.BtPrev=new Projapi.Widgets.PJToolButton(this._objectName+"_BtPrev",_af);
this.addLink(Projapi.Links.Container.CreateObjects,this.BtPrev);
this.BtPrev.addLink(Projapi.Links.Action,this);
_af={image:Projapi.Theme.PJNavigationToolbarNextImage,disabledImage:Projapi.Theme.PJNavigationToolbarNextImageDisabled,hooverImage:Projapi.Theme.PJNavigationToolbarNextImageHoover,actionCommand:"next",label:"Next",tooltip:"Jump to next item",hotkey:"DOWN"};
if(this._properties.next){
Object.extend(_af,this._properties.next);
}
this.BtNext=new Projapi.Widgets.PJToolButton(this._objectName+"_BtNext",_af);
this.addLink(Projapi.Links.Container.CreateObjects,this.BtNext);
this.BtNext.addLink(Projapi.Links.Action,this);
_af={image:Projapi.Theme.PJNavigationToolbarLastImage,disabledImage:Projapi.Theme.PJNavigationToolbarLastImageDisabled,hooverImage:Projapi.Theme.PJNavigationToolbarLastImageHoover,label:"Last",actionCommand:"last",tooltip:"Jump to last item",hotkey:"END"};
if(this._properties.last){
Object.extend(_af,this._properties.last);
}
this.BtLast=new Projapi.Widgets.PJToolButton(this._objectName+"_BtLast",_af);
this.addLink(Projapi.Links.Container.CreateObjects,this.BtLast);
this.BtLast.addLink(Projapi.Links.Action,this);
Projapi.Widgets.PJNavigationToolbar.superclass.createObjects.call(this);
};
Projapi.Widgets.PJNavigationToolbar.prototype.initializeObject=function(){
Projapi.Widgets.PJNavigationToolbar.superclass.initializeObject.call(this);
if(!this.getNavigationTarget()){
this.queryPosition("NoRecordAvailable");
}else{
this.queryPosition(this.getNavigationTarget().getQueryPosition());
}
this._objectInitialized=true;
};
Projapi.Widgets.PJNavigationToolbar.prototype.queryPosition=function(_b0){
this._prevQueryPosition=_b0;
switch(_b0){
case "FirstRecord":
this.BtFirst.disableObject();
this.BtPrev.disableObject();
this.BtNext.enableObject();
this.BtLast.enableObject();
break;
case "LastRecord":
this.BtFirst.enableObject();
this.BtPrev.enableObject();
this.BtNext.disableObject();
this.BtLast.disableObject();
break;
case "NotFirstOrLast":
this.BtFirst.enableObject();
this.BtPrev.enableObject();
this.BtNext.enableObject();
this.BtLast.enableObject();
break;
case "NoRecordAvailable":
this.BtFirst.disableObject();
this.BtPrev.disableObject();
this.BtNext.disableObject();
this.BtLast.disableObject();
break;
case "OnlyRecordAvailable":
this.BtFirst.disableObject();
this.BtPrev.disableObject();
this.BtNext.disableObject();
this.BtLast.disableObject();
break;
}
};
Projapi.Widgets.PJNavigationToolbar.prototype.updateState=function(_b1){
this._prevUpdateState=_b1;
switch(_b1){
case "UpdateBegin":
case "Update":
this.BtFirst.disableObject();
this.BtPrev.disableObject();
this.BtNext.disableObject();
this.BtLast.disableObject();
break;
case "UpdateEnd":
case "UpdateComplete":
this.queryPosition(this._prevQueryPosition);
break;
}
};
Projapi.Widgets.PJNavigationToolbar.prototype.actionPerformed=function(_b2){
switch(_b2){
case "first":
this.publish(Projapi.Links.Navigation.FetchFirst);
break;
case "prev":
this.publish(Projapi.Links.Navigation.FetchPrev);
break;
case "next":
this.publish(Projapi.Links.Navigation.FetchNext);
break;
case "last":
this.publish(Projapi.Links.Navigation.FetchLast);
break;
}
};
Projapi.Widgets.PJNavigationToolbar.prototype.enableObject=function(){
Projapi.Widgets.PJNavigationToolbar.superclass.enableObject.call(this);
this.queryPosition(this._prevQueryPosition);
this.updateState(this._prevUpdateState);
};
Projapi.Widgets.PJNavigationToolbar.prototype.getActionSource=function(){
return this._actionSource;
};
Projapi.Widgets.PJNavigationToolbar.prototype.addActionSource=function(_b3){
this._actionSource.push(_b3);
};
Projapi.Widgets.PJNavigationToolbar.prototype.removeActionSource=function(_b4){
var i=0;
while((this._actionSource[i]!=null)&&(this._actionSource[i]!=_b4)){
++i;
}
this._actionSource.splice(i,1);
};
Projapi.Widgets.PJNavigationToolbar.prototype.getNavigationTarget=function(){
return this._navigationTarget;
};
Projapi.Widgets.PJNavigationToolbar.prototype.setNavigationTarget=function(_b6){
this._navigationTarget=_b6;
};
if(typeof Projapi=="undefined"){
var Projapi={};
}
if(typeof Projapi.Widgets=="undefined"){
Projapi.Widgets={};
}
Projapi.Widgets.PJLabel=function(_b7,_b8){
Projapi.Widgets.PJLabel.superclass.constructor.call(this,_b7,_b8);
this.DataSourceEvents=[Projapi.Links.Data.DataAvailable];
this._dataSource=null;
this._fieldId=null;
this._doColumnName=null;
this._labelElement=null;
};
Projapi.extend(Projapi.Widgets.PJLabel,Projapi.Base.iPJVisualObject);
Projapi.Widgets.PJLabel.prototype._processObjectProperties=function(){
Projapi.Widgets.PJLabel.superclass._processObjectProperties.call(this);
if(this._properties.doColumnName){
this.setDOColumnName(this._properties.doColumnName);
}
if(this._properties.label){
this.setObjectValue(this._properties.label);
}
};
Projapi.Widgets.PJLabel.prototype.createObjects=function(){
this._processObjectProperties();
this._buildUI();
this._processVisualObjectProperties();
this._objectCreated=true;
};
Projapi.Widgets.PJLabel.prototype._buildUI=function(){
var _b9,_ba;
if(!this._domNode){
if(_b9=document.getElementById(this._objectName)){
this._domNode=Projapi.UI.Element.get(_b9);
this._labelElement=this._domNode;
if(_b9=this._domNode.domNode.getElementsByTagName("label")[0]){
this._labelElement=Projapi.UI.Element.get(_b9);
}
}else{
this._domNode=Projapi.UI.Element.fromString(["<label id=\"",this._objectName,"\" for=\"",this._fieldId,"\" class=\"pjLabel",this._properties.required&&" pjRequired"||"","\">",this._objectValue,"</label>"].join(""));
this._labelElement=this._domNode;
}
}
if(this._containerSource){
_ba=this._containerSource.getLayoutManager(this._objectPage).add(this);
}
};
Projapi.Widgets.PJLabel.prototype.initializeObject=function(){
Projapi.Widgets.PJField.superclass.initializeObject.call(this);
this._objectInitialized=true;
};
Projapi.Widgets.PJLabel.prototype.setFieldId=function(_bb){
this._fieldId=_bb;
if(this._labelElement){
this._labelElement.domNode.htmlFor=_bb;
}
};
Projapi.Widgets.PJLabel.prototype.getFieldId=function(){
return this._fieldId;
};
Projapi.Widgets.PJLabel.prototype.setDOColumnName=function(_bc){
this._doColumnName=_bc;
};
Projapi.Widgets.PJLabel.prototype.getDOColumnName=function(){
return this._doColumnName||this.getObjectName();
};
Projapi.Widgets.PJLabel.prototype.getDataSource=function(){
return this._dataSource;
};
Projapi.Widgets.PJLabel.prototype.setDataSource=function(_bd){
return this._dataSource=_bd;
};
Projapi.Widgets.PJLabel.prototype.dataAvailable=function(_be){
if(typeof _be=="undefined"){
_be=true;
}
if(!this._objectInitialized||this.getDataSource()==null){
return;
}
this.setObjectValue(this.getDataSource().colValues([this.getDOColumnName()])[0]);
};
Projapi.Widgets.PJLabel.prototype.setObjectValue=function(_bf){
this._objectValue=_bf;
if(this._labelElement){
this._labelElement.domNode.innerHTML=_bf;
}
};
Projapi.Widgets.PJLabel.prototype.isRequired=function(){
return !!this._properties.required;
};
Projapi.Widgets.PJLabel.prototype.setRequired=function(_c0){
if(!!this._properties.required==_c0){
return;
}
this._properties.required=_c0;
if(this._labelElement){
if(_c0){
this._labelElement.domNode.className+=" pjRequired";
}else{
this._labelElement.domNode.className=this._labelElement.domNode.className.replace(/\bpjRequired\b/,"");
}
}
};
if(typeof Projapi=="undefined"){
var Projapi={};
}
if(typeof Projapi.Widgets=="undefined"){
Projapi.Widgets={};
}
Projapi.Widgets.PJField=function(_c1,_c2,_c3){
Projapi.Widgets.PJField.superclass.constructor.call(this,_c1,_c2);
this._dataFormat=null;
this._fieldNode=null;
this.DataSourceEvents=[Projapi.Links.Data.DataAvailable];
this._dataSource=null;
this._doColumnName=null;
this._actionSources=[];
this._actionTargets=[];
this.ActionSourceEvents=[Projapi.Links.Action.ValueChanged];
this._containerTargets=[];
this._label=null;
this._size=20;
this._viewAs="Textfield";
this._fieldRepr=null;
this._readOnly=false;
this._initialValue=null;
this._nodes={};
this._fkWindow=null;
this._fkToolbutton=null;
this._fkDO=null;
this._fkDOColumnName=null;
this._canFocus=true;
this._dataModified=false;
if(this._properties.mask&&!this._properties.format){
this._properties.format=this._properties.mask;
}
this._focusLostBound=this._focusLost.bindAsEventListener(this);
this._focusGainedBound=this._focusGained.bindAsEventListener(this);
};
Projapi.extend(Projapi.Widgets.PJField,Projapi.Base.iPJVisualObject);
Projapi.Widgets.PJField.prototype.ContainerSourceEvents=["createObjects"].concat(Projapi.Links.Container.SourceEvents);
Projapi.Widgets.PJField.prototype.addContainerTarget=function(_c4){
if(this._containerTargets.indexOf(_c4)>-1){
return;
}
this._containerTargets.push(_c4);
if(this._objectCreated&&!_c4._objectCreated){
_c4.createObjects();
}
if(this._objectInitialized&&!_c4._objectInitialized){
_c4.initializeObject();
}
this.addLink(Projapi.Links.Container,_c4);
};
Projapi.Widgets.PJField.prototype.removeContainerTarget=function(_c5){
var idx=this._containerTargets.indexOf(_c5);
if(idx>-1){
this._containerTargets.splice(idx,1);
}
};
Projapi.Widgets.PJField.prototype._processObjectProperties=function(){
Projapi.Widgets.PJField.superclass._processObjectProperties.call(this);
if(this.getProperty("doColumnName",true,true)){
this.setDOColumnName(this._properties.doColumnName||this._objectName);
}
if(this._properties.fkWindowName){
this.setFKWindow(this._properties.fkWindowName);
}
if(this._properties.required){
this._properties.required=false;
this.setRequired(true);
}
};
Projapi.Widgets.PJField.prototype._processVisualObjectProperties=function(){
Projapi.Widgets.PJField.superclass._processVisualObjectProperties.call(this);
this.setViewAs(this._properties.viewAs||"Textfield");
this.setReadOnly(this._properties.readOnly||false);
if(this._fieldRepr){
this._fieldRepr.paint();
}
if(this._properties.disable||this._properties.disableOnInit){
this.disableObject();
}
this.setSize(this._properties.size||20);
if(this._properties.value){
this.setObjectValue(this._properties.value);
}
if(this._properties.format){
this.setDataFormat(this._properties.format);
}
};
Projapi.Widgets.PJField.prototype.createObjects=function(){
this._processObjectProperties();
this._buildUI();
this._processVisualObjectProperties();
this._objectCreated=true;
this.publish(Projapi.Links.Container.CreateObjects);
};
Projapi.Widgets.PJField.prototype._buildUI=function(){
var _c7;
if(!this._domNode){
_c7=$("PJFieldCont_"+this._objectName);
if(_c7){
this.setDOMNode(Projapi.UI.Element.get(_c7));
}else{
_c7=document.createElement("span");
_c7.innerHTML="<span id=\"PJFieldCont_"+this._objectName+"\" class=\"pjField\" style=\"display:none\"><span class=\"pjFieldChooser\"></span><span class=\"pjFieldInfo\"></span></span>";
this.setDOMNode(new Projapi.UI.Element(_c7.firstChild));
}
this._nodes.chooser=new Projapi.UI.Element(this._domNode.domNode.firstChild);
this._nodes.info=new Projapi.UI.Element(this._domNode.domNode.lastChild);
}else{
this._domNode.domNode.style.display="none";
}
this._buildLabel();
if(this._containerSource){
this._containerSource.getLayoutManager(this._objectPage).add(this);
}
};
Projapi.Widgets.PJField.prototype._buildLabel=function(){
if(this._label||this._properties.label==null){
return;
}
var val,_c9={label:this._properties.label||"",align:this._properties.labelAlign||"right",valign:this._properties.labelVAlign||"",fieldId:this._objectName,objectPage:this._objectPage||0,required:!!this._properties.required};
if(val=(this._properties.labelLayoutRow||this._properties.layoutRow)){
_c9.layoutRow=val;
}
if(val=(this._properties.labelLayoutRowSpan||this._properties.layoutRowSpan)){
_c9.layoutRowSpan=val;
}
if(val=(this._properties.labelLayoutCol||(this._properties.layoutCol-1))){
_c9.layoutCol=val;
}
this._label=new Projapi.Widgets.PJLabel(this._properties.labelId||"pjlabel_"+this._objectName,_c9);
this._containerSource.addLink(Projapi.Links.Container.CreateObjects,this._label);
this._label.createObjects();
};
Projapi.Widgets.PJField.prototype.initializeObject=function(){
Projapi.Widgets.PJField.superclass.initializeObject.call(this);
this._objectInitialized=true;
this.setFKToolbutton(this._fkToolbutton);
if(this._properties.type=="date"){
var _ca={image:Projapi.Theme.PJDateSelectImage,disabledImage:Projapi.Theme.PJDateSelectImageDisabled,hooverImage:Projapi.Theme.PJDateSelectImageHoover,label:this.getProperty("fkToolButtonLabel","Choose Value",true),tooltip:this.getProperty("fkToolButtonTooltip","Choose Value",true)};
if(this._properties["fkToolbutton"]){
Object.extend(_ca,this._properties["fkToolbutton"]);
}
this.setFKToolbutton(new Projapi.Widgets.PJToolButton(this._objectName+"_fkChooser",_ca));
Projapi.Calendars.create(this._objectName,this._objectName+"_fkChooser",this._properties.format||"99-99-9999",this._properties.dateFormat||"dmy");
}
if(!this._properties.hideOnInit){
this.viewObject();
}
Projapi.ValidationManager.initialize(this);
Projapi.Controller.objectInit(this);
this.publish(Projapi.Links.Container.InitializeObject);
};
Projapi.Widgets.PJField.prototype.setDataFormat=function(_cb){
this._dataFormat=_cb;
if(this._fieldRepr&&this._fieldRepr.setDataFormat){
this._fieldRepr.setDataFormat(this._dataFormat);
}
};
Projapi.Widgets.PJField.prototype.getDataFormat=function(){
return this._dataFormat;
};
Projapi.Widgets.PJField.prototype.setObjectValue=function(_cc){
if(this._objectValue!=_cc){
Projapi.WarningManager.clearWarnings(this._windowName,this._objectName);
}
Projapi.Widgets.PJField.superclass.setObjectValue.call(this,_cc);
this._initialValue=_cc;
if(this._fieldRepr){
this._fieldRepr.setValue(_cc);
}
if(this._properties.valueOptionsDO&&this._properties.valueOptions[_cc]){
var _cd=this._properties.valueOptionsDO,col=this._properties.valueOptionsDOValueColumn;
if(_cd){
_cd=$P(_cd);
var idx=_cd._getDataObject()._findRowByColumn(col,_cc);
if(idx!=null&&idx!=_cd._properties.currentIndex){
if(_cd._publishingCursorMove){
_cd._properties.currentIndex=idx;
}else{
_cd._getDataObject().moveCursor(idx);
}
}
}
}
Projapi.Util.Trigger(this,"onObjectValue",[this,_cc]);
};
Projapi.Widgets.PJField.prototype.resetRecord=function(){
this.fireValueChanged(this._initialValue);
if(this._fieldRepr){
this._fieldRepr.setValue(this._initialValue);
}
Projapi.WarningManager.clearWarnings(this._windowName,this.getDOColumnName());
Projapi.WarningManager.clearWarnings(this._windowName,this._objectName);
};
Projapi.Widgets.PJField.prototype.enableObject=function(){
if(this.getProperty("disable",false,true)){
return;
}
this._objectEnabled=true;
if(this._fieldRepr){
this._fieldRepr.setEnabled(true);
}
if(this._fkToolbutton){
this._fkToolbutton.enableObject();
}
this._fieldsEnabled=true;
this._canFocus=true;
this.publish(Projapi.Links.Container.EnableObject);
};
Projapi.Widgets.PJField.prototype.disableObject=function(){
this._objectEnabled=false;
this._canFocus=false;
if(this._fieldRepr){
this._fieldRepr.setEnabled(false);
}
if(this._fkToolbutton){
this._fkToolbutton.disableObject();
}
this._fieldsEnabled=false;
this.publish(Projapi.Links.Container.DisableObject);
};
Projapi.Widgets.PJField.prototype.hideObject=function(){
if(this._fkToolbutton){
this._fkToolbutton.hideObject();
}
if(this._label){
this._label.hideObject();
}
Projapi.Widgets.PJField.superclass.hideObject.call(this);
this.publish(Projapi.Links.Container.HideObject);
};
Projapi.Widgets.PJField.prototype.viewObject=function(){
if(this._fkToolbutton){
this._fkToolbutton.viewObject();
}
if(this._label){
this._label.viewObject();
}
Projapi.Widgets.PJField.superclass.viewObject.call(this);
this.publish(Projapi.Links.Container.ViewObject);
};
Projapi.Widgets.PJField.prototype.applyEntry=function(){
if(this._fieldRepr){
this._fieldRepr.focus();
}
return this.hasFocus();
};
Projapi.Widgets.PJField.prototype.dataAvailable=function(_d0){
if(typeof _d0=="undefined"){
_d0=true;
}
if(!this.isObjectInitialized()||this._dataSource==null){
return;
}
var val=null;
if(this._viewAs=="Combofield"&&typeof this._fieldRepr._value=="string"){
val=this._fieldRepr._value;
}
if(this._properties.valueOptionsDO){
this.updateDOValueOptions();
}
if(val!=null&&this._properties.valueOptions[val]){
this.setObjectValue(val);
var _d2=this._properties.valueOptionsDO,col=this._properties.valueOptionsDOValueColumn;
if(_d2){
_d2=$P(_d2);
var idx=_d2._getDataObject()._findRowByColumn(col,val);
if(idx!=null&&idx!=_d2._properties.currentIndex){
if(_d2._publishingCursorMove){
_d2._properties.currentIndex=idx;
}else{
_d2._getDataObject().moveCursor(idx);
}
}
}
}else{
this.setObjectValue(this._dataSource.colValues([this.getDOColumnName()])[0]);
}
};
Projapi.Widgets.PJField.prototype.setDOColumnName=function(_d5){
this._doColumnName=_d5;
Projapi.Register.add(this,this._objectName,this.getDOColumnName(),this.getContainerSource());
};
Projapi.Widgets.PJField.prototype.getDOColumnName=function(){
return this._doColumnName||this._objectName;
};
Projapi.Widgets.PJField.prototype.getDataSource=function(){
return this._dataSource;
};
Projapi.Widgets.PJField.prototype.setDataSource=function(_d6){
if(_d6&&!this.getProperty("format",false,true)&&this.getProperty("doColumnName",false,true)){
var _d7=_d6.getColumnInfo(this.getProperty("doColumnName",null,true));
if(_d7&&_d7.format){
this.setProperty("format",_d7.format,true);
}
this.setDataFormat(this._properties.format);
}
return this._dataSource=_d6;
};
Projapi.Widgets.PJField.prototype.getSize=function(){
return this._size;
};
Projapi.Widgets.PJField.prototype.setSize=function(_d8){
this._size=_d8;
if(this._fieldRepr){
this._fieldRepr.setSize(_d8);
}
};
Projapi.Widgets.PJField.prototype.getViewAs=function(){
return this._viewAs;
};
Projapi.Widgets.PJField.prototype.setViewAs=function(_d9){
this._viewAs=_d9;
if(Projapi.Widgets.PJField.Views[_d9]){
if(this._fieldRepr){
this._fieldRepr.destroy();
}
this._fieldRepr=new Projapi.Widgets.PJField.Views[_d9](this,this._domNode);
if(this.isObjectInitialized()&&this._fieldRepr){
this._fieldRepr.paint();
}
}
};
Projapi.Widgets.PJField.prototype.isReadOnly=function(){
return this._readOnly;
};
Projapi.Widgets.PJField.prototype.setReadOnly=function(_da){
this._readOnly=_da;
if(this._fieldRepr){
this._fieldRepr.setReadOnly(_da);
}
};
Projapi.Widgets.PJField.prototype.isRequired=function(){
return this._properties.required||false;
};
Projapi.Widgets.PJField.prototype.setRequired=function(_db){
if(this._properties.required==_db){
return;
}
this._properties.required=_db;
if(_db){
if(this._fieldRepr){
this._fieldRepr.addClassName("pjRequired");
}
this.addValidator(new Projapi.Valid.EmptyField(this._objectName,{"id":"EmptyField","messageBundle":this._messageBundle}));
}else{
Projapi.WarningManager.clearWarnings(this._windowName,this._objectName);
if(this._fieldRepr){
this._fieldRepr.removeClassName("pjRequired");
}
this.removeValidator("EmptyField");
}
if(this._label){
this._label.setRequired(_db);
}
};
Projapi.Widgets.PJField.prototype.getValueOptions=function(){
var _dc=this._properties.valueOptions||null;
if(_dc==null){
if(this._properties.valueOptionsDO){
this.updateDOValueOptions(true);
_dc=this._properties.valueOptions||null;
}else{
_dc={};
}
}
return _dc;
};
Projapi.Widgets.PJField.prototype.setValueOptions=function(_dd){
this._properties.valueOptions=_dd;
if(this._fieldRepr){
this._fieldRepr.setValueOptions(_dd);
if(!this._objectValue){
this._objectValue=this._fieldRepr.getValue();
}
}
};
Projapi.Widgets.PJField.prototype.updateDOValueOptions=function(_de){
_de=_de||false;
var _df={};
if(this._properties.valueOptionsDO){
var dO,_e1,_e2,i;
dO=Projapi.Register.get(this._properties.valueOptionsDO);
_e1=dO.collectColumn(this._properties.valueOptionsDOValueColumn);
_e2;
if(this._properties.valueOptionsDONameColumn){
_e2=dO.collectColumn(this._properties.valueOptionsDONameColumn);
}else{
_e2=_e1;
}
for(i=0;i<_e1.length;i++){
_df[_e1[i]]=_e2[i];
}
}
this.setProperty("valueOptions",_df,_de);
};
Projapi.Widgets.PJField.prototype.setFKWindow=function(_e4){
if(typeof _e4=="string"&&Projapi.Register.get(_e4)){
_e4=Projapi.Register.get(_e4);
}
if(typeof _e4=="string"){
this._fkWindow=Projapi.Register.get(_e4);
if(!this._fkWindow&&this._properties.fkWindowURL){
if(!this._fkToolbutton){
var _e5={image:Projapi.Theme.PJSelectImage,disabledImage:Projapi.Theme.PJSelectImageDisabled,hooverImage:Projapi.Theme.PJSelectImageHoover,label:this._properties.fkToolButtonLabel||"Choose Value",tooltip:this._properties.fkToolButtonTooltip||"Choose Value",onClickExecute:"var c = Projapi.Register.get('"+this._objectName+"'); if( c.getFKWindow() ){ c.getFKWindow().addLink(Projapi.Links.Action, c); c.getFKWindow().viewObject();} else { Projapi.Controller.subscribe('"+_e4+"', Projapi.Links.Action,'"+this._objectName+"' ); Projapi.Util.EvalUrl('"+this.getProperty("fkWindowURL",null,true)+"'); }"};
if(this._properties["fkToolbutton"]){
Object.extend(_e5,this._properties["fkToolbutton"]);
}
this.setFKToolbutton(new Projapi.Widgets.PJToolButton(this._objectName+"_fkChooser",_e5));
this.getFKToolbutton()._windowName=this._windowName;
}
}
}else{
if(typeof _e4=="function"){
var _e5={image:Projapi.Theme.PJSelectImage,disabledImage:Projapi.Theme.PJSelectImageDisabled,hooverImage:Projapi.Theme.PJSelectImageHoover,label:this._properties.fkToolButtonLabel||"Choose Value",tooltip:this._properties.fkToolButtonTooltip||"Choose Value",onClickExecute:(function(){
this._fkWindow=_e4();
if(!this._fkWindow.isObjectCreated()){
this._fkWindow.createObjects();
}
if(!this._fkWindow.isObjectInitialized()){
this._fkWindow.initializeObject();
}
this._fkWindow.addLink(Projapi.Links.Action,this);
this._fkWindow.viewObject();
}).bind(this)};
if(this._properties["fkToolbutton"]){
Object.extend(_e5,this._properties["fkToolbutton"]);
}
this.setFKToolbutton(new Projapi.Widgets.PJToolButton(this._objectName+"_fkChooser",_e5));
this.getFKToolbutton()._windowName=this._windowName;
}else{
this._fkWindow=_e4;
if(!this._fkWindow.isObjectCreated()){
this._fkWindow.createObjects();
}
if(!this._fkWindow.isObjectInitialized()){
this._fkWindow.initializeObject();
}
if(this._fkWindow&&!this._fkToolbutton){
var _e5={image:Projapi.Theme.PJSelectImage,disabledImage:Projapi.Theme.PJSelectImageDisabled,hooverImage:Projapi.Theme.PJSelectImageHoover,label:this._properties.fkToolButtonLabel||"Choose Value",tooltip:this._properties.fkToolButtonTooltip||"Choose Value",onClickExecute:"var c = Projapi.Register.get('"+this._objectName+"'); if( c.getFKWindow() ){ c.getFKWindow().addLink(Projapi.Links.Action, c); c.getFKWindow().viewObject();}"};
if(this._properties["fkToolbutton"]){
Object.extend(_e5,this._properties["fkToolbutton"]);
}
this.setFKToolbutton(new Projapi.Widgets.PJToolButton(this._objectName+"_fkChooser",_e5));
this.getFKToolbutton()._windowName=this._windowName;
}
}
}
};
Projapi.Widgets.PJField.prototype.getFKWindow=function(){
if(!this._fkWindow&&this._properties.fkWindowName){
this._fkWindow=Projapi.Register.get(this._properties.fkWindowName);
if(!this._fkWindow){
return null;
}
if(!this._fkWindow.isObjectCreated()){
this._fkWindow.createObjects();
}
if(!this._fkWindow.isObjectInitialized()){
this._fkWindow.initializeObject();
}
}
this._sinchronizeFkDO();
return this._fkWindow;
};
Projapi.Widgets.PJField.prototype._sinchronizeFkDO=function(){
if(this._fkWindow&&(!this._fkDOColumnName||!this._fkDO)){
var res=this._fkWindow.getObjectsByType("SmartBrowse");
if(res&&res[0]&&res[0]._dataSource){
this._fkDO=res[0]._dataSource;
}
this._fkDOColumnName=this._properties.fkDOColumnName||null;
if(this._fkDOColumnName==null){
this._fkDOColumnName=this.getDOColumnName();
this.setProperty("fkDOColumnName",this._fkDOColumnName,true);
}
}
if(this._fkDO&&this._fkDOColumnName){
this._fkDO.selectRow(this._fkDOColumnName,this._objectValue);
}
};
Projapi.Widgets.PJField.prototype.setFKToolbutton=function(_e7){
if(!_e7){
this._fkToolbutton=null;
return;
}
this._fkToolbutton=_e7;
if(this.isObjectCreated()&&!_e7.isObjectCreated()){
_e7.setContainerSource(this._nodes.chooser);
_e7.createObjects();
}
if(this.isObjectInitialized()&&!_e7.isObjectInitialized()){
_e7.initializeObject();
}
if(this.isObjectEnabled()){
this._fkToolbutton.enableObject();
}else{
this._fkToolbutton.disableObject();
}
if(this._fkToolbutton&&!this._fkToolbutton._windowName){
this._fkToolbutton._windowName=this._windowName;
}
};
Projapi.Widgets.PJField.prototype.getFKToolbutton=function(){
return this._fkToolbutton;
};
Projapi.Widgets.PJField.prototype.fireValueChanged=function(_e8){
if(!this.isObjectEnabled()||!this._objectInitialized){
return;
}
Projapi.WarningManager.clearWarnings(this._windowName,this._objectName);
this._objectValue=_e8;
Projapi.Util.Trigger(this,"onValueChanged",[this,_e8]);
this.publish(Projapi.Links.Action.ValueChanged,this,_e8);
this._sinchronizeFkDO();
};
Projapi.Widgets.PJField.prototype.getObjectValue=function(){
if(this._fieldRepr&&this._fieldRepr.getValue()!=this._objectValue&&this._fieldRepr.getValue()!==null){
this.fireValueChanged(this._fieldRepr.getValue());
}
return this._objectValue;
};
Projapi.Widgets.PJField.prototype.valueChanged=function(_e9,_ea){
if(_ea){
if(this._initialValue!=_ea){
this.publish(Projapi.Links.Action.DataModified,this,true);
}else{
this.publish(Projapi.Links.Action.DataModified,this,false);
}
this._fieldRepr.setValue(_ea);
this.fireValueChanged(_ea);
}else{
if(_e9){
var val=_e9.getObjectValue();
if(this._initialValue!=_ea){
this.publish(Projapi.Links.Action.DataModified,this,true);
}else{
this.publish(Projapi.Links.Action.DataModified,this,false);
}
if(val!=this._fieldRepr.getValue()){
this._fieldRepr.setValue(val);
this.fireValueChanged(val);
}
}
}
this.validate();
if(this._fkWindow){
this._fkWindow.removeLink(Projapi.Links.Action,this);
}
};
Projapi.Widgets.PJField.prototype.addValidator=function(_ec){
if(_ec.RefObjectName=="GENERIC"){
_ec.RefObjectName=this._objectName;
}
Projapi.ValidationManager.add(_ec);
};
Projapi.Widgets.PJField.prototype.removeValidator=function(_ed,_ee){
Projapi.ValidationManager.remove(this._objectName,_ed,_ee);
};
Projapi.Widgets.PJField.prototype.getValidators=function(_ef){
return Projapi.ValidationManager.get(this._objectName,_ef);
};
Projapi.Widgets.PJField.prototype.getActionSource=function(){
return this._actionSources;
};
Projapi.Widgets.PJField.prototype.addActionSource=function(_f0){
this._actionSources.push(_f0);
};
Projapi.Widgets.PJField.prototype.removeActionSource=function(_f1){
var i=0;
while((this._actionSources[i]!=null)&&(this._actionSources[i]!=_f1)){
++i;
}
this._actionSources.splice(i,1);
};
Projapi.Widgets.PJField.prototype.getActionTarget=function(){
return this._actionTargets;
};
Projapi.Widgets.PJField.prototype.addActionTarget=function(_f3){
this._actionTargets.push(_f3);
};
Projapi.Widgets.PJField.prototype.removeActionTarget=function(_f4){
var i=0;
while((this._actionTargets[i]!=null)&&(this._actionTargets[i]!=_f4)){
++i;
}
this._actionTargets.splice(i,1);
};
Projapi.Widgets.PJField.prototype.getInfoElement=function(){
return this._nodes.info;
};
Projapi.Widgets.PJField.prototype.validate=function(){
return Projapi.ValidationManager.run(this);
};
Projapi.Widgets.PJField.prototype._focusLost=function(){
if(this.validate()){
this._hasFocus=false;
Projapi.Util.Trigger(this,"onFocusLost");
}
};
Projapi.Widgets.PJField.prototype._focusGained=function(){
this._hasFocus=true;
Projapi.Util.Trigger(this,"onApplyEntry");
Projapi.FocusManager.setFocusedObject(this);
};
Projapi.Widgets.PJField.prototype.destroyObject=function(){
this.publish(Projapi.Links.Container.DestroyObject);
if(this._label){
this._label.destroyObject();
}
if(this._fkToolbutton){
this._fkToolbutton.destroyObject();
}
Projapi.Widgets.PJField.superclass.destroyObject.call(this);
};
Projapi.Widgets.PJField.Views={};
Projapi.Widgets.PJField.Views.Textfield=function(_f6,_f7){
this._field=_f6;
this._contentElement=_f7;
this._fieldElement=null;
this._roDisplayElement=null;
this._readOnly=false;
this._mask=null;
this._value=null;
};
Projapi.Widgets.PJField.Views.Textfield.prototype={paint:function(){
this._field._canFocus=true;
this.destroy();
var _f8=Projapi.UI.Element.DOMfromString(["<input type=\"text\" name=\"",this._field.getDOColumnName(),"\" class=\"pjField",this._field._properties.required?" pjRequired":"","\" id=\"",this._field._objectName,"\" tabindex=\"",(this._field._properties.tabIndex||0),"\" title=\"",this._field.getTooltip(),"\" value=\"\" />"].join(""));
this._contentElement.domNode.insertBefore(_f8,this._contentElement.domNode.firstChild);
this._fieldElement=new Projapi.UI.Element(_f8);
if(this._field.getFKToolbutton()){
Event.observe(_f8,"keydown",this.handleKeyEvents.bindAsEventListener(this));
}
if(this._readOnly){
this._roDisplayElement=Projapi.UI.Element.DOMfromString("<span class=\"pjFieldValue\">"+this._field.getObjectValue()+"</span>");
this._contentElement.domNode.insertBefore(this._roDisplayElement,_f8.nextSibling);
this._roDisplayElement=new Projapi.UI.Element(this._roDisplayElement);
this._field._canFocus=false;
}else{
var _f9=this;
Event.observe(_f8,"blur",this.valueChanged.bindAsEventListener(this));
Event.observe(_f8,"keyup",this.dataModified.bindAsEventListener(this));
Event.observe(_f8,"blur",this._field._focusLostBound);
Event.observe(_f8,"focus",this._field._focusGainedBound);
}
this.setSize(this._field._size);
},handleKeyEvents:function(_fa){
if(_fa.keyCode==Event.KEY_DOWN&&this._field.getFKToolbutton()&&this._field._containerTargets.length==0){
this._field.getFKToolbutton().click();
}
},setDataFormat:function(_fb){
if(_fb&&this._field._properties.type){
var _fc=this._field._properties.type;
if(_fc=="integer"){
_fc="decimal";
}
this._mask=new Mask(this._fieldElement.domNode,_fb,_fc,this._field._properties.dateFormat||undefined);
}
},setValueOptions:function(_fd){
},focus:function(){
try{
this._fieldElement.domNode.focus();
this._field._hasFocus=true;
}
catch(e){
}
},setValue:function(_fe){
this._value=_fe==null?"":_fe;
this._fieldElement.domNode.value=this._value;
if(this._readOnly){
this._roDisplayElement.domNode.innerHTML=this._value;
}
this._field._dataModified=false;
},isValueChanged:function(){
if(this._fieldElement){
return this._fieldElement.domNode.value!=this._value;
}
return false;
},getValue:function(){
if(!this._fieldElement){
return null;
}
return this._fieldElement.domNode.value;
},setEnabled:function(_ff){
if(_ff){
this._fieldElement.domNode.disabled=false;
this.removeClassName("disabled");
}else{
this._fieldElement.domNode.disabled=true;
this.addClassName("disabled");
}
},setReadOnly:function(_100){
if(this._readOnly!=_100){
this._readOnly=_100;
if(this._field.isObjectInitialized()){
this.destroy();
this.paint();
}
}
},setSize:function(_101){
this._fieldElement.domNode.size=_101;
},destroy:function(){
if(!this._fieldElement||!this._fieldElement.domNode){
return;
}
Event.stopObserving(this._fieldElement.domNode,"change",this.valueChanged);
this._fieldElement.domNode.onchange=null;
this._contentElement.domNode.removeChild(this._fieldElement.domNode);
if(this._roDisplayElement){
this._contentElement.domNode.removeChild(this._roDisplayElement);
}
},valueChanged:function(e){
if(this.isValueChanged()){
this._field.fireValueChanged(Event.element(e).value);
}
},dataModified:function(e){
if(this.isValueChanged()){
if(!this._field._dataModified){
this._field._dataModified=true;
this._field.publish(Projapi.Links.Action.DataModified,this._field,true);
}
}else{
if(this._field._dataModified){
this._field._dataModified=false;
this._field.publish(Projapi.Links.Action.DataModified,this._field,false);
}
}
},addClassName:function(_104){
if(this._fieldElement&&!this._fieldElement.domNode.className.match(new RegExp("\\b"+_104+"\\b"))){
this._fieldElement.domNode.className+=" "+_104;
}
},removeClassName:function(_105){
if(this._fieldElement&&this._fieldElement.domNode.className.match(new RegExp("\\b"+_105+"\\b"))){
this._fieldElement.domNode.className=this._fieldElement.domNode.className.replace(new RegExp("\\b"+_105+"\\b","g"),"");
}
}};
Projapi.Widgets.PJField.Views.Hiddenfield=function(_106,_107){
this._field=_106;
this._contentElement=_107;
this._fieldElement=null;
this._roDisplayElement=null;
this._readOnly=false;
this._mask=null;
this._value=null;
};
Projapi.Widgets.PJField.Views.Hiddenfield.prototype={paint:function(){
this._field._canFocus=false;
this.destroy();
var _108=Projapi.UI.Element.DOMfromString("<input type=\"hidden\" name=\""+this._field.getDOColumnName()+"\" class=\"pjField\" id=\""+this._field._objectName+"\" value=\"\"/>");
this._contentElement.domNode.insertBefore(_108,this._contentElement.domNode.firstChild);
this._fieldElement=new Projapi.UI.Element(_108);
this._field._properties.hide=true;
},setDataFormat:function(_109){
},setValueOptions:function(_10a){
},focus:function(){
},setValue:function(_10b){
this._value=_10b==null?"":_10b;
this._fieldElement.domNode.value=this._value;
this._field._dataModified=false;
},isValueChanged:function(){
if(this._fieldElement){
return this._fieldElement.domNode.value!=this._value;
}
return false;
},getValue:function(){
if(!this._fieldElement){
return null;
}
return this._fieldElement.domNode.value;
},setEnabled:function(_10c){
if(_10c){
this._fieldElement.domNode.disabled=false;
}else{
this._fieldElement.domNode.disabled=true;
}
},setReadOnly:function(_10d){
},setSize:function(_10e){
},destroy:function(){
if(!this._fieldElement||!this._fieldElement.domNode){
return;
}
},valueChanged:function(e){
},dataModified:function(e){
if(this.isValueChanged()){
if(!this._field._dataModified){
this._field._dataModified=true;
this._field.publish(Projapi.Links.Action.DataModified,this._field,true);
}
}else{
if(this._field._dataModified){
this._field._dataModified=false;
this._field.publish(Projapi.Links.Action.DataModified,this._field,false);
}
}
},addClassName:function(_111){
},removeClassName:function(_112){
}};
Projapi.Widgets.PJField.Views.Passwordfield=function(_113,_114){
this._field=_113;
this._contentElement=_114;
this._fieldElement=null;
this._roDisplayElement=null;
this._readOnly=false;
this._value=null;
};
Projapi.Widgets.PJField.Views.Passwordfield.prototype={paint:function(){
this.destroy();
var _115=Projapi.UI.Element.DOMfromString(["<input name=\"",this._field.getDOColumnName(),"\" type=\"password\" class=\"pjField",this._field._properties.required?" pjRequired":"","\" id=\"",this._field._objectName,"\" value=\"",(this._field.getObjectValue()||""),"\" tabindex=\"",(this._field._properties.tabIndex||0),"\" title=\"",this._field.getTooltip(),"\" />"].join(""));
Event.observe(_115,"blur",this.valueChanged.bindAsEventListener(this));
Event.observe(_115,"keyup",this.dataModified.bindAsEventListener(this));
Event.observe(_115,"blur",this._field._focusLostBound);
Event.observe(_115,"focus",this._field._focusGainedBound);
this._contentElement.domNode.insertBefore(_115,this._contentElement.domNode.firstChild);
this._fieldElement=new Projapi.UI.Element(_115);
this.setSize(this._field._size);
},setValueOptions:function(_116){
},setValue:function(_117){
this._value=_117==null?"":_117;
this._fieldElement.domNode.value=this._value;
if(this._readOnly){
this._roDisplayElement.domNode.innerHTML=this._value;
}
this._field._dataModified=false;
},getValue:function(){
if(!this._fieldElement){
return null;
}
return this._fieldElement.domNode.value;
},focus:function(){
try{
this._fieldElement.domNode.focus();
}
catch(e){
}
},setEnabled:function(_118){
if(_118){
this._fieldElement.domNode.disabled=false;
this.removeClassName("disabled");
}else{
this._fieldElement.domNode.disabled=true;
this.addClassName("disabled");
}
},setReadOnly:function(_119){
},setSize:function(_11a){
this._fieldElement.domNode.size=_11a;
if(this._fieldElement.domNode.maxLength){
this._fieldElement.domNode.maxLength=_11a;
}
},destroy:function(){
if(!this._fieldElement||!this._fieldElement.domNode){
return;
}
Event.stopObserving(this._fieldElement.domNode,"change",this.valueChanged);
this._fieldElement.domNode.onchange=null;
this._contentElement.domNode.removeChild(this._fieldElement.domNode);
},isValueChanged:function(){
if(this._fieldElement){
return this._fieldElement.domNode.value!=this._value;
}
return false;
},valueChanged:function(e){
if(this.isValueChanged()){
this._field.fireValueChanged(Event.element(e).value);
}
},dataModified:function(e){
if(this.isValueChanged()){
if(!this._field._dataModified){
this._field._dataModified=true;
this._field.publish(Projapi.Links.Action.DataModified,this._field,true);
}
}else{
if(this._field._dataModified){
this._field._dataModified=false;
this._field.publish(Projapi.Links.Action.DataModified,this._field,false);
}
}
},addClassName:function(_11d){
if(this._fieldElement&&this._fieldElement.domNode.className.match(new RegExp("\\b"+_11d+"\\b"))){
this._fieldElement.domNode.className+=" "+_11d;
}
},removeClassName:function(_11e){
if(this._fieldElement&&this._fieldElement.domNode.className.match(new RegExp("\\b"+_11e+"\\b"))){
this._fieldElement.domNode.className=this._fieldElement.domNode.className.replace(new RegExp("\\b"+_11e+"\\b","g"),"");
}
}};
Projapi.Widgets.PJField.Views.Radiofield=function(_11f,_120){
this._field=_11f;
this._contentElement=_120;
this._fieldElements=[];
this._roDisplayElement=null;
this._readOnly=false;
this._valueOptions=$H(_11f.getValueOptions());
};
Projapi.Widgets.PJField.Views.Radiofield.prototype={paint:function(){
var _121,_122,_idx,_len,_125,_126,_127;
this.destroy();
_125=this._valueOptions.keys();
var _128=this._valueOptions.values();
_127=this._field.getObjectValue();
_121=[];
for(_idx=0,_len=_125.length;_idx<_len;_idx++){
_121.push("<input name=\"");
_121.push(this._field.getDOColumnName());
_121.push("\" type=\"radio\" class=\"pjField\" value=\"");
_121.push(_125[_idx]);
_121.push("\" tabindex=\"");
_121.push(this._field._properties.tabIndex||0);
_121.push("\" title=\"");
_121.push(this._field.getTooltip());
if(_127==_125[_idx]){
_121.push("\" checked=\"checked");
}
_121.push("\" />");
_121.push("<span class=\"pjFieldLabel\">");
_121.push(_128[_idx]||_125[_idx]);
_121.push("</span>");
_121.push("<br />");
}
_122=document.createElement("div");
_122.innerHTML=_121.join("");
for(_idx=_125.length-1;_idx>=0;_idx--){
_121=new Projapi.UI.Element(_122.childNodes[_idx*3]);
_121.domNode.defaultChecked=(_127==_125[_idx]);
this._contentElement.domNode.insertBefore(_121.domNode,this._contentElement.domNode.childNodes[this._contentElement.domNode.childNodes.length-2]);
this._contentElement.domNode.insertBefore(_122.childNodes[_idx*3],_121.domNode.nextSibling);
if(this._field._properties.horizontal){
this._contentElement.domNode.insertBefore(_122.childNodes[_idx*3],_121.domNode.nextSibling.nextSibling);
}
_121.domNode.onchange=this.valueChanged.bindAsEventListener(this);
this._fieldElements.push(_121);
}
this._field._canFocus=true;
Event.observe(this._fieldElements[_len-1].domNode,"blur",this._field._focusLostBound);
Event.observe(this._fieldElements[0].domNode,"focus",this._field._focusGainedBound);
if(this._readOnly){
this._roDisplayElement=Projapi.UI.Element.DOMfromString("<span class=\"pjFieldValue\">"+this._field.getObjectValue()+"</span>");
this._contentElement.domNode.insertBefore(this._roDisplayElement,this._contentElement.domNode.childNodes[this._contentElement.domNode.childNodes.length-2]);
this._roDisplayElement=Projapi.UI.Element.get(this._roDisplayElement);
this._field._canFocus=false;
}
if(!this._field._objectValue){
this._field._objectValue=this.getValue();
}
},setValueOptions:function(_129){
this._valueOptions=$H(_129);
},setValue:function(_12a){
var _idx,_len,_12d,_12e;
_12a=""+_12a;
_12d=this._valueOptions.keys();
_12e=this._valueOptions.values();
for(_idx=0,_len=this._fieldElements.length;_idx<_len;_idx++){
this._fieldElements[_idx].domNode.checked=(this._fieldElements[_idx].domNode.value==_12a||this._fieldElements[_idx].domNode.innerHTML==_12a);
}
},getValue:function(){
var _idx,_len,_131;
_131=this._valueOptions.keys();
for(_idx=0,_len=_131.length;_idx<_len;_idx++){
if(this._fieldElements[_idx]&&this._fieldElements[_idx].domNode.checked){
return this._fieldElements[_idx].domNode.value;
}
}
return null;
},focus:function(){
try{
this._fieldElements[0].domNode.focus();
}
catch(e){
}
},setEnabled:function(_132){
for(var _idx=0,_len=this._fieldElements.length;_idx<_len;_idx++){
if(this._fieldElements[_idx]){
if(_132){
this._fieldElements[_idx].domNode.disabled=false;
this._fieldElements[_idx].removeClassName("disabled");
}else{
this._fieldElements[_idx].domNode.disabled=true;
this._fieldElements[_idx].addClassName("disabled");
}
}
}
},setReadOnly:function(_135){
if(this._readOnly!=_135){
this._readOnly=_135;
if(this._field.isObjectInitialized()){
this.destroy();
this.paint();
}
}
},setSize:function(_136){
},destroy:function(){
var _idx,_len;
for(_len=this._fieldElements.length-1;_len>=0;_len--){
Event.stopObserving(this._fieldElements[_len].domNode,"change",this.valueChanged);
this._fieldElements[_len].domNode.onchange=null;
this._fieldElements.splice(_len,1);
}
while(this._contentElement.domNode.childNodes.length>2){
this._contentElement.domNode.removeChild(this._contentElement.domNode.firstChild);
}
},isValueChanged:function(e){
var elem=typeof e!="undefined"?Event.element(e):null;
if(elem){
return elem.value!=this._field._initialValue;
}else{
return this.getValue()!=this._field._initialValue;
}
},valueChanged:function(e){
if(this.isValueChanged(e)){
this._field._dataModified=true;
this._field.publish(Projapi.Links.Action.DataModified,this._field,true);
}else{
this._field._dataModified=false;
this._field.publish(Projapi.Links.Action.DataModified,this._field,false);
}
this._field.fireValueChanged(Event.element(e).value);
},addClassName:function(_13c){
},removeClassName:function(_13d){
}};
Projapi.Widgets.PJField.Views.Combofield=function(_13e,_13f){
this._field=_13e;
this._contentElement=_13f;
this._fieldElement=null;
this._mask=null;
this._readOnly=false;
this._valueOptions=null;
this._value=null;
};
Projapi.Widgets.PJField.Views.Combofield.prototype={paint:function(){
this.valueChangedBound=this.valueChanged.bindAsEventListener(this);
this.setValue(this._field.getObjectValue());
this._fieldElement=true;
this.setValueOptions(this._field.getValueOptions());
if(!this._field._objectValue){
this._field._objectValue=this.getValue();
}
},setValueOptions:function(_140){
this._valueOptions=$H(_140);
if(this._fieldElement){
var idx,len,keys=this._valueOptions.keys(),_144=this._valueOptions.values();
var cls=this._fieldElement.domNode&&this._fieldElement.domNode.className||("pjField"+(this._field._properties.required?" pjRequired":""));
var dis=this._fieldElement.domNode&&this._fieldElement.domNode.disabled;
var txt=["<select name=\"",this._field.getDOColumnName(),"\" id=\"",this._field._objectName,"\" class=\"",cls,"\" tabindex=\"",this._field._properties.tabIndex||0,"\" title=\"",this._field.getTooltip(),"\" value=\"",this._value];
if(dis){
txt.push("\" disabled=\"disabled");
}
txt.push("\">");
for(idx=0,len=keys.length;idx<len;idx++){
txt.push("<option value=\"");
txt.push(keys[idx]);
txt.push("\">");
txt.push(_144[idx]);
txt.push("</option>");
}
txt.push("</select>");
if(this._fieldElement.domNode){
this._fieldElement.domNode.parentNode.removeChild(this._fieldElement.domNode);
}
this._fieldElement=Projapi.UI.Element.fromString(txt.join(""));
this._contentElement.domNode.insertBefore(this._fieldElement.domNode,this._contentElement.domNode.firstChild);
Event.observe(this._fieldElement.domNode,"blur",this._field._focusLostBound);
Event.observe(this._fieldElement.domNode,"focus",this._field._focusGainedBound);
Event.observe(this._fieldElement.domNode,"change",this.valueChangedBound);
}
},focus:function(){
try{
this._fieldElement.domNode.focus();
}
catch(e){
}
},setValue:function(_148){
this._value=_148==null?"":""+_148;
if(this._fieldElement){
this._fieldElement.domNode.value=this._value;
}
this._field._dataModified=false;
},getValue:function(){
if(!this._fieldElement){
return null;
}
return this._fieldElement.domNode.value;
},setEnabled:function(_149){
if(_149){
this._fieldElement.domNode.disabled=false;
this.removeClassName("disabled");
}else{
this._fieldElement.domNode.disabled=true;
this.addClassName("disabled");
}
},setReadOnly:function(_14a){
this._readOnly=_14a;
if(!this._fieldElement){
return;
}
if(_14a){
this._fieldElement.domNode.readOnly="readOnly";
}else{
delete this._fieldElement.domNode.readOnly;
}
},setSize:function(_14b){
this._fieldElement.domNode.size=_14b;
},destroy:function(){
if(!this._fieldElement||!this._fieldElement.domNode){
return;
}
Event.stopObserving(this._fieldElement.domNode,"change",this.valueChanged);
this._fieldElement.domNode.onchange=null;
this._contentElement.domNode.removeChild(this._fieldElement.domNode);
},isValueChanged:function(){
if(this._fieldElement&&this._field.isObjectEnabled()){
return this._fieldElement.domNode.value!=this._value;
}
return false;
},valueChanged:function(e){
if(this.isValueChanged()){
if(!this._field._dataModified){
this._field._dataModified=true;
this._field.publish(Projapi.Links.Action.DataModified,this._field,true);
}
this._value=Event.element(e).value;
var _14d=this._field._properties,vOdO=_14d.valueOptionsDO,col=_14d.valueOptionsDOValueColumn;
if(vOdO){
$P(vOdO).selectRow(col,this._value);
}
this._field.fireValueChanged(this._value);
}else{
if(this._field._dataModified){
this._field._dataModified=false;
this._field.publish(Projapi.Links.Action.DataModified,this._field,false);
}
}
},addClassName:function(_150){
if(this._fieldElement&&!this._fieldElement.domNode.className.match(new RegExp("\\b"+_150+"\\b"))){
this._fieldElement.domNode.className+=" "+_150;
}
},removeClassName:function(_151){
if(this._fieldElement&&this._fieldElement.domNode.className.match(new RegExp("\\b"+_151+"\\b"))){
this._fieldElement.domNode.className=this._fieldElement.domNode.className.replace(new RegExp("\\b"+_151+"\\b","g"),"");
}
}};
Projapi.Widgets.PJField.Views.Togglebox=function(_152,_153){
this._field=_152;
this._contentElement=_153;
this._fieldElement=null;
this._checked=null;
this._format=[true,false];
};
Projapi.Widgets.PJField.Views.Togglebox.prototype={paint:function(){
this._field._canFocus=true;
this.destroy();
var _154=Projapi.UI.CreateFormElement("input",this._field.getDOColumnName(),"checkbox");
_154.className="pjField"+(this._field._properties.required?" pjRequired":"");
_154.id=this._field._objectName;
_154.tabIndex=this._field.getProperty("tabIndex",0,true);
_154.title=this._field.getTooltip();
this._contentElement.domNode.insertBefore(_154,this._contentElement.domNode.firstChild);
this._fieldElement=Projapi.UI.Element.get(_154);
var _155=this;
Event.observe(_154,"blur",this._field._focusLost.bindAsEventListener(this._field));
Event.observe(_154,"focus",this._field._focusGained.bindAsEventListener(this._field));
Event.observe(_154,"change",this.valueChanged.bindAsEventListener(this));
},setDataFormat:function(_156){
if(!_156){
this._format=[true,false];
return;
}
var _157=_156.indexOf("/");
if(_157!=-1){
this._format[0]=_156.substring(0,_157);
if(_157<_156.length-1){
this._format[1]=_156.substring(_157+1);
}
}
},setValueOptions:function(_158){
},focus:function(){
try{
this._fieldElement.domNode.focus();
this._field._hasFocus=true;
}
catch(e){
}
},setValue:function(_159){
if(!this._fieldElement){
return;
}
_159=""+_159;
if(_159==this._format[0]||_159==""+this._format[0]){
this._fieldElement.domNode.checked=true;
}else{
this._fieldElement.domNode.checked=false;
}
this._checked=this._fieldElement.domNode.checked;
},getValue:function(){
if(!this._fieldElement){
return null;
}
if(this._fieldElement.domNode.checked){
return this._format[0];
}else{
return this._format[1];
}
},setEnabled:function(_15a){
if(_15a){
this._fieldElement.domNode.disabled=false;
this.removeClassName("disabled");
}else{
this._fieldElement.domNode.disabled=true;
this.addClassName("disabled");
}
},setReadOnly:function(_15b){
},setSize:function(_15c){
},destroy:function(){
if(!this._fieldElement||!this._fieldElement.domNode){
return;
}
Event.stopObserving(this._fieldElement.domNode,"change",this.valueChanged);
this._fieldElement.domNode.onchange=null;
this._contentElement.domNode.removeChild(this._fieldElement.domNode);
},valueChanged:function(e){
if(this._fieldElement.domNode.checked!=this._checked){
if(!this._field._dataModified){
this._field._dataModified=true;
this._field.publish(Projapi.Links.Action.DataModified,this._field,true);
}
this._field.fireValueChanged(Event.element(e).value);
}else{
if(this._field._dataModified){
this._field._dataModified=false;
this._field.publish(Projapi.Links.Action.DataModified,this._field,false);
}
}
this._checked=this._fieldElement.domNode.checked;
},addClassName:function(_15e){
if(this._fieldElement&&!this._fieldElement.domNode.className.match(new RegExp("\\b"+_15e+"\\b"))){
this._fieldElement.domNode.className+=" "+_15e;
}
},removeClassName:function(_15f){
if(this._fieldElement&&this._fieldElement.domNode.className.match(new RegExp("\\b"+_15f+"\\b"))){
this._fieldElement.domNode.className=this._fieldElement.domNode.className.reaplce(new RegExp("\\b"+_15f+"\\b","g"),"");
}
}};
Projapi.Widgets.PJField.Views.Textarea=function(_160,_161){
this._field=_160;
this._contentElement=_161;
this._fieldElement=null;
this._roDisplayElement=null;
this._readOnly=false;
this._value=null;
};
Projapi.Widgets.PJField.Views.Textarea.prototype={paint:function(){
this.destroy();
var _162=Projapi.UI.CreateFormElement("textarea",this._field.getDOColumnName());
_162.className="pjField"+(this._field._properties.required?" pjRequired":"");
_162.id=this._field._objectName;
_162.tabIndex=this._field.getProperty("tabIndex",0,true);
_162.rows=this._field.getProperty("rows",2,true);
_162.cols=this._field.getSize();
Event.observe(_162,"blur",this.valueChanged.bindAsEventListener(this));
Event.observe(_162,"keyup",this.dataModified.bindAsEventListener(this));
Event.observe(_162,"blur",this._field._focusLost.bindAsEventListener(this._field));
Event.observe(_162,"focus",this._field._focusGained.bindAsEventListener(this._field));
this._contentElement.domNode.insertBefore(_162,this._contentElement.domNode.firstChild);
this._fieldElement=Projapi.UI.Element.get(_162);
this.setValue(this._field.getObjectValue());
},setValueOptions:function(_163){
},setValue:function(_164){
this._value=_164==null?"":_164;
this._fieldElement.domNode.value=this._value;
if(this._readOnly){
this._roDisplayElement.domNode.innerHTML=this._value;
}
this._field._dataModified=false;
},getValue:function(){
if(!this._fieldElement){
return null;
}
return this._fieldElement.domNode.value;
},focus:function(){
try{
this._fieldElement.domNode.focus();
}
catch(e){
}
},setEnabled:function(_165){
if(_165){
this._fieldElement.domNode.disabled=false;
this.removeClassName("disabled");
}else{
this._fieldElement.domNode.disabled=true;
this.addClassName("disabled");
}
},setReadOnly:function(_166){
},setSize:function(_167){
this._fieldElement.domNode.cols=_167;
},destroy:function(){
if(!this._fieldElement||!this._fieldElement.domNode){
return;
}
Event.stopObserving(this._fieldElement.domNode,"change",this.valueChanged);
this._fieldElement.domNode.onchange=null;
this._contentElement.domNode.removeChild(this._fieldElement.domNode);
},isValueChanged:function(){
if(this._fieldElement){
return this._fieldElement.domNode.value!=this._value;
}
return false;
},valueChanged:function(e){
if(this.isValueChanged()){
this._field.fireValueChanged(Event.element(e).value);
}
},dataModified:function(e){
if(this.isValueChanged()){
if(!this._field._dataModified){
this._field._dataModified=true;
this._field.publish(Projapi.Links.Action.DataModified,this._field,true);
}
}else{
if(this._field._dataModified){
this._field._dataModified=false;
this._field.publish(Projapi.Links.Action.DataModified,this._field,false);
}
}
},addClassName:function(_16a){
if(this._fieldElement&&!this._fieldElement.domNode.className.match(new RegExp("\\b"+_16a+"\\b"))){
this._fieldElement.domNode.className+=" "+_16a;
}
},removeClassName:function(_16b){
if(this._fieldElement&&this._fieldElement.domNode.className.match(new RegExp("\\b"+_16b+"\\b"))){
this._fieldElement.domNode.className=this._fieldElement.domNode.className.replace(new RegExp("\\b"+_16b+"\\b","g"),"");
}
}};
Projapi.Base.Hotkey=function(_16c,_16d,_16e,_16f){
if(typeof (_16c)=="object"&&_16c.keyCode){
this.keyCode=_16c.keyCode;
this.ctrlKey=_16c.ctrlKey;
this.altKey=_16c.altKey;
this.shiftKey=_16c.shiftKey;
}else{
if(typeof (_16c)=="string"){
_16c=_16c.toUpperCase();
if(_16c.indexOf("CTRL+")>-1){
_16d=true;
}
if(_16c.indexOf("ALT+")>-1){
_16e=true;
}
if(_16c.indexOf("SHIFT+")>-1){
_16f=true;
}
_16c=_16c.replace(/CTRL\+/g,"").replace(/ALT\+/g,"").replace(/SHIFT\+/g,"");
if(_16c.length>1){
_16c=parseInt(_16c);
}
}
this.keyCode=_16c;
this.ctrlKey=(_16d)?true:false;
this.altKey=(_16e)?true:false;
this.shiftKey=(_16f)?true:false;
}
};
Projapi.Base.Hotkey.prototype.equals=function(_170){
return this.keyCode==_170.keyCode&&this.ctrlKey==_170.ctrlKey&&this.altKey==_170.altKey&&this.shiftKey==_170.shiftKey;
};
Projapi.Base.Hotkey.prototype.toString=function(){
if(this.readableKey){
return this.readableKey;
}
var i,item;
if(Projapi.Base.HotkeyHandler.keyCodeTable[this.keyCode]){
for(i in Projapi.Base.HotkeyHandler.keyCodeTable[this.keyCode]){
item=Projapi.Base.HotkeyHandler.keyCodeTable[this.keyCode][i];
if(Projapi.Base.HotkeyHandler.charCodeTable[item]&&this.equals(Projapi.Base.HotkeyHandler.charCodeTable[item])){
return item;
}
}
}
var s="";
if(this.ctrlKey){
s+="Ctrl+";
}
if(this.altKey){
s+="Alt+";
}
if(this.shiftKey){
s+="Shift+";
}
s+=this.keyCode;
return s;
};
if(typeof Projapi=="undefined"){
Projapi={};
}
if(!Projapi.Base){
Projapi.Base={};
}
Projapi.Base.HotkeyHandler=function(_174){
this.contexts=[];
if(_174.topLevel){
this.registerContext(this.topLevel=_174.topLevel);
}
this._ovr=null;
this._removeOverlay=this.__removeOverlay.bind(this);
this._activeModifiers={shift:false,ctrl:false,alt:false};
this._listedShortcuts=[];
};
Projapi.Base.HotkeyHandler.prototype.registerContext=function(_175){
if(_175.hotkeyContext){
return;
}
var _176,_177=this;
this.contexts.push(_176={object:_175});
_175.hotkeyContext=_176;
Event.observe(_175,"keydown",function(_178){
return _177.dispatch(_178||window.event,_176);
},false);
if(_175==this.topLevel){
this.addAccessKey(_175,new Projapi.Base.Hotkey(192,false,true,false),this.showHelp.bind(this),"Show hotkeys","Alt+`");
Event.observe(_175,"keydown",function(_179){
var key=_179.keyCode||_179.charCode;
if(key>=16&&key<=18){
this.setModifierForOvr(key,true);
Event.stop(_179);
return false;
}
}.bind(this),false);
Event.observe(_175,"keyup",function(_17b){
var key=_17b.keyCode||_17b.charCode;
if(key>=16&&key<=18){
this.setModifierForOvr(key,false);
Event.stop(_17b);
return false;
}
}.bind(this),false);
}
};
Projapi.Base.HotkeyHandler.prototype.isContext=function(_17d){
return _17d.hotkeyContext||null;
};
Projapi.Base.HotkeyHandler.prototype.findContext=function(_17e){
var f,_180;
while(_17e){
if(_180=_17e.hotkeyContext){
return _180;
}
_17e=_17e.parentNode;
}
return null;
};
Projapi.Base.HotkeyHandler.prototype.findFreeContext=function(_181,_182){
var f,_184,_185=[],obj,_187;
if(_181 instanceof Projapi.Base.iPJSmartObject){
obj=_181;
_187=-1;
while(obj){
if(obj._pageNode&&obj._pageNode[_187]&&obj._pageNode[_187].domNode.hotkeyContext){
_185.push(obj._pageNode[_187].domNode.hotkeyContext);
}
if(obj._domNode&&obj._domNode.domNode.hotkeyContext){
_185.push(obj._domNode.domNode.hotkeyContext);
}
_187=obj._objectPage;
obj=obj._containerSource;
}
if(this.topLevel&&_185.length==0||!_185.last().object==this.topLevel){
_185.push(this.topLevel.hotkeyContext);
}
}else{
while(_181){
if(_181.hotkeyContext){
_185.push(_181.hotkeyContext);
}
_181=_181.parentNode;
}
}
if(_185.length>1&&_185.last().object==this.topLevel){
_185.pop();
}
if(_185.length>1&&_185.last().object.className.match(/\bdialog\b/)){
_185.pop();
}
var i,idx=_185.length,_18a;
while(idx>0){
idx--;
_184=_185[idx];
if(!_184[_182.keyCode]){
return _184;
}
_18a=false;
var vec=_184[_182.keyCode];
for(i=0;i<vec.length;i++){
if(vec[i].equals(_182)){
_18a=true;
break;
}
}
if(!_18a){
return _184;
}
}
console.error("No context %o found for key %o",_181,_182);
return null;
};
Projapi.Base.HotkeyHandler.prototype.addAccessKey=function(_18c,key,_18e,_18f,_190){
if(!this.topLevel){
this.registerContext(this.topLevel=document.body);
var top=this.contexts.last();
this.contexts.pop();
this.contexts.splice(0,0,top);
}
var _192=_18c;
if(_192.domNode){
_192=_192.domNode;
}
if(!typeof (_18e)=="function"&&!typeof (_18e)=="string"){
throw new Error("An invalid action ["+_18e+"] has been sent to [Projapi.Base.HotkeyHandler.addAccessKey].");
}
if(typeof (_18f)=="object"){
flags=_18f;
_18f=null;
}
if(typeof (key)=="string"){
key=key.toUpperCase();
if(key.length==0){
throw new Error("Empty string sent instead of key to [Projapi.Base.HotkeyHandler.addAccessKey].");
}else{
if(/^((CTRL\+)|(ALT\+)|(SHIFT\+))*[0-9A-z]$/.test(key)){
key=new Projapi.Base.Hotkey(key);
}else{
if(/^\d+$/.test(key)){
key=new Projapi.Base.Hotkey(parseInt(key));
}else{
if(Projapi.Base.HotkeyHandler.charCodeTable[key]){
key=new Projapi.Base.Hotkey(Projapi.Base.HotkeyHandler.charCodeTable[key]);
}
}
}
}
}
if(!key.keyCode){
throw new Error("An invalid key ["+key+"] has been sent to [Projapi.Base.HotkeyHandler.addAccessKey].");
}
var _193=this.findFreeContext(_192,key);
if(_18e){
key.action=_18e;
}
if(_18f&&(typeof (_18f)!="string"||_18f.length>0)){
key.description=_18f;
}
if(_190){
key.readableKey=_190;
}
if(!_193){
console.error("Unable to register key %o",key);
return key;
}
var kC=key.keyCode;
if(!_193[kC]){
_193[kC]=[];
}
_193[kC].push(key);
return key;
};
Projapi.Base.HotkeyHandler.prototype.dispatch=function(_195,_196){
var elem=Event.element(_195);
if(elem&&["INPUT","TEXTAREA","SELECT"].indexOf(elem.nodeName)!=-1&&_195.keyCode<=46){
return;
}
var key=_195.keyCode||_195.charCode;
var _199=this._ovr&&!this._ovr._objectHidden;
key=String.fromCharCode(key);
var item,_19b=new Projapi.Base.Hotkey(key,_195.ctrlKey,_195.altKey,_195.shiftKey);
if(_196[key]&&_196[key].length){
for(item in _196[key]){
if(_196[key][item].keyCode&&_19b.equals(_196[key][item])){
try{
this.invoke(_196,_196[key][item].action,_195);
if(_199&&!this._ovr._objectHidden){
this._ovr.hideObject();
}
Event.stop(_195);
return false;
}
catch(e){
if(e!=$continue){
throw e;
}
}
}
}
}
key=_195.keyCode||_195.charCode;
_19b=new Projapi.Base.Hotkey(key,_195.ctrlKey,_195.altKey,_195.shiftKey);
if(_196[key]&&_196[key].length){
for(item in _196[key]){
if(_196[key][item].keyCode&&_19b.equals(_196[key][item])){
try{
this.invoke(_196,_196[key][item].action,_195);
if(_199&&!this._ovr._objectHidden){
this._ovr.hideObject();
}
Event.stop(_195);
return false;
}
catch(e){
if(e!=$continue){
throw e;
}
}
}
}
}
return true;
};
Projapi.Base.HotkeyHandler.prototype.invoke=function(_19c,_19d,_19e){
if(typeof (_19d)=="function"||typeof (_19d)=="object"){
return _19d(_19e,_19c.object);
}else{
if(typeof (_19d)=="string"){
return (new Function("event","object",_19d))(_19e,_19c.object);
}else{
throw new Error("Invalid action in HotkeyHandler: ["+_19d+"].");
}
}
};
Projapi.Base.HotkeyHandler.prototype.setModifierForOvr=function(key,_1a0){
switch(key){
case 16:
this._activeModifiers.shift=_1a0;
break;
case 17:
this._activeModifiers.ctrl=_1a0;
break;
case 18:
this._activeModifiers.alt=_1a0;
break;
default:
break;
}
this.applyModifiersToOvr();
};
Projapi.Base.HotkeyHandler.prototype.applyModifiersToOvr=function(){
if(!this._ovr){
return;
}
var _1a1=this._ovr.getDOMNode().domNode.childNodes;
var i,_1a3,_1a4=0;
for(i=0;i<_1a1.length;i++){
if(_1a1[i].className=="pjOverlay_Body"){
_1a1=_1a1[i].childNodes;
break;
}
}
if(!this._activeModifiers.shift&&!this._activeModifiers.ctrl&&!this._activeModifiers.alt){
for(i=0;i<_1a1.length;i++){
if(_1a1[i].className=="highlight"){
_1a1[i].className="";
}
}
}else{
for(i=0;i<this._listedShortcuts.length;i++){
_1a3=true;
if((this._activeModifiers.shift&&!this._listedShortcuts[i].shiftKey)||(this._activeModifiers.ctrl&&!this._listedShortcuts[i].ctrlKey)||(this._activeModifiers.alt&&!this._listedShortcuts[i].altKey)){
_1a3=false;
}
while(_1a1[i+_1a4].tagName.toUpperCase()=="HR"){
_1a4++;
}
if(_1a3){
_1a1[i+_1a4].className="highlight";
}else{
_1a1[i+_1a4].className="";
}
}
}
};
Projapi.Base.HotkeyHandler.prototype.showHelp=function(_1a5,_1a6){
this._listedShortcuts=[];
if(this._ovr&&!this._ovr._objectHidden){
this._ovr.hideObject();
return;
}
_1a6=Event.lastClickedNode||Event.element(_1a5);
this._activeModifiers={shift:false,ctrl:false,alt:false};
var msg=[],_1a8=this.findContext(_1a6),_1a9=_1a8,_1aa,i,i1,item,j;
_1a6=_1a8.object;
while(_1a8){
for(i in _1a8){
if(_1a8[i].length&&_1a8[i][0]){
for(i1 in _1a8[i]){
if((item=_1a8[i][i1]).keyCode){
for(j=0;j<this._listedShortcuts.length;j++){
if(this._listedShortcuts[j].equals(item)){
item=null;
break;
}
}
if(!item){
continue;
}
this._listedShortcuts.push(item);
msg.push("<div><b>");
msg.push(item);
msg.push("</b>: ");
if(item.description){
msg.push(item.description);
}else{
msg.push((typeof (item.action)=="function")?"[function]":item.action.replace("<","&lt;").replace("&","&amp;"));
}
msg.push("</div>");
}
}
}
}
if(msg.length>0&&msg.last()!="<hr/>"){
msg.push("<hr/>");
}
_1a8=this.findContext(_1a8.object.parentNode);
}
if(msg.length>0){
msg.pop();
}else{
msg.push("<i>(no hotkeys registered)</i>");
}
if(!this._ovr){
this._ovr=new Projapi.Widgets.iPJOverlay(null,{});
this._ovr.createObjects();
this._ovr.getDOMNode().domNode.className+=" hotkeys";
}
this._ovr.getContentDOMNode().domNode.innerHTML=msg.join("");
this._ovr.attachTo(_1a6,"inside");
var pos=Position.cumulativeOffset(_1a6);
this._ovr.viewObject();
var ovrN=this._ovr._domNode.domNode;
if(ovrN.offsetWidth+pos[0]>document.body.clientWidth){
pos[0]=Math.max(0,document.body.clientWidth-ovrN.offsetWidth);
}
if(ovrN.offsetHeight+pos[1]>document.body.clientHeight){
pos[1]=Math.max(0,document.body.clientHeight-ovrN.offsetHeight);
}
this._ovr.setLocation(pos[0],pos[1]);
Event.observe(document.body,"click",this._removeOverlay,false);
this.applyModifiersToOvr();
};
Projapi.Base.HotkeyHandler.prototype.__removeOverlay=function(_1b1){
this._ovr.hideObject();
Event.stopObserving(document.body,"click",this._removeOverlay,false);
};
Projapi.Base.HotkeyHandler.charCodeTable={common:{"INS":new Projapi.Base.Hotkey(45),"DEL":new Projapi.Base.Hotkey(46),"HOME":new Projapi.Base.Hotkey(36),"END":new Projapi.Base.Hotkey(35),"PGUP":new Projapi.Base.Hotkey(33),"PGDN":new Projapi.Base.Hotkey(34),"F1":new Projapi.Base.Hotkey(112),"F10":new Projapi.Base.Hotkey(121),"LEFT":new Projapi.Base.Hotkey(37),"UP":new Projapi.Base.Hotkey(38),"RIGHT":new Projapi.Base.Hotkey(39),"DOWN":new Projapi.Base.Hotkey(40),"ENTER":new Projapi.Base.Hotkey(13),"ESC":new Projapi.Base.Hotkey(27),"`":new Projapi.Base.Hotkey(192,false,false,false),"/":new Projapi.Base.Hotkey(191,false,false,false),"?":new Projapi.Base.Hotkey(191,false,false,true)},Presto:{"`":new Projapi.Base.Hotkey(96,false,false,false),"/":new Projapi.Base.Hotkey(47,false,false,false),"?":new Projapi.Base.Hotkey(47,false,false,true)}};
Projapi.Base.HotkeyHandler.keyCodeTable={};
Projapi.Base.HotkeyHandler.__runOnce=function(){
try{
var item,_1b3=Projapi.Base.HotkeyHandler.charCodeTable[Projapi.Util.BrowserInfo.engine];
for(item in _1b3){
if(_1b3[item].keyCode){
Projapi.Base.HotkeyHandler.charCodeTable.common[item]=_1b3[item];
}
}
_1b3=Projapi.Base.HotkeyHandler.charCodeTable.common;
for(item in _1b3){
if(_1b3[item].keyCode){
x=_1b3[item].keyCode;
if(!Projapi.Base.HotkeyHandler.keyCodeTable[x]){
Projapi.Base.HotkeyHandler.keyCodeTable[x]=[];
}
Projapi.Base.HotkeyHandler.keyCodeTable[x].push(item);
}
}
}
finally{
Projapi.Base.HotkeyHandler.charCodeTable=Projapi.Base.HotkeyHandler.charCodeTable.common;
}
};
Projapi.Base.HotkeyHandler.__runOnce();
delete Projapi.Base.HotkeyHandler.__runOnce;
Projapi.Hotkeys=new Projapi.Base.HotkeyHandler({topLevel:document.body});
if(typeof Projapi=="undefined"){
Projapi={};
}
if(!Projapi.Widgets){
Projapi.Widgets={};
}
Projapi.Widgets.PJMenu=function(_1b4,_1b5){
Projapi.Widgets.PJMenu.superclass.constructor.call(this,_1b4,_1b5);
this._DOMClassPrefix="pjMenu";
this._objectType="Menu";
this._ignoreNextClick=false;
this.layoutManager=new Projapi.Layout.Layout(this);
this._canFocus=true;
this._defaultHideOnInit=true;
this._containerSource=null;
this._containerTargets=[];
this.ContainerSourceEvents=Projapi.Widgets.PJMenu.ContainerSourceEvents;
this.ContainerTargetEvents=Projapi.Links.Container.TargetEvents;
this._activeItem=null;
this._processObjectProperties();
};
Projapi.extend(Projapi.Widgets.PJMenu,Projapi.Base.iPJVisualObject);
Projapi.Widgets.PJMenu.ContainerSourceEvents=Projapi.Links.Container.SourceEvents.without(Projapi.Links.Container.ViewObject,Projapi.Links.Container.Resize);
Projapi.Widgets.PJMenu.prototype.createObjects=function(){
if(this._objectCreated){
return;
}
Projapi.Widgets.PJMenu.superclass.createObjects.call(this);
this._buildUI();
var _1b6,_1b7=this._containerSource;
if(_1b7){
if(this._objectPage==-1){
this.objectPage=0;
_1b7._domNode.domNode.appendChild(this._domNode.domNode);
}else{
if(_1b7.getLayoutManager){
_1b6=this._containerSource.getLayoutManager(this._objectPage);
_1b6.add(this);
}else{
if(_1b7 instanceof Projapi.Widgets.PJToolButton){
while(_1b7&&!(_1b7 instanceof Projapi.Widgets.PJToolbar)){
_1b7=_1b7._containerSource;
}
if(!_1b7){
_1b7=this._containerSource;
}
_1b7._domNode.domNode.appendChild(this._domNode.domNode);
}else{
_1b7._domNode.domNode.appendChild(this._domNode.domNode);
}
}
}
}
this._objectCreated=true;
var i;
for(i=0;i<this._containerTargets.length;i++){
this._containerTargets[i]._windowName=this._windowName;
this._containerTargets[i].createObjects();
}
this._processVisualObjectProperties();
};
Projapi.Widgets.PJMenu.prototype._buildUI=function(){
var node=this._domNode;
if(!node){
if(node=$(this._objectName)){
this.setDOMNode(Projapi.UI.Element.get(node));
}else{
this.setDOMNode(Projapi.UI.Element.fromString("<div id=\""+this._objectName+"\" tabindex=\"0\" class=\""+this._DOMClassPrefix+((this._properties.hideOnInit||this._defaultHideOnInit)?"\" style=\"display: none":"")+"\"></div>"));
node=this._domNode.domNode;
}
}
};
Projapi.Widgets.PJMenu.prototype.showAt=function(x,y){
var node=this._domNode.domNode,_def=[0,0];
this.hideObject();
this._properties.hide=false;
this.viewObject();
if(node.offsetParent){
_def=Position.cumulativeOffset(node.offsetParent);
}
node.style.top=y-_def[1]+"px";
node.style.left=x-_def[0]+"px";
};
Projapi.Widgets.PJMenu.prototype.initializeObject=function(){
if(this._objectInitialized){
return;
}
Projapi.Widgets.PJMenu.superclass.initializeObject.call(this);
this._actions=Object.extend(this._actions||{},{collapse:Projapi.Widgets.PJMenu._actions.collapse.bind(this),onBlur:Projapi.Widgets.PJMenu._actions.onBlur.bind(this),onFocus:Projapi.Widgets.PJMenu._actions.onFocus.bind(this),onKeyDown:Projapi.Widgets.PJMenu._actions.onKeyDown.bind(this),nextItem:Projapi.Widgets.PJMenu._actions.nextItem.bind(this),prevItem:Projapi.Widgets.PJMenu._actions.prevItem.bind(this),onMouseOver:Projapi.Widgets.PJMenu._actions.mouseover.bind(this),onMouseOut:Projapi.Widgets.PJMenu._actions.mouseout.bind(this)});
Event.observe(this._domNode.domNode,"blur",this._actions.onBlur,false,this);
Event.observe(this._domNode.domNode,"focus",this._actions.onFocus,false,this);
Event.observe(this._domNode.domNode,"keydown",this._actions.onKeyDown,false,this);
Event.observe(this._domNode.domNode,"mouseover",this._actions.onMouseOver,false,this);
Event.observe(this._domNode.domNode,"mouseout",this._actions.onMouseOut,false,this);
this._objectInitialized=true;
this.publish(Projapi.Links.Container.InitializeObject);
};
Projapi.Widgets.PJMenu._actions={};
Projapi.Widgets.PJMenu._actions.onBlur=function(){
this._hasFocus=false;
};
Projapi.Widgets.PJMenu._actions.onFocus=function(){
this._hasFocus=true;
Projapi.Util.Trigger(this,"onApplyEntry");
Projapi.FocusManager.setFocusedObject(this);
};
Projapi.Widgets.PJMenu._actions.onKeyDown=function(_1be){
var key=_1be.keyCode||_1be.charCode;
var _1c0=false;
switch(key){
case 13:
if(this._activeItem){
this._activeItem._actions.click();
if(!this._activeItem._containerTarget){
this._actions.collapse();
}
}else{
_1c0=true;
}
break;
case 27:
this._actions.collapse();
break;
case 37:
if(this instanceof Projapi.Widgets.PJMenuBar){
this._actions.prevItem();
}else{
if(!(this instanceof Projapi.Widgets.PJPopupMenu)){
var src=this._containerSource._containerSource;
if(src instanceof Projapi.Widgets.PJMenuBar){
src._actions.prevItem();
}else{
this.hideObject();
src.applyEntry();
}
}
}
break;
case 38:
if(!(this instanceof Projapi.Widgets.PJMenuBar)){
this._actions.prevItem();
}
break;
case 39:
var src;
if(this instanceof Projapi.Widgets.PJMenuBar){
this._actions.nextItem();
}else{
if(this._activeItem&&this._activeItem._containerTarget){
this._activeItem._actions.mouseover(null,false);
this._activeItem._containerTarget._actions.nextItem();
}else{
if((src=this._containerSource._containerSource) instanceof Projapi.Widgets.PJMenuBar){
src._actions.nextItem();
}
}
}
break;
case 40:
if(this instanceof Projapi.Widgets.PJMenuBar){
if(this._activeItem){
this._activeItem._actions.mouseover(_1be,true);
}
}else{
this._actions.nextItem();
}
break;
default:
_1c0=true;
}
if(!_1c0){
Event.stop(_1be);
}
};
Projapi.Widgets.PJMenu._actions.collapse=function(){
this._containerSource._actions.mouseout();
this._containerSource._containerSource._actions.collapse();
};
Projapi.Widgets.PJMenu._actions.mouseover=function(){
if(this._mouseOutTimeout){
clearTimeout(this._mouseOutTimeout);
this._mouseOutTimeout=null;
}
};
Projapi.Widgets.PJMenu._actions.mouseout=function(){
var _1c2=this._containerSource;
while(_1c2&&!(_1c2 instanceof Projapi.Widgets.PJMenuBar)&&!(_1c2 instanceof Projapi.Widgets.PJPopupMenu)){
_1c2=_1c2._containerSource;
}
if(_1c2&&_1c2._properties.hoverMode){
this._mouseOutTimeout=setTimeout((function(){
this._containerSource._actions.mouseout();
}).bind(this),200);
}
};
Projapi.Widgets.PJMenu._actions.nextItem=function(){
if(this._containerTargets.length<1){
return;
}
var _1c3=this._containerTargets[0];
if(this._activeItem&&this._activeItem!=this._containerTargets.last()){
_1c3=this._containerTargets[this._containerTargets.indexOf(this._activeItem)+1];
}
if(_1c3){
_1c3._actions.mouseover(null,!(this instanceof Projapi.Widgets.PJMenuBar));
}
};
Projapi.Widgets.PJMenu._actions.prevItem=function(){
if(this._containerTargets.length<1){
return;
}
var _1c4=this._containerTargets.last();
if(this._activeItem&&this._activeItem!=this._containerTargets[0]){
_1c4=this._containerTargets[this._containerTargets.indexOf(this._activeItem)-1];
}
if(_1c4){
_1c4._actions.mouseover(null,!(this instanceof Projapi.Widgets.PJMenuBar));
}
};
Projapi.Widgets.PJMenu.prototype.applyEntry=function(){
if(this._windowName){
Projapi.FocusManager.setFocusedWindow(this._windowName);
}
try{
if(this._domNode&&this.isObjectEnabled()){
this._domNode.domNode.focus();
}
}
catch(ex){
}
return this.hasFocus();
};
Projapi.Widgets.PJMenu.prototype.hideObject=function(){
if(this._activeItem){
if(this._activeItem._actions&&this._activeItem._actions.mouseout){
this._activeItem._actions.mouseout();
}
this._activeItem=null;
}
Projapi.Util.Trigger(this,"onHideObject");
this._domNode.domNode.style.display="none";
this._objectHidden=true;
this.publish(Projapi.Links.Container.HideObject);
};
Projapi.Widgets.PJMenu.prototype.viewObject=function(){
Projapi.Widgets.PJMenu.superclass.viewObject.call(this);
this.publish(Projapi.Links.Container.ViewObject);
};
Projapi.Widgets.PJMenu.prototype.destroyObject=function(){
this.publish(Projapi.Links.Container.DestroyObject);
Projapi.Widgets.PJMenu.superclass.destroyObject.call(this);
};
Projapi.Widgets.PJMenu.prototype.enableObject=function(){
Projapi.Widgets.PJMenu.superclass.enableObject.call(this);
this.publish(Projapi.Links.Container.EnableObject);
};
Projapi.Widgets.PJMenu.prototype.disableObject=function(){
Projapi.Widgets.PJMenu.superclass.disableObject.call(this);
this.publish(Projapi.Links.Container.DisableObject);
};
Projapi.Widgets.PJMenu.prototype.confirmExit=function(){
this.publish(Projapi.Links.Container.ConfirmExit);
Projapi.Widgets.PJMenu.superclass.confirmExit.call(this);
};
Projapi.Widgets.PJMenu.prototype.confirmCancel=function(){
this.publish(Projapi.Links.Container.ConfirmCancel);
Projapi.Widgets.PJMenu.superclass.confirmCancel.call(this);
};
Projapi.Widgets.PJMenu.prototype.confirmOK=function(){
this.publish(Projapi.Links.Container.confirmOK);
Projapi.Widgets.PJMenu.superclass.confirmOK.call(this);
};
Projapi.Widgets.PJMenu.prototype.resize=function(){
Projapi.Widgets.PJMenu.superclass.resize.call(this);
this.publish(Projapi.Links.Container.Resize);
};
Projapi.Widgets.PJMenu.prototype.exitObject=function(){
Projapi.Widgets.PJMenu.superclass.exitObject.call(this);
this.publish(Projapi.Links.Container.ExitObject);
};
Projapi.Widgets.PJMenu.prototype.addContainerTarget=function(_1c5){
if(this._containerTargets.indexOf(_1c5)>-1){
return;
}
this._containerTargets.push(_1c5);
this.addLink(Projapi.Links.Container,_1c5);
_1c5._windowName=this._windowName;
if(this._objectCreated){
_1c5.createObjects();
}
if(this._objectInitialized){
_1c5.initializeObject();
}
};
Projapi.Widgets.PJMenu.prototype.getContainerTarget=function(){
return this._containerTargets;
};
Projapi.Widgets.PJMenu.prototype.removeContainerTarget=function(_1c6){
if(this._containerTargets.indexOf(_1c6)==-1){
return;
}
this._containerTargets=this._containerTargets.without(_1c6);
this.removeLink(Projapi.Links.Container,_1c6);
};
Projapi.Widgets.PJMenu.prototype.getLayoutManager=function(){
return this.layoutManager;
};
Projapi.Widgets.PJMenu.prototype.setLayoutManager=function(_1c7){
if(_1c7){
this.layoutManager=new _1c7;
}else{
this.layoutManager=new Projapi.Layout.Layout(this);
}
};
Projapi.Widgets.PJMenuBar=function(_1c8,_1c9){
Projapi.Widgets.PJMenuBar.superclass.constructor.call(this,_1c8,_1c9);
this._properties=Object.extend({displayAsList:false,hoverMode:!!this._properties.displayAsList},this._properties);
this._DOMClassPrefix="pjMenuBar";
this._objectType="MenuBar";
this._active=false;
this._defaultHideOnInit=false;
this.ContainerSourceEvents=Projapi.Links.Container.SourceEvents;
this._properties.displayAsList=!!this._properties.displayAsList;
};
Projapi.extend(Projapi.Widgets.PJMenuBar,Projapi.Widgets.PJMenu);
Projapi.Widgets.PJMenuBar.prototype.createObjects=function(){
if(this._objectCreated){
return;
}
if(this._properties.displayAsList){
this._DOMClassPrefix="pjMenuBar displayAsList";
}
Projapi.Widgets.PJMenuBar.superclass.createObjects.call(this);
if(!this._properties.displayAsList){
for(var i=0;i<this._containerTargets.length;i++){
if(this._containerTargets[i]._isSeparator){
this._containerTargets[i]._domNode.domNode.innerHTML="|";
}
}
}
};
Projapi.Widgets.PJMenuBar.prototype.initializeObject=function(){
if(this._objectInitialized){
return;
}
Projapi.Widgets.PJMenuBar.superclass.initializeObject.call(this);
var node=this._domNode.domNode;
this._actions=Object.extend(this._actions||{},{collapse:Projapi.Widgets.PJMenuBar._actions.collapse.bind(this),onClick:Projapi.Widgets.PJMenuBar._actions.onClick.bind(this),onDocumentClick:Projapi.Widgets.PJMenuBar._actions.onDocumentClick.bind(this),onMouseOut:Projapi.Widgets.PJMenuBar._actions.onMouseOut.bind(this)});
Event.observe(node,"click",this._actions.onClick,false,this);
Event.observe(node,"mouseout",this._actions.onMouseOut,false,this);
Event.observe(document.body,"click",this._actions.onDocumentClick,false,this);
Event.observe(document.body,"contextmenu",this._actions.onDocumentClick,false,this);
};
Projapi.Widgets.PJMenuBar.prototype.addContainerTarget=function(_1cc){
if(!this._properties.displayAsList&&_1cc._isSeparator&&_1cc._objectCreated){
_1cc._domNode.domNode.innerHTML="|";
}
Projapi.Widgets.PJMenuBar.superclass.addContainerTarget.call(this,_1cc);
};
Projapi.Widgets.PJMenuBar.prototype.removeContainerTarget=function(_1cd){
if(!this._properties.displayAsList&&_1cd._isSeparator&&_1cd._objectCreated){
_1cd._domNode.domNode.innerHTML="<hr />";
}
Projapi.Widgets.PJMenuBar.superclass.removeContainerTarget.call(this,_1cd);
};
Projapi.Widgets.PJMenuBar.prototype.setDisplayAsList=function(_1ce){
if(typeof _1ce=="undefined"){
return;
}
_1ce=!!_1ce;
if(_1ce==this._properties.displayAsList){
return;
}
this._properties.displayAsList=_1ce;
var cls="pjMenuBar",_1d0="|";
if(_1ce){
cls+=" displayAsList";
_1d0="<hr />";
}
this._DOMClassPrefix=cls;
if(this._objectCreated){
this._domNode.domNode.className=cls;
for(var i=0;i<this._containerTargets.length;i++){
if(this._containerTargets[i]._isSeparator){
this._containerTargets[i]._domNode.domNode.innerHTML=_1d0;
}
}
}
this._domNode.domNode.className=this._DOMClassPrefix;
};
Projapi.Widgets.PJMenuBar._actions={};
Projapi.Widgets.PJMenuBar._actions.collapse=function(_1d2){
this._active=false;
this._actions.onMouseOut();
};
Projapi.Widgets.PJMenuBar._actions.onClick=function(_1d3){
if(this._ignoreNextClick){
return;
}
this._ignoreNextClick=true;
this._active=!this._properties.hoverMode&&!this._active;
var _1d4;
if(_1d4=this._activeItem){
_1d4._actions.mouseout();
_1d4._actions.mouseover(null,false);
}
};
Projapi.Widgets.PJMenuBar._actions.onDocumentClick=function(_1d5){
if(this._ignoreNextClick){
this._ignoreNextClick=false;
return;
}
this._active=false;
if(this._activeItem){
this._activeItem._actions.mouseout();
}
};
Projapi.Widgets.PJMenuBar._actions.onMouseOut=function(_1d6){
var el=Event.element(_1d6);
if(el!=this._domNode.domNode&&el.parentNode!=this._domNode.domNode){
return;
}
if(!this._active){
if(this._activeItem){
this._activeItem._actions.mouseout();
}
}
};
Projapi.Widgets.PJPopupMenu=function(_1d8,_1d9){
_1d9.ignoreLayoutPosition=true;
_1d9.hide=true;
Projapi.Widgets.PJPopupMenu.superclass.constructor.call(this,_1d8,_1d9);
this._DOMClassPrefix="pjMenu";
this._objectType="PopupMenu";
if(Projapi.Widgets.PJPopupMenu.instances.length==0){
Event.observe(document.body,"contextmenu",Projapi.Widgets.PJPopupMenu.closeAllInstances,false,this);
}
Projapi.Widgets.PJPopupMenu.instances.push(this);
};
Projapi.extend(Projapi.Widgets.PJPopupMenu,Projapi.Widgets.PJMenu);
Projapi.Widgets.PJPopupMenu.instances=[];
Projapi.Widgets.PJPopupMenu._keepInstance=null;
Projapi.Widgets.PJPopupMenu.closeAllInstances=function(_1da){
var i,vec=Projapi.Widgets.PJPopupMenu.instances;
for(i=0;i<vec.length;i++){
if(vec[i]!=Projapi.Widgets.PJPopupMenu._keepInstance){
vec[i]._actions.onDocumentClick();
}
}
Projapi.Widgets.PJPopupMenu._keepInstance=null;
Event.stop(_1da);
};
Projapi.Widgets.PJPopupMenu.prototype.initializeObject=function(){
if(this._objectInitialized){
return;
}
Projapi.Widgets.PJPopupMenu.superclass.initializeObject.call(this);
var node=this._domNode.domNode;
this._actions=Object.extend(this._actions||{},{collapse:Projapi.Widgets.PJPopupMenu._actions.collapse.bind(this),onDocumentClick:Projapi.Widgets.PJPopupMenu._actions.onDocumentClick.bindAsEventListener(this)});
Event.observe(document.body,"click",this._actions.onDocumentClick,false,this);
};
Projapi.Widgets.PJPopupMenu.prototype.destroyObject=function(){
var i;
for(i=Projapi.Widgets.PJPopupMenu.instances.length-1;i>=0;i--){
if(Projapi.Widgets.PJPopupMenu.instances[i]==this){
Projapi.Widgets.PJPopupMenu.instances.splice(i,1);
break;
}
}
Projapi.Widgets.PJPopupMenu.superclass.destroyObject.call(this);
};
Projapi.Widgets.PJPopupMenu.prototype.disableObject=function(){
Projapi.Widgets.PJMenu.superclass.disableObject.call(this);
if(!this._objectHidden){
this.hideObject();
}
};
Projapi.Widgets.PJPopupMenu.prototype.hideObject=function(){
if(this._objectHidden){
return;
}
this._properties.hide=true;
Projapi.Widgets.PJPopupMenu.superclass.hideObject.call(this);
};
Projapi.Widgets.PJPopupMenu.prototype.pop=function(_1df,y1){
if(this._objectDisabled){
return;
}
var x,y;
if(!this._objectCreated){
this.createObjects();
}
if(!this._objectInitialized){
this.initializeObject();
}
if(this._domNode.domNode.parentNode){
this._domNode.domNode.parentNode.removeChild(this._domNode.domNode);
if(Projapi.Globals.ROOT_WINDOW&&Projapi.Globals.ROOT_WINDOW._domNode){
Projapi.Globals.ROOT_WINDOW._domNode.domNode.appendChild(this._domNode.domNode);
}else{
document.body.appendChild(this._domNode.domNode);
}
}
if(typeof _1df=="number"){
x=_1df;
y=y1;
}else{
x=Event.pointerX(_1df);
y=Event.pointerY(_1df);
}
this.showAt(x,y);
this.applyEntry();
Projapi.Widgets.PJPopupMenu._keepInstance=this;
};
Projapi.Widgets.PJPopupMenu._actions={};
Projapi.Widgets.PJPopupMenu._actions.collapse=function(_1e3){
this.hideObject();
};
Projapi.Widgets.PJPopupMenu._actions.onDocumentClick=function(_1e4){
if(this._ignoreNextClick){
this._ignoreNextClick=false;
return;
}
if(!this._objectHidden){
this.hideObject();
}
};
Projapi.Widgets.PJPopupMenu.prototype.setContainerSource=function(_1e5){
Projapi.Widgets.PJPopupMenu.superclass.setContainerSource.call(this,_1e5);
if(_1e5){
this._windowName=_1e5._windowName;
}else{
this._windowName="";
}
};
Projapi.Widgets.PJMenuItem=function(_1e6,_1e7){
Projapi.Widgets.PJMenuItem.superclass.constructor.call(this,_1e6,_1e7);
this._DOMClassPrefix="pjMenuItem";
this._objectType="PJMenuItem";
this._canFocus=true;
this._ignoreNextClick=false;
this.layoutManager=new Projapi.Layout.Layout(this);
this._containerSource=null;
this._containerTarget=null;
this.ContainerSourceEvents=Projapi.Links.Container.SourceEvents;
this.ContainerTargetEvents=Projapi.Links.Container.TargetEvents;
this._domNodes={img:null,label:null};
this._isSeparator=false;
this._processObjectProperties();
};
Projapi.extend(Projapi.Widgets.PJMenuItem,Projapi.Base.iPJVisualObject);
Projapi.Widgets.PJMenuItem.prototype.createObjects=function(){
if(this._objectCreated){
return;
}
Projapi.Widgets.PJMenuItem.superclass.createObjects.call(this);
this._buildUI();
if(this._containerSource){
this._containerSource.getLayoutManager(this._objectPage).add(this);
}
this._objectCreated=true;
if(this._containerTarget){
this._containerTarget._windowName=this._windowName;
this._containerTarget.createObjects();
}
this._processVisualObjectProperties();
};
Projapi.Widgets.PJMenuItem.prototype._buildUI=function(){
var node=this._domNode;
if(!node){
if(node=$(this._objectName)){
this.setDOMNode(Projapi.UI.Element.get(node));
}else{
var _1e9=!this._properties.image&&!this._properties.hoverImage&&!this._properties.disabledImage;
var sep=!this._properties.label&&_1e9;
var str=["<span id=\"",this._objectName,"\" class=\"",this._DOMClassPrefix];
if(sep){
str.push(" separator");
}
str.push("\">");
if(sep){
str.push("<hr />");
this._isSeparator=true;
this._properties.disableOnInit=true;
}else{
str.push("<img ");
if(_1e9){
str.push("style=\"display: none\" ");
}
str.push("/><img class=\"submenu\" /><span class=\"hotkey\"></span>");
str.push(this._properties.label||"&nbsp;");
str.push("<span class=\"hidden\"></span>");
}
str.push("</span>");
this.setDOMNode(Projapi.UI.Element.fromString(str.join("")));
if(!sep){
var node=this._domNode.domNode;
this._domNodes.img=node.firstChild;
this._domNodes.img.setSrc=Projapi.Widgets.PJToolButton.setImgSrc;
this._domNodes.subimg=node.childNodes[1];
this._domNodes.hotkey=node.childNodes[2];
this._domNodes.label=node.childNodes[3];
this._domNodes.hotkeyH=node.childNodes[4];
if(!this._containerTarget){
node.removeChild(this._domNodes.subimg);
}
node.removeChild(this._domNodes.hotkey);
if(this._properties.image){
this._domNodes.img.setSrc(this._properties.image);
}
}
}
}
};
Projapi.Widgets.PJMenuItem.prototype.initializeObject=function(){
if(this._objectInitialized){
return;
}
Projapi.Widgets.PJMenuItem.superclass.initializeObject.call(this);
this._initHandlers();
this._objectInitialized=true;
this.publish(Projapi.Links.Container.InitializeObject);
if(this._containerTarget){
this._containerTarget.hideObject();
}
if(this._properties.hotkey){
this.setHotkeyAction(this._actions.hotkey);
if(this._containerTarget){
this.setHotkeyDescription((this._properties.label||"[Unnamed]")+" menu");
}else{
this.setHotkeyDescription(this._properties.label||"[Unnamed menu item]");
}
}else{
if(this._properties.___hotkeyText){
this.showHotkey(this._properties.___hotkeyText);
}
}
};
Projapi.Widgets.PJMenuItem.prototype._initHandlers=function(){
this._actions={hotkey:Projapi.Widgets.PJMenuItem._actions.hotkey.bind(this),click:Projapi.Widgets.PJMenuItem._actions.click.bindAsEventListener(this),mouseover:Projapi.Widgets.PJMenuItem._actions.mouseover.bindAsEventListener(this),mouseout:Projapi.Widgets.PJMenuItem._actions.mouseout.bindAsEventListener(this)};
Event.observe(this._domNode.domNode,"click",this._actions.click,false,this);
Event.observe(this._domNode.domNode,"mouseover",this._actions.mouseover,false,this);
};
Projapi.Widgets.PJMenuItem._actions={};
Projapi.Widgets.PJMenuItem._actions.hotkey=function(_1ec,_1ed){
if(this._containerSource instanceof Projapi.Widgets.PJMenuBar){
this._containerSource._active=true;
}
this._actions.mouseover();
this._actions.click();
};
Projapi.Widgets.PJMenuItem._actions.click=function(_1ee){
if(this._ignoreNextClick){
this._ignoreNextClick=false;
return;
}
if(this._containerTarget){
this._containerTarget.applyEntry();
}else{
this._containerSource.applyEntry();
}
Projapi.Util.Trigger(this,"onClick");
if(this._properties.clickTarget){
if(this._properties.clickTarget.click){
this._properties.clickTarget.click();
}else{
this._properties.clickTarget.onclick();
}
}
var _1ef=this;
if((this._isSeparator||this._containerTarget)&&!(this._containerSource instanceof Projapi.Widgets.PJMenuBar)){
while(_1ef){
if((_1ef instanceof Projapi.Widgets.PJMenu)||(_1ef instanceof Projapi.Widgets.PJMenuItem)){
_1ef._ignoreNextClick=true;
_1ef=_1ef._containerSource;
}else{
_1ef=null;
}
}
}
};
Projapi.Widgets.PJMenuItem._actions.mouseover=function(_1f0,_1f1){
var _1f2=false;
if(arguments.length==1){
_1f1=_1f2;
}else{
if(arguments.length>1&&_1f0==_1f1){
_1f1=(arguments.length>2)?arguments[2]:_1f2;
}
}
if(this._containerSource._activeItem==this){
return;
}
if(this._containerSource._activeItem&&this._containerSource._activeItem._actions&&this._containerSource._activeItem._actions.mouseout){
this._containerSource._activeItem._actions.mouseout();
}
this._containerSource._activeItem=this;
if(!this._objectEnabled){
return;
}
this._domNode.domNode.className+=" hover";
if(this._properties.hoverImage){
this._domNodes.img.setSrc(this._properties.hoverImage);
}
if(this._containerTarget&&this._containerTarget instanceof Projapi.Widgets.PJMenu&&(!(this._containerSource instanceof Projapi.Widgets.PJMenuBar)||this._containerSource._active||this._containerSource._properties.hoverMode)){
var node=this._domNode.domNode;
var box=Position.cumulativeOffset(node);
if(this._containerSource instanceof Projapi.Widgets.PJMenuBar&&!this._containerSource._properties.displayAsList){
this._containerTarget.showAt(box[0],box[1]+node.offsetHeight);
}else{
this._containerTarget.showAt(box[0]+node.offsetWidth,box[1]-3);
}
if((typeof _1f1!="undefined")&&!_1f1){
this._containerTarget.applyEntry();
this._containerTarget._actions.nextItem();
}else{
this._containerSource.applyEntry();
}
}
};
Projapi.Widgets.PJMenuItem._actions.mouseout=function(_1f5){
if(this._containerSource._activeItem!=this){
return;
}
if(0&&_1f5){
var _1f6=this,_1f7,pos,_1f9=false;
while(_1f6){
if(_1f6._objectHidden){
break;
}
_1f7=_1f6._domNode.domNode;
pos=Position.cumulativeOffset(_1f7);
pos[0]=Event.pointerX(_1f5)-pos[0];
pos[1]=Event.pointerY(_1f5)-pos[1];
if(pos[0]>=0&&pos[1]>=0&&pos[0]<_1f7.offsetWidth&&pos[1]<_1f7.offsetHeight){
_1f9=true;
break;
}
if(_1f6 instanceof Projapi.Widgets.PJMenu){
_1f6=_1f6._activeItem;
}else{
if(_1f6._containerTarget){
_1f6=_1f6._containerTarget;
}else{
_1f6=null;
}
}
}
if(_1f9){
return;
}
}
this._containerSource._activeItem=null;
this._domNode.domNode.className=this._domNode.domNode.className.replace(" hover","");
if(this._objectEnabled&&this._properties.hoverImage){
this._domNodes.img.setSrc(this._properties.image);
}
if(this._containerTarget&&!this._containerTarget._objectHidden){
this._containerTarget.hideObject();
this._containerSource.applyEntry();
}
};
Projapi.Widgets.PJMenuItem.prototype.hideObject=function(){
this.publish(Projapi.Links.Container.HideObject);
Projapi.Widgets.PJMenuItem.superclass.hideObject.call(this);
};
Projapi.Widgets.PJMenuItem.prototype.viewObject=function(){
Projapi.Widgets.PJMenuItem.superclass.viewObject.call(this);
};
Projapi.Widgets.PJMenuItem.prototype.destroyObject=function(){
this.publish(Projapi.Links.Container.DestroyObject);
Projapi.Widgets.PJMenuItem.superclass.destroyObject.call(this);
};
Projapi.Widgets.PJMenuItem.prototype.enableObject=function(){
Projapi.Widgets.PJMenuItem.superclass.enableObject.call(this);
this._domNode.removeClassName("disabled");
if(this._properties.disabledImage){
this._domNodes.img.setSrc(this._properties.image||"");
}
this.publish(Projapi.Links.Container.EnableObject);
};
Projapi.Widgets.PJMenuItem.prototype.disableObject=function(){
Projapi.Widgets.PJMenuItem.superclass.disableObject.call(this);
if(this._objectInitialized){
this._domNode.addClassName("disabled");
if(this._properties.disabledImage){
this._domNodes.img.setSrc(this._properties.disabledImage);
}
}
this.publish(Projapi.Links.Container.DisableObject);
};
Projapi.Widgets.PJMenuItem.prototype.confirmExit=function(){
this.publish(Projapi.Links.Container.ConfirmExit);
Projapi.Widgets.PJMenuItem.superclass.confirmExit.call(this);
};
Projapi.Widgets.PJMenuItem.prototype.confirmCancel=function(){
this.publish(Projapi.Links.Container.ConfirmCancel);
Projapi.Widgets.PJMenuItem.superclass.confirmCancel.call(this);
};
Projapi.Widgets.PJMenuItem.prototype.confirmOK=function(){
this.publish(Projapi.Links.Container.confirmOK);
Projapi.Widgets.PJMenuItem.superclass.confirmOK.call(this);
};
Projapi.Widgets.PJMenuItem.prototype.resize=function(){
Projapi.Widgets.PJMenuItem.superclass.resize.call(this);
this.publish(Projapi.Links.Container.Resize);
};
Projapi.Widgets.PJMenuItem.prototype.exitObject=function(){
Projapi.Widgets.PJMenuItem.superclass.exitObject.call(this);
this.publish(Projapi.Links.Container.ExitObject);
};
Projapi.Widgets.PJMenuItem.prototype.setHotkey=function(_1fa){
Projapi.Widgets.PJMenuItem.superclass.setHotkey.call(this,_1fa);
if(this._properties.hotkey){
this.showHotkey(this._properties.hotkey.toString());
}
};
Projapi.Widgets.PJMenuItem.prototype.showHotkey=function(str){
this._domNodes.hotkeyH.innerHTML=this._domNodes.hotkey.innerHTML=str;
if(this._domNodes.hotkey.parentNode!=this._domNode.domNode){
this._domNode.domNode.insertBefore(this._domNodes.hotkey,this._domNode.domNode.firstChild);
}
};
Projapi.Widgets.PJMenuItem.prototype.setContainerSource=function(_1fc){
if(_1fc==this._containerSource){
return;
}
Projapi.Widgets.PJMenuItem.superclass.setContainerSource.call(this,_1fc);
if(this._containerSource){
var _1fd=this._containerSource.getLayoutManager(this.getObjectPage());
_1fd.add(this);
}else{
if(this._domNode){
var node=this._domNode.domNode;
if(node.parentNode){
node.parentNode.removeChild(node);
}
}
}
};
Projapi.Widgets.PJMenuItem.prototype.setContainerTarget=function(_1ff){
if(this._containerTarget==_1ff){
return;
}
if(_1ff==null){
if(this._containerTarget){
this.removeLink(Projapi.Links.Container,this._containerTarget);
this._containerTarget=null;
if(this._objectCreated){
this._domNode.domNode.removeChild(this._domNodes.subimg);
}
}
return;
}
this._containerTarget=_1ff;
_1ff._windowName=this._windowName;
this.addLink(Projapi.Links.Container,_1ff);
if(this._objectCreated){
this._domNode.domNode.appendChild(this._domNodes.subimg);
}
};
Projapi.Widgets.PJMenuItem.prototype.getContainerTarget=function(){
return this._containerTarget;
};
Projapi.Widgets.PJMenuItem.prototype.getLayoutManager=function(){
return this.layoutManager;
};
Projapi.Widgets.PJMenuItem.prototype.setLayoutManager=function(_200){
if(_200){
this.layoutManager=new _200;
}else{
this.layoutManager=new Projapi.Layout.Layout(this);
}
};
if(typeof Projapi=="undefined"){
var Projapi={};
}
if(typeof Projapi.Widgets=="undefined"){
Projapi.Widgets={};
}
Projapi.Widgets.PJImage=function(_201,_202){
Projapi.Widgets.PJImage.superclass.constructor.call(this,_201,_202);
this._properties=Object.extend({doColumnName:null,link:"",src:""},this._properties);
this._contentDOMNode=null;
this._domNode=null;
this._imageLinkTarget=(this._imageLink!="#")?_202.target:"";
this._dataSource=null;
};
Projapi.extend(Projapi.Widgets.PJImage,Projapi.Base.iPJVisualObject);
Projapi.Widgets.PJImage.prototype.DataSourceEvents=[Projapi.Links.Data.DataAvailable];
Projapi.Widgets.PJImage.prototype.createObjects=function(){
this._processObjectProperties();
if(!this._isUIBuilt()){
this._buildUI();
}
Projapi.Widgets.PJImage.superclass.createObjects.call(this);
this._objectCreated=true;
};
Projapi.Widgets.PJImage.prototype._isUIBuilt=function(){
return (this._domNode&&this._imageElement);
};
Projapi.Widgets.PJImage.prototype._buildUI=function(){
var _203,_img,cont;
if(!this._domNode){
_203=document.getElementById(this._objectName);
if(_203){
this._domNode=Projapi.UI.Element.get(_203);
}else{
this._domNode=Projapi.UI.Element.fromString("<a id=\""+this._objectName+"\" href=\""+this._properties.link+"\" target=\""+this._imageLinkTarget+"\" style=\"display:none\"><img class=\"pjImage\" src=\""+this._properties.src+"\" /></a>");
_img=this._domNode.domNode.firstChild;
this._domNode.domNode.img=_img;
}
}
if(cont=this._containerSource){
_layoutManager=cont.getLayoutManager(this._objectPage).add(this);
}
};
Projapi.Widgets.PJImage.prototype.setObjectValue=function(_206){
this._properties.src=_206;
if(this._objectCreated){
this._domNode.domNode.img.src=_206;
}
};
Projapi.Widgets.PJImage.prototype.getObjectValue=function(_207){
return _207?this[_207]:this._properties.src;
};
Projapi.Widgets.PJImage.prototype.getImageLink=function(){
return this._properties.link;
};
Projapi.Widgets.PJImage.prototype.setImageLink=function(_208){
this._properties.link=_208;
if(this._objectCreated){
this._domNode.domNode.href=_208;
}
};
Projapi.Widgets.PJImage.prototype.getImageLinkTarget=function(){
return this._imageLinkTarget;
};
Projapi.Widgets.PJImage.prototype.setImageLinkTarget=function(_209){
this._imageLinkTarget=_209;
if(this._objectCreated){
this._domNode.domNode.target=_209;
}
};
Projapi.Widgets.PJImage.prototype.initializeObject=function(){
if(!this.getProperty("hideOnInit",false,true)){
this.viewObject(true);
}
};
Projapi.Widgets.PJImage.prototype.setDataSource=function(_20a){
this._dataSource=_20a;
this.dataAvailable();
};
Projapi.Widgets.PJImage.prototype.getDataSource=function(){
return this._dataSource;
};
Projapi.Widgets.PJImage.prototype.dataAvailable=function(){
var src;
if(this._dataSource&&this._properties.doColumnName){
src=this._dataSource.colValues([this._properties.doColumnName])[0];
}else{
src="";
}
this.setObjectValue(src);
};
if(typeof Projapi=="undefined"){
var Projapi={};
}
if(typeof Projapi.Widgets=="undefined"){
Projapi.Widgets={};
}
Projapi.Widgets.PJHTMLLink=function(_20c,_20d){
Projapi.Widgets.PJHTMLLink.superclass.constructor.call(this,_20c,_20d);
this._contentDOMNode=null;
this._domNode=null;
this._link=_20d.link;
this._linkTarget=(this._link!="#")?_20d.target:"";
this._innerHTML=_20d.value;
};
Projapi.extend(Projapi.Widgets.PJHTMLLink,Projapi.Base.iPJVisualObject);
Projapi.Widgets.PJHTMLLink.prototype.createObjects=function(){
this._processObjectProperties();
if(!this._isUIBuilt()){
this._buildUI();
}
Projapi.Widgets.PJHTMLLink.superclass.createObjects.call(this);
this._objectCreated=true;
};
Projapi.Widgets.PJHTMLLink.prototype._isUIBuilt=function(){
return this.getDOMNode();
};
Projapi.Widgets.PJHTMLLink.prototype._buildUI=function(){
var _20e;
if(!this._domNode){
_20e=document.getElementById(this.getObjectName());
if(_20e){
this._domNode=Projapi.UI.Element.get(_20e);
}else{
_20e=document.createElement("A");
_20e.id=this.getObjectName();
_20e.href=this.getLink();
_20e.target=this.getLinkTarget();
_20e.innerHTML=this.getObjectValue();
_20e.style.display="none";
this._domNode=Projapi.UI.Element.get(_20e);
}
}
if(this.getContainerSource()){
_layoutManager=this.getContainerSource().getLayoutManager(this.getObjectPage());
_layoutManager.add(this);
}
};
Projapi.Widgets.PJHTMLLink.prototype.setObjectValue=function(_20f){
this._innerHTML=_20f;
this._domNode.domNode.innerHTML=_20f;
};
Projapi.Widgets.PJHTMLLink.prototype.getObjectValue=function(){
return this._innerHTML;
};
Projapi.Widgets.PJHTMLLink.prototype.getLink=function(){
return this._link;
};
Projapi.Widgets.PJHTMLLink.prototype.setLink=function(_210){
this._link=_210;
this._domNode.domNode.href=_210;
};
Projapi.Widgets.PJHTMLLink.prototype.getLinkTarget=function(){
return this._linkTarget;
};
Projapi.Widgets.PJHTMLLink.prototype.setLinkTarget=function(_211){
this._linkTarget=_211;
this._domNode.domNode.target=_211;
};
Projapi.Widgets.PJHTMLLink.prototype.initializeObject=function(){
if(!this.getProperty("hideOnInit",false,true)){
this.viewObject(true);
}
};
if(typeof Projapi=="undefined"){
Projapi={};
}
Projapi.Reflection={root:null,rootVisual:null,exploredTree:null,inlineParentCalls:false,profileEverything:false,isolateMethods:false,checkGlobals:true,frx:/^\s*function\s*\(([^)]*)\)\s*{((?:.|\s)*)}\s*$/,fcrxg:/\s([^\s;,{}()]+).call\(\s*this\s*(,[^)]+)?\)/g,fcrx:/\s([^\s;,{}()]+).call\(\s*this\s*(,[^)]+)?\)/,gprxg:/this.getProperty\(\s*("|')([^\s;,{}()]+)\1\s*,\s*([^\s;,{}()]+)\s*(?:,\s*([^\s;,{}()]+)\s*)?\)/g,gprx:/this.getProperty\(\s*("|')([^\s;,{}()]+)\1\s*,\s*([^\s;,{}()]+)\s*(?:,\s*([^\s;,{}()]+)\s*)?\)/,vdrxg:/(?:[{}();,]|^)\s*var\s+([^;]+)(?=;)/g,vdrx:/(?:[{}();,]|^)\s*var\s+([^;]+)/,varxg:/(?:[{}();,]|^)\s*([a-zA-Z0-9_$]+)\s*=(?!=)/g,varx:/(?:[{}();,]|^)\s*([a-zA-Z0-9_$]+)\s*=(?!=)/,var_str_auto_profiled:"auto profiled",explore:function(_212){
if(this.exploredTree&&(typeof _212=="undefined"||!_212)){
return this.exploredTree;
}
if(!this.root){
this.root=Projapi.Base.iPJSmartObject;
}
if(!this.rootVisual){
this.rootVisual=Projapi.Base.iPJVisualObject;
}
return this.exploredTree=this.processExplored(Object.extend(this.exploreClasses(Projapi.Base,"Projapi.Base","Base"),this.exploreClasses(Projapi.Widgets,"Projapi.Widgets","UI"),this.exploreClasses(Projapi.Layout,"Projapi.Layout","Layout"),this.exploreClasses({Controller:Projapi.Controller,Element:Projapi.UI.Element},"etc","etc")));
},exploreClasses:function(_213,_214,_215){
var list={},item;
for(item in _213){
if(!{}[item]&&typeof _213[item]=="function"&&!_213[item].notExplorable){
try{
list[item]=this.exploreClass(_213[item],_214+"."+item,_215+"."+item);
if(list[item]==null){
delete list[item];
continue;
}
list[item].className=_215+"."+item;
list[item].classRef=_213[item];
list[item].qualifiedClassName=_214+"."+item;
}
catch(e){
console.error("Error exploring %s.%s, exception: %o",_215,item,e);
delete list[item];
}
}
}
return list;
},exploreClass:function(clss,_219,_21a){
var item={},name,_21d,m,m2,_220,_221,v1,v2,str,_225;
var _226=_21a.replace(/\./g,"_");
var _227;
Projapi.Register.remove("someClass");
try{
_227=new clss("someClass",{});
}
catch(e){
_227=clss.prototype;
}
if(_227 instanceof this.root){
item.isSmartObject=true;
item.visual=(_227 instanceof this.rootVisual);
item.properties={};
if(_227._properties){
for(name in _227._properties){
if(!{}[name]&&name.length>0&&name[0]!="_"){
item.properties[name]={type:typeof _227._properties[name],defVal:_227._properties[name]};
if(item.properties[name].defVal instanceof Array){
item.properties[name].type="array";
}
if(_227._properties[name]==null){
item.properties[name].nullable=true;
}
}
}
if(_227._properties._selfStruct){
for(name in _227._properties._selfStruct){
if(!{}[name]){
if(!item.properties[name]){
item.properties[name]={};
}
for(_21d in _227._properties._selfStruct[name]){
item.properties[name][_21d]=_227._properties._selfStruct[name][_21d];
}
}
}
}
}
item.links={};
for(name in _227){
if(m=name.match(/^(get|set|add|remove)(\w+)(Source|Target)$/)){
if(!item.links[m[2]]){
item.links[m[2]]={source:[],target:[]};
}
item.links[m[2]][m[3].toLowerCase()].push(m[1]);
}
}
for(name in item.links){
if(item.links[name].source&&item.links[name].target){
for(m in {"source":true,"target":true}){
if(!{}[m]){
if(item.links[name][m].length>0){
_21d=[];
if(item.links[name][m].indexOf("get")<0){
_21d.push("get");
}
if(item.links[name][m].indexOf("set")<0){
if(item.links[name][m].indexOf("add")>=0||item.links[name][m].indexOf("remove")>=0){
if(item.links[name][m].indexOf("add")<0){
_21d.push("add");
}
if(item.links[name][m].indexOf("remove")<0){
_21d.push("remove");
}
}else{
_21d.push("set/add/remove");
}
}
if(_21d.length>0){
console.warn("%s has incomplete support for %s %s, missing methods: %s",_219,name,m,_21d.join(", "));
}
}
}
}
}
}
item.messages={};
if(_227._staticMessageBundle){
for(name in _227._staticMessageBundle){
if(!{}[name]){
item.messages[name]=_227._staticMessageBundle[name];
}
}
}
if(_227._messageBundle){
for(name in _227._messageBundle){
if(!{}[name]){
item.messages[name]=_227._messageBundle[name];
}
}
}
}
for(name in clss.prototype){
if(!{}[name]&&typeof clss.prototype[name]=="function"&&!clss.prototype[name].reflected){
m=String(clss.prototype[name]).match(this.frx);
if(!m){
continue;
}
m2=m[2].replace(/((\/\/.*\n)|(\/\*(.|\s)*?\*\/))/g,"\n");
_225="";
if(item.isSmartObject&&(!clss.superclass||clss.prototype[name]!=clss.superclass[name])&&(_21d=m2.match(this.gprxg))){
while(_21d.length>0){
_220=_21d.shift().match(this.gprx);
_221=eval(_220[3]);
if(!item.properties[_220[2]]){
item.properties[_220[2]]={type:typeof _221,defVal:_221,defValStr:_220[3],extraDef:[],extractedFromCode:true};
if(item.properties[_220[2]].defVal instanceof Array){
item.properties[_220[2]].type="array";
}
if(_221==null){
item.properties[_220[2]].nullable=true;
}
}else{
if(item.properties[_220[2]].extractedFromCode&&item.properties[_220[2]].defValStr!=_220[3]&&item.properties[_220[2]].extraDef.indexOf(_220[3])==-1){
item.properties[_220[2]].extraDef.push(_220[3]);
}
}
}
}
if(this.checkGlobals){
if(v1=m2.match(this.vdrxg)){
v1=v1.collect(function(s){
return s.match(Projapi.Reflection.vdrx)[1].split(",");
}).flatten();
}else{
v1=[];
}
if(m[1].match(/\S/)){
v1=v1.concat(m[1].split(","));
}
v1=v1.collect(function(s){
return s.match(/^\s*([^\s=]+)/)[1];
}).uniq();
if(v2=m2.match(this.varxg)){
v2=v2.collect(function(s){
return s.match(Projapi.Reflection.varx)[1];
}).uniq();
}else{
v2=[];
}
for(_21d=v2.length-1;_21d>=0;_21d--){
if(v1.indexOf(v2[_21d])>-1){
v2.splice(_21d,1);
}
}
if(v2.length>0){
console.warn(_219+"->"+name+" is using the global variables: "+v2.join(", "));
}
}
if(item.isSmartObject&&this.inlineParentCalls){
_225=m2;
if(_21d=_225.match(this.fcrxg)){
while(_21d.length>0){
_220=_21d[0].match(this.fcrx);
if(typeof eval(_220[1])=="function"&&_220[1].indexOf(".superclass.")>-1){
_221=String(eval(_220[1])).match(this.frx);
v1=(_220[2]?_220[2].split(","):[]);
v2=(_221[1]?_221[1].split(","):[]);
v1.shift();
str=[_21d[0].charAt(0),"for (;;) {\n"];
while(v2.length>0){
str.push("var ");
str.push(v2.shift());
if(v1.length>0){
str.push(" = ");
str.push(v1.shift());
}
str.push(";\n");
}
str.push(_221[2].replace(/\breturn\b/g,"break;"));
str.push("break;}");
str=str.join("");
while(_225.indexOf(_21d[0])>-1){
_225=_225.replace(_21d,str);
}
}
_21d.shift();
}
}
try{
eval("function() {"+_225+"}");
}
catch(e){
_225="";
console.log("Unable to inline super() call for "+_219+"->"+name+", exception: %o",e);
}
}
if(this.isolateMethods){
if(!_225){
_225=m2;
}
_225="try {\n"+_225+"} catch(e) {\n\tconsole.log('Error %o in "+_219+"->"+name+".', e);\n}\n";
}
if(this.profileEverything){
eval(["clss.prototype[name] = function(",m[1],") {\n","Projapi.Profiler.Start('",_226,"_",name,"');\n",(_225||m2).replace(/(^|[^)\s])(\s*)return\s*(?=[^\s{])([^;{}]+\s*)?(?=[;}])/g,"$1 $2 if(1) {if (arguments.callee._profiledName) Projapi.Profiler.Stop(arguments.callee._profiledName, Projapi.Reflection.var_str_auto_profiled); return $3;}").replace(/(\)\s*)return\s*(?=[^\s{])([^;{}]+\s*)?(?:[;}])/g,"$1 {if (arguments.callee._profiledName) Projapi.Profiler.Stop(arguments.callee._profiledName, Projapi.Reflection.var_str_auto_profiled); return $2;}"),"\nProjapi.Profiler.Stop(arguments.callee._profiledName, 'auto profiled');\n","}"].join(""));
clss.prototype[name]._profiledName=_226+"_"+name;
}else{
if(this.inlineParentCalls||this.isolateMethods){
eval(["clss.prototype[name] = function(",m[1],") {\n",(_225||m2),"}"].join(""));
}
}
clss.prototype[name].reflected=true;
}
}
if(item.isSmartObject){
_227.destroyObject();
for(name in item.properties){
if(item.properties[name].extractedFromCode&&item.properties[name].extraDef.length>0){
console.warn("The class "+_219+" has different default values for the property "+_220[2]+": "+item.properties[name].defValStr+", "+item.properties[name].extraDef.join(", ")+".");
}
}
}
return item;
},processExplored:function(_22b){
var item,_22d,_22e,i;
for(_22d in _22b){
if(!{}[_22d]){
item=_22b[_22d];
_22e=item.classRef.superclass;
if(_22e){
for(i in _22b){
if(_22b[i].classRef&&_22b[i].classRef.prototype==_22e){
item.parent=_22b[i];
break;
}
}
}
if(item.parent){
_22e=item.parent;
if(item.properties&&_22e.properties){
for(i in item.properties){
if(!{}[i]&&_22e.properties[i]){
item.properties[i].inherited=true;
}
}
}
}
}
}
return _22b;
},findClass:function(_230){
var _231=[],i,j;
for(i in this.explore()){
if(this.explore()[i].classRef&&_230 instanceof this.explore()[i].classRef){
_231.push(this.explore()[i]);
}
}
for(i=1;i<_231.length;i++){
while(_231[i].parent==_231[0]){
_231.splice(0,1);
i--;
}
for(j=0;j<i;j++){
if(_231[j].parent==_231[i]){
_231.splice(i,1);
i--;
break;
}
}
}
if(_231.length==1){
return _231[0];
}else{
if(_231.length==0){
return null;
}else{
return _231;
}
}
},findLinks:function(_234,_235){
var oa,sa,ob,sb;
if(typeof _234=="string"){
sa=_234;
oa=Projapi.Register.get(_234);
}else{
oa=_234;
sa=_234._objectName;
}
if(typeof _235=="string"){
sb=_235;
ob=Projapi.Register.get(_235);
}else{
ob=_235;
sb=_235._objectName;
}
var _23a,iter,_23c;
_23a=[];
_23c="";
_23c+=sa+" -> "+sb;
if(Projapi.Controller._indexed[sa]){
for(iter in Projapi.Controller._indexed[sa]){
if(Projapi.Controller._indexed[sa][iter] instanceof Array&&Projapi.Controller._indexed[sa][iter].pluck("_targetObject").indexOf(ob)>-1){
_23a.push(iter);
}
}
_23c+=" ("+_23a.length+")"+": "+_23a.join(", ")+".";
}else{
_23c+=" (0).";
}
console.log(_23c);
_23a=[];
_23c="";
_23c+=sb+" -> "+sa;
if(Projapi.Controller._indexed[sb]){
for(iter in Projapi.Controller._indexed[sb]){
if(Projapi.Controller._indexed[sb][iter] instanceof Array&&Projapi.Controller._indexed[sb][iter].pluck("_targetObject").indexOf(oa)>-1){
_23a.push(iter);
}
}
_23c+=" ("+_23a.length+")"+": "+_23a.join(", ")+".";
}else{
_23c+=" (0).";
}
console.log(_23c);
},getLinkTypes:function(){
var _23d={},obj=Projapi.Reflection.explore(),item=null,ln,lnk;
for(item in obj){
if(obj[item].links){
for(ln in obj[item].links){
if((lnk=obj[item].links[ln])&&lnk.source){
if(lnk.source.length>0){
if(!_23d[ln]){
_23d[ln]={Sources:[],Targets:[]};
}
_23d[ln].Targets.push(item);
}
if(lnk.target.length>0){
if(!_23d[ln]){
_23d[ln]={Sources:[],Targets:[]};
}
_23d[ln].Sources.push(item);
}
}
}
}
}
return _23d;
},findClassesWhichImplement:function(_242){
var list=[];
var cls=Projapi.Reflection.explore();
for(var i in cls){
if(cls[i].classRef&&cls[i].classRef.prototype[_242]&&(!cls[i].classRef.superclass||cls[i].classRef.prototype[_242]!=cls[i].classRef.superclass[_242])){
list.push(i);
}
}
return list.join(", ");
},getType:function(_246){
if(_246 instanceof Array){
return "array";
}
var cls=this.findClass(_246);
if(!cls){
cls=typeof _246;
}
return cls;
},getAsJS:function(_248,_249){
if(_248==null){
return "null";
}
if(typeof _249=="undefined"){
_249="";
}
var _24a;
if(_249==null){
_24a=null;
}else{
_24a=_249+"  ";
}
var cls=this.findClass(_248),i;
if(cls){
var str=["new "],_24e=true;
str.push(cls.qualifiedClassName);
str.push("(\"");
str.push(_248.getObjectName());
str.push("\",");
str.push("{");
var str2=[],targ,_251;
for(propName in cls.properties){
if(!{}[propName]){
_251=_248.getProperty(propName,null);
if(typeof _251=="object"&&_251!=null){
targ=str2;
}else{
targ=str;
if(_24e){
_24e=false;
}else{
str.push(", ");
}
}
targ.push("\n");
targ.push(_249);
targ.push("\"");
targ.push(String(propName).replace(/\\/g,"\\\\").replace(/"/g,"\\\""));
targ.push("\": ");
targ.push(this.getAsJS(_248.getProperty(propName,null),_24a));
}
}
if(str2.length>0){
if(str.last()!="{"){
str.push(", ");
}
str=str.concat(str2);
}
str.push("\n");
str.push(_249);
str.push("});");
return str.join("");
}else{
switch(typeof _248){
case "string":
return "\""+_248.replace(/\\/g,"\\\\").replace(/"/g,"\\\"")+"\"";
case "boolean":
case "number":
return String(_248);
case "function":
return "null";
case "object":
var str=[];
if(_248 instanceof Array){
str.push("[");
if(_248.length>0){
str.push("\n");
str.push(_249);
str.push(this.getAsJS(_248[0],_24a));
for(i=1;i<_248.length;i++){
str.push(", \n");
str.push(_249);
str.push(this.getAsJS(_248[i],_24a));
}
}
str.push("\n");
str.push(_249);
str.push("]");
}else{
str.push("{");
for(i in _248){
if(!{}[i]){
if(str.length>1){
str.push(", ");
}
str.push("\n");
str.push(_249);
str.push("\"");
str.push(String(i).replace(/\\/g,"\\\\").replace(/"/g,"\\\""));
str.push("\": ");
str.push(this.getAsJS(_248[i],_24a));
}
}
str.push("\n");
str.push(_249);
str.push("}");
}
str=str.join("");
var str2=str.replace(eval("/\\n"+_249+"/g"),"");
if(str2.length<80){
return str2;
}
return str;
default:
console.warn("Unhandled type for: %o",_248);
break;
}
}
},getAsXML:function(_252){
return "Not implemented";
},objectEditors:[],editObject:function(_253){
if(this.objectEditors.length==0){
this.objectEditors.push(Projapi.Reflection.ObjectEditor.createInstance());
}
var ed=this.objectEditors.last();
ed.beginEdit(_253);
},editObjectWithNewEditor:function(_255){
this.objectEditors.push(Projapi.Reflection.ObjectEditor.createInstance());
this.editObject(_255);
}};
Projapi.Reflection.ObjectEditor=function(_256,_257){
_257=Object.extend({closeCallback:this.destroyObject.bind(this),onViewObjectExecute:null},_257);
Projapi.Reflection.ObjectEditor.superclass.constructor.call(this,_256,_257);
this._properties=Object.extend(_257,this._properties);
this._targetObject=null;
this._targetClass=null;
this._emptyMsg=null;
this._dynObj=[];
this.__destroying=false;
this._history=[];
this._historyIndex=-1;
this.NavigationSourceEvents=[Projapi.Links.Navigation.FetchFirst,Projapi.Links.Navigation.FetchNext,Projapi.Links.Navigation.FetchPrev,Projapi.Links.Navigation.FetchLast];
};
Projapi.extend(Projapi.Reflection.ObjectEditor,Projapi.Widgets.PJSmartWindow);
Projapi.Reflection.ObjectEditor.createInstance=function(){
var i=1,_259="_generated_ObjectEditor",_25a={title:"Object Editor",closeOnOK:false,closeOnCancel:false,hideOnInit:true,layout:"TableLayout",layoutTableRows:3,layoutTableCols:3,layoutCellSpacing:0,width:250,windowType:"internal"};
while(Projapi.Register.get(_259+i)){
i++;
}
var inst=new Projapi.Reflection.ObjectEditor(_259+i,_25a);
inst.createObjects();
inst.initializeObject();
return inst;
};
Projapi.Reflection.ObjectEditor.prototype.setTargetObject=function(_25c,_25d){
if(this._targetObject){
this.removeTargetObject();
}
this._targetObject=_25c;
this.publish(Projapi.Links.Navigation.QueryPosition,this.getQueryPosition());
if(this._targetObject){
this._emptyMsg._properties.hide=true;
this._emptyMsg.hideObject();
this._targetClass=(typeof _25d!="undefined"&&_25d)?_25d:Projapi.Reflection.findClass(this._targetObject);
if(this._targetObject instanceof Projapi.Base.iPJSmartObject){
this._editType="SmartObject";
this.setTitle(this._targetObject._objectName);
}else{
this._editType=this._targetClass;
this.setTitle(this._editType);
}
this._prepareForEdit();
}
};
Projapi.Reflection.ObjectEditor.prototype.removeTargetObject=function(){
this._targetObject=null;
this._emptyMsg._properties.hide=false;
this._emptyMsg.viewObject();
this.setTitle("Object Editor");
var i;
for(i=0;i<this._dynObj.length;i++){
this._dynObj[i].destroyObject();
}
this._dynObj=[];
};
Projapi.Reflection.ObjectEditor.prototype.createObjects=function(){
this._emptyMsg=new Projapi.Widgets.PJLabel(this._objectName+"_noTargetObjectMsg",{layoutRow:1,layoutCol:0,layoutColSpan:3,label:"No object selected"});
this.addLink(Projapi.Links.Container.CreateObjects,this._emptyMsg);
this._PJObjectSelector=new Projapi.Widgets.PJField(this._objectName+"_selector",{layoutRow:0,layoutCol:0,layoutColSpan:3,size:1,viewAs:"Combofield",value:"",valueOptions:this._getValueOptionsForSelector()});
this._PJObjectSelector.addLink(Projapi.Links.Action.ValueChanged,this);
this.addLink(Projapi.Links.Container.CreateObjects,this._PJObjectSelector);
var _25f=new Projapi.Widgets.PJToolbar(this._objectName+"_toolbar",{});
var _260=new Projapi.Widgets.PJNavigationToolbar(this._objectName+"_nav",{first:{"label":"First"},prev:{"label":"Back"},next:{"label":"Next"},last:{"label":"Last"}});
_25f.addLink(Projapi.Links.Container.CreateObjects,_260);
_260.addLink(Projapi.Links.Navigation,this);
_25f.addLink(Projapi.Links.Container.CreateObjects,new Projapi.Widgets.PJToolButton(this._objectName+"_JSbtn",{label:"Get JS",tooltip:"View the JS commands to generate this object",onClickExecute:(function(){
var s=Projapi.Reflection.getAsJS(this._targetObject);
console.log(s);
alert(s.replace(/\n\s*/g," "));
}).bind(this)}));
_25f.addLink(Projapi.Links.Container.CreateObjects,new Projapi.Widgets.PJToolButton(this._objectName+"_XMLbtn",{label:"Get XML",tooltip:"View the XML text to generate this object",onClickExecute:(function(){
var s=Projapi.Reflection.getAsXML(this._targetObject);
console.log(s);
alert(s.replace(/\n\s*/g," "));
}).bind(this)}));
_25f.addLink(Projapi.Links.Container.CreateObjects,this._addBtn=new Projapi.Widgets.PJToolButton(this._objectName+"_AddBtn",{image:Projapi.Theme.PJUpdateToolbarAddImage,disabledImage:Projapi.Theme.PJUpdateToolbarAddImageDisabled,hooverImage:Projapi.Theme.PJUpdateToolbarAddImageHoover,label:"Add",tooltip:"Add a new field",hotkey:"INS",disableOnInit:true,onClickExecute:(function(){
this.addNewProperty();
}).bind(this)}));
this.addLink(Projapi.Links.Container.CreateObjects,_25f);
Projapi.Reflection.ObjectEditor.superclass.createObjects.call(this);
};
Projapi.Reflection.ObjectEditor.prototype.initializeObject=function(){
Projapi.Reflection.ObjectEditor.superclass.initializeObject.call(this);
this.publish(Projapi.Links.Navigation.QueryPosition,"NoRecordAvailable");
};
Projapi.Reflection.ObjectEditor.prototype.getQueryPosition=function(){
if(this._history.length==0){
return "NoRecordAvailable";
}else{
if(this._history.length==1){
return "OnlyRecordAvailable";
}else{
if(this._historyIndex==0){
return "FirstRecord";
}else{
if(this._historyIndex==this._history.length-1){
return "LastRecord";
}else{
return "NotFirstOrLast";
}
}
}
}
};
Projapi.Reflection.ObjectEditor.prototype.fetchFirst=function(){
this._historyIndex=0;
this.setTargetObject(this._history[this._historyIndex]);
};
Projapi.Reflection.ObjectEditor.prototype.fetchPrev=function(){
this._historyIndex--;
this.setTargetObject(this._history[this._historyIndex]);
};
Projapi.Reflection.ObjectEditor.prototype.fetchNext=function(){
this._historyIndex++;
this.setTargetObject(this._history[this._historyIndex]);
};
Projapi.Reflection.ObjectEditor.prototype.fetchLast=function(){
this._historyIndex=this._history.length-1;
this.setTargetObject(this._history[this._historyIndex]);
};
Projapi.Reflection.ObjectEditor.prototype.viewObject=function(){
Projapi.Reflection.ObjectEditor.superclass.viewObject.call(this);
if(this._properties.onViewObjectExecute){
this._properties.onViewObjectExecute(this);
}
};
Projapi.Reflection.ObjectEditor.prototype.destroyObject=function(){
if(this.__destroying){
return;
}
this.__destroying=true;
Projapi.Reflection.objectEditors=Projapi.Reflection.objectEditors.without(this);
Projapi.Reflection.ObjectEditor.superclass.destroyObject.call(this);
};
Projapi.Reflection.ObjectEditor.prototype._adjustSelects=function(){
var i,node;
this._PJObjectSelector.getDOMNode().domNode.getElementsByTagName("select")[0].style.width=this._toolbar.getDOMNode().domNode.offsetWidth-20+"px";
for(i=0;i<this._dynObj.length;i++){
if(this._dynObj[i] instanceof Projapi.Reflection.ObjectEditor.LinkEditor){
node=this._dynObj[i].objects[0].getDOMNode().domNode.getElementsByTagName("select");
if(node.length>0){
node[0].style.width="200px";
}
}
}
};
Projapi.Reflection.ObjectEditor.prototype.resize=function(){
this._adjustSelects();
Projapi.Reflection.ObjectEditor.superclass.resize.call(this);
};
Projapi.Reflection.ObjectEditor.prototype.beginEdit=function(_265){
if(typeof _265=="string"){
_265=Projapi.Register.get(_265);
}
if(_265!=this._targetObject){
this._historyIndex=this._history.length;
this._history[this._historyIndex]=_265;
this.setTargetObject(_265);
}
this.viewObject();
};
Projapi.Reflection.ObjectEditor.prototype.setTitle=function(_266){
this._properties.title=_266;
if(this._internalWindow){
this._internalWindow.setTitle(_266);
}else{
document.title=_266;
}
};
Projapi.Reflection.ObjectEditor.prototype.setOnViewObjectExecute=function(fct){
this._properties.onViewObjectExecute=fct;
};
Projapi.Reflection.ObjectEditor.prototype.valueChanged=function(obj,_269){
if(_269=="_"){
return;
}
if(!_269){
return;
}
console.log("editing "+_269);
var _26a=Projapi.Register.get(_269);
if(!_26a){
this._PJObjectSelector.setValueOptions(this._getValueOptionsForSelector());
this._PJObjectSelector.setObjectValue(this._targetObject._objectName);
}else{
this.beginEdit(_26a);
}
};
Projapi.Reflection.ObjectEditor.prototype._getValueOptionsForSelector=function(){
var _26b={},i,obj,_26e=true;
for(i=0;i<Projapi.Register._objectRegister.length;i++){
obj=Projapi.Register._objectRegister[i];
if(obj.getObjectName().match(/(\b|_)generated(\b|_)/)){
continue;
}
_26e=false;
_26b[obj.getObjectName()]=obj.getObjectName()+" ("+Projapi.Reflection.findClass(obj).className+")";
}
if(_26e){
_26b["_"]="None available";
}
return _26b;
};
Projapi.Reflection.ObjectEditor.prototype._prepareForEdit=function(){
var _26f=3,_270,idx=_26f;
if(this._editType!="SmartObject"){
if(["array","object","dictionary"].indexOf(this._editType)==-1){
this._addBtn.disableObject();
}else{
this._addBtn.enableObject();
}
this._PJObjectSelector.disableObject();
this._PJObjectSelector.hideObject();
}else{
this._addBtn.disableObject();
this._PJObjectSelector.enableObject();
this._PJObjectSelector.viewObject();
this._PJObjectSelector.setValueOptions(this._getValueOptionsForSelector());
this._PJObjectSelector.setObjectValue(this._targetObject._objectName);
}
switch(this._editType){
case "SmartObject":
if(this._internalWindow.width<350){
this._internalWindow.setSize(350,this._internalWindow.height);
}
var fld;
if(fld=$P(this._objectName+"_folder")){
fld.destroyObject();
}
fld=new Projapi.Widgets.PJSmartFolder(this._objectName+"_folder",{layout:"TableLayout",layoutTableRows:0,layoutTableCols:2,layoutCellSpacing:5,layoutRow:3,layoutCol:0,layoutColSpan:3});
fld._windowName=this._windowName;
fld.addPage("0",Projapi.Layout.TableLayout,"Properties");
fld.addPage("1",Projapi.Layout.TableLayout,"Messages");
fld.addPage("2",Projapi.Layout.TableLayout,"Links");
idx=0;
for(_270 in this._targetClass.properties){
if(this._targetClass.properties[_270].type){
this._dynObj.push(new Projapi.Reflection.ObjectEditor.PropertyEditor(this,_270,this._targetClass.properties[_270],idx++,{container:fld,objectPage:0}));
}
}
if(idx){
fld._titles[0]="Properties ("+idx+")";
}else{
fld._titles[0]="Properties -";
}
idx=0;
for(_270 in this._targetClass.messages){
if(!{}[_270]){
this._dynObj.push(new Projapi.Reflection.ObjectEditor.MessageEditor(this,_270,idx++,{container:fld,objectPage:1}));
}
}
if(idx){
fld._titles[1]="Messages ("+idx+")";
}else{
fld._titles[1]="Messages -";
}
idx=0;
for(_270 in this._targetClass.links){
if(this._targetClass.links[_270].source&&this._targetClass.links[_270].target){
if((this._targetClass.links[_270].source.indexOf("add")>-1)||(this._targetClass.links[_270].source.indexOf("set")>-1)){
this._dynObj.push(new Projapi.Reflection.ObjectEditor.LinkEditor(this,_270,"Source",idx++,{container:fld,objectPage:2,single:(this._targetClass.links[_270].source.indexOf("set")>-1),rIdx:this._dynObj.length}));
if(this._targetClass.links[_270].source.indexOf("add")>-1){
idx++;
}
}
if((this._targetClass.links[_270].target.indexOf("add")>-1)||(this._targetClass.links[_270].target.indexOf("set")>-1)){
this._dynObj.push(new Projapi.Reflection.ObjectEditor.LinkEditor(this,_270,"Target",idx++,{container:fld,objectPage:2,single:(this._targetClass.links[_270].target.indexOf("set")>-1),rIdx:this._dynObj.length}));
if(this._targetClass.links[_270].target.indexOf("add")>-1){
idx++;
}
}
}
}
if(idx){
fld._titles[2]="Links ("+idx+")";
}else{
fld._titles[2]="Links -";
}
this.addLink(Projapi.Links.Container.CreateObjects,fld);
this._dynObj.push(fld);
if(this._objectInitialized){
this._adjustSelects();
}
break;
case "array":
for(idx=0;idx<this._targetObject.length;idx++){
this._dynObj.push(new Projapi.Reflection.ObjectEditor.PropertyEditor(this,idx,Projapi.Reflection.getType(this._targetObject[idx]),idx+_26f));
}
break;
case "dictionary":
case "object":
for(_270 in this._targetObject){
if(!{}[_270]){
this._dynObj.push(new Projapi.Reflection.ObjectEditor.PropertyEditor(this,_270,Projapi.Reflection.getType(this._targetObject[_270]),idx++));
}
}
break;
default:
break;
}
};
Projapi.Reflection.ObjectEditor.prototype.getQualifiedPropName=function(_273){
switch(this._editType){
case "array":
return this._properties.title+"["+_273+"]";
case "dictionary":
return this._properties.title+"."+_273;
default:
return this._properties.title+"->"+_273;
}
};
Projapi.Reflection.ObjectEditor.prototype.getSnippet=function(){
switch(this._editType){
case "array":
return "["+this._targetObject.length+"]";
case "dictionary":
return "(dictionary)";
case "SmartObject":
return "("+this._targetClass.className+")";
default:
return "("+this._editType+")";
}
};
Projapi.Reflection.ObjectEditor.prototype.addNewProperty=function(){
var idx;
switch(this._editType){
case "array":
var obj={};
if(this._targetObject.length>0&&this._targetObject[0].constructor){
obj=this._targetObject[0].constructor();
}
this._targetObject.push(obj);
this._dynObj.push(new Projapi.Reflection.ObjectEditor.PropertyEditor(this,this._targetObject.length-1,Projapi.Reflection.getType(this._targetObject[idx]),this._targetObject.length+2));
break;
case "dictionary":
case "object":
alert("Not implemented");
break;
default:
return;
}
};
Projapi.Reflection.ObjectEditor.prototype.getTargetProperty=function(_276,_277){
var val;
if(this._targetObject.getProperty){
val=this._targetObject.getProperty(_276,_277);
}else{
val=this._targetObject[_276];
}
if(typeof val=="undefined"){
val=_277;
}
return val;
};
Projapi.Reflection.ObjectEditor.prototype.updateTargetProperty=function(_279,_27a){
switch(this._editType){
case "array":
case "dictionary":
this._targetObject[_279]=_27a;
break;
case "SmartObject":
this._targetObject.setProperty(_279,_27a);
default:
return (this._targetObject.setProperty)?this._targetObject.setProperty(_279,_27a):this._targetObject[_279]=_27a;
}
};
Projapi.Reflection.ObjectEditor.prototype.removeTargetProperty=function(_27b,_27c){
switch(this._editType){
case "array":
if(typeof _27c=="string"){
_27c=parseInt(_27c);
}
if(this._targetObject.length<=_27c){
return false;
}
this._targetObject.splice(_27c,1);
this._dynObj=this._dynObj.without(_27b);
_27b.destroyObject();
var i;
for(i=0;i<this._dynObj.length;i++){
if(this._dynObj[i] instanceof Projapi.Reflection.ObjectEditor.PropertyEditor&&this._dynObj[i].propName>=_27c){
this._dynObj[i].updatePropName(this._dynObj[i].propName-1);
}
}
return true;
break;
case "dictionary":
case "object":
if(typeof this._targetObject[_27c]!="undefined"){
delete this._targetObject[_27c];
}
this._dynObj=this._dynObj.without(_27b);
_27b.destroyObject();
return true;
break;
default:
return false;
}
};
Projapi.Reflection.ObjectEditor.PropertyEditor=function(_27e,_27f,_280,_281,_282){
this.owner=_27e;
this.ownerName=_27e._objectName;
this._targetObject=this.owner._targetObject;
this.propName=_27f;
this.objects=[];
this.nullable=!!_280.nullable;
this.pp=this._string;
this._propInfo=(typeof _280=="string")?{type:_280}:_280;
var _283=_27f;
if(_27e._editType=="array"&&parseInt(_27f)==_27f){
_283="["+_27f+"]";
}
if(typeof _282=="undefined"){
_282={};
}
if(!_282.objectPage){
_282.objectPage=0;
}
if(!_282.container){
_282.container=_27e;
}
var size=20;
if(_282.container!=_27e){
size+=10;
}
var fld=null,fld1=null,tmp;
var _288=function(wnd){
var _28a=_27e.getDOMNode().domNode,_28b=fld.getDOMNode().domNode,node=wnd.getDOMNode().domNode;
var _28d=Position.cumulativeOffset(_28a);
var _28e=Position.cumulativeOffset(_28b);
var x=_28d[0]+_28a.offsetWidth;
if(x+node.offsetWidth>document.body.offsetWidth){
x=_28d[0]-node.offsetWidth;
}
if(x<0){
x=0;
}
var y=_28e[1];
if(y+node.offsetHeight>document.body.offsetHeight){
y=document.body.offsetHeight-node.offsetHeight;
}
if(y<0){
y=0;
}
node=wnd.getDOMNode();
node.setX(x);
node.setY(y);
};
this.objects.addAndHandle=function(_291,_292){
this.push(_291);
_291._windowName=_292._windowName;
_292.addLink(Projapi.Links.Container.CreateObjects,_291);
if(_292._objectCreated){
_291.createObjects();
}
if(_292._objectInitialized){
_291.initializeObject();
}
};
switch(this._propInfo.type){
case "boolean":
fld=new Projapi.Widgets.PJField(this.ownerName+"_dynFld_"+_282.objectPage+"-"+_281,{layoutRow:_281,layoutCol:1,labelAlign:"LEFT",size:1,viewAs:"Combofield",value:[false,true].indexOf(this.owner.getTargetProperty(_27f,false))+"",label:_283,disableOnInit:!!this._propInfo.readOnly,valueOptions:{"0":"false","1":"true"},objectPage:_282.objectPage});
fld.addLink(Projapi.Links.Action.ValueChanged,this);
this.pp=this._boolean;
break;
case "number":
fld=new Projapi.Widgets.PJField(this.ownerName+"_dynFld_"+_282.objectPage+"-"+_281,{layoutRow:_281,layoutCol:1,label:_283,labelAlign:"LEFT",size:size,viewAs:"Textfield",value:String(this.owner.getTargetProperty(_27f,null)),disableOnInit:!!this._propInfo.readOnly,objectPage:_282.objectPage});
fld.addLink(Projapi.Links.Action.ValueChanged,this);
this.pp=this._number;
break;
case "string":
fld=new Projapi.Widgets.PJField(this.ownerName+"_dynFld_"+_282.objectPage+"-"+_281,{layoutRow:_281,layoutCol:1,label:_283,labelAlign:"LEFT",size:size,viewAs:"Textfield",value:this.owner.getTargetProperty(_27f,null),disableOnInit:!!this._propInfo.readOnly,objectPage:_282.objectPage});
fld.addLink(Projapi.Links.Action.ValueChanged,this);
break;
case "array":
fld=new Projapi.Widgets.PJField(this.ownerName+"_dynFld_"+_282.objectPage+"-"+_281,{layoutRow:_281,layoutCol:1,label:_283,labelAlign:"LEFT",size:size-3,viewAs:"Textfield",value:"["+this.owner.getTargetProperty(_27f,[]).length+"]",disableOnInit:!!this._propInfo.readOnly,objectPage:_282.objectPage,fkWindowName:function(){
var wnd=Projapi.Reflection.ObjectEditor.createInstance();
wnd.setTargetObject(_27e.getTargetProperty(_27f,[]),"array");
wnd.setTitle(_27e.getQualifiedPropName(_27f));
wnd.setOnViewObjectExecute(_288);
return wnd;
}});
break;
case "dictionary":
fld=new Projapi.Widgets.PJField(this.ownerName+"_dynFld_"+_282.objectPage+"-"+_281,{layoutRow:_281,layoutCol:1,label:_283,labelAlign:"LEFT",size:size-3,viewAs:"Textfield",value:"(dictionary)",disableOnInit:!!this._propInfo.readOnly,objectPage:_282.objectPage,fkWindowName:function(){
var wnd=Projapi.Reflection.ObjectEditor.createInstance();
wnd.setTargetObject(_27e.getTargetProperty(_27f,{}),"dictionary");
wnd.setTitle(_27e.getQualifiedPropName(_27f));
wnd.setOnViewObjectExecute(_288);
return wnd;
}});
break;
case "object":
if(this._propInfo.isSmartObject){
fld=new Projapi.Widgets.PJField(this.ownerName+"_dynFld_"+_282.objectPage+"-"+_281,{layoutRow:_281,layoutCol:1,label:_283,labelAlign:"LEFT",size:size-3,viewAs:"Textfield",value:"("+this._propInfo.className+")",disableOnInit:!!this._propInfo.readOnly,objectPage:_282.objectPage,fkWindowName:function(){
var wnd=Projapi.Reflection.ObjectEditor.createInstance();
wnd.setTargetObject(_27e.getTargetProperty(_27f,null));
wnd.setTitle(_27e.getQualifiedPropName(_27f));
wnd.setOnViewObjectExecute(_288);
return wnd;
}});
}else{
fld=new Projapi.Widgets.PJField(this.ownerName+"_dynFld_"+_282.objectPage+"-"+_281,{layoutRow:_281,layoutCol:1,label:_283,labelAlign:"LEFT",size:size-3,viewAs:"Textfield",value:"(object)",disableOnInit:!!this._propInfo.readOnly,objectPage:_282.objectPage,fkWindowName:function(){
var wnd=Projapi.Reflection.ObjectEditor.createInstance();
wnd.setTargetObject(_27e.getTargetProperty(_27f,{}),"object");
wnd.setTitle(_27e.getQualifiedPropName(_27f));
wnd.setOnViewObjectExecute(_288);
return wnd;
}});
}
break;
default:
break;
}
if(!fld){
fld=new Projapi.Widgets.PJLabel(this._objectName+"_dynLbl_"+_282.objectPage+"-"+_281,{layoutRow:_281,layoutCol:0,layoutColSpan:1,label:_27f,objectPage:_282.objectPage});
fld1=new Projapi.Widgets.PJLabel(this._objectName+"_dynTct_"+_282.objectPage+"-"+_281,{layoutRow:_281,layoutCol:1,layoutColSpan:1,align:"left",label:"("+this._propInfo.type+")",objectPage:_282.objectPage});
this.objects.addAndHandle(fld1,_282.container);
}
this.field=fld;
this.objects.addAndHandle(this.field,_282.container);
if(["array","dictionary","object"].indexOf(this.owner._editType)>-1){
var _297=new Projapi.Widgets.PJButton("remove_"+fld._objectName,{layoutRow:_281,layoutCol:2,objectPage:_282.objectPage,label:" - ",onClickExecute:(function(){
_27e.removeTargetProperty(this,this.propName);
}).bind(this)});
this.objects.addAndHandle(_297,_282.container);
}
};
Projapi.Reflection.ObjectEditor.PropertyEditor.prototype.destroyObject=function(){
var i;
for(i=0;i<this.objects.length;i++){
this.objects[i].destroyObject();
}
};
Projapi.Reflection.ObjectEditor.PropertyEditor.prototype.valueChanged=function(obj,_29a){
var val=this.pp(_29a);
this.owner.updateTargetProperty(this.propName,val);
obj.setObjectValue(String(val));
console.log("%s: %s",this.propName,_29a);
};
Projapi.Reflection.ObjectEditor.PropertyEditor.prototype.updatePropName=function(_29c){
this.propName=_29c;
var _29d=this.propName;
if(this.owner._editType=="array"&&parseInt(this.propName)==this.propName){
_29d="["+this.propName+"]";
}
var lbl=this.field._label||this.field;
if(lbl instanceof Projapi.Widgets.PJLabel){
lbl.setObjectValue(_29d);
}
};
Projapi.Reflection.ObjectEditor.PropertyEditor.prototype._boolean=function(_29f){
if(_29f=="1"||_29f=="true"||_29f==1||_29f==true){
return true;
}
return false;
};
Projapi.Reflection.ObjectEditor.PropertyEditor.prototype._number=function(_2a0){
if(_2a0==""){
if(this.nullable){
return null;
}else{
return 0;
}
}
return parseFloat(_2a0);
};
Projapi.Reflection.ObjectEditor.PropertyEditor.prototype._string=function(_2a1){
if(_2a1==""&&this.nullable){
return null;
}
return _2a1;
};
Projapi.Reflection.ObjectEditor.LinkEditor=function(_2a2,_2a3,_2a4,_2a5,_2a6){
this.owner=_2a2;
this.ownerName=_2a2._objectName;
this._targetObject=this.owner._targetObject;
this.linkName=_2a3;
this.direction=_2a4;
this.single=true;
if(typeof _2a6.single!="undefined"){
this.single=!!_2a6.single;
}
this.objects=[];
this.rIdx=_2a6.rIdx;
if(typeof _2a6=="undefined"){
_2a6={};
}
if(!_2a6.objectPage){
_2a6.objectPage=0;
}
if(!_2a6.container){
_2a6.container=_2a2;
}
var opts=this.listedOptions=this.getValueOptions();
fld=new Projapi.Widgets.PJField(this.ownerName+"_dynFld_"+_2a6.objectPage+"-"+_2a5,{layoutRow:_2a5,layoutCol:1,label:_2a3+" ("+_2a4+")",labelAlign:"LEFT",size:1,viewAs:"Combofield",value:this.getValueId(opts),valueOptions:opts,objectPage:_2a6.objectPage});
fld.addLink(Projapi.Links.Action.ValueChanged,this);
this.objects.push(fld);
fld._windowName=_2a6.container._windowName;
_2a6.container.addLink(Projapi.Links.Container.CreateObjects,fld);
if(_2a6.container._objectCreated){
fld.createObjects();
}
if(_2a6.container._objectInitialized){
fld.initializeObject();
}
if(!this.single){
var lbl;
lbl=new Projapi.Widgets.PJLabel(this.ownerName+"_dynFld_"+_2a6.objectPage+"-"+_2a5+"a",{layoutRow:_2a5+1,layoutCol:0,layoutColSpan:1,align:"left",label:this.linkName+" "+this.direction.toLowerCase()+"s:",objectPage:_2a6.objectPage});
this.objects.push(lbl);
lbl._windowName=_2a6.container._windowName;
_2a6.container.addLink(Projapi.Links.Container.CreateObjects,lbl);
if(_2a6.container._objectCreated){
lbl.createObjects();
}
if(_2a6.container._objectInitialized){
lbl.initializeObject();
}
this._listLbl=lbl=new Projapi.Widgets.PJHTMLBlock(this.ownerName+"_dynFld_"+_2a6.objectPage+"-"+_2a5+"b",{layoutRow:_2a5+1,layoutCol:1,layoutColSpan:1,align:"left",content:this.updateLabel(),objectPage:_2a6.objectPage});
this.objects.push(lbl);
lbl._windowName=_2a6.container._windowName;
_2a6.container.addLink(Projapi.Links.Container.CreateObjects,lbl);
if(_2a6.container._objectCreated){
lbl.createObjects();
}
if(_2a6.container._objectInitialized){
lbl.initializeObject();
}
}
};
Projapi.Reflection.ObjectEditor.LinkEditor.prototype.destroyObject=function(){
var i;
for(i=0;i<this.objects.length;i++){
this.objects[i].destroyObject();
}
};
Projapi.Reflection.ObjectEditor.LinkEditor.prototype.valueChanged=function(obj,_2ab){
var obj1;
if(_2ab!="_"){
obj1=Projapi.Register.get(_2ab);
if(!obj1){
this.refreshOptions();
this.updateLabel();
return;
}else{
if(this.single){
this._targetObject["set"+this.linkName+this.direction](obj1);
}else{
this._targetObject["add"+this.linkName+this.direction](obj1);
this.updateLabel();
}
}
}else{
if(this.single){
this._targetObject["set"+this.linkName+this.direction](null);
}
}
obj.setValueOptions(this.getValueOptions());
if(this.single){
obj.setObjectValue(_2ab);
}else{
obj.setObjectValue("_");
}
console.log("%s: %s",this.linkName,_2ab);
};
Projapi.Reflection.ObjectEditor.LinkEditor.prototype.getValueOptions=function(){
var _2ad={"_":"None"},i,obj,_2b0=[this._targetObject],_2b1=true;
if(!this.single){
_2ad["_"]="Add...";
}
var type=this.linkName+["Source","Target"][1-["Source","Target"].indexOf(this.direction)];
if(this.linkName!="Action"&&this._targetObject["get"+type]){
obj=this._targetObject["get"+type]();
if(obj){
if(obj instanceof Array){
_2b0=_2b0.concat(obj);
}else{
_2b0.push(obj);
}
}
}
if(!this.single){
obj=this._targetObject["get"+this.linkName+this.direction]();
if(obj){
if(obj instanceof Array){
_2b0=_2b0.concat(obj);
}else{
_2b0.push(obj);
}
}
}
for(i=0;i<Projapi.Register._objectRegister.length;i++){
obj=Projapi.Register._objectRegister[i];
if(_2b0.indexOf(obj)>-1){
continue;
}
if(obj.getObjectName().match(/(\b|_)generated(\b|_)/)){
continue;
}
if(obj["set"+type]||obj["add"+type]){
_2b1=false;
_2ad[obj.getObjectName()]=obj.getObjectName()+" ("+Projapi.Reflection.findClass(obj).className+")";
}
}
if(_2b1){
_2ad["_"]=(this.single)?"None available":"None left";
}
return _2ad;
};
Projapi.Reflection.ObjectEditor.LinkEditor.prototype.getValueId=function(_2b3){
if(this.single){
var obj=this._targetObject["get"+this.linkName+this.direction]();
if(obj){
return obj.getObjectName();
}
}
return "_";
};
Projapi.Reflection.ObjectEditor.LinkEditor.prototype.updateLabel=function(){
var str,lst=[],i,vec=this._targetObject["get"+this.linkName+this.direction]();
if(vec instanceof Array){
for(i=0;i<vec.length;i++){
lst.push(vec[i].getObjectName());
}
}else{
if(vec&&vec.getObjectName){
lst.push(vec.getObjectName());
}
}
if(lst.length==0){
str="none";
}else{
for(i=0;i<lst.length;i++){
lst[i]="<a href=\"#edit "+lst[i]+"\" onclick='Projapi.Register.get(\""+this.owner._objectName+"\").beginEdit(\""+lst[i]+"\"); false;' tooltip=\"edit "+lst[i]+"\">"+lst[i]+"</a>"+" <input type='button' class='pjButton' value='-' onclick='Projapi.Register.get(\""+this.owner._objectName+"\")._dynObj["+this.rIdx+"].removeLinked(\""+lst[i]+"\")'/>";
}
str=lst.join(", ");
}
if(this._listLbl){
this._listLbl.setContent(str);
}
return str;
};
Projapi.Reflection.ObjectEditor.LinkEditor.prototype.removeLinked=function(name){
if(typeof name=="string"){
name=Projapi.Register.get(name);
}
if(!name){
return;
}
this._targetObject.removeLink(this.linkName,name);
this.objects[0].setValueOptions(this.getValueOptions());
this.updateLabel();
};
Projapi.Reflection.ObjectEditor.MessageEditor=function(_2ba,_2bb,_2bc,_2bd){
this.owner=_2ba;
this.ownerName=_2ba._objectName;
this._targetObject=this.owner._targetObject;
this.msgName=_2bb;
this.objects=[];
if(typeof _2bd=="undefined"){
_2bd={};
}
if(!_2bd.objectPage){
_2bd.objectPage=0;
}
if(!_2bd.container){
_2bd.container=_2ba;
}
fld=new Projapi.Widgets.PJField(this.ownerName+"_dynFld_"+_2bd.objectPage+"-"+_2bc,{layoutRow:_2bc,layoutCol:1,label:_2bb,labelAlign:"LEFT",size:20,viewAs:"Textfield",value:this._targetObject.getMessage(_2bb),objectPage:_2bd.objectPage});
fld.addLink(Projapi.Links.Action.ValueChanged,this);
this.objects.push(fld);
fld._windowName=_2bd.container._windowName;
_2bd.container.addLink(Projapi.Links.Container.CreateObjects,fld);
if(_2bd.container._objectCreated){
fld.createObjects();
}
if(_2bd.container._objectInitialized){
fld.initializeObject();
}
};
Projapi.Reflection.ObjectEditor.MessageEditor.prototype.destroyObject=function(){
var i;
for(i=0;i<this.objects.length;i++){
this.objects[i].destroyObject();
}
};
Projapi.Reflection.ObjectEditor.MessageEditor.prototype.valueChanged=function(obj,_2c0){
this._targetObject._messageBundle[this.msgName]=_2c0;
obj.setObjectValue(_2c0);
console.log("%s: %s",this.msgName,_2c0);
this.upateList();
};
Array.prototype.getProperty=function(_2c1,_2c2,_2c3){
return (this.length>_2c1)?this[_2c1]:_2c2;
};

