summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJannik Schönartz2016-12-02 17:18:38 +0100
committerJannik Schönartz2016-12-02 17:18:38 +0100
commitdf4a420dedabcaac420e32287e4a48e4ce968fba (patch)
treefc0fced1cd40dbb69fa0e57a56a23454ecb97398
parentfrontend: fixed cases whend the backend doens't answer (diff)
downloadslx-admin-df4a420dedabcaac420e32287e4a48e4ce968fba.tar.gz
slx-admin-df4a420dedabcaac420e32287e4a48e4ce968fba.tar.xz
slx-admin-df4a420dedabcaac420e32287e4a48e4ce968fba.zip
Locationinfo config: added auto scale mode. Fixed some api bugs
-rw-r--r--modules-available/locationinfo/api.inc.php8
-rw-r--r--modules-available/locationinfo/lang/de/template-tags.json3
-rw-r--r--modules-available/locationinfo/lang/en/template-tags.json3
-rw-r--r--modules-available/locationinfo/page.inc.php10
-rw-r--r--modules-available/locationinfo/templates/config.html27
5 files changed, 36 insertions, 15 deletions
diff --git a/modules-available/locationinfo/api.inc.php b/modules-available/locationinfo/api.inc.php
index b96dbdc6..f4f5c9c2 100644
--- a/modules-available/locationinfo/api.inc.php
+++ b/modules-available/locationinfo/api.inc.php
@@ -87,7 +87,7 @@ function checkIfHidden($locationID) {
return true;
}
}
- return -1;
+ return false;
}
function getOpeningTimesFromParent($locationID) {
@@ -161,10 +161,10 @@ function getRoomInfoJson($locationID, $coords) {
$error = true;
}
- if ($error == false) {
- echo $pcs;
- } else {
+ if ($error == true) {
echo "ERROR";
+ } else {
+ echo $pcs;
}
}
diff --git a/modules-available/locationinfo/lang/de/template-tags.json b/modules-available/locationinfo/lang/de/template-tags.json
index da18765a..3f782970 100644
--- a/modules-available/locationinfo/lang/de/template-tags.json
+++ b/modules-available/locationinfo/lang/de/template-tags.json
@@ -61,5 +61,6 @@
"lang_configupdate": "Einstellungs update rate",
"lang_configupdateTooltip": "Zeit nachder die Einstellungen geupdated werden (in minuten)",
"lang_min": "min",
- "lang_sec": "sec"
+ "lang_sec": "sec",
+ "lang_autoScale": "Auto skalierung"
}
diff --git a/modules-available/locationinfo/lang/en/template-tags.json b/modules-available/locationinfo/lang/en/template-tags.json
index b2beabef..07224987 100644
--- a/modules-available/locationinfo/lang/en/template-tags.json
+++ b/modules-available/locationinfo/lang/en/template-tags.json
@@ -61,5 +61,6 @@
"lang_configupdate": "Config update",
"lang_configupdateTooltip": "Time interval the config gets updated (in minutes)",
"lang_min": "min",
- "lang_sec": "sec"
+ "lang_sec": "sec",
+ "lang_autoScale": "Auto scale"
}
diff --git a/modules-available/locationinfo/page.inc.php b/modules-available/locationinfo/page.inc.php
index b05153b0..271b15fc 100644
--- a/modules-available/locationinfo/page.inc.php
+++ b/modules-available/locationinfo/page.inc.php
@@ -63,13 +63,14 @@ class Page_LocationInfo extends Page
$result['mode'] = Request::post('mode', 1, 'int');
$result['vertical'] = Request::post('vertical', false, 'bool');
$result['eco'] = Request::post('eco', false, 'bool');
+ $result['scaledaysauto'] = Request::post('autoscale', false, 'bool');
$result['daystoshow'] = Request::post('daystoshow', 7, 'int');
$result['rotation'] = Request::post('rotation', 0, 'int');
$result['scale'] = Request::post('scale', 50, 'int');
$result['switchtime'] = Request::post('switchtime', 20, 'int');
- $result['calupdate'] = Request::post('calupdate', 0, 'int'); //TODO SET DEFAULT TIME INSTEAD OF 0
- $result['roomupdate'] = Request::post('roomupdate', 0, 'int'); //TODO SET DEFAULT TIME INSTEAD OF 0
- $result['configupdate'] = Request::post('configupdate', 0, 'int'); //TODO SET DEFAULT TIME INSTEAD OF 0
+ $result['calupdate'] = Request::post('calupdate', 30, 'int');
+ $result['roomupdate'] = Request::post('roomupdate', 30, 'int');
+ $result['configupdate'] = Request::post('configupdate', 180, 'int');
Database::exec("INSERT INTO `location_info` VALUES (:id, :hidden, '', :config, '') ON DUPLICATE KEY UPDATE config=:config",
array('id' => $locationid, 'hidden' => false, 'config' => json_encode($result, true)));
@@ -80,7 +81,6 @@ class Page_LocationInfo extends Page
private function updateOpeningTimeExpert()
{
- //$existingDays = Request::post('existingdays'); TODO maybe use openingdays from the html so we don't need the db query
$days = Request::post('days');
$locationid = Request::post('id', 0, 'int');
$openingtime = Request::post('openingtime');
@@ -404,7 +404,7 @@ class Page_LocationInfo extends Page
$array = json_decode($dbdata['config'], true);
}
echo Render::parse('config', array('id' => $id, 'language' => $array['language'], 'mode' => 'mode'.$array['mode'], 'vertical' => $array['vertical'],
- 'eco' => $array['eco'], 'daystoshow' => 'day'.$array['daystoshow'], 'rotation' => 'rotation'.$array['rotation'],
+ 'eco' => $array['eco'], 'daystoshow' => 'day'.$array['daystoshow'], 'scaledaysauto' => $array['scaledaysauto'], 'rotation' => 'rotation'.$array['rotation'],
'scale' => $array['scale'], 'switchtime' => $array['switchtime'], 'calupdate' => $array['calupdate'],
'roomupdate' => $array['roomupdate'], 'configupdate' => $array['configupdate']));
}
diff --git a/modules-available/locationinfo/templates/config.html b/modules-available/locationinfo/templates/config.html
index 06240e66..a814077a 100644
--- a/modules-available/locationinfo/templates/config.html
+++ b/modules-available/locationinfo/templates/config.html
@@ -23,7 +23,8 @@
</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}}
+ <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;">
@@ -102,6 +103,10 @@ function loadValues() {
$("#cb_eco").prop("checked", true);
}
+ if('{{scaledaysauto}}' == true){
+ $("#cb_autoScale").prop("checked", true);
+ }
+
var day = $("#{{daystoshow}}");
if (!day.length) {
day = $("#day7");
@@ -128,9 +133,23 @@ function loadValues() {
$("#sl_switch").attr('value', switchVal);
showSwitchValue(switchVal);
- $("#updateCalendar").attr("value", '{{calupdate}}');
- $("#updateRoom").attr("value", '{{roomupdate}}');
- $("#updateConfig").attr("value", '{{configupdate}}');
+ 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) {