function tomListview(div) { this.div = div; this.id = div.getAttribute("id2"); this.datafield = div.getAttribute("datafield"); this.divStatus = gEL2(div,this.id+"Status"); this.divInh = gEL2(div,"inhalt"); this.contDiv = gEL2(div,"contDiv"); this.url = "/_gui/_ components/listview/xListview.asp" this.cancelclick=false; this.listindex=-1; } tomListview.prototype.init = function() { this.initLV(); } tomListview.prototype.reset = function() { if(this.lastTR) { var cls = ""; if(this.lastTR.className =="inactiveSelected") var cls = "inactive"; this.lastTR.className = cls; } } tomListview.prototype.status = function(msg) { if(getWert(msg)=="") { vis=false; }else{ var vis=true; } setVisible(this.divStatus,vis); if(this.tbl) setVisible(this.tbl,!vis); setContent(this.divStatus," "+web.sandclock+" "+msg); } tomListview.prototype.load = function(msg,pars) { this.status(msg); var data = "web="+web.webname+"&datafield="+this.datafield; if(pars) data+="&"+pars; xmlhttp(this.url,data,this.doneLoad,"",this) } tomListview.prototype.doneLoad = function(ret) { if(check4Error("listview.doneLoad",ret)) return; this.status(""); setContent(this.divInh,ret); this.initLV(); if(this.gui[this.id+"_doneLoad"]) this.gui[this.id+"_doneLoad"](); } tomListview.prototype.initLV = function() { var tblHead = this.div.getElementsByTagName("table")[0]; this.tbl = this.divInh.getElementsByTagName("table")[0]; if(!this.tbl) return; this.listcount = this.tbl.rows.length; this.listindex=-1; if(this.listcount==0) return; var tr = tblHead.rows[0]; var max = tr.cells.length-1; for(i=1;i < max;i++) { var td = tr.cells[i]; var wi = parseInt(td.style.width)-2; if(i==max-1) { //wi=wi+4; } if(wi>0) this.tbl.rows[0].cells[i].width = wi + "px"; } var obj = this; for(i=0;i < this.tbl.rows.length;i++) { var tr = this.tbl.rows[i]; if(tr.cells[1].className!== "lvheader") { tr.onclick=function() { obj.Clicked(this); } tr.onmouseover=function() { obj.hover(this,true) } tr.onmouseout=function() { obj.hover(this,false) } } } } tomListview.prototype.hover = function(tr,cod) { var cla = tr.className; if(cla=="selected" || cla=="lvHead" || cla=="inactive" || cla=="inactiveSelected") return; if(cod==true) { var cls = "hover"; if(cla=="bold") cls = "hoverbold"; }else{ var cls = ""; if(cla=="hoverbold") cls = "bold"; } tr.className = cls; } tomListview.prototype.Clicked = function(tr) { if(tr.className=="inactive") return; this.reset(); this.listindex = tr.rowIndex; this.TR = tr; tr.className = "selected"; var sItems = new Array; for(i=1;i < tr.cells.length;i++) { var inh = tr.cells[i].innerHTML; sItems.push(inh); } this.lastTR = tr; this.recID = tr.getAttribute("recID"); if(this.gui[this.id+"_Click"]) { if(this.cancelclick) { this.cancelclick=false; return; } raiseevent(this,"Click",this.recID,sItems); } } tomListview.prototype.setListindex = function(nr) { if(!this.tbl) return; var tr = this.tbl.rows[nr]; this.Clicked(tr); } tomListview.prototype.setValue = function(ze,col,txt) { var td = this.tbl.rows[ze].cells[col]; td.innerHTML = txt; } tomListview.prototype.setActive = function(row,cod) { var tr = this.tbl.rows[row]; tr.setAttribute("active",cod); if(cod==false) { var cls = "inactive"; if(tr.className=="selected") var cls = "inactiveSelected"; }else{ var cls = ""; if(tr.className=="inactiveSelected") var cls = "selected"; } tr.className = cls; } tomListview.prototype.list = function(ze,col) { var td = this.tbl.rows[ze].cells[col]; return td.innerHTML; } tomListview.prototype.listTR = function(ze) { return this.tbl.rows[ze]; } tomListview.prototype.selectedItem = function() { var tr = this.lastTR; var sItems = new Array; for(i=1;i < tr.cells.length;i++) { var inh = tr.cells[i].innerHTML; sItems.push(inh); } return sItems; } tomListview.prototype.resizeY = function() { rc = resizeY(this.div); this.setHeight(rc); } tomListview.prototype.setHeight = function(y) { this.div.style.height = y + "px"; this.contDiv.style.height = y-12 + "px"; } tomListview.prototype.cancelClick = function() { this.cancelclick = true; } tomListview.prototype.deleteItembyID = function(id) { for(i=0;i < this.tbl.rows.length;i++) { var tr = this.tbl.rows[i]; if(tr.getAttribute("recID")==id) { tr.parentNode.removeChild(tr); this.listcount = this.tbl.rows.length; break; } } }