summaryrefslogtreecommitdiffstats
path: root/modules-available/webinterface/page.inc.php
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/page.inc.php
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/page.inc.php')
-rw-r--r--modules-available/webinterface/page.inc.php30
1 files changed, 30 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()