* Add dragModal to testcase browse.
This commit is contained in:
@@ -1472,13 +1472,13 @@ class testcase extends control
|
||||
{
|
||||
$sourceID = $this->post->sourceID;
|
||||
$sceneID = $this->post->targetID;
|
||||
if($sourceID == $sceneID) return false;
|
||||
if($sourceID == $sceneID) return $this->send(array('result' => 'success', 'load' => true));
|
||||
|
||||
if(strpos($sourceID, 'case_') !== false)
|
||||
{
|
||||
$caseID = str_replace('case_', '', $sourceID);
|
||||
$oldCase = $this->dao->select('scene')->from(TABLE_CASE)->where('id')->eq($caseID)->fetch();
|
||||
if($oldCase->scene == $sceneID) return false;
|
||||
if($oldCase->scene == $sceneID) return $this->send(array('result' => 'success', 'load' => true));
|
||||
|
||||
$this->dao->update(TABLE_CASE)->set('scene')->eq($sceneID)->where('id')->eq($caseID)->exec();
|
||||
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
@@ -1594,10 +1594,10 @@ class testcase extends control
|
||||
*/
|
||||
public function updateOrder()
|
||||
{
|
||||
$sourceID = $this->post->sourceID;
|
||||
$sourceOrder = $this->post->sourceOrder;
|
||||
$targetID = $this->post->targetID;
|
||||
$targetOrder = $this->post->targetOrder;
|
||||
$sourceID = (int)$this->post->sourceID;
|
||||
$sourceOrder = (int)$this->post->sourceOrder;
|
||||
$targetID = (int)$this->post->targetID;
|
||||
$targetOrder = (int)$this->post->targetOrder;
|
||||
$type = $this->post->type;
|
||||
$module = $this->post->module;
|
||||
|
||||
@@ -1607,7 +1607,7 @@ class testcase extends control
|
||||
|
||||
$this->dao->update($table)->set('sort')->eq($type == 'after' ? ($targetOrder + 1) : $targetOrder)->where('id')->eq($sourceID)->exec();
|
||||
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess));
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => true));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,17 +53,13 @@ window.onSortEnd = function(from, to, type)
|
||||
{
|
||||
if(from.data.parent == to.data.parent)
|
||||
{
|
||||
zui.Modal.confirm({message: dragModalMessage, icon:'icon-exclamation-sign', iconClass: 'warning-pale rounded-full icon-2x'}).then((confirmed) =>
|
||||
{
|
||||
if(confirmed)
|
||||
{
|
||||
changeScene(from.data.id, to.data.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
changeOrder(from.data.id, from.data.sort, to.data.id, to.data.sort, type, 'scene');
|
||||
}
|
||||
});
|
||||
$('#dragModal').attr('data-sourceID', from.data.id);
|
||||
$('#dragModal').attr('data-targetID', to.data.id);
|
||||
$('#dragModal').attr('data-sourceSort', from.data.sort);
|
||||
$('#dragModal').attr('data-targetSort', to.data.sort);
|
||||
$('#dragModal').attr('data-type', type);
|
||||
|
||||
zui.Modal.open({id: 'dragModal'});
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -265,3 +261,27 @@ window.checkZtf = function(e)
|
||||
});
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
window.clickChangeScenen = function()
|
||||
{
|
||||
const caseID = $('#dragModal').attr('data-sourceID');
|
||||
const sceneID = $('#dragModal').attr('data-targetID');
|
||||
|
||||
changeScene(caseID, sceneID);
|
||||
}
|
||||
|
||||
window.clickChangeOrder = function()
|
||||
{
|
||||
const sourceID = $('#dragModal').attr('data-sourceID');
|
||||
const sourceOrder = $('#dragModal').attr('data-sourceOrder');
|
||||
const targetID = $('#dragModal').attr('data-targetID');
|
||||
const targetOrder = $('#dragModal').attr('data-targetOrder');
|
||||
const type = $('#dragModal').attr('data-type');
|
||||
|
||||
changeOrder(sourceID, sourceOrder, targetID, targetOrder, type, 'scene');
|
||||
}
|
||||
|
||||
window.clickCloseModal = function()
|
||||
{
|
||||
window.reloadPage();
|
||||
}
|
||||
|
||||
@@ -359,7 +359,10 @@ $lang->testcase->normal = 'normal';
|
||||
|
||||
/* Translation for drag modal message box. */
|
||||
$lang->testcase->dragModalTitle = 'Drag and drop operation selection';
|
||||
$lang->testcase->dragModalMessage = 'Are you sure you want to change the scene to which the target belongs? Click to cancel and only adjust the sorting.';
|
||||
$lang->testcase->dragModalDesc = 'There are two possible scenarios for the current operation:';
|
||||
$lang->testcase->dragModalOrder = '1) Adjust sorting';
|
||||
$lang->testcase->dragModalScene = '2) Change the scene to which the module belongs and also change it to the module of the target scene';
|
||||
$lang->testcase->dragModalAction = 'Please select the action you want to perform';
|
||||
$lang->testcase->dragModalChangeScene = 'Change its scene';
|
||||
$lang->testcase->dragModalChangeOrder = 'Reorder';
|
||||
|
||||
|
||||
@@ -359,7 +359,10 @@ $lang->testcase->normal = 'normal';
|
||||
|
||||
/* Translation for drag modal message box. */
|
||||
$lang->testcase->dragModalTitle = 'Drag and drop operation selection';
|
||||
$lang->testcase->dragModalMessage = 'Are you sure you want to change the scene to which the target belongs? Click to cancel and only adjust the sorting.';
|
||||
$lang->testcase->dragModalDesc = 'There are two possible scenarios for the current operation:';
|
||||
$lang->testcase->dragModalOrder = '1) Adjust sorting';
|
||||
$lang->testcase->dragModalScene = '2) Change the scene to which the module belongs and also change it to the module of the target scene';
|
||||
$lang->testcase->dragModalAction = 'Please select the action you want to perform';
|
||||
$lang->testcase->dragModalChangeScene = 'Change its scene';
|
||||
$lang->testcase->dragModalChangeOrder = 'Reorder';
|
||||
|
||||
|
||||
@@ -359,7 +359,10 @@ $lang->testcase->normal = 'normal';
|
||||
|
||||
/* Translation for drag modal message box. */
|
||||
$lang->testcase->dragModalTitle = 'Drag and drop operation selection';
|
||||
$lang->testcase->dragModalMessage = 'Are you sure you want to change the scene to which the target belongs? Click to cancel and only adjust the sorting.';
|
||||
$lang->testcase->dragModalDesc = 'There are two possible scenarios for the current operation:';
|
||||
$lang->testcase->dragModalOrder = '1) Adjust sorting';
|
||||
$lang->testcase->dragModalScene = '2) Change the scene to which the module belongs and also change it to the module of the target scene';
|
||||
$lang->testcase->dragModalAction = 'Please select the action you want to perform';
|
||||
$lang->testcase->dragModalChangeScene = 'Change its scene';
|
||||
$lang->testcase->dragModalChangeOrder = 'Reorder';
|
||||
|
||||
|
||||
@@ -359,7 +359,10 @@ $lang->testcase->normal = '正常';
|
||||
|
||||
/* Translation for drag modal message box. */
|
||||
$lang->testcase->dragModalTitle = '拖拽操作选择';
|
||||
$lang->testcase->dragModalMessage = '您确定要更改目标的所属场景吗? 点击取消仅调整排序。';
|
||||
$lang->testcase->dragModalDesc = '当前操作有两种可能的情况:';
|
||||
$lang->testcase->dragModalOrder = '1) 调整排序';
|
||||
$lang->testcase->dragModalScene = '2) 更改所属场景,所属模块同时变更为目标场景的模块';
|
||||
$lang->testcase->dragModalAction = '请选择您要执行的操作';
|
||||
$lang->testcase->dragModalChangeScene = '更改所属场景';
|
||||
$lang->testcase->dragModalChangeOrder = '调整排序';
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace zin;
|
||||
include 'header.html.php';
|
||||
|
||||
jsVar('confirmBatchDeleteSceneCase', $lang->testcase->confirmBatchDeleteSceneCase);
|
||||
jsVar('dragModalMessage', $lang->testcase->dragModalMessage);
|
||||
|
||||
$topSceneCount = count(array_filter(array_map(function($case){return $case->isScene && $case->grade == 1;}, $cases)));
|
||||
|
||||
@@ -190,4 +189,24 @@ modal
|
||||
)
|
||||
);
|
||||
|
||||
modal
|
||||
(
|
||||
setID('dragModal'),
|
||||
set::title($lang->testcase->dragModalTitle),
|
||||
set::size('sm'),
|
||||
divider(),
|
||||
div(setClass('my-4'), $lang->testcase->dragModalDesc),
|
||||
div($lang->testcase->dragModalOrder),
|
||||
div($lang->testcase->dragModalScene),
|
||||
div(setClass('my-4'), $lang->testcase->dragModalAction),
|
||||
divider(),
|
||||
div
|
||||
(
|
||||
setClass('mt-4 pull-right'),
|
||||
btn(setClass('primary mr-2'), $lang->testcase->dragModalChangeScene, set('data-on', 'click'), set('data-call', 'clickChangeScenen')),
|
||||
btn(setClass('primary mr-2'), $lang->testcase->dragModalChangeOrder, set('data-on', 'click'), set('data-call', 'clickChangeOrder')),
|
||||
btn($lang->close, set('data-on', 'click'), set('data-call', 'clickCloseModal'))
|
||||
)
|
||||
);
|
||||
|
||||
render();
|
||||
|
||||
Reference in New Issue
Block a user