From a2c4e7f594e0eb4a400f9d1d6189ebd848e50925 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 24 Jan 2018 15:35:37 +0800 Subject: [PATCH] * finish task #3613. --- module/block/control.php | 40 ++++++++++++++++- module/block/css/dashboard.css | 23 ---------- module/block/js/admin.js | 2 +- module/block/js/dashboard.js | 60 ++++++++++--------------- module/block/lang/en.php | 6 +++ module/block/lang/zh-cn.php | 18 +++++--- module/block/view/dashboard.html.php | 42 +++++++++++------- module/block/view/welcome.html.php | 66 ++++++++++++++++++++++++++++ module/tutorial/model.php | 11 +++++ 9 files changed, 184 insertions(+), 84 deletions(-) create mode 100644 module/block/view/welcome.html.php diff --git a/module/block/control.php b/module/block/control.php index 184afe5d7c..1349ce1b09 100644 --- a/module/block/control.php +++ b/module/block/control.php @@ -57,6 +57,7 @@ class block extends control if(strpos(",$closedBlock,", ",|assigntome,") === false) $modules['assigntome'] = $this->lang->block->assignToMe; if(strpos(",$closedBlock,", ",|dynamic,") === false) $modules['dynamic'] = $this->lang->block->dynamic; 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'; $modules = array('' => '') + $modules; @@ -258,6 +259,39 @@ class block extends control $this->display(); } + /** + * Welcome block. + * + * @access public + * @return void + */ + public function welcome() + { + $projects = $this->loadModel('project')->getPairs(); + $products = $this->loadModel('product')->getPairs(); + + $this->view->tutorialed = $this->loadModel('tutorial')->getTutorialed(); + $this->view->tasks = (int)$this->dao->select('count(*) AS count')->from(TABLE_TASK)->where('assignedTo')->eq($this->app->user->account)->fetch('count'); + $this->view->bugs = (int)$this->dao->select('count(*) AS count')->from(TABLE_BUG)->where('assignedTo')->eq($this->app->user->account)->fetch('count'); + $this->view->stories = (int)$this->dao->select('count(*) AS count')->from(TABLE_STORY)->where('assignedTo')->eq($this->app->user->account)->fetch('count'); + $this->view->projects = (int)$this->dao->select('count(*) AS count')->from(TABLE_PROJECT)->where('id')->in(array_keys($projects))->andWhere("(status='wait' or status='doing')")->fetch('count'); + $this->view->products = (int)$this->dao->select('count(*) AS count')->from(TABLE_PRODUCT)->where('status')->ne('closed')->andWhere('id')->in(array_keys($products))->fetch('count'); + + $today = date('Y-m-d'); + $this->view->delay['task'] = (int)$this->dao->select('count(*) AS count')->from(TABLE_TASK)->where('assignedTo')->eq($this->app->user->account)->andWhere('deadline')->ne('0000-00-00')->andWhere('deadline')->lt($today)->fetch('count'); + $this->view->delay['bug'] = (int)$this->dao->select('count(*) AS count')->from(TABLE_BUG)->where('assignedTo')->eq($this->app->user->account)->andWhere('deadline')->ne('0000-00-00')->andWhere('deadline')->lt($today)->fetch('count'); + $this->view->delay['project'] = (int)$this->dao->select('count(*) AS count')->from(TABLE_PROJECT)->where('id')->in(array_keys($projects))->andWhere("(status='wait' or status='doing')")->andWhere('end')->lt($today)->fetch('count'); + + $time = date('H:i'); + $welcomeType = '19:00'; + foreach($this->lang->block->welcomeList as $type => $name) + { + if($time >= $type) $welcomeType = $type; + } + $this->view->welcomeType = $welcomeType; + $this->display(); + } + /** * Print block. * @@ -298,8 +332,12 @@ class block extends control { $html = $this->fetch('block', 'printAssignToMeBlock'); } + elseif($block->block == 'welcome') + { + $html = $this->fetch('block', 'welcome'); + } - die($html); + echo $html; } /** diff --git a/module/block/css/dashboard.css b/module/block/css/dashboard.css index e6a24741c1..9969a13dca 100644 --- a/module/block/css/dashboard.css +++ b/module/block/css/dashboard.css @@ -2,29 +2,6 @@ body {background: #fafafa;} .page-content {margin-top: -19px; border-top: 1px solid #3280fc;} -.dashboard {position: relative;} -.dashboard .row {margin: 0 auto;} -.dashboard .panel-actions {margin-top: 0; margin-right: 0;} -.dashboard .panel-heading {line-height: 17px; height: 30px; position: relative;} -.dashboard .panel-actions {position: absolute; top: 0; right: 0; height: 30px;} -.dashboard .panel-action {display: block; float: left; height: 30px; min-width: 26px; text-align: center; line-height: 30px; padding-left: 3px; padding-right: 3px;} -.dashboard .panel-actions > a {color: #666} -.dashboard .panel-action-more {font-size: 12px; font-weight: 200} -.dashboard .panel-action:hover, .dashboard .panel-actions > .dropdown > a:hover {color: #333; background-color: #ddd; background-color: rgba(0,0,0,0.1)} -.dashboard .panel-title {font-size: 13px; color: #333} -.dashboard a.panel-title > .icon-double-angle-right {position: relative; filter: alpha(opacity=0); opacity: 0; transition: opacity .2s, left .2s; left: -5px} -.dashboard .panel:hover a.panel-title > .icon-double-angle-right {filter: alpha(opacity=100); opacity: 1; left: 0} -.dashboard a.panel-title:hover {color: #1a53ff} -.dashboard .panel {box-shadow: 0 1px 3px rgba(0,0,0,.05); position: relative; overflow-x: hidden;} -.dashboard .panel.with-fixed-header {overflow-x: hidden;} -.dashboard .panel-heading + .panel-body {position: absolute; left: 0; top: 30px; right: 0; bottom: 0} -.dashboard .panel-dragging-shadow {position: absolute;} -.dashboard-empty-message {text-align: center; margin-top: 100px;} -.dashboard-empty-message > h5 {margin-bottom: 20px;} -.dashboard-actions {position: absolute; top:-20px; right:-10px;} -.dashboard-actions > a {display: inline-block; width: 40px; height: 20px; text-align: center; color: #999; border: 1px solid #999; line-height: 20px; background: #1a4f85; color: #fff} -.dashboard-actions > a:hover {background: #2e6dad; border-color: #2e6dad} - #wrap .outer {background-color: #fafafa;} #wrap .outer > .dashboard {margin-left: -10px; margin-right: -10px;} diff --git a/module/block/js/admin.js b/module/block/js/admin.js index f12d6ce372..b03d872274 100644 --- a/module/block/js/admin.js +++ b/module/block/js/admin.js @@ -18,7 +18,7 @@ function getBlocks(moduleID) getNotSourceParams('html', moduleID.replace('hiddenBlock', '')); return true; } - if(moduleID == 'html' || moduleID == 'dynamic' || moduleID == 'flowchart' || moduleID == 'assigntome') + if(moduleID == 'html' || moduleID == 'dynamic' || moduleID == 'flowchart' || moduleID == 'assigntome' || moduleID == 'welcome') { getNotSourceParams(moduleID, blockID); return true; diff --git a/module/block/js/dashboard.js b/module/block/js/dashboard.js index cc7d3f9861..a2cc707832 100644 --- a/module/block/js/dashboard.js +++ b/module/block/js/dashboard.js @@ -14,8 +14,6 @@ function deleteBlock(index) alert(data.message); return false; } - - checkEmpty(); }) } @@ -40,19 +38,6 @@ function sortBlocks(orders) }); } -/** - * Check dashboard wether is empty - * @access public - * @return void - */ -function checkEmpty() -{ - var $dashboard = $('#dashboard'); - var hasBlocks = !!$dashboard.children('.row').children().length; - $dashboard.find('.dashboard-empty-message').toggleClass('hide', hasBlocks); - if(!hasBlocks) $dashboard.find('.dashboard-actions').addClass('hide'); -} - /** * Resize block * @param object $event @@ -168,28 +153,27 @@ function hiddenBlock(index) $(function() { - var $dashboard = $('#dashboard').dashboard( - { - height : 240, - draggable : !useGuest, - shadowType : false, - afterOrdered : sortBlocks, - afterPanelRemoved : deleteBlock, - sensitive : true, - panelRemovingTip : config.confirmRemoveBlock, - resizable : !useGuest, - onResize : resizeBlock, - afterRefresh : function(e) - { - var $sortTable = e.$panel.find('.tablesorter'); - if($sortTable.length) $sortTable.sortTable(); - initTableHeader(); - } - }); +// var $dashboard = $('#dashboard').dashboard( +// { +// height : 240, +// draggable : !useGuest, +// shadowType : false, +// afterOrdered : sortBlocks, +// afterPanelRemoved : deleteBlock, +// sensitive : true, +// panelRemovingTip : config.confirmRemoveBlock, +// resizable : !useGuest, +// onResize : resizeBlock, +// afterRefresh : function(e) +// { +// var $sortTable = e.$panel.find('.tablesorter'); +// if($sortTable.length) $sortTable.sortTable(); +// initTableHeader(); +// } +// }); +// +// // $dashboard.find('ul.dashboard-actions').addClass('hide').children('li').addClass('right').appendTo($('#modulemenu > .nav')); +// $dashboard.find('[data-toggle=tooltip]').tooltip({container: 'body'}); - // $dashboard.find('ul.dashboard-actions').addClass('hide').children('li').addClass('right').appendTo($('#modulemenu > .nav')); - $dashboard.find('[data-toggle=tooltip]').tooltip({container: 'body'}); - - checkEmpty(); - initTableHeader(); +// initTableHeader(); }); diff --git a/module/block/lang/en.php b/module/block/lang/en.php index 95d9eef98a..9dd3332839 100644 --- a/module/block/lang/en.php +++ b/module/block/lang/en.php @@ -31,6 +31,7 @@ $lang->block->lblHtml = 'HTML'; $lang->block->dynamic = 'Dynamic'; $lang->block->assignToMe = 'Assign To Me'; $lang->block->lblFlowchart = 'Workflow'; +$lang->block->welcome = 'Welcome'; $lang->block->assignToMeList['todo'] = 'Todo'; $lang->block->assignToMeList['story'] = 'Story'; @@ -320,6 +321,11 @@ $lang->block->modules['common'] = new stdclass(); $lang->block->modules['common']->moreLinkList = new stdclass(); $lang->block->modules['common']->moreLinkList->dynamic = 'company|dynamic|'; +$lang->block->welcomeList['06:00'] = 'Good morning, %s'; +$lang->block->welcomeList['11:30'] = 'Good noon, %s'; +$lang->block->welcomeList['13:30'] = 'Good afternoon, %s'; +$lang->block->welcomeList['19:00'] = 'Good evening, %s'; + $lang->block->flowchart = array(); $lang->block->flowchart[] = array('Administration', 'Manage a Company', 'Add Users', 'Maintain Privileges'); $lang->block->flowchart[] = array($lang->productCommon . ' Manager', 'Add ' . $lang->productCommon, 'Maintain Modules', 'Maintain Plans', 'Maintain Stories', 'Create Release'); diff --git a/module/block/lang/zh-cn.php b/module/block/lang/zh-cn.php index 81537e9e7a..6ab6b0914e 100644 --- a/module/block/lang/zh-cn.php +++ b/module/block/lang/zh-cn.php @@ -31,12 +31,15 @@ $lang->block->lblHtml = 'HTML内容'; $lang->block->dynamic = '最新动态'; $lang->block->assignToMe = '指派给我'; $lang->block->lblFlowchart = '流程图'; +$lang->block->welcome = '欢迎总览'; -$lang->block->assignToMeList['todo'] = '待办'; -$lang->block->assignToMeList['story'] = '需求'; -$lang->block->assignToMeList['task'] = '任务'; -$lang->block->assignToMeList['bug'] = 'Bug'; -$lang->block->assignToMeList['case'] = '用例'; +$lang->block->leftToday = '今天剩余工作总计'; +$lang->block->myTask = '我的任务'; +$lang->block->myStory = '我的需求'; +$lang->block->myBug = '我的BUG'; +$lang->block->myProject = '进行中的' . $lang->projectCommon; +$lang->block->myProduct = '未关闭的' . $lang->productCommon; +$lang->block->delayed = '已延期'; $lang->block->params = new stdclass(); $lang->block->params->name = '参数名称'; @@ -320,6 +323,11 @@ $lang->block->modules['common'] = new stdclass(); $lang->block->modules['common']->moreLinkList = new stdclass(); $lang->block->modules['common']->moreLinkList->dynamic = 'company|dynamic|'; +$lang->block->welcomeList['06:00'] = '%s,早上好!'; +$lang->block->welcomeList['11:30'] = '%s,中文好!'; +$lang->block->welcomeList['13:30'] = '%s,下午好!'; +$lang->block->welcomeList['19:00'] = '%s,晚上好!'; + $lang->block->flowchart = array(); $lang->block->flowchart[] = array('管理员', '维护公司', '添加用户', '维护权限'); $lang->block->flowchart[] = array($lang->productCommon . '经理', '创建' . $lang->productCommon, '维护模块', '维护计划', '维护需求', '创建发布'); diff --git a/module/block/view/dashboard.html.php b/module/block/view/dashboard.html.php index af901b54b0..e5b6267236 100644 --- a/module/block/view/dashboard.html.php +++ b/module/block/view/dashboard.html.php @@ -24,13 +24,17 @@ $useGuest = $this->app->user->account == 'guest'; block->closed) and strpos(",{$config->block->closed},", ",{$block->source}|{$block->block},") !== false) continue;?>
-
params->color;?>' id='blockid?>' data-id='id?>' data-name='title?>' data-url='blockLink?>' height) echo "data-height='$block->height'";?>> +
params->color;?>' id='blockid?>' data-id='id?>' data-name='title?>'> + block != 'welcome' and $block->block != 'flowchart');?> +
-
+
title;?>
+ +
- title;?> + + +
-
+ +
fetch('block', 'printBlock', "id=$block->id")?>
@@ -60,13 +65,17 @@ $useGuest = $this->app->user->account == 'guest'; block->closed) and strpos(",{$config->block->closed},", ",{$block->source}|{$block->block},") !== false) continue;?>
-
params->color;?>' id='blockid?>' data-id='id?>' data-name='title?>' data-url='blockLink?>' height) echo "data-height='$block->height'";?>> +
params->color;?>' id='blockid?>' data-id='id?>' data-name='title?>'> + block != 'welcome' and $block->block != 'flowchart');?> +
-
+
title;?>
+ +
- title;?> + + +
-
+ +
fetch('block', 'printBlock', "id=$block->id")?>
diff --git a/module/block/view/welcome.html.php b/module/block/view/welcome.html.php new file mode 100644 index 0000000000..eda09be6cb --- /dev/null +++ b/module/block/view/welcome.html.php @@ -0,0 +1,66 @@ + + * @package block + * @version $Id$ + * @link http://www.zentao.net + */ +?> +
+
+

