Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!--#set global $pane="Servers"#-->
- <!--#set global $help_uri="configure-servers-1-0"#-->
- <!--#include $webdir + "/_inc_header_uc.tmpl"#-->
- <div class="colmask">
- <form action="addServer" method="post" autocomplete="off" 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') <a href="$helpuri$help_uri" target="_blank"><span class="glyphicon glyphicon-question-sign"></span></a></h3>
- </div><!-- /col2 -->
- <div class="col1">
- <fieldset>
- <div class="field-pair">
- <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" />
- </div>
- <div class="field-pair">
- <label class="config" for="port">$T('srv-port')</label>
- <input type="number" 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" />
- </div>
- <div class="field-pair">
- <label class="config" for="password">$T('srv-password')</label>
- <input type="text" name="password" id="password" />
- </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">
- <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 <!--#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="">$T('Default')</option>
- <!--#if 't12' in $ssl_protocols#-->
- <option value="t12">TLS v1.2</option>
- <!--#end if#-->
- <!--#if 't11' in $ssl_protocols#-->
- <option value="t11">TLS v1.1</option>
- <!--#end if#-->
- <!--#if 't1' in $ssl_protocols#-->
- <option value="t1">TLS v1</option>
- <!--#end if#-->
- <!--#if 'v3' in $ssl_protocols#-->
- <option value="v3">SSL v3</option>
- <!--#end if#-->
- <!--#if 'v2' in $ssl_protocols#-->
- <option value="v2">SSL v2</option>
- <!--#end if#-->
- </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">
- <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#-->>
- <!--#if $cat == "Default" then $T('Default') else $cat#-->
- </option>
- <!--#end for#-->
- </select>
- <span class="desc">$T('srv-explain-categories')</span>
- </div>
- <div class="field-pair">
- <label class="config" for="displayname">$T('srv-displayname')</label>
- <input type="text" name="displayname" id="displayname" />
- </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 $cur = 0#-->
- <!--#for $server in $servers#-->
- <!--#set $cur = $cur + 1#-->
- <form action="saveServer" method="post" class="fullform" autocomplete="off" novalidate>
- <input type="hidden" name="session" value="$session" />
- <input type="hidden" name="server" value="$server['name']" />
- <div class="section <!--#if int($server['enable']) == 0 then 'server-disabled' else ""#-->">
- <div class="col2 <!--#if int($server['enable']) == 0 then 'server-disabled' else ""#-->">
- <h3>$server['displayname'] <a href="$helpuri$help_uri" target="_blank"><span class="glyphicon glyphicon-question-sign"></span></a></h3>
- <!--#if int($server['enable']) != 0#-->
- <span class="label label-primary" data-priority="$server['priority']#-->">$server['priority']</span>
- <span class="label label-primary" data-priority="$server['priority']#-->">$T('srv-priority'):</span>
- <!--#end if#-->
- <table><tr>
- <td><input type="checkbox" class="toggleServerCheckbox" id="enable_$cur" name="$server['name']" value="1" <!--#if int($server['enable']) != 0 then 'checked="checked"' else ""#--> /></td>
- <td><label for="enable_$cur">$T('enabled')</label></td>
- </tr></table>
- <button type="button" class="btn btn-default showserver"><span class="glyphicon glyphicon-pencil"></span> $T('showDetails')</button>
- </div><!-- /col2 -->
- <div class="col1" style="display:none;">
- <input type="hidden" name="enable" id="enable$cur" value="$int($server['enable'])" />
- <fieldset>
- <div class="field-pair">
- <label class="config" for="host$cur">$T('srv-host')</label>
- <input type="text" name="host" id="host$cur" value="$server['host']" />
- </div>
- <div class="field-pair">
- <label class="config" for="port$cur">$T('srv-port')</label>
- <input type="number" name="port" id="port$cur" value="$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="$server['username']" />
- </div>
- <div class="field-pair">
- <label class="config" for="password$cur">$T('srv-password')</label>
- <input type="text" name="password" id="password$cur" value="$server['password']" />
- </div>
- <div class="field-pair">
- <label class="config" for="connections$cur">$T('srv-connections')</label>
- <input type="number" name="connections" id="connections$cur" value="$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="$server['priority']" min="0" max="100" /> <i>$T('explain-svrprio')</i>
- </div>
- <div class="field-pair">
- <label class="config" for="retention$cur">$T('srv-retention')</label>
- <input type="number" name="retention" id="retention$cur" value="$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="$server['timeout']" min="30" /> <i>$T('seconds')</i>
- </div>
- <div class="field-pair <!--#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($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="" <!--#if $server['ssl_type'] == "" then 'selected="selected"' else ""#--> >$T('Default')</option>
- <!--#if 't12' in $ssl_protocols#-->
- <option value="t12" <!--#if $server['ssl_type'] == "t12" then 'selected="selected"' else ""#--> >TLS v1.2</option>
- <!--#end if#-->
- <!--#if 't11' in $ssl_protocols#-->
- <option value="t11" <!--#if $server['ssl_type'] == "t11" then 'selected="selected"' else ""#--> >TLS v1.1</option>
- <!--#end if#-->
- <!--#if 't1' in $ssl_protocols#-->
- <option value="t1" <!--#if $server['ssl_type'] == "t1" then 'selected="selected"' else ""#--> >TLS v1</option>
- <!--#end if#-->
- <!--#if 'v3' in $ssl_protocols#-->
- <option value="v3" <!--#if $server['ssl_type'] == "v3" then 'selected="selected"' else ""#--> >SSL v3</option>
- <!--#end if#-->
- <!--#if 'v2' in $ssl_protocols#-->
- <option value="v2" <!--#if $server['ssl_type'] == "v2" then 'selected="selected"' else ""#--> >SSL v2</option>
- <!--#end if#-->
- </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($server['optional']) != 0 then 'checked="checked"' else ""#--> />
- <span class="desc">$T('srv-optional')</span>
- </div>
- <div class="field-pair">
- <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($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 $server['categories'] then 'selected' else ""#-->>
- <!--#if $cat == "Default" then $T('Default') else $cat#-->
- </option>
- <!--#end for#-->
- </select>
- <span class="desc">$T('srv-explain-categories')</span>
- </div>
- <div class="field-pair">
- <label class="config" for="displayname$cur">$T('srv-displayname')</label>
- <input type="text" name="displayname" id="displayname$cur" value="$server['displayname']" />
- </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">$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 clrServer" type="button"><span class="glyphicon glyphicon-remove"></span> $T('button-clrServer')</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 $server#-->
- <b>$T('srv-bandwidth'):</b><br/>
- $T('total'): $(server['amounts'][0])B<br/>
- $T('today'): $(server['amounts'][3])B<br/>
- $T('thisWeek'): $(server['amounts'][2])B<br/>
- $T('thisMonth'): $(server['amounts'][1])B
- <!--#end if#-->
- </div>
- </div><!-- /section -->
- </form>
- <!--#end for#-->
- </div><!-- /colmask -->
- <script type="text/javascript">
- \$(document).ready(function(){
- // Exception when change of priority, reload
- \$('input[name="priority"], input[name="displayname"]').on('change', function() {
- \$('.fullform').submit(function() {
- // Skip the fancy stuff, just submit
- this.submit()
- })
- })
- /**
- Color the priority labels
- **/
- // They are already sorted
- var colorList = ["#cc3333", "#cc33a6", "#7f33cc", "#3366cc", "#59cc33"];
- var lastColor = colorList[0];
- var lastPrio = '-1';
- var theColor = '';
- \$('[data-priority]').each(function() {
- // New one?
- if(\$(this).data('priority') != lastPrio) {
- // Update
- theColor = colorList.pop() || lastColor;
- lastPrio = \$(this).data('priority');
- }
- \$(this).css('background-color', theColor)
- })
- /**
- Click events
- **/
- \$('.showserver').click(function () {
- if(\$(this).parent().hasClass('server-disabled')) {
- \$(this).parent().parent().toggleClass('server-disabled')
- }
- \$(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&name=test_server&" + \$(this).parents('form:first').serialize(),
- 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();
- // Let us leave!
- formWasSubmitted = true;
- formHasChanged = false;
- setTimeout(function() { location.reload(); }, 100)
- }
- return false;
- });
- \$('.clrServer').click(function(){
- if( confirm("$T('Plush-confirm')") ) {
- \$(this).parents('form:first').attr('action','clrServer').submit();
- // Let us leave!
- formWasSubmitted = true;
- formHasChanged = false;
- setTimeout(function() { location.reload(); }, 100)
- }
- return false;
- });
- \$('.toggleServerCheckbox').click(function(){
- var whichServer = \$(this).attr("name");
- \$.ajax({
- type: "POST",
- url: "toggleServer",
- data: {server: whichServer, session: "$session" }
- }).done(function() {
- // Let us leave!
- formWasSubmitted = true;
- formHasChanged = false;
- setTimeout(function() { location.reload(); }, 100)
- });
- });
- });
- </script>
- <!--#include $webdir + "/_inc_footer_uc.tmpl"#-->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement