diff --git a/db/update16.2.sql b/db/update16.2.sql index 129e637289..229e10e0e5 100644 --- a/db/update16.2.sql +++ b/db/update16.2.sql @@ -1,2 +1,4 @@ ALTER TABLE `zt_kanbanspace` ADD `type` varchar(50) NOT NULL AFTER `name`; UPDATE `zt_kanbanspace` SET `type` = 'cooperation'; + +ALTER TABLE `zt_kanban` ADD `importObject` varchar(255) NOT NULL AFTER `displayCards`; diff --git a/db/zentao.sql b/db/zentao.sql index 96d30fa663..0726ec6bd9 100644 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -679,6 +679,7 @@ CREATE TABLE `zt_kanban` ( `status` enum('active','closed') NOT NULL default 'active', `order` mediumint(8) NOT NULL DEFAULT '0', `displayCards` smallint(6) NOT NULL default '0', + `importObject` varchar(255) NOT NULL, `createdBy` char(30) NOT NULL, `createdDate` datetime NOT NULL, `lastEditedBy` char(30) NOT NULL, diff --git a/module/group/lang/resource.php b/module/group/lang/resource.php index e72e4e7126..e81d70dd46 100644 --- a/module/group/lang/resource.php +++ b/module/group/lang/resource.php @@ -675,6 +675,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->kanban->methodOrder[5] = 'space'; $lang->kanban->methodOrder[10] = 'createSpace'; @@ -720,6 +721,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] = 'import'; /* Execution. */ $lang->resource->execution = new stdclass(); diff --git a/module/kanban/control.php b/module/kanban/control.php index 3d62a1fc9a..ebaacc156f 100644 --- a/module/kanban/control.php +++ b/module/kanban/control.php @@ -1154,4 +1154,30 @@ class kanban extends control if(empty($lanes)) return; return print(html::select('otherLane', $lanes, '', "class='form-control'")); } + + /** + * Import. + * + * @param int $kanbanID + * @access public + * @return void + */ + public function import($kanbanID) + { + if(!empty($_POST)) + { + $this->kanban->import($kanbanID); + + if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); + + return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); + } + + $kanban = $this->kanban->getByID($kanbanID); + + $this->view->enableImport = empty($kanban->importObject) ? 'off' : 'on'; + $this->view->importObjects = empty($kanban->importObject) ? array() : explode(',', $kanban->importObject); + + $this->display(); + } } diff --git a/module/kanban/css/import.css b/module/kanban/css/import.css new file mode 100644 index 0000000000..b9a5c7ac76 --- /dev/null +++ b/module/kanban/css/import.css @@ -0,0 +1,2 @@ +#importForm .checkbox-primary:not(:first-child) {margin-left: 10px;} +#importForm .checkbox-primary {display: inline-block} diff --git a/module/kanban/js/import.js b/module/kanban/js/import.js new file mode 100644 index 0000000000..689502bdbe --- /dev/null +++ b/module/kanban/js/import.js @@ -0,0 +1,33 @@ +$(function() +{ + if(enableImport == 'off') $("input[name^='importObjectList']").attr('disabled', 'disabled'); + + $("input[name='import']").change(function() + { + if($(this).val() == 'off') + { + $("input[name^='importObjectList']").attr('disabled', 'disabled'); + } + else + { + $("input[name^='importObjectList']").removeAttr('disabled'); + } + }) + + $("input[name^='importObjectList']").change(function() + { + if($("input:checked[name^=importObjectList]").length != 0 && !$('#emptyTip').is('.hidden')) $('#emptyTip').addClass('hidden'); + }) + + $('#submit').click(function() + { + var enableImport = $("input:checked[name='import']").val(); + var objectListLength = $("input:checked[name^=importObjectList]").length; + + if(enableImport == 'on' && objectListLength == 0) + { + $('#emptyTip').removeClass('hidden'); + return false; + } + }) +}) diff --git a/module/kanban/lang/en.php b/module/kanban/lang/en.php index 5f841b2d1c..dab868fae0 100644 --- a/module/kanban/lang/en.php +++ b/module/kanban/lang/en.php @@ -55,6 +55,7 @@ $lang->kanban->restoreColumn = 'Restore Column'; $lang->kanban->restoreCard = 'Restore Card'; $lang->kanban->restore = 'Restore'; $lang->kanban->child = 'Child'; +$lang->kanban->import = 'Import'; /* Fields. */ $lang->kanban->space = 'Space'; @@ -158,6 +159,18 @@ $lang->kanban->error = new stdclass(); $lang->kanban->error->mustBeInt = 'The WIPs must be positive integer.'; $lang->kanban->error->parentLimitNote = 'The WIPs in the parent column cannot be < the sum of the WIPs in the child column.'; $lang->kanban->error->childLimitNote = 'The sum of products in the child column cannot be > the number of products in the parent column.'; +$lang->kanban->error->importObjNotEmpty = 'Please select at least one import object.'; + +$lang->kanban->importList = array(); +$lang->kanban->importList['off'] = 'Import is not enabled'; +$lang->kanban->importList['on'] = 'Enable the import function, you can only import content that you have permission to view.'; + +$lang->kanban->importObjectList = array(); +$lang->kanban->importObjectList['plan'] = 'Product Plan'; +$lang->kanban->importObjectList['release'] = 'Release'; +$lang->kanban->importObjectList['build'] = 'Build'; +$lang->kanban->importObjectList['execution'] = 'Execution'; +$lang->kanban->importObjectList['cards'] = 'Other Kanban Cards'; $lang->kanban->defaultColumn = array(); $lang->kanban->defaultColumn['wait'] = 'wait'; @@ -308,7 +321,7 @@ $lang->kanbancard->empty = 'No Card'; $lang->kanbancard->confirmArchive = 'Are you sure to archive this card? After archiving the card, it will be hidden from the column and you can view it in the Region - Archived.'; $lang->kanbancard->confirmDelete = 'Are you sure to delete this card? After deleting the card, it will be deleted from the Kanban. You can only view it in the system recycle bin.'; -$lang->kanbancard->confirmRestore = 'Are you sure you want to restore this card? After the card is restored, the card will be restored to the "%s" Kanban column.'; +$lang->kanbancard->confirmRestore = "Are you sure you want to restore this card? After the card is restored, the card will be restored to the '%s' Kanban column."; $lang->kanbancard->confirmRestoreTip = "The card's column has been archived or deleted, please restore '%s' column first."; $lang->kanbancard->priList[1] = 1; diff --git a/module/kanban/lang/zh-cn.php b/module/kanban/lang/zh-cn.php index 49cb9059ed..d1ddabe95e 100644 --- a/module/kanban/lang/zh-cn.php +++ b/module/kanban/lang/zh-cn.php @@ -55,6 +55,7 @@ $lang->kanban->restoreColumn = '还原看板列'; $lang->kanban->restoreCard = '还原卡片'; $lang->kanban->restore = '还原'; $lang->kanban->child = '子'; +$lang->kanban->import = '导入功能'; /* Fields. */ $lang->kanban->space = '所属空间'; @@ -155,9 +156,21 @@ $lang->kanban->my = '我的看板'; $lang->kanban->other = '其他'; $lang->kanban->error = new stdclass(); -$lang->kanban->error->mustBeInt = '在制品数量必须是正整数。'; -$lang->kanban->error->parentLimitNote = '父列的在制品数量不能小于子列在制品数量之和'; -$lang->kanban->error->childLimitNote = '子列在制品数量之和不能大于父列的在制品数量'; +$lang->kanban->error->mustBeInt = '在制品数量必须是正整数。'; +$lang->kanban->error->parentLimitNote = '父列的在制品数量不能小于子列在制品数量之和'; +$lang->kanban->error->childLimitNote = '子列在制品数量之和不能大于父列的在制品数量'; +$lang->kanban->error->importObjNotEmpty = '请至少选择一个导入对象'; + +$lang->kanban->importList = array(); +$lang->kanban->importList['off'] = '不启用导入功能'; +$lang->kanban->importList['on'] = '启用导入功能,只能导入自己有权限查看的内容'; + +$lang->kanban->importObjectList = array(); +$lang->kanban->importObjectList['plan'] = '产品计划'; +$lang->kanban->importObjectList['release'] = '产品发布'; +$lang->kanban->importObjectList['build'] = '项目版本'; +$lang->kanban->importObjectList['execution'] = '项目执行'; +$lang->kanban->importObjectList['cards'] = '其他看板卡片'; $lang->kanban->defaultColumn = array(); $lang->kanban->defaultColumn['wait'] = '未开始'; diff --git a/module/kanban/model.php b/module/kanban/model.php index 63672209aa..ab074c21a8 100644 --- a/module/kanban/model.php +++ b/module/kanban/model.php @@ -2525,6 +2525,7 @@ class kanbanModel extends model $actions .= "" . ' ' . $this->lang->kanban->setting . ''; $actions .= "