diff options
author | Jannik Schönartz | 2017-03-15 12:54:29 +0100 |
---|---|---|
committer | Jannik Schönartz | 2017-03-15 12:54:29 +0100 |
commit | e92e4a11cd2771338db823e8aadb5a9c74957808 (patch) | |
tree | 4010849d0a02961e903843733a54013259624459 /modules-available/locationinfo/templates | |
parent | frontend: fixed loading bar in mode 4, mode 4 now supports up to 4 rooms, fon... (diff) | |
download | slx-admin-e92e4a11cd2771338db823e8aadb5a9c74957808.tar.gz slx-admin-e92e4a11cd2771338db823e8aadb5a9c74957808.tar.xz slx-admin-e92e4a11cd2771338db823e8aadb5a9c74957808.zip |
Locationinfo: Reformat code.
Diffstat (limited to 'modules-available/locationinfo/templates')
4 files changed, 607 insertions, 579 deletions
diff --git a/modules-available/locationinfo/templates/config.html b/modules-available/locationinfo/templates/config.html index 5e221756..79d6f085 100644 --- a/modules-available/locationinfo/templates/config.html +++ b/modules-available/locationinfo/templates/config.html @@ -1,192 +1,199 @@ <div> - <form method="post" action="?do=locationinfo" id="configForm"> - <input type="hidden" name="token" value="{{token}}"> - <input type="hidden" name="action" value="updateConfig"> - <input type="hidden" name="id" value="{{id}}"> - - - <div style="float: left;"> - <Label>{{lang_server}}</Label><br> - <select name="serverid"> - {{#serverlist}} - <option id="serverOption-{{sid}}" value="{{sid}}">{{sname}}</option> - {{/serverlist}} - </select> - </div> - - <div style="float: left; margin-left: 15px;"> - <Label>{{lang_serverRoomId}}</Label><br> - <input name="serverroomid" id="serverroomid" value="{{serverroomid}}" style="width: 250px; text-align: center;"></input> - </div> - - - <br><br><br><br> - - <div style="float: left;"> - <Label>{{lang_language}}</Label><br> - <select name="language"> - <option value="en" id="en">{{lang_languageEn}}</option> - <option value="de" id="de">{{lang_languageDe}}</option> - <option value="pt" id="pt">{{lang_languagePt}}</option> - </select> - </div> - <div style="float: left; margin-left: 15px;"> - <Label>{{lang_mode}}</Label><br> - <select name="mode" onchange="vertical_cb(this.value);"> - <option value="1" id="mode1">{{lang_mode1}}</option> - <option value="2" id="mode2">{{lang_mode2}}</option> - <option value="3" id="mode3">{{lang_mode3}}</option> - <option value="4" id="mode4">{{lang_mode4}}</option> - </select> - </div> - <div style="float: left; margin-left: 15px;"> - <input name="vertical" id="cb_vertical" type="checkbox"/> {{lang_vertical}}<br> - <input name="eco" id="cb_eco" type="checkbox"/> {{lang_ecoMode}}<br> - <input name="autoscale" id="cb_autoScale" type="checkbox"/> {{lang_autoScale}} - </div> - - <div style="float: left; margin-left: 15px;"> - <Label data-toggle="tooltip" title="{{lang_daysToShowTooltip}}">{{lang_daysToShow}}</Label><br> - <select name="daystoshow"> - <option value="1" id="day1">1</option> - <option value="2" id="day2">2</option> - <option value="3" id="day3">3</option> - <option value="4" id="day4">4</option> - <option value="5" id="day5">5</option> - <option value="6" id="day6">6</option> - <option value="7" id="day7">7</option> - </select> - </div> - - <div style="float: left; margin-left: 15px;"> - <Label>{{lang_rotation}}</Label><br> - <select name="rotation"> - <option value="0" id="rotation0">{{lang_rotation0}}</option> - <option value="3" id="rotation3">{{lang_rotation3}}</option> - <option value="2" id="rotation2">{{lang_rotation2}}</option> - <option value="1" id="rotation1">{{lang_rotation1}}</option> - </select> - </div> - - <br><br><br><br> - - <Label data-toggle="tooltip" title="{{lang_scaleTooltip}}">{{lang_scale}}</Label><br> - <span id="scale">50 %</span><input name="scale" id="sl_scale" type="range" step="1" min="10" max="90" value="50" style="width: 300px;" oninput="showScaleValue(this.value)"/> - - <br><br> - - <Label data-toggle="tooltip" title="{{lang_switchTimeTooltip}}">{{lang_switchTime}}</Label><br> - <span id="switch">20 {{lang_sec}}</span><input name="switchtime" id="sl_switch" type="range" step="1" min="1" max="120" value="20" style="width: 300px;" oninput="showSwitchValue(this.value)"/> - - <br><br> - - <div> - <div style="float: left;"> - <Label data-toggle="tooltip" title="{{lang_calupdateTooltip}}">{{lang_calupdate}}</Label><br> - <input id="updateCalendar" name="calupdate" type="number" style="width: 50px; text-align: center;" min="0" max="1440"/> {{lang_min}} - </div> - <div style="float: left; margin-left: 15px;"> - <Label data-toggle="tooltip" title="{{lang_roomupdateTooltip}}">{{lang_roomupdate}}</Label><br> - <input id="updateRoom" name="roomupdate" type="number" style="width: 50px; text-align: center;" min="0" max="86400"/> {{lang_sec}} - </div> - <div style="float: left; margin-left: 15px;"> - <Label data-toggle="tooltip" title="{{lang_configupdateTooltip}}">{{lang_configupdate}}</Label><br> - <input id="updateConfig" name="configupdate" type="number" style="width: 50px; text-align: center;" min="0" max="1440"/> {{lang_min}} - </div> - </div> - - <br><br><br><br> - - <button type="submit" class="btn btn-primary">{{lang_save}}</button> - - </form> + <form method="post" action="?do=locationinfo" id="configForm"> + <input type="hidden" name="token" value="{{token}}"> + <input type="hidden" name="action" value="updateConfig"> + <input type="hidden" name="id" value="{{id}}"> + + + <div style="float: left;"> + <Label>{{lang_server}}</Label><br> + <select name="serverid"> + {{#serverlist}} + <option id="serverOption-{{sid}}" value="{{sid}}">{{sname}}</option> + {{/serverlist}} + </select> + </div> + + <div style="float: left; margin-left: 15px;"> + <Label>{{lang_serverRoomId}}</Label><br> + <input name="serverroomid" id="serverroomid" value="{{serverroomid}}" + style="width: 250px; text-align: center;"></input> + </div> + + + <br><br><br><br> + + <div style="float: left;"> + <Label>{{lang_language}}</Label><br> + <select name="language"> + <option value="en" id="en">{{lang_languageEn}}</option> + <option value="de" id="de">{{lang_languageDe}}</option> + <option value="pt" id="pt">{{lang_languagePt}}</option> + </select> + </div> + <div style="float: left; margin-left: 15px;"> + <Label>{{lang_mode}}</Label><br> + <select name="mode" onchange="vertical_cb(this.value);"> + <option value="1" id="mode1">{{lang_mode1}}</option> + <option value="2" id="mode2">{{lang_mode2}}</option> + <option value="3" id="mode3">{{lang_mode3}}</option> + <option value="4" id="mode4">{{lang_mode4}}</option> + </select> + </div> + <div style="float: left; margin-left: 15px;"> + <input name="vertical" id="cb_vertical" type="checkbox"/> {{lang_vertical}}<br> + <input name="eco" id="cb_eco" type="checkbox"/> {{lang_ecoMode}}<br> + <input name="autoscale" id="cb_autoScale" type="checkbox"/> {{lang_autoScale}} + </div> + + <div style="float: left; margin-left: 15px;"> + <Label data-toggle="tooltip" title="{{lang_daysToShowTooltip}}">{{lang_daysToShow}}</Label><br> + <select name="daystoshow"> + <option value="1" id="day1">1</option> + <option value="2" id="day2">2</option> + <option value="3" id="day3">3</option> + <option value="4" id="day4">4</option> + <option value="5" id="day5">5</option> + <option value="6" id="day6">6</option> + <option value="7" id="day7">7</option> + </select> + </div> + + <div style="float: left; margin-left: 15px;"> + <Label>{{lang_rotation}}</Label><br> + <select name="rotation"> + <option value="0" id="rotation0">{{lang_rotation0}}</option> + <option value="3" id="rotation3">{{lang_rotation3}}</option> + <option value="2" id="rotation2">{{lang_rotation2}}</option> + <option value="1" id="rotation1">{{lang_rotation1}}</option> + </select> + </div> + + <br><br><br><br> + + <Label data-toggle="tooltip" title="{{lang_scaleTooltip}}">{{lang_scale}}</Label><br> + <span id="scale">50 %</span><input name="scale" id="sl_scale" type="range" step="1" min="10" max="90" value="50" + style="width: 300px;" oninput="showScaleValue(this.value)"/> + + <br><br> + + <Label data-toggle="tooltip" title="{{lang_switchTimeTooltip}}">{{lang_switchTime}}</Label><br> + <span id="switch">20 {{lang_sec}}</span><input name="switchtime" id="sl_switch" type="range" step="1" min="1" + max="120" value="20" style="width: 300px;" + oninput="showSwitchValue(this.value)"/> + + <br><br> + + <div> + <div style="float: left;"> + <Label data-toggle="tooltip" title="{{lang_calupdateTooltip}}">{{lang_calupdate}}</Label><br> + <input id="updateCalendar" name="calupdate" type="number" style="width: 50px; text-align: center;" min="0" + max="1440"/> {{lang_min}} + </div> + <div style="float: left; margin-left: 15px;"> + <Label data-toggle="tooltip" title="{{lang_roomupdateTooltip}}">{{lang_roomupdate}}</Label><br> + <input id="updateRoom" name="roomupdate" type="number" style="width: 50px; text-align: center;" min="0" + max="86400"/> {{lang_sec}} + </div> + <div style="float: left; margin-left: 15px;"> + <Label data-toggle="tooltip" title="{{lang_configupdateTooltip}}">{{lang_configupdate}}</Label><br> + <input id="updateConfig" name="configupdate" type="number" style="width: 50px; text-align: center;" min="0" + max="1440"/> {{lang_min}} + </div> + </div> + + <br><br><br><br> + + <button type="submit" class="btn btn-primary">{{lang_save}}</button> + + </form> </div> <script type="text/javascript"> -loadValues(); - -function loadValues() { - $("#{{language}}").attr("selected","selected"); - - $('#serverOption-{{serverid}}').attr("selected", "selected"); - - var mode = $("#{{mode}}"); - if (!mode.length) { - mode = $("#mode1"); - } - mode.attr("selected","selected"); - vertical_cb(mode.val()); - if('{{vertical}}' == true){ - $("#cb_vertical").prop("checked", true); - } - if('{{eco}}' == true){ - $("#cb_eco").prop("checked", true); - } - - if('{{scaledaysauto}}' == true){ - $("#cb_autoScale").prop("checked", true); - } - - var day = $("#{{daystoshow}}"); - if (!day.length) { - day = $("#day7"); - } - day.attr("selected","selected"); - - var rotation = $("#{{rotation}}"); - if (!rotation.length) { - rotation = $("#rotation0"); - } - rotation.attr("selected","selected"); - - var scaleVal = '{{scale}}'; - if (scaleVal == '') { - scaleVal = 50; - } - $('#sl_scale').attr('value', '{{scale}}'); - showScaleValue(scaleVal); - - var switchVal = '{{switchtime}}'; - if (switchVal == '') { - switchVal = 20; - } - $("#sl_switch").attr('value', switchVal); - showSwitchValue(switchVal); - - var calupdate = '{{calupdate}}'; - if (!calupdate.length) { - calupdate = 30; - } - $("#updateCalendar").attr("value", calupdate); - - var roomupdate = '{{roomupdate}}'; - if (!roomupdate.length) { - roomupdate = 30; - } - $("#updateRoom").attr("value", roomupdate); - - var configupdate = '{{configupdate}}'; - if (!configupdate.length) { - configupdate = 180; - } - $("#updateConfig").attr("value", configupdate); -} - -function showScaleValue(newValue) { - $("#scale").text(newValue + " %"); -} - -function showSwitchValue(newValue) { - $("#switch").text(newValue + " " + '{{lang_sec}}'); -} - -function vertical_cb(value) { - var cb = $("#cb_vertical"); - if (value == 1) { - cb.prop("disabled", false); - } else { - cb.prop("disabled", true); - cb.prop("checked", false); - } -} + loadValues(); + + function loadValues() { + $("#{{language}}").attr("selected", "selected"); + + $('#serverOption-{{serverid}}').attr("selected", "selected"); + + var mode = $("#{{mode}}"); + if (!mode.length) { + mode = $("#mode1"); + } + mode.attr("selected", "selected"); + vertical_cb(mode.val()); + if ('{{vertical}}' == true) { + $("#cb_vertical").prop("checked", true); + } + if ('{{eco}}' == true) { + $("#cb_eco").prop("checked", true); + } + + if ('{{scaledaysauto}}' == true) { + $("#cb_autoScale").prop("checked", true); + } + + var day = $("#{{daystoshow}}"); + if (!day.length) { + day = $("#day7"); + } + day.attr("selected", "selected"); + + var rotation = $("#{{rotation}}"); + if (!rotation.length) { + rotation = $("#rotation0"); + } + rotation.attr("selected", "selected"); + + var scaleVal = '{{scale}}'; + if (scaleVal == '') { + scaleVal = 50; + } + $('#sl_scale').attr('value', '{{scale}}'); + showScaleValue(scaleVal); + + var switchVal = '{{switchtime}}'; + if (switchVal == '') { + switchVal = 20; + } + $("#sl_switch").attr('value', switchVal); + showSwitchValue(switchVal); + + var calupdate = '{{calupdate}}'; + if (!calupdate.length) { + calupdate = 30; + } + $("#updateCalendar").attr("value", calupdate); + + var roomupdate = '{{roomupdate}}'; + if (!roomupdate.length) { + roomupdate = 30; + } + $("#updateRoom").attr("value", roomupdate); + + var configupdate = '{{configupdate}}'; + if (!configupdate.length) { + configupdate = 180; + } + $("#updateConfig").attr("value", configupdate); + } + + function showScaleValue(newValue) { + $("#scale").text(newValue + " %"); + } + + function showSwitchValue(newValue) { + $("#switch").text(newValue + " " + '{{lang_sec}}'); + } + + function vertical_cb(value) { + var cb = $("#cb_vertical"); + if (value == 1) { + cb.prop("disabled", false); + } else { + cb.prop("disabled", true); + cb.prop("checked", false); + } + } </script> diff --git a/modules-available/locationinfo/templates/credentials.html b/modules-available/locationinfo/templates/credentials.html index 70e96982..f8c04bcb 100644 --- a/modules-available/locationinfo/templates/credentials.html +++ b/modules-available/locationinfo/templates/credentials.html @@ -1,31 +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> + <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 type="checkbox" name="{{name}}" value="{{value}}" form="credentialsForm"><br><br>'); - } else if("{{type}}" == "array") { - $("#div").before('<label>{{name}}</label><br>\ + // {{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 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}} + } + {{/credentials}} </script> diff --git a/modules-available/locationinfo/templates/location-info.html b/modules-available/locationinfo/templates/location-info.html index 3e832284..ef8de412 100644 --- a/modules-available/locationinfo/templates/location-info.html +++ b/modules-available/locationinfo/templates/location-info.html @@ -1,52 +1,65 @@ <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 title="{{lang_serverID}}">{{lang_sID}}</th> - <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;"> + <h1>{{lang_mainHeader}}</h1> + + <br> + <h4>{{lang_serverTable}}</h4> + <div id="serverTable"> + + <table class="table table-condensed locations" style="margin-bottom:0;"> + <tr> + <th title="{{lang_serverID}}">{{lang_sID}}</th> + <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> <td align="center"><input id="input-id-{{id}}" name="id" type="hidden" value="{{id}}">{{id}}</td> <td id="type-{{id}}"> - <select disabled id="input-type-{{id}}" name="type" value="{{type}}" onchange="servertype_changed(this.value, {{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}} >{{display}} + <option id="{{type}}" value="{{type}}" {{#active}}selected{{/active}}>{{display}} {{/types}} </select> </td> <td id="name-{{id}}" style="padding:8px;"> - <input readonly required id="input-name-{{id}}" name="name" type="text" value="{{name}}" style="padding:0;height:100%;width:100%;"></input> + <input readonly required id="input-name-{{id}}" name="name" type="text" value="{{name}}" + style="padding:0;height:100%;width:100%;"></input> </td> <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> + <input readonly required id="input-url-{{id}}" name="url" type="text" value="{{url}}" + style="padding:0;height:100%;width:100%;"></input> </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" title="credentials" onclick="loadCredentialModal({{id}},'{{name}}');">{{lang_credentials}}</button> - <button class="btn btn-sm btn-primary table-refresh" id="refresh-btn-{{id}}" title="refresh" onclick="refreshButtonClick({{id}});">↺</button> + <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" + title="credentials" onclick="loadCredentialModal({{id}},'{{name}}');">{{lang_credentials}} + </button> + <button class="btn btn-sm btn-primary table-refresh" id="refresh-btn-{{id}}" title="refresh" + onclick="refreshButtonClick({{id}});">↺ + </button> </td> <td align="center" id="btncell-{{id}}" style="white-space:nowrap;"> - <button class="btn btn-sm btn-primary table-edit" title="{{lang_edit}}" onclick="editButtonClick({{id}});" id="edit">✎</button> - <button class="btn btn-sm btn-danger table-delete" type="button" title="{{lang_delete}}" onclick="deleteButtonClick({{id}});">✘</button> + <button class="btn btn-sm btn-primary table-edit" title="{{lang_edit}}" + onclick="editButtonClick({{id}});" id="edit">✎ + </button> + <button class="btn btn-sm btn-danger table-delete" type="button" title="{{lang_delete}}" + onclick="deleteButtonClick({{id}});">✘ + </button> </td> </tr> </form> -{{/serverlist}} + {{/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"> @@ -56,38 +69,41 @@ </table> <br> - <button class="btn btn-success btn-sm" id="addServerButton" onclick="addNewServerRow()"><span class="glyphicon glyphicon-plus-sign"> {{lang_addServer}}</span></button> + <button class="btn btn-success btn-sm" id="addServerButton" onclick="addNewServerRow()"><span + class="glyphicon glyphicon-plus-sign"> {{lang_addServer}}</span></button> <br><br><br> -</div> -<br> + </div> + <br> -<h4>{{lang_buildingTable}}</h4> -<table class="table table-condensed locations" style="margin-bottom:0"> + <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>{{lang_locationIsHidden}}</th> - <th width=50>{{lang_openingTime}}</th> - <th width=50>{{lang_locationSettings}}</th> - </tr> + <tr> + <th>{{lang_locationName}}</th> + <th width=10>{{lang_locationID}}</th> + <th width=80>{{lang_locationInUse}}</th> + <th width=50>{{lang_locationIsHidden}}</th> + <th width=50>{{lang_openingTime}}</th> + <th width=50>{{lang_locationSettings}}</th> + </tr> -{{#list}} - <tr id="row{{locationid}}" class="tablerow"> + {{#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> + <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'); + <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.type = 'checkbox'; + cbh.appendChild(cb); cb.id = 'cb' + {{locationid}}; cb.value = {{hidden}}; @@ -95,183 +111,187 @@ 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" onclick="loadTimeModal({{locationid}}, '{{locationname}}');">{{lang_openingTime}}</a></td> - <td onclick="event.cancelBubble = true;"><a class="btn btn-sm btn-default" role="button" onclick="loadConfigModal({{locationid}}, '{{locationname}}');">{{lang_locationSettings}}</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"> - <a class="btn btn-primary" data-dismiss="modal">{{lang_close}}</a> - </div> - </div> - - </div> -</div> + </script> + <td onclick="event.cancelBubble = true;"><a class="btn btn-sm btn-default" role="button" + onclick="loadTimeModal({{locationid}}, '{{locationname}}');">{{lang_openingTime}}</a> + </td> + <td onclick="event.cancelBubble = true;"><a class="btn btn-sm btn-default" role="button" + onclick="loadConfigModal({{locationid}}, '{{locationname}}');">{{lang_locationSettings}}</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"> + <a class="btn btn-primary" data-dismiss="modal">{{lang_close}}</a> + </div> + </div> + + </div> + </div> +</div> <script type="text/javascript"> -var lastPcSubTable = false; + var lastPcSubTable = false; + + 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; + } + + 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"); -function cbClick(cb, locID) { - var value; + $('#myModal').modal('show'); + $('#myModalBody').load("?do=locationinfo&action=timetable&id=" + locationId); + } + + function loadConfigModal(locationId, locationName) { + $('#myModalHeader').text("[" + locationId + "] " + locationName).css("font-weight", "Bold"); - if (cb.checked == true) { - value = 1; - } else { - value = 0; + $('#myModal').modal('show'); + $('#myModalBody').load("?do=locationinfo&action=config&id=" + locationId); } - 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"); - - $('#myModal').modal('show'); - $('#myModalBody').load("?do=locationinfo&action=timetable&id=" + locationId); -} - -function loadConfigModal(locationId, locationName) { - $('#myModalHeader').text("[" + locationId + "] " + locationName).css("font-weight","Bold"); - - $('#myModal').modal('show'); - $('#myModalBody').load("?do=locationinfo&action=config&id=" + locationId); -} - -// ########### Server Table ########### -var preEditName; -var preEditUrl; -var preEditUser; -var preEditPassword; -var preEditType; - -function deleteButtonClick(id) { - var del = confirm("{{lang_deleteConfirmation}}"); - if (del == true) { - $('#serverFormAction-' + id).val("deleteServer"); - $('#serverForm-' + id).submit(); + + // ########### Server Table ########### + var preEditName; + var preEditUrl; + var preEditUser; + var preEditPassword; + var preEditType; + + function deleteButtonClick(id) { + var del = confirm("{{lang_deleteConfirmation}}"); + if (del == true) { + $('#serverFormAction-' + id).val("deleteServer"); + $('#serverForm-' + id).submit(); + } } -}; - -function servertype_changed(value, id) { - if (value == "Frontend") { - $('#input-user-' + id).removeAttr('required'); - $('#input-password-' + id).removeAttr('required'); - } else { - $('#input-user-' + id).attr('required'); - $('#input-password-' + id).attr('required'); + + function servertype_changed(value, id) { + if (value == "Frontend") { + $('#input-user-' + id).removeAttr('required'); + $('#input-password-' + id).removeAttr('required'); + } else { + $('#input-user-' + id).attr('required'); + $('#input-password-' + id).attr('required'); + } } -}; - -function editButtonClick(id) { - var name = $('#input-name-' + id); - var url = $('#input-url-' + id); - var user = $('#input-user-' + id); - var password = $('#input-password-' + id); - var type = $('#input-type-' + id); - - name.attr('readonly', false); - url.attr('readonly', false); - user.attr('readonly', false); - password.attr('readonly', false); - type.attr('disabled', false); - - name.css("color", "#000"); - url.css("color", "#000"); - user.css("color", "#000"); - password.css("color", "#000"); - type.css("color", "#000"); - - preEditName = name.val(); - preEditUrl = url.val(); - preEditUser = user.val(); - preEditPassword = password.val(); - preEditType = type.val(); - - servertype_changed(preEditType, id); - - $('#btncell-' + id).html('\ + + function editButtonClick(id) { + var name = $('#input-name-' + id); + var url = $('#input-url-' + id); + var user = $('#input-user-' + id); + var password = $('#input-password-' + id); + var type = $('#input-type-' + id); + + name.attr('readonly', false); + url.attr('readonly', false); + user.attr('readonly', false); + password.attr('readonly', false); + type.attr('disabled', false); + + name.css("color", "#000"); + url.css("color", "#000"); + user.css("color", "#000"); + password.css("color", "#000"); + type.css("color", "#000"); + + preEditName = name.val(); + preEditUrl = url.val(); + preEditUser = user.val(); + preEditPassword = password.val(); + preEditType = type.val(); + + servertype_changed(preEditType, id); + + $('#btncell-' + id).html('\ <button class="btn btn-sm btn-success" title="{{lang_save}}" onclick="saveButtonClick(' + id + ');">✔</button> \ <button class="btn btn-sm btn-danger" title="{{lang_cancel}}" onclick="cancelButtonClick(' + id + ');">✘</button>'); - $('.table-edit').attr('disabled', true); - $('.table-delete').attr('disabled', true); - $('.table-refresh').attr('disabled', true); - $('#addServerButton').attr('disabled', true); -}; - -function saveButtonClick(id) { - $('#serverFormAction-' + id).val("updateServer"); - $('#submit-serverForm-' + id).trigger("click"); -}; - -function refreshButtonClick(id) { - $('#serverFormAction-' + id).val("checkConnection"); - $('#submit-serverForm-' + id).trigger("click"); -}; - -function addNewServer() { - $('#serverFormAction-0').val("updateServer"); - - $('#submit-serverForm-0').trigger("click"); -}; - -function cancelButtonClick(id) { - var name = $('#input-name-' + id); - var url = $('#input-url-' + id); - var user = $('#input-user-' + id); - var password = $('#input-password-' + id); - var type = $('#input-type-' + id); - - name.attr('readonly', true); - url.attr('readonly', true); - user.attr('readonly', true); - password.attr('readonly', true); - type.attr('disabled', true); - - name.css("color", ""); - url.css("color", ""); - user.css("color", ""); - password.css("color", ""); - type.css("color", ""); - - name.val(preEditName); - url.val(preEditUrl); - user.val(preEditUser); - password.val(preEditPassword); - type.val(preEditType); - - $('#btncell-' + id).html('\ + $('.table-edit').attr('disabled', true); + $('.table-delete').attr('disabled', true); + $('.table-refresh').attr('disabled', true); + $('#addServerButton').attr('disabled', true); + } + + function saveButtonClick(id) { + $('#serverFormAction-' + id).val("updateServer"); + $('#submit-serverForm-' + id).trigger("click"); + } + + function refreshButtonClick(id) { + $('#serverFormAction-' + id).val("checkConnection"); + $('#submit-serverForm-' + id).trigger("click"); + } + + function addNewServer() { + $('#serverFormAction-0').val("updateServer"); + + $('#submit-serverForm-0').trigger("click"); + } + + function cancelButtonClick(id) { + var name = $('#input-name-' + id); + var url = $('#input-url-' + id); + var user = $('#input-user-' + id); + var password = $('#input-password-' + id); + var type = $('#input-type-' + id); + + name.attr('readonly', true); + url.attr('readonly', true); + user.attr('readonly', true); + password.attr('readonly', true); + type.attr('disabled', true); + + name.css("color", ""); + url.css("color", ""); + user.css("color", ""); + password.css("color", ""); + type.css("color", ""); + + name.val(preEditName); + url.val(preEditUrl); + user.val(preEditUser); + password.val(preEditPassword); + type.val(preEditType); + + $('#btncell-' + id).html('\ <button class="btn btn-sm btn-primary table-edit" title="{{lang_edit}}" onclick="editButtonClick(' + id + ');" id="edit">✎</button> \ <button class="btn btn-sm btn-danger table-delete" type="button" title="{{lang_delete}}" onclick="deleteButtonClick(' + id + ');">✘</button>'); - $('.table-edit').attr('disabled', false); - $('.table-delete').attr('disabled', false); - $('.table-refresh').attr('disabled', false); - $('#addServerButton').attr('disabled', false); -} - -function deleteNewServer() { - $('#new').remove(); - $('.table-edit').attr('disabled', false); - $('.table-delete').attr('disabled', false); - $('#addServerButton').attr('disabled', false); -}; - -function addNewServerRow() { - $('#lastServerTableElement').before('<tr class=tablerow id="new">\ + $('.table-edit').attr('disabled', false); + $('.table-delete').attr('disabled', false); + $('.table-refresh').attr('disabled', false); + $('#addServerButton').attr('disabled', false); + } + + function deleteNewServer() { + $('#new').remove(); + $('.table-edit').attr('disabled', false); + $('.table-delete').attr('disabled', false); + $('#addServerButton').attr('disabled', false); + } + + 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}}"> {{display}}{{/servertypelist}}\ @@ -286,6 +306,5 @@ function addNewServerRow() { $('.table-edit').attr('disabled', true); $('.table-delete').attr('disabled', true); $('#addServerButton').attr('disabled', true); -}; + } </script> -</div> diff --git a/modules-available/locationinfo/templates/timetable.html b/modules-available/locationinfo/templates/timetable.html index bb3f7991..29446f58 100644 --- a/modules-available/locationinfo/templates/timetable.html +++ b/modules-available/locationinfo/templates/timetable.html @@ -1,159 +1,166 @@ <div> -<div align="right"> - <label for="CB_1">{{lang_expertMode}}</label> - <input class="bs-switch" name="1" id="CB_1" type="checkbox" {{#expertMode}}checked="checked"{{/expertMode}}> -</div> -<br> - - <div id="easyMode" style="{{#expertMode}}display: none;{{/expertMode}}"> - <form method="post" action="?do=locationinfo" id="timeForm"> - <input type="hidden" name="token" value="{{token}}"> - <input type="hidden" name="action" value="updateOpeningTimeEasy"> - <input type="hidden" name="id" value="{{id}}"> - <input type="hidden" name="easyMode" value="{{easyMode}}"> - - <table class="table table-condensed locations" style="margin-bottom:0"> - <tr> - <th>{{lang_day}}</th> - <th>{{lang_openingTime}}</th> - <th>{{lang_closingTime}}</th> - </tr> - - <tr class=tablerow> - <td>{{lang_monTilFr}}</td> - <td> - <div class="input-group bootstrap-timepicker"> + <div align="right"> + <label for="CB_1">{{lang_expertMode}}</label> + <input class="bs-switch" name="1" id="CB_1" type="checkbox" {{#expertMode}}checked="checked"{{/expertMode}}> + </div> + <br> + + <div id="easyMode" style="{{#expertMode}}display: none;{{/expertMode}}"> + <form method="post" action="?do=locationinfo" id="timeForm"> + <input type="hidden" name="token" value="{{token}}"> + <input type="hidden" name="action" value="updateOpeningTimeEasy"> + <input type="hidden" name="id" value="{{id}}"> + <input type="hidden" name="easyMode" value="{{easyMode}}"> + + <table class="table table-condensed locations" style="margin-bottom:0"> + <tr> + <th>{{lang_day}}</th> + <th>{{lang_openingTime}}</th> + <th>{{lang_closingTime}}</th> + </tr> + + <tr class=tablerow> + <td>{{lang_monTilFr}}</td> + <td> + <div class="input-group bootstrap-timepicker"> <span class="input-group-addon"> <span class="glyphicon glyphicon-time"></span> </span> - <input type="text" class="form-control timepicker2" name="openingtime[]" id="openingtimepicker" pattern="[0-9]{1,2}:[0-9]{2}" value="{{openingtime0}}"> - </div> - </td> - <td> - <div class="input-group bootstrap-timepicker"> + <input type="text" class="form-control timepicker2" name="openingtime[]" id="openingtimepicker" + pattern="[0-9]{1,2}:[0-9]{2}" value="{{openingtime0}}"> + </div> + </td> + <td> + <div class="input-group bootstrap-timepicker"> <span class="input-group-addon"> <span class="glyphicon glyphicon-time"></span> </span> - <input type="text" class="form-control timepicker2" name="closingtime[]" id="openingtimepicker" pattern="[0-9]{1,2}:[0-9]{2}" value="{{closingtime0}}"> - </div> - </td> - </tr> - <tr class=tablerow> - <td>{{lang_saturday}}</td> - <td> - <div class="input-group bootstrap-timepicker"> + <input type="text" class="form-control timepicker2" name="closingtime[]" id="openingtimepicker" + pattern="[0-9]{1,2}:[0-9]{2}" value="{{closingtime0}}"> + </div> + </td> + </tr> + <tr class=tablerow> + <td>{{lang_saturday}}</td> + <td> + <div class="input-group bootstrap-timepicker"> <span class="input-group-addon"> <span class="glyphicon glyphicon-time"></span> </span> - <input type="text" class="form-control timepicker2" name="openingtime[]" id="openingtimepicker" pattern="[0-9]{1,2}:[0-9]{2}" value="{{openingtime1}}"> - </div> - </td> - <td> - <div class="input-group bootstrap-timepicker"> + <input type="text" class="form-control timepicker2" name="openingtime[]" id="openingtimepicker" + pattern="[0-9]{1,2}:[0-9]{2}" value="{{openingtime1}}"> + </div> + </td> + <td> + <div class="input-group bootstrap-timepicker"> <span class="input-group-addon"> <span class="glyphicon glyphicon-time"></span> </span> - <input type="text" class="form-control timepicker2" name="closingtime[]" id="openingtimepicker" pattern="[0-9]{1,2}:[0-9]{2}" value="{{closingtime1}}"> - </div> - </td> - </tr> - <tr class=tablerow> - <td>{{lang_sunday}}</td> - <td> - <div class="input-group bootstrap-timepicker"> + <input type="text" class="form-control timepicker2" name="closingtime[]" id="openingtimepicker" + pattern="[0-9]{1,2}:[0-9]{2}" value="{{closingtime1}}"> + </div> + </td> + </tr> + <tr class=tablerow> + <td>{{lang_sunday}}</td> + <td> + <div class="input-group bootstrap-timepicker"> <span class="input-group-addon"> <span class="glyphicon glyphicon-time"></span> </span> - <input type="text" class="form-control timepicker2" name="openingtime[]" id="openingtimepicker" pattern="[0-9]{1,2}:[0-9]{2}" value="{{openingtime2}}"> - </div> - </td> - <td> - <div class="input-group bootstrap-timepicker"> + <input type="text" class="form-control timepicker2" name="openingtime[]" id="openingtimepicker" + pattern="[0-9]{1,2}:[0-9]{2}" value="{{openingtime2}}"> + </div> + </td> + <td> + <div class="input-group bootstrap-timepicker"> <span class="input-group-addon"> <span class="glyphicon glyphicon-time"></span> </span> - <input type="text" class="form-control timepicker2" name="closingtime[]" id="openingtimepicker" pattern="[0-9]{1,2}:[0-9]{2}" value="{{closingtime2}}"> - </div> - </td> - </tr> - </table> - - <br> - <br> - <br> - <button type="submit" class="btn btn-primary">{{lang_save}}</button> - <br> - </form> - </div> - - <div id="expertMode" style="{{#easyMode}}display: none;{{/easyMode}}"> - <form method="post" action="?do=locationinfo" id="timeForm"> - <input type="hidden" name="token" value="{{token}}"> - <input type="hidden" name="action" value="updateOpeningTimeExpert"> - <input type="hidden" name="id" value="{{id}}"> - <input type="hidden" name="easyMode" value="{{easyMode}}"> - - - <table class="table table-condensed locations" style="margin-bottom:0"> - <tr> - <th>{{lang_day}}</th> - <th>{{lang_openingTime}}</th> - <th>{{lang_closingTime}}</th> - <th>{{lang_delete}}</th> - </tr> - - {{#openingtimes}} - <tr class=tablerow> - <td>{{days}}</td> - <td>{{openingtime}}</td> - <td>{{closingtime}}</td> - <td align="center"><input type="checkbox" name="delete[]" value="{{index}}"></td> - <!--<td><button class="btn btn-sm btn-danger">X</button></td>--> - </tr> - {{/openingtimes}} - - <tr id="lastOpenTimesTableElement"></tr> - </table> - - <br> - <a class="btn btn-success btn-sm" onclick=newOpeningTime()><span class="glyphicon glyphicon-plus-sign"></span> {{lang_openingTime}}</a> - <!--<a class="btn btn-danger btn-sm" onclick=>{{lang_deleteAll}}</a>--> - <br> - <br> - <button type="submit" class="btn btn-primary">{{lang_save}}</button> - <br> - </form> - </div> + <input type="text" class="form-control timepicker2" name="closingtime[]" id="openingtimepicker" + pattern="[0-9]{1,2}:[0-9]{2}" value="{{closingtime2}}"> + </div> + </td> + </tr> + </table> + + <br> + <br> + <br> + <button type="submit" class="btn btn-primary">{{lang_save}}</button> + <br> + </form> + </div> + + <div id="expertMode" style="{{#easyMode}}display: none;{{/easyMode}}"> + <form method="post" action="?do=locationinfo" id="timeForm"> + <input type="hidden" name="token" value="{{token}}"> + <input type="hidden" name="action" value="updateOpeningTimeExpert"> + <input type="hidden" name="id" value="{{id}}"> + <input type="hidden" name="easyMode" value="{{easyMode}}"> + + + <table class="table table-condensed locations" style="margin-bottom:0"> + <tr> + <th>{{lang_day}}</th> + <th>{{lang_openingTime}}</th> + <th>{{lang_closingTime}}</th> + <th>{{lang_delete}}</th> + </tr> + + {{#openingtimes}} + <tr class=tablerow> + <td>{{days}}</td> + <td>{{openingtime}}</td> + <td>{{closingtime}}</td> + <td align="center"><input type="checkbox" name="delete[]" value="{{index}}"></td> + <!--<td><button class="btn btn-sm btn-danger">X</button></td>--> + </tr> + {{/openingtimes}} + + <tr id="lastOpenTimesTableElement"></tr> + </table> + + <br> + <a class="btn btn-success btn-sm" onclick=newOpeningTime()><span class="glyphicon glyphicon-plus-sign"></span> + {{lang_openingTime}}</a> + <!--<a class="btn btn-danger btn-sm" onclick=>{{lang_deleteAll}}</a>--> + <br> + <br> + <button type="submit" class="btn btn-primary">{{lang_save}}</button> + <br> + </form> + </div> </div> <script> -setTimepicker(); -$('#CB_1').bootstrapSwitch(); -$('#CB_1').on('switchChange.bootstrapSwitch', function (e, data) { - - if (data == false) { - $('#expertMode').hide(); - $('#easyMode').show(); - } else { - $('#easyMode').hide(); - $('#expertMode').show(); - } -}); - - function setTimepicker() { - $('.timepicker2').timepicker({ - minuteStep: 1, - template: 'modal', - appendWidgetTo: 'body', - showSeconds: false, - showMeridian: false, - defaultTime: false - }); - }; - - function newOpeningTime() { - $('#lastOpenTimesTableElement').before('<tr>\ + setTimepicker(); + $('#CB_1').bootstrapSwitch(); + $('#CB_1').on('switchChange.bootstrapSwitch', function (e, data) { + + if (data == false) { + $('#expertMode').hide(); + $('#easyMode').show(); + } else { + $('#easyMode').hide(); + $('#expertMode').show(); + } + }); + + function setTimepicker() { + $('.timepicker2').timepicker({ + minuteStep: 1, + template: 'modal', + appendWidgetTo: 'body', + showSeconds: false, + showMeridian: false, + defaultTime: false + }); + } + + function newOpeningTime() { + $('#lastOpenTimesTableElement').before('<tr>\ <td>\ <div class="form-group options">\ <label><input required type="checkbox" name="days[]" value="Monday">{{lang_shortMonday}}</label>\ @@ -190,23 +197,18 @@ $('#CB_1').on('switchChange.bootstrapSwitch', function (e, data) { <input type="checkbox" name="dontadd[]" value="dontadd"\ </td>\ </tr>'); - setTimepicker(); - - $(function(){ - var requiredCheckboxes = $('.options :checkbox[required]'); - requiredCheckboxes.change(function(){ - if(requiredCheckboxes.is(':checked')) { - requiredCheckboxes.removeAttr('required'); - } else { - requiredCheckboxes.attr('required', 'required'); - } - }); - }); - }; - // <!--<button type="submit" class="btn btn-success btn-sm" onclick=>✓</button>-->\ - // <input type="time" name="openingtime[]">\ - // <input type="time" name="closingtime[]">\ - - + setTimepicker(); + + $(function () { + var requiredCheckboxes = $('.options :checkbox[required]'); + requiredCheckboxes.change(function () { + if (requiredCheckboxes.is(':checked')) { + requiredCheckboxes.removeAttr('required'); + } else { + requiredCheckboxes.attr('required', 'required'); + } + }); + }); + } </script> |