<input type="hidden" id="unique<%id%>" value="<%unique%>" />
<input type="hidden" id="deps<%id%>" value="<%loop deps%><%loop_value%><%unless last%> <%endunless%><%endloop%>" />
<input type="hidden" id="requires<%id%>" value="<%loop requires%><%loop_value%><%unless last%> <%endunless%><%endloop%>" />
<input type="hidden" id="update_type<%id%>" value="<%update_type%>" />
<div class="update <%update_type%>">
  <div class="selected-update" id="sel<%id%>" style="display: none"><%if update_mode eq 'history'%>uninstall<%else%>selected<%endif%></div>
  <div class="heading">
    <%~set show_check = 1%>
    <%~if update_mode eq 'history' and not reversible%>
      <%~set show_check = 0%>
    <%~elsif deps_first or revdeps_first%>
      <%~set show_check = 0%>
    <%~endif%>
    <%if show_check~%>
      <input type="checkbox" id="check<%id%>" name="<%if update_mode eq 'history'%>uninstall<%else%><%update_mode%><%endif%>" value="<%id%>" style="float: left" onclick="toggleUpdate(<%id%>, true)" />
    <%~endif%>
    <div class="message"><%if show_check%><label for="check<%id%>"><%endif%>
      <%if update_type eq 'version'%>New version:<%else%><%ucfirst update_type%> update:<%endif%>
    <%if show_check%></label><%endif%></div>
    <div class="update-title"><%if show_check%><label for="check<%id%>"><%title%></label><%else%><%title%><%endif%></div>
    <div class="show-hide" id="show-hide<%id%>" onclick="toggleDetails(<%id%>)">Show details</div>
  </div>
  <div id="details<%id%>" class="update-details">
    <%if installed~%>
    <div class="installdate"><span>Installed:</span> <%GT::Date::date_get($installed, '%yyyy%-%mm%-%dd% %HH%:%mm%:%ss%')%></div>
    <%~endif%>
    <div class="desc"><%description%></div>
    <%if not historic_version or historic_version eq $current_version%>
      <%if reversible%><div class="reversible">This update can be uninstalled.</div>
      <%else%>
        <div class="irreversible">
          <%if irreversible_dep~%>
            This update cannot be uninstalled because another, uninstallable update depends on it.
          <%~else~%>
            This update cannot be uninstalled.
          <%~endif%>
        </div>
      <%endif~%>
    <%endif~%>
    <%set display_files = 0~%>
    <%if files.length~%>
      <%loop files%><%unless id eq 'code'%><%set display_files = 1%><%lastloop%><%endunless%><%endloop%>
    <%~endif%>

    <%if deps_first and requires.length~%>
    <div class="depinfo">
      This update requires the following updates to be installed prior to installation:
      <ul>
        <%~loop requires%>
        <li><%ucfirst update.$loop_value.update_type%> update: <%update.$loop_value.title%></li>
        <%~endloop%>
      </ul>
    </div>
    <%~elsif revdeps_first and revdeps.length%>
    <div class="depinfo">
      This update requires the following updates to be uninstalled prior to being removed:
      <ul>
        <%~loop revdeps%>
        <li><%ucfirst update.$loop_value.update_type%> update: <%update.$loop_value.title%></li>
        <%~endloop%>
      </ul>
    </div>
    <%~endif%>

    <%if display_files~%>
    <div class="files">
      Files contained in update:
      <%if update_mode eq 'history' and reversible~%>
        (<span class="restore-star">*</span> = original file will be restored)
      <%~endif%>
      <table>
        <tr>
          <th title="Full path+filename">File</th>
          <th title="Type (file/directory)">Type</th>
          <th>Permission</th>
        </tr>
        <%~loop files%>
        <%~if id eq 'code'%><%nextloop%><%endif%>
        <tr class="<%if dir%>dir<%else%>file<%endif%> <%if odd%>odd<%else%>even<%endif%>">
          <td class="path"><%Links::Update::shorten($path, 8, 50)%><%if update_mode eq 'history' and backup%>&nbsp;<span class="restore-star" title="Backup up as <%backup%>">*</span><%endif%></td>
          <td class="type"><%if dir%>directory<%else%>file<%endif%></td>
          <td class="mode"><%mode%></td>
        </tr>
        <%~endloop%>
      </table>
    </div>
    <%~endif%>
  </div>
</div>
