<!DOCTYPE html>
<html>
  <head>
    {include="includes"}
    {if="empty($GLOBALS['disablejquery'])"}
    <script src="inc/jquery.min.js#"></script>
    <script src="inc/jquery-ui.min.js#"></script>
    {/if}
  </head>
  <body
  {if condition="$link.title==''"}onload="document.linkform.lf_title.focus();"
  {elseif condition="$link.description==''"}onload="document.linkform.lf_description.focus();"
  {else}onload="document.linkform.lf_tags.focus();"{/if} >
    <div id="pageheader">
      {if="$source !== 'firefoxsocialapi'"}
        {include="page.header"}
      {/if}
      <div id="editlinkform">
        <form method="post" name="linkform">
          <p>
            <label for="lf_url">URL</label>
            <input type="text" id="lf_url" name="lf_url" value="{$link.url|htmlspecialchars}">
          </p>
          <p>
            <label for="lf_title">Title</label>
            <input type="text" id="lf_title" name="lf_title" value="{$link.title|htmlspecialchars}">
          </p>
          <p>
            <label for="lf_description">Description</label><a href="doc/markdown.php" id="help"><img src="images/help_icon.png#" alt="help icon"/></a>
            <textarea id="lf_description" name="lf_description" rows="4" cols="25">{$link.description|htmlspecialchars}</textarea>
          </p>
          <p>
            <label for="lf_tags">Tags</label>
            <input type="text" id="lf_tags" name="lf_tags" value="{$link.tags|htmlspecialchars}">
          </p>
          <p>
            <label for="lf_via">Origine</label>
            <input type="text" id="lf_via" name="lf_via" value="{$link.via|htmlspecialchars}">
          </p>
          {if condition="($link_is_new && $GLOBALS['privateLinkByDefault']==true) || $link.private == true"}
          <p>
            <input type="checkbox" checked="checked" name="lf_private" id="lf_private">
            &nbsp;<label for="lf_private">Private</label>
          </p>
          {else}
          <p>
            <input type="checkbox"  name="lf_private" id="lf_private">
            &nbsp;<label for="lf_private">Private</label>
          </p>
          {/if}
          <p class="submitButton">
            <input type="hidden" id="lf_linkdate" name="lf_linkdate" value="{$link.linkdate}">
            <input type="submit" value="Save" name="save_edit" class="bigbutton">
            <input type="submit" value="Cancel" name="cancel_edit" class="bigbutton">
            {if condition="!$link_is_new"}
            <input type="submit" value="Delete" name="delete_link" class="bigbutton" onClick="return confirmDeleteLink();">
            {/if}
            <input type="hidden" name="token" value="{$token}">
            {if condition="$http_referer"}
            <input type="hidden" name="returnurl" value="{$http_referer|htmlspecialchars}">
            {/if}
          </p>
        </form>
      </div>
    </div>
    {if="$source !== 'firefoxsocialapi'"}
      {include="page.footer"}
    {/if}
    {if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()) && empty($GLOBALS['disablejquery'])"}
    <script>
      $(document).ready(function() {
        $('#lf_tags').autocomplete({
          source : '{$source}?ws=tags',
          minLength : 1
        });
        $("#help").click(function() {
          window.open("doc/markdown.php", "myWindow","scrollbars=1, width=400, height=400");
          return false;
        });
      });
    </script>
    {/if}
  </body>
</html>