<h1 tal:replace="structure context/manage_page_header">PAGE HEADER</h1>
<h2 tal:replace="structure context/manage_tabs">TABS</h2>
<style type="text/css">
.warning {
   color: red;
   font-weight: bold;
}
.info {
   color: #446688;
   font-style: italic;
   margin-left: 2em;
}
</style>

<div tal:define="contexts context/listContextInfos;
                 bases python: [x for x in contexts if x['type'] == 'base'];
                 context_id context/getBaselineContextID;
                 context_id_display python: context_id or '(none)';
                 overwrite_style python: context_id != ''
                                    and 'display: none' or 'display: block';
                ">
<h3> Setup Tool Profiles </h3>

<form method="post" action=".">

 <fieldset id="baseline_fs">
   <legend>Baseline Profile</legend>
   
  <p>Active baseline: <span tal:content="context_id_display">(none)</span>
  <tal:whatever
         tal:define="last python:context.getProfileImportDate(context_id);
                    ">
   <span class="info"
         tal:condition="last">
     Last imported <tal:x tal:content="last">TIMESTAMP</tal:x></span>
   </tal:whatever>
  </p>

  <div tal:condition="python: context_id != ''">
  <script type="text/javascript" lang="JavaScript">
  function showOverwrite(e) {
      var overwrite = document.getElementById('overwrite');
      overwrite.style.display = 'block';
  }
  </script>
  <p style="color: red"> Changing the baseline profile is potentially a
     dangerous operation.
     <a href="#" onclick="showOverwrite(this); return false">Click here</a>
     if you really need to do this.
   </p>
  </div>

  <div id="overwrite"
       tal:attributes="style overwrite_style">
   <select name="context_id">
    <option value="context-CONTEXT_ID"
       tal:repeat="context_info bases"
       tal:attributes="selected python:context_id == context_info['id'];
                       value context_info/id"
       tal:content="context_info/title"
    >CONTEXT_TITLE</option>
   </select>
   <input class="form-element" type="submit"
          name="manage_updateToolProperties:method"
          value="Update Base Profile" />
  </div>
 </fieldset>
</form>
</div>

<h1 tal:replace="structure context/manage_page_footer">PAGE FOOTER</h1>
