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

<?cs def:print_row(label, value) ?>
       <tr>
          <th align="right"><?cs var:label ?></th>
          <td><?cs var:value ?></td>
       </tr>
<?cs /def ?>


<?cs def:print_search_param() ?>
  <table cellspacing="0" border="5">
   <?cs call:print_row(lang.super_info.search_button, search) ?>
   <?cs call:print_row(lang.super_info.field_msg, lang.super_info.field[field]) ?>
   <?cs call:print_row(lang.super_info.include_msg, lang.super_info.include[users]) ?>
   <?cs call:print_row(lang.super_info.case_msg, lang.super_info.case[sensitive]) ?>
   <?cs call:print_row(lang.super_info.sort_msg, lang.super_info.sort[sort]) ?>
   <?cs call:print_row(lang.super_info.match_msg, lang.super_info.match[where]) ?>
   <?cs call:print_row(lang.super_info.match_num_msg, num_match) ?>
   <?cs set:data = showing_from + "-" + showing_to ?>
   <?cs call:print_row(lang.super_info.show_record, data) ?>
 </table>
<?cs /def ?>

<?cs def:print_form() ?>
  <?cs if:check_all ?>
   <div><form method="post" action="super_remove"  >
    <div>
     <input type="hidden" name="id" value="<?cs var:Query.id ?>" />
     <input type="hidden" name="num" value="<?cs var:num_match ?>" />
     <input type="button" value="<?cs var:lang.super_info.check_all ?>" onclick="checkAll(this.form.users)" title="<?cs var:lang.super_info.check_all ?>" />
     <input type="button" value="<?cs var:lang.super_info.uncheck_all ?>" onclick="uncheckAll(this.form.users)" title="<?cs var:lang.super_info.uncheck_all ?>" />
     <br />
   </div>
 <?cs /if ?>
<?cs /def ?>

<?cs def:print_checkbox(name, value) ?>
     <?cs if:check_all ?>
      <td><input type="checkbox"  name="<?cs var:name ?>" value="<?cs var:value.username ?>:<?cs var:value.realname ?>:<?cs var:value.id ?>" title="<?cs var:value.realname ?>" /></td>
     <?cs /if ?>
<?cs /def ?>

<?cs def:print_delete_button() ?> 
   <?cs if:check_all ?>
   <tr><td colspan="5" align="center">
       <input  type="submit" name="delete" value="<?cs var:lang.super_info.delete_users ?>"  onclick="return remove_warn()" title="<?cs var:lang.super_info.delete_complete1_help ?>" />
   </td></tr>
   <?cs /if ?>
<?cs /def ?>

<?cs def:print_quick_list() ?>
  <?cs call:print_form() ?>
  <table cellspacing="0" cellpadding="3" border="1">
   <tr>
     <?cs each:this = lang.super_info.table ?>
      <th><?cs var:this ?></th>
     <?cs /each ?>
     <?cs if:check_all ?>
     <th><?cs var:lang.super_info.select ?></th>
     <?cs /if ?>
   </tr>
   
   <?cs each:data = user ?>
   <tr>
    <td>
       <a href="<?cs var:data.url ?>" title="<?cs var:lang.super_info.info_help ?>" >
        <?cs var: data.username ?>
      </a>
    </td>
    <td>
       <?cs if:data.bio_url ?>
        <a href="<?cs var:data.bio_url ?>" title="<?cs var:lang.super_info.bio_help ?>" 
       onclick="newwin=window.open('<?cs var:data.bio_url ?>','bio','menubar=yes,toolbar=yes,status=yes,scrollbars=yes,resizable=yes,width=760,height=500'); newwin.focus(); return false" ><?cs var:lang.super_info.case[1] ?></a>
      <?cs else ?>
        <?cs var:lang.super_info.case[0] ?>
      <?cs /if ?>     
    </td>
    <td>
        <?cs var:data.realname ?>
     </td>
     <td>
        <?cs var:data.id ?>
     </td> 
     <?cs call:print_checkbox("users", data) ?>
  </tr>
   <?cs /each ?>
  <?cs call:print_delete_button() ?> 
</table>
<?cs if:check_all ?>
</form></div>
<?cs /if ?>
<?cs /def ?>
<?cs def:print_navigate_page() ?>
   <div>
    <?cs each:this = page ?>
      <?cs if:this.url ?>
       <a href="<?cs var:this.url ?>" title="<?cs var:lang.super_info.page_help ?> <?cs var:this.name ?>" ><?cs var:this.name ?></a>
     <?cs else ?>
       <?cs var:this.name ?>
     <?cs /if ?>
    <?cs /each ?>
  </div>
<?cs /def ?>

