home *** CD-ROM | disk | FTP | other *** search
/ CD Shareware Magazine 1999 April / CD_Shareware_Magazine_31.iso / WIN95 / INTERNET / h12395co.exe / data.1 / dbs.hei < prev    next >
Encoding:
Text File  |  1997-12-04  |  4.7 KB  |  169 lines

  1. <includeonce;
  2. // dbs Database Scroll Library
  3. //
  4. // (C) 1996-97 H.E.I. GmbH and suppliers all rights reseved
  5. // 
  6. // Redistribution and use in source and binary forms, with or without
  7. // modification, are permitted provided that the following conditions
  8. // are met:
  9. // 1. Redistributions of source code must retain the above copyright
  10. //    notice, this list of conditions and the following disclaimer.
  11. // 2. Redistributions in binary form must reproduce the above copyright
  12. //    notice, this list of conditions and the following disclaimer in the
  13. //    documentation and/or other materials provided with the distribution.
  14. // 3. Neither the name of H.E.I. GmbH nor the names of its contributors
  15. //    may be used to endorse or promote products derived from this software
  16. //    without specific prior written permission.
  17. // 4. The complete licensing conditions of heitml apply also to this file,
  18. //    be sure to have read and accepted these conditions before using this
  19. //    file. This file may be used and modified freely in conjunction with 
  20. //    a valid heitml license.
  21. // 
  22. // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  23. // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  24. // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  25. // IN NO EVENT SHALL THE H.E.I. OR CONTRIBUTORS BE LIABLE FOR ANY
  26. // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27. // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  28. // GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  29. // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  30. // IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  31. // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  32. // IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33. include ses.hei>< 
  34.  
  35. defenv dbsQuery *s max=200 pagesize=5;
  36.    s = emptytuple;
  37.    assign qt; defbody; /assign;
  38.    s.max = max;
  39.    s.rel = array(0);
  40.    s.overflow=false;
  41.    i=1; SrvMax=max;
  42.    dbquery q; ? qt; 
  43.    dbrow   ArAppend (s.rel,clone(q)); 
  44.        i=i+1;
  45.        if max<i; s.overflow=true; break; /if;
  46.    /dbquery;
  47.    s.pos = 0;
  48.    s.pagesize = pagesize;
  49.    s.extname = FormExtName("Scrl");
  50. /defenv; 
  51.  
  52. def dbsSize s;
  53.    return len(s.rel);
  54. /def;
  55.  
  56.  
  57. defenv dbsScroller s pagesize=null;
  58.    if isempty(s); return; /if;
  59.    if isempty(s.rel); return; /if;
  60.    if len(s.rel)==0; return; /if;
  61.    
  62.    if !isnull(pagesize); s.pagesize=pagesize; /if;
  63.    p = ff[s.extname];
  64.    if (!isempty(p)); 
  65.       if (!isempty(p.goto)); s.pos=integer(p.goto); /if   
  66.       if (!isempty(p.first)); s.pos=0; /if   
  67.       if (!isempty(p.last)); s.pos=len(s.rel)+1; /if
  68.       if (!isempty(p.next)); s.pos=s.pos+s.pagesize; /if   
  69.       if (!isempty(p.prev)); s.pos=s.pos-s.pagesize; /if
  70.       if (len(s.rel)<=s.pos); s.pos= ( (len(s.rel)-1)/s.pagesize )*s.pagesize; /if;
  71.       if (s.pos<0); s.pos=0; /if;
  72.    /if;
  73.    defbody;
  74. /defenv;
  75.  
  76.  
  77. defenv dbsLine s *r;
  78.    i=s.pos; l=0;
  79.    while (i<len(s.rel) && l<s.pagesize);
  80.       r = s.rel[i];
  81.       defbody;
  82.       i=i+1; l=l+1;
  83.    /while;
  84.    r=null;
  85. /defenv   
  86.  
  87.  
  88. def dbsTableHeadLine s;
  89.   i=0; h=s.rel[0];
  90.   while (i<len(h));
  91.      >  <th> <? fname(h[i])> </th> < let
  92.      i=i+1;
  93.   /while;
  94. /def
  95.  
  96.  
  97. def    dbsTableHead s;
  98.   ><tr><
  99.   dbsTableHeadLine s;
  100.   ></tr><
  101. /def;
  102.  
  103.  
  104. def    dbsTableLine s r;
  105.       i=0;
  106.       while (i<len(r));
  107.     if isempty(r[i])
  108.     > <td> </td> < 
  109.     else if isinteger(r[i])||isreal(r[i])
  110.     > <td align="right"><? r[i]></td> <
  111.     else
  112.     > <td><? r[i]></td> < 
  113.     /if; /if;
  114.         i=i+1;
  115.       /while;
  116. /def
  117.  
  118.  
  119. def    dbsTableBody s;
  120.    dbsLine s r;
  121.       > <tr> <
  122.       dbsTableLine s r;
  123.       > </tr> < 
  124.    /dbsLine; 
  125. /def;
  126.  
  127.  
  128. defenv dbsScrollBarNum s;
  129.    cur = s.pos/s.pagesize;
  130.    i=0;
  131.    while i*s.pagesize<len(s.rel);
  132.       ><sa urlpar=s.extname+".goto="+i*s.pagesize; 
  133.          if cur==i><b><? i+1></b><else><? i+1></if></sa><
  134.       let i=i+1;
  135.       if i*s.pagesize<len(s.rel); defbody; /if;
  136.    /while;
  137. /defenv;
  138.  
  139.  
  140. defenv dbsANext s; 
  141.   if s.pos+s.pagesize<len(s.rel); sa urlpar=s.extname+".next=t";  defbody;/sa; 
  142.   else defbody; /if; /defenv;
  143. defenv dbsAPrev s;  
  144.   if s.pagesize<=s.pos; sa urlpar=s.extname+".prev=t";  defbody; /sa; 
  145.   else defbody; /if; /defenv;
  146. defenv dbsAFirst s; sa urlpar=s.extname+".first=t"; defbody; /sa; /defenv;
  147. defenv dbsALast s;  
  148.   if s.pagesize<len(s.rel); sa urlpar=s.extname+".last=t";  defbody; /sa; 
  149.   else defbody; /if; /defenv;
  150.   
  151.  
  152. def dbsControls s;
  153. > <dbsAFirst s>First</dbsAFirst> | <dbsAprev s>Prev</dbsAprev> | 
  154.            <dbsAnext s>Next</dbsAnext> | <dbsALast s>Last</dbsALast> 
  155. </def;
  156.  
  157.  
  158. def dbsControlLine s;
  159.   if s.pagesize<len(s.rel)> 
  160.   <center> <dbsControls s>       
  161.   <dbsScrollBarNum s>  </dbsScrollBarNum></center>
  162.   </if
  163. /def;
  164. >
  165.  
  166.  
  167.  
  168.  
  169.