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

<?cs def:print_heading() ?>
  <?cs call:course_info() ?>
  <div>
    <a href="javascript:history.back()" title="<?cs var:lang.news_info.back_button_title ?>"><img src="<?cs var:image_path ?>/back_arrow.gif" width="50" height="34" alt="<?cs var:lang.news_info.back_button_title ?>" /></a>
  </div>
<?cs /def ?>





<?cs def:print_info_heading(label, value) ?>
  <tr>
    <td class="table_heading"><?cs var:label ?></td>
    <td><?cs var:value ?></td>
  </tr>
<?cs /def ?>





<?cs def:print_info() ?>
<?cs with:lang=lang.news_info ?>
 <table width="100%">
 <tr><td align="center">
  <table cellspacing="0" cellpadding="4" border="1">
    <?cs call:print_info_heading(lang.subject_label, escaped_subject) ?>
    <?cs call:print_info_heading(lang.posted_by_label, sender_realname) ?>
    <?cs if:(grp != #2) || time_sent ?>
       <?cs call:print_info_heading(lang.posted_date_label, time_sent) ?>
    <?cs else ?>
       <?cs call:print_info_heading(lang.posted_date_label, lang.not_avail ) ?>
    <?cs /if ?>

    <?cs if:website_attached || attach[0].orig_filename ?>
    <tr>
        <td class="table_heading"><?cs var:lang.attachments_label ?></td>
        <td>
           <?cs if:website_attached ?>
              <?cs var:lang.attached_website_notice ?>
           <?cs else ?>
             <?cs each:this = attach ?>
               <?cs var:this.orig_filename ?> (<?cs var:this.size ?> <?cs var:lang.bytes_label ?>)<br />
              <?cs /each ?>
           <?cs /if ?>
        </td>
    </tr>
    <?cs /if ?>
    <tr><td>&nbsp;</td>
    <td class="table_heading" align="center"><?cs var:lang.time_opened_label ?></td>
    </tr> 
    <?cs each:person = recipient ?>
     <tr>
       <td><?cs var:person.realname ?></td>
       <td><?cs var:person.time_read?> <?cs if:person.unlocked_attachments ?><br /><?cs var:lang.unlocked_attachment_notice ?><?cs /if ?>&nbsp;</td>
     </tr>
    <?cs /each ?> 
  </table>
<div style="width:50%"><?cs if:show_time_read ?><?cs var:lang.time_read_allowed ?><?cs else ?><?cs if:grp == #2 ?><?cs var:lang.anon_times_hidden ?><?cs else ?><?cs var:lang.time_read_not_allowed ?><?cs /if ?><?cs /if ?></div>
 </td></tr>
 
 </table>
<?cs /with ?>
<?cs /def ?> 





<?cs def:print_selftest() ?>
<?cs with:lang=lang.news_info ?>
 <?cs if:grp == # 11 ?>
  <?cs if:selftest_user[0].realname ?>
  <div><br /><br /><a name="results"></a>
  <table width="100%">
  <tr><td align="center">
   <?cs if:selftest_csv_url ?><p><a href="<?cs var:selftest_csv_url ?>" title="<?cs var:lang.selftest_csv_link_title ?>" ><?cs var:lang.selftest_csv_link ?></a></p><?cs /if ?>
   <?cs each:person = selftest_user ?>
  <table>
  <tr><td align="left" class="table_heading">
   <?cs var:person.realname ?> 
  </td></tr>
  <tr><td>
   <?cs each:ex = person.exercise ?>
    <table cellspacing="0" cellpadding="5" border="1" class=<?cs if:name(ex) % #2 ?>"odder_color"<?cs else ?>"even_color"<?cs /if ?> >
     <caption><span class="regheading"><?cs var:ex.title ?> (<?cs var:ex.filename ?>)</span>
     </caption>
       <tr>
         <th><?cs var:lang.selftest_submitted_label ?></th>
         <th><?cs var:lang.selftest_elapsed_label ?></th>
         <th><?cs var:lang.selftest_score_label ?></th>
       </tr>
       <?cs each:test = ex.result ?>
        <tr>
            <td><?cs var:test.time_submitted ?></td>
            <td><?cs var:test.elapsed_time ?></td>
            <td><?cs var:test.score ?></td>
        </tr> 
       <?cs /each ?>
    </table><br />
   <?cs /each ?>
  </td></tr>
 </table>
<?cs /each ?>
 </td></tr>
 </table><br /><br />
 </div>
  <?cs /if ?>
 <?cs /if ?>
<?cs /with ?>
<?cs /def ?> 


<?cs def:print_podcast_downloads() ?>
<?cs with:l = lang.news_info ?>
<?cs if:(grp == #16) && (podcast_log.0.time)  ?>
<div>
<table width="100%">
<tr><td align="center">
 <table cellpadding="5" cellspacing="5" border="1">
  <caption><?cs var:l.podcast_download_log_description ?></caption>
  <tr><th class="table_heading"><?cs var:l.podcast_download_time ?></th>
      <th class="table_heading"><?cs var:l.podcast_download_remote_host ?></th>
      <th class="table_heading"><?cs var:l.podcast_download_remote_address ?></th>
      <th class="table_heading"><?cs var:l.podcast_download_user_agent ?></th>
  </tr>      
  <?cs each:record = podcast_log ?>
   <tr><td align="right"><?cs var:record.time ?></td>
       <td align="right"><?cs var:record.remost_host ?></td>
       <td align="right"><?cs var:record.remote_address ?></td>
       <td align="right"><?cs var:record.user_agent ?></td>
   </tr>
 <?cs /each ?>
 </table>
</td></tr>
</table>
</div>
<?cs /if ?>
<?cs /with ?>
<?cs /def ?>



<?cs call:html_heading() ?>
   <head>
      <title><?cs var:course_no ?> <?cs var:lang.news_info.module[grp] ?></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"  />
  </head>
<?cs call:define_body() ?>
 <?cs call:print_course_heading("javascript:history.back()", lang.news_info.back_button_title) ?>
 <div class="center_msg" >
  <span class="alert_color"><?cs var:lang.news_info.module[grp] ?></span>
  </div>
  <?cs if:grp == # 11 && selftest_user[0].realname ?>
     <div style="text-align:center"><a href="#results"><?cs var:lang.news_info.includes_selftest_results ?></a></div>
  <?cs /if ?>
<?cs call:print_info() ?>
<?cs call:print_selftest() ?>
<?cs call:print_podcast_downloads() ?>
</body>
</html>
<?cs call:runtime() ?>
