From ab546fefa2b7e8339d35585aa55da30ce6bece1d Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 9 Jun 2016 16:06:07 +0200 Subject: [dictionary] Handle case where we have no Page --- inc/dictionary.inc.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/dictionary.inc.php b/inc/dictionary.inc.php index 6ae8fb9b..01651b88 100644 --- a/inc/dictionary.inc.php +++ b/inc/dictionary.inc.php @@ -79,7 +79,8 @@ class Dictionary public static function translateFile($path, $tag) { - // TODO: Handle case where we have no active module/no page class + if (!class_exists('Page') || Page::getModule() === false) + return false; // We have no page - return false for now, as we're most likely running in api or install mode return self::translateFileModule(Page::getModule()->getIdentifier(), $path, $tag); } -- cgit v1.2.3-55-g7522 From 1b5355fb961f62508d3a3c356182421149ec49a1 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 9 Jun 2016 17:50:38 +0200 Subject: [module] PageTitle: Fallback to module name --- inc/module.inc.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/module.inc.php b/inc/module.inc.php index 13d9c1e4..58484f34 100644 --- a/inc/module.inc.php +++ b/inc/module.inc.php @@ -197,7 +197,10 @@ class Module public function getPageTitle() { - return Dictionary::translateFileModule($this->name, 'module', 'page_title'); + $val = Dictionary::translateFileModule($this->name, 'module', 'page_title'); + if ($val !== false) + return $val; + return $this->getDisplayName(); } public function getCategory() -- cgit v1.2.3-55-g7522 From 7982cce9f5da57f3d41afe8072965fad312effb9 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 9 Jun 2016 17:51:05 +0200 Subject: [property] Increate ML list download timeout --- inc/property.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/property.inc.php b/inc/property.inc.php index eae5033c..4a6c3720 100644 --- a/inc/property.inc.php +++ b/inc/property.inc.php @@ -100,7 +100,7 @@ class Property if (!isset($task['id'])) return 'Could not start list download (' . Message::asString() . ')'; if ($task['statusCode'] !== TASK_FINISHED) { - $task = Taskmanager::waitComplete($task['id'], 4000); + $task = Taskmanager::waitComplete($task['id'], 5000); } if ($task['statusCode'] !== TASK_FINISHED || !isset($task['data']['content'])) { return $task['data']['error']; -- cgit v1.2.3-55-g7522 From eb448fcc611b87108b00b3d402188519a54b5764 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 9 Jun 2016 18:06:06 +0200 Subject: Remove remaining references to schema version --- inc/taskmanagercallback.inc.php | 19 ++++++++++--------- modules-available/backup/page.inc.php | 4 ++-- 2 files changed, 12 insertions(+), 11 deletions(-) (limited to 'inc') diff --git a/inc/taskmanagercallback.inc.php b/inc/taskmanagercallback.inc.php index f40db297..c2a05609 100644 --- a/inc/taskmanagercallback.inc.php +++ b/inc/taskmanagercallback.inc.php @@ -29,15 +29,16 @@ class TaskmanagerCallback 'task' => $task, 'callback' => $callback, ); - if (Property::getCurrentSchemaVersion() >= 9) { - if (is_null($args)) - $data['args'] = ''; - else - $data['args'] = serialize($args); - Database::exec("INSERT INTO callback (taskid, dateline, cbfunction, args) VALUES (:task, UNIX_TIMESTAMP(), :callback, :args)", $data); + if (is_null($args)) { + $data['args'] = ''; } else { - Database::exec("INSERT INTO callback (taskid, dateline, cbfunction) VALUES (:task, UNIX_TIMESTAMP(), :callback)", $data); + $data['args'] = serialize($args); } + if (Database::exec("INSERT INTO callback (taskid, dateline, cbfunction, args)" + . " VALUES (:task, UNIX_TIMESTAMP(), :callback, :args)", $data, true) !== false) { + return; + } + Database::exec("INSERT INTO callback (taskid, dateline, cbfunction) VALUES (:task, UNIX_TIMESTAMP(), :callback)", $data); } /** @@ -47,10 +48,10 @@ class TaskmanagerCallback */ public static function getPendingCallbacks() { - if (Property::getCurrentSchemaVersion() < 9) + $res = Database::simpleQuery("SELECT taskid, cbfunction, args FROM callback", array(), true); + if ($res === false) return array(); $retval = array(); - $res = Database::simpleQuery("SELECT taskid, cbfunction, args FROM callback"); while ($row = $res->fetch(PDO::FETCH_ASSOC)) { $retval[$row['taskid']][] = $row; } diff --git a/modules-available/backup/page.inc.php b/modules-available/backup/page.inc.php index 6cd3168f..34777db8 100644 --- a/modules-available/backup/page.inc.php +++ b/modules-available/backup/page.inc.php @@ -50,7 +50,7 @@ class Page_Backup extends Page Util::redirect('?do=Backup'); } Header('Content-Type: application/octet-stream', true); - Header('Content-Disposition: attachment; filename=' . 'satellite-backup_v' . Database::getExpectedSchemaVersion() . '_' . date('Y.m.d-H.i.s') . '.tgz'); + Header('Content-Disposition: attachment; filename=' . 'satellite-backup_v16_' . date('Y.m.d-H.i.s') . '.tgz'); Header('Content-Length: ' . @filesize($task['data']['backupFile'])); while (!feof($fh)) { $data = fread($fh, 16000); @@ -95,7 +95,7 @@ class Page_Backup extends Page $this->templateData['mountid'] = $task['id']; $parent = $task['id']; } - EventLog::info('Creating backup, v' . Database::getExpectedSchemaVersion() . ' on ' . Property::getServerIp()); + EventLog::info('Creating backup on ' . Property::getServerIp()); // Finally run restore $task = Taskmanager::submit('BackupRestore', array( 'mode' => 'restore', -- cgit v1.2.3-55-g7522 From 91bfa07f909101a42476accff50981d649e725d2 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 14 Jun 2016 11:21:29 +0200 Subject: [dashboard] Add submenu feature --- inc/dashboard.inc.php | 17 ++++++++++++++--- modules-available/main/templates/main-menu.html | 3 +++ style/default.css | 6 ++++++ 3 files changed, 23 insertions(+), 3 deletions(-) (limited to 'inc') diff --git a/inc/dashboard.inc.php b/inc/dashboard.inc.php index ddea6166..3c913b76 100644 --- a/inc/dashboard.inc.php +++ b/inc/dashboard.inc.php @@ -4,6 +4,7 @@ class Dashboard { private static $iconCache = array(); + private static $subMenu = array(); public static function createMenu() { @@ -16,6 +17,7 @@ class Dashboard continue; $modByCategory[$cat][] = $module; } + $currentPage = Page::getModule()->getIdentifier(); $categories = array(); $catSort = array(); foreach ($modByCategory as $catId => $modList) { @@ -23,11 +25,15 @@ class Dashboard $sectionSort = array(); foreach ($modList as $module) { $modId = $module->getIdentifier(); - $modules[] = array( + $newEntry = array( 'displayName' => $module->getDisplayName(), - 'identifier' => $module->getIdentifier(), - 'className' => ($module->getIdentifier() === Page::getModule()->getIdentifier()) ? 'active' : '' + 'identifier' => $module->getIdentifier() ); + if ($module->getIdentifier() === $currentPage) { + $newEntry['className'] = 'active'; + $newEntry['subMenu'] = self::$subMenu; + } + $modules[] = $newEntry; if (isset($MENU_SETTING_SORT_ORDER[$modId])) { $sectionSort[] = (string)($MENU_SETTING_SORT_ORDER[$modId] + 1000); } else { @@ -82,5 +88,10 @@ class Dashboard } return 'glyphicon glyphicon-' . self::$iconCache[$module][$icon]; } + + public static function addSubmenu($url, $name) + { + self::$subMenu[] = array('url' => $url, 'name' => $name); + } } \ No newline at end of file diff --git a/modules-available/main/templates/main-menu.html b/modules-available/main/templates/main-menu.html index af8f833f..6538e2a3 100644 --- a/modules-available/main/templates/main-menu.html +++ b/modules-available/main/templates/main-menu.html @@ -33,6 +33,9 @@ diff --git a/style/default.css b/style/default.css index 3701c43f..c77149da 100644 --- a/style/default.css +++ b/style/default.css @@ -469,6 +469,12 @@ section{ padding-left: 15px; } +li.slx-submenu { + font-size: 80%; + font-weight: bold; + padding-left: 1em; +} + /* * Sysconfig Module Editor */ -- cgit v1.2.3-55-g7522