* Finish task #45829.

This commit is contained in:
tianshujie
2021-12-13 15:37:33 +08:00
parent a14bfc93e7
commit 6a894bc7fb
12 changed files with 232 additions and 10 deletions
+1
View File
@@ -289,6 +289,7 @@ $config->objectTables['kanbancolumn'] = TABLE_KANBANCOLUMN;
$config->objectTables['kanbanlane'] = TABLE_KANBANLANE;
$config->objectTables['kanbanorder'] = TABLE_KANBANORDER;
$config->objectTables['kanbangroup'] = TABLE_KANBANGROUP;
$config->objectTables['kanbancard'] = TABLE_KANBANCARD;
$config->newFeatures = array('introduction', 'tutorial', 'youngBlueTheme');
+6
View File
@@ -15,6 +15,8 @@ $config->kanban->edit = new stdclass();
$config->kanban->createspace = new stdclass();
$config->kanban->editspace = new stdclass();
$config->kanban->editcard = new stdclass();
$config->kanban->setwip->requiredFields = 'limit';
$config->kanban->setlane->requiredFields = 'name,type';
$config->kanban->setlaneColumn->requiredFields = 'name';
@@ -23,6 +25,8 @@ $config->kanban->edit->requiredFields = 'space,name';
$config->kanban->createspace->requiredFields = 'name,owner';
$config->kanban->editspace->requiredFields = 'name,owner';
$config->kanban->editcard->requiredFields = 'name';
$config->kanban->editor = new stdclass();
$config->kanban->editor->create = array('id' => 'desc', 'tools' => 'simpleTools');
$config->kanban->editor->edit = array('id' => 'desc', 'tools' => 'simpleTools');
@@ -30,6 +34,8 @@ $config->kanban->editor->createspace = array('id' => 'desc', 'tools' => 'simpleT
$config->kanban->editor->editspace = array('id' => 'desc', 'tools' => 'simpleTools');
$config->kanban->editor->close = array('id' => 'comment', 'tools' => 'simpleTools');
$config->kanban->editor->editcard = array('id' => 'desc', 'tools' => 'simpleTools');
$config->kanban->default = new stdclass();
$config->kanban->default->story = new stdclass();
$config->kanban->default->story->name = $lang->SRCommon;
+29
View File
@@ -263,6 +263,35 @@ class kanban extends control
$this->display();
}
/**
* Edit a card.
*
* @param int $cardID
* @access public
* @return void
*/
public function editCard($cardID)
{
$this->loadModel('action');
if(!empty($_POST))
{
$changes = $this->kanban->updateCard($cardID);
if(dao::isError()) die(js::error(dao::getError()));
$actionID = $this->action->create('kanbanCard', $cardID, 'edited');
$this->action->logHistory($actionID, $changes);
die(js::reload('parent.parent'));
}
$this->view->card = $this->kanban->getCardByID($cardID);
$this->view->actions = $this->action->getList('kanbancard', $cardID);
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->display();
}
/**
* Set WIP.
*
+3 -1
View File
@@ -216,4 +216,6 @@ $lang->kanbanregion->default = 'Default Region';
$lang->kanbancard = new stdclass();
$lang->kanbancard->create = 'Create Card';
$lang->kanbancard->name = 'Card Name';
$lang->kanbancard->name = 'Card Name';
$lang->kanbancard->legendBasicInfo = 'Basic Info';
$lang->kanbancard->legendLifeTime = 'Card Life';
+3 -1
View File
@@ -216,4 +216,6 @@ $lang->kanbanregion->default = '默认区域';
$lang->kanbancard = new stdclass();
$lang->kanbancard->create = '创建卡片';
$lang->kanbancard->name = '卡片名称';
$lang->kanbancard->name = '卡片名称';
$lang->kanbancard->legendBasicInfo = '基本信息';
$lang->kanbancard->legendLifeTime = '卡片的一生';
+99 -4
View File
@@ -316,7 +316,10 @@ class kanbanModel extends model
*/
public function getByID($kanbanID)
{
return $this->dao->findByID($kanbanID)->from(TABLE_KANBAN)->fetch();
$kanban = $this->dao->findByID($kanbanID)->from(TABLE_KANBAN)->fetch();
$kanban = $this->loadModel('file')->replaceImgURL($kanban, 'desc');
return $kanban;
}
/**
@@ -727,6 +730,8 @@ class kanbanModel extends model
if(strpos(",{$space->team},", ",$account,") === false and $space->owner != $account) $space->team .= ",$account";
$space = $this->loadModel('file')->processImgURL($space, $this->config->kanban->editor->createspace['id'], $this->post->uid);
$this->dao->insert(TABLE_KANBANSPACE)->data($space)
->autoCheck()
->batchCheck($this->config->kanban->createspace->requiredFields, 'notempty')
@@ -736,6 +741,8 @@ class kanbanModel extends model
{
$spaceID = $this->dao->lastInsertID();
$this->saveOrder(0, '', $spaceID, 'space', '', $spaceID);
$this->file->saveUpload('kanbanspace', $spaceID);
$this->file->updateObjectID($this->post->uid, $spaceID, 'kanbanspace');
return $spaceID;
}
@@ -760,13 +767,20 @@ class kanbanModel extends model
->remove('uid,contactListMenu')
->get();
$space = $this->loadModel('file')->processImgURL($space, $this->config->kanban->editor->editspace['id'], $this->post->uid);
$this->dao->update(TABLE_KANBANSPACE)->data($space)
->autoCheck()
->batchCheck($this->config->kanban->editspace->requiredFields, 'notempty')
->where('id')->eq($spaceID)
->exec();
if(!dao::isError()) return common::createChanges($oldSpace, $space);
if(!dao::isError())
{
$this->file->saveUpload('kanbanspace', $spaceID);
$this->file->updateObjectID($this->post->uid, $spaceID, 'kanbanspace');
return common::createChanges($oldSpace, $space);
}
}
/**
@@ -852,6 +866,8 @@ class kanbanModel extends model
if(strpos(",{$kanban->team},", ",$account,") === false and $kanban->owner != $account) $kanban->team .= ",$account";
$kanban = $this->loadModel('file')->processImgURL($kanban, $this->config->kanban->editor->create['id'], $this->post->uid);
$this->dao->insert(TABLE_KANBAN)->data($kanban)
->autoCheck()
->batchCheck($this->config->kanban->create->requiredFields, 'notempty')
@@ -863,6 +879,8 @@ class kanbanModel extends model
$this->saveOrder(0, '', $kanbanID, 'kanban', '', $kanbanID);
$this->initKanban($kanbanID);
$this->file->saveUpload('kanban', $kanbanID);
$this->file->updateObjectID($this->post->uid, $kanbanID, 'kanban');
return $kanbanID;
}
@@ -888,13 +906,21 @@ class kanbanModel extends model
->remove('uid,contactListMenu')
->get();
$kanban = $this->loadModel('file')->processImgURL($kanban, $this->config->kanban->editor->edit['id'], $this->post->uid);
$this->dao->update(TABLE_KANBAN)->data($kanban)
->autoCheck()
->batchCheck($this->config->kanban->edit->requiredFields, 'notempty')
->where('id')->eq($kanbanID)
->exec();
if(!dao::isError()) return common::createChanges($oldKanban, $kanban);
if(!dao::isError())
{
$this->file->saveUpload('kanban', $kanbanID);
$this->file->updateObjectID($this->post->uid, $kanbanID, 'kanban');
return common::createChanges($oldKanban, $kanban);
}
}
/**
@@ -1402,6 +1428,58 @@ class kanbanModel extends model
->exec();
}
/**
* Update a card.
*
* @param int $cardID
* @access public
* @return array
*/
public function updateCard($cardID)
{
if($this->post->estimate < 0)
{
dao::$errors[] = $this->lang->kanbancard->error->recordMinus;
return false;
}
if($this->post->begin > $this->post->end)
{
dao::$errors[] = $this->lang->kanbancard->error->endSmall;
return false;
}
$cardID = (int)$cardID;
$oldCard = $this->getCardById($cardID);
$now = helper::now();
$card = fixer::input('post')
->add('lastEditedBy', $this->app->user->account)
->add('createdDate', $now)
->setDefault('estimate', $oldCard->estimate)
->setIF(!empty($this->post->assignedTo) and $oldCard->assignedTo != $this->post->assignedTo, 'assignedDate', $now)
->setIF(is_numeric($this->post->estimate), 'estimate', (float)$this->post->estimate)
->remove('uid')
->get();
$card = $this->loadModel('file')->processImgURL($card, $this->config->kanban->editor->editcard['id'], $this->post->uid);
$this->dao->update(TABLE_KANBANCARD)->data($card)
->autoCheck()
->checkIF($card->estimate != '', 'estimate', 'float')
->batchcheck($this->config->kanban->editcard->requiredFields, 'notempty')
->where('id')->eq($cardID)
->exec();
if(!dao::isError())
{
$this->file->saveUpload('kanbancard', $cardID);
$this->file->updateObjectID($this->post->uid, $cardID, 'kanbancard');
return common::createChanges($oldCard, $card);
}
}
/**
* Set WIP limit.
*
@@ -1586,7 +1664,9 @@ class kanbanModel extends model
*/
public function getSpaceById($spaceID)
{
return $this->dao->findById($spaceID)->from(TABLE_KANBANSPACE)->fetch();
$space = $this->dao->findById($spaceID)->from(TABLE_KANBANSPACE)->fetch();
$space = $this->loadModel('file')->replaceImgURL($space, 'desc');
return $space;
}
/**
@@ -1719,6 +1799,21 @@ class kanbanModel extends model
return $groupList;
}
/**
* Get card by id.
*
* @param int $cardID
* @access public
* @return object
*/
public function getCardByID($cardID)
{
$card = $this->dao->select('*')->from(TABLE_KANBANCARD)->where('id')->eq($cardID)->fetch();
$card = $this->loadModel('file')->replaceImgURL($card, 'desc');
return $card;
}
/**
* Get Kanban cards menus by execution id.
*
+1
View File
@@ -29,6 +29,7 @@
<tr>
<td colspan='3' class='text-center form-actions'>
<?php echo html::submitButton($lang->kanban->close);?>
<?php echo html::commonButton($lang->cancel, "data-dismiss='modal'", 'btn btn-wide');?>
</td>
</tr>
</table>
+4 -1
View File
@@ -56,7 +56,10 @@
<td><?php echo html::select('whitelist[]', $users, '', 'class="form-control chosen" multiple');?></td>
</tr>
<tr>
<td colspan='3' class='text-center form-actions'><?php echo html::submitButton();?></td>
<td colspan='3' class='text-center form-actions'>
<?php echo html::submitButton();?>
<?php echo html::commonButton($lang->cancel, "data-dismiss='modal'", 'btn btn-wide');?>
</td>
</tr>
</table>
</form>
+4 -1
View File
@@ -52,7 +52,10 @@
<td><?php echo html::select('whitelist[]', $users, '', 'class="form-control chosen" multiple');?></td>
</tr>
<tr>
<td colspan='3' class='text-center form-actions'><?php echo html::submitButton();?></td>
<td colspan='3' class='text-center form-actions'>
<?php echo html::submitButton();?>
<?php echo html::commonButton($lang->cancel, "data-dismiss='modal'", 'btn btn-wide');?>
</td>
</tr>
</table>
</form>
+4 -1
View File
@@ -56,7 +56,10 @@
<td><?php echo html::select('whitelist[]', $users, $kanban->whitelist, 'class="form-control chosen" multiple');?></td>
</tr>
<tr>
<td colspan='3' class='text-center form-actions'><?php echo html::submitButton();?></td>
<td colspan='3' class='text-center form-actions'>
<?php echo html::submitButton();?>
<?php echo html::commonButton($lang->cancel, "data-dismiss='modal'", 'btn btn-wide');?>
</td>
</tr>
</table>
</form>
+74
View File
@@ -0,0 +1,74 @@
<?php
/**
* The editcard of kanban module of ZenTaoPMS.
*
* @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@easycorp.ltd>
* @package kanban
* @version $Id: editcard.html.php 4903 2021-12-13 14:25:59Z $
* @link https://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<div id="mainContent" class="main-content fade">
<form method='post' enctype='multipart/form-data' target='hiddenwin' id='dataform'>
<div class='main-header'>
<h2><?php echo $lang->kanbancard->edit;?></h2>
</div>
<div class='main-row'>
<div class='main-col col-8'>
<div class='cell'>
<div class='detail'>
<div class='detail-title'><?php echo $lang->kanbancard->name;?></div>
<div class='form-group'>
<div class="input-control has-icon-right">
<?php echo html::input('name', $card->name, 'class="form-control"');?>
</div>
</div>
</div>
<div class='detail'>
<div class='detail-title'><?php echo $lang->kanbancard->desc;?></div>
<div class='form-group'>
<?php echo html::textarea('desc', $card->desc, "rows='5' class='form-control'");?>
</div>
</div>
<div class='detail text-center form-actions'>
<?php echo html::submitButton();?>
<?php echo html::commonButton($lang->cancel, "data-dismiss='modal'", 'btn btn-wide');?>
</div>
<?php include '../../common/view/action.html.php';?>
</div>
</div>
<div class='side-col col-4'>
<div class='cell'>
<div class='detail'>
<div class='detail-title'><?php echo $lang->kanbancard->legendBasicInfo;?></div>
<table class="table table-form">
<tr>
<?php unset($users['closed']);?>
<th><?php echo $lang->kanbancard->assignedTo;?></th>
<td><?php echo html::select('assignedTo', $users, $card->assignedTo, "class='form-control chosen' multiple");?></td>
</tr>
<tr>
<th><?php echo $lang->kanbancard->begin;?></th>
<td><?php echo html::input('begin', helper::isZeroDate($card->begin) ? '' : $card->begin, "class='form-control form-datetime'");?></td>
</tr>
<tr>
<th><?php echo $lang->kanbancard->end;?></th>
<td><?php echo html::input('end', helper::isZeroDate($card->end) ? '' : $card->end, "class='form-control form-datetime'");?></td>
</tr>
<tr>
<th><?php echo $lang->kanbancard->pri;?></th>
<td><?php echo html::select('pri', $lang->kanbancard->priList, $card->pri, "class='form-control'");?></td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
<?php include '../../common/view/footer.html.php';?>
+4 -1
View File
@@ -53,7 +53,10 @@
<td><?php echo html::select('whitelist[]', $users, $space->whitelist, 'class="form-control chosen" multiple');?></td>
</tr>
<tr>
<td colspan='3' class='text-center form-actions'><?php echo html::submitButton();?></td>
<td colspan='3' class='text-center form-actions'>
<?php echo html::submitButton();?>
<?php echo html::commonButton($lang->cancel, "data-dismiss='modal'", 'btn btn-wide');?>
</td>
</tr>
</table>
</form>