diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/dashboard.inc.php | 17 | ||||
-rw-r--r-- | inc/dictionary.inc.php | 3 | ||||
-rw-r--r-- | inc/module.inc.php | 5 | ||||
-rw-r--r-- | inc/property.inc.php | 2 | ||||
-rw-r--r-- | inc/taskmanagercallback.inc.php | 19 |
5 files changed, 31 insertions, 15 deletions
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/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); } 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() 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']; 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; } |