diff --git a/module/productplan/config.php b/module/productplan/config.php index 3c07e859d5..a669201cc0 100644 --- a/module/productplan/config.php +++ b/module/productplan/config.php @@ -10,5 +10,6 @@ $config->productplan->start->requiredFields = 'begin,end'; $config->productplan->editor = new stdclass(); $config->productplan->editor->create = array('id' => 'desc', 'tools' => 'simpleTools'); $config->productplan->editor->edit = array('id' => 'desc', 'tools' => 'simpleTools'); +$config->productplan->editor->start = array('id' => 'desc', 'tools' => 'simpleTools'); $config->productplan->laneColorList = array('#32C5FF', '#006AF1', '#9D28B2', '#FF8F26', '#FFC20E', '#00A78E', '#7FBB00', '#424BAC', '#C0E9FF', '#EC2761'); diff --git a/module/productplan/control.php b/module/productplan/control.php index 8b6204bf00..e9d42232d9 100644 --- a/module/productplan/control.php +++ b/module/productplan/control.php @@ -420,6 +420,7 @@ class productplan extends control return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess,'locate' => 'parent')); } + $this->view->plan = $plan; $this->display(); } diff --git a/module/productplan/js/browse.js b/module/productplan/js/browse.js index 5b6e183368..19e22af2a3 100644 --- a/module/productplan/js/browse.js +++ b/module/productplan/js/browse.js @@ -198,8 +198,7 @@ function findDropColumns($element, $root) var $col = $element.closest('.kanban-col'); var col = $col.data(); var lane = $col.closest('.kanban-lane').data(); - var kanbanID = $root.data('id'); - var kanbanRules = window.kanbanDropRules ? window.kanbanDropRules[kanbanID] : null; + var kanbanRules = window.kanbanDropRules ? window.kanbanDropRules : null; if(!kanbanRules) return $root.find('.kanban-lane[data-id="' + lane.id + '"] .kanban-lane-col:not([data-type="project"],[data-type="' + col.type + '"])'); @@ -251,6 +250,50 @@ function handleFinishDrop(event) function changeCardColType(card, fromColType, toColType, kanbanID) { if(typeof card == 'undefined') return false; + var objectID = card.id; + var privs = card.actions; + var showIframe = false; + var link = ''; + + if(toColType == 'doing') + { + if(fromColType == 'wait' && privs.includes('start')) + { + var link = createLink('productplan', 'start', 'planID=' + objectID, '', true); + showIframe = true; + } + else if((fromColType == 'done' || fromColType == 'closed') && privs.includes('activate')) + { + var link = createLink('productplan', 'activate', 'planID=' + objectID, '', true); + showIframe = false; + } + } + else if(toColType == 'done') + { + if(fromColType == 'doing') + { + var link = createLink('productplan', 'finish', 'planID=' + objectID, '', true); + showIframe = false; + } + } + else if(toColType == 'closed') + { + if(fromColType == 'done') + { + var link = createLink('productplan', 'close', 'planID=' + objectID); + showIframe = false; + } + } + + if(showIframe) + { + var modalTrigger = new $.zui.ModalTrigger({type: 'iframe', width: '50%', url: link}); + modalTrigger.show(); + } + else if(!showIframe && link) + { + hiddenwin.location.href = link; + } } /** @@ -374,3 +417,14 @@ function getPlanID(obj, branch) } }); } + +if(!window.kanbanDropRules) +{ + window.kanbanDropRules = + { + wait: ['doing'], + doing: ['done'], + done: ['doing', 'closed'], + closed: ['doing'] + } +} diff --git a/module/productplan/model.php b/module/productplan/model.php index 2d9fca41e1..4561d53268 100644 --- a/module/productplan/model.php +++ b/module/productplan/model.php @@ -521,10 +521,15 @@ class productplanModel extends model if($status == 'doing' and !empty($_POST)) { - $plan = fixer::input('post')->add('status', $status)->get(); + $plan = fixer::input('post') + ->add('status', $status) + ->stripTags($this->config->productplan->editor->start['id'], $this->config->allowedTags) + ->remove('uid') + ->get(); $this->checkDate4Plan($oldPlan, $plan->begin, $plan->end); if(dao::isError()) return false; + $plan = $this->loadModel('file')->processImgURL($plan, $this->config->productplan->editor->start['id'], $this->post->uid); $this->dao->update(TABLE_PRODUCTPLAN) ->data($plan) @@ -534,6 +539,8 @@ class productplanModel extends model ->where('id')->eq($planID) ->beginIF(isset($parentPlan))->orWhere('id')->eq($oldPlan->parent)->fi() ->exec(); + + $this->file->updateObjectID($this->post->uid, $planID, 'productplan'); if($parentPlan->status != 'doing') $parentChange = true; } elseif($status == 'doing' and isset($parentPlan) and $parentPlan->status != 'doing') @@ -959,7 +966,7 @@ class productplanModel extends model if($plan->status != 'done' or $plan->parent < 0) return false; break; case 'activate' : - if($plan->status != 'closed' or $plan->parent < 0) return false; + if(($plan->status != 'closed' and $plan->status != 'done') or $plan->parent < 0) return false; break; } diff --git a/module/productplan/view/browsebylist.html.php b/module/productplan/view/browsebylist.html.php index 96ba8f4bc7..6f3ce09231 100644 --- a/module/productplan/view/browsebylist.html.php +++ b/module/productplan/view/browsebylist.html.php @@ -147,12 +147,12 @@ if($plan->begin == '2030-01-01' or $plan->end == '2030-01-01') { $class = 'iframe'; - $attr = "data-toggle='modal' data-id='{$plan->id}' data-width='550px'"; + $attr = "data-id='{$plan->id}' data-width='550px'"; $isOnlyBody = true; } - common::printIcon('productplan', 'start', "planID=$plan->id", $plan, 'list', 'play', '', $class, $isOnlyBody, $attr, $lang->productplan->start); - common::printIcon('productplan', 'finish', "planID=$plan->id", $plan, 'list', 'checked', '', $class, false, $attr, $lang->productplan->finish); - common::printIcon('productplan', 'close', "planID=$plan->id", $plan, 'list', 'off', '', $class, false, $attr, $lang->productplan->close); + common::printIcon('productplan', 'start', "planID=$plan->id", $plan, 'list', 'play', '', $class, $isOnlyBody); + common::printIcon('productplan', 'finish', "planID=$plan->id", $plan, 'list', 'checked', '', $class, false, $attr); + common::printIcon('productplan', 'close', "planID=$plan->id", $plan, 'list', 'off', '', $class, false, $attr); } $attr = $plan->expired ? "disabled='disabled'" : ''; diff --git a/module/productplan/view/start.html.php b/module/productplan/view/start.html.php index 1f9a9c43b5..5087c5207d 100644 --- a/module/productplan/view/start.html.php +++ b/module/productplan/view/start.html.php @@ -10,11 +10,8 @@ * @link https://www.zentao.net */ ?> - +