summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/statistics')
-rw-r--r--modules-available/statistics/inc/parser.inc.php26
-rw-r--r--modules-available/statistics/lang/de/permissions.json15
-rw-r--r--modules-available/statistics/lang/en/permissions.json15
-rw-r--r--modules-available/statistics/page.inc.php6
-rw-r--r--modules-available/statistics/pages/projectors.inc.php2
-rw-r--r--modules-available/statistics/templates/machine-hdds.html6
6 files changed, 52 insertions, 18 deletions
diff --git a/modules-available/statistics/inc/parser.inc.php b/modules-available/statistics/inc/parser.inc.php
index 679055a7..b179b4a3 100644
--- a/modules-available/statistics/inc/parser.inc.php
+++ b/modules-available/statistics/inc/parser.inc.php
@@ -151,24 +151,44 @@ class Parser {
$type = strtolower($out[4]);
if ($type === '5' || $type === 'f' || $type === '85') {
continue;
+ } elseif ($type === '44') {
+ $out[5] = 'OpenSLX-ID44';
+ $color = '#5c1';
+ } elseif ($type === '45') {
+ $out[5] = 'OpenSLX-ID45';
+ $color = '#0d7';
+ } elseif ($type === '82') {
+ $color = '#48f';
+ } else {
+ $color = '#e55';
}
+
$partsize = round(($out[3] - $out[2]) * $mbrToMbFactor);
$hdd['partitions'][] = array(
'id' => $out[1],
'name' => $out[1],
'size' => round($partsize / 1024, $partsize < 1024 ? 1 : 0),
- 'type' => ($type === '44' ? 'OpenSLX' : $out[5]),
+ 'type' => $out[5],
);
$hdd['json'][] = array(
'label' => $out[1],
'value' => $partsize,
- 'color' => ($type === '44' ? '#4d4' : ($type === '82' ? '#48f' : '#e55')),
+ 'color' => $color,
);
$hdd['used'] += $partsize;
} elseif (isset($hdd) && $sectorToMbFactor !== 0 && preg_match(',^\s*(\d+)\s+(\d+)[\+\-]?\s+(\d+)[\+\-]?\s+\S+\s+([0-9a-f]+)\s+(.*)$,i', $line, $out)) {
// --- GPT: Partition entry ---
// Some partition
$type = $out[5];
+ if ($type === 'OpenSLX-ID44') {
+ $color = '#5c1';
+ } elseif ($type === 'OpenSLX-ID45') {
+ $color = '#0d7';
+ } elseif ($type === 'Linux swap') {
+ $color = '#48f';
+ } else {
+ $color = '#e55';
+ }
$id = $hdd['devid'] . '-' . $out[1];
$partsize = round(($out[3] - $out[2]) * $sectorToMbFactor);
$hdd['partitions'][] = array(
@@ -180,7 +200,7 @@ class Parser {
$hdd['json'][] = array(
'label' => $id,
'value' => $partsize,
- 'color' => ($type === 'OpenSLX-ID44' ? '#4d4' : ($type === 'Linux swap' ? '#48f' : '#e55')),
+ 'color' => $color,
);
$hdd['used'] += $partsize;
}
diff --git a/modules-available/statistics/lang/de/permissions.json b/modules-available/statistics/lang/de/permissions.json
index 7b7db89a..8579b28f 100644
--- a/modules-available/statistics/lang/de/permissions.json
+++ b/modules-available/statistics/lang/de/permissions.json
@@ -1,5 +1,12 @@
{
- "view": "Statistiken anschauen.",
- "machine.note": "Anmerkungen zu einem Rechner speichern.",
- "machine.delete": "Rechner löschen."
-}
+ "hardware.projectors.edit": "Beamerzuweisung bearbeiten",
+ "hardware.projectors.view": "Beamerzuweisung anzeigen",
+ "machine.delete": "Rechner l\u00f6schen.",
+ "machine.note": "Anmerkungen zu einem Rechner speichern.",
+ "machine.note.edit": "Anmerkungen bearbeiten",
+ "machine.note.view": "Anmerkungen anzeigen",
+ "machine.view-details": "Clientinformationen anzeigen",
+ "view": "Statistiken anschauen.",
+ "view.list": "Clientliste anzeigen",
+ "view.summary": "Visualisierung anzeigen"
+} \ No newline at end of file
diff --git a/modules-available/statistics/lang/en/permissions.json b/modules-available/statistics/lang/en/permissions.json
index 01acdb8a..445f96b8 100644
--- a/modules-available/statistics/lang/en/permissions.json
+++ b/modules-available/statistics/lang/en/permissions.json
@@ -1,5 +1,12 @@
{
- "view": "View statistics.",
- "machine.note": "Save client notes.",
- "machine.delete": "Delete clients."
-}
+ "hardware.projectors.edit": "Edit beamer assignment",
+ "hardware.projectors.view": "Show beamer assignment",
+ "machine.delete": "Delete clients.",
+ "machine.note": "Save client notes.",
+ "machine.note.edit": "Edit notes",
+ "machine.note.view": "Show notes",
+ "machine.view-details": "Show client details",
+ "view": "View statistics.",
+ "view.list": "Show client list",
+ "view.summary": "Show visualization"
+} \ No newline at end of file
diff --git a/modules-available/statistics/page.inc.php b/modules-available/statistics/page.inc.php
index 3baac190..a1c4f0c9 100644
--- a/modules-available/statistics/page.inc.php
+++ b/modules-available/statistics/page.inc.php
@@ -227,7 +227,7 @@ class Page_Statistics extends Page
if (in_array($row['locationid'], $allowedLocations)) {
$delete[] = $row['machineuuid'];
} else {
- Message::addError('no-permission-location', $row['locationid']);
+ Message::addError('locations.no-permission-location', $row['locationid']);
}
}
if (!empty($delete)) {
@@ -266,7 +266,7 @@ class Page_Statistics extends Page
if (!$filterSet->setAllowedLocationsFromPermission('view.' . $this->show)) {
Message::addError('main.no-permission');
- Util::redirect('?do=statistics');
+ Util::redirect('?do=main');
}
if ($this->show === 'list') {
@@ -866,7 +866,7 @@ class Page_Statistics extends Page
Parser::parsePci($client['lspci1'], $client['lspci2'], $section[2]);
}
if (isset($hdds['hdds']) && $section[1] === 'smartctl') {
- // This currently required that the partition table section comes first...
+ // This currently requires that the partition table section comes first...
Parser::parseSmartctl($hdds['hdds'], $section[2]);
}
}
diff --git a/modules-available/statistics/pages/projectors.inc.php b/modules-available/statistics/pages/projectors.inc.php
index cdd0195e..cc808cf0 100644
--- a/modules-available/statistics/pages/projectors.inc.php
+++ b/modules-available/statistics/pages/projectors.inc.php
@@ -19,7 +19,7 @@ class SubPage
Util::traceError('Param hwid missing');
}
if ($action === 'addprojector') {
- Database::exec('INSERT INTO statistic_hw_prop (hwid, prop, value)'
+ Database::exec('INSERT IGNORE INTO statistic_hw_prop (hwid, prop, value)'
. ' VALUES (:hwid, :prop, :value)', array(
'hwid' => $hwid,
'prop' => 'projector',
diff --git a/modules-available/statistics/templates/machine-hdds.html b/modules-available/statistics/templates/machine-hdds.html
index fd6cf1be..b839dfca 100644
--- a/modules-available/statistics/templates/machine-hdds.html
+++ b/modules-available/statistics/templates/machine-hdds.html
@@ -20,7 +20,7 @@
<div>{{lang_powerOnTime}}: {{s_PowerOnHours}}&thinsp;{{lang_hours}} ({{PowerOnTime}})</div>
{{/s_PowerOnHours}}
<div class="row">
- <div class="col-sm-6">
+ <div class="col-sm-7">
<table class="table table-condensed table-striped table-responsive">
<tr>
<th>{{lang_partName}}</th>
@@ -30,14 +30,14 @@
{{#partitions}}
<tr id="{{id}}">
<td>{{name}}</td>
- <td class="text-right">{{size}}&thinsp;GiB</td>
+ <td class="text-right text-nowrap">{{size}}&thinsp;GiB</td>
<td>{{type}}</td>
</tr>
{{/partitions}}
</table>
<div class="slx-bold">{{lang_total}}: {{size}}&thinsp;GiB</div>
</div>
- <div class="col-sm-6">
+ <div class="col-sm-5">
<canvas id="{{devid}}-chart" style="width:100%;height:250px"></canvas>
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function() {