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

<?cs def:print_description(desc) ?>
 <?cs if:desc ?><?cs var:desc ?><?cs else ?><?cs var:lang.super_new_course_form.no_description ?><?cs /if ?>
<?cs /def ?>

<?cs def:print_group(label) ?>
 <tr>
  <th align="left"><?cs var:label.msg ?></th>
  <td><select name="subdir"  title="<?cs var:label.help ?>" id="subdir">
      <option value="__new__"><?cs var:label.new_group ?></option>
      <?cs each:this = course_group ?>
      <option value="<?cs var:this.value ?>"><?cs var:this.value ?>(<?cs call:print_description(this.description) ?>)</option>
      <?cs /each ?>
     </select>
  <input type="text" name="new_subdir" size="20" id="new_subdir" maxlength="<?cs var:max_sub ?>" title="<?cs var:label.help_2 ?>"  />
  </td>
 </tr>
<?cs /def ?>





<?cs def:print_row(name, type, label, max) ?>
 <tr>
   <th align="left"><?cs var:label.msg ?></th>
   <?cs if:max ?>
   <td><input type="<?cs var:type ?>" name="<?cs var:name ?>" id="<?cs var:name ?>" title="<?cs var:label.help ?>"  size="20" maxlength="<?cs var:max ?>" />
   </td>
   <?cs else ?>
   <td><input type="<?cs var:type ?>" name="<?cs var:name ?>" id="<?cs var:name ?>" title="<?cs var:label.help ?>"  />
   </td>
   <?cs /if ?>
 </tr>
<?cs /def ?>





<?cs def:print_type_option(label) ?>
  <tr>
   <th align="left"><?cs var:label.msg ?></th>
   <td>
    <select name="type"  title="<?cs var:label.help ?>" id="type">
    <?cs set:value = #0 ?> 
    <?cs each:this =  label.option ?>
     <option value="<?cs var:value ?>"><?cs var:this ?></option>
     <?cs set:value = value + #1 ?> 
    <?cs /each ?>
   </select>
  </td>
 </tr> 
<?cs /def ?>

<?cs def:print_sumit(label) ?>
  <tr>
   <td colspan="2" align="center">
   <input type="submit" value="<?cs var:label.msg ?>" title="<?cs var:label.help ?>"  />
   </td>
  </tr>
<?cs /def ?>


<?cs def:print_roster() ?>
  <div><form  method="post" enctype="multipart/form-data" action="super_upload_roster" onsubmit="return roster_upload()">
  <div>
   <input type="hidden" name="id" value="<?cs var:id ?>" />
  </div>
  <table cellspacing="0" cellpadding="4" >
     <?cs call:print_group(lang.super_new_course_form.label[0]) ?>
     <?cs call:print_row("crs", "text", lang.super_new_course_form.label[1], max_id) ?>
     <?cs call:print_row("roster", "file", lang.super_new_course_form.label[2], #0) ?>
     <?cs call:print_type_option(lang.super_new_course_form.label[3]) ?>
     <?cs call:print_sumit(lang.super_new_course_form.label[4]) ?>
    </table>
  </form>
  <script type="text/javascript"> document.forms[0].crs.focus(); </script>
  </div>
<?cs /def ?>




<?cs call:html_header() ?>
   <head>
      <title><?cs var:lang.super_new_course_form.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> 
   <script type="text/javascript" src="<?cs var:image_path ?>xp_progress.js"></script> 
   <?cs call:addDoIMenu() ?>
   <script type="text/javascript">
       function roster_upload()
       {
          var index = document.getElementById('subdir').selectedIndex;
          var type = document.getElementById('type').selectedIndex;
          if(index == 0 && type != 2)
           {
               var new_subdir = document.getElementById('new_subdir').value;
               if(is_whitespace(new_subdir))
               {
                    window.alert("<?cs var:lang.super_new_course_form.create_new_group_must_be_filled ?>");
                     return false;
               }
           }
           var value = document.getElementById('crs').value;
           if(is_whitespace(value))
           {
                window.alert("<?cs var:lang.super_new_course_form.internal_name_must_be_filled ?>");
                     return false;
           }
           value = document.getElementById('roster').value;
           if(is_whitespace(value))
           {
                window.alert("<?cs var:lang.super_new_course_form.rosterfile_must_be_filled ?>");
                     return false;
           }
           else
           {
             bar1.showBar();
             scroll(0,0);
             return true; 
           }
       }
   </script>
  </head>

<?cs call:define_super_onload_onunload_body() ?>
<div id="container">
 <?cs call:top_container() ?>
 <?cs call:doIMenu() ?>
 <div id="content">
  <fieldset>
   <legend><?cs var:lang.super_new_course_form.roster ?></legend>
   <?cs call:print_roster() ?>
  <div class="instruction">
  <?cs each:this = lang.super_new_course_form.notes ?>
   <h4><?cs var:this.msg ?></h4>
   <?cs each:desc = this.desc ?> 
      <div><?cs var:desc ?></div>
      <div style="margin-left:10em">
      <?cs each:file = desc.file ?>
       <div><?cs var:file ?></div>
      <?cs /each ?>
      </div>
      <?cs if:desc.sub_msg.0 ?>
      <ul>
      <?cs each:sub_msg = desc.sub_msg ?>
        <li><?cs var:sub_msg ?></li> 
      <?cs /each ?>
     </ul>
     <?cs /if ?>
   <?cs /each ?>
   <br />
  <?cs /each ?>
  </div>
  </fieldset>
</div>
</div>
<script type="text/javascript">
     var bar1 = createBar( 'white', 1, 'black', 'blue', 85, 7, 3, "");
</script>

</body>
</html>
<?cs call:runtime() ?>
