* Adjust for index block.

This commit is contained in:
tanghucheng
2022-01-26 17:22:36 +08:00
parent 5166aa63bb
commit 02281ff345
6 changed files with 59 additions and 7 deletions
+2
View File
@@ -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`);
+2 -1
View File
@@ -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`;
+2
View File
@@ -0,0 +1,2 @@
<?php
$config->block->closed = '|html,|contribute';
@@ -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']);
+19 -3
View File
@@ -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'));
}
+11 -3
View File
@@ -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';