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


<?cs def:print_radio(value, name) ?>
 <input type="radio" name="access" value="<?cs var:value ?>"  title="<?cs var:name.help ?>" /><?cs var:name.msg ?>
<?cs /def ?>

<?cs def:print_access_setting() ?>
<table width="100%">
<tr><td align="center">
<table cellspacing="0" cellpadding="2">
   <tr><th align="left"><?cs var:lang.super_course_search.chg_access_instruction ?></th></tr>
   <?cs set:value = #0 ?>
   <?cs each:this = lang.super_course_search.access ?>
   <tr><td>
    <?cs call:print_radio(value, this) ?>
   </td></tr>
    <?cs set:value = value + #1 ?>
   <?cs /each ?>
  <tr><td align="center">
   <input  type="submit" value="<?cs var:lang.super_course_search.chg_access_button ?>" title="<?cs var:lang.super_course_search.chg_access_button_help ?>" />
  </td></tr>
 </table>
</td></tr>
</table>
<?cs /def ?>



<?cs def:print_search_result() ?>
 <fieldset>
  <legend><?cs var:lang.super_course_search.change_course_title ?></legend>
  <?cs call:print_super_search_criteria() ?>
<?cs if:number_matches ?>
 <div class="instruction"><?cs var:lang.super_course_search.change_access_step ?></div>
  <div>
    <form  method="post" action="<?cs var:server_name ?>/<?cs var:sbin_alias ?>/super_chg_crs_access" onsubmit="return change_warn()">
   <div>
   <input type="hidden" name="id" value="<?cs var:id ?>" />
   </div>
  <div class="dtree">
   <h4><a href="javascript: d.openAll();" title="<?cs var:lang.super_course_search.open_all ?>"><?cs var:lang.super_course_search.open_all ?></a> | <a href="javascript: d.closeAll();" title="<?cs var:lang.super_course_search.close_all ?>"><?cs var:lang.super_course_search.close_all ?></a> | <a href="javascript:checkAll(document.forms[0].crs)" > <?cs var:lang.super_course_search.check_all ?></a> | <a href="javascript:uncheckAll(document.forms[0].crs)"> <?cs var:lang.super_course_search.uncheck_all ?></a></h4><br />

   <script type="text/javascript">
     d = new dTree('d');
     d.add(0, -1, '<?cs var:lang.super_course_search.change_course_title ?>');

     <?cs if:normal_count ?>
            d.add(1, 0, '<?cs var:normal_count ?> <?cs var:lang.super_course_search.num_central_courses ?>'); 
     <?cs /if ?>
     <?cs if:std_count ?>
           
             d.add(2, 0,'<?cs var:std_count ?> <?cs var:lang.super_course_search.num_std_courses ?>'); 
     <?cs /if ?>
     <?cs if:temp_count ?>
            d.add(3, 0, '<?cs var:temp_count ?> <?cs var:lang.super_course_search.num_temp_courses ?>'); 
     <?cs /if ?>
     <?cs each:mynode = node ?>
       d.add(<?cs var:mynode ?>);
     <?cs /each ?>     
   document.write(d);
   d.openAll();
  </script>
  </div>
  <?cs call:print_access_setting() ?>
  </form>
</div>
<?cs /if ?>
 </fieldset>
<?cs /def ?>

<?cs call:html_header() ?>
   <head>
      <title><?cs var:lang.super_course_search.change_course_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"  />
   <link rel="StyleSheet" href="<?cs var:image_path ?>dtree.css" type="text/css"  />
   <script type="text/javascript" src="<?cs var:image_path ?>form_validation.js"></script>
   <?cs call:addDoIMenu() ?>
  <?cs if:number_matches ?>
    <base href="<?cs var:server_name ?><?cs var:image_path ?>index.html" />
     <script type="text/javascript" src="<?cs var:image_path ?>dtree.js"></script>
  <?cs /if ?>
   <script type="text/javascript">
    function validate_course_list()
   {
      var obj = document.forms[0].crs;
      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 check_access()
   {
       var check_obj = document.forms[0].access;
       var len = check_obj.length;
       for(i =0; i<len; i++)
       {
             if(check_obj[i].checked)
                return true;
       }
       return false;
   }
   function change_warn()
   {
       if(validate_course_list() == false)
       {
            window.alert('<?cs var:lang.super_course_search.must_select_one_course ?>');
            return false;
       }
       if(check_access() == false)
       {
            window.alert('<?cs var:lang.super_course_search.must_select_one_access_right ?>');
            return false;
       }
       return window.confirm('<?cs var:lang.super_course_search.change_course_msg ?>');

   }

   </script>
  </head>

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