* Finish story #29765.
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
ALTER TABLE `zt_kanbanspace` ADD COLUMN `activatedBy` char(30) NOT NULL AFTER `closedDate`;
|
||||
ALTER TABLE `zt_kanbanspace` ADD COLUMN `activatedDate` datetime NOT NULL AFTER `activatedBy`;
|
||||
|
||||
ALTER TABLE `zt_kanban` ADD COLUMN `activatedBy` char(30) NOT NULL AFTER `closedDate`;
|
||||
ALTER TABLE `zt_kanban` ADD COLUMN `activatedDate` datetime NOT NULL AFTER `activatedBy`;
|
||||
@@ -624,6 +624,7 @@ $lang->resource->kanban->sortSpace = 'sortSpace';
|
||||
$lang->resource->kanban->create = 'create';
|
||||
$lang->resource->kanban->edit = 'edit';
|
||||
$lang->resource->kanban->view = 'view';
|
||||
$lang->resource->kanban->activate = 'activate';
|
||||
$lang->resource->kanban->close = 'close';
|
||||
$lang->resource->kanban->delete = 'delete';
|
||||
$lang->resource->kanban->createRegion = 'createRegion';
|
||||
@@ -712,6 +713,7 @@ $lang->kanban->methodorder[220] = 'setColumnWidth';
|
||||
$lang->kanban->methodOrder[225] = 'batchCreateCard';
|
||||
$lang->kanban->methodorder[230] = 'import';
|
||||
$lang->kanban->methodorder[235] = 'enableArchived';
|
||||
$lang->kanban->methodorder[240] = 'activate';
|
||||
|
||||
/* Execution. */
|
||||
$lang->resource->execution = new stdclass();
|
||||
|
||||
@@ -40,6 +40,7 @@ $config->kanban->editor->createspace = array('id' => 'desc', 'tools' => 'simple
|
||||
$config->kanban->editor->editspace = array('id' => 'desc', 'tools' => 'simpleTools');
|
||||
$config->kanban->editor->closespace = array('id' => 'comment', 'tools' => 'simpleTools');
|
||||
$config->kanban->editor->createcard = array('id' => 'desc', 'tools' => 'simpleTools');
|
||||
$config->kanban->editor->activate = array('id' => 'comment', 'tools' => 'simpleTools');
|
||||
$config->kanban->editor->close = array('id' => 'comment', 'tools' => 'simpleTools');
|
||||
$config->kanban->editor->editcard = array('id' => 'desc', 'tools' => 'simpleTools');
|
||||
$config->kanban->editor->viewcard = array('id' => 'comment', 'tools' => 'simpleTools');
|
||||
|
||||
@@ -239,6 +239,36 @@ class kanban extends control
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/*
|
||||
* Activate a kanban.
|
||||
*
|
||||
* @param int $kanbanID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function activate($kanbanID)
|
||||
{
|
||||
$this->loadModel('action');
|
||||
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$changes = $this->kanban->activate($kanbanID);
|
||||
|
||||
if(dao::isError()) return print(js::error(dao::getError()));
|
||||
|
||||
$actionID = $this->action->create('kanban', $kanbanID, 'activated', $this->post->comment);
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
|
||||
return print(js::reload('parent.parent'));
|
||||
}
|
||||
|
||||
$this->view->kanban = $this->kanban->getByID($kanbanID);
|
||||
$this->view->actions = $this->action->getList('kanban', $kanbanID);
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/*
|
||||
* Close a kanban.
|
||||
*
|
||||
|
||||
@@ -8,6 +8,7 @@ $lang->kanban->deleteSpace = 'Delete Space';
|
||||
$lang->kanban->sortSpace = 'Sort Space';
|
||||
$lang->kanban->edit = 'Edit Kanban';
|
||||
$lang->kanban->view = 'View Kanban';
|
||||
$lang->kanban->activate = 'Activate Kanban';
|
||||
$lang->kanban->close = 'Close Kanban';
|
||||
$lang->kanban->delete = 'Delete Kanban';
|
||||
$lang->kanban->createRegion = 'Create Region';
|
||||
|
||||
@@ -8,6 +8,7 @@ $lang->kanban->deleteSpace = '删除空间';
|
||||
$lang->kanban->sortSpace = '空间排序';
|
||||
$lang->kanban->edit = '设置看板';
|
||||
$lang->kanban->view = '查看看板';
|
||||
$lang->kanban->activate = '激活看板';
|
||||
$lang->kanban->close = '关闭看板';
|
||||
$lang->kanban->delete = '删除看板';
|
||||
$lang->kanban->createRegion = '新增区域';
|
||||
|
||||
+36
-3
@@ -2053,6 +2053,37 @@ class kanbanModel extends model
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate a kanban.
|
||||
*
|
||||
* @param int $kanbanID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
function activate($kanbanID)
|
||||
{
|
||||
$kanbanID = (int)$kanbanID;
|
||||
$oldKanban = $this->getByID($kanbanID);
|
||||
$now = helper::now();
|
||||
$kanban = fixer::input('post')
|
||||
->setDefault('status', 'active')
|
||||
->setDefault('activatedBy', $this->app->user->account)
|
||||
->setDefault('activatedDate', $now)
|
||||
->setDefault('closedBy', '')
|
||||
->setDefault('closedDate', '0000-00-00 00:00:00')
|
||||
->setDefault('lastEditedBy', $this->app->user->account)
|
||||
->setDefault('lastEditedDate', $now)
|
||||
->remove('comment')
|
||||
->get();
|
||||
|
||||
$this->dao->update(TABLE_KANBAN)->data($kanban)
|
||||
->autoCheck()
|
||||
->where('id')->eq($kanbanID)
|
||||
->exec();
|
||||
|
||||
if(!dao::isError()) return common::createChanges($oldKanban, $kanban);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close a kanban.
|
||||
*
|
||||
@@ -2069,6 +2100,8 @@ class kanbanModel extends model
|
||||
->setDefault('status', 'closed')
|
||||
->setDefault('closedBy', $this->app->user->account)
|
||||
->setDefault('closedDate', $now)
|
||||
->setDefault('activatedBy', '')
|
||||
->setDefault('activatedDate', '0000-00-00 00:00:00')
|
||||
->setDefault('lastEditedBy', $this->app->user->account)
|
||||
->setDefault('lastEditedDate', $now)
|
||||
->remove('comment')
|
||||
@@ -2950,7 +2983,7 @@ class kanbanModel extends model
|
||||
|
||||
$CRKanban = !(isset($this->config->CRKanban) and $this->config->CRKanban == '0' and $kanban->status == 'closed');
|
||||
$printRegionBtn = ($CRKanban and (common::hasPriv('kanban', 'createRegion') or $printSetHeightBtn or common::hasPriv('kanban', 'performable') or common::hasPriv('kanban', 'enableArchived') or common::hasPriv('kanban', 'import') or common::hasPriv('kanban', 'setColumnWidth')));
|
||||
$printKanbanBtn = (common::hasPriv('kanban', 'edit') or common::hasPriv('kanban', 'close') or common::hasPriv('kanban', 'delete'));
|
||||
$printKanbanBtn = (common::hasPriv('kanban', 'edit') or ($kanban->status == 'active' and common::hasPriv('kanban', 'close')) or common::hasPriv('kanban', 'delete') or ($kanban->status == 'closed' and common::hasPriv('kanban', 'activate')));
|
||||
|
||||
if($printRegionBtn or $printKanbanBtn)
|
||||
{
|
||||
@@ -2970,9 +3003,9 @@ class kanbanModel extends model
|
||||
if(common::hasPriv('kanban', 'performable') and $CRKanban) $actions .= '<li>' . html::a(helper::createLink('kanban', 'performable', "kanbanID=$kanban->id", '', true), '<i class="icon icon-checked"></i>' . $this->lang->kanban->manageProgress, '', "class='iframe btn btn-link' data-width=40%") . '</li>';
|
||||
|
||||
$kanbanActions = '';
|
||||
$attr = $kanban->status == 'closed' ? "disabled='disabled'" : '';
|
||||
if(common::hasPriv('kanban', 'edit')) $kanbanActions .= '<li>' . html::a(helper::createLink('kanban', 'edit', "kanbanID=$kanban->id", '', true), '<i class="icon icon-edit"></i>' . $this->lang->kanban->edit, '', "class='iframe btn btn-link' data-width='75%'") . '</li>';
|
||||
if(common::hasPriv('kanban', 'close')) $kanbanActions .= '<li>' . html::a(helper::createLink('kanban', 'close', "kanbanID=$kanban->id", '', true), '<i class="icon icon-off"></i>' . $this->lang->kanban->close, '', "class='iframe btn btn-link' $attr") . '</li>';
|
||||
if(common::hasPriv('kanban', 'close') and $kanban->status == 'active') $kanbanActions .= '<li>' . html::a(helper::createLink('kanban', 'close', "kanbanID=$kanban->id", '', true), '<i class="icon icon-off"></i>' . $this->lang->kanban->close, '', "class='iframe btn btn-link'") . '</li>';
|
||||
if(common::hasPriv('kanban', 'activate') and $kanban->status == 'closed') $kanbanActions .= '<li>' . html::a(helper::createLink('kanban', 'activate', "kanbanID=$kanban->id", '', true), '<i class="icon icon-magic"></i>' . $this->lang->kanban->activate, '', "class='iframe btn btn-link'") . '</li>';
|
||||
if(common::hasPriv('kanban', 'delete')) $kanbanActions .= '<li>' . html::a(helper::createLink('kanban', 'delete', "kanbanID=$kanban->id"), '<i class="icon icon-trash"></i>' . $this->lang->kanban->delete, 'hiddenwin', "class='btn btn-link'") . '</li>';
|
||||
if($kanbanActions)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* The activate file 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 Mengyi Liu <liumengyi@easycorp.ltd>
|
||||
* @package kanban
|
||||
* @version $Id: activate.html.php 935 2021-12-09 10:49:24Z $
|
||||
* @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'>
|
||||
<div class='center-block'>
|
||||
<div class='main-header'>
|
||||
<h2>
|
||||
<span class='label label-id'><?php echo $kanban->id;?></span>
|
||||
<?php echo "<span title='$kanban->name'>" . $kanban->name . '</span>';?>
|
||||
</h2>
|
||||
</div>
|
||||
<form method='post' enctype='multipart/form-data' target='hiddenwin'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th><?php echo $lang->comment;?></th>
|
||||
<td colspan='2'><?php echo html::textarea('comment', '', "rows='6'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='3' class='text-center form-actions'>
|
||||
<?php echo html::submitButton($lang->kanban->activate);?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<hr class='small' />
|
||||
<div class='main'><?php include '../../common/view/action.html.php';?></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
@@ -68,7 +68,7 @@
|
||||
<?php endif;?>
|
||||
<strong title='<?php echo $kanban->name;?>'><?php echo $kanban->name;?></strong>
|
||||
</div>
|
||||
<?php $canActions = (common::hasPriv('kanban','edit') or common::hasPriv('kanban','close') or common::hasPriv('kanban','delete'));?>
|
||||
<?php $canActions = (common::hasPriv('kanban','edit') or (common::hasPriv('kanban','close') and $kanban->status == 'active') or common::hasPriv('kanban','delete') or (common::hasPriv('kanban','activate') and $kanban->status == 'closed'));?>
|
||||
<?php if($canActions):?>
|
||||
<div class='kanban-actions kanban-actions<?php echo $kanbanID;?>'>
|
||||
<div class='dropdown'>
|
||||
@@ -81,11 +81,16 @@
|
||||
common::printLink('kanban', 'edit', "kanbanID={$kanban->id}", '<i class="icon icon-edit"></i> ' . $lang->kanban->edit, '', "class='iframe' data-width='75%'", '', true);
|
||||
echo '</li>';
|
||||
}
|
||||
if(common::hasPriv('kanban','close'))
|
||||
if(common::hasPriv('kanban','close') and $kanban->status == 'active')
|
||||
{
|
||||
$class = $kanban->status == 'closed' ? 'disabled' : '';
|
||||
echo "<li class='{$class}'>";
|
||||
common::printLink('kanban', 'close', "kanbanID={$kanban->id}", '<i class="icon icon-off"></i> ' . $lang->kanban->close, '', "class='iframe {$class}' data-width='75%'", '', true);
|
||||
echo "<li>";
|
||||
common::printLink('kanban', 'close', "kanbanID={$kanban->id}", '<i class="icon icon-off"></i> ' . $lang->kanban->close, '', "class='iframe' data-width='75%'", '', true);
|
||||
echo '</li>';
|
||||
}
|
||||
if(common::hasPriv('kanban','activate') and $kanban->status == 'closed')
|
||||
{
|
||||
echo "<li>";
|
||||
common::printLink('kanban', 'activate', "kanbanID={$kanban->id}", '<i class="icon icon-magic"></i> ' . $lang->kanban->activate, '', "class='iframe' data-width='75%'", '', true);
|
||||
echo '</li>';
|
||||
}
|
||||
if(common::hasPriv('kanban','delete'))
|
||||
|
||||
Reference in New Issue
Block a user