* Add new block set method and more link.

This commit is contained in:
Yagami
2020-08-24 15:33:30 +08:00
parent fe575297f0
commit 5d75ef450c
10 changed files with 214 additions and 72 deletions
+3
View File
@@ -290,3 +290,6 @@ ALTER TABLE `zt_project` ADD `path` varchar(255) NOT NULL AFTER `parent`;
ALTER TABLE `zt_project` ADD `grade` tinyint unsigned NOT NULL AFTER `path`;
INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system','custom','','URAndSR','1'),('system','custom','','URSRName','{\"urCommon\":{\"zh-cn\":\"\\u7528\\u6237\\u9700\\u6c42\"},\"srCommon\":{\"zh-cn\":\"\\u8f6f\\u4ef6\\u9700\\u6c42\"}}'),('system','custom','','storyPoint','1');
ALTER TABLE `zt_block` ADD `type` char(30) NOT NULL AFTER `module`;
ALTER TABLE `zt_block` ADD UNIQUE `account_module_type_order` (`account`, `module`, `type`, `order`), DROP INDEX `account_module_order_type`;
+13 -7
View File
@@ -15,15 +15,21 @@ $config->block->editor = new stdclass();
$config->block->editor->set = array('id' => 'html', 'tools' => 'simple');
$config->block->longBlock = array();
$config->block->longBlock['']['flowchart'] = 'flowchart';
$config->block->longBlock['']['welcome'] = 'welcome';
$config->block->longBlock['product']['statistic'] = 'statistic';
$config->block->longBlock['project']['statistic'] = 'statistic';
$config->block->longBlock['qa']['statistic'] = 'statistic';
$config->block->longBlock['']['flowchart'] = 'flowchart';
$config->block->longBlock['']['welcome'] = 'welcome';
$config->block->longBlock['product']['statistic'] = 'statistic';
$config->block->longBlock['project']['statistic'] = 'statistic';
$config->block->longBlock['qa']['statistic'] = 'statistic';
$config->block->longBlock['program']['cmmireport'] = 'cmmireport';
$config->block->longBlock['program']['cmmiissue'] = 'cmmiissue';
$config->block->longBlock['program']['cmmirisk'] = 'cmmirisk';
$config->block->shortBlock = array();
$config->block->shortBlock['product']['overview'] = 'overview';
$config->block->shortBlock['project']['overview'] = 'overview';
$config->block->shortBlock['product']['overview'] = 'overview';
$config->block->shortBlock['project']['overview'] = 'overview';
$config->block->shortBlock['program']['cmmiestimate'] = 'cmmiestimate';
$config->block->shortBlock['program']['cmmiprogress'] = 'cmmiprogress';
$config->block->shortBlock['']['contribute'] = 'contribute';
$config->statistic = new stdclass();
$config->statistic->storyStages = array('wait', 'planned', 'developing', 'testing', 'released');
+21 -13
View File
@@ -59,6 +59,7 @@ class block extends control
if(strpos(",$closedBlock,", ",|flowchart,") === false and $this->config->global->flow == 'full') $modules['flowchart'] = $this->lang->block->lblFlowchart;
if(strpos(",$closedBlock,", ",|welcome,") === false and $this->config->global->flow == 'full') $modules['welcome'] = $this->lang->block->welcome;
if(strpos(",$closedBlock,", ",|html,") === false) $modules['html'] = 'HTML';
if(strpos(",$closedBlock,", ",|contribute,") === false) $modules['contribute'] = $this->lang->block->contribute;
$modules = array('' => '') + $modules;
$hiddenBlocks = $this->block->getHiddenBlocks();
@@ -207,11 +208,11 @@ class block extends control
public function dashboard($module, $type = '')
{
if($this->loadModel('user')->isLogon()) $this->session->set('blockModule', $module);
$blocks = $this->block->getBlockList($module);
$blocks = $this->block->getBlockList($module, $type);
$inited = empty($this->config->$module->common->blockInited) ? '' : $this->config->$module->common->blockInited;
/* Init block when vist index first. */
if(empty($blocks) and !$inited and !defined('TUTORIAL'))
if((empty($blocks) and !$inited and !defined('TUTORIAL')) || (empty($blocks) and $module == 'program'))
{
if($this->block->initBlock($module, $type)) die(js::reload());
}
@@ -322,6 +323,19 @@ class block extends control
$this->display();
}
/**
* Print contribute block.
*
* @access public
* @return void
*/
public function contribute()
{
$this->view->data = $this->block->getContributeBlockData();
$this->display();
}
/**
* Print block.
*
@@ -374,6 +388,10 @@ class block extends control
{
$html = $this->fetch('block', 'welcome');
}
elseif($block->block == 'contribute')
{
$html = $this->fetch('block', 'contribute');
}
echo $html;
}
@@ -1062,6 +1080,7 @@ class block extends control
*/
public function printCmmiReportBlock()
{
$this->loadModel('program');
$program = $this->loadModel('project')->getByID($this->session->program);
$today = date('Y-m-d', strtotime(helper::today()));
$date = date('Ymd', strtotime($this->loadModel('weekly')->getThisMonday($today)));
@@ -1455,17 +1474,6 @@ class block extends control
$this->display();
}
/**
* Print contribute block.
*
* @access public
* @return void
*/
public function printContributeBlock()
{
$this->view->data = $this->block->getContributeBlockData();
}
/**
* Print recent program block.
*
+1 -1
View File
@@ -92,7 +92,7 @@ $(function()
return true;
}
if(moduleID == 'html' || moduleID == 'dynamic' || moduleID == 'flowchart' || moduleID == 'assigntome' || moduleID == 'welcome')
if(moduleID == 'html' || moduleID == 'dynamic' || moduleID == 'flowchart' || moduleID == 'assigntome' || moduleID == 'welcome' || moduleID == 'contribute')
{
getNotSourceParams(moduleID, blockID, onFinish);
return true;
+38 -22
View File
@@ -36,6 +36,7 @@ $lang->block->done = '已完成';
$lang->block->lblFlowchart = '流程图';
$lang->block->welcome = '欢迎总览';
$lang->block->lblTesttask = '查看测试详情';
$lang->block->contribute = '个人贡献';
$lang->block->leftToday = '今天剩余工作总计';
$lang->block->myTask = '我的任务';
@@ -75,25 +76,29 @@ $lang->block->nbsp = '';
$lang->block->hidden = '隐藏';
$lang->block->dynamicInfo = "<span class='timeline-tag'>%s</span> <span class='timeline-text'>%s <em>%s</em> %s <a href='%s' title='%s'>%s</a></span>";
$lang->block->default['cmmi']['program']['1']['title'] = '项目周报';
$lang->block->default['cmmi']['program']['1']['block'] = 'cmmireport';
$lang->block->default['cmmi']['program']['1']['grid'] = 8;
$lang->block->default['cmmi']['program']['1']['title'] = '项目周报';
$lang->block->default['cmmi']['program']['1']['block'] = 'cmmireport';
$lang->block->default['cmmi']['program']['1']['source'] = 'program';
$lang->block->default['cmmi']['program']['1']['grid'] = 8;
$lang->block->default['cmmi']['program']['2']['title'] = '估算';
$lang->block->default['cmmi']['program']['2']['block'] = 'cmmiestimate';
$lang->block->default['cmmi']['program']['2']['grid'] = 4;
$lang->block->default['cmmi']['program']['2']['title'] = '估算';
$lang->block->default['cmmi']['program']['2']['block'] = 'cmmiestimate';
$lang->block->default['cmmi']['program']['2']['source'] = 'program';
$lang->block->default['cmmi']['program']['2']['grid'] = 4;
$lang->block->default['cmmi']['program']['3']['title'] = '计划甘特图';
$lang->block->default['cmmi']['program']['3']['block'] = 'cmmigantt';
$lang->block->default['cmmi']['program']['3']['grid'] = 8;
$lang->block->default['cmmi']['program']['3']['title'] = '计划甘特图';
$lang->block->default['cmmi']['program']['3']['block'] = 'cmmigantt';
$lang->block->default['cmmi']['program']['3']['source'] = 'program';
$lang->block->default['cmmi']['program']['3']['grid'] = 8;
$lang->block->default['cmmi']['program']['4']['title'] = '到目前为止项目进展趋势图';
$lang->block->default['cmmi']['program']['4']['block'] = 'cmmiprogress';
$lang->block->default['cmmi']['program']['4']['grid'] = 4;
$lang->block->default['cmmi']['program']['4']['title'] = '到目前为止项目进展趋势图';
$lang->block->default['cmmi']['program']['4']['block'] = 'cmmiprogress';
$lang->block->default['cmmi']['program']['4']['grid'] = 4;
$lang->block->default['cmmi']['program']['5']['title'] = '项目问题';
$lang->block->default['cmmi']['program']['5']['block'] = 'cmmiissue';
$lang->block->default['cmmi']['program']['5']['grid'] = 8;
$lang->block->default['cmmi']['program']['5']['title'] = '项目问题';
$lang->block->default['cmmi']['program']['5']['block'] = 'cmmiissue';
$lang->block->default['cmmi']['program']['5']['source'] = 'program';
$lang->block->default['cmmi']['program']['5']['grid'] = 8;
$lang->block->default['cmmi']['program']['5']['params']['type'] = 'all';
$lang->block->default['cmmi']['program']['5']['params']['num'] = '15';
@@ -104,9 +109,10 @@ $lang->block->default['cmmi']['program']['6']['block'] = 'dynamic';
$lang->block->default['cmmi']['program']['6']['grid'] = 4;
$lang->block->default['cmmi']['program']['6']['source'] = '';
$lang->block->default['cmmi']['program']['7']['title'] = '项目风险';
$lang->block->default['cmmi']['program']['7']['block'] = 'cmmirisk';
$lang->block->default['cmmi']['program']['7']['grid'] = 8;
$lang->block->default['cmmi']['program']['7']['title'] = '项目风险';
$lang->block->default['cmmi']['program']['7']['block'] = 'cmmirisk';
$lang->block->default['cmmi']['program']['7']['source'] = 'program';
$lang->block->default['cmmi']['program']['7']['grid'] = 8;
$lang->block->default['cmmi']['program']['7']['params']['type'] = 'all';
$lang->block->default['cmmi']['program']['7']['params']['num'] = '15';
@@ -255,6 +261,7 @@ $lang->block->default['full']['my']['4']['grid'] = 8;
$lang->block->default['full']['my']['5']['title'] = '个人贡献';
$lang->block->default['full']['my']['5']['block'] = 'contribute';
$lang->block->default['full']['my']['5']['source'] = '';
$lang->block->default['full']['my']['5']['grid'] = 4;
$lang->block->default['full']['my']['6']['title'] = '我的近期项目';
@@ -274,9 +281,10 @@ $lang->block->default['full']['my']['8']['title'] = '项目人力投入';
$lang->block->default['full']['my']['8']['block'] = 'programteam';
$lang->block->default['full']['my']['8']['grid'] = 8;
$lang->block->default['full']['my']['9']['title'] = '项目列表';
$lang->block->default['full']['my']['9']['block'] = 'program';
$lang->block->default['full']['my']['9']['grid'] = 8;
$lang->block->default['full']['my']['9']['title'] = '项目列表';
$lang->block->default['full']['my']['9']['block'] = 'program';
$lang->block->default['full']['my']['9']['source'] = 'program';
$lang->block->default['full']['my']['9']['grid'] = 8;
$lang->block->default['full']['my']['9']['params']['orderBy'] = 'id_desc';
$lang->block->default['full']['my']['9']['params']['num'] = '15';
@@ -308,7 +316,9 @@ $lang->block->moduleList['todo'] = '待办';
$lang->block->modules['program'] = new stdclass();
$lang->block->modules['program']->availableBlocks = new stdclass();
$lang->block->modules['program']->availableBlocks->list = '项目列表';
$lang->block->modules['program']->availableBlocks->program = '项目列表';
$lang->block->modules['program']->availableBlocks->recentprogram = '近期项目';
$lang->block->modules['program']->availableBlocks->statistic = '项目统计';
$lang->block->modules['scrum']['index'] = new stdclass();
$lang->block->modules['scrum']['index']->availableBlocks = new stdclass();
@@ -448,6 +458,12 @@ $lang->block->typeList->testtask['all'] = '全部';
$lang->block->modules['program']->moreLinkList = new stdclass();
$lang->block->modules['program']->moreLinkList->recentprogram = 'program|browse|';
$lang->block->modules['program']->moreLinkList->statistic = 'program|browse|';
$lang->block->modules['program']->moreLinkList->program = 'program|browse|';
$lang->block->modules['program']->moreLinkList->cmmireport = 'weekly|index|';
$lang->block->modules['program']->moreLinkList->cmmiestimate = 'workestimation|index|';
$lang->block->modules['program']->moreLinkList->cmmiissue = 'issue|browse|';
$lang->block->modules['program']->moreLinkList->cmmirisk = 'risk|browse|';
$lang->block->modules['product']->moreLinkList = new stdclass();
$lang->block->modules['product']->moreLinkList->list = 'product|all|product=&line=0&status=%s';
+132 -27
View File
@@ -59,6 +59,8 @@ class blockModel extends model
unset($_SESSION['album'][$uid]);
}
if(strpos($data->block, 'cmmi') !== false) $data->type = 'cmmi';
if(strpos($data->block, 'scrum') !== false) $data->type = 'scrum';
$data->params = helper::jsonEncode($data->params);
$this->dao->replace(TABLE_BLOCK)->data($data)->exec();
if(!dao::isError()) $this->loadModel('score')->create('block', 'set');
@@ -129,11 +131,12 @@ class blockModel extends model
* @access public
* @return void
*/
public function getBlockList($module = 'my')
public function getBlockList($module = 'my', $type = '')
{
$blocks = $this->dao->select('*')->from(TABLE_BLOCK)->where('account')->eq($this->app->user->account)
->andWhere('module')->eq($module)
->andWhere('hidden')->eq(0)
->beginIF($type)->andWhere('type')->eq($type)->fi()
->beginIF($this->config->global->flow == 'onlyStory')->andWhere('source')->notin('project,qa')->fi()
->beginIF($this->config->global->flow == 'onlyTask')->andWhere('source')->notin('product,qa')->fi()
->beginIF($this->config->global->flow == 'onlyTest')->andWhere('source')->notin('product,project')->fi()
@@ -233,6 +236,7 @@ class blockModel extends model
{
$block['order'] = $index;
$block['module'] = $module;
$block['type'] = $type;
$block['account'] = $account;
$block['params'] = isset($block['params']) ? helper::jsonEncode($block['params']) : '';
if(!isset($block['source'])) $block['source'] = $module;
@@ -446,6 +450,26 @@ class blockModel extends model
return json_encode($params);
}
/**
* Get program params.
*
* @access public
* @return json
*/
public function getProgramParams()
{
$this->app->loadLang('program');
$params->type['name'] = $this->lang->block->type;
$params->type['options'] = $this->lang->program->featureBar;
$params->type['control'] = 'select';
$params->orderBy['name'] = $this->lang->block->orderBy;
$params->orderBy['options'] = $this->lang->block->orderByList->product;
$params->orderBy['control'] = 'select';
return json_encode($this->onlyNumParams($params));
}
/**
* Get Build params.
*
@@ -547,6 +571,17 @@ class blockModel extends model
return json_encode($params);
}
/**
* Get recent program pararms.
*
* @access public
* @return string
*/
public function getRecentprogramParams()
{
return false;
}
/**
* Get product overview pararms.
*
@@ -558,6 +593,102 @@ class blockModel extends model
return false;
}
/**
* Get cmmi program report pararms.
*
* @access public
* @return string
*/
public function getCmmireportParams()
{
return false;
}
/**
* Get program estimate pararms.
*
* @access public
* @return string
*/
public function getCmmiestimateParams()
{
return false;
}
/**
* Get program gantt pararms.
*
* @access public
* @return string
*/
public function getCmmiganttParams()
{
return false;
}
/**
* Get program progress pararms.
*
* @access public
* @return string
*/
public function getCmmiprogressParams()
{
return false;
}
/**
* Get cmmi issue params.
*
* @param string $module
* @access public
* @return void
*/
public function getCmmiissueParams($module = '')
{
$this->app->loadLang('issue');
$params = new stdclass();
$params->type['name'] = $this->lang->block->type;
$params->type['options'] = $this->lang->issue->labelList;
$params->type['control'] = 'select';
$params->num['name'] = $this->lang->block->num;
$params->num['default'] = 20;
$params->num['control'] = 'input';
$params->orderBy['name'] = $this->lang->block->orderBy;
$params->orderBy['options'] = $this->lang->block->orderByList->product;
$params->orderBy['control'] = 'select';
return json_encode($params);
}
/**
* Get cmmi risk params.
*
* @param string $module▫
* @access public
* @return void
*/
public function getCmmiriskParams($module = '')
{
$this->app->loadLang('risk');
$params = new stdclass();
$params->type['name'] = $this->lang->block->type;
$params->type['options'] = $this->lang->risk->featureBar['browse'];
$params->type['control'] = 'select';
$params->num['name'] = $this->lang->block->num;
$params->num['default'] = 20;
$params->num['control'] = 'input';
$params->orderBy['name'] = $this->lang->block->orderBy;
$params->orderBy['options'] = $this->lang->block->orderByList->product;
$params->orderBy['control'] = 'select';
return json_encode($params);
}
/**
* Get project params.
*
@@ -713,32 +844,6 @@ class blockModel extends model
return $key == $hash;
}
/**
* Get cmmi issue params.
*
* @param string $module▫
* @access public
* @return void
*/
public function getCmmiissueParams($module = '')
{
$this->app->loadLang('issue');
$params = new stdclass();
$params->type['name'] = $this->lang->block->type;
$params->type['options'] = $this->lang->issue->labelList;
$params->type['control'] = 'select';
$params->num['name'] = $this->lang->block->num;
$params->num['default'] = 20;
$params->num['control'] = 'input';
$params->orderBy['name'] = $this->lang->block->orderBy;
$params->orderBy['options'] = $this->lang->block->orderByList->product;
$params->orderBy['control'] = 'select';
return json_encode($params);
}
/**
* Get testtask params.
*▫
+2
View File
@@ -208,6 +208,8 @@ class riskModel extends model
{
return $this->dao->select('*')->from(TABLE_RISK)
->where('program')->eq($this->session->program)
->beginIF($browseType != 'all' and $browseType != 'assignTo')->andWhere('status')->eq($browseType)->fi()
->beginIF($browseType == 'assignTo')->andWhere('assignedTo')->eq($this->app->user->account)->fi()
->andWhere('deleted')->eq('0')
->orderBy($orderBy)
->limit($limit)
+2 -1
View File
@@ -17,8 +17,9 @@ class weekly extends control
$this->view->users = $this->loadModel('user')->getPairs('noletter');
}
public function index($program, $date = '')
public function index($program = 0, $date = '')
{
$program = $program ? $program : $this->session->program;
if(!$date) $date = helper::today();
$date = date('Y-m-d', strtotime($date));
+2 -1
View File
@@ -11,8 +11,9 @@
*/
class workestimation extends control
{
public function index($program)
public function index($program = 0)
{
$program = $program ? $program : $this->session->program;
if($_POST)
{
$result = $this->workestimation->save($program);