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






<?cs def:print_message_status() ?>
<fieldset style="width:80%; margin-left: 4em" >
<legend class="fieldset_legend">
<?cs var:lang.module[grp] ?>: <?cs var:lang.page_title ?>
</legend>
<?cs ## handle subject ## ?>
<table>

     <tr>
       <td align="left" class="regheading">
              <?cs if:grp_uses_topic ?><?cs var:lang.topic_label ?><?cs else ?><?cs var:lang.subject_label ?><?cs /if ?>
        </td>
       <td align="left"><?cs var:escaped_subject ?></td>
     </tr> 


<?cs ## print the status, e.g. "this message can be viewed by your students" ### ?>

  <tr>
    <td align="left" class="regheading"><?cs var:lang.status_label ?></td>
    <td align="left"><?cs var:lang.status_msg[status] ?></td>
  </tr> 



<?cs ## print a 'reason' for the above status ## ?>

  <tr>
    <td align="left" class="regheading"><?cs var:lang.reason_label ?></td>
    <?cs if:status == "VISIBLE" ?>
          <td><?cs var:lang.not_hidden_or_scheduled ?></td></tr>
    <?cs elif:status == "HIDDEN" ?>
          <td><?cs var:lang.manually_hidden ?></td></tr>
    <?cs elif:status == "R_ONLY" ?>
          <td><?cs var:lang.read_only ?></td></tr>

    <?cs ### else status is 'scheduled' and can either be viewed or not ### ?>
    <?cs else ?>
        <td><?cs var:lang.scheduled ?>
        <?cs if:status == "SCHED_NORMAL" ?>
           <?cs var:lang.scheduled_visible ?>
        <?cs else ?>
           <?cs var:lang.scheduled_hidden ?>
        <?cs /if ?>
        </td></tr>

       <?cs ### print the current time ### ?>
       <tr>
               <td><b><?cs var:lang.current_time_label ?></b></td>
               <td><?cs var:current_time ?></td>
       </tr>
       
       
       <?cs ### print the release time ### ?>
       <tr>
               <td><b><?cs var:lang.release_time_label ?></b></td>
               <td><?cs var:release_time ?></td>
       </tr>
   
       <?cs ### print the unrelease time, if exists ### ?>

       <tr>
               <td><b><?cs var:lang.unrelease_time_label ?></b></td>
               <td><?cs if:unrelease_time ?><?cs var:unrelease_time ?><?cs else ?><?cs var:lang.no_unrelease_time ?><?cs /if ?></td>
       </tr>
     <?cs /if ?>
  </table>
</fieldset>
<?cs /def ?>





<?cs def:print_hide_link(intro) ?>
 <?cs if:intro ?>
   <tr><td class="intro"><?cs var:intro ?></td></tr>
 <?cs /if ?>

 <tr>
  <td>
    <dl>
     <dt><a href="<?cs var:manual_hide_url ?>" title="<?cs var:lang.mark_hidden_link ?>"><?cs var:lang.mark_hidden_link ?></a></dt>
     <dd><?cs var:lang.mark_hidden_description ?></dd>
    </dl>
  </td>
 </tr>
<?cs /def ?>





<?cs def:print_readonly_link(intro) ?>
<?cs if:manual_readonly_url ?>
 <?cs if:intro ?>
   <tr><td class="intro"><?cs var:intro ?></td></tr>
 <?cs /if ?>
 <tr>
   <td>
     <dl>
      <dt><a href="<?cs var:manual_readonly_url ?>" title="<?cs var:lang.read_only_link ?>"><?cs var:lang.read_only_link ?></a></dt>
      <dd><?cs var:lang.read_only_description ?></dd>
     </dl>
   </td>
 </tr>
<?cs /if ?>
<?cs /def ?>






<?cs def:print_unhide_link(intro) ?>
 <?cs if:intro ?>
   <tr><td class="intro"><?cs var:intro ?></td></tr>
 <?cs /if ?>
 <tr>
   <td>
     <dl> 
     <dt><a href="<?cs var:manual_unhide_url ?>" title="<?cs var:lang.mark_normal_link ?>"><?cs var:lang.mark_normal_link ?></a></dt>
     <dd><?cs var:lang.mark_normal_description ?></dd>
     </dl>
   </td>
 </tr>
