diff --git a/module/kanban/model.php b/module/kanban/model.php
index a6dc806486..d29ea2588f 100644
--- a/module/kanban/model.php
+++ b/module/kanban/model.php
@@ -531,12 +531,13 @@ class kanbanModel extends model
$this->loadModel('branch');
$this->loadModel('productplan');
- $kanbanData = new stdclass();
- $lanes = array();
- $columns = array();
- $branches = array();
- $colorIndex = 0;
- $laneOrder = 1;
+ $kanbanData = new stdclass();
+ $lanes = array();
+ $columns = array();
+ $branches = array();
+ $colorIndex = 0;
+ $laneOrder = 1;
+ $cardActions = array('view');
if($product->type == 'normal')
{
@@ -566,6 +567,14 @@ class kanbanModel extends model
{
if(empty($plan) or $plan->parent == -1) continue;
if(!isset($planList[$plan->status])) $planList[$plan->status] = array();
+
+ $plan->title = htmlspecialchars_decode($plan->title);
+ $plan->desc = strip_tags(htmlspecialchars_decode($plan->desc));
+ $plan->actions = array();
+ foreach($cardActions as $action)
+ {
+ if(common::hasPriv('productplan', $action)) $plan->actions[] = $action;
+ }
$planList[$plan->status][] = $plan;
}
@@ -751,7 +760,7 @@ class kanbanModel extends model
//->orderBy('`order` asc')
->fetchAll('id');
- $actions = array('editCard', 'archiveCard', 'copyCard', 'deleteCard', 'moveCard', 'setCardColor', 'viewCard');
+ $actions = array('editCard', 'archiveCard', 'deleteCard', 'moveCard', 'setCardColor', 'viewCard');
$cardGroup = array();
foreach($cards as $card)
{
diff --git a/module/product/control.php b/module/product/control.php
index 0ed61baa9f..10649e1888 100644
--- a/module/product/control.php
+++ b/module/product/control.php
@@ -1001,11 +1001,11 @@ class product extends control
*/
public function ajaxGetPlans($productID, $branch = 0, $planID = 0, $fieldID = '', $needCreate = false, $expired = '', $param = '')
{
- $param = strtolower($param);
- $plans = $this->loadModel('productplan')->getPairs($productID, $branch, $expired, strpos($param, 'skipparent') !== false);
- $field = $fieldID ? "plans[$fieldID]" : 'plan';
- $output = '';
- $output .= html::select($field, $plans, $planID, "class='form-control chosen'");
+ $param = strtolower($param);
+ $plans = $this->loadModel('productplan')->getPairs($productID, $branch, $expired, strpos($param, 'skipparent') !== false);
+ $field = $fieldID ? "plans[$fieldID]" : 'plan';
+ $output = '';
+ $output .= html::select($field, $plans, $planID, "class='form-control chosen'");
if(count($plans) == 1 and $needCreate and $needCreate !== 'false')
{
$output .= "
";
diff --git a/module/productplan/control.php b/module/productplan/control.php
index 45d0452634..99ff28544f 100644
--- a/module/productplan/control.php
+++ b/module/productplan/control.php
@@ -249,12 +249,12 @@ class productplan extends control
$sort = $this->loadModel('common')->appendOrder($orderBy);
$this->session->set('productPlanList', $this->app->getURI(true), 'product');
- $viewType = $this->cookie->viewType ? $this->cookie->viewType : 'bylist';
+ $viewType = $this->cookie->viewType ? $this->cookie->viewType : 'list';
$this->commonAction($productID, $branch);
$product = $this->product->getById($productID);
$productName = empty($product) ? '' : $product->name;
- if($viewType == 'bykanban')
+ if($viewType == 'kanban')
{
$branches = array();
$branchPairs = array();
diff --git a/module/productplan/js/browse.js b/module/productplan/js/browse.js
index 53e3560940..9bc95dee80 100644
--- a/module/productplan/js/browse.js
+++ b/module/productplan/js/browse.js
@@ -51,7 +51,7 @@ $(function()
location.href = link;
});
- if(viewType == 'bykanban')
+ if(viewType == 'kanban')
{
$('#branch_chosen .chosen-single span').prepend('
');
$('#kanban').kanban(
@@ -59,6 +59,8 @@ $(function()
data: kanbanData,
minColWidth: 290,
maxColWidth: 290,
+ maxColHeight: 460,
+ minColHeight: 190,
itemRender: renderKanbanItem,
virtualize: true,
droppable:
@@ -165,7 +167,63 @@ function changeCardColType(card, fromColType, toColType, kanbanID)
*/
function renderKanbanItem(item, $item)
{
- var $title = $item.children('.title');
+ var privs = item.actions;
+ var $titleBox = $item.children('.titleBox');
+
+ /* Output header information. */
+ if(!$titleBox.length) $titleBox = $(
+ [
+ '
',
+ '
'
+ ].join('')).appendTo($item);
+
+ /* Print plan name. */
+ var $title = $titleBox.children('.title');
+ if(!$title.length)
+ {
+ if(privs.includes('view')) $title = $('
').appendTo($titleBox).attr('href', createLink('productplan', 'view', 'cardID=' + item.id));
+ if(!privs.includes('view')) $title = $('
').appendTo($titleBox);
+ }
+ $title.text(item.title).attr('title', item.title);
+
+ /* Determine whether to print an expired label. */
+ var today = new Date();
+ var begin = $.zui.createDate(item.begin);
+ var end = $.zui.createDate(item.end);
+ if(end.toLocaleDateString() < today.toLocaleDateString())
+ {
+ $expired = $titleBox.children('.expired');
+ if(!$expired.length)
+ {
+ $('
' + productplanLang.expired + '').appendTo($titleBox);
+ }
+ }
+
+ /* Output plan date information. */
+ var $dateBox = $item.children('.dateBox');
+ if(!$dateBox.length) $dateBox = $(
+ [
+ '
',
+ '',
+ '
'
+ ].join('')).appendTo($item);
+
+ var $time = $dateBox.children('.time');
+ if(item.begin != '2030-01-01' && item.end != '2030-01-01')
+ {
+ $time.text($.zui.formatDate(begin, 'MM-dd') + ' ' + productplanLang.to + ' ' + $.zui.formatDate(end, 'MM-dd')).attr('title', $.zui.formatDate(begin, 'yyyy-MM-dd') + productplanLang.to + $.zui.formatDate(end, 'yyyy-MM-dd')).show();
+ }
+ else
+ {
+ $time.text(productplanLang.future).attr('title', productplanLang.future).show();
+ }
+
+ /* Output plan desc information. */
+ var $desc = $item.children('.desc');
+ if(!$desc.length)
+ {
+ $("
" + item.desc + '
').appendTo($item);
+ }
}
/**
diff --git a/module/productplan/lang/en.php b/module/productplan/lang/en.php
index a0ef357eb9..93d7bcbde9 100644
--- a/module/productplan/lang/en.php
+++ b/module/productplan/lang/en.php
@@ -30,6 +30,7 @@ $lang->productplan->batchEdit = 'Batch Edit';
$lang->productplan->project = 'Project';
$lang->productplan->plan = 'Plan';
$lang->productplan->allAB = 'All';
+$lang->productplan->to = 'To';
$lang->productplan->batchUnlink = "Batch Unlink";
$lang->productplan->unlinkAB = "Unlink";
diff --git a/module/productplan/lang/zh-cn.php b/module/productplan/lang/zh-cn.php
index 30f2fd3a82..b1da22b2d2 100644
--- a/module/productplan/lang/zh-cn.php
+++ b/module/productplan/lang/zh-cn.php
@@ -31,6 +31,7 @@ $lang->productplan->batchEdit = '批量编辑';
$lang->productplan->project = '项目';
$lang->productplan->plan = '计划';
$lang->productplan->allAB = '所有';
+$lang->productplan->to = '至';
$lang->productplan->batchUnlink = "批量移除";
$lang->productplan->unlinkAB = "移除";
diff --git a/module/productplan/view/browse.html.php b/module/productplan/view/browse.html.php
index 30ed8d250b..d29e415c8f 100644
--- a/module/productplan/view/browse.html.php
+++ b/module/productplan/view/browse.html.php
@@ -19,7 +19,7 @@
productplan->projectNotEmpty)?>
span {flex: none;}
+.kanban-card .title {white-space: nowrap; overflow: hidden;}
+.kanban-card .expired {margin-left: 2px;}
+.kanban-card .dateBox {padding-top: 5px;}
+.kanban-card .desc {overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #838a9d; padding-top: 5px;}
+productplan);?>
type == 'normal'):?>
@@ -35,8 +43,8 @@