<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%if install~%>
  <%Links::Update::browser_install~%>
  <%if update_success and update_status == 2~%><%include update_version.html%><%endparse~%>
  <%elsif update_success%><%set message = 'Selected updates have been successfully installed.'~%>
  <%elsif update_failed~%>
    <%if verify_failed~%>
      <%set error = "Unable to installed selected updates: Update verification failed: "~%>
      <%set failure_reason = '<ul>'~%>
      <%if already_installed%><%set failure_reason .= "<li>Some selected updates were already installed.</li>"~%>
      <%elsif does_not_exist%><%set failure_reason .= "<li>Some selected updates are no longer available for installation.</li>"~%>
      <%elsif unique_update%><%set failure_reason .= "<li>One or more selected updates are marked as unique, but more than one update was selected.</li>"~%>
      <%elsif depends_on%><%set failure_reason .= "<li>One or more selected updates require dependencies which were not selected.</li>"~%>
      <%endif~%>
      <%if failure_reason eq '<ul>'%><%set failure_reason = 'Unknown error.'%><%else%><%set failure_reason .= '</ul>'%><%endif~%>
      <%set error .= $failure_reason~%>
    <%endif~%>
  <%endif~%>
<%endif~%>
<%if not config.reg_number~%>
<%set error = "You must enter a valid registration number before checking for updates.  You can enter a registration number in the Setup -&gt; Misc. Options menu."~%>
<%else~%>
<%Links::Update::check~%>

<%endif~%>

<%if error and update_error_code~%>
  <%if update_error_code == 203~%>
    <%set error .= "<br /><br />You can reset the admin path stored on the Gossamer Threads update server a limited number of times from the <a href=\"http://www.gossamer-threads.com/scripts/licensed/\" target=\"_blank\">licensed download area</a>."~%>
  <%endif~%>
<%endif~%>

<%set update_mode = 'install'~%>
<html>
<head>
  <base target="content" />
  <title>Gossamer Links - Updates - Available Updates</title>
  <%include include_style.html%>
  <%include update_style.html%>
  <%include update_js.html%>
</head>
<body>

<div class="header-block">
  <h1>Available Updates</h1>
  <h2>Available Updates</h2>
  <%if message%><div class="success"><div class="word">Results:&nbsp;</div> <%message%></div><%endif%>
  <%if error%><div class="error"><div class="word">Error:&nbsp;</div> <%error%></div><%endif%>
  <h3>

    The following updates are available for your Gossamer Links installation:<br /><br />

    <span class="critical">
      <%if critical_installable%><span class="yes">
        <%critical_installable%> critical update<%unless critical_installable == 1%>s<%endunless%>
      </span><%else%>
      No critical updates
      <%endif%>
    </span>
    <br />

    <span class="recommended">
      <%if recommended_installable%><span class="yes">
        <%recommended_installable%> recommended update<%unless recommended_installable == 1%>s<%endunless%>
      </span><%else%>
      No recommended updates
      <%endif%>
    </span>
    <br />

    <span class="optional">
      <%if optional_installable%><span class="yes">
        <%optional_installable%> optional update<%unless optional_installable == 1%>s<%endunless%>
      </span><%else%>
      No optional updates
      <%endif%>
    </span>
    <br />

  <%if critical_installable or recommended_installable or optional_installable or version_installable%>
    <div class="show-all" id="show-all" onclick="allUpdates(showDetails); this.style.display = 'none'; document.getElementById('hide-all').style.display = 'block';">Show all details</div>
    <div class="show-all" style="display: none" id="hide-all" onclick="allUpdates(hideDetails); this.style.display = 'none'; document.getElementById('show-all').style.display = 'block';">Hide all details</div>
  <%endif%>

    <span class="version">
      <%if version_installable%><span class="yes">
        A new version is available!
      </span><%else%>
      No new version is available.
      <%endif%>
    </span>
  </h3>
</div>


<form method="post" action="admin.cgi">
<input type="hidden" name="do" value="page" />
<input type="hidden" name="page" value="update_list.html" />
<%if updates_selected%><input type="hidden" id="preselect" value="<%loop updates_selected%><%loop_value%><%unless last%> <%endunless%><%endloop%>" /><%endif%>
<div class="updates">
<%loop update_types%>
<%loop updates%>
<%if installed or impossible%><%nextloop%><%endif%>
<%include update_display.html%>
<%endloop%>
<%endloop%>
</div>

<div id="install-updates" class="submit" style="margin-top: 30px; display: none">
  <input type="submit" value="Install Selected Updates" />
</div>
</form>

</body>
</html>
