Merge branch 'sprint/183_zhouxin_47982'
This commit is contained in:
@@ -674,7 +674,7 @@ $lang->resource->kanban->viewArchivedColumn = 'viewArchivedColumn';
|
||||
$lang->resource->kanban->viewArchivedCard = 'viewArchivedCard';
|
||||
$lang->resource->kanban->restoreCard = 'restoreCard';
|
||||
$lang->resource->kanban->setLaneHeight = 'setLaneHeight';
|
||||
$lang->resource->kanban->import = 'import';
|
||||
$lang->resource->kanban->batchCreateCard = 'batchCreateCard';
|
||||
|
||||
$lang->kanban->methodOrder[5] = 'space';
|
||||
$lang->kanban->methodOrder[10] = 'createSpace';
|
||||
@@ -720,6 +720,7 @@ $lang->kanban->methodorder[200] = 'viewArchivedCard';
|
||||
$lang->kanban->methodorder[205] = 'archiveColumn';
|
||||
$lang->kanban->methodorder[210] = 'restoreCard';
|
||||
$lang->kanban->methodorder[215] = 'setLaneHeight';
|
||||
$lang->kanban->methodOrder[220] = 'batchCreateCard';
|
||||
$lang->kanban->methodorder[220] = 'import';
|
||||
|
||||
/* Execution. */
|
||||
|
||||
@@ -102,3 +102,5 @@ $config->kanban->taskColumnStatusList['closed'] = 'closed';
|
||||
$config->kanban->laneColorList = array('#7ec5ff', '#333', '#2b529c', '#e48600', '#d2323d', '#229f24', '#777', '#d2691e', '#008b8b', '#2e8b57', '#4169e1', '#4b0082', '#fa8072', '#ba55d3', '#6b8e23');
|
||||
$config->kanban->columnColorList = array('#333', '#2b519c', '#e48610', '#d2313d', '#2a9f23', '#777', '#d2691e', '#2e8b8b', '#2f8b58', '#4168e0', '#4b0082', '#f58072', '#ba55d3', '#6a8e22');
|
||||
$config->kanban->cardColorList = array('#fff', '#b10b0b', '#cfa227', '#2a5f29');
|
||||
|
||||
$config->kanban->batchCreate = 10;
|
||||
|
||||
@@ -709,6 +709,34 @@ class kanban extends control
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch create cards.
|
||||
*
|
||||
* @param int $kanbanID
|
||||
* @param int $regionID
|
||||
* @param int $groupID
|
||||
* @param int $laneID
|
||||
* @param int $columnID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchCreateCard($kanbanID = 0, $regionID = 0, $groupID = 0, $laneID = 0, $columnID = 0)
|
||||
{
|
||||
$backLink = $this->createLink('kanban', 'view', "kanbanID=$kanbanID");
|
||||
|
||||
if($_POST)
|
||||
{
|
||||
$this->kanban->batchCreateCard($kanbanID, $regionID, $groupID, $columnID);
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $backLink));
|
||||
}
|
||||
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noclosed|nodeleted');
|
||||
$this->view->lanePairs = $this->kanban->getLanePairsByGroup($groupID);
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit a card.
|
||||
*
|
||||
|
||||
@@ -142,15 +142,14 @@ function renderHeaderCol($column, column, $header, kanbanData)
|
||||
|
||||
if(!$column.children('.actions').length) $column.append('<div class="actions"></div>');
|
||||
var $actions = $column.children('.actions');
|
||||
|
||||
if(columnPrivs.includes('createCard') && column.parent != -1)
|
||||
if(column.parent != -1)
|
||||
{
|
||||
var cardUrl = createLink('kanban', 'createCard', 'kanbanID=' + kanbanID + '®ionID=' + regionID + '&groupID=' + groupID + '&columnID=' + columnID);
|
||||
addItemBtn = ['<a data-contextmenu="columnCreate" data-toggle="modal" data-action="addItem" data-column="' + column.id + '" data-lane="' + laneID + '" href="' + cardUrl + '" class="text-primary iframe">', '<i class="icon icon-expand-alt"></i>', '</a>'].join('');
|
||||
addItemBtn = ['<a data-contextmenu="columnCreate" data-action="addItem" data-column="' + column.id + '" data-lane="' + laneID + '" class="text-primary">', '<i class="icon icon-expand-alt"></i>', '</a>'].join('');
|
||||
}
|
||||
|
||||
var moreAction = ' <button class="btn btn-link action" title="' + kanbanLang.moreAction + '" data-contextmenu="column" data-column="' + column.id + '"><i class="icon icon-ellipsis-v"></i></button>';
|
||||
$actions.html(addItemBtn + moreAction);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -768,6 +767,28 @@ function createColumnMenu(options)
|
||||
return items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create create menu for column.
|
||||
*
|
||||
* @param object $options
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
function createColumnCreateMenu(options)
|
||||
{
|
||||
var col = options.$trigger.closest('.kanban-col').data('col');
|
||||
var privs = col.actions;
|
||||
var items = [];
|
||||
var regionID = col.region;
|
||||
var groupID = col.group;
|
||||
var laneID = col.$kanbanData.lanes[0].id ? col.$kanbanData.lanes[0].id : 0;
|
||||
var columnID = col.id;
|
||||
|
||||
if(privs.includes('createCard')) items.push({label: kanbanLang.createCard, url: $.createLink('kanban', 'createCard', 'kanbanID=' + kanbanID + '®ionID=' + regionID + '&groupID=' + groupID + '&laneID=' + laneID + '&columnID=' + columnID), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}});
|
||||
if(privs.includes('batchCreateCard')) items.push({label: kanbanLang.batchCreateCard, url: $.createLink('kanban', 'batchCreateCard', 'kanbanID=' + kanbanID + '®ionID=' + regionID + '&groupID=' + groupID + '&laneID=' + laneID + '&columnID=' + columnID), attrs: {'data-width': '80%'}});
|
||||
return items;
|
||||
}
|
||||
|
||||
/** Calculate column height */
|
||||
function calcColHeight(col, lane, colCards, colHeight, kanban)
|
||||
{
|
||||
@@ -787,7 +808,8 @@ window.menuCreators =
|
||||
{
|
||||
card: createCardMenu,
|
||||
lane: createLaneMenu,
|
||||
column: createColumnMenu
|
||||
column: createColumnMenu,
|
||||
columnCreate: createColumnCreateMenu
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -57,6 +57,7 @@ $lang->kanban->restoreColumn = 'Restore Column';
|
||||
$lang->kanban->restoreCard = 'Restore Card';
|
||||
$lang->kanban->restore = 'Restore';
|
||||
$lang->kanban->child = 'Child';
|
||||
$lang->kanban->batchCreateCard = 'Batchcreate Card';
|
||||
$lang->kanban->import = 'Import';
|
||||
$lang->kanban->showClosed = 'Closed';
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ $lang->kanban->restoreColumn = '还原看板列';
|
||||
$lang->kanban->restoreCard = '还原卡片';
|
||||
$lang->kanban->restore = '还原';
|
||||
$lang->kanban->child = '子';
|
||||
$lang->kanban->batchCreateCard = '批量创建卡片';
|
||||
$lang->kanban->import = '导入功能';
|
||||
$lang->kanban->showClosed = '显示已关闭';
|
||||
|
||||
|
||||
+73
-1
@@ -468,6 +468,78 @@ class kanbanModel extends model
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch create kanban cards.
|
||||
*
|
||||
* @param int $kanbanID
|
||||
* @param int $regionID
|
||||
* @param int $groupID
|
||||
* @param int $columnID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchCreateCard($kanbanID, $regionID, $groupID, $columnID)
|
||||
{
|
||||
foreach($_POST['name'] as $index => $value)
|
||||
{
|
||||
if($_POST['name'][$index] and isset($_POST['assignedTo'][$index])) $_POST['assignedTo'][$index] = implode(',', $_POST['assignedTo'][$index]);
|
||||
}
|
||||
$cards = fixer::input('post')->get();
|
||||
|
||||
$now = helper::now();
|
||||
$data = array();
|
||||
$lanes = array();
|
||||
|
||||
foreach($cards->name as $i => $name)
|
||||
{
|
||||
if(empty($cards->name[$i])) continue;
|
||||
$data[$i] = new stdclass();
|
||||
$data[$i]->name = trim($cards->name[$i]);
|
||||
$data[$i]->begin = $cards->begin[$i];
|
||||
$data[$i]->end = $cards->end[$i];
|
||||
$data[$i]->assignedTo = $cards->assignedTo[$i];
|
||||
$data[$i]->desc = nl2br($cards->desc[$i]);
|
||||
$data[$i]->pri = $cards->pri[$i];
|
||||
$data[$i]->kanban = $kanbanID;
|
||||
$data[$i]->region = $regionID;
|
||||
$data[$i]->group = $groupID;
|
||||
$data[$i]->createdBy = $this->app->user->account;
|
||||
$data[$i]->createdDate = $now;
|
||||
$data[$i]->assignedDate = $now;
|
||||
$data[$i]->color = '#fff';
|
||||
$data[$i]->estimate = is_numeric($cards->estimate[$i]) ? (float)$cards->estimate[$i] : $cards->estimate[$i];
|
||||
|
||||
$lanes[$i] = $cards->lane[$i];
|
||||
}
|
||||
|
||||
foreach($data as $i => $card)
|
||||
{
|
||||
$this->dao->insert(TABLE_KANBANCARD)->data($card)->autoCheck()
|
||||
->checkIF($card->estimate != '', 'estimate', 'float')
|
||||
->batchCheck($this->config->kanban->createcard->requiredFields, 'notempty')
|
||||
->exec();
|
||||
|
||||
if($card->estimate < 0)
|
||||
{
|
||||
dao::$errors[] = $this->lang->kanbancard->error->recordMinus;
|
||||
return false;
|
||||
}
|
||||
if($card->end && $card->begin > $card->end)
|
||||
{
|
||||
dao::$errors[] = $this->lang->kanbancard->error->endSmall;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!dao::isError())
|
||||
{
|
||||
$cardID = $this->dao->lastInsertID();
|
||||
$lane = $lanes[$i];
|
||||
$this->addKanbanCell($kanbanID, $lane, $columnID, 'common', $cardID);
|
||||
$this->loadModel('action')->create('kanbancard', $cardID, 'created');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get kanban by id.
|
||||
*
|
||||
@@ -807,7 +879,7 @@ class kanbanModel extends model
|
||||
->orderBy($order)
|
||||
->fetchGroup('group');
|
||||
|
||||
$actions = array('createColumn', 'setColumn', 'setWIP', 'archiveColumn', 'restoreColumn', 'deleteColumn', 'createCard', 'splitColumn');
|
||||
$actions = array('createColumn', 'setColumn', 'setWIP', 'archiveColumn', 'restoreColumn', 'deleteColumn', 'createCard', 'batchCreateCard', 'splitColumn');
|
||||
|
||||
/* Group by parent. */
|
||||
$parentColumnGroup = array();
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* The batch create view of kanban 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 Xin Zhou <zhouxin@cnezsoft.com>
|
||||
* @package kanban
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div id="mainContent" class="main-content fade">
|
||||
<div class="main-header clearfix">
|
||||
<h2 class="pull-left">
|
||||
<?php echo $lang->kanban->batchCreateCard;?>
|
||||
</h2>
|
||||
</div>
|
||||
<form method='post' class='load-indicator batch-actions-form form-ajax' enctype='multipart/form-data' id="batchCreateCardForm">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-form">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='c-id text-center'><?php echo $lang->idAB;?></th>
|
||||
<th class='c-name required'><?php echo $lang->kanbancard->name?></th>
|
||||
<th><?php echo $lang->kanbancard->lane;?></th>
|
||||
<th><?php echo $lang->kanbancard->assignedTo;?></th>
|
||||
<th class='c-estimate'><?php echo $lang->kanbancard->estimate;?></th>
|
||||
<th><?php echo $lang->kanbancard->beginAndEnd;?></th>
|
||||
<th><?php echo $lang->kanbancard->desc;?></th>
|
||||
<th class='c-pri w-120px'><?php echo $lang->kanbancard->pri;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $pri = 3;?>
|
||||
<?php for($i = 0; $i < $config->kanban->batchCreate; $i++):?>
|
||||
<tr>
|
||||
<td class='text-center'><?php echo $i + 1;?></td>
|
||||
<td class='text-center'><?php echo html::input("name[$i]", '', "class='form-control title-import'");?></td>
|
||||
<td style='overflow:visible'><?php echo html::select("lane[$i]", $lanePairs, key($lanePairs), "class='form-control chosen'")?></td>
|
||||
<td style='overflow:visible'><?php echo html::select("assignedTo[$i][]", $users, $app->user->account, "class='form-control chosen' multiple");?></td>
|
||||
<td><?php echo html::input("estimate[$i]", '', "class='form-control text-center'");?></td>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<?php echo html::input("begin[$i]", '', "class='form-control form-date' placeholder='{$lang->kanbancard->begin}'");?>
|
||||
<span class='input-group-addon fix-border'>~</span>
|
||||
<?php echo html::input("end[$i]", '', "class='form-control form-date' placeholder='{$lang->kanbancard->end}'");?>
|
||||
</div>
|
||||
</td>
|
||||
<td ><?php echo html::textarea("desc[$i]", '', "rows='1' class='form-control autosize'");?></td>
|
||||
<td ><?php echo html::select("pri[$i]", (array)$lang->kanbancard->priList, $pri, 'class=form-control');?></td>
|
||||
</tr>
|
||||
<?php endfor;?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan='8' class='text-center form-actions'>
|
||||
<?php echo html::submitButton();?>
|
||||
<?php echo html::backButton();?>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
@@ -5,7 +5,7 @@
|
||||
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Shujie Tian<tianshujie@cnezsoft.com>
|
||||
* @package kanban
|
||||
* @package kanban
|
||||
* @version $Id: createcard.html.php 5090 2021-12-13 13:49:24Z tainshujie@cnezsoft.com $
|
||||
* @link https://www.zentao.net
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user