<?cs include:"util.cs" ?>

<?cs def:print_list(data) ?>
<table width="100%">
 <tr><td align="center">
 <br />
 <br />
 
  <fieldset style="width:50%">
  <legend class="fieldset_legend"><?cs var:lang.admin_reset_pass_form.title ?></legend>
  <div><form method="post" action="admin_reset_pass_form" onsubmit="return selected_user()" >
   <div>
     <input type="hidden" name="id" value="<?cs var:id ?>" />
     <input type="hidden" name="crs" value="<?cs var:crs ?>" />
   </div>
  <table cellspacing="0" cellpadding="4">
   <tr><td><select name="student" size="10" title="<?cs var:data.select.help ?>" id="student">
    <?cs each:this = user ?>
     <option value="<?cs var:this.value ?>"><?cs var:this.realname ?></option>
    <?cs /each ?>
    </select></td>
    <td valign="middle" class="regheading" align="center">
     <?cs var:data.check[0] ?><br />
      <input type="submit" name="oper" value="<?cs var:data.check[1] ?>" title="<?cs var:data.check[3] ?>" /><br />
      <?cs var:data.check[2] ?>
    </td>
   </tr>
  </table> 
  </form></div>
  </fieldset>
 </td></tr>
</table>
<?cs /def ?>

<?cs def:print_row(label, value) ?>
 <tr>
    <td class="regheading"><?cs var:label ?></td>
    <td><?cs var:value ?></td>
 </tr>
<?cs /def ?>




<?cs def:print_reset_form(data) ?> 
  <table width="100%">
  <tr><td align="center">
 <br />
 <br />
  <fieldset style="width:50%">
  <legend class="fieldset_legend"><?cs var:data.title ?></legend>
    <div><form method="post" action="admin_reset_password" onsubmit="return confirm_reset()">
     <div>
     <input type="hidden" name="id" value="<?cs var:id ?>" />
     <input type="hidden" name="crs" value="<?cs var:crs ?>" />
     </div>
    <table cellspacing="0" cellpadding="4" border="1">
      <?cs call:print_row(data.label[0], username) ?>
      <?cs call:print_row(data.label[1], realname) ?>
      <?cs call:print_row(data.label[2], user_id) ?>
      <tr><td colspan="2">
         <input type="hidden" name="username" value="<?cs var:username ?>" />
         <input type="hidden" name="realname" value="<?cs var:realname ?>" />
         <input type="hidden" name="ssn" value="<?cs var:user_id ?>" />
         <input type="submit" value="<?cs var:data.reset.msg ?>" title="<?cs var:data.reset.help ?>" />
         </td>
     </tr> 
    </table>
   </form></div>
  </fieldset>
  </td></tr>
  </table>
<?cs /def ?>




<?cs def:print_report(data) ?>
  <table width="100%">
  <tr><td align="center">
 <br />
 <br />
   <fieldset style="width:50%">
   <legend class="fieldset_legend"><?cs var:data.password_reset ?></legend>
   <table border="1" cellspacing="0" cellpadding="4">
      <?cs call:print_row(data.label[0], username) ?>
      <?cs call:print_row(data.label[1], realname) ?>
      <?cs call:print_row(data.label[2], user_id) ?>
      <?cs call:print_row(data.label[3], password) ?>
   </table>
  </fieldset>
  </td></tr>
 </table>
<?cs /def ?>

<?cs call:html_heading() ?>
   <head>
      <title><?cs var:lang.admin_reset_pass_form.title ?></title>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
   <link rel="StyleSheet" href="<?cs var:image_path ?>common.css" type="text/css"  />
   <link rel="StyleSheet" href="<?cs var:image_path ?>manhattan.css" type="text/css"  />
  <script type="text/javascript"> 
  function selected_user()
  {
      var index = document.getElementById('student').selectedIndex;
      if(index < 0)
      {
         window.alert('<?cs var:lang.admin_reset_pass_form.select_user_warn ?>');
         return false;
      }
      return true;
  }
  function confirm_reset()
  {
     return window.confirm('<?cs var:lang.admin_reset_pass_form.confirm_warn ?>');
  }
  </script>
  </head>
<?cs call:define_body() ?>
<?cs call:print_course_heading(back_url, lang.admin_reset_pass_form.goback) ?>
<?cs if:display ?>
<?cs call:print_reset_form(lang.admin_reset_pass_form) ?> 
<?cs elif:success ?>
<?cs call:print_report(lang.admin_reset_pass_form) ?>
<?cs else ?>
 <?cs call:print_list(lang.admin_reset_pass_form) ?>
<?cs /if ?>
</body>
</html>
<?cs call:runtime() ?>