<?cs def:print_one_student_reacord(one_user) ?>
 <table cellpadding="4" cellspacing="0" width="75%">
  <tr>
      <th align="left" colspan="2"><?cs var:lang.super_info.table.0 ?>: <?cs var:one_user.username ?></th>
      <th align="left" colspan="2"><?cs var:lang.super_info.id_name ?>: <?cs var:one_user.id ?></th>
  </tr>
  <tr>
      <td>
         <div><form action="">
          <div><input  type="button" value="<?cs var:one_user.realname ?><?cs if:one_user.bio_exist ?>*<?cs /if ?>" title="<?cs var:lang.super_info.bio_help ?>" onclick="newwin=window.open('<?cs var:one_user.bio_url ?>','bio','menubar=yes,toolbar=yes,status=yes,scrollbars=yes,resizable=yes,width=760,height=500'); newwin.focus(); return false" />
        </div>
        </form></div>
      </td>
     <td>
        <div><form action="">
        <div><input  type="button" value="<?cs var:lang.super_info.modify ?>" title="<?cs var:lang.super_info.modify_help ?>" onclick="newwin=window.open('<?cs var:one_user.modify_url ?>','namewin','resizable=yes,width=500,height=600,top=50,left=50,scrollbars=1'); newwin.focus(); return false" />

      </div>
     </form></div>
     </td>
     <td>
     <div><form action="">
       <div><input  type="button" value="<?cs var:lang.super_info.reset_passwd ?>" title="<?cs var:lang.super_info.reset_passwd_help ?>" onclick="newwin=window.open('<?cs var:one_user.passwd_url ?>','passwin','resizable=yes,width=325,height=250,top=50,left=50'); newwin.focus(); return false" />
       </div>
    </form></div>
     </td>
     <td>
     <div><form action="">
     <div><input  type="button" value="<?cs var:lang.super_info.log ?>" title="<?cs var:lang.super_info.log_help ?>" onclick="newwin=window.open('<?cs var:one_user.log_url ?>','logdatawin','resizable=yes,width=500,height=600,top=50,left=50,scrollbars=1'); newwin.focus(); return false" /> 
    </div>
    </form></div>
   </td></tr>
     </td>
  </tr>
 <?cs set:num_crs = #0 ?>
 <?cs each:crs = one_user.course ?>
  <tr>
   <td>
     <?cs if:crs.delete_url ?>
       <div><form action=""><div>
          <input  type="button" value="<?cs var:lang.super_info.delete_crs ?>" title="<?cs var:lang.super_info.delete_crs_help ?>" onclick="window.open('<?cs var:crs.delete_url ?>','delwin','resizable=yes,width=425,height=300,top=100,left=100')" />
      </div></form></div>
     <?cs else ?> 
      (<?cs var:lang.super_info.teacher ?>) 
      <?cs /if ?>
  </td>
  <td> 
    <?cs var:crs.title ?> (<?cs var:crs.course_dir ?>)
  </td>
  <td>
  <?cs var:crs.semester ?> <?cs var:crs.instructor ?>
  </td>
  <td>
       <?cs var:lang.super_info.access[crs.access] ?>
  </td>
 </tr>
 <?cs set:num_crs = num_crs + #1 ?>
 <?cs /each ?> 
 <tr>
      <td colspan="4" align="center">
      <?cs if:num_crs ?>
      <div><form  action="">
      <div>
        <input  type="button" value="<?cs var:lang.super_info.delete_complete ?>" title="<?cs var:lang.super_info.delete_complete_help ?>" onclick="return warning_func('<?cs var:lang.super_info.delete_msg.0 ?>')" />
     </div>
      </form></div>
     <?cs else ?>
      <div><form method="post" action="super_remove">
      <div>
        <input type="hidden" name="id" value="<?cs var:Query.id ?>" />
        <input type="hidden" name="users" value="<?cs var:this.username ?>:<?cs var:this.realname ?>:<?cs var:this.id ?>" />
        <input  type="submit" value="<?cs var:lang.super_info.delete_complete ?>" title="<?cs var:lang.super_info.delete_complete_help ?>" onclick="return warning_func('<?cs var:lang.super_info.delete_msg.1 ?>')" />

     </div>
     </form></div>
     <?cs /if ?>
  </td>
 </tr> 
</table>
<?cs /def ?>

<?cs def:print_full_list() ?>
  <?cs call:print_navigate_page() ?>
  <table cellspacing="0" cellpadding="3" > 
   <?cs each:this = user ?>
   <?cs if:name(this) % 2 == #0 ?>
     <tr>
   <?cs else ?>
     <tr class="tr_odd">
   <?cs /if ?>
   <td align="center">
      <?cs call:print_one_student_reacord(this) ?>
   </td>
    </tr>
   <?cs /each ?>
  </table>
  <?cs call:print_navigate_page() ?>
<?cs /def ?>

<?cs def:print_content() ?>
<fieldset>
<legend><?cs var:lang.super_info.page_title ?></legend>
<table width="100%">
<tr><td align="center">
   <?cs call:print_search_param() ?><br />
   <?cs if:full_record ?>
     <?cs call:print_full_list() ?>
   <?cs else ?> 
     <?cs call:print_quick_list() ?>
   <?cs /if ?>
</td></tr>
</table>
</fieldset>
<?cs /def ?>

<?cs call:html_header() ?>   
<head>
      <title><?cs var:lang.super_info.page_title ?></title>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
   <link rel="StyleSheet" href="<?cs var:image_path ?>super_template.css" type="text/css"  />
   <script type="text/javascript" src="<?cs var:image_path ?>form_validation.js"></script>
   <?cs call:addDoIMenu()   ?> 
	<script type="text/javascript" >
   function remove_list()
   {
      var obj = document.forms[0].users;
      if(obj.checked)
             return true;
      else
      {
             if(obj.length >0)
             {
                 for(i =0; i<obj.length; i++)
                 {
                    if(obj[i].checked)
                      return true;
                 }
             }
             return false;
      }
   }
   function remove_warn()
   {
       if(remove_list() == false)
       {
            window.alert('<?cs var:lang.super_info.must_select_one ?>');
            return false;
       }
       return window.confirm('<?cs var:lang.super_info.delete_complete ?>');

   }
  </script>
   
  </head>

<body>
<div id="container">
  <?cs call:top_container() ?>
  <?cs call:doIMenu() ?>
  <div id="content">
   <?cs call:print_content() ?>
  </div>
</div>
</body>
</html>
<?cs call:runtime() ?>
