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

<?cs def:print_commands() ?>
<?cs with:lang=lang.assign_student_work ?>
<table width="100%">
<tr><td align="center">
  <div><a href="<?cs var:back_url ?>" title="<?cs var:lang.back_button_title ?>"><img src="<?cs var:image_path ?>back_arrow.gif"  width="50" height="34" alt="<?cs var:lang.back_button_title ?>" /></a><a href="<?cs var:main_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><span class="assign_student_name"> <?cs var:realname ?> </span><?cs if:newmemo_url ?><a href="<?cs var:newmemo_url ?>" title="<?cs var:lang.new_item_title ?>"><img src="<?cs var:image_path ?>new_memo.gif" width="50" height="34" alt="<?cs var:lang.new_item_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 ?></div> 
</td></tr>
</table>
<?cs /with ?>
<?cs /def ?>


<?cs def:flag_image(is_flagged) ?><img src="<?cs var:image_path ?><?cs if:is_flagged ?>flag.gif"  alt="<?cs var:lang.flag_title ?>" width="14" height="14"  /><?cs else ?>noflag.gif" alt="<?cs var:lang.noflag_title ?>" width="14" height="15" /><?cs /if ?><?cs /def ?>

<?cs def:print_flag(item) ?><a href="<?cs var:item.flag_url ?>" title="<?cs var:lang.flag_link_title ?>" ><?cs call:flag_image(item.is_flagged) ?></a><?cs /def ?>

<?cs def:print_attachment(topic, use_spacer) ?><?cs if:topic.has_attachments == #1 ?><img src="<?cs var:image_path ?>pclip.gif" alt="<?cs var:lang.attach_title ?>" title="<?cs var:lang.attach_title ?>" /><?cs elif:use_spacer ?><img src="<?cs var:image_path?>spacer.gif" width="13" height="15" alt=""/><?cs /if ?><?cs /def ?>

<?cs def:print_info(topic) ?><a href="<?cs var:topic.info_url ?>" title="<?cs var:lang.info_title ?>">?</a><?cs /def ?>

<?cs def:print_unread(topic, use_spacer) ?><?cs if:topic.is_unread == #1 ?><img src="<?cs var:image_path ?>redstar.gif" alt="<?cs var:lang.unread_title ?>" title="<?cs var:lang.unread_title ?>" width="10" height="12"/><?cs elif:use_spacer ?><img src="<?cs var:image_path?>spacer.gif" width="10" height="12" alt=""/><?cs /if ?><?cs /def ?>



<?cs def:print_one_msg(this) ?>
<?cs with:lang=lang.assign_student_work ?>
 <?cs each:topic = this.msg ?>
  <a name="<?cs var:topic.msg_id ?>"></a>
  <?cs if:topic.is_topic == #1 ?>
    <div class=<?cs if:teacher_hidden ?>"hidden_topic_listing"<?cs elif:read_only?>"readonly_topic_listing"<?cs else ?>"topic_listing"<?cs /if ?>>
    
    <?cs call:print_flag(topic) ?><a href="<?cs var:topic.info_url ?>" title="<?cs var:lang.assignment_info_title ?>">?</a><?cs call:print_attachment(topic, #0) ?><?cs call:print_unread(topic, #0) ?>
   
    <a href="<?cs var:topic.subject_url ?>" title="<?cs var:lang.read_assignment_help ?>"><?cs var:topic.subject ?></a>
    <?cs var:topic.sender ?> <?cs var:topic.sent_time ?> [<?cs var:topic.msg_id ?>]
    <?cs if:teacher_hidden ?><?cs var:lang.teacher_hidden ?><?cs elif:read_only ?><?cs var:lang.read_only ?><?cs /if ?>

   </div> 
 <?cs else ?>
   <?cs set:indent = topic.indent * #2 ?>
   <div style="text-indent: <?cs var:indent ?>em;">
   <?cs if:teacher_hidden ?><span class="hidden_message_listing"><?cs elif:read_only ?><span class="readonly_message_listing"><?cs /if ?>

   <?cs call:print_flag(topic) ?><?cs call:print_info(topic) ?><?cs call:print_attachment(topic, #1) ?><?cs call:print_unread(topic, #1) ?>

   <a href="<?cs var:topic.subject_url ?>" title="<?cs var:lang.subject_help ?>">
   <?cs if:topic.no_subject ?>
    <?cs var:lang.no_subject ?></a>
   <?cs else ?>
    <?cs var:topic.subject ?></a>
   <?cs /if ?>
   <?cs var:topic.sender ?> <?cs var:topic.sent_time ?>
   <?cs if:topic.add_re ?>
     [<?cs var:topic.msg_id ?> <?cs var:lang.regarding_label ?> <?cs var:topic.re_id ?>]
   <?cs else ?> 
  [<?cs var:topic.msg_id ?>]
  <?cs /if ?>
 <?cs if:teacher_hidden ?>
          <?cs var:lang.teacher_hidden ?>
          </span>
 <?cs elif:read_only ?>
          <?cs var:lang.read_only ?>
          </span>
 <?cs /if ?>
  </div> 
  <?cs /if ?>
 <?cs /each ?>
<?cs /with ?>
<?cs /def ?>



<?cs def:print_messages() ?>
<table width="100%">
<tr><td align="center">
 <table>
  <tr><td>
  <?cs each:this = topic ?>
    <?cs call:print_one_msg(this) ?>
  <?cs /each ?>  
  </td></tr>
 </table>
</td></tr>
</table>
<?cs /def ?>


<?cs call:html_heading() ?>
<head>
<title><?cs var:course_no ?> <?cs var:lang.assign_student_work.title ?> : <?cs var:realname ?> </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_commands() ?>
<?cs call:print_messages() ?>
</body>
</html>
<?cs call:runtime() ?>
