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

<?cs def:print_one_entry(data) ?>
  <div class="menu_entry">
   <span class="regheading"><?cs var:data.entry ?></span>
  </div>
  <div class="menu_entry_desc">
     <span class="menu_desc"><?cs var:data.desc ?></span>
  </div>
<?cs /def ?>



<?cs def:print_photo(photo) ?>
 <table cellspacing="0" cellpadding="4" >
  <tr>
    <td valign="top"><img src="<?cs var:photo_url ?>" alt="" /><td>
    <td valign="middle">
      <table cellspacing="0" cellpadding="4" width="100%">
       <?cs set:photo_value = #0 ?>
       <?cs each:this = photo ?>
         <tr>
             <?cs if:photo_value == #0 ?>
             <td><input type="radio" name="photo" value="<?cs var:photo_value ?>" checked="checked" title="<?cs var:this.help ?>" /></td>
             <?cs else ?>
             <td><input type="radio" name="photo" value="<?cs var:photo_value ?>" title="<?cs var:this.help ?>" /></td>
             <?cs /if ?>
            <td><?cs var:this.msg ?><?cs if:this.help1 ?><input type="file" name="photofile" id="photofile" title="<?cs var:this.help1 ?>" /><?cs /if ?></td>
         </tr>
       <?cs set:photo_value = photo_value + #1 ?>
       <?cs /each ?>
      </table> 
    </td>
 </tr>
 </table>
<?cs /def ?>



<?cs def:print_default(data, value, name, max) ?>
  <tr>
     <td class="regheading"><?cs var:data.msg ?></td>
     <td><input type="text" name="<?cs var:name ?>" value="<?cs var:value ?>" title="<?cs var:data.help ?>" size="20" maxlength="<?cs var:max ?>" /></td> 
  </tr>
<?cs /def ?>



<?cs def:print_text_box(name, value, max, help) ?>
  <input type="text" size="20" maxlength="<?cs var:max ?>" name="<?cs var:name ?>" title="<?cs var:help ?>"  value="<?cs var:value ?>" />
<?cs /def ?>



<?cs def:print_custom(num, labelvalue, labelmax, contentvalue, contentmax) ?>
  <?cs set:num = num + #1 ?>
  <?cs set:lname = "label" + num  ?>
  <?cs set:cname = "content" + num  ?>
 <tr>
   <td><?cs call:print_text_box(lname, labelvalue, labelmax, lang.bio_edit_form.custom[0].help) ?><span class="regheading">:</span></td>
   <td><?cs call:print_text_box(cname, contentvalue, contentmax, lang.bio_edit_form.custom[1].help) ?></td>
 </tr> 
<?cs /def ?>


<?cs def:print_label(data) ?>
 <table cellspacing="0" cellpadding="6" border="1">
  <tr>
     <?cs each:label = data.info.label ?>
      <td class="regheading" align="center"><?cs var:label ?></td>
     <?cs /each ?>
  </tr>
   <?cs call:print_default(data.tag[0], email, "email", bio_max_custom_content) ?>
   <?cs call:print_default(data.tag[1], website, "website", bio_max_custom_content) ?>
   <?cs loop:x = #0, bio_max_custom_elements - 1, #1 ?>
     <?cs call:print_custom(x, custom[x].label, bio_max_custom_label, custom[x].content, bio_max_custom_content) ?>
   <?cs /loop ?> 
 </table> 
<?cs /def ?>


<?cs def:print_bio(data) ?>
  <span class="regheading"><?cs var:data.bio.desc ?></span>
  <table cellspacing="0" cellpadding="6" >
   <?cs if:spell_check ?>
    <tr>
     <td align="right">
     <input type="button" value="<?cs var:data.spell.msg ?>" onclick="openSpellChecker( document.forms[0].narrative );" title="<?cs var:data.spell.help ?>" /></td>
    </tr> 
   <?cs /if ?>
   <tr>
     <td>
      <textarea name="narrative" title="<?cs var:data.bio.help ?>" rows="8" cols="71" wrap=<?cs if:hard_wrap ?>"hard"<?cs else ?>"virtual"<?cs /if?>><?cs each:this = bio ?><?cs var:this.line ?><?cs /each ?></textarea>
    </td>
   </tr>
   <tr>
    <td align="center"><br />
   <input type="submit" value="<?cs var:lang.bio_edit_form.submit.msg ?>" title="<?cs var:lang.bio_edit_form.submit.help ?>" onclick="javascript:doaction()" />
    </td>
   </tr>
  </table> 
<?cs /def ?>

<?cs call:html_heading() ?>
   <head>
      <title><?cs var:lang.bio_edit_form.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 ?>manhattan.css" type="text/css" />
  <script type="text/javascript" src="<?cs var:servername ?><?cs var:image_path ?>xp_progress.js"></script>
   <?cs if:spell_check ?>
  <script type="text/javascript" src="<?cs var:servername ?><?cs var:image_path ?>spellChecker.js"></script>
  <script type="text/javascript">
   function openSpellChecker(txt) {
    var speller = new spellChecker( txt,'<?cs var:servername ?><?cs var:image_path ?>spellchecker.html','<?cs var:servername ?>/<?cs var:alias ?>/spellchecker' );
     speller.openChecker();
   }
  </script>

   <?cs /if ?>
  <script type="text/javascript">
   function doaction()
   {
        bar1.showBar();
        scroll(0,0);
   }
  </script> 
  </head>

<?cs call:define_onload_onunload_body('photofile') ?>
    <div>
    <a href="javascript:history.back()" title="<?cs var:lang.bio_edit_form.goback ?>"><img src="<?cs var:image_path ?>/back_arrow.gif" width="50" height="34" alt="<?cs var:lang.bio_edit_form.goback ?>" /></a>
  </div> 
<div class="center_msg">
   <span class="common_course">(<?cs var:lang.bio_edit_form.scroll ?>)</span>
</div>
 
<div class="center_msg">
  <?cs var:realname ?>
</div> 
<div><form enctype="multipart/form-data" method="post" action="bio_edit">
  <div>
    <input type="hidden" name="id" value="<?cs var:Query.id ?>" />
    <input type="hidden" name="user" value="<?cs var:Query.user ?>" />
    <?cs if:Query.crs ?>
    <input type="hidden" name="crs" value="<?cs var:Query.crs ?>" />
    <?cs /if ?>
    <?cs if:Query.admin ?>
    <input type="hidden" name="admin" value="<?cs var:Query.admin ?>" />
    <?cs /if ?>
  </div> 
<div class="menu_entry_sub">
  <?cs call:print_photo(lang.bio_edit_form.photo) ?>
</div>

<div class="menu_entry_sub">
  <?cs call:print_label(lang.bio_edit_form) ?>
</div>

<div class="menu_entry_sub">
  <?cs call:print_bio(lang.bio_edit_form) ?>
</div>
</form></div>
<?cs each:this = lang.bio_edit_form.desc ?>
   <?cs call:print_one_entry(this) ?>
<?cs /each ?>
 <script type="text/javascript">
     var bar1 = createBar( 'white', 1, 'black', 'blue', 85, 7, 3, "");
   </script>

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