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

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

<?cs def:print_course(course) ?>
  <?cs call:print_course_row(lang.super_upload_tar.label.0, course.course_subdir) ?>
  <?cs call:print_course_row(lang.super_upload_tar.label.1, course.course_dir) ?>
  <?cs call:print_course_row(lang.super_upload_tar.label.2, course.course_no) ?>
  <?cs call:print_course_row(lang.super_upload_tar.label.3, course.course_title) ?>
  <?cs call:print_course_row(lang.super_upload_tar.label.4, course.course_semester) ?>
  <?cs call:print_course_row(lang.super_upload_tar.label.5, lang.super_upload_tar.type[course.type]) ?>
  <?cs call:print_course_row(lang.super_upload_tar.label.6, lang.super_upload_tar.status[0]) ?>
<?cs /def ?>

<?cs def:print_user(course) ?>
  <br /><br />
  <table border="1" cellspacing="0" cellpading="4">
   <tr>
    <?cs each:this = lang.super_upload_tar.heading ?>
      <th><?cs var:this ?></th>
    <?cs /each ?>
  </tr>
   <?cs each:user = course.users ?>
    <?cs if:user.is_new == #2  ?>
     <tr class="tr_error">
    <?cs elif:user.group == #0 ?>
     <tr class="tr_teacher">
    <?cs else ?>
     <tr>
    <?cs /if ?>
        <td><?cs var:user.first ?> <?cs var:user.last ?></td>
        <td><?cs var:user.id ?> </td>
        <td><?cs var:user.username ?> </td>
        <td><?cs var:lang.super_upload_tar.user_status[user.is_new] ?> </td>
      <td><?cs var:lang.super_upload_tar.group[user.group] ?> </td>
        <td><?cs var:lang.super_upload_tar.add_state[user.central_state] ?> </td>
     </tr>
    <?cs /each ?>
    <tr>
     <td colspan="7" align="center">
       <?cs var:lang.super_upload_tar.total ?> <?cs var:suc_total ?>
     </td>
  </tr>
   <?cs if:inv_total != #0 ?>
    <tr>
     <td colspan="7" align="center">
       <?cs var:lang.super_upload_tar.failed ?> <?cs var:inv_total ?>
     </td>
    </tr>
    <?cs /if ?>
</table>
<?cs /def ?>

<?cs def:summary_course(course) ?>
 <div><br /></div>
 <?cs if:course.type == #0 ?>
  <table class="table_data_std" border="1" cellspacing="0" cellpadding="4">
 <?cs elif:course.type == #1 ?>
  <table class="table_data_ctr" border="1" cellspacing="0" cellpadding="4">
 <?cs else ?>
  <table class="table_data_tmp" border="1" cellspacing="0" cellpadding="4">
 <?cs /if ?>
 <?cs call:print_course(course) ?>
 </table>
 <?cs call:print_user(course) ?>
<?cs /def ?>

<?cs def:print_conent() ?>
<fieldset>
   <?cs if:ctr_total ?>
   <legend>
     <?cs var:ctr_total ?> <?cs var:lang.super_upload_tar.normal_temp ?></legend>
     <?cs each:this = ctr ?>
       <?cs call:summary_course(this) ?>
     <?cs /each ?>
   <?cs /if ?>
    
   <?cs if:std_total ?>
     <legend><?cs var:std_total ?> <?cs var:lang.super_upload_tar.standalone ?></legend>
     <?cs each:this = std ?>
       <?cs call:summary_course(this) ?>
     <?cs /each ?>
   <?cs /if ?>
</fieldset>
<?cs /def ?>

<?cs call:html_header() ?>
   <head>
      <title><?cs var:lang.super_upload_tar.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"  />
   <?cs call:addDoIMenu() ?>
  </head>
<body>
<div id="container">
 <?cs call:top_container() ?>
 <?cs call:doIMenu() ?>
 <div id="content">
  <?cs call:print_conent() ?>
 </div>
</div>
</body>
</html>

<?cs call:runtime() ?>