block->welcomeList[$welcomeType], $app->user->realname)?>

+
    + tutorial->tasks as $taskKey => $task) + { + $class = strpos(",$tutorialed,", ",$taskKey,") !== false ? "class='active'" : ''; + echo "
  • " . html::a($this->createLink('tutorial', 'index', "referer=&task=$taskKey"), $task['title']) . "
  • "; + } + ?> +
+
+
+

block->leftToday?>

+
+
+
block->myTask?>
+
+ +
+ block->delayed . ' ' . $delay['task']?> +
+ +
+
+
block->myBug?>
+
+ +
+ block->delayed . ' ' . $delay['bug']?> +
+ +
+
+
block->myStory?>
+
+
+
+
block->myProject?>
+
+ +
+ block->delayed . ' ' . $delay['project']?> +
+ +
+
+
block->myProduct?>
+
+
+
+
+
diff --git a/module/tutorial/model.php b/module/tutorial/model.php index dc5ca1866e..72464b3f55 100644 --- a/module/tutorial/model.php +++ b/module/tutorial/model.php @@ -242,4 +242,15 @@ class tutorialModel extends model $users['test'] = 'Test'; return $users; } + + /** + * Get tutorialed. + * + * @access public + * @return string + */ + public function getTutorialed() + { + return $this->dao->select('*')->from(TABLE_CONFIG)->where('module')->eq('tutorial')->andWhere('owner')->eq($this->app->user->account)->andWhere('section')->eq('tasks')->andWhere('`key`')->eq('setting')->fetch('value'); + } }