/* ================================================================================ Desc: 今易软件JS函数库 Auth: Gianteasy http: www.gianteasy.com Date: 2004-08-05 ================================================================================ Copyright (C) 2004-2009 Gianteasy Corporation ================================================================================ */ function _GEXMLNodeArraySort(x,y){var _k=0;var _l=x.orderByArr;for(var i=0;i<_l.length;i++){var _m=_l[i];var _n=GEXMLHelper.getAttrAsStringNoCase(x.nodeObj,_m.o,'');var _o=GEXMLHelper.getAttrAsStringNoCase(y.nodeObj,_m.o,'');switch(_m.strDataType){case'double':{_n=GEConvert.StringToFloat(_n);_o=GEConvert.StringToFloat(_o);break;}case'date':{_n=GEConvert.StringToDateTime(_n);_o=GEConvert.StringToDateTime(_o);break;}default:{break;}}if(_n<_o)_k=-1;else if(_n>_o)_k=1;else _k=0;if(_k!=0){if(_m.strDirection!='asc'){if(_k==1)_k=-1;else _k=1;}break;}}return _k;};function GEXMLStruct(a,b){this._xmlDoc=null;if(a==null)this._strRootName='XMLStruct';else this._strRootName=a;this._constDefaultXML=" <{0}/>";this._constBaseInfoTagName="BaseInfo";this._constSubTableTagName="SubTable";this._constSecurityTagName="Security";this._constRecordRightTagName="RecordRight";this._constAliasAttrName="Alias";this._constTitleAttrName="Title";this._constDeleteIDAttrName="__deleteID";this._constIsModifyAttrName="__IsModify";this._constStateAttrName="__state";this._constFieldsTagName="fields";this._constDataTagName="data";this._constRecordTag="DataRow";if(b!=null){this.init(b);}}GEXMLStruct.prototype.toString=function(){return this._getXMLDoc().xml;};GEXMLStruct.prototype.toXMLString=function(){return GEConvert.StringToXMLString(this._getXMLDoc().xml);};GEXMLStruct.prototype.alertXML=function(){alert(this._getXMLDoc().xml);};GEXMLStruct.prototype._getXMLDoc=function(){if(this._xmlDoc==null){this._xmlDoc=GEXMLHelper.createXMLDoc();var b=GEUtil.StringFormat(this._constDefaultXML,this._strRootName);this._xmlDoc.loadXML(b);this._getXMLRootNode().setAttribute("__IsNew","true");}return this._xmlDoc;};GEXMLStruct.prototype._getXMLRootNode=function(){return this._getXMLDoc().documentElement;};GEXMLStruct.prototype._getBaseInfoRootNode=function(c){return GEXMLHelper.findNode(this._getXMLRootNode(),this._constBaseInfoTagName,c);};GEXMLStruct.prototype._getSubTableRootNode=function(c){return GEXMLHelper.findNode(this._getXMLRootNode(),this._constSubTableTagName,c);};GEXMLStruct.prototype._getRecordRightNode=function(){return GEXMLHelper.findNode(this._getXMLRootNode(),this._constSecurityTagName+"|"+this._constRecordRightTagName,true);};GEXMLStruct.prototype._findBaseInfoNode=function(d,c){if(d!=null&&d.length>0)return GEXMLHelper.findNode(this._getXMLRootNode(),this._constBaseInfoTagName+"|"+d,c);return null;};GEXMLStruct.prototype.findTableNode=function(f,c){if(f!=null&&f.length>0)return GEXMLHelper.findNode(this._getXMLRootNode(),this._constSubTableTagName+"|"+f,c);return null;};GEXMLStruct.prototype.findBaseInfoDataNode=function(d,c){if(d!=null&&d.length>0)return GEXMLHelper.findNode(this._getXMLRootNode(),this._constBaseInfoTagName+"|"+d+"|"+this._constRecordTag,c);return null;};GEXMLStruct.prototype.findTableDataNode=function(f,c){if(f!=null&&f.length>0)return GEXMLHelper.findNode(this._getXMLRootNode(),this._constSubTableTagName+"|"+f+"|"+this._constDataTagName,c);return null;};GEXMLStruct.prototype.findBaseInfoFieldsNode=function(d,c){if(d!=null&&d.length>0)return GEXMLHelper.findNode(this._getXMLRootNode(),this._constBaseInfoTagName+"|"+d+"|"+this._constFieldsTagName,c);return null;};GEXMLStruct.prototype.findTableFieldsNode=function(f,c){if(f!=null&&f.length>0)return GEXMLHelper.findNode(this._getXMLRootNode(),this._constSubTableTagName+"|"+f+"|"+this._constFieldsTagName,c);return null;};GEXMLStruct.prototype.clear=function(){this._getXMLDoc().loadXML(GEUtil.StringFormat(this._constDefaultXML,this._strRootName));this._getXMLRootNode().setAttribute("__IsNew","true");};GEXMLStruct.prototype.init=function(b){var _p=false;if(b!=null){this._getXMLDoc().loadXML(b.toString());var _q=this._getXMLRootNode();if(_q!=null){this._strRootName=_q.nodeName;_p=true;}}if(!_p){this.clear();}return _p;};GEXMLStruct.prototype.isNew=function(){return GEXMLHelper.getAttrAsString(this._getXMLRootNode(),"__IsNew","false").toLowerCase()=="true";};GEXMLStruct.prototype.setNewState=function(g){this._getXMLRootNode().setAttribute("__IsNew",g?"true":"false");};GEXMLStruct.prototype.isOverdueData=function(){return GEXMLHelper.getAttrAsString(this._getXMLRootNode(),"__IsOverdueData","false").toLowerCase()=="true";};GEXMLStruct.prototype.setOverdueData=function(h){this._getXMLRootNode().setAttribute("__IsOverdueData",h?"true":"false");};GEXMLStruct.prototype.isEditRight=function(){var _r=this._getRecordRightNode();return GEXMLHelper.getAttrAsStringNoCase(_r,'IsEditRight','true').toLowerCase()=='true';};GEXMLStruct.prototype.isDelRight=function(){var _r=this._getRecordRightNode();return GEXMLHelper.getAttrAsStringNoCase(_r,'IsDelRight','false').toLowerCase()=='true';};GEXMLStruct.prototype.isPrintRight=function(){var _r=this._getRecordRightNode();return GEXMLHelper.getAttrAsStringNoCase(_r,'IsPrintRight','false').toLowerCase()=='true';};GEXMLStruct.prototype.isViewRight=function(){var _r=this._getRecordRightNode();return GEXMLHelper.getAttrAsStringNoCase(_r,'IsViewRight','true').toLowerCase()=='true';};GEXMLStruct.prototype.isManageRight=function(){var _r=this._getRecordRightNode();return GEXMLHelper.getAttrAsStringNoCase(_r,'IsManageRight','false').toLowerCase()=='true';};GEXMLStruct.prototype.isSupportWorkflow=function(){var _r=this._getRecordRightNode();return GEXMLHelper.getAttrAsStringNoCase(_r,'IsSupportWorkflow','false').toLowerCase()=='true';};GEXMLStruct.prototype.getWorkFlowState=function(){var _r=this._getRecordRightNode();return GEXMLHelper.getAttrAsStringNoCase(_r,'WorkFlowState','');};GEXMLStruct.prototype.isExistBaseInfo=function(k){if(k!=null){return this._findBaseInfoNode(k,false)!=null;}return false;};GEXMLStruct.prototype.setBaseInfoAlias=function(k,l){var _r=this._findBaseInfoNode(k,false);if(_r!=null){if(l==null||l.length<0)l="";_r.setAttribute(this._constAliasAttrName,l);return true;}return false;};GEXMLStruct.prototype.getBaseInfoAlias=function(k){var _r=this._findBaseInfoNode(k,false);if(_r!=null){return GEXMLHelper.getAttrAsString(_r,this._constAliasAttrName,_r.nodeName);}return'';};GEXMLStruct.prototype.setBaseInfoTitle=function(k,l){var _r=this._findBaseInfoNode(k,false);if(_r!=null){if(l==null||l.length<0)l="";_r.setAttribute(this._constTitleAttrName,l);return true;}return false;};GEXMLStruct.prototype.getBaseInfoTitle=function(k){var _r=this._findBaseInfoNode(k,false);if(_r!=null){return GEXMLHelper.getAttrAsString(_r,this._constTitleAttrName,_r.nodeName);}return'';};GEXMLStruct.prototype.isBaseInfoModify=function(m){var _s=this.findBaseInfoDataNode(m,false);if(_s!=null){return GEXMLHelper.getAttrAsString(_s,this._constIsModifyAttrName,"false").toLowerCase()=="true";}return false;};GEXMLStruct.prototype.removeBaseInfo=function(m){var _r=this._findBaseInfoNode(m,false);if(_r!=null){_r.parentNode.removeChild(_r);return true;}return false;};GEXMLStruct.prototype.enumBaseInfoNameList=function(){var _t="";var _u=this._getBaseInfoRootNode(true);if(_u!=null&&_u.childNodes.length>0){var _v=_u.childNodes.length;for(var i=0;i<_v;i++){if(_t.length>0)_t+="|";var _r=_u.childNodes.item(i);_t+=_r.nodeName;}}return _t;};GEXMLStruct.prototype.getBaseInfoToHas=function(m){var _r=this.findBaseInfoDataNode(m,false);if(_r!=null){return GEXMLHelper.xmlNodeAttrToHashtable(_r);}return null;};GEXMLStruct.prototype.setBaseInfoByHas=function(m,n){var _r=this.findBaseInfoDataNode(m,true);if(_r!=null){GEXMLHelper.setXmlNodeAttrByHashtableNoClear(_r,n);_r.setAttribute(this._constIsModifyAttrName,"true");return true}return false;};GEXMLStruct.prototype.getBaseInfoValue=function(m,o,p){if(m!=null&&o!=null){var _w=this.findBaseInfoDataNode(m,false);if(_w!=null){if(p==null)p='';var q=GEXMLHelper.getAttrAsStringNoCase(_w,o,p);return q;}}return"";};GEXMLStruct.prototype.setBaseInfoValue=function(m,o,q){if(m!=null&&o!=null&&q!=null){var _w=this.findBaseInfoDataNode(m,true);_w.setAttribute(o,q);_w.setAttribute(this._constIsModifyAttrName,"true");return true;}return false;};GEXMLStruct.prototype.removeBaseInfoValue=function(m,o){if(m!=null&&o!=null){var _w=this.findBaseInfoDataNode(m,false);if(_w!=null){var _x=GEConvert.StringToStringCollection(o);var _v=_x.count();for(var i=0;i<_v;i++){var _y=_x.items(i);if(_y!=null&&_y.length>0)_w.removeAttribute(_y);}return true;}}return false;};GEXMLStruct.prototype.getBaseInfoValueAsInt=function(m,o,r){var _z=parseInt(this.getBaseInfoValue(m,o,r.toString()));if(isNaN(_z)){return r;}return _z;};GEXMLStruct.prototype.setBaseInfoValueAsInt=function(m,o,s){return this.setBaseInfoValue(m,o,s.toString());};GEXMLStruct.prototype.getBaseInfoValueAsFloat=function(m,o,r){var _aa=parseFloat(this.getBaseInfoValue(m,o,r.toString()));if(isNaN(_aa)){return r;}return _aa;};GEXMLStruct.prototype.setBaseInfoValueAsFloat=function(m,o,s){return this.setBaseInfoValue(m,o,s.toString());};GEXMLStruct.prototype.getBaseInfoValueAsDate=function(m,o,r){var _ab=this.getBaseInfoValue(m,o,GEConvert.DateTimeToString(r));return GEConvert.StringToDateTime(_ab);};GEXMLStruct.prototype.setBaseInfoValueAsDate=function(m,o,s){return this.setBaseInfoValue(m,o,GEConvert.DateTimeToString(s));};GEXMLStruct.prototype.getBaseInfoValueAsBool=function(m,o,r){return this.getBaseInfoValue(m,o,r?'true':'false').toLowerCase()=="true";};GEXMLStruct.prototype.setBaseInfoValueAsBool=function(m,o,s){return this.setBaseInfoValue(m,o,s?"true":"false");};GEXMLStruct.prototype.getBaseInfoValueAsStringCollection=function(m,o,r){return GEConvert.StringToStringCollection(this.getBaseInfoValue(m,o,r));};GEXMLStruct.prototype.setBaseInfoValueAsStringCollection=function(m,o,s){return this.setBaseInfoValue(m,o,s.toString());};GEXMLStruct.prototype.getBaseInfoValueAsHas=function(m,o,r){return GEConvert.StringToHashtable(this.getBaseInfoValue(m,o,r));};GEXMLStruct.prototype.setBaseInfoValueAsHas=function(m,o,s){return this.setBaseInfoValue(m,o,s.toString());};GEXMLStruct.prototype.isExistTable=function(f){if(f!=null){return this.findTableNode(f,false)!=null;}return false;};GEXMLStruct.prototype.setTableAlias=function(f,l){var _r=this.findTableNode(f,false);if(_r!=null){if(l==null||l.length<0)l="";_r.setAttribute(this._constAliasAttrName,l);return true;}return false;};GEXMLStruct.prototype.getTableAlias=function(f){var _r=this.findTableNode(f,false);if(_r!=null){return GEXMLHelper.getAttrAsString(_r,this._constAliasAttrName,_r.nodeName);}return'';};GEXMLStruct.prototype.setTableTitle=function(f,l){var _r=this.findTableNode(f,false);if(_r!=null){if(l==null||l.length<0)l="";_r.setAttribute(this._constTitleAttrName,l);return true;}return false;};GEXMLStruct.prototype.getTableTitle=function(f){var _r=this.findTableNode(f,false);if(_r!=null){return GEXMLHelper.getAttrAsString(_r,this._constTitleAttrName,_r.nodeName);}return'';};GEXMLStruct.prototype.removeTable=function(f){var _r=this.findTableNode(f,false);if(_r!=null){_r.parentNode.removeChild(_r);return true;}return false;};GEXMLStruct.prototype.appendTable=function(t,u){if(t==null)return;if(typeof(t)=='string'){var b=t;t=new GEXMLStruct();t.init(b);}var _ac;if(u!=null&&u.length>0){_ac=GEConvert.StringToStringCollection(u);}else{_ac=GEConvert.StringToStringCollection(t.enumTableNameList());}if(_ac!=null&&_ac.count()>0){for(var i=0;i<_ac.count();i++){var l=_ac.items(i);var _ad=t.findTableNode(l);if(_ad!=null){var _ae=this.findTableNode(l,true);GEXMLHelper.copyChildNode(_ad,_ae,true);}}}};GEXMLStruct.prototype.enumTableNameList=function(){var _t="";var _u=this._getSubTableRootNode(true);if(_u!=null&&_u.childNodes.length>0){var _v=_u.childNodes.length;for(var i=0;i<_v;i++){if(_t.length>0)_t+="|";var _r=_u.childNodes.item(i);_t+=_r.nodeName;}}return _t;};GEXMLStruct.prototype.getTableRecordCount=function(f){var _r=this.findTableDataNode(f,false);if(_r!=null){return _r.childNodes.length;}return-1;};GEXMLStruct.prototype.getTableToXMLString=function(f,v,w){return this.getTableRecordXMLStringByKey(f,null,v,w);};GEXMLStruct.prototype.getTableRecordXMLStringByIndex=function(f,_a,w){return this.getTableRecordXMLStringByKey(f,_a,null,w);};GEXMLStruct.prototype._XMLNodeListToArray=function(_b,v){var arr=new Array();if(_b!=null&&_b.length>0){if(typeof(v)!='string')v='';if(v.length>0){var _l=new Array();var _ac=GEConvert.StringToStringCollection(v,",");for(var i=0;i<_ac.count();i++){var _af=GEConvert.StringToStringCollection(_ac.items(i),' ');if(_af.count()>0){var _m=new Object();_m.o=_af.items(0);_m.strDirection='asc';_m.strDataType='string';if(_af.count()>1){_m.strDirection=_af.items(1).toLowerCase();}if(_af.count()>2){_m.strDataType=_af.items(2).toLowerCase();}_l.add(_m);}}var _ag=new Array();for(var y=0;y<_b.length;y++){var _m=new Object();_m.nodeObj=_b(y);_m.orderByArr=_l;_ag.push(_m);}_ag.sort(_GEXMLNodeArraySort);for(var x=0;x<_ag.length;x++){arr.push(_ag[x].nodeObj);}}else{for(var i=0;i<_b.length;i++){arr.push(_b(i));}}}return arr;};GEXMLStruct.prototype.getTableRecordXMLStringByKey=function(f,_c,v,w){var _w=this.findTableDataNode(f,false);if(_w!=null){if(typeof(w)!='string')w='';var _ah=GEConvert.StringToStringCollection(w);var _ai;if(_c==null)_ai=_w.childNodes;else _ai=_w.selectNodes(this._constRecordTag+"["+_c+"]");var _aj=this._XMLNodeListToArray(_ai,v);var _ak=new GEStringBuilder();var _v=_aj.length;if(_v>0){_ak.append('<'+f+' items-in-total="'+_v+'">');for(var i=0;i<_v;i++){var _d=null;if(_ah!=null&&_ah.count()>0){_d=new GEHashtable();for(var j=0;j<_ah.count();j++){var _al=_ah.items(j);var _am=_aj[i].getAttribute(_al);if(_am!=null)_d.add(_al,_am);}}else{_d=GEXMLHelper.xmlNodeAttrToHashtable(_aj[i]);}if(_d!=null){_d.remove(this._constStateAttrName);_ak.append("<"+_aj[i].nodeName);for(var x=0;x<_d.count();x++){_ak.append(' '+_d.findKeyByIndex(x)+'="'+GEConvert.StringToXMLString(_d.findValueByIndex(x))+'"');}_ak.append(" />");}}_ak.append("");}return _ak.toString();}return null;};GEXMLStruct.prototype.appendTableRecord=function(f,_d){return this.insertTableRecord(f,_d);};GEXMLStruct.prototype.insertTableRecord=function(f,_d,_e){var _w=this.findTableDataNode(f,true);if(_w!=null&&_d!=null){if(_e==null||_e.toString().length<=0)_e=null;var _an=this._getXMLDoc().createNode(1,this._constRecordTag,"");_an.setAttribute(this._constStateAttrName,"Insert");_d.remove(this._constStateAttrName);for(var i=0;i<_d.count();i++){_an.setAttribute(_d.findKeyByIndex(i).toString(),_d.findValueByIndex(i).toString());}if(_e!=null){var _ao=_w.selectSingleNode(this._constRecordTag+"["+_e.toString()+"]");_w.insertBefore(_an,_ao);}else{_w.insertBefore(_an,null);}return true;}return false;};GEXMLStruct.prototype.removeAllTableRecord=function(f,_f){var _v=this.getTableRecordCount(f);for(var i=_v-1;i>=0;i--){this.removeTableRecord(f,i,_f);}return true;};GEXMLStruct.prototype.removeTableRecord=function(f,_c,_f){var _w=this.findTableDataNode(f,false);if(_w!=null&&_c!=null){var _ai=_w.selectNodes(this._constRecordTag+"["+_c.toString()+"]");if(_ai!=null){var _ap=GEConvert.StringToStringCollection(_f);var _v=_ai.length;for(var i=0;i<_v;i++){if(_ai(i).getAttribute(this._constStateAttrName)=="Insert"){_w.removeChild(_ai(i));}else{var _aq=_w.getAttribute(this._constDeleteIDAttrName);if(_aq==null)_aq="";if(_aq.length>0){_aq+="||";}var _ar=new GEHashtable();for(var z=0;z<_ap.count();z++){_ar.add(_ap.items(z),_ai(i).getAttribute(_ap.items(z)));}_aq+=GEConvert.HashtableToString(_ar);_w.setAttribute(this._constDeleteIDAttrName,_aq);_w.removeChild(_ai(i));}}return true;}}return false;};GEXMLStruct.prototype.updateTableRecord=function(f,_d,_c){var _w=this.findTableDataNode(f,false);if(_w!=null&&_c!=null&&_d!=null){var _ai=_w.selectNodes(this._constRecordTag+"["+_c.toString()+"]");if(_ai!=null){_d.remove(this._constStateAttrName);var _v=_ai.length;for(var i=0;i<_v;i++){for(var x=0;x<_d.count();x++){_ai(i).setAttribute(_d.findKeyByIndex(x).toString(),_d.findValueByIndex(x).toString());}if(_ai(i).getAttribute(this._constStateAttrName)!="Insert"&&_ai(i).getAttribute(this._constStateAttrName)!="Delete"){_ai(i).setAttribute(this._constStateAttrName,"Update");}}if(_v>0)return true;}}return false;};GEXMLStruct.prototype.isExistTableRecord=function(f,_c){try{var _w=this.findTableDataNode(f,false);if(_w!=null&&_c!=null){var _ai=_w.selectNodes(this._constRecordTag+"["+_c.toString()+"]");if(_ai!=null&&_ai.length){return true;}}return false;}catch(e){return false;}};GEXMLStruct.prototype.getTableRecordValue=function(f,_g,_h){var _w=this.findTableDataNode(f,false);if(_w!=null&&_g!=null&&_h!=null&&_h.length>0){var _r=_w.selectSingleNode(this._constRecordTag+"["+_g.toString()+"]");if(_r!=null){return GEXMLHelper.getAttrAsString(_r,_h,'');}}return"";};GEXMLStruct.prototype.setTableRecordValue=function(f,_g,_h,q){var _w=this.findTableDataNode(f,false);if(_w!=null&&_g!=null&&_h!=null&&_h.length>0){var _r=_w.selectSingleNode(this._constRecordTag+"["+_g.toString()+"]");if(_r!=null){_r.setAttribute(_h,q);return true;}}return false;};GEXMLStruct.prototype.getTableRecordHas=function(f,_g){var _w=this.findTableDataNode(f,false);if(_w!=null&&_g!=null){var _r=_w.selectSingleNode(this._constRecordTag+"["+_g.toString()+"]");if(_r!=null){var _d=GEXMLHelper.xmlNodeAttrToHashtable(_r);_d.remove('__state');return _d;}}return null;};GEXMLStruct.prototype.selectTableRecordHas=function(f,_c,v){var _w=this.findTableDataNode(f,false);if(_w!=null&&_c!=null){var _ai=_w.selectNodes(this._constRecordTag+"["+_c.toString()+"]");var _aj=this._XMLNodeListToArray(_ai,v);var _as=_aj.length;var _at=new Array();for(var j=0;j<_as;j++){var _d=GEXMLHelper.xmlNodeAttrToHashtable(_aj[j]);_d.remove('__state');_at.push(_d);}return _at;}return null;};GEXMLStruct.prototype.clearModifyState=function(){this.setNewState(false);var _au=this.enumBaseInfoNameList();var _av=this.enumTableNameList();if(_au!=null&&_au.length>0){var _ac=GEConvert.StringToStringCollection(_au);for(var i=0;i<_ac.count();i++){var _s=this.findBaseInfoDataNode(_ac.items(i));if(_s!=null){_s.removeAttribute(this._constIsModifyAttrName);}}}if(_av!=null&&_av.length>0){var _ac=GEConvert.StringToStringCollection(_av);for(var i=0;i<_ac.count();i++){var _s=this.findTableDataNode(_ac.items(i));if(_s!=null){_s.removeAttribute(this._constDeleteIDAttrName);var _v=_s.childNodes.length;for(var j=0;j<_v;j++){var _aw=_s.childNodes.item(j);_aw.removeAttribute(this._constStateAttrName);}}}}};GEXMLStruct.prototype.updateTableByDS=function(f,_f,b){var _w=this.findTableDataNode(f,true);var _ax=GEXMLHelper.convertXmlNode(b);if(_ax!=null&&_w!=null&&_f!=null&&_f.length>0){var _ap=GEConvert.StringToStringCollection(_f);var _ay=GEConvert.StringToStringCollection(_ax.getAttribute(this._constDeleteIDAttrName),"||");for(var i=0;i<_ay.count();i++){var _ar=GEConvert.StringToHashtable(_ay.items(i));var _g='';for(var z=0;z<_ap.count();z++){var o=_ap.items(z);if(_g.length>0)_g+=" and ";_g+=" @"+o+" = '"+_ar.findValue(o)+"'";}this.removeTableRecord(f,_g,_f);}var _ai=_ax.selectNodes(this._constRecordTag);if(_ai!=null){var _az=_ai.length;for(var j=0;j<_az;j++){var _ba=_ai[j];var _d=GEXMLHelper.xmlNodeAttrToHashtable(_ba);var _bb=_ba.getAttribute(this._constStateAttrName);if(_bb=="Insert"){this.appendTableRecord(f,_d);}else{var _g='';for(var z=0;z<_ap.count();z++){var o=_ap.items(z);if(_g.length>0)_g+=" and ";_g+=" @"+o+" = '"+_d.findValue(o)+"'";}var _bc=_w.selectNodes(this._constRecordTag+"["+_g.toString()+"]");if(_bc!=null&&_bc.length>0){for(var x=0;x<_bc.length;x++){var _bd=_w.removeChild(_bc(x));_w.insertBefore(_bd,null);}}if(_bb=="Update"){this.updateTableRecord(f,_d,_g);}}}}return true;}return false;};GEXMLStruct.prototype.convertFieldsValue=function(_i,_d){var _be=new GEHashtable();var _bf=_i.childNodes.length;for(var x=0;x<_bf;x++){var _bg=_i.childNodes.item(x);var o=GEXMLHelper.getAttrAsStringNoCase(_bg,'FieldID','');var q=_d.findValueNoCase(o);if(q!=null){_be.add(o,q);}}return _be;};GEXMLStruct.prototype.importXMLStruct=function(t,_j){if(t==null)return;if(typeof(t)=='string'){var b=t;t=new GEXMLStruct();t.init(b);}if(_j==null)_j="ContentID";var _au=this.enumBaseInfoNameList();var _av=this.enumTableNameList();if(_au!=null&&_au.length>0){var _ac=GEConvert.StringToStringCollection(_au);for(var i=0;i<_ac.count();i++){var l=_ac.items(i);var _bh=this.findBaseInfoFieldsNode(l);if(_bh!=null){var _d=t.getBaseInfoToHas(l);if(_d!=null){_d=this.convertFieldsValue(_bh,_d);this.setBaseInfoByHas(l,_d);}}}}if(_av!=null&&_av.length>0){var _ac=GEConvert.StringToStringCollection(_av);for(var i=0;i<_ac.count();i++){var l=_ac.items(i);var _bh=this.findTableFieldsNode(l);if(_bh!=null){if(t.isExistTable(l)){this.removeAllTableRecord(l,_j);var _bi=t.getTableRecordCount(l);for(i=0;i<_bi;i++){var _bj=t.getTableRecordHas(l,i);_bj=this.convertFieldsValue(_bh,_bj);this.appendTableRecord(l,_bj);}}}}}}; function RIACtrlBase(a,b){}RIACtrlBase.prototype._init=function(a,b){if(a!=null&&a.length>0){this.IsRIA=true;this.m_strVarName=a;this.m_parentRIACtrl=b;this.m_strCtrlID=a.replace(/\./g,"_")+"_CTRL";this._CtrlIndex=0;this.m_strConstructScript=null;this.m_bConstruct=false;this._EventNameColl=new GEStringCollection();this.c_strIDAttrName="id";this.c_strScriptTag="s:script";this.c_strOnEventAttrName="event";this.c_strOnParmsAttrName="params";return true;}else{alert("RIA控件类构造时传入无效的全局变量名!!") return false;}};RIACtrlBase.prototype._initXmlNode=function(c,d){this.m_bConstruct=false;if(d!=null){for(var i=d.attributes.length-1;i>=0;i--){var h=d.attributes.item(i).nodeName;var j=d.attributes.item(i).value;if(h.toLowerCase().startsWith('on')){if(this.addEventListener(h,j));{d.removeAttribute(h);}}}for(var i=d.childNodes.length-1;i>=0;i--){var p=d.childNodes.item(i);if(this.processScriptTag(p)){p=d.removeChild(p);}}return this.initXmlNode(c,d);}return'';};RIACtrlBase.prototype.newCtrlID=function(){this._CtrlIndex++;return this.m_strCtrlID+"_T_"+this._CtrlIndex;};RIACtrlBase.prototype.getXmlNodeID=function(d){var q=GEXMLHelper.getAttrAsStringNoCase(d,this.c_strIDAttrName,null);if(q==null){q=this.newCtrlID();}return q;};RIACtrlBase.prototype.xmlNodeAttrToHTMLString=function(d,f){var r="";if(d!=null){var s=GEConvert.StringToStringCollection(f);s.add('xmlns:b');s.add('xmlns:s');for(var i=0;i0)return" "+h+"=\""+j+"\"";return"";};RIACtrlBase.prototype.buildEventCall=function(k){return"return "+this.m_strVarName+"."+k+"(this,event);";};RIACtrlBase.prototype.processScriptTag=function(d){var w=false;if(d!=null){if(d.nodeName.toLowerCase()==this.c_strScriptTag){var l=GEXMLHelper.getAttrAsStringNoCase(d,this.c_strOnEventAttrName,"");var n=GEXMLHelper.getAttrAsStringNoCase(d,this.c_strOnParmsAttrName,"");var j="";for(var i=0;iRIA的 "+d.nodeName+" 派生类没有重载initXmlNode方法!!";};RIACtrlBase.prototype.construct=function(){if(this.m_strConstructScript!=null&&this.m_strConstructScript.length>0){eval(this.m_strConstructScript);}this.m_bConstruct=true;};RIACtrlBase.prototype.getStandardHTMLEvent=function(){return'';};RIACtrlBase.prototype.getRIAEvent=function(){return'';};RIACtrlBase.prototype.getTopRIAObj=function(){var _b=this;while(_b.m_parentRIACtrl!=null){_b=_b.m_parentRIACtrl;}return _b;};RIACtrlBase.prototype.getHtmlCtrl=function(){return $(this.m_strCtrlID);};RIACtrlBase.prototype.getHTML=function(){return GEDocUtil.getHTML(this.getHtmlCtrl());};RIACtrlBase.prototype.setEnabled=function(o){GEDocUtil.setEnabled(o,this.getHtmlCtrl());};RIACtrlBase.prototype.isEnabled=function(){return GEDocUtil.isEnabled(this.getHtmlCtrl());};RIACtrlBase.prototype.setVisible=function(o){GEDocUtil.setVisible(o,this.getHtmlCtrl());};RIACtrlBase.prototype.isVisible=function(){return GEDocUtil.isVisible(this.getHtmlCtrl());};RIACtrlBase.prototype.focus=function(){var _c=this.getHtmlCtrl();if(jscomTestObj(_c)){try{_c.focus();}catch(e){}}}; function RIAComboBox(a,b){this._init(a,b);this.m_bEnableEdit=true;this.m_bCustomize=false;this.m_bValidText=false;this.m_strValue='';this.m_listItems=new Array();this.m_iSelectedIndex=-1;this.m_xmlDoc=null;this.textBoxCtrl=new RIATextBox(a+".textBoxCtrl",this);this.btnCtrl=new RIAButton(a+".btnCtrl",this);this.btnCtrl.addEventListener("onclick",this.m_strVarName+"._onbuttonclick(sender,event)");this.btnCtrl.addEventListener("onblur",this.m_strVarName+"._onblur(sender,event)");this.textBoxCtrl.addEventListener("onchange",this.m_strVarName+"._ontextboxchange(sender,event)");this.textBoxCtrl.addEventListener("onblur",this.m_strVarName+"._onblur(sender,event)");this.textBoxCtrl.addEventListener("onclick",this.m_strVarName+"._ontextboxclick(sender,event)");this.textBoxCtrl.addEventListener("onkeydown",this.m_strVarName+"._ontextboxkeydown(sender,event)");this.c_strListItemTag="b:listitem";};RIAComboBox.inherits(RIACtrlBase);RIAComboBox.prototype.createListItem=function(c,d,f,g){return{m_strText:(c==null)?'':c,m_strValue:(d==null)?'':d,m_strTitle:(f==null)?'':f,m_bSelected:(g==null)?false:g};};RIAComboBox.prototype.construct=function(){this.textBoxCtrl.construct();this.btnCtrl.construct();this.btnCtrl.getHtmlCtrl().tabIndex=-1;this._base("construct");};RIAComboBox.prototype.getRIAEvent=function(){return"onblur|onitemchange|onpulldownbegin|onpulldownend|ontextchange|onclearcustomize|onnextitem|onpreviusitem|onselcurrentitem";};RIAComboBox.prototype.getPullDownDivCtrlID=function(){return this.m_strCtrlID+'_pulldiv';};RIAComboBox.prototype.getPullDownTableCtrlID=function(){return this.m_strCtrlID+'_pulltbl';};RIAComboBox.prototype.initXmlNode=function(h,j){this.m_listItems.clear();var w=GEXMLHelper.getAttrAsStringNoCase(j,"IsVisible","true").toLowerCase()=="true";var x=GEXMLHelper.getAttrAsStringNoCase(j,"IsEnabled","true").toLowerCase()=="true";this.m_bEnableEdit=GEXMLHelper.getAttrAsStringNoCase(j,"IsEnableEdit","true").toLowerCase()=="true";this.m_bCustomize=GEXMLHelper.getAttrAsStringNoCase(j,"IsCustomize","false").toLowerCase()=="true";this.m_strValue=GEXMLHelper.getAttrAsStringNoCase(j,"value","");var y=GEXMLHelper.getAttrAsStringNoCase(j,"PullWidth","");var z=GEXMLHelper.getAttrAsStringNoCase(j,"PullHeight","");var _a=GEXMLHelper.getAttrAsStringNoCase(j,"width",null);var _b=GEXMLHelper.getAttrAsStringNoCase(j,"height",null);if(this.m_bCustomize){this.m_xmlDoc=GEXMLHelper.createXMLDoc();this.m_xmlDoc.loadXML(RIA.buildXMPHTMLByXmlNode(j,''));}else{var _c=false;var i=0;for(i=0;i');_i.append(_h);_i.append('');_i.append(_g);_i.append('');_i.append('');return _i.toString();};RIAComboBox.prototype.initTextCtrlHTML=function(h,j){this.m_bValidText=GEXMLHelper.getAttrAsStringNoCase(j,"IsValidText","false").toLowerCase()=="true";var _l=GEXMLHelper.getAttrAsStringNoCase(j,"DataType","Text");var _m=GEXMLHelper.getAttrAsStringNoCase(j,"IsReadOnly","false").toLowerCase()=="true";var _n=new GEStyles("border-right: #B8CFD8 0px solid;");var _o=GEXMLHelper.getAttrAsStringNoCase(j,"name","");var l='';if(GEXMLHelper.isExistAttrNoCase(j,"text"))l=GEXMLHelper.getAttrAsStringNoCase(j,"text","");else{if(GEXMLHelper.isExistAttr(j,"value"))l=this.getTextByValue(GEXMLHelper.getAttrAsStringNoCase(j,"value",""));}if(_o.length<=0)this.m_bValidText=true;return this.textBoxCtrl.renderTextBox(h,j,_l,_o,l,false,true,_m||!this.m_bEnableEdit,null,null,_n);};RIAComboBox.prototype.hidePullDownDiv=function(){this.btnCtrl.focus();GEDocUtil.setVisible(false,this.getPullDownDivCtrlID());};RIAComboBox.prototype.fireOnItemChange=function(k,l,m,n,o){this.m_iSelectedIndex=k;this.textBoxCtrl.clearValidStat();this.textBoxCtrl.setValue(l);this.m_strValue=m;if(this.onitemchange){this.onitemchange(k,l,m,n);}if(o==null)o=true;if(o==true){this.hidePullDownDiv();}try{this.textBoxCtrl.focus();}catch(e){}};RIAComboBox.prototype.clearPullDownDiv=function(){var _p=$(this.getPullDownDivCtrlID());if(jscomTestObj(_p)){_p.innerHTML='';}};RIAComboBox.prototype.refresh=function(){this.textBoxCtrl.setValue('');this.m_strValue='';this.m_iSelectedIndex=-1;this.textBoxCtrl.clearValidStat();this.clearPullDownDiv();};RIAComboBox.prototype.selectByIndex=function(k){return this.selectListItemByIndex(k);};RIAComboBox.prototype.selectByValue=function(m){return this.selectListItemByValue(m);};RIAComboBox.prototype.getTextByValue=function(m){var k=this.findIndexByValue(m);if(k>=0)return this.m_listItems[i].l;return'';};RIAComboBox.prototype.getText=function(){return this.textBoxCtrl.getValue();};RIAComboBox.prototype.setText=function(l){return this.textBoxCtrl.setValue(l);};RIAComboBox.prototype.getValue=function(){return this.m_strValue;};RIAComboBox.prototype.setValue=function(m){if(!this.m_bCustomize){if(this.m_strValue!=m){var k=this.findIndexByValue(m);this.selectListItemByIndex(k);return;}}else{if(this.m_strValue!=m&&m.length==0){if(this.onclearcustomize){this.onclearcustomize();}}this.m_strValue=m;}};RIAComboBox.prototype.isValid=function(){if(this.m_bValidText){return this.textBoxCtrl.isValid(this.getText());}else{return this.textBoxCtrl.isValid(this.getValue());}};RIAComboBox.prototype.setEnabled=function(p){this.textBoxCtrl.setEnabled(p);if(p&&!this.m_bEnableEdit){this.textBoxCtrl.setReadOnly(true);}this.btnCtrl.setEnabled(p);GEDocUtil.setEnabled(p,this.getHtmlCtrl());};RIAComboBox.prototype.setReadOnly=function(p){if(this.m_bEnableEdit)this.textBoxCtrl.setReadOnly(p);else this.textBoxCtrl.setReadOnly(true);this.btnCtrl.setEnabled(!p);};RIAComboBox.prototype.isReadOnly=function(){return!this.btnCtrl.isEnabled();};RIAComboBox.prototype.setLabelMode=function(p){this.textBoxCtrl.setLabelMode(p);if(!p&&!this.m_bEnableEdit){this.textBoxCtrl.setReadOnly(true);}this.btnCtrl.setVisible(!p);};RIAComboBox.prototype.isLabelMode=function(){return this.textBoxCtrl.isLabelMode();};RIAComboBox.prototype.setRequire=function(p){return this.textBoxCtrl.setRequire(p);};RIAComboBox.prototype.focus=function(){var _q=this.textBoxCtrl;if(_q){_q.focus();}};RIAComboBox.prototype._ontextboxclick=function(q,r){this.showPullDownDiv(true);};RIAComboBox.prototype._ontextboxkeydown=function(q,r){var _r=true;if(r.keyCode==13){var _p=$(this.getPullDownDivCtrlID());if(jscomTestObj(_p)){if(GEDocUtil.isVisible(_p)){this._onselcurrentitem();_r=false;}}}else if(r.keyCode==38){this.showPullDownDiv(true);this._onpreviusitem();}else if(r.keyCode==40){this.showPullDownDiv(true);this._onnextitem();}else{}if(_r&&this.onkeydown){return this.onkeydown(this,r);}};RIAComboBox.prototype._onbuttonclick=function(q,r){var _s=false;if(this.onbuttonclick){_s=this.onbuttonclick(q,r);}if(_s!=true){this.showPullDownDiv(false);}};RIAComboBox.prototype._ontextboxchange=function(q,r){this.m_strValue=this.textBoxCtrl.getValue();if(this.ontextchange){this.ontextchange(q,r);}};RIAComboBox.prototype.showPullDownDiv=function(s){this.textBoxCtrl.clearValidStat();var _p=$(this.getPullDownDivCtrlID());if(jscomTestObj(_p)&&this.btnCtrl.isEnabled()){if(GEDocUtil.isVisible(_p)){if(s!=true){GEDocUtil.setVisible(false,_p);}}else{var _t=true;if(this.onpulldownbegin){var _u=this.onpulldownbegin(this.getHtmlCtrl(),null);if(_u==false){_t=false;}}if(_t){this.renderPullDownDiv();this.textBoxCtrl.focus();GEDocUtil.showPullDownDiv(this.getHtmlCtrl(),_p);if(this.onpulldownend){this.onpulldownend(this.getHtmlCtrl(),null);}}}}};RIAComboBox.prototype.renderPullDownDiv=function(t){var _p=$(this.getPullDownDivCtrlID());if(jscomTestObj(_p)){if(_p.innerHTML.length<=0){if(this.m_bCustomize){var _v=GEXMLHelper.createXMLDoc();_v.loadXML(this.m_xmlDoc.xml);var _w=RIA.processXMP(_v.documentElement,_p);}else{var _i=new GEStringBuilder();_i.append('');for(var i=0;i');_i.appendLine('');_i.appendLine('');}_i.append('
',_f.m_strText,'
');_p.innerHTML=_i.toString();}}}};RIAComboBox.prototype.addListItem=function(l,m,u){if(!this.m_bCustomize){this.clearPullDownDiv();var _f=this.createListItem(l,m,u);this.m_listItems.add(_f);}};RIAComboBox.prototype.setListItemByIndex=function(k,l,m,u){if(!this.m_bCustomize){if(k>=0&&k=0&&k=0&&k