You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

287 lines
16 KiB

<!--#set global $pane="Servers"#-->
<!--#set global $help_uri="configure-servers-0-8"#-->
<!--#include $webdir + "/_inc_header_uc.tmpl"#-->
<div class="colmask">
<form action="addServer" method="post" novalidate>
<input type="hidden" name="session" value="$session" />
<div id="addServer">
<div class="padding alt">
<button type="button" class="btn btn-default" id="addServerButton"><span class="glyphicon glyphicon-plus"></span> $T('button-addServer')</button>
</div>
</div>
<div class="section" id="addServerContent" style="display: none;">
<div class="col2">
<h3>$T('addServer')</h3>
</div><!-- /col2 -->
<div class="col1">
<fieldset>
<div class="field-pair alt">
<label class="config" for="enable">$T('srv-enable')</label>
<input type="checkbox" name="enable" id="enable" value="1" checked="checked" />
<span class="desc">$T('srv-enable')</span>
</div>
<div class="field-pair">
<label class="config" for="host">$T('srv-host')</label>
<input type="text" name="host" id="host" size="40" />
</div>
<div class="field-pair alt">
<label class="config" for="port">$T('srv-port')</label>
<input type="text" name="port" id="port" size="8" />
</div>
<div class="field-pair">
<label class="config" for="username">$T('srv-username')</label>
<input type="text" name="username" id="username" size="30" />
</div>
<div class="field-pair alt">
<label class="config" for="password">$T('srv-password')</label>
<input type="password" name="password" id="password" size="30" />
</div>
<div class="field-pair">
<label class="config" for="connections">$T('srv-connections')</label>
<input type="number" name="connections" id="connections" min="0" max="100" />
</div>
<div class="field-pair alt">
<label class="config" for="priority">$T('srv-priority')</label>
<input type="number" name="priority" id="priority" min="0" max="100" /> <i>$T('explain-svrprio')</i>
</div>
<div class="field-pair">
<label class="config" for="retention">$T('srv-retention')</label>
<input type="number" name="retention" id="retention" min="0" /> <i>$T('days')</i>
</div>
<div class="field-pair">
<label class="config" for="timeout">$T('srv-timeout')</label>
<input type="number" name="timeout" id="timeout" min="30" /> <i>$T('seconds')</i>
</div>
<div class="field-pair alt <!--#if int($have_ssl) == 0 then "disabled" else ""#-->">
<label class="config" for="ssl">$T('srv-ssl')</label>
<input type="checkbox" name="ssl" id="ssl" value="1" <!--#if int($have_ssl) == 0 then "disabled=\"disabled\"" else ""#--> />
<span class="desc">$T('srv-ssl')</span>
</div>
<div class="field-pair <!--#if int($have_ssl) == 0 then "disabled" else ""#-->">
<label class="config" for="ssl_type">$T('srv-ssl_type')</label>
<!--#if int($have_ssl) == 1#-->
<select name="ssl_type" id="ssl_type">
<option value="t1" selected="selected" class="selected">TLS1</option>
<option value="v23">V23</option>
<option value="v2" >V2</option>
<option value="v3" >V3</option>
</select>
<!--#end if#-->
<span class="desc">$T('srv-explain-ssl_type')</span>
</div>
<div class="field-pair">
<label class="config" for="send_group">$T('srv-send_group')</label>
<input type="checkbox" name="send_group" id="send_group" value="1" />
<span class="desc">$T('srv-explain-send_group')</span>
</div>
<div class="field-pair alt">
<label class="config" for="optional">$T('srv-optional')</label>
<input type="checkbox" name="optional" id="optional" value="1" />
<span class="desc">$T('srv-optional')</span>
</div>
<div class="field-pair">
<label class="config" for="categories">$T('srv-categories')</label>
<select name="categories" id="categories" multiple>
<!--#for $cat in $cats#-->
<option value="$cat" <!--#if $cat == "Default"#-->selected<!--#end if#-->>$cat</option>
<!--#end for#-->
</select>
<span class="desc">$T('srv-explain-categories')</span>
</div>
<div class="field-pair alt">
<label class="config" for="displayname">$T('srv-displayname')</label>
<input type="text" name="displayname" id="displayname" size="30" />
</div>
<div class="field-pair">
<label class="config" for="notes">$T('srv-notes')</label>
<textarea name="notes" id="notes" rows="3" cols="50"></textarea>
</div>
<div class="field-pair">
<button class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> $T('button-addServer')</button>
<button class="btn btn-default testServer" type="button"><span class="glyphicon glyphicon-sort"></span> $T('button-testServer')</button>
</div>
</fieldset>
</div><!-- /col1 -->
</div><!-- /section -->
</form>
<!--#set $slist = $servers.keys()#-->
<!--#$slist.sort()#-->
<!--#set $cur = 0#-->
<!--#for $server in $slist#-->
<!--#set $cur = $cur + 1#-->
<form action="saveServer" method="post" id="fullform" novalidate>
<input type="hidden" name="session" value="$session" />
<input type="hidden" name="server" value="$server" />
<div class="section">
<div class="col2">
<h3>$servers[$server]['displayname']</h3>
<table><tr>
<td><input type="checkbox" class="toggleServerCheckbox" id="enable_$server" rel="$server" name="q_enable" value="1" <!--#if int($servers[$server]['enable']) != 0 then 'checked="checked"' else ""#--> /></td>
<td><label for="enable_$server">&nbsp;$T('enabled')</label></td>
</tr></table>
<button type="button" class="btn btn-default clrServer">$T('button-clrServer')</button>
<button type="button" class="btn btn-default showserver">$T('showDetails')</button>
</div><!-- /col2 -->
<div class="col1" style="display:none;">
<fieldset>
<div class="field-pair alt">
<label class="config" for="enable$cur">$T('srv-enable')</label>
<input type="checkbox" name="enable" id="enable$cur" value="1" <!--#if int($servers[$server]['enable']) != 0 then 'checked="checked"' else ""#--> />
<span class="desc">$T('srv-enable')</span>
</div>
<div class="field-pair">
<label class="config" for="host$cur">$T('srv-host')</label>
<input type="text" name="host" id="host$cur" value="$servers[$server]['host']" size="30" />
</div>
<div class="field-pair alt">
<label class="config" for="port$cur">$T('srv-port')</label>
<input type="text" name="port" id="port$cur" value="$servers[$server]['port']" size="8" />
</div>
<div class="field-pair">
<label class="config" for="username$cur">$T('srv-username')</label>
<input type="text" name="username" id="username$cur" value="$servers[$server]['username']" size="30" />
</div>
<div class="field-pair alt">
<label class="config" for="password$cur">$T('srv-password')</label>
<input type="password" name="password" id="password$cur" value="$servers[$server]['password']" size="30" />
</div>
<div class="field-pair">
<label class="config" for="connections$cur">$T('srv-connections')</label>
<input type="number" name="connections" id="connections$cur" value="$servers[$server]['connections']" min="0" max="100" />
</div>
<div class="field-pair">
<label class="config" for="priority$cur">$T('srv-priority')</label>
<input type="number" name="priority" id="priority$cur" value="$servers[$server]['priority']" min="0" max="100" /> <i>$T('explain-svrprio')</i>
</div>
<div class="field-pair alt">
<label class="config" for="retention$cur">$T('srv-retention')</label>
<input type="number" name="retention" id="retention$cur" value="$servers[$server]['retention']" min="0" /> <i>$T('days')</i>
</div>
<div class="field-pair">
<label class="config" for="timeout$cur">$T('srv-timeout')</label>
<input type="number" name="timeout" id="timeout$cur" value="$servers[$server]['timeout']" min="30" /> <i>$T('seconds')</i>
</div>
<div class="field-pair alt <!--#if int($have_ssl) == 0 then "disabled" else ""#-->">
<label class="config" for="ssl$cur">$T('srv-ssl')</label>
<input type="checkbox" name="ssl" id="ssl$cur" value="1" <!--#if int($servers[$server]['ssl']) != 0 and int($have_ssl) == 1 then 'checked="checked"' else ""#--> <!--#if int($have_ssl) == 0 then "disabled=\"disabled\"" else ""#--> />
<span class="desc">$T('srv-ssl')</span>
</div>
<div class="field-pair <!--#if int($have_ssl) == 0 then "disabled" else ""#-->">
<label class="config" for="ssl_type$cur">$T('srv-ssl_type')</label>
<!--#if int($have_ssl) == 1#-->
<select name="ssl_type" id="ssl_type$cur">
<option value="t1" <!--#if $servers[$server]['ssl_type'] == "t1" then 'selected="selected" class="selected"' else ""#--> >TLS1</option>
<option value="v23" <!--#if $servers[$server]['ssl_type'] == "v23" then 'selected="selected" class="selected"' else ""#--> >V23</option>
<option value="v2" <!--#if $servers[$server]['ssl_type'] == "v2" then 'selected="selected" class="selected"' else ""#--> >V2</option>
<option value="v3" <!--#if $servers[$server]['ssl_type'] == "v3" then 'selected="selected" class="selected"' else ""#--> >V3</option>
</select>
<!--#end if#-->
<span class="desc">$T('srv-explain-ssl_type')</span>
</div>
<div class="field-pair">
<label class="config" for="optional$cur">$T('srv-optional')</label>
<input type="checkbox" name="optional" id="optional$cur" value="1" <!--#if int($servers[$server]['optional']) != 0 then 'checked="checked"' else ""#--> />
<span class="desc">$T('srv-optional')</span>
</div>
<div class="field-pair alt">
<label class="config" for="send_group$cur">$T('srv-send_group')</label>
<input type="checkbox" name="send_group" id="send_group$cur" value="1" <!--#if int($servers[$server]['send_group']) != 0 then 'checked="checked"' else ""#--> />
<span class="desc">$T('srv-explain-send_group')</span>
</div>
<div class="field-pair">
<label class="config" for="categories$cur">$T('srv-categories')</label>
<select name="categories" id="categories$cur" multiple>
<!--#for $cat in $cats#-->
<option value="$cat" <!--#if $cat in $servers[$server]['categories'] then 'selected' else ""#-->>$cat</option>
<!--#end for#-->
</select>
<span class="desc">$T('srv-explain-categories')</span>
</div>
<div class="field-pair alt">
<label class="config" for="displayname$cur">$T('srv-displayname')</label>
<input type="text" name="displayname" id="displayname$cur" value="$servers[$server]['displayname']" size="30" />
</div>
<div class="field-pair">
<label class="config" for="notes$cur">$T('srv-notes')</label>
<textarea name="notes" id="notes$cur" rows="3" cols="50">$servers[$server]['notes']</textarea>
</div>
<div class="field-pair">
<button class="btn btn-default saveButton"><span class="glyphicon glyphicon-ok"></span> $T('button-saveChanges')</button>
<button class="btn btn-default testServer" type="button"><span class="glyphicon glyphicon-sort"></span> $T('button-testServer')</button>
<button class="btn btn-default delServer"><span class="glyphicon glyphicon-trash"></span> $T('button-delServer')</button>
</div>
</fieldset>
</div><!-- /col1 -->
<div class="col2" style="display:block;">
<!--#if 'amounts' in $servers[$server]#-->
<b>$T('srv-bandwidth'):</b><br/>
$T('total'): $(servers[$server]['amounts'][0])B<br/>
$T('today'): $(servers[$server]['amounts'][3])B<br/>
$T('thisWeek'): $(servers[$server]['amounts'][2])B<br/>
$T('thisMonth'): $(servers[$server]['amounts'][1])B
<!--#end if#-->
</div>
</div><!-- /section -->
</form>
<!--#end for#-->
</div><!-- /colmask -->
<script>
\$(document).ready(function(){
\$('.showserver').click(function () {
\$(this).parent().next().toggle();
\$(this).parent().next().next().toggle();
if (\$(this).attr("value") == "$T('showDetails')") {
\$(this).attr("value", "$T('hideDetails')");
} else {
\$(this).attr("value", "$T('showDetails')");
}
});
\$('#addServerButton').click(function(){
\$('#addServer').hide();
\$('#addServerContent').show();
});
\$('.testServer').click(function(event){
\$(this).attr("disabled", "disabled")
\$.ajax({
type: "POST",
url: "../../tapi",
data: "mode=config&amp;name=test_server&amp;" + \$(this).parents('form:first').serialize() + "&amp;apikey=" + \$('#apikey').val(),
success: function(msg){
alert(msg);
\$(event.target).removeAttr("disabled")
}
});
});
\$('.delServer').click(function(){
if( confirm("$T('Plush-confirm')") )
\$(this).parents('form:first').attr('action','delServer').submit();
return false;
});
\$('.clrServer').click(function(){
if( confirm("$T('Plush-confirm')") )
\$(this).parents('form:first').attr('action','clrServer').submit();
return false;
});
\$('.toggleServerCheckbox').click(function(){
var whichServer = \$(this).attr("rel");
\$.ajax({
type: "POST",
url: "toggleServer",
data: {server: whichServer, session: "$session" }
}).done(function() {
location.reload();
});
});
});
</script>
<!--#include $webdir + "/_inc_footer_uc.tmpl"#-->