diff --git a/module/block/control.php b/module/block/control.php
index 6d9e7acb80..db7582229c 100644
--- a/module/block/control.php
+++ b/module/block/control.php
@@ -188,7 +188,7 @@ class block extends control
$inited = empty($this->config->$module->common->blockInited) ? '' : $this->config->$module->common->blockInited;
/* Init block when vist index first. */
- if(empty($blocks) and !$inited)
+ if(empty($blocks) and !$inited and !defined('KIZARD'))
{
if($this->block->initBlock($module)) die(js::reload());
}
diff --git a/module/bug/control.php b/module/bug/control.php
index 008e1a135e..d1ce72167c 100644
--- a/module/bug/control.php
+++ b/module/bug/control.php
@@ -19,9 +19,9 @@ class bug extends control
* @access public
* @return void
*/
- public function __construct()
+ public function __construct($moduleName = '', $methodName = '')
{
- parent::__construct();
+ parent::__construct($moduleName, $methodName);
$this->loadModel('product');
$this->loadModel('tree');
$this->loadModel('user');
diff --git a/module/custom/config.php b/module/custom/config.php
index ecca0f7163..955a7af2bc 100644
--- a/module/custom/config.php
+++ b/module/custom/config.php
@@ -10,4 +10,4 @@ $config->custom->canAdd['user'] = 'roleList';
$config->menu = new stdclass();
$config->menu->main = array();
-$config->menu->main['novice'] = 'my,product,project,qa,doc,report,company,admin';
+$config->menu->main['novice'] = 'my,company,product,project,qa,doc,report,admin';
diff --git a/module/product/control.php b/module/product/control.php
index d807dd631c..97fa164fa6 100644
--- a/module/product/control.php
+++ b/module/product/control.php
@@ -19,9 +19,9 @@ class product extends control
* @access public
* @return void
*/
- public function __construct()
+ public function __construct($moduleName = '', $methodName = '')
{
- parent::__construct();
+ parent::__construct($moduleName, $methodName);
/* Load need modules. */
$this->loadModel('story');
diff --git a/module/product/model.php b/module/product/model.php
index f49732f950..c5fce8e8f6 100644
--- a/module/product/model.php
+++ b/module/product/model.php
@@ -141,6 +141,7 @@ class productModel extends model
*/
public function getById($productID)
{
+ if(defined('WIZARD')) return $this->loadModel('tutorial')->getProduct();
return $this->dao->findById($productID)->from(TABLE_PRODUCT)->fetch();
}
@@ -183,6 +184,8 @@ class productModel extends model
*/
public function getPairs($mode = '')
{
+ if(defined('WIZARD')) return $this->loadModel('tutorial')->getProductPairs();
+
$orderBy = !empty($this->config->product->orderBy) ? $this->config->product->orderBy : 'isClosed';
$mode .= $this->cookie->productMode;
$products = $this->dao->select('*, IF(INSTR(" closed", status) < 2, 0, 1) AS isClosed')
@@ -363,6 +366,8 @@ class productModel extends model
*/
public function getStories($productID, $branch, $browseType, $queryID, $moduleID, $sort, $pager)
{
+ if(defined('WIZARD')) return $this->loadModel('tutorial')->getStories();
+
$this->loadModel('story');
/* Set modules and browse type. */
diff --git a/module/project/model.php b/module/project/model.php
index 4d7d1ea07f..8115dcb6ec 100644
--- a/module/project/model.php
+++ b/module/project/model.php
@@ -520,6 +520,8 @@ class projectModel extends model
*/
public function getPairs($mode = '')
{
+ if(defined('KIZARD')) return $this->loadModel('tutorial')->getProjectPairs();
+
$orderBy = !empty($this->config->project->orderBy) ? $this->config->project->orderBy : 'isDone, status';
$mode .= $this->cookie->projectMode;
/* Order by status's content whether or not done */
@@ -840,6 +842,8 @@ class projectModel extends model
*/
public function getById($projectID, $setImgSize = false)
{
+ if(defined('WIZARD')) return $this->loadModel('tutorial')->getProject();
+
$project = $this->dao->findById((int)$projectID)->from(TABLE_PROJECT)->fetch();
if(!$project) return false;
@@ -901,6 +905,11 @@ class projectModel extends model
*/
public function getProducts($projectID, $withBranch = true)
{
+ if(defined('WIZARD'))
+ {
+ if(!$withBranch) return $this->loadModel('tutorial')->getProductPairs();
+ return $this->loadModel('tutorial')->getProjectProducts();
+ }
$query = $this->dao->select('t2.id, t2.name, t2.type, t1.branch')->from(TABLE_PROJECTPRODUCT)->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')
->on('t1.product = t2.id')
diff --git a/module/project/view/task.html.php b/module/project/view/task.html.php
index 2b5f286f89..7832f5a43e 100644
--- a/module/project/view/task.html.php
+++ b/module/project/view/task.html.php
@@ -27,14 +27,14 @@ js::set('browseType', $browseType);
if($productID)
{
$product = $this->product->getById($productID);
- $removeLink = $browseType == 'byproduct' ? inlink('task', "projectID=$projectID&browseType=$status¶m=0&orderBy=$orderBy&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}") : 'javascript:removeCookieByKey("browseParam")';
+ $removeLink = $browseType == 'byproduct' ? inlink('task', "projectID=$projectID&browseType=$status¶m=0&orderBy=$orderBy&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}") : 'javascript:removeCookieByKey("productBrowseParam")';
echo $product->name;
echo ' ' . html::a($removeLink, "") . ' ';
}
elseif($moduleID)
{
$module = $this->tree->getById($moduleID);
- $removeLink = $browseType == 'bymodule' ? inlink('task', "projectID=$projectID&browseType=$status¶m=0&orderBy=$orderBy&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}") : 'javascript:removeCookieByKey("browseParam")';
+ $removeLink = $browseType == 'bymodule' ? inlink('task', "projectID=$projectID&browseType=$status¶m=0&orderBy=$orderBy&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}") : 'javascript:removeCookieByKey("moduleBrowseParam")';
echo $module->name;
echo ' ' . html::a($removeLink, "") . ' ';
}
diff --git a/module/search/view/buildform.html.php b/module/search/view/buildform.html.php
index de9d53f7a7..43f52ab30a 100644
--- a/module/search/view/buildform.html.php
+++ b/module/search/view/buildform.html.php
@@ -431,6 +431,6 @@ foreach($fieldParams as $fieldName => $param)
diff --git a/module/story/model.php b/module/story/model.php
index 5dc52f0caf..fcb64d38b6 100644
--- a/module/story/model.php
+++ b/module/story/model.php
@@ -1218,6 +1218,8 @@ class storyModel extends model
*/
public function getProductStories($productID = 0, $branch = 0, $moduleIds = 0, $status = 'all', $orderBy = 'id_desc', $pager = null)
{
+ if(defined('WIZARD')) return $this->loadModel('tutorial')->getStories();
+
if(is_array($branch))
{
unset($branch[0]);
@@ -1498,6 +1500,8 @@ class storyModel extends model
*/
public function getProjectStories($projectID = 0, $orderBy = 'pri_asc,id_desc', $type = 'byModule', $param = 0, $pager = null)
{
+ if(defined('WIZARD')) return $this->loadModel('tutorial')->getProjectStories();
+
$modules = ($type == 'byModule' and $param) ? $this->dao->select('*')->from(TABLE_MODULE)->where('path')->like("%,$param,%")->andWhere('type')->eq('story')->fetchPairs('id', 'id') : array();
$stories = $this->dao->select('distinct t1.*, t2.*,t3.branch as productBranch,t4.type as productType,t2.version as version')->from(TABLE_PROJECTSTORY)->alias('t1')
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id')
@@ -1540,6 +1544,7 @@ class storyModel extends model
*/
public function getProjectStoryPairs($projectID = 0, $productID = 0, $branch = 0, $moduleIds = 0, $type = 'full')
{
+ if(defined('WIZARD')) return $this->loadModel('tutorial')->getProjectStoryPairs();
$stories = $this->dao->select('t2.id, t2.title, t2.module, t2.pri, t2.estimate, t3.name AS product')
->from(TABLE_PROJECTSTORY)->alias('t1')
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id')
diff --git a/module/tutorial/control.php b/module/tutorial/control.php
index ec6c526036..a47495a2b7 100644
--- a/module/tutorial/control.php
+++ b/module/tutorial/control.php
@@ -51,4 +51,23 @@ class tutorial extends control
$this->view->referer = base64_decode($referer);
$this->display();
}
+
+ /**
+ * Wizard.
+ *
+ * @param string $module
+ * @param string $method
+ * @param string $params
+ * @access public
+ * @return void
+ */
+ public function wizard($module, $method, $params = '')
+ {
+ define('WIZARD', true);
+ if($_POST)
+ {
+ die();
+ }
+ die($this->fetch($module, $method, $params));
+ }
}
diff --git a/module/tutorial/model.php b/module/tutorial/model.php
new file mode 100644
index 0000000000..4db33625e6
--- /dev/null
+++ b/module/tutorial/model.php
@@ -0,0 +1,175 @@
+
+ * @package tutorial
+ * @version $Id$
+ * @link http://www.zentao.net
+ */
+class tutorialModel extends model
+{
+ /**
+ * Get tutorial product pairs.
+ *
+ * @access public
+ * @return array
+ */
+ public function getProductPairs()
+ {
+ return array(1 => 'Test product');
+ }
+
+ /**
+ * Get tutorial product.
+ *
+ * @access public
+ * @return object
+ */
+ public function getProduct()
+ {
+ $product = new stdclass();
+ $product->id = 1;
+ $product->name = 'Test product';
+ $product->code = 'test';
+ $product->type = 'normal';
+ $product->status = 'normal';
+ $product->desc = '';
+ $product->PO = $this->app->user->account;
+ $product->QD = '';
+ $product->RD = '';
+ $product->acl = 'open';
+ $product->createdBy = $this->app->user->account;
+ $product->createdDate = helper::now();
+ $product->createdVersion = '8.1.3';
+ $product->order = 10;
+ $product->deleted = '0';
+
+ return $product;
+ }
+
+ /**
+ * Get tutorial stories.
+ *
+ * @access public
+ * @return array
+ */
+ public function getStories()
+ {
+ $story = new stdclass();
+ $story->id = 1;
+ $story->product = 1;
+ $story->branch = 0;
+ $story->module = 0;
+ $story->plan = '';
+ $story->planTitle = '';
+ $story->color = '';
+ $story->source = 'po';
+ $story->fromBug = 0;
+ $story->title = 'Test story';
+ $story->keywords = '';
+ $story->type = '';
+ $story->pri = 3;
+ $story->estimate = 1;
+ $story->status = 'active';
+ $story->stage = 'wait';
+ $story->openedBy = $this->app->user->account;
+ $story->openedDate = helper::now();
+ $story->assignedTo = '';
+ $story->assignedDate = '';
+ $story->reviewedBy = $this->app->user->account;
+ $story->reviewedDate = helper::now();
+ $story->closedBy = '';
+ $story->closedDate = '';
+ $story->closedReason = '';
+ $story->toBug = 0;
+ $story->childStories = '';
+ $story->linkStories = '';
+ $story->duplicateStory = 0;
+ $story->version = 1;
+ $story->deleted = '0';
+
+ $stories = array();
+ $stories[] = $story;
+ $story = json_decode(json_encode($stories[0]));
+ $story->id = 2;
+ $story->title = 'Test story 2';
+ $stories[] = $story;
+ return $stories;
+ }
+
+ /**
+ * Get tutorial project pairs.
+ *
+ * @access public
+ * @return array
+ */
+ public function getProjectPairs()
+ {
+ return array(1 => 'Test project');
+ }
+
+ /**
+ * Get tutorial project.
+ *
+ * @access public
+ * @return object
+ */
+ public function getProject()
+ {
+ $project = new stdclass();
+ $project->id = 1;
+ $project->type = 'sprint';
+ $project->name = 'Test project';
+ $project->code = 'test';
+ $project->begin = date('Y-m-d', strtotime('-7 days'));
+ $project->end = date('Y-m-d', strtotime('+7 days'));
+ $project->days = 10;
+ $project->status = 'wait';
+ $project->pri = '1';
+ $project->desc = '';
+ $project->goal = '';
+ $project->acl = 'open';
+ return $project;
+ }
+
+ /**
+ * Get tutorial project products.
+ *
+ * @access public
+ * @return array
+ */
+ public function getProjectProducts()
+ {
+ $product = $this->getProduct();
+ return array($product->id => $product);
+ }
+
+ /**
+ * Get tutorial project stories.
+ *
+ * @access public
+ * @return array
+ */
+ public function getProjectStories()
+ {
+ $stories = $this->getStories();
+ $story = $stories[0];
+ return array($story->id => $story);
+ }
+
+ /**
+ * Get tutorial project story pairs.
+ *
+ * @access public
+ * @return array
+ */
+ public function getProjectStoryPairs()
+ {
+ $stories = $this->getStories();
+ $story = $stories[0];
+ return array($story->id => $story->title);
+ }
+}