blob: 940bc55a369041ccf82547b92fd256b0a6351f67 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
<div class="panel panel-default">
<div class="panel-heading">{{lang_general}}</div>
<div class="panel-body">
<div class="list-group">
<div class="list-group-item">
<div class="row">
<div class="col-md-3">
<label>{{lang_entryName}}</label>
</div>
<div class="col-md-7">
<input required class="form-control" name="name" type="text" value="{{name}}" id="name-input"
form="form-{{currentbackend}}">
</div>
<div class="col-md-2">
<a class="btn btn-default" title="{{lang_nameTooltip}}">
<span class="glyphicon glyphicon-question-sign"></span>
</a>
</div>
</div>
</div>
<div class="list-group-item">
<div class="row">
<div class="col-md-3">
<label>{{lang_serverType}}</label>
</div>
<div class="col-md-7">
<select class="form-control" onchange="servertype_changed(this.value)">
{{#defaultBlank}}
<option value="" selected>{{lang_pleaseSelect}}</option>
{{/defaultBlank}}
{{#backendList}}
<option value="{{backendtype}}" {{#active}}selected{{/active}}>{{display}}</option>
{{/backendList}}
</select>
</div>
<div class="col-md-2">
<a class="btn btn-default" id="help-type" title="{{lang_typeTooltip}}">
<span class="glyphicon glyphicon-question-sign"></span>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
{{#backendList}}
<div id="formwrapper-{{backendtype}}" {{^active}}class="collapse"{{/active}}>
<form method="post" action="?do=locationinfo" id="form-{{backendtype}}">
<input type="hidden" name="token" value="{{token}}">
<input type="hidden" name="action" value="updateServerSettings">
<input type="hidden" name="id" value="{{id}}">
<input type="hidden" name="type" value="{{backendtype}}">
<input type="text" name="prevent_autofill" id="prevent_autofill" value="" style="position:absolute;top:-2000px" tabindex="-1">
<input type="password" name="password_fake" id="password_fake" value="" style="position:absolute;top:-2000px" tabindex="-1">
<div class="panel panel-default">
<div class="panel-heading">{{lang_credentials}}</div>
<div class="panel-body">
<div class="list-group">
{{#credentials}}
{{{credentialsHtml}}}
{{/credentials}}
</div>
</div>
</div>
</form>
</div>
{{/backendList}}
<script type="text/javascript">
var currentBackend = "{{currentbackend}}";
/**
* Show proper form after switching backend type
*
* @param {string} value The new currentBackend of the server which credentials needs to be loaded.
*/
function servertype_changed(value) {
if (value === currentBackend)
return;
var newBackend = value;
var fadeIn = function() {
$('#formwrapper-' + newBackend).fadeIn('fast');
$('#myModalSubmitButton, #name-input').attr('form', 'form-' + newBackend);
};
if (currentBackend) {
$('#formwrapper-' + currentBackend).fadeOut('fast', fadeIn);
} else {
fadeIn();
}
currentBackend = value;
}
$('a.btn[title]').tooltip();
$('#myModalSubmitButton').attr('form', 'form-' + currentBackend);
$('.settings-bs-switch').bootstrapSwitch({size:'small'});
</script>
|