diff options
author | Dirk Riestere | 2017-02-27 20:27:19 +0100 |
---|---|---|
committer | Dirk Riestere | 2017-02-27 20:27:19 +0100 |
commit | 9276d5471f9697e336b1da94f5fd2ff29fe74b2e (patch) | |
tree | 9425a2e1ecf902aa59b4807645601029518d64fb /modules-available/locationinfo/templates | |
parent | Bugfixes and Errorcode implementation (diff) | |
parent | Admin panel: New server GUI now using the backend types. (diff) | |
download | slx-admin-9276d5471f9697e336b1da94f5fd2ff29fe74b2e.tar.gz slx-admin-9276d5471f9697e336b1da94f5fd2ff29fe74b2e.tar.xz slx-admin-9276d5471f9697e336b1da94f5fd2ff29fe74b2e.zip |
Merge branch 'location-info-panel' of git.openslx.org:openslx-ng/slx-admin into location-info-panel
Diffstat (limited to 'modules-available/locationinfo/templates')
3 files changed, 44 insertions, 13 deletions
diff --git a/modules-available/locationinfo/templates/config.html b/modules-available/locationinfo/templates/config.html index 1cbcbe31..778b5c55 100644 --- a/modules-available/locationinfo/templates/config.html +++ b/modules-available/locationinfo/templates/config.html @@ -1,6 +1,4 @@ <div> - - <form method="post" action="?do=locationinfo" id="configForm"> <input type="hidden" name="token" value="{{token}}"> <input type="hidden" name="action" value="updateConfig"> diff --git a/modules-available/locationinfo/templates/credentials.html b/modules-available/locationinfo/templates/credentials.html new file mode 100644 index 00000000..6933db75 --- /dev/null +++ b/modules-available/locationinfo/templates/credentials.html @@ -0,0 +1,31 @@ +<div> + <form method="post" action="?do=locationinfo" id="credentialsForm"> + <input type="hidden" name="token" value="{{token}}"> + <input type="hidden" name="action" value="updateCredentials"> + <input type="hidden" name="id" value="{{id}}"> + <div id="div"></div> + <button type="submit" class="btn btn-primary">{{lang_save}}</button> + </form> +</div> +<script type="text/javascript"> + +// {{name}} name of auth {{type}} type of auth (string, int etc.) {{value}} value from the db +{{#credentials}} + if("{{type}}" == "string") { + $("#div").before('<label>{{name}}</label><br><input required type="text" name="{{name}}" value="{{value}}" form="credentialsForm"><br><br>'); + } else if("{{type}}" == "int") { + $("#div").before('<label>{{name}}</label><br><input required type="number" name="{{name}}" value="{{value}}" form="credentialsForm"><br><br>'); + } else if("{{type}}" == "bool") { + $("#div").before('<label>{{name}}</label><br><input required type="checkbox" name="{{name}}" value="{{value}}" form="credentialsForm"><br><br>'); + } else if("{{type}}" == "array") { + $("#div").before('<label>{{name}}</label><br>\ + <select name="{{name}}" form="credentialsForm">\ + {{#array}}\ + <option value="{{option}}" {{#active}}selected{{/active}}>{{option}}</option>\ + {{/array}}\ + </select>\ + <br><br>'); + } +{{/credentials}} + +</script> diff --git a/modules-available/locationinfo/templates/location-info.html b/modules-available/locationinfo/templates/location-info.html index 82b0ad15..f10831e3 100644 --- a/modules-available/locationinfo/templates/location-info.html +++ b/modules-available/locationinfo/templates/location-info.html @@ -11,8 +11,7 @@ <th width="90">{{lang_serverType}}</th> <th>{{lang_locationName}}</th> <th>{{lang_serverUrl}}</th> - <th>{{lang_serverUser}}</th> - <th>{{lang_serverPassword}}</th> + <th width="80" style="text-align: center;"></th> <th width="80" style="text-align: center;"></th> </tr> {{#serverlist}} @@ -26,7 +25,7 @@ <td id="type-{{id}}"> <select disabled id="input-type-{{id}}" name="type" value="{{type}}" onchange="servertype_changed(this.value, {{id}});"> {{#types}} - <option id="{{type}}" value="{{type}}" {{#active}}selected{{/active}} >{{type}} + <option id="{{type}}" value="{{type}}" {{#active}}selected{{/active}} >{{display}} {{/types}} </select> </td> @@ -36,11 +35,9 @@ <td id="url-{{id}}" style="padding:8px;"> <input readonly required id="input-url-{{id}}" name="url" type="text" value="{{url}}" style="padding:0;height:100%;width:100%;"></input> </td> - <td id="user-{{id}}" style="padding:8px;"> - <input readonly required id="input-user-{{id}}" name="user" type="text" value="{{user}}" style="padding:0;height:100%;width:100%;"></input> - </td> - <td id="password-{{id}}" style="padding:8px;"> - <input readonly required id="input-password-{{id}}" name="password" type="text" value="{{password}}" style="padding:0;height:100%;width:100%;"></input> + + <td align="center" id="credentials-{{id}}" onclick="event.cancelBubble = true;"> + <button class="btn btn-sm btn-primary" type="button" title="credentials" onclick="loadCredentialModal({{id}},'{{name}}');" id="credentials">{{lang_credentials}}</button> </td> <td align="center" id="btncell-{{id}}"> <button class="btn btn-sm btn-primary table-edit" title="{{lang_edit}}" onclick="editButtonClick({{id}});" id="edit">✎</button> @@ -134,6 +131,13 @@ function cbClick(cb, locID) { window.location.href = "?do=locationinfo&action=hide&id=" + locID + "&value=" + value; } +function loadCredentialModal(serverid, servername) { + $('#myModalHeader').text("[" + serverid + "] " + servername).css("font-weight","Bold"); + + $('#myModal').modal('show'); + $('#myModalBody').load("?do=locationinfo&action=credentials&id=" + serverid); +} + function loadTimeModal(locationId, locationName) { $('#myModalHeader').text("[" + locationId + "] " + locationName).css("font-weight","Bold"); @@ -268,12 +272,10 @@ function addNewServerRow() { $('#lastServerTableElement').before('<tr class=tablerow id="new">\ <td align="center"><input id="input-id-0" name="id" type="hidden" form="serverForm-0" value="0"></td>\ <td id="type-0"><select id="input-type-0" name="type" form="serverForm-0" onchange="servertype_changed(this.value, 0)">\ - {{#servertypelist}}<option value="{{type}}"> {{type}}{{/servertypelist}}\ + {{#servertypelist}}<option value="{{type}}"> {{display}}{{/servertypelist}}\ </select></td>\ <td id="name-0" style="padding:0;"><input required id="input-name-0" name="name" type="text" form="serverForm-0" value="" style="padding:0;height:100%;width:100%;"></input></td>\ <td id="url-0" style="padding:0;"><a><input required id="input-url-0" name="url" type="text" form="serverForm-0" value="" style="padding:0;height:100%;width:100%;"></input></a></td>\ - <td id="user-0" style="padding:0;"><input required id="input-user-0" name="user" type="text" form="serverForm-0" value="" style="padding:0;height:100%;width:100%;"></input></td>\ - <td id="password-0" style="padding:0;"><input required id="input-password-0" name="password" type="text" form="serverForm-0" value="" style="padding:0;height:100%;width:100%;"></input></td>\ <td align="center" id="btncell-new">\ <button class="btn btn-sm btn-success" title="{{lang_save}}" onclick="addNewServer();">✔</button> \ <button class="btn btn-sm btn-danger" title="{{lang_cancel}}" onclick="deleteNewServer();">✘</button>\ |