Texis Web Script source code for: /texis/site/demos/recipe.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 $units url>
<export $mflag url>
<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>

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

<a name=hdr>
<demolook title="Texis Code Examples: Recipe Book">
</a>

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

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

<!--------------------------------------------------------------------------
  Execute image update and display recipe with new picture
--------------------------------------------------------------------------->

<A NAME=doupdate>
  <hdr>
<!-- 
    <SQL "UPDATE recipe SET Image = $nimage where id = $id">
      <prtrec>
    </SQL>
-->
  <ftr>
</A>

<!--------------------------------------------------------------------------
  Image update form
--------------------------------------------------------------------------->

<A NAME=updimage PUBLIC>
  <hdr>
    <center><big>Change Image</big></center>
    <br>
    <center>
      <FORM method=POST action=$url/passwdchk.html>
        Enter full path name of GIF file on index.
        <p>
        <SQL "SELECT Image from recipe where id = $id">
          Image: <INPUT SIZE=40 NAME="nimage" VALUE=$Image>
        </SQL>
        <P>
          <table cellpadding=2>
            <tr>
              <td>Password:<input name=pass size=10 type=password value=""></td>
              <td><INPUT TYPE=submit VALUE="Update"></td>
              <td><input TYPE=reset></td>
          </tr>
        </table>
      </FORM>
    </center>
  <ftr>
</A>

<!--------------------------------------------------------------------------
  Check password
--------------------------------------------------------------------------->

<A NAME=passwdchk public>
    <pwencrypt $pass "u5">
    <$pass = $ret>
    <if $pass eq "u5w4ArqqyNoZU">
      <doupdate>
    <else>
      <hdr>
      <center><big>Your password is wrong, could not update the picture.</big></center>
      <br>
      <$mflag = 1>
      <detail>
    </if>
</A>

<!--------------------------------------------------------------------------
  Display image
--------------------------------------------------------------------------->

<A NAME=image PUBLIC>
  <SQL "SELECT Image from recipe where id = $id">
    <spew $Image>
  </SQL>
</A>

<!--------------------------------------------------------------------------
  Display entire recipe
--------------------------------------------------------------------------->

<A NAME=prtrec>
  <title>$Name</title>
  <p>
  <p><img src=$url/image.gif>
  <h1>$Name</h1>
  <br><send $Description><br>
  <h3>$Servings</h3><br>
  <h2>Ingredients</h2><ul><send $Ing></ul>
  <h2>Method</h2><send $Ins></OL>
  <h2>Notes</h2><send $AddInfo><p>
  <b>Difficulty: </b><send $Difficulty><br>
  <b>Time: </b><send $Time><br>
  <b>Precision: </b><send $Precision><p>
  <a href=$url/updimage.html>Change Image</a><br>
</A>

<!--------------------------------------------------------------------------
  Display recipe
--------------------------------------------------------------------------->

<A NAME=detail PUBLIC>
  <if $mflag neq 1>
    <hdr>
  </if>
    <$mflag = "">
    <if $units eq 'us'>
      <SQL "SELECT id, Name, Description, UsServ AS Servings, UsIng AS Ing, UsIns AS Ins, AddInfo, Difficulty, Time, Precision from recipe where id = $id">
        <prtrec>
      </SQL>
    <else>
      <SQL "SELECT id, Name, Description, MetServ AS Servings, MetIng AS Ing, MetIns AS Ins, AddInfo, Difficulty, Time, Precision from recipe where id = $id">
        <prtrec>
      </SQL>
    </if>
  <ftr>
</A>

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

<A NAME=search PUBLIC>
  <hdr>
    <p align=right><a href="$url/">New Search</a></p>
    <center><big>Matching Recipes</big></center>
    <br>
    <if $maxhits eq "">
      <$maxhits=50>
    </if>
    <apicp allinear 1>
    <SQL null="" MAX=$maxhits "SELECT Name, id from recipe where Name\UsIng\Description like $uquery
      and Name like $uname and UsIng like $uing and Description like $udescription">
      <A HREF=$url/detail.html>$Name</A>
      <p>
    </SQL>
    Found $loop Recipes
    <p><a href="$url/">New Search</a></p>
  <ftr>
</A>

<!--------------------------------------------------------------------------
  Search form for recipe
--------------------------------------------------------------------------->

<A NAME=main PUBLIC>
  <hdr>
    <center><big>Recipe Query Form</big></center>
    <br>
    <center><b>Type search word(s) and click Search.</b></center>
    <br>
    <center>
      <table border=0 width=85% cellpadding=10%><tr><td valign=top><h5 align=right>
        <tr>
          <td>
            <FORM METHOD=POST ACTION=$url/search.html>
              <PRE>
                Entire Recipe: <INPUT NAME="uquery" SIZE=35>
                Ingredients:   <INPUT NAME="uing" SIZE=35>
                Name:          <INPUT NAME="uname" SIZE=35>
                Description:   <INPUT NAME="udescription" SIZE=35>
                Units:  <INPUT TYPE=radio NAME=units VALUE="us" CHECKED>US  <INPUT TYPE=radio NAME=units VALUE="metric">Metric

                <input type="submit" value="Search"> <input type="reset" value="Reset"> Maximum results:<input size=4 name="maxhits" value=50>
              </PRE>
            </FORM>
          </td>
        </tr>
      </table>
    </center>
    <hr>
    <center><i>Be more specific if you get too many matches.  Be less specific if you get too few.</i></center>
  <ftr>
</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.