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

<?cs def:print_release_form() ?>
<div>
<br />
  <form id="release_form" method="post" action="grade_book_release_save">
  <input type="hidden" name="nextUrl" value="" />
  <input type="hidden" name="save_option" value="" />
  <input type="hidden" name="crs" value="<?cs var:Query.crs ?>" />
  <input type="hidden" name="id" value="<?cs var:Query.id ?>" />
  <?cs if:grades_release_form ?>
  <table width="100%" cellpadding="4" cellspacing="0">
   <tr class="headingcolor">
    <th colspan="2" align="left">
    <?cs var:lang.grade_book_release.new_release ?> <?cs call:insert_help("gradebook_help.html", "RELEASE_Release_now", lang.grade_book_release.help_button_title, "gradebook_help") ?>
    </th>
   </tr>
   <tr>
      <td align="right"><input type="checkbox" name="view_max" value="1" checked="checked" /></td>
      <td><?cs var:lang.grade_book_release.view_max ?> <?cs call:insert_help("gradebook_help.html", "RELEASE_Include_max_min", lang.grade_book_release.help_button_title, "gradebook_help") ?> </td>
   </tr>
   <tr>
      <td align="right"><input type="checkbox" name="view_total" value="1" checked="checked" /></td>
      <td><?cs var:lang.grade_book_release.view_total ?> <?cs call:insert_help("gradebook_help.html", "RELEASE_Include_final_grades", lang.grade_book_release.help_button_title, "gradebook_help") ?> </td>
   </tr>

   <tr>
      <td align="right"><input type="checkbox" name="view_bar" value="1" checked="checked" /></td>
      <td><?cs var:lang.grade_book_release.view_bar ?> <?cs call:insert_help("gradebook_help.html", "RELEASE_Include_bar_graphs", lang.grade_book_release.help_button_title, "gradebook_help") ?> </td>
   </tr>
   <tr class="headingcolor">
      <td>
      &nbsp;
      </td>
      <td>
      <input type="button" value="<?cs var:lang.grade_book_release.new_release ?>" onclick="getNextUrl('grade_book_release?crs=<?cs var:Query.crs ?>&id=<?cs var:Query.id ?>', 'save')" />
      <?cs call:insert_help("gradebook_help.html", "RELEASE_Release_now", lang.grade_book_release.help_button_title, "gradebook_help") ?>
      </td>
   </tr>
  </table>
  <?cs /if ?> 
</form>
</div>
<?cs /def ?>


<?cs def:print_last_release() ?>
<div>
<br />
  <table width="100%" cellpadding="4" cellspacing="0">
  <tr class="headingcolor">
  <th colspan="2" align="left">
    <?cs var:lang.grade_book_release.last_release ?> <?cs call:insert_help("gradebook_help.html", "RELEASE_Last_release", lang.grade_book_release.help_button_title, "gradebook_help") ?>
  </th>
  </tr>
  <?cs if:released_time ?>
  <tr>
  <td>&nbsp;</td>
  <th align="left"><?cs var:lang.grade_book_release.release_time ?>: <?cs var:released_time ?></th>      
  </tr>
  <?cs each:rl = release ?>
  <tr>
  <td>&nbsp;</td>
    <td>
    <?cs var:lang.grade_book_release[rl] ?>
    </td>
  </tr>
  <?cs /each ?>
  <?cs else ?>
  <tr>
  <td>&nbsp;</td>
  <th><?cs var:lang.grade_book_release.no_released_grades ?></th>      
  </tr>
   
  <?cs /if ?> 
  </table>
</div>
<?cs /def ?>


<?cs def:insert_release_help(link_name) ?>
<?cs if:link_name == "grades_delete_form" ?>
  <?cs call:insert_help("gradebook_help.html", "RELEASE_Delete_released", lang.grade_book_release.help_button_title, "gradebook_help") ?>
<?cs elif: link_name == "grades_info" ?>
  <?cs call:insert_help("gradebook_help.html", "RELEASE_Info", lang.grade_book_release.help_button_title, "gradebook_help") ?>
<?cs elif:link_name == "grades_view" ?>
  <?cs call:insert_help("gradebook_help.html", "RELEASE_View_released", lang.grade_book_release.help_button_title, "gradebook_help") ?>
<?cs elif: link_name == "grades_view_form" ?>
   <?cs call:insert_help("gradebook_help.html", "RELEASE_View_one_students", lang.grade_book_release.help_button_title, "gradebook_help") ?>
<?cs /if ?>
<?cs /def ?>


<?cs def:print_release_menu() ?>
  <table width="100%" cellpadding="4" cellspacing="0">
  <tr><td>
    <dl>
        <?cs each:entry = grade_book_release ?>
	 <?cs if:entry.url ?>
	  <dt><span style="font-weight:bold"><a href="javascript:openWindow('<?cs var:entry.url ?>', 'releasewin')" title="<?cs var:lang.grade_book_release[entry.name].link ?>" ><?cs var:lang.grade_book_release[entry.name].link ?></a></span> <?cs call:insert_release_help(entry.name) ?></dt>
	  <dd>
	    <?cs var:lang.grade_book_release[entry.name].desc ?> 
	  </dd>
	  <br />
	  <?cs else ?>
	  <dt><span style="font-style:italic; font-weight:bold; color:#00f"><?cs var:lang.grade_book_release[entry.name].link ?></span></dt>
	  <dd><span style="font-style:italic;"><?cs var:lang.grade_book_release[entry.name].desc ?></span>          </dd>
	  <br />
	 <?cs /if ?>
	 
	<?cs /each ?>
    </dl>
  </td></tr>
  </table>
<?cs /def ?>

<?cs ###########################
     # HTML starts here
     ###########################
?>
<?cs call:html_heading() ?>
   <head>
      <title><?cs var:course_title ?> <?cs var:lang.grade_configure.scale_heading ?></title>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
   <meta http-equiv="Cache-Control" content="No-Cache" />
   <meta http-equiv="EXPIRES" content="Mon, 22 Jul 1997 11:12:01 GMT" />
   <meta http-equiv="PRAGMA" content="No-Cache" />

   
   <link rel="StyleSheet" href="<?cs var:image_path ?>grade_tab_menu.css" type="text/css"  />
   <script type="text/javascript" src="<?cs var:image_path ?>form_validation.js">
   </script>
   <script type="text/javascript">

    function getNextUrl(url, some)
   {
          var myform = document.getElementById('release_form');
          myform.nextUrl.value = url;

	   if(some.length > 0)
	   {
              myform.save_option.value = "save";
	      var confirm = window.confirm('<?cs var:lang.grade_book_release.confirm ?>');
	      if(confirm == true)
                 myform.submit();
	   }
	   else
	   {
              myform.save_option.value = "no";
              myform.submit();
	   }

    }
    function openWindow(url, winname)
    {
       var new_window = window.open(url, winname,'menubar=0,toolbar=0,status=0,scrollbars=yes,resizable=yes,width=1100,height=400,screenX=150,screeny=200,left=150,top=200');
       new_window.focus();
   }

   </script>

</head>


<?cs call:define_body() ?> 
<div id="container">
<?cs call:print_course_heading(back_url, lang.grade_book_menu_util.goback) ?>
<div>
<br />
<br />
  <?cs call:grade_menu()  ?>
</div>
<div id="content">
<?cs call:print_release_form() ?>
<?cs call:print_last_release() ?>

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