*Finish task #46095.

This commit is contained in:
songchenxuan
2021-12-20 18:10:40 +08:00
parent 1bbb985b3e
commit ca1230076f
7 changed files with 68 additions and 13 deletions
+17 -3
View File
@@ -115,9 +115,12 @@ class productplan extends control
}
$plan = $this->productplan->getByID($planID);
$oldBranch = array();
$oldBranch[$planID] = $plan->branch;
$this->commonAction($plan->product, $plan->branch);
$this->view->title = $this->view->product->name . $this->lang->colon . $this->lang->productplan->edit;
$this->view->position[] = $this->lang->productplan->edit;
$this->view->oldBranch = $oldBranch;
$this->view->plan = $plan;
$this->display();
}
@@ -135,18 +138,26 @@ class productplan extends control
{
if(isset($_POST['planIDList']))
{
$this->commonAction($productID, $branch);
$this->view->title = $this->lang->productplan->batchEdit;
$this->view->position[] = html::a(inlink('browse', "productID=$productID&branch=$branch"), $this->lang->productplan->common);
$this->view->position[] = $this->lang->productplan->batchEdit;
$this->view->plans = $this->productplan->getByIDList($this->post->planIDList);
$plans = $this->productplan->getByIDList($this->post->planIDList);
$this->view->plans = $plans;
$oldBranch = array();
foreach($plans as $plan) $oldBranch[$plan->id] = $plan->branch;
$this->view->oldBranch = $oldBranch;
$product = $this->loadModel('product')->getById($productID);
$this->view->branchProduct = $product->type == 'normal' ? false : true;
die($this->display());
}
elseif($_POST)
{
$changes = $this->productplan->batchUpdate($productID);
$this->productplan->synchronizeStory($changes);
$this->synchronizeStory($changes);
$this->loadModel('action');
foreach($changes as $planID => $change)
{
@@ -686,6 +697,7 @@ class productplan extends control
}
}
$oldBranch = '';
$newBranch = '';
}
}
/**
@@ -696,8 +708,10 @@ class productplan extends control
* @access public
* @return void
*/
public function ajaxGetConflictStory($planID, $oldBranch, $newBranch)
public function ajaxGetConflictStory($planID, $newBranch)
{
$plan = $this->productplan->getByID($planID);
$oldBranch = $plan->branch;
$planStories = $this->loadModel('story')->getPlanStories($planID, 'all');
$conflictStoryIdList = '';
if($oldBranch)
+12
View File
@@ -24,3 +24,15 @@ function changeDate(planID)
$('.form-date').datetimepicker('update');
}
};
function loadWarning(planID, branch)
{
$.get(createLink('productplan', 'ajaxGetConflictStory', 'planID=' + planID + '&newBranch=' + branch), function(conflictStories)
{
if(conflictStories != '' && !confirm(conflictStories))
{
console.log('yes');
$('#branch' + planID).val(oldBranch[planID]);
$('#branch' + planID).trigger("chosen:updated");
}
});
}
+7 -3
View File
@@ -12,11 +12,15 @@ function convertStringToDate(dateString)
return Date.parse(dateString);
}
function loadWarning(branch)
function loadWarning(planID, branch)
{
$.get(createLink('productplan', 'ajaxGetConflictStory', 'planID=' + planID + '&oldBranch=' + oldBranch + '&newBranch=' + branch), function(conflictStories)
$.get(createLink('productplan', 'ajaxGetConflictStory', 'planID=' + planID + '&newBranch=' + branch), function(conflictStories)
{
if(conflictStories != '') alert(conflictStories);
if(conflictStories != '' && !confirm(conflictStories))
{
$('#branch').val(oldBranch[planID]);
$('#branch').trigger("chosen:updated");
}
});
}
+16
View File
@@ -0,0 +1,16 @@
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
!_TAG_PROGRAM_NAME Exuberant Ctags //
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
!_TAG_PROGRAM_VERSION 5.9~svn20110310 //
changeDate batchedit.js /^function changeDate(planID)$/;" f
computeEndDate create.js /^function computeEndDate(delta)$/;" f
computeEndDate edit.js /^function computeEndDate(delta)$/;" f
convertStringToDate create.js /^function convertStringToDate(dateString)$/;" f
convertStringToDate edit.js /^function convertStringToDate(dateString)$/;" f
getPlanID browse.js /^function getPlanID(obj, branch)$/;" f
loadURL view.js /^function loadURL(url, type)$/;" f
loadWarning batchedit.js /^function loadWarning(planID, branch)$/;" f
loadWarning edit.js /^function loadWarning(planID, branch)$/;" f
showLink view.js /^function showLink(planID, type, orderBy, param)$/;" f
+5 -4
View File
@@ -501,10 +501,11 @@ class productplanModel extends model
foreach($data->id as $planID)
{
$plan = new stdclass();
$plan->title = $data->title[$planID];
$plan->desc = $purifier->purify($data->desc[$planID]);
$plan->begin = $data->begin[$planID];
$plan->end = $data->end[$planID];
$plan->branch = $data->branch[$planID];
$plan->title = $data->title[$planID];
$plan->desc = $purifier->purify($data->desc[$planID]);
$plan->begin = $data->begin[$planID];
$plan->end = $data->end[$planID];
if(empty($plan->title))die(js::alert(sprintf($this->lang->productplan->errorNoTitle, $planID)));
if(empty($plan->begin))die(js::alert(sprintf($this->lang->productplan->errorNoBegin, $planID)));
@@ -12,6 +12,7 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/datepicker.html.php';?>
<?php js::set('oldBranch', $oldBranch)?>
<div id="mainContent" class="main-content">
<div class="main-header">
<h2><?php echo $lang->productplan->batchEdit;?></h2>
@@ -21,6 +22,9 @@
<thead>
<tr class='text-center'>
<th class='c-id'><?php echo $lang->productplan->id?></th>
<?php if($branchProduct):?>
<th class='c-branch'><?php echo $lang->productplan->branch;?></th>
<?php endif;?>
<th><?php echo $lang->productplan->title?></th>
<th><?php echo $lang->productplan->desc?></th>
<th class='c-full-date'><?php echo $lang->productplan->begin?></th>
@@ -39,6 +43,11 @@
<?php $isChecked = ($plan->begin == '2030-01-01' || $plan->end == '2030-01-01') ? 'checked="checked"' : '';?>
<tr>
<td class='text-center'><?php echo $plan->id . html::hidden("id[$plan->id]", $plan->id);?></td>
<?php if($branchProduct):?>
<td class='text-left'>
<?php echo html::select("branch[$plan->id]", $branches, $plan->branch, "onchange='loadWarning($plan->id, this.value); 'class='form-control chosen' ");?>
</td>
<?php endif;?>
<td title='<?php echo $plan->title?>'><?php echo html::input("title[$plan->id]", $plan->title, "class='form-control'")?></td>
<td><?php echo html::textarea("desc[$plan->id]", $plan->desc, "class='form-control' rows='1'")?></td>
<td><?php echo html::input("begin[$plan->id]", $plan->begin, "class='form-control form-date $hiddenInput'");echo html::input("begin$plan->id", '', "class='form-control $showInput' disabled='disabled'");?></td>
+2 -3
View File
@@ -15,8 +15,7 @@
<?php js::set('weekend', $config->execution->weekend);?>
<?php js::import($jsRoot . 'misc/date.js');?>
<?php js::set('today', helper::today());?>
<?php js::set('planID', $plan->id);?>
<?php js::set('oldBranch', $plan->branch);?>
<?php js::set('oldBranch', $oldBranch);?>
<div id='mainContent' class='main-content'>
<div class='center-block'>
<div class='main-header'>
@@ -32,7 +31,7 @@
<?php if($product->type != 'normal'):?>
<tr>
<th><?php echo $lang->product->branch;?></th>
<td><?php echo html::select('branch', $branches, $plan->branch, "onchange='loadWarning(this.value); 'class='form-control'");?></td><td></td><td></td>
<td><?php echo html::select('branch', $branches, $plan->branch, "onchange='loadWarning($plan->id, this.value); 'class='form-control'");?></td><td></td><td></td>
</tr>
<?php endif;?>
<tr>