blob: 90ac40b8edc17212ce6c71a77cfbb8feb4cb70e8 (
plain) (
tree)
|
|
<div>
<h1>{{lang_mainHeader}}</h1>
<br>
<h4>{{lang_serverTable}}</h4>
<div id="serverTable">
<table class="table table-condensed locations" style="margin-bottom:0;">
<tr>
<th width="1">{{lang_serverType}}</th>
<th>{{lang_locationName}}</th>
<th>{{lang_serverUrl}}</th>
<th width="1"></th>
<th width="1"></th>
</tr>
{{#serverlist}}
<form method="post" action="?do=locationinfo" id="serverForm-{{id}}">
<input type="hidden" name="token" value="{{token}}">
<input id="serverFormAction-{{id}}" type="hidden" name="action" value="updateServer">
<input type="submit" id="submit-serverForm-{{id}}" style="display:none;">
<tr class=tablerow>
<input id="input-id-{{id}}" name="id" type="hidden" value="{{id}}">
<td id="type-{{id}}" nowrap>{{display}}</td>
<td id="name-{{id}}" nowrap>{{name}}</td>
<td id="url-{{id}}" nowrap>{{url}}</td>
<td align="center" id="credentials-{{id}}" onclick="event.cancelBubble = true;"
style="white-space:nowrap;">
<button {{#auth}}class="btn btn-sm btn-success" {{/auth}}
{{^auth}}class="btn btn-sm btn-danger"{{/auth}} id="credentials-btn-{{id}}" type="button"
onclick="loadSettingsModal({{id}},'{{name}}');"><span style="margin-right: 5px;" class="glyphicon glyphicon-cog"></span>{{lang_locationSettings}}
</button>
<button class="btn btn-sm btn-primary table-refresh" id="refresh-btn-{{id}}" title="{{lang_refresh_title}}"
onclick="refreshButtonClick({{id}});"><span id="refresh-btn-animate-{{id}}" style="margin-right: 5px;" class="glyphicon glyphicon-refresh"></span>{{lang_refresh}}
</button>
</td>
<td align="center" id="btncell-{{id}}" style="white-space:nowrap;">
<button class="btn btn-sm btn-danger table-delete" type="button"
onclick="deleteButtonClick({{id}});"><span style="margin-right: 5px;" class="glyphicon glyphicon-remove"></span>{{lang_delete}}
</button>
</td>
</tr>
</form>
{{/serverlist}}
<form method="post" action="?do=locationinfo" id="serverForm-0">
<input type="hidden" name="token" value="{{token}}">
<input id="serverFormAction-0" type="hidden" name="action" value="updateServer">
<input type="submit" id="submit-serverForm-0" style="display:none;">
<tr id="lastServerTableElement"></tr>
</form>
</table>
<br>
<button class="btn btn-sm btn-success" id="addServerButton" onclick="addServer()"><span
title="{{lang_addServer_title}}"><span style="margin-right: 5px;" class="glyphicon glyphicon-plus"></span>{{lang_addServer}}</button>
<br><br><br>
</div>
<br>
<h4>{{lang_buildingTable}}</h4>
<table class="table table-condensed locations" style="margin-bottom:0">
<tr>
<th>{{lang_locationName}}</th>
<th width=10>{{lang_locationID}}</th>
<th width=80>{{lang_locationInUse}}</th>
<th width=50 title="{{lang_locationIsHidden_title}}">{{lang_locationIsHidden}}</th>
<th width=50>{{lang_openingTime}}</th>
<th width=50>{{lang_locationSettings}}</th>
</tr>
{{#list}}
<tr id="row{{locationid}}" class="tablerow">
<td>
<div style="display:inline-block;width:{{depth}}em"></div>
<a href="modules-available/locationinfo/frontend/doorsign.html?id={{locationid}}">{{locationname}}</a></td>
<td align="center">[{{locationid}}]</td>
<td align="center">{{#hasPcs}}{{pcState}} / {{total}}{{/hasPcs}}</td>
<td id={{locationid}} onclick="event.cancelBubble = true;" align="center"></td>
<script>
var cbh = document.getElementById('{{locationid}}');
var cb = document.createElement('input');
cb.type = 'checkbox';
cbh.appendChild(cb);
cb.id = 'cb' + {{locationid}};
cb.value = {{hidden}};
if ({{hidden}} == 1) {
cb.checked = true;
}
cb.addEventListener("click", function() { cbClick(this, {{locationid}}); });
</script>
<td onclick="event.cancelBubble = true;"><a class="btn btn-sm btn-default" role="button" style="width: 100%"
onclick="loadTimeModal({{locationid}}, '{{locationname}}');"><span style="margin-right: 5px;" class="glyphicon glyphicon-time"></span></a>
</td>
<td onclick="event.cancelBubble = true;"><a class="btn btn-sm btn-default" role="button" style="width: 100%;"
onclick="loadConfigModal({{locationid}}, '{{locationname}}');"><span style="margin-right: 5px;" class="glyphicon glyphicon-cog"></span></a>
</td>
</tr>
{{/list}}
</table>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header" id="myModalHeader"></div>
<div class="modal-body" id="myModalBody"></div>
<div class="modal-footer">
<button type="submit" id="myModalSubmitButton" class="btn btn-primary" form="">{{lang_save}}</button>
<a class="btn btn-primary" data-dismiss="modal">{{lang_close}}</a>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var lastPcSubTable = false;
/**
* Sets the checkbox value and calls the php hide action.
*
* @param cb The checkbox which was clicked.
* @param locID the locationID of the checkbox.
*/
function cbClick(cb, locID) {
var value;
if (cb.checked == true) {
value = 1;
} else {
value = 0;
}
window.location.href = "?do=locationinfo&action=hide&id=" + locID + "&value=" + value;
}
/**
* Loads the settings modal of a server.
*
* @param serverid The id of the server.
* @param servername The name of the server.
*/
function loadSettingsModal(serverid, servername) {
$('#myModalHeader').text("{{lang_locationSettings}}").css("font-weight", "Bold");
$('#myModalSubmitButton').attr("Form", "settingsForm");
$('#myModal').modal('show');
$('#myModalBody').load("?do=locationinfo&action=serverSettings&id=" + serverid);
}
/**
* Load a opening time modal of a location.
*
* @param locationId The id of the location.
* @param locationName The name of the location.
*/
function loadTimeModal(locationId, locationName) {
$('#myModalHeader').text("[" + locationId + "] " + locationName).css("font-weight", "Bold");
$('#myModal').modal('show');
$('#myModalBody').load("?do=locationinfo&action=timetable&id=" + locationId);
}
/**
* Loads the config modal of a location.
*
* @param locationId The id of the location
* @param locationName the name of the location
*/
function loadConfigModal(locationId, locationName) {
$('#myModalHeader').text("[" + locationId + "] " + locationName).css("font-weight", "Bold");
$('#myModalSubmitButton').attr("Form", "configForm");
$('#myModal').modal('show');
$('#myModalBody').load("?do=locationinfo&action=config&id=" + locationId);
}
// ########### Server Table ###########
var preEditName;
var preEditUrl;
var preEditUser;
var preEditPassword;
var preEditType;
/**
* Deletes a server.
*
* @param id The serverid
*/
function deleteButtonClick(id) {
var del = confirm("{{lang_deleteConfirmation}}");
if (del == true) {
$('#serverFormAction-' + id).val("deleteServer");
$('#serverForm-' + id).submit();
}
}
/**
* Calls the checkConnection php function to check a server connection.
*
* @param id The id of the server.
*/
function refreshButtonClick(id) {
$('#refresh-btn-animate-' + id).addClass('glyphicon-refresh-animate');
$('#serverFormAction-' + id).val("checkConnection");
$('#submit-serverForm-' + id).trigger("click");
}
/**
* Loads a new / empty server settings modal.
*/
function addServer() {
loadSettingsModal(0, '');
}
</script>
|