summaryrefslogtreecommitdiffstats
path: root/modules-available
diff options
context:
space:
mode:
authorJannik Schönartz2016-11-21 05:34:45 +0100
committerJannik Schönartz2016-11-21 05:34:45 +0100
commiteda3fac7c520e33228ef771767da652c0f94379e (patch)
tree1b49cfeaa2319cba39cc29ec0b8da6f9334fa628 /modules-available
parentfirst commit of the frontend from locationinfo modul (diff)
downloadslx-admin-eda3fac7c520e33228ef771767da652c0f94379e.tar.gz
slx-admin-eda3fac7c520e33228ef771767da652c0f94379e.tar.xz
slx-admin-eda3fac7c520e33228ef771767da652c0f94379e.zip
Fixed from the Mail applied. Added OpeningTimes and stuff for the admin panel. new install.php should beexcecuted
Diffstat (limited to 'modules-available')
-rw-r--r--modules-available/locationinfo/api.inc.php72
-rwxr-xr-xmodules-available/locationinfo/frontend/doorsign.html2
-rw-r--r--modules-available/locationinfo/install.inc.php4
-rw-r--r--modules-available/locationinfo/lang/de/messages.json4
-rw-r--r--modules-available/locationinfo/lang/de/template-tags.json3
-rw-r--r--modules-available/locationinfo/lang/en/messages.json4
-rw-r--r--modules-available/locationinfo/lang/en/template-tags.json2
-rw-r--r--modules-available/locationinfo/page.inc.php190
-rw-r--r--modules-available/locationinfo/style.css44
-rw-r--r--modules-available/locationinfo/templates/location-info.html168
-rw-r--r--modules-available/locationinfo/templates/pcsubtable.html6
-rw-r--r--modules-available/locationinfo/templates/timetable.html64
12 files changed, 345 insertions, 218 deletions
diff --git a/modules-available/locationinfo/api.inc.php b/modules-available/locationinfo/api.inc.php
index be202546..31c574d9 100644
--- a/modules-available/locationinfo/api.inc.php
+++ b/modules-available/locationinfo/api.inc.php
@@ -3,32 +3,77 @@
HandleParameters();
function HandleParameters() {
- $getAction = $_GET['action'];
+ $getAction = Request::get('action', 0, 'string');
if ($getAction == "roominfo") {
- $getRoomID = $_GET['id'];
- $getCoords = $_GET['coords'];
-
+ $getRoomID = Request::get('id', 0, 'int');
+ $getCoords = Request::get('coords', 0, 'string');
if (empty($getCoords)) {
$getCoords = '0';
}
getRoomInfoJson($getRoomID, $getCoords);
+ } elseif ($getAction == "openingtime") {
+ $getRoomID = Request::get('id', 0, 'int');
+ getOpeningTimes($getRoomID);
}
}
-function getRoomInfoJson($locationID, $coords) {
- $error = false;
-
- $dbquery = Database::simpleQuery("SELECT hidden FROM `locationinfo` WHERE locationid = $locationID");
+function checkIfHidden($locationID) {
+ $dbquery = Database::simpleQuery("SELECT hidden FROM `location_info` WHERE locationid = :locationID", array('locationID' => $locationID));
while($roominfo=$dbquery->fetch(PDO::FETCH_ASSOC)) {
$hidden = $roominfo['hidden'];
if ($hidden === '0') {
- $error = false;
+ return false;
} else {
- $error = true;
+ return true;
}
}
+}
+
+function getOpeningTimes($locationID) {
+ $error = checkIfHidden($locationID);
+ if ($error == true) {
+ echo "ERROR";
+ return;
+ }
+ $dbquery = Database::simpleQuery("SELECT openingtime FROM `location_info` WHERE locationid = :locationID", array('locationID' => $locationID));
+
+ $result = array();
+ while($dbdata=$dbquery->fetch(PDO::FETCH_ASSOC)) {
+ $dbresult = json_decode($dbdata['openingtime'], true);
+ }
+
+ $weekarray = array ("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");
+
+ foreach ($weekarray as $d) {
+ $array = array();
+ foreach ($dbresult as $day) {
+ foreach($day['days'] as $val) {
+ if ($val == $d) {
+ $arr = array();
+
+ $arr['HourOpen'] = $day['openingtime'][0] . $day['openingtime'][1];
+ $arr['MinutesOpen'] = $day['openingtime'][3] . $day['openingtime'][4];
+
+ $arr['HourClose'] = $day['closingtime'][0] . $day['closingtime'][1];
+ $arr['MinutesClose'] = $day['closingtime'][3] . $day['closingtime'][4];
+
+ $array[] = $arr;
+ }
+ }
+ if(!empty($array)) {
+ $result[$d] = $array;
+ }
+ }
+ }
+
+ echo json_encode($result, true);
+}
+
+function getRoomInfoJson($locationID, $coords) {
+ $error = checkIfHidden($locationID);
+
$pcs = getPcInfos($locationID, $coords);
if (empty($pcs)) {
@@ -43,13 +88,12 @@ function getRoomInfoJson($locationID, $coords) {
}
function getPcInfos($locationID, $coords) {
-
$dbquery;
if ($coords === '1') {
- $dbquery = Database::simpleQuery("SELECT machineuuid, position, logintime FROM `machine` WHERE locationid = $locationID");
+ $dbquery = Database::simpleQuery("SELECT machineuuid, position, logintime FROM `machine` WHERE locationid = :locationID" , array('locationID' => $locationID));
} else {
- $dbquery = Database::simpleQuery("SELECT machineuuid, logintime FROM `machine` WHERE locationid = $locationID");
+ $dbquery = Database::simpleQuery("SELECT machineuuid, logintime FROM `machine` WHERE locationid = :locationID" , array('locationID' => $locationID));
}
$pcs = array();
@@ -79,5 +123,3 @@ function getPcInfos($locationID, $coords) {
return $str;
}
-
-?>
diff --git a/modules-available/locationinfo/frontend/doorsign.html b/modules-available/locationinfo/frontend/doorsign.html
index 9db56fd8..fb621671 100755
--- a/modules-available/locationinfo/frontend/doorsign.html
+++ b/modules-available/locationinfo/frontend/doorsign.html
@@ -798,4 +798,4 @@ optional:
</div>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/modules-available/locationinfo/install.inc.php b/modules-available/locationinfo/install.inc.php
index 807e2826..e056fea1 100644
--- a/modules-available/locationinfo/install.inc.php
+++ b/modules-available/locationinfo/install.inc.php
@@ -2,10 +2,10 @@
$res = array();
-$res[] = tableCreate('locationinfo', '
+$res[] = tableCreate('location_info', '
`locationid` INT(11) NOT NULL,
`hidden` BOOLEAN NOT NULL DEFAULT 0,
- `computers` BLOB DEFAULT NULL,
+ `openingtime` VARCHAR(2000) NOT NULL,
PRIMARY KEY (`locationid`)
');
diff --git a/modules-available/locationinfo/lang/de/messages.json b/modules-available/locationinfo/lang/de/messages.json
new file mode 100644
index 00000000..26822083
--- /dev/null
+++ b/modules-available/locationinfo/lang/de/messages.json
@@ -0,0 +1,4 @@
+{
+ "no-days-selected": "Es wurden keine Tage ausgewählt.",
+ "added-x-entries": "Eintr\u00e4ge hinzugef\u00fcgt: {{0}}"
+}
diff --git a/modules-available/locationinfo/lang/de/template-tags.json b/modules-available/locationinfo/lang/de/template-tags.json
index 843beb5a..d27d55e4 100644
--- a/modules-available/locationinfo/lang/de/template-tags.json
+++ b/modules-available/locationinfo/lang/de/template-tags.json
@@ -9,6 +9,7 @@
"lang_pcID": "ID",
+ "lang_pcIP": "IP",
"lang_pcX": "X",
"lang_pcY": "Y",
"lang_pcInUse": "In Benutzung",
@@ -16,6 +17,8 @@
"lang_day": "Tag",
"lang_openingTime": "Öffnungszeit",
"lang_closingTime": "Schließungszeit",
+ "lang_deleteAll": "Alles Löschen",
+
"lang_shortMonday": "Mo",
"lang_shortTuesday": "Di",
diff --git a/modules-available/locationinfo/lang/en/messages.json b/modules-available/locationinfo/lang/en/messages.json
new file mode 100644
index 00000000..114cade7
--- /dev/null
+++ b/modules-available/locationinfo/lang/en/messages.json
@@ -0,0 +1,4 @@
+{
+ "no-days-selected": "No days selected.",
+ "added-x-entries": "Entries added: {{0}}"
+}
diff --git a/modules-available/locationinfo/lang/en/template-tags.json b/modules-available/locationinfo/lang/en/template-tags.json
index 4c4d1d38..a63751a8 100644
--- a/modules-available/locationinfo/lang/en/template-tags.json
+++ b/modules-available/locationinfo/lang/en/template-tags.json
@@ -9,6 +9,7 @@
"lang_pcID": "ID",
+ "lang_pcIP": "IP",
"lang_pcX": "X",
"lang_pcY": "Y",
"lang_pcInUse": "In Use",
@@ -16,6 +17,7 @@
"lang_day": "Day",
"lang_openingTime": "Opening time",
"lang_closingTime": "Closing time",
+ "lang_deleteAll": "Delete all",
"lang_shortMonday": "Mon",
"lang_shortTuesday": "Tue",
diff --git a/modules-available/locationinfo/page.inc.php b/modules-available/locationinfo/page.inc.php
index f6b4b661..f946bee8 100644
--- a/modules-available/locationinfo/page.inc.php
+++ b/modules-available/locationinfo/page.inc.php
@@ -15,6 +15,11 @@ class Page_LocationInfo extends Page
Message::addError('main.no-permission');
Util::redirect('?do=Main'); // does not return
}
+
+ $this->action = Request::post('action');
+ if ($this->action === 'updateOpeningTime') {
+ $this->updateOpeningTime();
+ }
}
/**
@@ -44,33 +49,125 @@ class Page_LocationInfo extends Page
}
}
+ private function updateOpeningTime()
+ {
+ $existingDays = Request::post('existingdays');
+ $days = Request::post('days');
+ $locationid = Request::post('id');
+ $openingtime = Request::post('openingtime');
+ $closingtime = Request::post('closingtime');
+ $delete = Request::post('delete');
+ $dontadd = Request::post('dontadd');
+ $count = 0;
+ $result = array();
+ $resulttmp = array();
+
+ $dbquery = Database::simpleQuery("SELECT openingtime FROM `location_info` WHERE locationid = :id", array('id' => $locationid));
+ while($dbdata=$dbquery->fetch(PDO::FETCH_ASSOC)) {
+ $resulttmp = json_decode($dbdata['openingtime'], true);
+ }
+
+ $index = 0;
+
+ foreach ($resulttmp as $day) {
+ $skip = false;
+ foreach ($delete as $del) {
+ if ($del == $index) {
+ $skip = true;
+ break;
+ }
+ }
+ if ($skip == true) {
+ $index++;
+ continue;
+ }
+
+ $result[] = $day;
+ $index++;
+ }
+
+ if (!empty($days) && !is_array($days)) {
+ Message::addError('no-days-selected');
+ Util::redirect('?do=locationinfo');
+ } else{
+
+ $dayz = array();
+ $da = array();
+
+ foreach ($days as $d) {
+ if ($d != '-') {
+ $da[] = $d;
+ } else {
+ $dayz[$count] = $da;
+ $da = array();
+ $count++;
+ }
+ }
+
+ $optime = array();
+ for ($x = 0; $x < $count; $x++) {
+ if ($dontadd[$x] == 'dontadd') {
+ continue;
+ }
+ $optime['days'] = $dayz[$x];
+ $optime['openingtime'] = $openingtime[$x];
+ $optime['closingtime'] = $closingtime[$x];
+ $result[] = $optime;
+ }
+ }
+
+ Database::exec("INSERT INTO `location_info` VALUES (:id, :hidden, :openingtime) ON DUPLICATE KEY UPDATE openingtime=:openingtime",
+ array('id' => $locationid, 'hidden' => false, 'openingtime' => json_encode($result, true)));
+
+ Message::addSuccess('added-x-entries', $count);
+ Util::redirect('?do=locationinfo');
+ }
+
+ private function removeOpeningTime() {
+ Message::addError('wasd');
+ }
+
protected function toggleHidden($id, $val) {
- Database::exec("UPDATE `locationinfo` SET hidden = $val WHERE locationid = $id");
+ Database::exec("INSERT INTO `location_info` VALUES (:id, :hidden, '') ON DUPLICATE KEY UPDATE hidden=:hidden", array('id' => $id, 'hidden' => $val));
}
protected function getInfoScreenTable() {
+ $dbquery = Database::simpleQuery("SELECT l.locationname, l.locationid, li.hidden, m.inUse, m.total FROM `location_info` AS li
+ RIGHT JOIN `location` AS l ON li.locationid=l.locationid LEFT JOIN
+ (SELECT locationid, Count(case m.logintime WHEN NOT 1 THEN null else 1 end) AS inUse, Count(*) AS total FROM `machine` AS m
+ WHERE locationid IS NOT NULL GROUP BY locationid) AS m ON l.locationid=m.locationid");
+ $pcs = array();
- $dbquery = Database::simpleQuery("SELECT * FROM `locationinfo`");
+ if (Module::isAvailable('locations')) {
+ foreach (Location::getLocations() as $loc) {
+ $data = array();
+ $data['locationid'] = (int)$loc['locationid'];
+ $data['locationname'] = $loc['locationname'];
+ $data['depth'] = $loc['depth'];
+ $data['hidden'] = NULL;
+ $locid = (int)$loc['locationid'];
+ $pcs[$locid] = $data;
+ }
+ }
- $pcs = array();
while($roominfo=$dbquery->fetch(PDO::FETCH_ASSOC)) {
- $data = array();
- $data['locationid'] = $roominfo['locationid'];
- $data['hidden'] = $roominfo['hidden'];
+ $locid = (int)$roominfo['locationid'];
- $inUseCounter = 0;
- $totalPcCounter = 0;
- $data['computers'] = json_decode($roominfo['computers'], true);
+ if ($roominfo['hidden'] == NULL) {
+ $pcs[$locid]['hidden'] = 0;
+ } else {
+ $pcs[$locid]['hidden'] = $roominfo['hidden'];
+ }
- foreach ($data['computers'] as $value) {
- if ($value['inUse'] == 1) {
- $inUseCounter++;
- }
- $totalPcCounter++;
+ if ($roominfo['inUse'] != NULL) {
+ $pcs[$locid]['inUse'] = $roominfo['inUse'];
+ }
+ if ($roominfo['total'] != NULL) {
+ $pcs[$locid]['total'] = $roominfo['total'];
+ $pcs[$locid]['hasPcs'] = true;
+ } else {
+ $pcs[$locid]['hasPcs'] = false;
}
- $data['inUse'] = $inUseCounter;
- $data['totalPcs'] = $totalPcCounter;
- $pcs[] = $data;
}
Render::addTemplate('location-info', array(
@@ -85,6 +182,17 @@ class Page_LocationInfo extends Page
}
}
+ private function getInUseStatus($logintime, $lastseen) {
+ if ($logintime == 0) {
+ return 0;
+ } elseif ($logintime > 0) {
+ return 1;
+ // TODO lastseen > 610 = OFF TODO DEFEKT! if ...
+ } elseif ($lastseen > 610) {
+ return 2;
+ }
+ }
+
/**
* AJAX
*/
@@ -98,22 +206,62 @@ class Page_LocationInfo extends Page
if ($action === 'pcsubtable') {
$id = Request::any('id');
$this->ajaxShowLocation($id);
+ }
+ if ($action === 'timetable') {
+ $id = Request::any('id');
+ $this->ajaxTimeTable($id);
}
}
private function ajaxShowLocation($id)
{
- $dbquery = Database::simpleQuery("SELECT * FROM `locationinfo` WHERE locationid = $id");
+ $dbquery = Database::simpleQuery("SELECT machineuuid, clientip, position, logintime, lastseen FROM `machine` WHERE locationid = :id", array('id' => $id));
$data = array();
- while($roominfo=$dbquery->fetch(PDO::FETCH_ASSOC)) {
- $data = json_decode($roominfo['computers'], true);
+
+ while($dbdata=$dbquery->fetch(PDO::FETCH_ASSOC)) {
+ $pc = array();
+ $pc['id'] = $dbdata['machineuuid'];
+ $pc['ip'] = $dbdata['clientip'];
+ $pc['inUse'] = $this->getInUseStatus($dbdata['logintime'], $dbdata['lastseen']);
+
+ $position = array();
+ $position = json_decode($dbdata['position'], true);
+ $pc['x'] = $position['gridRow'];
+ $pc['y'] = $position['gridCol'];
+
+
+ $data[] = $pc;
}
echo Render::parse('pcsubtable', array(
- 'list' => array_values($data),
+ 'list' => array_values($data)
));
}
+ private function ajaxTimeTable($id) {
+ $array = array();
+ $dbquery = Database::simpleQuery("SELECT openingtime FROM `location_info` WHERE locationid = :id", array('id' => $id));
+ while($dbdata=$dbquery->fetch(PDO::FETCH_ASSOC)) {
+ $db = array();
+ $db = json_decode($dbdata['openingtime'], true);
+ $index = 0;
+ foreach ($db as $key) {
+ $str = "| ";
+ foreach ($key['days'] as $val) {
+ $str .= $val;
+ $str .= " | ";
+ }
+ $ar = array();
+ $ar['days'] = $str;
+ $ar['openingtime'] = $key['openingtime'];
+ $ar['closingtime'] = $key['closingtime'];
+ $ar['index'] = $index;
+ $array[] = $ar;
+ $index++;
+ }
+ }
+ echo Render::parse('timetable', array('id' => $id, 'openingtimes' => array_values($array)));
+ }
}
diff --git a/modules-available/locationinfo/style.css b/modules-available/locationinfo/style.css
index 2169efa2..c0b10cd9 100644
--- a/modules-available/locationinfo/style.css
+++ b/modules-available/locationinfo/style.css
@@ -1,47 +1,3 @@
-/* The Modal (background) */
-.modal {
- display: none; /* Hidden by default */
- position: fixed; /* Stay in place */
- z-index: 1; /* Sit on top */
- left: 0;
- top: 0;
- width: 100%; /* Full width */
- height: 100%; /* Full height */
- overflow: auto; /* Enable scroll if needed */
- background-color: rgb(0,0,0); /* Fallback color */
- background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
-}
-
-/* Modal Content/Box */
-.modal-content {
- background-color: #fefefe;
- margin: 15% auto; /* 15% from the top and centered */
- padding: 20px;
- border: 1px solid #888;
- width: 40%; /* Could be more or less, depending on screen size */
-}
-
-/* The Close Button */
-.close {
- color: #aaa;
- float: right;
- font-size: 28px;
- font-weight: bold;
-}
-
-.close:hover,
-.close:focus {
- color: black;
- text-decoration: none;
- cursor: pointer;
-}
-
.tablerow:hover {
background-color: #F2F2F2;
}
-
-.divider{
- width:50px;
- height:auto;
- display:inline-block;
-}
diff --git a/modules-available/locationinfo/templates/location-info.html b/modules-available/locationinfo/templates/location-info.html
index 9e4e886d..22a961b6 100644
--- a/modules-available/locationinfo/templates/location-info.html
+++ b/modules-available/locationinfo/templates/location-info.html
@@ -1,136 +1,34 @@
<div>
<h1>{{lang_mainHeader}}</h1>
-<!-- The Modal -->
-<div id="popup" class="modal">
- <!-- Modal content -->
- <div class="modal-content">
- <span class="close" onclick="closePopup()">x</span>
- <label id=1></label>
- <br>
-
- <!-- vvvv TEST STUFF vvvv-->
- <table class="table table-condensed locations" style="margin-bottom:0px">
- <tr>
- <th>{{lang_day}}</th>
- <th>{{lang_openingTime}}</th>
- <th>{{lang_closingTime}}</th>
- </tr>
-
- <tr>
- <td>Monday</td>
- <td>08:00</td>
- <td>16:00</td>
- </tr>
-
- <tr>
- <td>MO, DI, MI, DO, FR, SA</td>
- <td>08:00</td>
- <td>21:00</td>
- </tr>
-
- <tr>
- <td>SO</td>
- <td>10:00</td>
- <td>12:00</td>
- </tr>
-
- <tr>
- <td>MON, TUE, WED, THU, FRI, SAT, SUN</td>
- <td>10:00</td>
- <td>12:00</td>
- </tr>
-
- <tr>
- <td>
- <label><input type="checkbox" value="Monday">{{lang_shortMonday}}</label>
- <label><input type="checkbox" value="Tuesday">{{lang_shortTuesday}}</label>
- <label><input type="checkbox" value="Wednesday">{{lang_shortWednesday}}</label>
- <label><input type="checkbox" value="Thursday">{{lang_shortThursday}}</label>
- <label><input type="checkbox" value="Friday">{{lang_shortFriday}}</label>
- <label><input type="checkbox" value="Saturday">{{lang_shortSaturday}}</label>
- <label><input type="checkbox" value="Sunday">{{lang_shortSunday}}</label>
- </td>
- <td>
- <label><input type="text" onkeypress="return isNumber(event)" style="width:35px;"> :</label>
- <input type="text" onkeypress="return isNumber(event)" style="width:35px;">
- </td>
- <td>
- <label><input type="text" onkeypress="return isNumber(event)" style="width:35px;"> :</label>
- <input type="text" onkeypress="return isNumber(event)" style="width:35px;">
- </td>
- </tr>
- </table>
-
- <!-- ^^^^ TEST STUFF ^^^^-->
-
- <button class="btn btn-success btn-sm">Add</button>
- <button class="btn btn-sm btn-danger">Delete</button>
-
-
- <br><br>
- <button class="btn btn-primary">Save</button>
- <div class="divider"></div>
- <button class="btn btn-sm btn-danger" onclick="closePopup()">Cancel</button>
- </div>
-
-</div>
-<script>
-
-// Get the modal
-var modal = document.getElementById('popup');
-
-// Get the button that opens the modal
-var btn = document.getElementById("myBtn");
-
-// Get the <span> element that closes the modal
-var span = document.getElementsByClassName("close")[0];
-
-// When the user clicks on the button, open the modal
-function openPopup(locID) {
- modal.style.display = "block";
-
- $('#1').text('Location ID: ' + locID);
-}
-
-// When the user clicks on <span> (x), close the modal
-function closePopup() {
- modal.style.display = "none";
-}
-
-// When the user clicks anywhere outside of the modal, close it
-window.onclick = function(event) {
- if (event.target == modal) {
- modal.style.display = "none";
- }
-}
-</script>
-
<table class="table table-condensed locations" style="margin-bottom:0px">
<tr>
- <th>{{lang_locationID}}</th>
- <th>{{lang_locationInUse}}</th>
+ <th>{{lang_locationName}}</th>
+ <th width=10>{{lang_locationID}}</th>
+ <th width=50>{{lang_locationInUse}}</th>
<th width=50>{{lang_locationIsHidden}}</th>
<th width=50>{{lang_locationSettings}}</th>
+ <th width=1/>
</tr>
{{#list}}
- <tr class="tablerow" onclick="slxOpenLocationInfo(this, {{locationid}})">
- <td>
- <div style="display:inline-block;width:{{depth}}em"></div>
- <a href="#" >{{locationid}}<b class="caret"></b></a>
- </td>
- <td>{{inUse}} / {{totalPcs}}</td>
- <!-- <td>{{hidden}}</td> -->
- <!-- <td><form><input type="checkbox" id={{locationid}} value={{hidden}}></form></td> -->
+ <tr class="tablerow" onclick="{{#hasPcs}}slxOpenLocationInfo(this, {{locationid}}){{/hasPcs}}">
+ <td><div style="display:inline-block;width:{{depth}}em"></div>{{#hasPcs}}<a>{{/hasPcs}}{{locationname}}</td>
+ <td align="center">{{locationid}}</td>
+
+
+ <td align="center">{{#hasPcs}}{{inUse}} / {{total}}{{/hasPcs}}</td>
+
+
<td id={{locationid}} onclick="event.cancelBubble = true;" align="center"></td>
<script>
- var cbh = document.getElementById('{{locationid}}');
+ var cbh = document.getElementById('{{locationid}}');
var cb = document.createElement('input');
- cb.type = 'checkbox';
+ cb.type = 'checkbox';
cbh.appendChild(cb);
+
cb.id = 'cb' + {{locationid}};
cb.value = {{hidden}};
if ({{hidden}} == 1) {
@@ -139,31 +37,31 @@ window.onclick = function(event) {
cb.addEventListener("click", function() { cbClick(this, {{locationid}}); });
</script>
- <td><button onclick="event.cancelBubble = true; openPopup({{locationid}})">{{lang_locationSettings}}</button></td>
-
+ <td onclick="event.cancelBubble = true;"><a class="btn btn-sm btn-default" role="button" onclick="loadModal({{locationid}});">{{lang_locationSettings}}</a><td>
</tr>
-{{/list}}
+{{/list}}
</table>
-<script type="text/javascript"><!--
+<div class="modal fade" id="myModal" tabindex="-1" role="dialog">
+ <div class="modal-dialog">
-function isNumber(evt) {
- evt = (evt) ? evt : window.event;
- var charCode = (evt.which) ? evt.which : evt.keyCode;
- if (charCode > 31 && (charCode < 48 || charCode > 57)) {
- return false;
- }
- return true;
-}
+ <div class="modal-content">
+ <div class="modal-header"></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>
-var x = false;
+ </div>
+</div>
+
+<script type="text/javascript">
var lastPcSubTable = false;
function cbClick(cb, locID) {
- // TODO TOGGLE CB and set db Value
- //alert("TODO set db value and toggle cb: " + locID);
var value;
if (cb.checked == true) {
@@ -199,5 +97,9 @@ function slxOpenLocationInfo(e, locationId) {
td.load("?do=locationinfo&action=pcsubtable&id=" + locationId);
lastPcSubTable = tr;
}
- // -->
+
+function loadModal(locationId) {
+ $('#myModal').modal('show')
+ $('#myModalBody').load("?do=locationinfo&action=timetable&id=" + locationId);
+}
</script>
diff --git a/modules-available/locationinfo/templates/pcsubtable.html b/modules-available/locationinfo/templates/pcsubtable.html
index 0359813b..1a7ea81e 100644
--- a/modules-available/locationinfo/templates/pcsubtable.html
+++ b/modules-available/locationinfo/templates/pcsubtable.html
@@ -2,7 +2,8 @@
<br>
<table style="margin-bottom:0px">
<tr>
- <th width=120>{{lang_pcID}}</th>
+ <th width=320>{{lang_pcID}}</th>
+ <th width=120>{{lang_pcIP}}</th>
<th width=50>{{lang_pcX}}</th>
<th width=50>{{lang_pcY}}</th>
<th width=20>{{lang_pcInUse}}</th>
@@ -10,7 +11,8 @@
{{#list}}
<tr class="tablerow">
- <td>{{id}}</td>
+ <td>{{id}}</td>
+ <td>{{ip}}</td>
<td>{{x}}</td>
<td>{{y}}</td>
<td align="center">{{inUse}}</td>
diff --git a/modules-available/locationinfo/templates/timetable.html b/modules-available/locationinfo/templates/timetable.html
new file mode 100644
index 00000000..c06a70eb
--- /dev/null
+++ b/modules-available/locationinfo/templates/timetable.html
@@ -0,0 +1,64 @@
+<div>
+ <form method="post" action="?do=locationinfo">
+ <input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="action" value="updateOpeningTime">
+ <input type="hidden" name="id" value="{{id}}">
+
+ <table class="table table-condensed locations" style="margin-bottom:0px">
+ <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>
+
+ </form>
+</div>
+
+<script>
+function newOpeningTime() {
+ $('#lastOpenTimesTableElement').before('<tr>\
+ <td>\
+ <label><input type="checkbox" name="days[]" value="Monday">{{lang_shortMonday}}</label>\
+ <label><input type="checkbox" name="days[]" value="Tuesday">{{lang_shortTuesday}}</label>\
+ <label><input type="checkbox" name="days[]" value="Wednesday">{{lang_shortWednesday}}</label>\
+ <label><input type="checkbox" name="days[]" value="Thursday">{{lang_shortThursday}}</label>\
+ <label><input type="checkbox" name="days[]" value="Friday">{{lang_shortFriday}}</label>\
+ <label><input type="checkbox" name="days[]" value="Saturday">{{lang_shortSaturday}}</label>\
+ <label><input type="checkbox" name="days[]" value="Sunday">{{lang_shortSunday}}</label>\
+ <input type="hidden" name="days[]" value="-">\
+ </td>\
+ <td>\
+ <input type="time" name="openingtime[]">\
+ </td>\
+ <td>\
+ <input type="time" name="closingtime[]">\
+ </td>\
+ <td align="center">\
+ <input type="checkbox" name="dontadd[]" value="dontadd"\
+ </td>\
+ </tr>');
+}
+// <!--<button type="submit" class="btn btn-success btn-sm" onclick=>✓</button>-->\
+
+</script>