Texis Web Script source code for: /texis/site/demos/docdb.vs
Note: Click on links to view the documentation for HTML tags which are special to the Vortex compiler.
<!--------------------------------------------------------------------------
  Start of Vortex script
--------------------------------------------------------------------------->

<script language=vortex>

<!--------------------------------------------------------------------------
  Save variable values between calls
--------------------------------------------------------------------------->

<export $id url>
<export $allfields userok>
<export $maxhits url userok>
<uses demonav=demonav><!--simple look and feel module-->
<entryfunc=init>              <!-- init function for every invocation -->

<!-- ------------------------------------------------------------------- -->
<a name=init private>
  <sum "%s" $SERVER_ROOT "/texis"><db = $ret>  <!-- set the database -->
</a>

<!--------------------------------------------------------------------------
  The main entry point
--------------------------------------------------------------------------->

<a name=main PUBLIC>
  <hdr>
    <description>
    <if $maxhits eq "">
      <$maxhits = 25>
    </if>
    <the_form>
  <ftr>
</a>

<!--------------------------------------------------------------------------
  Common header macro  
--------------------------------------------------------------------------->

<a name=hdr>   
  <demolook title="TEXIS Document Imaging Database">
</a>

<!--------------------------------------------------------------------------
  Common footer macro
--------------------------------------------------------------------------->

<a name=ftr>
  <br>
  <h6 align=right>Copyright © 1996 Thunderstone Software</h6>
  </demolook>
</a>

<!--------------------------------------------------------------------------
  Display document
--------------------------------------------------------------------------->

<a name=content PUBLIC>
  <hdr>
    <the_form>
    <p>
    <sql max=1 "select doc_page,doc_desc,doc_text,doc_image from docdb where id = $id">
      <sum "%s" $allfields " @0 w/.">
      <$markup = $ret>
      <table width=100%>
        <tr>
          <rex "[^/]*>>=" $doc_image />
          <td align=right><a href="/site/demos/docdb-images/$ret"><big><b><i>Get OCR Image</i></b></big></a></td>
        </tr>
      </table>
      <center><big><b>$doc_desc</b></big></center>
      <p>
      <table>
        <tr>
          <td><strfmt "%=|V" $doc_text><fmt "%mIpH" $markup $ret></td>
        </tr>
      </table>
      <p>
      <table width=100%>
        <tr>
          <td align=right>$doc_page</td>
        </tr>
      </table>
    </sql>
    <if $loop eq 0>
      Could not find document id '<tt>$id</tt>'.
    </if>
  <ftr>
</a>

<!--------------------------------------------------------------------------
  Program description
--------------------------------------------------------------------------->

<a name=description>
  <center>
    <table>
      <tr>
        <td>
          <pre>
            <i>
      This database contains scanned and OCR'ed images of Thunderstone<br>
      Product Descriptions. The text is searched in order to locate and<br>
      deliver the image. Your browser must support TIFF Group IV.<br>
            </i>
          </pre>
        </td>
      </tr>
    </table>
  </center>
  <p>
</a>

<!--------------------------------------------------------------------------
  Display a list of hits
--------------------------------------------------------------------------->

<a name=makelist>
  <tr>
    <td nowrap><a href="$url/content.html">$doc_id</a></td>
    <td nowrap align=center>$doc_page</td>
    <td nowrap>$doc_desc</td>
  </tr>
</a>

<!--------------------------------------------------------------------------
  Display a page of hits
--------------------------------------------------------------------------->

<a name=prevnext>
  <table width=100%>
    <tr>
      <!-- Display previous group of hits -->
      <if $forward gt 0>
        <td align=left>
          <if $loop gte $maxhits and $forward gte 0>
            <if $maxhits eq 1>
              <$forward = ($forward - 1)>
            <else>
              <$forward = ($forward - $loop)>
            </if>
          <else>
            <$forward = 0>
          </if>
          <form method=post action="$url/results.html">
            <input type=submit value="Previous">
            <input type=hidden name=forward value=$forward>
          </form>
        </td>
      </if>
      <!-- Display next group of hits -->
      <if $loop gt $maxhits>
        <td align=right>
          <$next = ($next - 1)>
          <$forward = $next>
          <form method=post action="$url/results.html">
            <input type=submit value="Next">
            <input type=hidden name=forward value=$forward>
          </form>
        </td>
      </if>        
    </tr>
  </table>
</a>

<!--------------------------------------------------------------------------
  Error handling function
--------------------------------------------------------------------------->

<a name=putmsg>
  <$pmflag = 1>
  <$allfields = "">
  <if $errnum eq 115>
    <center><h4>Your query was too general. Try again with more specific words.</h4></center>
  </if>
</a>

<!--------------------------------------------------------------------------
  Display results
--------------------------------------------------------------------------->

<a name=results PUBLIC>
  <hdr>
  <if $allfields neq "">
    <rex \alpha{2,} $allfields />
    <if $ret eq "">
      <$allfields = "">
    <else>
      <sum "%s " $ret>
      <$allfields = $ret>
    </if>
  </if>
  <the_form>
  <if $forward eq "">
    <$forward = 0>
  </if>
  <if $allfields eq "">
    <center><h4>No search parameters were entered. Try again.</h4></center>
  <else>       
    <if $maxhits eq "">
      <$maxhits = 25>
    </if>
    <$usermax = $maxhits>
    <$maxhits = ($maxhits + 1)>
    <center>
      <p>
      <table cellpadding=6>
        <sql null="" skip=$forward max=$maxhits "select id,doc_id,doc_page,doc_desc from docdb
                where doc_id\doc_page\doc_desc\doc_text\doc_image like $allfields">
          <if $pmflag neq 1 and $id neq "" and $hdrflag neq 1>
            <$hdrflag = 1>
            <tr>
              <td><big>Document ID</big></td>
              <td><big>Page Number</big></td>
              <td align=center><big>Description</big></td>
            </tr>
          </if>
          <if $loop lt $usermax>
            <makelist>
          </if>
        </sql>
      </table>
    </center>
    <$maxhits = ($maxhits - 1)>
    <prevnext>
    <if $pmflag eq 1>
      <$pmflag = 0>
    <else>
      <if $id eq "">
        <center><h4>No matches for your Query were found.</h4></center>
      </if>
      <if $id neq "">
        <center><h4>Select Document ID Number to see more information</h4></center>
      </if>
    </if>
  </if>
  <ftr>
</a>

<!--------------------------------------------------------------------------
  The search form
--------------------------------------------------------------------------->

<a name=the_form>
  <center><big><b>Document Imaging Search</b></big></center>
  <form method=post action="$url/results.html">
    <center>
      <table cellpadding=10>
        <tr>
          <td>Key Terms:<input name=allfields value="$allfields"></td>
          <td>Show <input name=maxhits value="$maxhits" size=4> Titles</td>
          <td><input type=submit value=Search></td>
          </td>
        </tr>
      </table>      
    </center>
  </form>
  <hr>
</a>

<!--------------------------------------------------------------------------
  End of Vortex script
--------------------------------------------------------------------------->

</script>

Back to the Code Example List

The Source Viewer is also a Code Example.
Click Here to see its source.
Copyright © 1992-1999 Thunderstone Software
Copyright © 2024 Thunderstone Software LLC. All rights reserved.