* Rewrite start and close page.

This commit is contained in:
daitingting
2018-05-14 15:34:56 +08:00
parent a8c1340f86
commit 68b1ec1dcd
4 changed files with 84 additions and 60 deletions
+6 -6
View File
@@ -484,7 +484,7 @@ class testtask extends control
if(!empty($_POST))
{
$changes = $this->testtask->start($taskID);
if(dao::isError()) die(js::error(dao::getError()));
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if($this->post->comment != '' or !empty($changes))
{
@@ -492,8 +492,8 @@ class testtask extends control
$this->action->logHistory($actionID, $changes);
}
if(isonlybody()) die(js::reload('parent.parent'));
die(js::locate($this->createLink('testtask', 'view', "taskID=$taskID"), 'parent'));
if(isonlybody()) $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('testtask', 'view', "taskID=$taskID")));
}
/* Get task info. */
@@ -566,7 +566,7 @@ class testtask extends control
if(!empty($_POST))
{
$changes = $this->testtask->close($taskID);
if(dao::isError()) die(js::error(dao::getError()));
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if($this->post->comment != '' or !empty($changes))
{
@@ -574,8 +574,8 @@ class testtask extends control
$this->action->logHistory($actionID, $changes);
}
if(isonlybody()) die(js::reload('parent.parent'));
die(js::locate($this->createLink('testtask', 'view', "taskID=$taskID"), 'parent'));
if(isonlybody()) $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
$this->send(array('result' => 'success', 'message' => $this->lang->success, 'locate' => $this->createLink('testtask', 'view', "taskID=$taskID")));
}
/* Get task info. */
+22
View File
@@ -0,0 +1,22 @@
$(document).ready(function()
{
$('#startForm, #closeForm').ajaxForm(
{
finish:function(response)
{
if(response.locate)
{
if(response.locate == 'parent')
{
parent.$.cookie('selfClose', 1);
setTimeout(function(){parent.$.closeModal(null, 'this')}, 1200);
}
else
{
setTimeout(function(){window.location.href = response.locate;}, 1200);
}
}
return false;
}
});
})
+30 -30
View File
@@ -11,38 +11,38 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/datepicker.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<div class='container mw-800px'>
<div id='titlebar'>
<div class='heading'>
<span class='prefix'><?php echo html::icon($lang->icons['testtask']);?> <strong><?php echo $testtask->id;?></strong></span>
<strong><?php echo html::a($this->createLink('testtask', 'view', 'taskID=' . $testtask->id), $testtask->name, '_blank');?></strong>
<small class='text-danger'> <?php echo $lang->testtask->close;?> <?php echo html::icon($lang->icons['close']);?></small>
<div id='mainContent' class='main-content'>
<div id='center-block'>
<div class='main-header'>
<h2>
<span class='label label-id'><?php echo $testtask->id;?></span>
<?php echo html::a($this->createLink('testtask', 'view', 'taskID=' . $testtask->id), $testtask->name, '_blank');?>
<small> <?php echo $lang->arrow . $lang->testtask->close;?></small>
</h2>
</div>
</div>
<form class='form-condensed' method='post' target='hiddenwin'>
<table class='table table-form'>
<tr>
<th><?php echo $lang->comment;?></th>
<td><?php echo html::textarea('comment', '', "rows='6' class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->testtask->mailto;?></th>
<td colspan='2'>
<div class='input-group'>
<?php echo html::select('mailto[]', $users, str_replace(' ' , '', $testtask->mailto), "multiple class='form-control'");?>
<?php if($contactLists) echo html::select('', $contactLists, '', "class='form-control chosen' onchange=\"setMailto('mailto', this.value)\"");?>
</div>
</td>
</tr>
<tr>
<td colspan='2' class='text-center'><?php echo html::submitButton() . html::linkButton($lang->goback, $this->session->taskList); ?></td>
</tr>
</table>
</form>
<div class='main'>
<?php include '../../common/view/action.html.php';?>
<form class='load-indicator main-form' method='post' id='closeForm'>
<table class='table table-form'>
<tr>
<th class='w-60px'><?php echo $lang->comment;?></th>
<td><?php echo html::textarea('comment', '', "rows='6' class='form-control kindeditor' hidefocus='true'");?></td>
</tr>
<tr>
<th><?php echo $lang->testtask->mailto;?></th>
<td>
<div class='input-group'>
<?php echo html::select('mailto[]', $users, str_replace(' ' , '', $testtask->mailto), "multiple class='form-control chosen'");?>
<?php if($contactLists) echo html::select('', $contactLists, '', "class='form-control chosen' onchange=\"setMailto('mailto', this.value)\"");?>
</div>
</td>
</tr>
<tr>
<td colspan='2' class='text-center'><?php echo html::submitButton() . html::linkButton($lang->goback, $this->session->taskList); ?></td>
</tr>
</table>
</form>
<hr class='small' />
<div class='main'><?php include '../../common/view/action.html.php';?></div>
</div>
</div>
<?php include '../../common/view/footer.html.php';?>
+26 -24
View File
@@ -12,31 +12,33 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<?php include '../../common/view/datepicker.html.php';?>
<div class='container mw-800px'>
<div id='titlebar'>
<div class='heading'>
<span class='prefix'><?php echo html::icon($lang->icons['testtask']);?> <strong><?php echo $testtask->id;?></strong></span>
<strong><?php echo html::a($this->createLink('testtask', 'view', 'taskID=' . $testtask->id), $testtask->name, '_blank');?></strong>
<small class='text-success'> <?php echo $lang->testtask->start;?> <?php echo html::icon($lang->icons['start']);?></small>
<div id='mainContent' class='main-content'>
<div class='center-block'>
<div class='main-header'>
<h2>
<span class='label label-id'><?php echo $testtask->id;?></span>
<?php echo isonlybody() ? $testtask->name : html::a($this->createLink('testtask', 'view', 'taskID=' . $testtask->id), $testtask->name, '_blank');?>
<?php if(!isonlybody()):?>
<small><?php echo $lang->arrow . $lang->testtask->start;?></small>
<?php endif;?>
</div>
</div>
</div>
<form class='form-condensed' method='post' target='hiddenwin'>
<table class='table table-form'>
<tr>
<th class='text-left'><?php echo $lang->comment;?></th>
</tr>
<tr>
<td><?php echo html::textarea('comment', '', "rows='6' class='form-control'");?></td>
</tr>
<tr>
<td class='text-center'><?php echo html::submitButton() . html::linkButton($lang->goback, $this->session->taskList); ?></td>
</tr>
</table>
</form>
<div class='main'>
<?php include '../../common/view/action.html.php';?>
<form class='load-indicator main-form' method='post' id='startForm'>
<table class='table table-form'>
<tr>
<th class='w-45px'><?php echo $lang->comment;?></th>
<td><?php echo html::textarea('comment', '', "rows='6' class='form-control kindeditor' hidefocus='true'");?></td>
</tr>
<tr>
<td colspan="2" class="text-center">
<?php echo html::submitButton();?>
<?php echo html::linkButton($lang->goback, $this->session->taskList);?>
</td>
</tr>
</table>
</form>
<hr class='small' />
<div class='main'><?php include '../../common/view/action.html.php';?></div>
</div>
</div>
<?php include '../../common/view/footer.html.php';?>