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

<?cs def:get_next_color() ?>
<?cs if:color == "even_color" ?><?cs set:color="odd_color" ?><?cs else ?><?cs set:color="even_color" ?><?cs /if ?>
<?cs /def ?>



<?cs def:red_blue_no_star(msg_unread) ?>
<?cs if:msg_unread ?>
   <?cs if:outbox ?>
     <img src="<?cs var:image_path ?>bluestar.gif" alt="<?cs var:lang.bluestar_title ?>" title="<?cs var:lang.bluestar_title ?>"/>
   <?cs else ?>
     <img src="<?cs var:image_path ?>redstar.gif" alt="<?cs var:lang.redstar_title ?>" title="<?cs var:lang.redstar_title ?>"/>
   <?cs /if ?>
<?cs else ?>
    <img src="<?cs var:image_path ?>clear.gif" alt="" width="10" height="12" />
<?cs /if ?>
<?cs /def ?>




<?cs def:sender_or_recipients(message) ?>
<?cs if:outbox ?>
   <?cs each:recipient = message.to ?>
       <?cs var:recipient ?><br />
     <?cs /each ?>
     <?cs if:message.partial_to_list ?>
        <?cs var:lang.partial_recipient_list ?>
     <?cs /if ?>
<?cs else ?>
  <?cs var:message.sender ?>
<?cs /if ?>
<?cs /def ?>


<?cs def:print_messages() ?>
<?cs with:lang=lang.post_inbox ?>
  <table cellspacing="0" cellpadding="2"  width="75%">
  <tr class="table_heading">
     <td></td>
     <td></td>
     <td><?cs var:lang.subject_heading ?></td>
     <td><?cs if:outbox ?><?cs var:lang.to_heading ?><?cs else ?><?cs var:lang.from_heading ?><?cs /if ?></td>
     <td><?cs var:lang.date_sent_heading ?></td>
     <td></td> 
  </tr>
   <?cs each:this = msg ?>
     <?cs call:get_next_color() ?>
     <tr class="<?cs var:color ?>">
      <td>
        <?cs if:allow_user_hidden ?>
           <?cs if:this.hide_url ?>
               <a href="<?cs var:this.hide_url ?>" title="<?cs var:lang.mark_sleepy_title ?>"><img src="<?cs var:image_path ?>topic_normal.gif" alt="<?cs var:lang.mark_sleepy_title ?>" /></a>
           <?cs elif:this.unhide_url ?>
               <a href="<?cs var:this.unhide_url ?>" title="<?cs var:lang.mark_normal_title ?>"><img src="<?cs var:image_path ?>topic_tired.gif" alt="<?cs var:lang.mark_normal_title ?>" /></a>
           <?cs else ?>
               <img src="<?cs var:image_path ?>topic_wired.gif" alt="<?cs var:lang.wired_message_title ?>" title="<?cs var:lang.wired_message_title ?>" />
           <?cs /if ?>
       <?cs /if ?>
     </td> 

     <td>
          <?cs call:red_blue_no_star(this.is_unread) ?>
         <?cs if:this.info_url ?>
               <a href="<?cs var:this.info_url ?>" title="<?cs var:lang.info_title ?>" >?</a>
         <?cs /if ?>
         <?cs if:this.has_attachments ?>
           <img src="<?cs var:image_path ?>pclip.gif" alt="<?cs var:lang.pclip_title ?>" title="<?cs var:lang.pclip_title ?>" />
         <?cs /if ?>
     </td>

     <td><a href="<?cs var:this.read_msg_url ?>" title="<?cs var:lang.read_msg_title ?>" ><?cs var:this.subject ?></a></td>
     <td nowrap="nowrap"><?cs call:sender_or_recipients(this) ?></td>
     <td nowrap="nowrap"><?cs var:this.time_sent ?></td>
     <td><?cs if:this.delete_url ?><a href="<?cs var:this.delete_url ?>" title="<?cs var:lang.delete_msg_title ?>" onclick="return confirm_delete()" ><?cs var:lang.delete_msg ?></a><?cs /if ?></td>
    </tr>
   <?cs /each ?>
  </table>
<?cs /with ?>
<?cs /def ?>


<?cs def:new_memo_button() ?><?cs if:new_memo_url ?><a href="<?cs var:new_memo_url ?>" title="<?cs var:lang.new_memo_title ?>"><img src="<?cs var:image_path ?>new_memo.gif" width="50" height="34" alt="<?cs var:lang.new_memo_title ?>" /></a><?cs else ?><img src="<?cs var:image_path ?>new_memo.gif" width="50" height="34" alt="<?cs var:lang.command_disabled ?>" title="<?cs var:lang.command_disabled ?>" /><?cs /if ?><?cs /def ?>

