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


<?cs def:print_check(data, i) ?>
  <td>
   <?cs if:data.new == #1 && data.request == #0 ?>
   <input type="checkbox" name="course_list" value="<?cs var:data.org_id ?>:<?cs var:data.subdir ?>:<?cs var:data.course_title ?>:<?cs var:data.course_code ?>:<?cs var:data.course_semester ?>"  />
 <?cs /if ?>
  </td> 
<?cs /def ?>




<?cs def:print_cell(value) ?>
  <td><?cs var:value ?></td>
<?cs /def ?>




<?cs def:print_teacher(crs) ?>
  <td>
  <?cs set:i = #0 ?>
  <?cs each:one = crs.faculty ?>
  <?cs if:i != #0 ?>
    <br />
  <?cs /if ?>
   <?cs var:one.fname ?> <?cs var:one.lname ?>  
  <?cs set:i = i + #1 ?>
  <?cs /each ?>
 </td>
<?cs /def ?>





<?cs def:print_submit_button(data) ?>
  <td colspan="8" align="center">
    <input type="button" value="<?cs var:data.go_back ?>" title="<?cs var:data.go_back_help ?>" onclick="javascript:history.back()" />
    <?cs if:has_new_requests ?>
    <input type="submit" value="<?cs var:data.msg ?>" title="<?cs var:data.help ?>"  />
    <?cs elif:!no_submit ?>
       <?cs if:new_course ?>
       <input type="submit" value="<?cs var:data.msg ?>" title="<?cs var:data.help ?>"  />
       <?cs /if ?>
    <?cs /if ?>
  </td>
<?cs /def ?>
 




<?cs def:print_status(crs) ?>
   <td>
     <?cs if:crs.new == #0 ?>
     <?cs var:lang.admin_get_course_list.in_manhattan ?>
     <?cs else ?>
       <?cs if:crs.request == #0 ?>
         <?cs var:lang.admin_get_course_list.not_request_manhattan ?>
       <?cs else ?>
         <?cs var:lang.admin_get_course_list.request_manhattan ?>
      <?cs /if ?>
    <?cs /if ?>
   </td>
<?cs /def ?>

<?cs def:print_requested_by(crs) ?>
 <?cs if:crs.request && crs.faculty ?>
    <td><?cs var:lang.admin_get_course_list.requested_by ?> <?cs var:crs.faculty ?></td>
  <?cs else ?>
    <td>&nbsp;</td>
<?cs /if ?>
<?cs /def ?>

<?cs def:print_courses() ?>
  <?cs set:num = #1 ?>
  <?cs each:crs = sis_course ?>
   <tr>
      <?cs call:print_check(crs, num) ?>
      <?cs call:print_cell(crs.course_code) ?>
      <?cs call:print_cell(crs.course_title) ?>
      <?cs call:print_cell(crs.course_semester) ?>
      <?cs call:print_teacher(crs) ?>
      <?cs call:print_status(crs) ?>
      <?cs call:print_requested_by(crs) ?>
   </tr>
  <?cs set:num = num + #1 ?>
  <?cs /each ?>
  <tr><td colspan="7">
         
      </td>
  </tr>
<?cs /def ?>

<?cs def:print_content() ?>
<div><form method="post" action="admin_add_courses" onsubmit="return list()" >
<div><input type="hidden" name="id" value="<?cs var:Query.id ?>" />
<?cs if:use_total_count ?>
<input type="hidden" id="count" name="count" value="<?cs var:total_courses ?>" />
<?cs else ?>
<input type="hidden" id="count" name="count" value="<?cs var:has_new_requests ?>" />
<?cs /if ?>
<input type="hidden" id="division" name="division" value="<?cs var:division ?>" />
</div>
<table border="1" cellspacing="0" cellpadding="4">
<caption style="font-size: 12px">
<?cs var:lang.admin_get_course_list.you_have_selected_div ?> <?cs var:division_read ?> <br />
<?cs if:has_new_requests ?>
<?cs var:lang.admin_get_course_list.select ?>
<?cs elif:!no_submit && new_course ?>
<?cs var:lang.admin_get_course_list.select ?>
<?cs /if ?>
</caption>
<tr class="table_heading">

<?cs each:this = lang.admin_get_course_list.label ?>
<th align="left"><?cs var:this ?></th>
<?cs /each ?>
</tr>
<?cs call:print_courses() ?>
<tr>
<th colspan="8">
<?cs var:lang.admin_get_course_list.total ?> <?cs var:total_courses ?>
</th>
</tr>
<tr>
  <?cs if:new_course == #0 ?> 
  <td colspan="8" align="center"><?cs var:lang.admin_get_course_list.no_new_courses ?> <br />
   <span class="regheading"><?cs var:lang.admin_get_course_list.click ?> <a href="<?cs var:back_url ?>" title="<?cs var:lang.admin_get_course_list.try_another_division_help ?>" /> <?cs var:lang.admin_get_course_list.here ?></a> <?cs var:lang.admin_get_course_list.try_another_division ?></span>
  </td>
  <?cs else ?>
     <?cs call:print_submit_button(lang.admin_get_course_list.button) ?>
  <?cs /if ?>
</tr>
</table>
  </form></div>
<?cs /def ?>


<?cs call:html_heading() ?>
   <head>
      <title><?cs var:lang.admin_get_course_list.page_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"  />
   <script type="text/javascript">
   function list()
   {
       var obj = document.forms[0].course_list;
       var count = 0; 
       if(obj.checked)
          return window.confirm('<?cs var:lang.admin_get_course_list.confirm_create_course_msg ?>');
       else
       {
           if(obj.length >0)
             {
                 for(i =0; i<obj.length; i++)
                 {
                    if(obj[i].checked)
                         count++;
                 }
             }
             if(count > 0)
                return window.confirm('<?cs var:lang.admin_get_course_list.confirm_create_course_msg ?>');
             else
             { 
               window.alert('<?cs var:lang.admin_get_course_list.no_course_selected ?>');
               return false;
             }
       }     
   } 
   </script>
  </head>
<body>
<?cs call:course_info() ?>
  <div>
  <a href="javascript:window.close()" title="<?cs var:lang.admin_get_course_list.closewindow ?>">
  <img src="<?cs var:image_path ?>close.gif" alt="<?cs var:lang.admin_get_course_list.closewindow ?>" /></a>
  </div>
  <br />
  <br />

<table width="100%">
<tr><td align="center">
<fieldset style="width:85%">
<?cs var:lang.admin_get_course_list.not_for_combined_sections ?>
</fieldset>
<fieldset style="width:85%">
<legend class="fieldset_legend"><?cs var:lang.admin_get_course_list.add_course_requests ?></legend>
 <?cs call:print_content() ?>
</fieldset>
</td></tr>
</table>
</body>
</html>

<?cs call:runtime() ?>
