Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

innerPages.xml

00001 <?xml version="1.0" encoding="ISO-8859-1"?>
00002 
00003 
00004 <!-- The JWAA Demo Application -->
00005 <pages title= "JWAA Inner Pages" >
00006 
00007   <!-- 
00008     The form element's type attribute specifies that an
00009     instance of DemoAccountBean$LoginForm be created to
00010     contain the login form parameters which is returned to
00011     the <logic> as the $form parameter.  This is a container
00012     class; an artifice to work around a bone-headed Velocity
00013     limitation: static methods and class constructors are not
00014     available to Velocity programs, so DemoAccountBean (the
00015     account class) cannot be loaded by calling its static
00016     load method.  Therefore parameters containers provide
00017     instance methods (such as the load method below) to call
00018     whatever static methods/constructors we might need.
00019   -->
00020   <page id="PORTAL" name="Demo" requiresRole="none" 
00021     title="Demo Login/Registration" 
00022   >
00023 
00024   <p>
00025     A simple login and registration form.  The registration form 
00026     shows how fields are validated and stored in the database. 
00027     The login form shows how fields are retrieved, used to lookup 
00028     an account record in the database, and to mark that account as 
00029     logged in by recording it in the browser's session.
00030   </p>
00031 
00032     <form id="PORTAL_FORM" type="edu.virtualschool.jwaa.bean.DemoAccountBean$LoginForm">
00033       <logic>
00034 <!-- If logged in already bypass useless login -->
00035 #if (not $account.isNull())
00036   $self.gotoPage('INNER')
00037 #end
00038 #if ($form.op.toString() eq "Register")
00039   $self.gotoPage("REGISTER")
00040 #end
00041 <!--
00042   If login parameters all pass validation use them to attempt
00043   login.  If successful, record the account in the session with
00044   $self.setAccount($account) and go to the demo home page.  Else
00045   present the login page.  
00046 -->
00047 #if ($form.ok())
00048   #set ($account = $form.load($dbms))
00049   #if (not $account.isNull())
00050     $self.setAccount($account)
00051     $self.gotoPage('INNER')
00052   #end
00053 #end
00054 </logic>
00055   <p>
00056     <input name="op" value="Register" type="submit" />
00057     an account first, then type your email address and 
00058     password to login.
00059   </p>
00060   <table align="center">
00061     <tr>
00062       <th>Email</th>
00063       <td>
00064         <input name="email" value="$!form.email" type="text" size="16"/>
00065         #redFont($form.email.message)
00066       </td>
00067     </tr>
00068     <tr>
00069       <th>Password</th>
00070       <td>
00071         <input name="password" value="$!form.password" size="16" type="password" />
00072         #redFont($form.password.message)
00073       </td>
00074     </tr>
00075     <tr>
00076       <td colspan="2" align="center">
00077         <input name="op" value="Login" type="submit" /> 
00078         #redFont($form.message)
00079       </td>
00080     </tr>
00081   </table>
00082 </form>
00083     
00084   </page>
00085 
00086   <!-- The logout page nulls out the Account record in the session and
00087   forwards to the site's home page. The natural way of doing this
00088   would be to call $self.setAccount(null), but null is not allowed
00089   by Velocity.  -->
00090   <page id="LOGOUT" name="Logout" title="Logout Page" requiresRole="none">
00091     <logic>
00092       $self.logout();
00093       $self.gotoPage('OUTER')
00094     </logic>
00095   </page>
00096 
00097   <page id="NOTFOUND" name="Not Found" title="Not Found" requiresRole="none">
00098     <p>Page not found</p>
00099   </page>
00100 
00101   <page id="FAULT" name="Fault" title="Software Fault" requiresRole="none">
00102     <p>Software fault</p>
00103   </page>
00104 
00105   <page id="DENY" name="Denied" title="Access Denied" requiresRole="none">
00106     <logic>
00107       $self.gotoPage("PORTAL");
00108     </logic>
00109   </page>
00110 
00111 
00112   <!-- The main demo inner page.  -->
00113   <page id="INNER" name="Demo" requiresRole="person" title="Demo Home Page" >
00114 
00115   <table align="center">
00116     <tr>
00117       <th align="right">Email</th>
00118       <td>$account.email</td>
00119     </tr>
00120     <tr>
00121       <th align="right">Name</th>
00122       <td>$account.name</td>
00123     </tr>
00124     <tr>
00125       <th align="right">Address</th>
00126       <td>$account.address</td>
00127     </tr>
00128     <tr>
00129       <th align="right">Phone</th>
00130       <td>$account.phone</td>
00131     </tr>
00132     <tr>
00133       <th align="right"><a idref="UPDATE">Update</a></th>
00134       <td>this information.</td>
00135     </tr>
00136   </table>
00137 
00138   <p>
00139     This is the demo web application's inner page.  A real 
00140     application would provide access to all the features of 
00141     the application here.  This demo only provides two services,
00142     just enough to show how real services are provided:
00143   </p>
00144 
00145     <ul>
00146 
00147       <li>
00148         <a idref="UPDATE">Update</a> shows
00149         how the persistent information in the
00150         database (the information created during
00151         account registration in this example)
00152         is accessed and modified.
00153       </li>
00154         
00155       <li>
00156         <a idref="LOGOUT">Logout</a> shows how
00157         session-specific information is accessed
00158         and modified, such as the session variable
00159         that identifies which (if any) account
00160         is currently logged in.
00161       </li>
00162 
00163     </ul>
00164 
00165     <p>
00166       Open <a idref="innerPages.xml">innerPages.xml</a> and search for 
00167       UPDATE or LOGOUT to view the XML for the two services.
00168     </p>
00169 
00170   </page>
00171 
00172   <page id="REGISTER" name="Register" requiresRole="none"
00173     title="Account Registration Page" >
00174 
00175     <p>
00176       In this demo, the registration procedure is only to 
00177       collect recognizable data to edit during the demo.
00178       The email address is used only as an easily remembered 
00179       string to identify your account uniquely.  You needn't 
00180       provide real information so long as the email address 
00181       is unique and you can remember it easily.
00182     </p>
00183 
00184   <form id="REGISTRATION_FORM" type="edu.virtualschool.jwaa.bean.DemoAccountBean$UpdateForm">
00185     <logic>
00186 #if ($form.ok())
00187   #set ($account = $form.createAccount($dbms))
00188   #if (not $account.isNull())
00189     $self.setAccount($account)
00190     $self.gotoPage('INNER')
00191   #end
00192 #end
00193     </logic>
00194   <table align="center">
00195 
00196     <tr>
00197       <th align="right">Email Address</th>
00198       <td>
00199         <input name="email" value="$!form.email" size="24" />
00200         #redFont($form.email.message)
00201       </td>
00202     </tr>
00203 
00204     <tr>
00205       <th align="right">Name</th>
00206       <td>
00207         <input name="name" value="$!form.name" size="24" />
00208         #redFont($form.name.message)
00209       </td>
00210     </tr>
00211 
00212     <tr>
00213       <th align="right">Street</th>
00214       <td>
00215         <input name="street" value="$!form.street" size="24" />
00216         #redFont($form.street.message)
00217       </td>
00218     </tr>
00219 
00220     <tr>
00221       <th align="right">City</th>
00222       <td>
00223         <input name="city" value="$!form.city" size="24" />
00224         #redFont($form.city.message)
00225       </td>
00226     </tr>
00227 
00228     <tr>
00229       <th align="right">State</th>
00230       <td>
00231         <input name="state" value="$!form.state" size="2" />
00232         <!--
00233         <select name="state">
00234           <option>  </option>
00235           <option>AK</option>
00236           <option>AL</option>
00237           <option>AR</option>
00238           <option>AZ</option>
00239           <option>CA</option>
00240           <option>CO</option>
00241           <option>CT</option>
00242           <option>DC</option>
00243           <option>DE</option>
00244           <option>FL</option>
00245           <option>GA</option>
00246           <option>GU</option>
00247           <option>HI</option>
00248           <option>IA</option>
00249           <option>ID</option>
00250           <option>IL</option>
00251           <option>IN</option>
00252           <option>KS</option>
00253           <option>KY</option>
00254           <option>LA</option>
00255           <option>MA</option>
00256           <option>MD</option>
00257           <option>ME</option>
00258           <option>MI</option>
00259           <option>MN</option>
00260           <option>MO</option>
00261           <option>MS</option>
00262           <option>MT</option>
00263           <option>NC</option>
00264           <option>ND</option>
00265           <option>NE</option>
00266           <option>NH</option>
00267           <option>NJ</option>
00268           <option>NM</option>
00269           <option>NV</option>
00270           <option>NY</option>
00271           <option>OH</option>
00272           <option>OK</option>
00273           <option>OR</option>
00274           <option>PA</option>
00275           <option>PR</option>
00276           <option>RI</option>
00277           <option>SC</option>
00278           <option>SD</option>
00279           <option>TN</option>
00280           <option>TX</option>
00281           <option>UT</option>
00282           <option>VA</option>
00283           <option>VI</option>
00284           <option>VT</option>
00285           <option>WA</option>
00286           <option>WI</option>
00287           <option>WV</option>
00288           <option>WY</option> 
00289         </select>
00290         -->
00291         #redFont($!form.state.message)
00292 
00293         Zip <input name="zipcode" value="$!form.zipcode" size="5" />
00294         #redFont($!form.zipcode.message)
00295 
00296         Cntry <input name="country" value="$!form.country" size="3" />
00297         #redFont($!form.country.message)
00298       </td>
00299     </tr>
00300 
00301     <tr>
00302       <th align="right">Phone</th>
00303       <td>
00304         <input name="phone" value="$!form.phone" size="24" />
00305         #redFont($!form.phone.message)
00306       </td>
00307     </tr>
00308 
00309     <tr>
00310       <th align="right">Password</th>
00311       <td>
00312         <input name="password" value="$!form.password" size="24"
00313           type="password" />
00314         #redFont($form.password.message)<br/>
00315       </td>
00316     </tr>
00317 
00318     <tr>
00319       <th align="right">Password (again)</th>
00320       <td>
00321         <input name="passwordConfirm" value="$!form.passwordConfirm" size="24"
00322           type="password" />
00323         #redFont($form.passwordConfirm.message)
00324       </td>
00325     </tr>
00326 
00327     <tr>
00328       <td colspan="2" align="center">
00329         <input type="submit" name="op" value="Commit" />
00330         #redFont($!form.message)
00331       </td>
00332     </tr>
00333 
00334   </table>
00335   </form>
00336   </page>
00337 
00338   <!-- This provides the account information update service. 
00339   UpdateForm is a parameters container class (defined
00340   within the DemoAccountBean class) to contain the form 
00341   parameters. If all fields validate correctly ($form.ok())
00342   the container class's update method is called, which updates 
00343   the argument account ($account) with the new information
00344   and saves the result in the database ($dbms) and fowards 
00345   control to the inner demo home page.  -->
00346   <page id="UPDATE" name="Account Update" requiresRole="person" title="Account Update Page" >
00347   
00348     <p>
00349       This page shows how information in the database, stored
00350       there during registration in this example, can be 
00351       retrieved, modified, validated, and returned to the database.
00352     </p>
00353 
00354   <form id="UPDATE_FORM" type="edu.virtualschool.jwaa.bean.DemoAccountBean$UpdateForm">
00355     <logic>
00356 #if ($form.ok())
00357     $form.updateAccount($dbms, $account)
00358     $self.gotoPage('INNER')
00359 #end
00360     </logic>
00361 
00362   <table align="center">
00363 
00364     <tr>
00365       <th align="right">Account</th>
00366       <td>
00367         <input name="email" value="$!form.email" size="24" />
00368         #redFont($form.email.message)
00369       </td>
00370     </tr>
00371 
00372     <tr>
00373       <th align="right">Name</th>
00374       <td>
00375         <input name="name" value="$!form.name" size="24" />
00376         #redFont($form.name.message)
00377       </td>
00378     </tr>
00379 
00380     <tr>
00381       <th align="right">Street</th>
00382       <td>
00383         <input name="street" value="$!form.street" size="24" />
00384         #redFont($form.street.message)
00385       </td>
00386     </tr>
00387 
00388     <tr>
00389       <th align="right">City</th>
00390       <td>
00391         <input name="city" value="$!form.city" size="24" />
00392         #redFont($form.city.message)
00393       </td>
00394     </tr>
00395 
00396     <tr>
00397       <th align="right">State</th>
00398       <td>
00399         <input name="state" value="$!form.state" size="2" />
00400         <!--
00401         <select name="state">
00402           <option>  </option>
00403           <option>AK</option>
00404           <option>AL</option>
00405           <option>AR</option>
00406           <option>AZ</option>
00407           <option>CA</option>
00408           <option>CO</option>
00409           <option>CT</option>
00410           <option>DC</option>
00411           <option>DE</option>
00412           <option>FL</option>
00413           <option>GA</option>
00414           <option>GU</option>
00415           <option>HI</option>
00416           <option>IA</option>
00417           <option>ID</option>
00418           <option>IL</option>
00419           <option>IN</option>
00420           <option>KS</option>
00421           <option>KY</option>
00422           <option>LA</option>
00423           <option>MA</option>
00424           <option>MD</option>
00425           <option>ME</option>
00426           <option>MI</option>
00427           <option>MN</option>
00428           <option>MO</option>
00429           <option>MS</option>
00430           <option>MT</option>
00431           <option>NC</option>
00432           <option>ND</option>
00433           <option>NE</option>
00434           <option>NH</option>
00435           <option>NJ</option>
00436           <option>NM</option>
00437           <option>NV</option>
00438           <option>NY</option>
00439           <option>OH</option>
00440           <option>OK</option>
00441           <option>OR</option>
00442           <option>PA</option>
00443           <option>PR</option>
00444           <option>RI</option>
00445           <option>SC</option>
00446           <option>SD</option>
00447           <option>TN</option>
00448           <option>TX</option>
00449           <option>UT</option>
00450           <option>VA</option>
00451           <option>VI</option>
00452           <option>VT</option>
00453           <option>WA</option>
00454           <option>WI</option>
00455           <option>WV</option>
00456           <option>WY</option> 
00457         </select>
00458         -->
00459         #redFont($!form.state.message)
00460 
00461         Zip <input name="zipcode" value="$!form.zipcode" size="5" />
00462         #redFont($!form.zipcode.message)
00463 
00464         Cntry <input name="country" value="$!form.country" size="3" />
00465         #redFont($!form.country.message)
00466       </td>
00467     </tr>
00468 
00469     <tr>
00470       <th align="right">Phone</th>
00471       <td>
00472         <input name="phone" value="$!form.phone" size="24" />
00473         #redFont($!form.phone.message)
00474       </td>
00475     </tr>
00476 
00477     <tr>
00478       <th align="right">Password (twice)</th>
00479       <td>
00480         <input name="password" value="$!form.password" 
00481           size="24" type="password"/>
00482         #redFont($form.password.message)<br/>
00483         <input name="passwordConfirm" value="$!form.passwordConfirm" 
00484           size="24" type="password"/>
00485         #redFont($form.passwordConfirm.message)
00486       </td>
00487     </tr>
00488 
00489     <tr>
00490       <td colspan="2" align="center">
00491         <input type="submit" name="op" value="Commit" />
00492         #redFont($!form.message)
00493       </td>
00494     </tr>
00495 
00496   </table>
00497   </form>
00498   </page>
00499 
00500 <page id="ADMIN" name="Admin" requiresRole="admin"
00501   title="Demo Administration Page" >
00502 
00503 <table>
00504 <tr>
00505  <th>ID</th>
00506  <th>Roles</th>
00507  <th>Name</th>
00508  <th>Email</th>
00509  <th>When</th>
00510 </tr>
00511 #foreach ($person in DemoAccountBean.loadAll(dbms))
00512 <tr>
00513   <td align="right"><a idref="ADMIN_EDIT">$person</a></td>
00514  <td>$person.name</td>
00515  <td>$person.email</td>
00516  <td>$person.phone</td>
00517  <td>$person.roles</td>
00518  <td>$person.whenCreated</td>
00519 </tr>
00520 </table>
00521 </page>
00522 
00523 <page id="ADMIN_EDIT" name="Administration" requiresRole="admin"
00524   title="Account Administration" >
00525 
00526   <form id="ADMIN_EDIT_FORM"
00527     type="edu.virtualschool.jwaa.bean.DemoAccountBean$AdminForm">
00528   <input type="hidden" name="aid" value="$aid" />
00529   <p>
00530     The administrator uses this to review/update account information,
00531     to delete obsolete accounts, and to review account activity.
00532   </p>
00533 
00534 <table>
00535  <tr>
00536   <th align="center" colspan="2"> Account#$aid 
00537     <input type="submit" name="op" value="Commit" />
00538     </th>
00539     <th>
00540       <input type="submit" name="op" value="Delete" />
00541       <input type="checkbox" name="ReallyDelete" value="Yes" />
00542       </th>
00543  </tr>
00544 
00545  <tr>
00546   <th align="right">Email</th>
00547   <td>
00548     <input name="email" value="$!form.email" size="16" />
00549       #redFont($!form.email.message)
00550   </td>
00551   <th align="right">Password</th>
00552   <td>
00553     <input name="password" value="$!form.password" size="16" />
00554       #redFont($!form.password.message)
00555   </td>
00556  </tr>
00557 
00558  <tr><td colspan="4"><hr/></td></tr>
00559 
00560  <tr>
00561   <th align="right">Name</th>
00562   <td>
00563     <input name="name" value="name" size="16" />
00564     #redFont($form.name.message)
00565   </td>
00566   <th align="right">Street</th>
00567   <td>
00568     <input name="street" value="street" size="16" />
00569       #redFont($form.street.message)
00570   </td>
00571  </tr>
00572 
00573  <tr>
00574   <th align="right">City</th>
00575   <td>
00576     <input name="city" value="city" size="16" />
00577     #redFont($form.city.message)
00578   </td>
00579   <th align="right">State</th>
00580   <td>
00581     #redFont($form.state.message)
00582     <input name="zipcode" value="zipcode" size="5" />
00583       Zip #redFont($form.zipcode.message)
00584     <input name="country" value="country" size="3" />
00585     Cntry #redFont($form.country.message)
00586   </td>
00587  </tr>
00588 
00589  <tr>
00590   <th align="right">Email</th>
00591   <td>
00592     <input name="email" value="email" size="16" />
00593       #redFont($form.email.message)
00594   </td>
00595   <th align="right">Phone</th>
00596   <td>
00597     <input name="phone" value="phone" size="16" />
00598       #redFont($form.phone.message)
00599   </td>
00600  </tr>
00601 
00602  <tr>
00603   <th align="right">Role</th>
00604   <td colspan="3">
00605     <input name="roles" value="roles" size="16" />
00606    #redFont($form.roles.message)
00607   </td>
00608  </tr>
00609 
00610 </table>
00611 </form>
00612   </page>
00613 
00614 </pages>