<!--#set global $pane="Servers"#-->
<!--#set global $help_uri="Configure+Servers-0-7"#-->
<!--#include $webdir + "/_inc_header.tmpl"#-->

<div id="config-components">

  <div id="core-component-group0" class="component-group clearfix">
    <input type="button" class="juiButton" id="addServerButton" style="padding:4px;" value="$T('button-addServer')" />
    <script>
      jQuery('#addServerButton').click(function(){
        jQuery('#core-component-group0').hide();
        jQuery('#core-component-group1').show();
      });
    </script>
  </div>

  <div id="core-component-group1" class="component-group clearfix" style="display:none;">
    <form action="addServer" method="post" autocomplete="off">
    <input type="hidden" name="session" value="$session">
    <div class="component-group-desc">
      <h3>$T('addServer')</h3>
      <p>
        <input type="submit" class="juiButton" style="padding:4px;" value="$T('button-addServer')" /><br/><br/>
        <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
      </p>
    </div>
    <fieldset class="component-group-list">
      <div class="field-pair">
        <label class="nocheck clearfix" for="host">
          <span class="component-title">$T('srv-host')</span>
          <input type="text" size="25" name="host"/>
        </label>
      </div>
      <div class="field-pair alt">
        <label class="nocheck clearfix" for="port">
          <span class="component-title">$T('srv-port')</span>
          <input type="text" size="10" name="port"/>
        </label>
      </div>
      <div class="field-pair">
        <label class="nocheck clearfix" for="username">
          <span class="component-title">$T('srv-username')</span>
          <input type="text" size="25" name="username"/>
        </label>
      </div>
      <div class="field-pair alt">
        <label class="nocheck clearfix" for="password">
          <span class="component-title">$T('srv-password')</span>
          <input type="text" size="25" name="password"/>
        </label>
      </div>
      <div class="field-pair">
        <label class="nocheck clearfix" for="connections">
          <span class="component-title"># $T('srv-connections')</span>
          <input type="text" size="10" name="connections"/>
        </label>
      </div>
      <div class="field-pair alt">
        <label class="nocheck clearfix" for="retention">
          <span class="component-title">$T('srv-retention')</span>
          <input type="text" size="10" name="retention"/> <i>$T('days')</i>
        </label>
      </div>
      <div class="field-pair">
        <label class="nocheck clearfix" for="timeout">
          <span class="component-title">$T('srv-timeout')</span>
          <input type="text" size="10" name="timeout"/> <i>$T('seconds')</i>
        </label>
      </div>
      <div class="field-pair alt">
        <input type="checkbox" name="enable" id="enable" value="1" checked="1"/>
        <label class="clearfix" for="enable">
          <span class="component-title">$T('srv-enable')</span>
          <span class="component-desc">&nbsp;</span>
        </label>
      </div>
      <div class="field-pair alt">
        <input type="checkbox" name="ssl" id="ssl" value="1" <!--#if int($have_ssl) == 0 then "disabled" else ""#-->/>
        <label class="clearfix" for="ssl">
          <span class="component-title">$T('srv-ssl')</span>
          <span class="component-desc">&nbsp;</span>
        </label>
      </div>
      <div class="field-pair alt">
        <input type="checkbox" name="fillserver" id="fillserver" value="1"/>
        <label class="clearfix" for="fillserver">
          <span class="component-title">$T('srv-fillserver')</span>
          <span class="component-desc">&nbsp;</span>
        </label>
      </div>
      <div class="field-pair alt">
        <input type="checkbox" name="optional" id="optional" value="1"/>
        <label class="clearfix" for="optional">
          <span class="component-title">$T('srv-optional')</span>
          <span class="component-desc">&nbsp;</span>
        </label>
      </div>
    </fieldset>
    </form>
  </div><!-- /component-group1 -->

  <!--#set $slist = $servers.keys()#-->
  <!--#$slist.sort()#-->
  <!--#set $cur = 0#-->
  <!--#for $server in $slist#-->
    <!--#set $cur = $cur + 1#-->

  <div id="core-component-group$cur" class="component-group clearfix">
    <form action="saveServer" method="post" autocomplete="off">
    <input type="hidden" name="session" value="$session">
    <input type="hidden" name="server" value="$server"/>
    <div class="component-group-desc">
      <h3>$servers[$server]['name']</h3>
      <p>
        <input type="submit" class="juiButton" style="padding:4px;" value="$T('button-saveChanges')" />
        <br/><br/>
        <input type="button" class="juiButton testServer" style="padding:4px;" value="$T('button-testServer')" />
        <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
        <br/><br/>
        <input type="button" class="juiButton delServer" style="padding:4px;" value="$T('button-delServer')" rel="$T('Plush-confirm') "/>
        <br/><br/>
        <input type="button" class="juiButton clrServer" style="padding:4px;" value="$T('button-clrServer')" rel="$T('Plush-confirm') "/>
      </p>

  <!--#if 'amounts' in $servers[$server]#-->
  <br/>
  <p>
    <strong>$T('srv-bandwidth'):</strong><br/>
    $T('total'): $servers[$server]['amounts'][0]<br/>
    $T('today'): $servers[$server]['amounts'][3]<br/>
    $T('thisWeek'): $servers[$server]['amounts'][2]<br/>
    $T('thisMonth'): $servers[$server]['amounts'][1]
  </p>
  <!--#end if#-->
