//codigo incrustado control_data.asp /************************************** * * * ***************************************/ function listObject(pname,pfields,pdata){ this.name=pname; this.editmode=false; this.fieldsSource=pfields; this.blankfields = new Array() try{ var adoRs = new ActiveXObject("adodb.recordset"); }catch (e){alert(e.description)} var objectAsosiates=new Array(); this.init=function(){for (var i in pfields){this.blankfields[i]="";adoRs.Fields.append (pfields[i],200,8000);}adoRs.CursorLocation=3;adoRs.CursorType=3;adoRs.LockType=4;adoRs.open();for (var i in pdata ){adoRs.AddNew(pfields,pdata[i]);}adoRs.MoveFirst()}; this.edit=function(){this.editmode=!this.editmode;this.updateAsociates2()} this.isedit=function(){return this.editmode} this.close=function(){adoRs.close()}; this.movenext=function(){adoRs.MoveNext();this.updateAsociates2()}; this.movefirst=function(){adoRs.MoveFirst();this.updateAsociates2()}; this.movelast=function(){adoRs.MoveLast();this.updateAsociates2()} this.movepreview=function(){adoRs.MovePreview();this.updateAsociates2()}; this.sort=function(pcriterial){adoRs.sort=(pcriterial);this.updateAsociates()}; this.filter=function(pcriterial){adoRs.filter=(pcriterial);this.movefirst();this.updateAsociates()}; this.fields=function(){return adoRs.fields}; this.fieldscount=function(){return adoRs.fields.count}; this.field=function(pfield){return adoRs.fields(pfield)}; this.insertrow=function(pdata){adoRs.addNew (this.fieldsSource,pdata);this.updateAsociates()}; this.addrow=function(pdata){adoRs.MoveLast();adoRs.addNew (this.fieldsSource,this.blankfields);adoRs.MoveLast();this.edit();}; this.count=function(){return (adoRs.RecordCount)}; this.eof=function(){return adoRs.EOF}; this.addAsociates=function (pobject){objectAsosiates[objectAsosiates.length] = pobject}; this.updateAsociates=function(){for (var i in objectAsosiates){if(objectAsosiates[i].classname=="grid")objectAsosiates[i].paint()/*; else objectAsosiates[i].selectrow();*/}}; this.updateAsociates2=function(){ for (var i in objectAsosiates){ try{ if(objectAsosiates[i].classname!="grid")objectAsosiates[i].paint() /*; else objectAsosiates[i].selectrow();*/ }catch(e){} } }; this.updateAsociates3=function(){ for (var i in objectAsosiates){ try{ objectAsosiates[i].paint() }catch(e){} } }; this.updaterow=function(){ try{ for (var i =1;i< this.fieldscount();i++) { for (var n in objectAsosiates){ if(objectAsosiates[n].name==this.fields()(i).name) { this.fields()(i).value=objectAsosiates[n].getvalue() } } } this.updateAsociates3() }catch(e){alert (e.description)} this.edit(); }; this.showAsociates=function(){var stri="";for (var i in objectAsosiates){stri+=objectAsosiates[i].objectname+"\r\n"}alert (stri);}; this.setposition=function(ppostion){if (this.isedit())return;adoRs.AbsolutePosition=ppostion;this.updateAsociates2()}; this.getrow=function(){return adoRs.AbsolutePosition}; this.deleterow=function(){try{adoRs.Delete()}catch(e){alert (e.description)};this.movefirst();this.updateAsociates()} this.cancel=function() {this.deleterow()} this.init(); } //codigo incrustado control_grid.asp /************************************** * * * ***************************************/ function addpro(provalue,proname){return ((provalue)?proname+"='"+provalue+"'":"")}; function addprocss(provalue,proname){return ((provalue)?proname+":"+provalue:"")}; function gridControl (parg) { this.container=parg.container var customValue this.ds=parg.datasource; this.classname="grid" this.evalheader=""; this.evalrowdata=""; this.widthLength=""; this.lastselectrow=null; this.columnclick=null this.name=parg.name this.objectclick=null this.setclickedcolumn=function(pobj,pcolumn) { this.columnclick =pcolumn this.objectclick=pobj } this.getclickedcolumn=function() { return this.columnclick+0+1 } this.getclickedobject=function() { return this.objectclick } this.header=function (){ return this.evalheader }; this.setposition=function(pobj,pposition){ if (this.ds.isedit())return; if (this.lastselectrow)this.lastselectrow.className=""; pobj.className="selectrow"; this.lastselectrow=pobj; parg.datasource.setposition(pposition); if (this.click) this.click(); } this.selectrow = function (){ /* if (this.ds.isedit())return; if (this.lastselectrow)this.lastselectrow.className=""; pobj.className="selectrow"; this.lastselectrow=pobj; */ } this.rowdata=null; this.dbclick=null; this.click=null; this.custom1=null this.custom2=null this.custom3=null this.custom4=null this.custom5=null this.custom6=null this.custom7=null this.custom8=null this.custom9=null this.custom10=null if (parg.click) this.click=parg.click; if (parg.dbclick) this.dbclick=parg.dbclick; if (parg.custom1) this.custom1=parg.custom1; if (parg.custom2) this.custom2=parg.custom2; if (parg.custom3) this.custom3=parg.custom3; if (parg.custom4) this.custom4=parg.custom4; if (parg.custom5) this.custom5=parg.custom5; if (parg.custom6) this.custom6=parg.custom6; if (parg.custom7) this.custom7=parg.custom7; if (parg.custom8) this.custom8=parg.custom8; if (parg.custom9) this.custom9=parg.custom9; if (parg.custom10) this.custom10=parg.custom10; var fieldList=parg.fields,stroption="",strrow="",widthLength=0; for (var i in fieldList){ this.evalheader+="
"+fieldList[i].title+"
"; if (fieldList[i].custom) { customValue=parg.name+"."+fieldList[i].custom+"()" strrow+="
\"+"+customValue+"+\"
" } else { if (!fieldList[i].list) { strrow+="
\"+pfield(\""+fieldList[i].name+"\")+\"
" } else{ var rsobjectlist = fieldList[i].list.dataobject var vcode = fieldList[i].list.code var vview = fieldList[i].list.view rsobjectlist.movefirst() stroption="" while (!rsobjectlist.eof()) { stroption+="(pfield(\""+fieldList[i].name+"\")=='"+rsobjectlist.field(vcode)+"')?\""+rsobjectlist.field(vview)+"\":" rsobjectlist.movenext() } strrow+="
\"+("+stroption+"\"\")+\"
" } } widthLength+=parseInt(fieldList[i].width) } this.evalheader+="
 
"; var rowdatawidth=(widthLength+(6*fieldList.length)+fieldList.length)+16 this.evalrowdata=strrow this.paint=function (){ var strHtml=""; parg.datasource.movefirst(); while (!parg.datasource.eof()) { strHtml+=""+this.rowdata(parg.datasource.fields())+""; parg.datasource.movenext(); } strHtml+="
" document.all.item("div_"+parg.name).innerHTML =strHtml parg.datasource.movefirst(); } this.setsort=function(pobj,pname){ if (!pobj.getAttribute("lastcolumnsort")){ pobj.setAttribute("lastcolumnsort","1") }else{ pobj.setAttribute("lastcolumnsort",!pobj.getAttribute("lastcolumnsort")) } parg.datasource.sort(pname +(!pobj.getAttribute("lastcolumnsort")?" DESC":"") ) } this.init=function (){ var vdata="<"+"script"+">"+parg.name+".rowdata=function (pfield){return (\""+this.evalrowdata+"\")};"; vdata+="
"; vdata+= ""; vdata+= this.header(); vdata+="
"; vdata+="
"; vdata+="
"; document.write (vdata); parg.datasource.addAsociates(this); } this.gotourl =function (params){ var squery = "?"+params var qstring = squery if (qstring.search("_portletid_")==-1 && qstring.search("_portletid_")==-1)qstring+="&_portletid_="+this.container._portletid_.value if (qstring.search("_page_")==-1 && qstring.search("_page_")==-1)qstring+="&_page_="+this.container._page_.value window.location.href=qstring } } //codigo incrustado control_field.asp /************************************** * * * ***************************************/ function nvoInput(odata,parg){ this.classname="input"; this.datasource =odata.datasource this.name=parg.name; this.validmessage=parg.validmessage this.required=parg.required this.label=parg.label this.container=odata.container this.styletype=parg.styletype this.value=function (){ return this.element.value } this.getvalue=function (){ return this.element.value } this.paint=function (){ this.element.value=this.datasource.field(this.objectname); this.value=this.element.value if (this.datasource.isedit()==false) { this.element.setAttribute("disabled","disabled",false) }else { this.element.removeAttribute("disabled") } } this.objectname=parg.name; if (odata.datasource) { this.datasource.addAsociates(this); } str ="" if (parg.styletype=="edit"){ str +="" } if(parg.styletype=="text") { str +="" } if(parg.styletype=="dropdownds"){ str +="" } if(parg.styletype=="button"){ str +="" objds.movenext(); } str +="" } if(parg.styletype=="multicheck"){ str +="" var objds = parg.list.dataobject var objdschk = parg.list.dataobjectcheck var strchk="" objds.movefirst(); while (!objds.eof()) { var rodd = ((objds.getrow())%(parg.list.columnsAcross ))-1 if (parg.list.columnsAcross==1 ) rodd=0 if (rodd==0 ) { str +="" } str +="" objds.movenext(); } str +="
"+objds.field(parg.list.view)+"
" } document.write (str) this.element=odata.container.item (this.objectname) if (parg.onclick) this.element.attachEvent("onclick",parg.onclick) if (parg.onkeyup) this.element.attachEvent("onkeyup",parg.onkeyup) } /************************************** * * * ***************************************/ function nvoInputCompute(parg){ this.classname="input"; this.paint=function (){ this.element.innerHTML=eval(parg.evaluate); } this.objectname=parg.name; if (parg.datasource) { parg.datasource.addAsociates(this); document.write ("") }else{ document.write ("") } this.element=document.all.item(this.objectname); if (parg.onclick) { this.element.attachEvent("onclick",parg.onclick) } } //codigo incrustado controlex_form.asp function enviar(obj) { validForm(obj) } function validFields(obj) { var ss=""; for (var i=0;i"+fieldList[i].title+""; if (fieldList[i].custom) { customValue=parg.name+"."+fieldList[i].custom+"()" strrow+="
\"+"+customValue+"+\"
" } else { if (!fieldList[i].list) { strrow+="
\"+pfield(\""+fieldList[i].name+"\")+\"
" } else{ var rsobjectlist = fieldList[i].list.dataobject var vcode = fieldList[i].list.code var vview = fieldList[i].list.view rsobjectlist.movefirst() stroption="" while (!rsobjectlist.eof()) { stroption+="(pfield(\""+fieldList[i].name+"\")=='"+rsobjectlist.field(vcode)+"')?\""+rsobjectlist.field(vview)+"\":" rsobjectlist.movenext() } strrow+="
\"+("+stroption+"\"\")+\"
" } } widthLength+=parseInt(fieldList[i].width) } this.evalheader+="
 
"; var rowdatawidth=(widthLength+(6*fieldList.length)+fieldList.length)+16 this.evalrowdata=strrow this.paint=function (){ var strHtml=""; parg.datasource.movefirst(); while (!parg.datasource.eof()) { strHtml+=""+this.rowdata(parg.datasource.fields())+""; parg.datasource.movenext(); } strHtml+="
" document.all.item("div_"+parg.name).innerHTML =strHtml parg.datasource.movefirst(); } this.setsort=function(pobj,pname){ if (!pobj.getAttribute("lastcolumnsort")){ pobj.setAttribute("lastcolumnsort","1") }else{ pobj.setAttribute("lastcolumnsort",!pobj.getAttribute("lastcolumnsort")) } parg.datasource.sort(pname +(!pobj.getAttribute("lastcolumnsort")?" DESC":"") ) } this.init=function (){ var vdata="<"+"script"+">"+parg.name+".rowdata=function (pfield){return (\""+this.evalrowdata+"\")};"; vdata+="
"; vdata+= ""; vdata+= this.header(); vdata+="
"; vdata+="
"; vdata+="
"; document.write (vdata); parg.datasource.addAsociates(this); } this.gotourl =function (params){ var squery = "?"+params var qstring = squery if (qstring.search("_portletid_")==-1 && qstring.search("_portletid_")==-1)qstring+="&_portletid_="+this.container._portletid_.value if (qstring.search("_page_")==-1 && qstring.search("_page_")==-1)qstring+="&_page_="+this.container._page_.value window.location.href=qstring } } /************************************** * * * ***************************************/ function updatefield(objsource,objtarget){ if (objsource.checked) { objtarget.value+=objsource.value+"," return } objtarget.value=objtarget.value.replace(objsource.value+",","") } /************************************** * * * ***************************************/ /************************************** * * * ***************************************/ function nvoInput(odata,parg){ this.classname="input"; this.datasource =odata.datasource this.name=parg.name; this.validmessage=parg.validmessage this.required=parg.required this.label=parg.label this.container=odata.container this.styletype=parg.styletype this.value=function (){ return this.element.value } this.getvalue=function (){ return this.element.value } this.paint=function (){ this.element.value=this.datasource.field(this.objectname); this.value=this.element.value if (this.datasource.isedit()==false) { this.element.setAttribute("disabled","disabled",false) }else { this.element.removeAttribute("disabled") } } this.objectname=parg.name; if (odata.datasource) { this.datasource.addAsociates(this); } str ="" if (parg.styletype=="edit"){ str +="" } if(parg.styletype=="text") { str +="" } if(parg.styletype=="dropdownds"){ str +="" } if(parg.styletype=="button"){ str +="" objds.movenext(); } str +="" } if(parg.styletype=="multicheck"){ str +="" var objds = parg.list.dataobject var objdschk = parg.list.dataobjectcheck var strchk="" objds.movefirst(); while (!objds.eof()) { var rodd = ((objds.getrow())%(parg.list.columnsAcross ))-1 if (parg.list.columnsAcross==1 ) rodd=0 if (rodd==0 ) { str +="" } str +="" objds.movenext(); } str +="
"+objds.field(parg.list.view)+"
" } document.write (str) this.element=odata.container.item (this.objectname) if (parg.onclick) this.element.attachEvent("onclick",parg.onclick) if (parg.onkeyup) this.element.attachEvent("onkeyup",parg.onkeyup) } /************************************** * * * ***************************************/ function nvoInputCompute(parg){ this.classname="input"; this.paint=function (){ this.element.innerHTML=eval(parg.evaluate); } this.objectname=parg.name; if (parg.datasource) { parg.datasource.addAsociates(this); document.write ("") }else{ document.write ("") } this.element=document.all.item(this.objectname); if (parg.onclick) { this.element.attachEvent("onclick",parg.onclick) } } /************************************** * * * ***************************************/ function processForm (odata) { this.container=odata.container; this.columnsAcross=odata.columnsAcross; this.border=odata.border; this.padding=odata.padding; this.spacing=odata.spacing; this.showcomment=odata.showcomment; this.width=odata.width; this.odd=odata.odd; this.oddbackgroundcolor=odata.oddbackgroundcolor; this.datasource=odata.datasource; this.objects = new Array(); var irow=1; var nFields=""; var nSize=""; /*id="+odata.container+" */ var str ="
"+item.comment:"" if (odata.showcomment!="under") { str +="" if (odata.showcomment=="third") str +="" if (odata.columnsAcross>1) { if (rodd==(odata.columnsAcross -1)) { str +="" irow++ } } else { str +="" irow++ } nFields+=item.label nSize+=parseInt(item.labelwidth) if (i < odata.fields.length-1) {nFields+=",";nSize+=",";} document.write (str);str=""; } str +="
" }else { str +="
" } if (odata.showcomment=="top") str +=(item.comment)?item.comment+"
":"" document.write (str);str=""; //objdata[objdata.length]=new nvoInput(odata,item) this.objects[this.objects.length]=new nvoInput(odata,item) if (odata.showcomment=="down"||odata.showcomment=="under") str +=(item.comment)?"
"+item.comment:" " str +="
"+((item.comment)?item.comment:" ")+"
" document.write (str);str=""; //return str; } /************************************** * * * ***************************************/ function enviar(obj) { validForm(obj) } /************************************** * * * ***************************************/ function validFields(obj) { var ss=""; for (var i=0;i