home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / srev13g.zip / USETABL2.RX0 < prev    next >
Text File  |  1996-12-24  |  4KB  |  100 lines

  1. /* this is the USETABL2 Rexx-code block, to be called as a
  2. file using the INTERPRET FILE USETABL2.RXX keyphrase. 
  3.  
  4. To use this:
  5. 1) Create an html document. Without loss of generality,
  6.   let's call it TABLEDO.HTM
  7. 1) Insert the following  SSI keyphrase into TABLEDO.HTM,
  8.    at the position you want a table inserted
  9.       <!-- Interpret file usetabl2.rxx  -->
  10. 2) Create two files:
  11.    TABLEDO.TBL -- the HTML table you want inserted
  12.    TABLEDO.DEF -- a text version of this table
  13. 3) Make sure that TABLEDO.HTM, TABLEDO.TBL, and TABLEDO.DEF
  14.    are in the same directory
  15. 4) That's it-- just put a link to TABLEDO.HTM, and the rest
  16.    is automatic. 
  17.  
  18. Note that when USETABL2 can not find out for sure if the browser
  19. supports tables, it will send back a little note asking the
  20. client to select YES or NO; and then resend the apporpriate
  21. version.
  22.  
  23. Note:
  24. This procedure uses the SREF_BROWSER_INFO macrospace routine, which
  25. uses the BROWSERS.IDX file (which should be in your
  26. WORKDATA_DIR directory).
  27.  
  28. See SREFPRC1.DOC for information on SREF_BROWSER_INFO
  29.  
  30. Citation: the browser capabilities list was obtained from
  31. http://www.openmarket.com/browsertest/prob/bt-maker.cgi
  32.  
  33. */
  34.    seldoc=docname
  35.  
  36.    isat=lastpos('.',docname);
  37.    docname0=docname ;
  38.    if isat>0 then
  39.       docname0=delstr(docname,isat) ;
  40.  
  41.    docname1=0 ;
  42.    if symbol('optlist.0')='VAR' then do ;
  43.      do tmp1z=1 to optlist.0;
  44.        parse upper var optlist.tmp1z tmp.1 '=' tmp.2;
  45.        if tmp.1="TABLE" & tmp.2="YES" then do;
  46.           docname1=docname0||'.TBL' ; leave ; end;
  47.        if tmp.1="TABLE" & tmp.2="NO" then do ;
  48.            docname1=docname0||'.DEF' ; leave ; end ;
  49.      end;
  50.    end ;
  51.  
  52.    dotabl=upper(sref_browser_Info('TABLES'))
  53.    if docname1=0 then do ;
  54.       if dotabl='YES' then do
  55.            docname1=docname0||'.TBL' ; 
  56.       end ;
  57.    end;
  58.    if docname1=0 then do ;
  59.       if dotabl='NO' then do
  60.            docname1=docname0||'.DEF' ;
  61.      end;
  62.    end;
  63.  
  64.  
  65.    delim_1.1=get_value('DELIM_1.1')
  66.    delim_2.1=get_value('DELIM_2.1')
  67.    IF DOCNAME1<>0 THEN   do ;             
  68.       interpret.results=delim_1.1||'INCLUDE  '||docname1||delim_2.1 ;
  69.    END ;
  70.  
  71.    else do  ;       
  72.        aac='?';
  73.        if pos('?',seldoc)>0 then aac="&" ;
  74.        themess="" ;
  75.        putme=reqfield("User-Agent");
  76.        tmp.1="<html><head><title> Table Version Check </title></head> <body> " ;
  77.        tmp.2=" <h2> The requested document contains an optional table </h2> ";
  78.        tmp.3=" <br> and our server can't tell whether your browser supports table! ";
  79.        tmp.4=" <p> <em>  Please select either ..</em> <blockquote>" ;
  80.        tmp.5='<p>     the <a href="/'||seldoc||aac||'TABLE=YES">  .. TABLE version </a>' ;
  81.  
  82.        tmp.6='<p> or the <a href="/'||seldoc||aac||'TABLE=NO"> .. non-table version </a>' ;
  83.        tmp.7='</blockquote> of the requested document: ' docname;
  84.        tmp.8='<p> Hint: if you see a little table below... your browser <strong>can</strong> handle tables! ' ;
  85.        tmp.9="<table border=1><th>Headings <th>Col 1 <th> col 2<th> col 3 " ;
  86.        tmp.10="<tr> <td> Row is.. </td> <td> r1 c1 </td <td> r1 c2 </td> ";
  87.        tmp.11='<td> r1 c2 </td> <td> last spot </td> </table> ' ;
  88.        tmp.12='<hr> FYI: Your browser claims to be :<em>' putme   '</em>';
  89.        tmp.13="</body></html> ";
  90.  
  91.        themess=tmp.1;
  92.        do tmpi=2 to 13 ;
  93.          themess=themess||tmp.tmpi ;
  94.        end ;
  95.        'var type text/html  as ' docname ' NAME themess '  ;
  96.  
  97.         return 1
  98.    end ;
  99.  
  100.