<?cs /def ?>




<?cs def:print_ampm_date(data, name, is_am) ?>
  <select name="<?cs var:name ?>" id="<?cs var:name ?>" title="<?cs var:data ?>">
  <option value="0" <?cs if:is_am ?> selected="selected"<?cs /if ?> ><?cs var:lang.am ?></option>
  <option value="1" <?cs if:!is_am ?> selected="selected"<?cs /if ?> ><?cs var:lang.pm ?></option>
 </select> 
<?cs /def ?>





<?cs def:print_hour(data, name, my_hour) ?>
  <select name="<?cs var:name ?>" id="<?cs var:name ?>" title="<?cs var:data ?>">
  <?cs loop:x=#1, #12, #1 ?>
    <?cs if:x < 10 ?>
    <option value="<?cs var:x ?>" <?cs if:x == my_hour ?> selected="selected" <?cs /if ?> >0<?cs var:x ?></option>
    <?cs else ?>
    <option value="<?cs var:x ?>" <?cs if:x == my_hour ?> selected="selected" <?cs /if ?> ><?cs var:x ?></option>
   <?cs /if ?> 
  <?cs /loop ?>
  </select> 
<?cs /def ?>




<?cs def:print_min(data, name, my_minute) ?>
  <select name="<?cs var:name ?>" id="<?cs var:name ?>" title="<?cs var:data ?>">
  <?cs loop:x=#0, #59, #1 ?>
    <?cs if:x < 10 ?>
    <option value="<?cs var:x ?>" <?cs if:x == my_minute ?> selected="selected" <?cs /if ?> >0<?cs var:x ?></option>
    <?cs else ?>
    <option value="<?cs var:x ?>" <?cs if:x == my_minute ?> selected="selected" <?cs /if ?> ><?cs var:x ?></option>
   <?cs /if ?> 
  <?cs /loop ?>
  </select> 
<?cs /def ?>





<?cs def:print_start_date() ?>
    <br />
    <a href="javascript:openBrWindow('calendar_pick?textId=start', 'pickdate')" title="<?cs var:lang.start_date_button_title ?>"><img src="<?cs var:image_path ?>pickdate.jpg" alt="<?cs var:lang.start_date_button_title ?>" align="center" /></a>
    <input type="text" name="start" id="start" maxlength="<?cs var:mm_dd_yyyy_len ?>" size="<?cs var:mm_dd_yyyy_len ?>" title="<?cs var:lang.start_date_input_title ?>" <?cs if:release_month ?> value="<?cs var:release_month ?>/<?cs var:release_day ?>/<?cs var:release_year ?>" <?cs /if ?> />
    <?cs call:print_hour(lang.start_hour_title, "start_hour", release_hour) ?>
    <?cs call:print_min(lang.start_min_title, "start_min", release_minute) ?>
    <?cs call:print_ampm_date(lang.start_ampm_title, "start_am", release_is_am) ?>
<?cs /def ?>



<?cs def:print_end_date() ?>
    <br />
    <a href="javascript:openBrWindow('calendar_pick?textId=end', 'pickdate')" title="<?cs var:lang.end_date_button_title ?>"><img src="<?cs var:image_path ?>pickdate.jpg" alt="<?cs var:lang.end_date_button_title ?>" align="center" /></a>
    <input type="text" name="end" id="end" maxlength="<?cs var:mm_dd_yyyy_len ?>" size="<?cs var:mm_dd_yyyy_len ?>" title="<?cs var:lang.end_date_input_title ?>"  <?cs if:unrelease_month ?>value="<?cs var:unrelease_month ?>/<?cs var:unrelease_day ?>/<?cs var:unrelease_year ?>" <?cs /if ?> />
    <?cs call:print_hour(lang.end_hour_title, "end_hour", unrelease_hour) ?>
   <?cs call:print_min(lang.end_min_title, "end_min", unrelease_minute) ?>
    <?cs call:print_ampm_date(lang.end_ampm_title, "end_am", unrelease_is_am) ?>
