[% USE CGI %]
[% INCLUDE header.tt %]
[% INCLUDE banner.tt %]
<div id="content">
[% INCLUDE navbar.tt %]
<h2>Edit "[% node_name %]"</h2>

<div class="warning_text">
Someone has committed changes to this node since you began editing.
You will need to manually merge your changes into the new version.
</div>

<br clear="all" />

<form action="[% cgi_url %]" method="POST">
<table summary="Layout containing table">
  <tr>
    <td colspan="3">
    <fieldset>
    <legend>Main information</legend>
    <table summary="Editing areas for reconciling edit conflicts">
      <tr>
        <td class="label"><label for="content">Content:</label></td>
        <td><textarea name="content" id="content" rows="21" cols="40">[% stored_content %]</textarea></td>
        <td><small>[% CGI.escapeHTML(new_content) %]</small></td>
      </tr>
      <tr>
        <td class="label"><label for="locales">Locales:<br />(one per line)</label></td>
[%# NOTE: The whitespace in the next two textareas is deliberate, to avoid
    getting bogus tabs and blank lines in the textarea content.  Please
    do not reintroduce this bug.  Test on more than one browser. #%]
        <td><textarea id="locales" name="locales" rows="5" cols="40">[% FOREACH locale = stored_locales %][% locale %]
[% END %]</textarea></td>
        <td>[% FOREACH locale = new_locales %][% CGI.escapeHTML(locale) %]<br/>[% END %]</td>
      </tr>
      <tr>
        <td class="label"><label>Categories:<br />(one per line)</label></td>
        <td><textarea id="categories" name="categories" rows="5" cols="40">[% FOREACH category = stored_categories %][% category %]
[% END %]</textarea></td>
        <td>[% FOREACH category = new_categories %][% CGI.escapeHTML(category) %]<br/>[% END %]</td>
      </tr>
    </table>
    </fieldset>
    &nbsp;
    <fieldset>
    <legend>Metadata</legend>
    <table>
      <tr>
        <td class="label"><label for="phone">Phone:</label></td>
        <td><input type="text" size="50" id="phone" name="phone" value="[% stored_phone %]"></td>
        <td>[% CGI.escapeHTML(new_phone) %]</td>
      </tr>
      <tr>
        <td class="label"><label for="fax">Fax:</label></td>
        <td><input type="text" size="50" id="fax" name="fax" value="[% stored_fax %]"></td>
        <td>[% CGI.escapeHTML(new_fax) %]</td>
      </tr>
            <tr>
        <td class="label"><label for="website">Website:</label></td>
        <td><input type="text" size="50" id="website" name="website" value="[% stored_website %]"></td>
        <td>[% CGI.escapeHTML(new_website) %]
      </tr>
            <tr>
        <td class="label"><label for="hours">Opening hours:</label></td>
        <td><input type="text" size="50" id="hours" name="hours_text" value="[% stored_hours_text %]"></td>
        <td>[% CGI.escapeHTML(new_hours_text) %]</td>
      </tr>
            <tr>
        <td class="label"><label for="address">Address:</label></td>
        <td><input type="text" size="50" id="address" name="address" value="[% stored_address %]"></td>
        <td>[% CGI.escapeHTML(new_address) %]</td>
      </tr>
            <tr>
        <td class="label"><label for="postcode">Postcode:</label></td>
        <td><input type="text" size="50" id="postcode" name="postcode" value="[% stored_postcode %]"></td>
        <td>[% CGI.escapeHTML(new_postcode) %]</td>
      </tr> 
            <tr>
        <td class="label"><label for="os_x">OS X coordinate:</label></td>
        <td><input type="text" size="50" id="os_x" name="os_x" value="[% stored_os_x %]">
        <td>[% CGI.escapeHTML(new_os_x) %]</td>
      </tr>
            <tr>
        <td class="label"><label for="os_y">OS Y coordinate:</label></td>
        <td><input type="text" size="50" id="os_y" name="os_y" value="[% stored_os_y %]"></td>
        <td>[% CGI.escapeHTML(new_os_y) %]</td>
      </tr>
      <tr>
	<td class="label"><label for="map_link">Map link:</label></td>
	<td><input type="text" size="70" id="map_link" name="map_link" value="[% map_link %]"></td>
      </tr>
    </table>
    </fieldset>
    &nbsp;
    [% INCLUDE openguides_information_boxes.tt %]
    </td>
  </tr>
  <tr>
    <td align="center"><input type="submit" name="preview" value="Preview changes" class="form_button" /></td>
    <td align="center"><input type="submit" name="Save" value="Save changes" class="form_button" /></td>
  </tr>
  <tr>
    <td colspan="2" align="center"><a href="[% cgi_url %]?[% node_param %]">(cancel edit)</a></td>
  </tr>
</table>
<input type="hidden" name="title" value="[% node_name %]">
<input type="hidden" name="checksum" value="[% checksum %]" />
</form>

[% IF preview_html %]
  <h2>Preview</h2>
  [% INCLUDE display_metadata.tt %]

  [% preview_html %]
[% END %]

[% INCLUDE footer.tt %]