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

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

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

<?cs def:print_user(course) ?>
  <div><br /></div>
  <table border="1" cellspacing="0" cellpading="4">
   <tr>
    <?cs each:this = lang.super_xml_course_create.heading ?>
      <th><?cs var:this ?></th>
    <?cs /each ?>
  </tr>
   <?cs each:user = course.users ?>
    <?cs if:user.is_new == #3  || user.is_new == #4 ?>
     <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>
        <?cs if:course.type == #0 ?>
        <td><?cs var:lang.super_xml_course_create.ctr_state[3] ?> </td>
      <?cs else ?>
        <td><?cs var:lang.super_xml_course_create.user_status[user.is_new] ?> </td>
      <?cs /if ?>
      <td><?cs var:lang.super_xml_course_create.group[user.group] ?> </td>
        <td><?cs var:lang.super_xml_course_create.add_state[user.add_state] ?> </td>
      <?cs if:course.type == #0 ?>
        <td><?cs var:lang.super_xml_course_create.ctr_state[3] ?> </td>
      <?cs else ?>
        <td><?cs var:lang.super_xml_course_create.ctr_state[user.central_state] ?> </td>
      <?cs /if ?>
     </tr>
    <?cs /each ?>
    <tr>
     <td colspan="7" align="center">
       <?cs var:lang.super_xml_course_create.total ?> <?cs var:course.total_users ?>
     </td>
  </tr>
</table>
<?cs /def ?>

<?cs def:summary_course(course) ?>
 <?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) ?>
 <br /><br />
<?cs /def ?>

<?cs def:print_content() ?>
 <?cs if:ctr_total ?>
     <h4><?cs var:ctr_total ?> <?cs var:lang.super_xml_course_create.normal_temp ?></h4>
     <?cs each:this = ctr ?>
       <?cs call:summary_course(this) ?>
     <?cs /each ?>
   <?cs /if ?>
    
   <?cs if:std_total ?>
     <h4><?cs var:std_total ?> <?cs var:lang.super_xml_course_create.standalone ?></h4>
     <?cs each:this = std ?>
       <?cs call:summary_course(this) ?>
     <?cs /each ?>
   <?cs /if ?>
<?cs /def ?>

<?cs call:html_header() ?>
   <head>
      <title><?cs var:lang.super_xml_course_create.page_title ?></title>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
   <?cs if:from_faculty ?>
   <link rel="StyleSheet" href="<?cs var:image_path ?>common.css" type="text/css"  />
   <?cs else ?>
   <link rel="StyleSheet" href="<?cs var:image_path ?>super_template.css" type="text/css"  />
   <?cs call:addDoIMenu() ?> 
 <?cs /if ?> 
   
   <script language="javascript">
   function dothis()
   {
      opener.parent.location.reload();
          window.close();
   }
   </script>
  </head>

<body>
<?cs if:from_faculty ?>
  <div class="course_info">
  <span class="course_name"><?cs var:course_no ?> <?cs var:course_title ?><br />
   <?cs var:semester ?></span> <i><?cs var:instructor ?> </i>
  </div>
  <div>
  <a href="javascript:dothis()" title="<?cs var:lang.super_xml_course_create.closewindow ?>">
  <img src="<?cs var:image_path ?>close.gif" alt="<?cs var:lang.super_xml_course_create.closewindow ?>" /></a>
  </div>
  <br />
  <br />

  <fieldset style="width:85%">
  <legend class="fieldset_legend"><?cs var:lang.super_xml_course_create.added_updated_courses ?></legend>
  <?cs call:print_content() ?>
 </fieldset>
<?cs else ?>
<div id="container">
  <?cs call:top_container() ?>
  <?cs call:doIMenu() ?>
  <div id="content">
  <?cs call:print_content() ?>
  </div>
</div>
<?cs /if ?>
</body>
</html>

<?cs call:runtime() ?>
