summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2017-07-06 13:12:21 +0200
committerSimon Rettberg2017-07-06 13:12:21 +0200
commit03997075bec3a0fd436c881a748b108acc7a98fd (patch)
tree2f17dc7ccebadad9cf8b60fd856b6603a1078f47
parent[runmode] New module for managing special boot modes of clients (diff)
downloadslx-admin-03997075bec3a0fd436c881a748b108acc7a98fd.tar.gz
slx-admin-03997075bec3a0fd436c881a748b108acc7a98fd.tar.xz
slx-admin-03997075bec3a0fd436c881a748b108acc7a98fd.zip
[locationinfo] Support runmode module
-rw-r--r--modules-available/locationinfo/hooks/runmode/config.json4
-rw-r--r--modules-available/locationinfo/inc/locationinfo.inc.php11
-rw-r--r--modules-available/locationinfo/page.inc.php9
-rw-r--r--modules-available/locationinfo/templates/page-config-panel-default.html17
-rw-r--r--modules-available/locationinfo/templates/page-panels.html15
5 files changed, 44 insertions, 12 deletions
diff --git a/modules-available/locationinfo/hooks/runmode/config.json b/modules-available/locationinfo/hooks/runmode/config.json
new file mode 100644
index 00000000..8c1ebad8
--- /dev/null
+++ b/modules-available/locationinfo/hooks/runmode/config.json
@@ -0,0 +1,4 @@
+{
+ "getModeName": "LocationInfo::getPanelName",
+ "isClient": false
+} \ No newline at end of file
diff --git a/modules-available/locationinfo/inc/locationinfo.inc.php b/modules-available/locationinfo/inc/locationinfo.inc.php
index 473804cc..36a77d4f 100644
--- a/modules-available/locationinfo/inc/locationinfo.inc.php
+++ b/modules-available/locationinfo/inc/locationinfo.inc.php
@@ -75,4 +75,15 @@ class LocationInfo
);
}
+ /**
+ * @param string $uuid panel uuid
+ * @return bool|string panel name if exists, false otherwise
+ */
+ public static function getPanelName($uuid)
+ {
+ $ret = Database::queryFirst('SELECT panelname FROM locationinfo_panel WHERE paneluuid = :uuid', compact('uuid'));
+ if ($ret === false) return false;
+ return $ret['panelname'];
+ }
+
}
diff --git a/modules-available/locationinfo/page.inc.php b/modules-available/locationinfo/page.inc.php
index e8ce7b78..f5e64209 100644
--- a/modules-available/locationinfo/page.inc.php
+++ b/modules-available/locationinfo/page.inc.php
@@ -440,6 +440,10 @@ class Page_LocationInfo extends Page
$res = Database::simpleQuery('SELECT p.paneluuid, p.panelname, p.locationids,
p.paneltype FROM locationinfo_panel p
ORDER BY panelname ASC');
+ $hasRunmode = Module::isAvailable('runmode');
+ if ($hasRunmode) {
+ $runmodes = RunMode::getForModule(Page::getModule(), true);
+ }
$panels = array();
$locations = Location::getLocationsAssoc();
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
@@ -452,9 +456,12 @@ class Page_LocationInfo extends Page
if ($len < 5) {
$row['panelname'] .= str_repeat('…', 5 - $len);
}
+ if ($hasRunmode && isset($runmodes[$row['paneluuid']])) {
+ $row['assignedMachineCount'] = count($runmodes[$row['paneluuid']]);
+ }
$panels[] = $row;
}
- Render::addTemplate('page-panels', array('panels' => $panels));
+ Render::addTemplate('page-panels', compact('panels', 'hasRunmode'));
}
/**
diff --git a/modules-available/locationinfo/templates/page-config-panel-default.html b/modules-available/locationinfo/templates/page-config-panel-default.html
index fac1db03..4632a718 100644
--- a/modules-available/locationinfo/templates/page-config-panel-default.html
+++ b/modules-available/locationinfo/templates/page-config-panel-default.html
@@ -300,15 +300,14 @@
<div class="modal-dialog"> <!--style="min-width:600px;width:70%"-->
<div class="modal-content">
- <div class="modal-header">{{lang_error}}</div>
- <div class="modal-body">
- {{lang_noLocationsWarning}}
- </div>
- <div class="modal-footer">
- <a class="btn btn-primary pull-right" data-dismiss="modal">{{lang_close}}</a>
- <div class="clearfix"></div>
- </div>
- </form>
+ <div class="modal-header">{{lang_error}}</div>
+ <div class="modal-body">
+ {{lang_noLocationsWarning}}
+ </div>
+ <div class="modal-footer">
+ <a class="btn btn-primary pull-right" data-dismiss="modal">{{lang_close}}</a>
+ <div class="clearfix"></div>
+ </div>
</div>
</div>
diff --git a/modules-available/locationinfo/templates/page-panels.html b/modules-available/locationinfo/templates/page-panels.html
index 51998cea..8b567410 100644
--- a/modules-available/locationinfo/templates/page-panels.html
+++ b/modules-available/locationinfo/templates/page-panels.html
@@ -8,8 +8,11 @@
<th>{{lang_panel}}</th>
<th>{{lang_panelType}}</th>
<th>{{lang_locations}}</th>
- <th width="1"></th>
- <th width="1"></th>
+ {{#hasRunmode}}
+ <th class="slx-smallcol">{{lang_runmodeTHead}}</th>
+ {{/hasRunmode}}
+ <th class="slx-smallcol"></th>
+ <th class="slx-smallcol"></th>
</tr>
</thead>
<tbody>
@@ -27,6 +30,14 @@
<td>
{{locations}}
</td>
+ {{#hasRunmode}}
+ <td>
+ <a class="btn btn-default btn-xs" href="?do=runmode&amp;module=locationinfo&amp;modeid={{paneluuid}}">
+ <span class="glyphicon glyphicon-edit"></span>
+ </a>
+ {{assignedMachineCount}}
+ </td>
+ {{/hasRunmode}}
<td>
<a class="btn btn-default btn-xs" href="?do=locationinfo&amp;show=edit-panel&amp;uuid={{paneluuid}}">
<span class="glyphicon glyphicon-cog"></span>