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

<?cs def:print_heading() ?>
<div class="center_msg">
 <span class="alert_color"><?cs var:lang.module[grp] ?> <?cs var:lang.page_title ?></span><br />
 <?cs var:current_time ?>
</div> 
<?cs /def ?>


<?cs def:print_blank_img(width, height) ?><img src="<?cs var:image_path ?>spacer.gif" alt="" width="<?cs var:width ?>"  height="<?cs var:height ?>" /><?cs /def ?>


<?cs def:print_arrow(direction, msg_id) ?>
<?cs if:direction == "none" ?>
  <?cs call:print_blank_img("16", "16") ?>
<?cs else ?>
  <a href="news_manage_topic_order?crs=<?cs var:crs ?>&amp;id=<?cs var:id ?>&amp;grp=<?cs var:grp ?>&amp;msg=<?cs var:msg_id ?><?cs if:direction == "up" ?>&amp;up=1<?cs /if ?><?cs if:grp == 7 ?>&amp;team=<?cs var:Query.team ?><?cs /if ?>" title="<?cs var:lang[direction] ?>"><img src="<?cs var:image_path ?><?cs var:direction ?>arrow.gif" alt="<?cs var:lang[direction] ?>" width="16" height="16" /></a>   
<?cs /if ?>
<?cs /def ?>



<?cs def:print_redstar() ?><img src="<?cs var:image_path ?>redstar.gif" alt="<?cs var:lang.redstar_title ?>"  title="<?cs var:lang.redstar_title ?>"  /><?cs /def ?>

<?cs def:print_flag() ?><img src="<?cs var:image_path ?>flag.gif" alt="<?cs var:lang.flag_title ?>" title="<?cs var:lang.flag_title ?>" width="14" height="14"  /><?cs /def ?>