<?cs def:other_box_button() ?><?cs if:outbox ?><a href="<?cs var:post_inbox_url ?>" title="<?cs var:lang.inbox_title ?>"><img src="<?cs var:image_path ?>goto_inbox.gif" width="50" height="34" alt="<?cs var:lang.inbox_title ?>" /></a><?cs else ?><a href="<?cs var:post_outbox_url ?>" title="<?cs var:lang.outbox_title ?>"><img src="<?cs var:image_path ?>goto_outbox.gif" width="50" height="34" alt="<?cs var:lang.outbox_title ?>" /></a><?cs /if ?><?cs /def ?>

<?cs def:inbox_outbox_label() ?><?cs if:outbox ?><img src="<?cs var:image_path ?>outbox_label.gif" width="136" height="34" alt="<?cs var:lang.outbox_description ?>" title="<?cs var:lang.outbox_description?>" /><?cs else ?><img src="<?cs var:image_path ?>inbox_label.gif" width="136" height="34" alt="<?cs var:lang.inbox_description ?>" title="<?cs var:lang.inbox_description?>" /><?cs /if ?><?cs /def ?>


<?cs def:print_inbox_outbox() ?>
<?cs with:lang=lang.post_inbox ?>
<table width="100%">
<tr><td align="center">
<form method="post" action="<?cs var:gather_action ?>">
 <div>
  <a href="<?cs var:main_menu_url ?>" title="<?cs var:lang.main_menu_title ?>"><img src="<?cs var:image_path ?>main.gif" width="50" height="34" alt="<?cs var:lang.main_menu_title ?>" /></a><?cs call:other_box_button() ?><?cs call:inbox_outbox_label() ?><?cs call:new_memo_button() ?>
 </div>
  <div>
  <?cs if:gather_action ?>
   <input type="hidden" name="id" value="<?cs var:id ?>" />
   <input type="hidden" name="crs" value="<?cs var:crs ?>" />
   <input type="hidden" name="fixed" value="<?cs var:fixed_font ?>" />
   <input type="submit" value="<?cs var:lang.gather_button ?>" title="<?cs var:lang.gather_button_title ?>" />
     <select name="gather" title="<?cs var:lang.gather_select_title ?>" >
     <option value="_unread_">&lt;<?cs var:lang.gather_unread ?>&gt;</option>
     <option value="_all_">&lt;<?cs var:lang.gather_all ?>&gt;</option>
     <?cs each:this = user ?>
      <option value="<?cs var:this.value ?>"><?cs var:this.realname ?></option>
     <?cs /each ?>
    </select>
 <?cs /if ?>
<?cs if:sort_order_url ?>
   <a href="<?cs var:sort_order_url ?>" title="<?cs var:lang.sort_title ?>"><img src="<?cs var:image_path ?>newest_sm.gif" alt="<?cs var:lang.sort_title ?>" /></a>
<?cs /if ?>
  </div>
<?cs if:hide_sleepy_url ?>
    <div><span class="hide_unhide_text" ><?cs var:lang.listing_all_msgs ?></span> <a href="<?cs var:hide_sleepy_url ?>" title="<?cs var:lang.hide_sleepy_help ?>" ><?cs var:lang.hide_sleepy_link ?></a></div>
 <?cs elif:list_all_url ?>
   <?cs if:hidden_count ?>
     <div><span class="hide_unhide_warning"><?cs var:hidden_count ?> <?cs var:lang.msgs_sleepy ?></span> <a href="<?cs var:list_all_url ?>" title="<?cs var:list_all_msgs ?>" ><?cs var:lang.list_all_msgs ?></a></div>
   <?cs else ?>
    <div><span class="hide_unhide_text"><?cs var:lang.no_sleepy_msgs ?></span> <a href="<?cs var:list_all_url ?>" title="<?cs var:lang.list_all_msgs ?>" ><?cs var:lang.list_all_msgs ?></a></div>
   <?cs /if ?>
 <?cs /if ?>
<?cs /with ?>
</form>
  <?cs call:print_messages() ?>

</td></tr>
</table>
<?cs /def ?>




	
<?cs call:html_heading() ?>

<head>
<title><?cs var:course_no ?> <?cs if:outbox ?><?cs var:lang.post_inbox.outbox_page_title ?><?cs else ?><?cs var:lang.post_inbox.inbox_page_title ?><?cs /if ?></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"  />
<script type="text/javascript">
function confirm_delete()
{
     return window.confirm('<?cs var:lang.post_inbox.delete_confirm ?>');
}
</script>
</head>
<?cs call:define_body() ?>
<?cs call:print_inbox_outbox() ?>
</body>
</html>
<?cs call:runtime() ?> 
