summaryrefslogtreecommitdiffstats
path: root/modules-available/webinterface
diff options
context:
space:
mode:
authorSimon Rettberg2017-05-09 14:30:30 +0200
committerSimon Rettberg2017-05-09 14:30:30 +0200
commit16dc9cfeea4bc060982f0b364ddaac98095ef654 (patch)
treee5c5eaa88f17840ee86371780a9550193ceb8a4a /modules-available/webinterface
parent[locationinfo] Fix more undefined offset access (diff)
downloadslx-admin-16dc9cfeea4bc060982f0b364ddaac98095ef654.tar.gz
slx-admin-16dc9cfeea4bc060982f0b364ddaac98095ef654.tar.xz
slx-admin-16dc9cfeea4bc060982f0b364ddaac98095ef654.zip
[webinterface] Allow customizing page title prefix and logo bgcolor
Diffstat (limited to 'modules-available/webinterface')
-rw-r--r--modules-available/webinterface/page.inc.php30
-rw-r--r--modules-available/webinterface/templates/customization.html30
2 files changed, 60 insertions, 0 deletions
diff --git a/modules-available/webinterface/page.inc.php b/modules-available/webinterface/page.inc.php
index ae9a94fd..e5a25834 100644
--- a/modules-available/webinterface/page.inc.php
+++ b/modules-available/webinterface/page.inc.php
@@ -21,6 +21,9 @@ class Page_WebInterface extends Page
case 'password':
$this->actionShowHidePassword();
break;
+ case 'customization':
+ $this->actionCustomization();
+ break;
}
}
@@ -57,6 +60,17 @@ class Page_WebInterface extends Page
Util::redirect('?do=WebInterface');
}
+ private function actionCustomization()
+ {
+ $prefix = Request::post('prefix', '', 'string');
+ if (!empty($prefix) && !preg_match('/[\]\)\}\-_\s\&\$\!\/\+\*\^\>]$/', $prefix)) {
+ $prefix .= ' ';
+ }
+ Property::set('page-title-prefix', $prefix);
+ Property::set('logo-background', Request::post('bgcolor', '', 'string'));
+ Util::redirect('?do=WebInterface');
+ }
+
protected function doRender()
{
//
@@ -118,6 +132,22 @@ class Page_WebInterface extends Page
else
$data['selected_hide'] = 'checked';
Render::addTemplate('passwords', $data);
+ $data = array('prefix' => Property::get('page-title-prefix'));
+ $data['colors'] = array_map(function ($i) { return array('color' => $i); },
+ array('', 'red', 'green', 'blue', 'black', 'white', 'orange', 'gray', 'lime', 'magenta', 'yellow'));
+ $color = Property::get('logo-background');
+ foreach ($data['colors'] as &$c) {
+ if ($c['color'] === $color) {
+ $c['selected'] = 'selected';
+ $color = false;
+ break;
+ }
+ }
+ unset($c);
+ if ($color) {
+ $data['colors'][] = array('color' => $color, 'selected' => 'selected');
+ }
+ Render::addTemplate('customization', $data);
}
private function setHttpsOff()
diff --git a/modules-available/webinterface/templates/customization.html b/modules-available/webinterface/templates/customization.html
new file mode 100644
index 00000000..447404a6
--- /dev/null
+++ b/modules-available/webinterface/templates/customization.html
@@ -0,0 +1,30 @@
+<form action="?do=WebInterface" method="post">
+ <input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="action" value="customization">
+ <div class="panel panel-default">
+ <div class="panel-heading">{{lang_customization}}</div>
+ <div class="panel-body">
+ <p>{{lang_customizationDesc}}</p>
+ <div>
+ <label>
+ {{lang_pageTitlePrefix}}
+ <input type="text" class="form-control" name="prefix" value="{{prefix}}">
+ </label>
+
+ </div>
+ <div>
+ <label>
+ {{lang_logoBackground}}
+ <select class="form-control" name="bgcolor">
+ {{#colors}}
+ <option style="color:{{color}}" {{selected}}>{{color}}</option>
+ {{/colors}}
+ </select>
+ </label>
+ </div>
+ <div class="pull-right">
+ <button type="submit" class="btn btn-primary">{{lang_save}}</button>
+ </div>
+ </div>
+ </div>
+</form>