* finish task #3613.

This commit is contained in:
wangyidong
2018-01-24 15:35:37 +08:00
parent 0dd8eb6f05
commit a2c4e7f594
9 changed files with 184 additions and 84 deletions
+39 -1
View File
@@ -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;
}
/**
-23
View File
@@ -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;}
+1 -1
View File
@@ -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;
+22 -38
View File
@@ -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();
});
+6
View File
@@ -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');
+13 -5
View File
@@ -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, '维护模块', '维护计划', '维护需求', '创建发布');
+26 -16
View File
@@ -24,13 +24,17 @@ $useGuest = $this->app->user->account == 'guest';
<?php if(isset($config->block->closed) and strpos(",{$config->block->closed},", ",{$block->source}|{$block->block},") !== false) continue;?>
<div class='row'>
<div class='col-sm-12'>
<div class='panel <?php if(isset($block->params->color)) echo 'panel-' . $block->params->color;?>' id='block<?php echo $block->id?>' data-id='<?php echo $block->id?>' data-name='<?php echo $block->title?>' data-url='<?php echo $block->blockLink?>' <?php if($block->height) echo "data-height='$block->height'";?>>
<div class='panel <?php echo "block-{$block->block}";?> <?php if(isset($block->params->color)) echo 'panel-' . $block->params->color;?>' id='block<?php echo $block->id?>' data-id='<?php echo $block->id?>' data-name='<?php echo $block->title?>'>
<?php $hasHeading = ($block->block != 'welcome' and $block->block != 'flowchart');?>
<?php if($hasHeading):?>
<div class='panel-heading'>
<div class='panel-actions'>
<div class='panel-title'><?php echo $block->title;?></div>
<?php endif;?>
<nav class='panel-actions nav nav-default'>
<?php if(!empty($block->moreLink)):?>
<?php echo html::a($block->moreLink, " <i class='icon icon-more'></i>", null, "class='panel-action drag-disabled panel-action-more'"); ?>
<?php echo '<li>' . html::a($block->moreLink, " <i class='icon icon-more'></i>") . '</li>'; ?>
<?php endif; ?>
<div class='dropdown'>
<li class='dropdown'>
<a href='javascript:;' data-toggle='dropdown' class='panel-action'><i class='icon icon-ellipsis-v'></i></a>
<ul class='dropdown-menu pull-right'>
<li><a href='javascript:;' class='refresh-panel'><i class='icon-repeat'></i> <?php echo $lang->block->refresh ?></a></li>
@@ -45,11 +49,12 @@ $useGuest = $this->app->user->account == 'guest';
<li><?php echo html::a($this->createLink('block', 'close', "blockID={$block->id}"), "<i class='icon-eye-close'></i> {$lang->block->closeForever}", 'hiddenwin', "class='close-block' onclick=\"return confirm('{$lang->block->confirmClose}')\"")?>
<?php endif;?>
</ul>
</div>
</div>
<span class='panel-title'><?php echo $block->title;?></span>
</li>
</nav>
<?php if($hasHeading):?>
</div>
<div class='panel-body no-padding'></div>
<?php endif;?>
<div class='panel-body conatiner-fluid'><?php echo $this->fetch('block', 'printBlock', "id=$block->id")?></div>
</div>
</div>
</div>
@@ -60,13 +65,17 @@ $useGuest = $this->app->user->account == 'guest';
<?php if(isset($config->block->closed) and strpos(",{$config->block->closed},", ",{$block->source}|{$block->block},") !== false) continue;?>
<div class='row'>
<div class='col-sm-12'>
<div class='panel <?php if(isset($block->params->color)) echo 'panel-' . $block->params->color;?>' id='block<?php echo $block->id?>' data-id='<?php echo $block->id?>' data-name='<?php echo $block->title?>' data-url='<?php echo $block->blockLink?>' <?php if($block->height) echo "data-height='$block->height'";?>>
<div class='panel <?php echo "block-{$block->block}";?> <?php if(isset($block->params->color)) echo 'panel-' . $block->params->color;?>' id='block<?php echo $block->id?>' data-id='<?php echo $block->id?>' data-name='<?php echo $block->title?>'>
<?php $hasHeading = ($block->block != 'welcome' and $block->block != 'flowchart');?>
<?php if($hasHeading):?>
<div class='panel-heading'>
<div class='panel-actions'>
<div class='panel-title'><?php echo $block->title;?></div>
<?php endif;?>
<nav class='panel-actions nav nav-default'>
<?php if(!empty($block->moreLink)):?>
<?php echo html::a($block->moreLink, " <i class='icon icon-more'></i>", null, "class='panel-action drag-disabled panel-action-more'"); ?>
<?php echo '<li>' . html::a($block->moreLink, " <i class='icon icon-more'></i>") . '</li>';?>
<?php endif; ?>
<div class='dropdown'>
<li class='dropdown'>
<a href='javascript:;' data-toggle='dropdown' class='panel-action'><i class='icon icon-ellipsis-v'></i></a>
<ul class='dropdown-menu pull-right'>
<li><a href='javascript:;' class='refresh-panel'><i class='icon-repeat'></i> <?php echo $lang->block->refresh ?></a></li>
@@ -81,11 +90,12 @@ $useGuest = $this->app->user->account == 'guest';
<li><?php echo html::a($this->createLink('block', 'close', "blockID={$block->id}"), "<i class='icon-eye-close'></i> {$lang->block->closeForever}", 'hiddenwin', "class='close-block' onclick=\"return confirm('{$lang->block->confirmClose}')\"")?>
<?php endif;?>
</ul>
</div>
</div>
<span class='panel-title'><?php echo $block->title;?></span>
</li>
</nav>
<?php if($hasHeading):?>
</div>
<div class='panel-body no-padding'></div>
<?php endif;?>
<div class='panel-body conatiner-fluid'><?php echo $this->fetch('block', 'printBlock', "id=$block->id")?></div>
</div>
</div>
</div>
+66
View File
@@ -0,0 +1,66 @@
<?php
/**
* The welcome view file of block module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Yidong Wang <yidong@cnezsoft.com>
* @package block
* @version $Id$
* @link http://www.zentao.net
*/
?>
<div class="row">
<div class="col col-left">
<h4><?php printf($lang->block->welcomeList[$welcomeType], $app->user->realname)?></h4>
<ul class="timeline timeline-sm">
<?php
foreach($lang->tutorial->tasks as $taskKey => $task)
{
$class = strpos(",$tutorialed,", ",$taskKey,") !== false ? "class='active'" : '';
echo "<li $class>" . html::a($this->createLink('tutorial', 'index', "referer=&task=$taskKey"), $task['title']) . "</li>";
}
?>
</ul>
</div>
<div class="col col-right">
<h4><small class="text-muted"><?php echo date(DT_DATE3)?></small> <?php echo $lang->block->leftToday?></h4>
<div class="row tiles">
<div class="col tile">
<div class="tile-title"><?php echo $lang->block->myTask?></div>
<div class="tile-amount"><?php echo (int)$tasks;?></div>
<?php if(!empty($delay['task'])):?>
<div class="tile-info">
<span class="label label-danger label-outline"><?php echo $lang->block->delayed . ' ' . $delay['task']?></span>
</div>
<?php endif;?>
</div>
<div class="col tile">
<div class="tile-title"><?php echo $lang->block->myBug?></div>
<div class="tile-amount"><?php echo (int)$bugs;?></div>
<?php if(!empty($delay['bug'])):?>
<div class="tile-info">
<span class="label label-danger label-outline"><?php echo $lang->block->delayed . ' ' . $delay['bug']?></span>
</div>
<?php endif;?>
</div>
<div class="col tile">
<div class="tile-title"><?php echo $lang->block->myStory?></div>
<div class="tile-amount"><?php echo (int)$stories;?></div>
</div>
<div class="col tile">
<div class="tile-title"><?php echo $lang->block->myProject?></div>
<div class="tile-amount"><?php echo (int)$projects;?></div>
<?php if(!empty($delay['project'])):?>
<div class="tile-info">
<span class="label label-danger label-outline"><?php echo $lang->block->delayed . ' ' . $delay['project']?></span>
</div>
<?php endif;?>
</div>
<div class="col tile">
<div class="tile-title"><?php echo $lang->block->myProduct?></div>
<div class="tile-amount"><?php echo (int)$products;?></div>
</div>
</div>
</div>
</div>
+11
View File
@@ -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');
}
}