Merge branch 'tsj_sortable' into 'zentaopms_284'
Tsj sortable See merge request easycorp/zentaopms!6945
This commit is contained in:
@@ -208,7 +208,7 @@ class programplan extends control
|
||||
$this->view->productID = $productID ? $productID : key($productList);
|
||||
$this->view->stages = empty($planID) ? $this->loadModel('stage')->getStages('id_asc') : array();
|
||||
$this->view->programPlan = $programPlan;
|
||||
$this->view->plans = empty($executions) ? $this->programplan->getStage($planID ? $planID : $projectID, $this->productID, 'parent') : $executions;
|
||||
$this->view->plans = empty($executions) ? $this->programplan->getStage($planID ? $planID : $projectID, $this->productID, 'parent', 'order_asc') : $executions;
|
||||
$this->view->planID = $planID;
|
||||
$this->view->type = 'lists';
|
||||
$this->view->executionType = $executionType;
|
||||
|
||||
@@ -753,7 +753,6 @@ class programplanModel extends model
|
||||
$datas[] = $plan;
|
||||
}
|
||||
|
||||
|
||||
$totalPercent = 0;
|
||||
$totalDevType = 0;
|
||||
$milestone = 0;
|
||||
@@ -836,6 +835,20 @@ class programplanModel extends model
|
||||
$this->app->loadLang('doc');
|
||||
$account = $this->app->user->account;
|
||||
$now = helper::now();
|
||||
|
||||
if(!isset($orders)) $orders = array();
|
||||
asort($orders);
|
||||
if(count($orders) < count($datas))
|
||||
{
|
||||
$orderIndex = empty($orders) ? 0 : count($orders);
|
||||
$lastID = $this->dao->select('id')->from(TABLE_EXECUTION)->orderBy('id_desc')->fetch('id');
|
||||
for($i = $orderIndex; $i < count($datas); $i ++)
|
||||
{
|
||||
$lastID ++;
|
||||
$orders[$i] = $lastID * 5;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($datas as $data)
|
||||
{
|
||||
/* Set planDuration and realDuration. */
|
||||
@@ -847,6 +860,8 @@ class programplanModel extends model
|
||||
|
||||
$projectChanged = false;
|
||||
$data->days = helper::diffDate($data->end, $data->begin) + 1;
|
||||
$data->order = current($orders);
|
||||
|
||||
if($data->id)
|
||||
{
|
||||
$stageID = $data->id;
|
||||
@@ -924,7 +939,6 @@ class programplanModel extends model
|
||||
$stageID = $this->dao->lastInsertID();
|
||||
|
||||
if($data->acl != 'open') $this->user->updateUserView($stageID, 'sprint');
|
||||
$this->dao->update(TABLE_PROJECT)->set('`order`')->eq($stageID * 5)->where('id')->eq($stageID)->exec();
|
||||
|
||||
/* Create doc lib. */
|
||||
$lib = new stdclass();
|
||||
@@ -1004,6 +1018,8 @@ class programplanModel extends model
|
||||
if($parentID and $milestone) $this->dao->update(TABLE_PROJECT)->set('milestone')->eq(0)->where('id')->eq($parentID)->exec();
|
||||
|
||||
if(dao::isError()) return print(js::error(dao::getError()));
|
||||
|
||||
next($orders);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/sortable.html.php';?>
|
||||
<?php js::set('browseType', $type);?>
|
||||
<style>.icon-help{margin-left: 3px;}</style>
|
||||
<div id='mainMenu' class='clearfix'>
|
||||
@@ -99,7 +100,7 @@
|
||||
<th class="c-action text-center w-110px"> <?php echo $lang->actions;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tbody class='sortable'>
|
||||
<?php $i = 0;?>
|
||||
<?php if(empty($plans) and $planID == 0):?>
|
||||
<?php foreach($stages as $stage):?>
|
||||
@@ -127,7 +128,9 @@
|
||||
<?php endif;?>
|
||||
<td class='c-actions text-center'>
|
||||
<a href='javascript:;' onclick='addItem(this)' class='btn btn-link'><i class='icon-plus'></i></a>
|
||||
<button type="button" class='btn btn-link btn-sm btn-icon btn-move'><i class='icon-move'></i></button>
|
||||
<a href='javascript:;' onclick='deleteItem(this)' class='btn btn-link'><i class='icon icon-close'></i></a>
|
||||
<?php echo html::hidden('orders[]', $stage->order);?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php $i ++;?>
|
||||
@@ -164,7 +167,9 @@
|
||||
<?php endif;?>
|
||||
<td class='c-actions text-center'>
|
||||
<a href='javascript:;' onclick='addItem(this)' class='btn btn-link'><i class='icon-plus'></i></a>
|
||||
<button type="button" class='btn btn-link btn-sm btn-icon btn-move'><i class='icon-move'></i></button>
|
||||
<a href='javascript:;' onclick='deleteItem(this)' class='invisible btn btn-link'><i class='icon icon-close'></i></a>
|
||||
<?php echo html::hidden('orders[]', $plan->order);?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php $i ++;?>
|
||||
@@ -197,6 +202,7 @@
|
||||
<?php endif;?>
|
||||
<td class='c-actions text-center'>
|
||||
<a href='javascript:;' onclick='addItem(this)' class='btn btn-link'><i class='icon-plus'></i></a>
|
||||
<button type="button" class='btn btn-link btn-sm btn-icon btn-move'><i class='icon-move'></i></button>
|
||||
<a href='javascript:;' onclick='deleteItem(this)' class='btn btn-link'><i class='icon icon-close'></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -244,6 +250,7 @@
|
||||
<?php endif;?>
|
||||
<td class='c-actions text-center'>
|
||||
<a href='javascript:;' onclick='addItem(this)' class='btn btn-link'><i class='icon-plus'></i></a>
|
||||
<button type="button" class='btn btn-link btn-sm btn-icon btn-move'><i class='icon-move'></i></button>
|
||||
<a href='javascript:;' onclick='deleteItem(this)' class='btn btn-link'><i class='icon icon-close'></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -261,6 +268,14 @@ js::set('projectEndDate', $project->end);
|
||||
<script>
|
||||
$('[data-toggle="popover"]').popover();
|
||||
|
||||
var options = {
|
||||
selector: 'tr',
|
||||
trigger: '.icon-move',
|
||||
dragCssClass: 'drag-row',
|
||||
reverse: true,
|
||||
}
|
||||
$('#planForm tbody.sortable').sortable(options);
|
||||
|
||||
$('#planForm').submit(function()
|
||||
{
|
||||
/* Clear all error messages. */
|
||||
|
||||
Reference in New Issue
Block a user