<!DOCTYPE html>
<html{if="$language !=='auto'"} lang=" {$language}"{/if}>

  <head>
    {include="includes"}
  </head>

  <body>
    {include="page.header"}

    <noscript>
      <div class="pure-g new-version-message pure-alert pure-alert-warning">
        <div class="pure-u-2-24"></div>
        <div class="pure-u-20-24">
          {'You have to enable JavaScript to change plugin loading order.'|t}
        </div>
      </div>
      <div class="clear"></div>
    </noscript>

    <section>
      <h2 class="window-title">{'Plugin administration'|t}</h2>

      <form method="POST" action="{$base_path}/admin/plugins" name="pluginform" id="pluginform">
        <fieldset id="enabled_plugins">
          <legend class="window-subtitle">{'Enabled Plugins'|t}</legend>
          {if="count($enabledPlugins)==0"}
          <p>{'No plugin enabled.'|t}</p>
          {else}
          <table id="plugin_table">
            <thead>
              <tr>
                <th>{'Enabled'|t}</th>
                <th>{'Name'|t}</th>
                <th>{'Description'|t}</th>
                <th>{'Order'|t}</th>
              </tr>
            </thead>
            <tbody>
              {loop="$enabledPlugins"}
              <tr data-line="{$key}" data-order="{$counter}">
                <td class="text-center"><input type="checkbox" name="{$key}" id="{$key}" checked="checked"></td>
                <td>
                  <label for="{$key}">{function="str_replace('_', ' ', $key)"}</label>
                </td>
                <td>{$value.description}</td>
                <td class="text-center">
                  {if="count($enabledPlugins)>1"}
                  <a href="#" class="order order-up">▲</a>
                  <a href="#" class="order order-down">▼</a>
                  {/if}
                  <input type="hidden" name="order_{$key}" value="{$counter}">
                </td>
              </tr>
              {/loop}
            </tbody>
            <tfoot>
              <tr>
                <th>{'Enabled'|t}</th>
                <th>{'Name'|t}</th>
                <th>{'Description'|t}</th>
                <th>{'Order'|t}</th>
              </tr>
            </tfoot>
          </table>
          {/if}
        </fieldset>

        <fieldset id="disabled_plugins">
          <legend class="window-subtitle">{'Disabled Plugins'|t}</legend>
          {if="count($disabledPlugins)==0"}
          <p>{'No plugin disabled.'|t}</p>
          {else}
          <table>
            <thead>
              <tr>
                <th>{'Enabled'|t}</th>
                <th>{'Name'|t}</th>
                <th>{'Description'|t}</th>
              </tr>
            </thead>
            <tbody>
              {loop="$disabledPlugins"}
              <tr>
                <td class="text-center"><input type="checkbox" name="{$key}" id="{$key}"></td>
                <td>
                  <label for="{$key}">{function="str_replace('_', ' ', $key)"}</label>
                </td>
                <td>
                  {$value.description}
                </td>
              </tr>
              {/loop}
            </tbody>
            <tfoot>
              <tr>
                <th>{'Enabled'|t}</th>
                <th>{'Name'|t}</th>
                <th>{'Description'|t}</th>
              </tr>
            </tfoot>
          </table>
          {/if}
        </fieldset>
        <p>
          {"More plugins available"|t}
          <a href="{$root_path}/doc/html/Community-&-Related-software/#third-party-plugins">{"in the documentation"|t}</a>.
        </p>
        <input type="submit" value="{'Save'|t}" name="save">
        <input type="hidden" name="token" value="{$token}">
      </form>
    </section>

    <section>
      <h2 class="window-title">{'Plugin configuration'|t}</h2>
      <form action="{$base_path}/admin/plugins" method="POST">
        {if="count($enabledPlugins)==0"}
        <p>{'No plugin enabled.'|t}</p>
        {else}
        {$nbParameters=0}
        {loop="$enabledPlugins"}
        {$nbParameters=$nbParameters+count($value.parameters)}
        {if="count($value.parameters) > 0"}
        <fieldset class="plugin_parameters">
          <legend class="window-subtitle">{function="str_replace('_', ' ', $key)"}</legend>
          {loop="$value.parameters"}
          <label for="{$key}">{$key}
            {if="isset($value.desc)"}
            &middot; {$value.desc}
            {/if}
          </label>
          <input name="{$key}" value="{$value.value}" id="{$key}" type="text" />
          {/loop}
        </fieldset>
        {/if}
        {/loop}
        {if="$nbParameters===0"}
        <p>{'No parameter available.'|t}</p>
        {else}
        <input type="submit" name="parameters_form" value="{'Save'|t}" />
        {/if}
        {/if}
        <input type="hidden" name="token" value="{$token}">
      </form>
    </section>
    {include="page.footer"}
    <script src="{$asset_path}/js/pluginsadmin.min.js?v={$version_hash}#"></script>
  </body>

  </html>