<?cs /def ?>



<?cs def:print_schedule_form() ?>

 <tr><td class="intro"><?cs var:lang.or_you_can_label ?></td></tr>
 
<tr>
  <td>
      <dl>
         <dt><?cs var:lang.release_time_description ?></dt>
          <dd><?cs call:print_start_date() ?> </dd>
      </dl>
 </td>
 </tr>

 <tr>
  <td>
      <dl>
       <dt><?cs var:lang.unrelease_time_description ?></dt>
       <dd><?cs call:print_end_date() ?></dd>
      </dl>
  </td>
 </tr>


 <tr>
  <td>
   <dl>
    <dt></dt>
    <dd style="margin-left: 8em"><input type="submit" value="<?cs var:lang.submit_button ?>" title="<?cs var:lang.submit_button_title ?>" /></dd>
    </dl>
   </td>
 </tr>
<?cs /def ?>





<?cs def:print_options() ?>
<p />
<table border="0" style="margin-left: 4em">
<?cs if:status == "VISIBLE" ?>
     <?cs call:print_hide_link(lang.you_can_label) ?>
     <?cs call:print_readonly_link(lang.or_you_can_label) ?>
 <?cs elif:status == "HIDDEN" ?>
     <?cs call:print_unhide_link(lang.you_can_label) ?>
     <?cs call:print_readonly_link(lang.or_you_can_label) ?>
 <?cs elif:status == "R_ONLY" ?>
     <?cs call:print_hide_link(lang.you_can_label) ?>
     <?cs call:print_unhide_link(lang.or_you_can_label) ?>
 <?cs else ?>
     <?cs call:print_hide_link(lang.you_can_label) ?>
     <?cs call:print_unhide_link(lang.or_you_can_label) ?>
     <?cs call:print_readonly_link(lang.or_you_can_label) ?>
 <?cs /if ?>

 <?cs call:print_schedule_form() ?>

</table>
<?cs /def ?>




<?cs call:html_heading() ?>
<?cs with:lang=lang.news_manage_sched_form ?>
   <head>
      <title><?cs var:course_no ?> <?cs var:lang.module[grp] ?> <?cs var:lang.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" src="<?cs var:image_path ?>form_validation.js"></script>

<script type="text/javascript">
function openBrWindow(some_url,winname)
   {
     var new_window = window.open(some_url, winname,'menubar=0,toolbar=0,status=0,scrollbars=yes,resizable=yes,width=350,height=250,screenX=150,screeny=200,left=150,top=200');
     new_window.focus();
   }


function check_all()
   {
      var start_str = document.getElementById('start').value;
      if(checkvalid_date_string(start_str) == false)
       {
           window.alert('<?cs var:lang.bad_start_date_javascript ?>');
           return false;
       }

      var end_str = document.getElementById('end').value;
      if(end_str != "")
      {
          if(checkvalid_date_string(end_str) == false)
          {
              window.alert('<?cs var:lang.bad_end_date_javascript ?>');
              return false;
          }
      }


    return true;
   }
</script>

<style type="text/css">
     .intro { font-size:14px;
             font-weight: bold;
             color: #cc6633;
            }
</style>

</head>
<?cs call:define_body() ?>
<?cs call:print_course_heading("javascript:history.back()", lang.back_button_title) ?>
  <div><form method="post" action="news_manage_topic_sched" onsubmit="return check_all()" >
  <div>
   <input type="hidden" name="crs" value="<?cs var:crs ?>" />
   <input type="hidden" name="id" value="<?cs var:id ?>" />
   <input type="hidden" name="grp" value="<?cs var:grp ?>" />
   <input type="hidden" name="loc" value="<?cs var:offset ?>" />
  </div>
 <?cs call:print_message_status() ?>
 <?cs call:print_options() ?>
</form></div>

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