<?cs def:print_topics() ?>
<table width="100%">
<tr><td align="center">
 <table cellspacing="0" cellpadding="4" >
  <?cs each:m = message ?>
    <tr class=<?cs if:(name(m) % #2) ?>"odder_color"<?cs else ?>"even_color"<?cs /if ?>>
      <td valign="top" align="left">
       <a name="<?cs var:m.msg_id ?>" />
         <?cs if:(name(m) == "0") ?><?cs call:print_arrow("none", m.msg_id) ?><?cs else ?><?cs call:print_arrow("up",m.msg_id) ?><?cs /if ?>
         <?cs if:message[name(m) + #1].sender ?><?cs call:print_arrow("down", m.msg_id) ?><?cs else ?><?cs call:print_arrow("none",m.msg_id) ?><?cs /if ?>
    </td>
    <td align="left">
      <?cs if:grp_uses_topics ?>
         (<?cs var:m.total_msgs ?><?cs if:m.total_unread ?><?cs call:print_redstar() ?><?cs /if ?><?cs if:m.total_flagged ?><?cs call:print_flag() ?><?cs /if ?>)
      <?cs /if ?>

      <?cs if:m.is_flagged ?>
               <?cs call:print_flag() ?>
      <?cs /if ?>
     

     <?cs if:grp == 15 ?>       
     <a href="survey_info?crs=<?cs var:crs ?>&amp;id=<?cs var:id ?>&amp;grp=<?cs var:grp ?>&amp;loc=<?cs var:m.offset?>" title="<?cs var:lang.info_title ?>">?</a>
     <?cs else ?>
     <a href="news_info?crs=<?cs var:crs ?>&amp;id=<?cs var:id ?>&amp;grp=<?cs var:grp ?>&amp;loc=<?cs var:m.offset?>" title="<?cs var:lang.info_title ?>">?</a>
     <?cs /if ?> 

         
     <?cs if:m.has_attachments ?>
             <img src="<?cs var:image_path ?>pclip.gif" alt="<?cs var:lang.pclip_title ?>" width="13" height="15" />
     <?cs /if ?>

      <?cs if:m.is_unread ?>
               <?cs call:print_redstar() ?>
      <?cs /if ?>



     <span class=<?cs if:m.teacher_hidden ?>"hidden_topic_listing"<?cs elif:m.basic_status == "READ_ONLY" ?>"readonly_topic_listing"<?cs else ?>"topic_listing"<?cs /if ?>><?cs var:m.escaped_subject ?></span> <?cs var:m.sender ?> <?cs var:m.time_sent ?> <?cs if:m.teacher_hidden ?><?cs var:lang.teacher_hidden_label ?><?cs /if ?>
     <br />
       <b><?cs var:lang.status_label ?></b>
       <?cs if:m.basic_status == "NORMAL" ?>
           <?cs var:lang.normal ?>
       <?cs elif: m.basic_status == "TEACHER_HIDDEN" ?>
            <span class="hidden_topic_listing" style="font-size:12px"><?cs var:lang.teacher_hidden ?></span>
       <?cs elif:m.basic_status == "READ_ONLY" ?>
            <span class="readonly_topic_listing" style="font-size:12px"><?cs var:lang.readonly ?></span>
       <?cs elif: m.basic_status == "TIMED_RELEASE" ?>
            <?cs if:m.teacher_hidden ?>
                  <span class="hidden_topic_listing" style="font-size:12px"><?cs var:lang.hidden_timed_release ?></span>
            <?cs else ?>
                 <?cs var:lang.normal_timed_release ?>
            <?cs /if ?>
       <?cs /if ?>
       
       <a href="news_manage_sched_form?crs=<?cs var:crs ?>&amp;id=<?cs var:id ?>&amp;grp=<?cs var:grp ?>&amp;loc=<?cs var:m.offset ?>" title="<?cs var:lang.schedule_title ?>"><?cs var:lang.change_link ?></a>           

      
       <?cs if: m.basic_status == "TIMED_RELEASE" ?>
         <br />
         <b><?cs var:lang.release_time_label ?></b> <?cs var:m.release_time ?><br />
         <b><?cs var:lang.unrelease_time_label ?></b> <?cs if:m.unrelease_time ?><?cs var:m.unrelease_time ?><?cs else ?><?cs var:lang.no_release_time ?><?cs /if ?>
       <?cs /if ?>
      
       <br />
       <?cs if:m.allow_locked_attachments ?>
            <?cs if:m.attachments_locked ?>
                <span class="hidden_topic_listing" style="font-size: 12px"><?cs var:lang.attachments_locked ?></span>
                <a href="news_manage_protect?crs=<?cs var:crs ?>&amp;id=<?cs var:id ?>&amp;grp=<?cs var:grp ?>&amp;loc=<?cs var:m.offset ?>&amp;protect=0" onclick="return confirm('<?cs var:lang.unlock_attachments_javascript ?>')"  title="<?cs var:lang.unlock_attachments_title ?>"><?cs var:lang.change_link ?></a>           
            <?cs else ?>
                <?cs var:lang.attachments_normal ?>
                <a href="news_manage_protect?crs=<?cs var:crs ?>&amp;id=<?cs var:id ?>&amp;grp=<?cs var:grp ?>&amp;loc=<?cs var:m.offset ?>&amp;protect=1"  onclick="return confirm('<?cs var:lang.lock_attachments_javascript ?>')"  title="<?cs var:lang.lock_attachments_title ?>"><?cs var:lang.change_link ?></a>           
            <?cs /if ?>
       <?cs /if ?>

    </td>
  </tr>
  <tr><td colspan="2" align="left">&nbsp;</td></tr>
  <?cs /each ?>
</table>
</td></tr>
</table>
<?cs /def ?>

<?cs call:html_heading() ?>
<?cs with:lang=lang.news_manage_topic_list ?>
   <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" />
   <link rel="StyleSheet" href="<?cs var:image_path ?>topic_listing.css" type="text/css" />
</head>
<?cs call:define_body() ?>
<?cs call:print_course_heading(back_url, lang.back_button_title) ?>
<?cs call:print_heading() ?>
<?cs call:print_topics() ?>
<?cs /with ?>
</body>
</html>
<?cs call:runtime() ?>
