PageSourceSearch

https://www.printdigitalinc.com/list_box/listBox.js

js printdigitalinc.com collected 2026-10-08 16:19:45 UTC 5,496 bytes, 157 lines download raw bytes

1
2function ListBoxObject(dest,listmdl,rpp,totalrec,passin,printer){
3  this.dest=dest;
4  this.mdl=listmdl;
5  this.rpp=rpp;
6  this.original_rpp=rpp;
7  this.start=0;
8  this.passIn=passin;
9  this.total=totalrec;
10  this.mustLoad=false;
11  var params=new AjaxFormContent();
12  params.addNameValue('mdl','list_box/resource.aj');
13  if(PREFS.cXML_ID&&PREFS.cXML_ID>0) params.addNameValue('cXML_ID',PREFS.cXML_ID);
14  if(printer) params.addNameValue('PRINTER_FRIENDLY','1');
15  var instance=this;
16  ajaxPostFunction(params,function(sc,st,rt,rxml){  
17        instance.dest.innerHTML=rt;
18        instance.processResource();
19     },
20     "ajax.iml");    
21}
22ListBoxObject.prototype.processResource=function(){
23  var instance=this;
24  this.destHTML=new HTMLParse(this.dest);  
25  this.destHTML.pos[0].node.innerHTML="";
26  this.destHTML.nav[0].link[0].node.onclick=function(evt){instance.first();return false;};
27  this.destHTML.nav[1].link[0].node.onclick=function(evt){instance.prev();return false;};
28  this.destHTML.nav[2].link[0].node.onclick=function(evt){instance.all();return false;};
29  this.destHTML.nav[3].link[0].node.onclick=function(evt){instance.next();return false;};
30  this.destHTML.nav[4].link[0].node.onclick=function(evt){instance.last();return false;};
31  if(this.destHTML.printer){
32    this.destHTML.printer[0].node.onclick=function(evt){instance.print();return false;};
33    this.destHTML.printer[1].node.onclick=function(evt){instance.print();return false;};
34  }
35  this.load();
36}
37
38
39ListBoxObject.prototype.load=function(){
40  this.showNav();
41  this.destHTML.content[0].node.style["display"]="none";
42  var params=new AjaxFormContent();
43  params.addNameValue('mdl',this.mdl);
44  params.addNameValue('RECORD_START',this.start);
45  params.addNameValue('RPP',this.rpp);
46  if(PREFS.cXML_ID&&PREFS.cXML_ID>0) params.addNameValue('cXML_ID',PREFS.cXML_ID);
47  for(var i=0;i<this.passIn.length; i++){
48    params.addNameValue(this.passIn[i][0],this.passIn[i][1]);
49  }
50  var instance=this;
51  ajaxPostFunction(params,function(sc,st,rt,rxml){  
52      var res=new HTMLParse(rt);
53      instance.destHTML.content[0].node.innerHTML=res.LIST_DIV[0].node.innerHTML;      
54      instance.destHTML.content[0].node.style["display"]="";
55      instance.showNav();
56     },"ajax.iml");
57}
58
59ListBoxObject.prototype.showNav=function(){  
60  var instance=this;
61  if(this.start==0){
62    this.destHTML.nav[0].node.style["display"]="none";
63    this.destHTML.nav[1].node.style["display"]="none";
64  }else{
65    this.destHTML.nav[0].node.style["display"]="";
66    this.destHTML.nav[1].node.style["display"]="";
67  }
68  
69  if(this.start>=this.total-this.rpp){
70    this.destHTML.nav[3].node.style["display"]="none";
71    this.destHTML.nav[4].node.style["display"]="none";
72  }else{
73    this.destHTML.nav[3].node.style["display"]="";
74    this.destHTML.nav[4].node.style["display"]="";
75  }
76    
77  if(this.total>0){  
78    var last_record_shown=Number(this.start)+Number(this.rpp);
79    if(last_record_shown>this.total)last_record_shown=this.total;
80    this.destHTML.pos[0].node.innerHTML=this.start+1+" - "+last_record_shown+" of "+this.total;
81  }
82  
83  var page_start=0;
84  var page_end=this.total;
85  var page=this.destHTML.pages[0].node;
86  if(this.total>20*this.rpp&&this.start>10*this.rpp) page_start=this.start-10*this.rpp;
87  if(page_end>page_start+20*this.rpp)page_end=page_start+20*this.rpp;
88  page.innerHTML='';
89  if(this.total<=this.rpp){    
90    this.destHTML.nav[2].node.style["display"]="none";
91  }else{
92    this.destHTML.nav[2].node.style["display"]="";
93    var span, a;
94    for(var i=page_start; i<page_end; i+=this.rpp){
95      span=ce('span'); span.style["paddingLeft"]="5px";      
96      if(i==this.start)span.innerHTML="("+(i/this.rpp+1)+")";
97      else {
98        a=ce('a'); a.setAttribute('goto',i); a.onclick=function(evt){instance.gotoRecord(this.getAttribute('goto'));return false;};
99        a.innerHTML="("+(i/this.rpp+1)+")"; span.appendChild(a);
100      }
101      page.appendChild(span);
102    }
103  }    
104}
105
106ListBoxObject.prototype.print=function(){
107  var params="mdl="+this.mdl+"&RPP="+this.total+"&RECORD_START=0";
108  for(var i=0;i<this.passIn.length; i++){
109    params=params+"&"+this.passIn[i][0]+"="+escape(this.passIn[i][1]);
110  }
111  var PRINTER_FRIENDLY= window.open('loadin.iml?'+params,'printer_friendly','scrollbars=1,toolbar=1,location=0,directories=0,status=0,menubar=1,width=550,resizable=1');
112  PRINTER_FRIENDLY.focus();
113}
114
115ListBoxObject.prototype.all=function(){
116  this.start=0;
117  this.rpp=this.total;
118  this.load();
119}
120ListBoxObject.prototype.viewSome=function(){
121  this.start=0;
122  this.rpp=this.original_rpp;
123  this.load();
124}
125ListBoxObject.prototype.first=function(){
126  if(this.start!=0){
127    this.start=0;
128    this.load();
129  }
130}
131ListBoxObject.prototype.last=function(){
132  var next_start=this.start;
133  while(next_start<this.total-this.rpp) next_start+=this.rpp;
134  if(next_start!=this.start){
135    this.start=next_start;
136    this.load();
137  }
138}
139ListBoxObject.prototype.prev=function(){
140  var next_start=this.start-this.rpp;
141  if(next_start<0)next_start=0;
142  if(next_start!=this.start){
143    this.start=next_start;
144    this.load();
145  }
146}
147ListBoxObject.prototype.next=function(){
148  var next_start=this.start+this.rpp;
149  if(next_start!=this.start){
150    this.start=next_start;
151    this.load();
152  }
153}
154ListBoxObject.prototype.gotoRecord=function(i){
155  this.start=i;
156  this.load();
157}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.