diff --git a/db/update16.3.sql b/db/update16.3.sql index d3d4dc4e4f..2cc57f0be4 100644 --- a/db/update16.3.sql +++ b/db/update16.3.sql @@ -12,3 +12,5 @@ ALTER TABLE `zt_searchindex` ADD `vision` varchar(10) NOT NULL DEFAULT 'rnd' AFT ALTER TABLE `zt_config` ADD `vision` varchar(10) NOT NULL DEFAULT '' AFTER `id`; ALTER TABLE `zt_config` DROP INDEX `unique`, ADD UNIQUE `unique` (`vision`,`owner`,`module`,`section`,`key`); ALTER TABLE `zt_todo` ADD `vision` varchar(10) NOT NULL DEFAULT 'rnd' AFTER `deleted`; +ALTER TABLE `zt_block` ADD `vision` varchar(10) NOT NULL DEFAULT 'rnd' AFTER `account`; +ALTER TABLE `zt_block` DROP INDEX `account_module_type_order`, ADD UNIQUE `account_vision_module_type_order` (`account`, `vision`, `module`, `type`, `order`); diff --git a/db/zentao.sql b/db/zentao.sql index 11ed104b30..636962d75c 100644 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -124,6 +124,7 @@ CREATE TABLE `zt_apistruct_spec` ( CREATE TABLE IF NOT EXISTS `zt_block` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `account` char(30) NOT NULL, + `vision` varchar(10) NOT NULL DEFAULT 'rnd', `module` varchar(20) NOT NULL, `type` char(30) NOT NULL, `title` varchar(100) NOT NULL, @@ -135,7 +136,7 @@ CREATE TABLE IF NOT EXISTS `zt_block` ( `height` smallint(5) unsigned NOT NULL DEFAULT '0', `hidden` tinyint(1) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`), - UNIQUE KEY `account_module_type_order` (`account`,`module`,`type`,`order`), + UNIQUE KEY `account_vision_module_type_order` (`account`,`vision`,`module`,`type`,`order`), KEY `account` (`account`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- DROP TABLE IF EXISTS `zt_branch`; diff --git a/extension/lite/block/ext/config/lite.php b/extension/lite/block/ext/config/lite.php new file mode 100644 index 0000000000..60ccd32b16 --- /dev/null +++ b/extension/lite/block/ext/config/lite.php @@ -0,0 +1,2 @@ +block->closed = '|html,|contribute'; diff --git a/extension/lite/block/ext/lang/zh-cn/lite.php b/extension/lite/block/ext/lang/zh-cn/lite.php index c73debea5e..74d2caa454 100644 --- a/extension/lite/block/ext/lang/zh-cn/lite.php +++ b/extension/lite/block/ext/lang/zh-cn/lite.php @@ -15,9 +15,32 @@ $lang->block->story = '目标'; $lang->block->storyCount = '目标数'; +unset($lang->block->default['full']['my']['9']); + +$lang->block->default['full']['my']['5']['title'] = '看板列表'; +$lang->block->default['full']['my']['5']['block'] = 'scrumlist'; +$lang->block->default['full']['my']['5']['source'] = 'execution'; + +$lang->block->default['full']['my']['5']['params']['type'] = 'doing'; +$lang->block->default['full']['my']['5']['params']['orderBy'] = 'id_desc'; +$lang->block->default['full']['my']['5']['params']['count'] = '15'; + $lang->block->modules['kanban']['index'] = new stdclass(); $lang->block->modules['kanban']['index']->availableBlocks = new stdclass(); $lang->block->modules['kanban']['index']->availableBlocks->scrumoverview = '项目概况'; $lang->block->modules['kanban']['index']->availableBlocks->scrumlist = $lang->executionCommon . '列表'; $lang->block->modules['kanban']['index']->availableBlocks->sprint = $lang->executionCommon . '总览'; $lang->block->modules['kanban']['index']->availableBlocks->projectdynamic = '最新动态'; + +$lang->block->modules['project']->availableBlocks = new stdclass(); +$lang->block->modules['project']->availableBlocks->project = '项目列表'; + +$lang->block->modules['execution'] = new stdclass(); +$lang->block->modules['execution']->availableBlocks = new stdclass(); +$lang->block->modules['execution']->availableBlocks->statistic = $lang->execution->common . '统计'; +$lang->block->modules['execution']->availableBlocks->overview = $lang->execution->common . '总览'; +$lang->block->modules['execution']->availableBlocks->list = $lang->execution->common . '列表'; +$lang->block->modules['execution']->availableBlocks->task = '卡片列表'; + +unset($lang->block->moduleList['product']); +unset($lang->block->moduleList['qa']); diff --git a/module/block/control.php b/module/block/control.php index 1b1d60e25f..5b6130fa55 100644 --- a/module/block/control.php +++ b/module/block/control.php @@ -226,6 +226,7 @@ class block extends control { if($this->loadModel('user')->isLogon()) $this->session->set('blockModule', $module); $blocks = $this->block->getBlockList($module, $type); + $vision = $this->config->vision; $commonField = 'common'; if($module == 'project' and $projectID) @@ -234,7 +235,12 @@ class block extends control $commonField = $project->model . 'common'; } - $inited = empty($this->config->$module->$commonField->blockInited) ? '' : $this->config->$module->$commonField->blockInited; + $inited = $this->dao->select('*')->from(TABLE_CONFIG) + ->where('module')->eq($module) + ->andWhere('owner')->eq($this->app->user->account) + ->andWhere('`key`')->eq('blockInited') + ->andWhere('vision')->eq($vision) + ->fetch('value'); /* Init block when vist index first. */ if((empty($blocks) and !$inited and !defined('TUTORIAL'))) @@ -1873,8 +1879,18 @@ class block extends control { if($confirm != 'yes') die(js::confirm($this->lang->block->confirmReset, inlink('ajaxReset', "module=$module&confirm=yes"))); - $this->dao->delete()->from(TABLE_BLOCK)->where('module')->eq($module)->andWhere('account')->eq($this->app->user->account)->exec(); - $this->dao->delete()->from(TABLE_CONFIG)->where('module')->eq($module)->andWhere('owner')->eq($this->app->user->account)->andWhere('`key`')->eq('blockInited')->exec(); + $this->dao->delete()->from(TABLE_BLOCK) + ->where('module')->eq($module) + ->andWhere('vision')->eq($this->config->vision) + ->andWhere('account')->eq($this->app->user->account) + ->exec(); + + $this->dao->delete()->from(TABLE_CONFIG) + ->where('module')->eq($module) + ->andWhere('vision')->eq($this->config->vision) + ->andWhere('owner')->eq($this->app->user->account) + ->andWhere('`key`')->eq('blockInited') + ->exec(); die(js::reload('parent')); } diff --git a/module/block/model.php b/module/block/model.php index 510fcb22d9..2a581efa4e 100644 --- a/module/block/model.php +++ b/module/block/model.php @@ -133,6 +133,7 @@ class blockModel extends model { $blocks = $this->dao->select('*')->from(TABLE_BLOCK)->where('account')->eq($this->app->user->account) ->andWhere('module')->eq($module) + ->andWhere('vision')->eq($this->config->vision) ->andWhere('hidden')->eq(0) ->beginIF($type)->andWhere('type')->eq($type)->fi() ->orderBy('`order`') @@ -231,19 +232,21 @@ class blockModel extends model { $flow = isset($this->config->global->flow) ? $this->config->global->flow : 'full'; $account = $this->app->user->account; + $vision = $this->config->vision; + if($module == 'project') { $blocks = $this->lang->block->default[$type]['project']; /* Mark project block has init. */ - $this->loadModel('setting')->setItem("$account.$module.{$type}common.blockInited", true); + $this->loadModel('setting')->setItem("$account.$module.{$type}common.blockInited@$vision", true); } else { $blocks = $module == 'my' ? $this->lang->block->default[$flow][$module] : $this->lang->block->default[$module]; /* Mark this app has init. */ - $this->loadModel('setting')->setItem("$account.$module.common.blockInited", true); + $this->loadModel('setting')->setItem("$account.$module.common.blockInited@$vision", true); } $this->loadModel('setting')->setItem("$account.$module.block.initVersion", $this->config->block->version); @@ -254,11 +257,11 @@ class blockModel extends model $block['type'] = $type; $block['account'] = $account; $block['params'] = isset($block['params']) ? helper::jsonEncode($block['params']) : ''; + $block['vision'] = $this->config->vision; if(!isset($block['source'])) $block['source'] = $module; $this->dao->replace(TABLE_BLOCK)->data($block)->exec(); } - return !dao::isError(); } @@ -457,6 +460,7 @@ class blockModel extends model public function getProjectParams() { $this->app->loadLang('project'); + $params = new stdclass(); $params->type['name'] = $this->lang->block->type; $params->type['options'] = $this->lang->project->featureBar; $params->type['control'] = 'select'; @@ -477,6 +481,7 @@ class blockModel extends model public function getProjectTeamParams() { $this->app->loadLang('project'); + $params = new stdclass(); $params->type['name'] = $this->lang->block->type; $params->type['options'] = $this->lang->project->featureBar; $params->type['control'] = 'select'; @@ -507,6 +512,7 @@ class blockModel extends model */ public function getProductParams() { + $params = new stdclass(); $params->type['name'] = $this->lang->block->type; $params->type['options'] = $this->lang->block->typeList->product; $params->type['control'] = 'select'; @@ -715,6 +721,7 @@ class blockModel extends model */ public function getExecutionParams() { + $params = new stdclass(); $params->type['name'] = $this->lang->block->type; $params->type['options'] = $this->lang->block->typeList->execution; $params->type['control'] = 'select'; @@ -730,6 +737,7 @@ class blockModel extends model */ public function getAssignToMeParams() { + $params = new stdclass(); $params->todoCount['name'] = $this->lang->block->todoCount; $params->todoCount['default'] = 20; $params->todoCount['control'] = 'input';