From 240b81f508dcfac9c8dd738ba44e9b8cede4a1c9 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 27 Apr 2016 08:30:32 +0800 Subject: [PATCH] * adjust for tutorial. --- module/common/model.php | 6 ++++-- module/common/view/header.lite.html.php | 4 ++-- module/story/control.php | 4 ++-- module/task/control.php | 4 ++-- module/tutorial/control.php | 6 +++++- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/module/common/model.php b/module/common/model.php index d91afeaaae..6882d522b2 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -474,8 +474,8 @@ class commonModel extends model /* get current module and method. */ $isTutorialMode = commonModel::isTutorialMode(); - $currentModule = $isTutorialMode ? constant('WIZARD_MODULE') : $app->getModuleName(); - $currentMethod = $isTutorialMode ? constant('WIZARD_METHOD') : $app->getMethodName(); + $currentModule = ($isTutorialMode and defined('WIZARD_MODULE')) ? WIZARD_MODULE : $app->getModuleName(); + $currentMethod = ($isTutorialMode and defined('WIZARD_METHOD')) ? WIZARD_METHOD : $app->getMethodName(); $menu = customModel::getModuleMenu($moduleName); /* The beginning of the menu. */ @@ -1006,6 +1006,8 @@ class commonModel extends model if($onlyCondition) { $queryCondition = explode('WHERE', $sql); + if(!isset($queryCondition[1])) return true; + $queryCondition = explode('ORDER', $queryCondition[1]); $queryCondition = str_replace('t1.', '', $queryCondition[0]); } diff --git a/module/common/view/header.lite.html.php b/module/common/view/header.lite.html.php index 6650647fc7..3ff6231cfe 100755 --- a/module/common/view/header.lite.html.php +++ b/module/common/view/header.lite.html.php @@ -37,8 +37,8 @@ $clientTheme = $this->app->getClientTheme(); if(commonModel::isTutorialMode()) { - $wizardModule = constant('WIZARD_MODULE'); - $wizardMethod = constant('WIZARD_METHOD'); + $wizardModule = defined('WIZARD_MODULE') ? WIZARD_MODULE : ''; + $wizardMethod = defined('WIZARD_METHOD') ? WIZARD_METHOD : ''; $requiredFields = ''; if(isset($config->$wizardModule->$wizardMethod->requiredFields)) $requiredFields = str_replace(' ', '', $config->$wizardModule->$wizardMethod->requiredFields); echo ""; diff --git a/module/story/control.php b/module/story/control.php index e06c6d9db5..c33fc31155 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -17,9 +17,9 @@ class story extends control * @access public * @return void */ - public function __construct() + public function __construct($module = '', $method = '') { - parent::__construct(); + parent::__construct($module, $method); $this->loadModel('product'); $this->loadModel('project'); $this->loadModel('tree'); diff --git a/module/task/control.php b/module/task/control.php index 616cb7c8b6..03c7ee2d6d 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -17,9 +17,9 @@ class task extends control * @access public * @return void */ - public function __construct() + public function __construct($module = '', $method = '') { - parent::__construct(); + parent::__construct($module, $method); $this->loadModel('project'); $this->loadModel('story'); $this->loadModel('tree'); diff --git a/module/tutorial/control.php b/module/tutorial/control.php index 1cbcf7ee9d..114e4d4058 100644 --- a/module/tutorial/control.php +++ b/module/tutorial/control.php @@ -80,12 +80,16 @@ class tutorial extends control */ public function wizard($module, $method, $params = '') { + define('WIZARD', true); define('WIZARD_MODULE', $module); define('WIZARD_METHOD', $method); $params = helper::safe64Decode($params); if($_POST) { - die(js::locate(helper::createLink('tutorial', 'wizard', "module=$module&method=$method¶ms=$params"), 'parent')); + $target = 'parent'; + if(($module == 'story' or $module == 'task' or $module == 'bug') and $method == 'create') $target = 'self'; + if($module == 'project' and $method == 'linkStory') $target = 'self'; + die(js::locate(helper::createLink('tutorial', 'wizard', "module=$module&method=$method¶ms=" . helper::safe64Encode($params)), $target)); } die($this->fetch($module, $method, $params)); }