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

<?cs def:print_row(label, value) ?>
     <tr>
        <td><?cs var:label ?></td>  
        <td><?cs var:value ?></td>  
     </tr>
<?cs /def ?>

<?cs def:print_title() ?>
  <table width="100%">
   <tr><td align="center">
     <table border="1" cellspacing="0">
         <?cs call:print_row(lang.survey_table_data.num_responses_label, survey.num_responses) ?>
      <?cs if:survey_type != "www_accessible" ?>
         <?cs call:print_row(lang.survey_table_data.num_expected_takers, survey.num_expected_takers) ?>
         <?cs call:print_row(lang.survey_table_data.rate_label, survey.rate) ?>
      <?cs /if ?>

         <?cs if:survey_type == "mymanhattan" ?>
            <?cs call:print_row(lang.survey_table_data.survey_type_label, lang.survey_table_data.mymanhattan_delivered) ?>
         <?cs elif:survey_type == "www_accessible" ?>
            <?cs call:print_row(lang.survey_table_data.survey_type_label, lang.survey_table_data.web_delivered) ?>

         <?cs /if ?>
      </table>
   </td></tr>
 </table>
<?cs /def ?> 
    
<?cs def:print_table_heading() ?>
  <tr>
   <?cs if:display_course_list ?>
    <th><?cs var:lang.survey_table_data.course_list ?></th>
   <?cs /if ?>

   <?cs loop:x =1, number_question, #1 ?>
    <th><?cs var:x ?></th>
   <?cs /loop ?>
  </tr>
<?cs /def ?>
 
<?cs def:print_data(data) ?>
   <tr>
     <?cs if:data.course_list ?>
       <td><?cs var:data.course_list ?></td>
     <?cs /if ?>
     <?cs each:this = data.value ?>
        <td><?cs var:this ?></td>
     <?cs /each ?>
   </tr>
<?cs /def ?> 

      

<?cs ###########################
     # HTML starts here
     ###########################
?>
<?cs call:html_heading() ?>
   <head>
      <title><?cs var:lang.survey_table_data.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 ?>survey.css" type="text/css"  />
</head>
<?cs call:define_body() ?> 
<?cs if:course_title ?>
 <?cs call:print_course_heading("javascript:history.back()", lang.survey_table_data.back_button) ?>
<?cs else ?>
<div>
   <a href="javascript:window.close()" title="<?cs var:lang.survey_table_data.closewin ?>">
   <img src="<?cs var:image_path ?>close.gif" alt="<?cs var:lang.survey_table_data.closewin ?>" /></a>
</div>
<?cs /if ?>

<?cs call:print_title() ?>
<div class="center_msg">
  <a href="<?cs var:csv_url ?>" title="<?cs var:lang.survey_table_data.download_csv_link_title ?>" >
   <?cs var:lang.survey_table_data.download_csv_link ?>
  </a>
</div>

<table width="100%">
<tr><td align="center">
  <table border="1" cellspacing="0">
    <?cs call:print_table_heading() ?>
    <?cs each:this = record ?>
      <?cs call:print_data(this) ?>
    <?cs /each ?>
  </table>  
</td></tr>
</table>

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