</div>
<fieldset class="component-group-list">
  <br/>
  <div class="field-pair">
    <label class="nocheck clearfix" for="host">
      <span class="component-title">$T('srv-host')</span>
      <input type="text" size="40" name="host" value="$servers[$server]['host']" />
    </label>
  </div>
  <div class="field-pair alt">
    <label class="nocheck clearfix" for="port">
      <span class="component-title">$T('srv-port')</span>
      <input type="text" size="10" name="port" value="$servers[$server]['port']" />
    </label>
  </div>
  <div class="field-pair">
    <label class="nocheck clearfix" for="username">
      <span class="component-title">$T('srv-username')</span>
      <input type="text" size="25" name="username" value="$servers[$server]['username']" />
    </label>
  </div>
  <div class="field-pair alt">
    <label class="nocheck clearfix" for="password">
      <span class="component-title">$T('srv-password')</span>
      <input type="text" size="25" name="password" value="$servers[$server]['password']" />
    </label>
  </div>
  <div class="field-pair">
    <label class="nocheck clearfix" for="connections">
      <span class="component-title">$T('srv-connections')</span>
      <input type="text" size="10" name="connections" value="$servers[$server]['connections']" />
    </label>
  </div>
  <div class="field-pair alt">
    <label class="nocheck clearfix" for="retention">
      <span class="component-title">$T('srv-retention')</span>
      <input type="text" size="10" name="retention" value="$servers[$server]['retention']" /> <i>$T('days')</i>
    </label>
  </div>
  <div class="field-pair">
    <label class="nocheck clearfix" for="timeout">
      <span class="component-title">$T('srv-timeout')</span>
      <input type="text" size="10" name="timeout" value="$servers[$server]['timeout']" /> <i>$T('seconds')</i>
    </label>
  </div>

  <div class="field-pair alt">
    <input type="checkbox" name="enable" id="enable" value="1" <!--#if int($servers[$server]['enable']) != 0 then "checked=1" else ""#--> />
    <label class="clearfix" for="enable">
      <span class="component-title">$T('srv-enable')</span>
      <span class="component-desc">&nbsp;</span>
    </label>
  </div>
  <div class="field-pair alt">
    <input type="checkbox" name="ssl" id="ssl" value="1" <!--#if int($servers[$server]['ssl']) != 0 and int($have_ssl) == 1 then "checked=1" else ""#--> <!--#if int($have_ssl) == 0 then "disabled" else ""#--> />
    <label class="clearfix" for="ssl">
      <span class="component-title">$T('srv-ssl')</span>
      <span class="component-desc">&nbsp;</span>
    </label>
  </div>
  <div class="field-pair alt">
    <input type="checkbox" name="fillserver" id="fillserver" value="1" <!--#if int($servers[$server]['fillserver']) != 0 then "checked=1" else ""#--> />
    <label class="clearfix" for="fillserver">
      <span class="component-title">$T('srv-fillserver')</span>
      <span class="component-desc">&nbsp;</span>
    </label>
  </div>
  <div class="field-pair alt">
    <input type="checkbox" name="optional" id="optional" value="1" <!--#if int($servers[$server]['optional']) != 0 then "checked=1" else ""#--> />
    <label class="clearfix" for="optional">
      <span class="component-title">$T('srv-optional')</span>
      <span class="component-desc">&nbsp;</span>
    </label>
  </div>
  </fieldset>
  </form>
</div><!-- /component-group$cur -->

  <!--#end for#-->

</div>

<!--#include $webdir + "/_inc_footer.tmpl"#-->
