diff --git a/config/filter.php b/config/filter.php index 8b088659f0..f69a51cd97 100644 --- a/config/filter.php +++ b/config/filter.php @@ -28,33 +28,34 @@ $filter->default->cookie['fingerprint'] = 'reg::word'; $filter->default->cookie['hideMenu'] = 'equal::true'; $filter->default->cookie['openApp'] = 'reg::word'; -$filter->bug = new stdclass(); -$filter->caselib = new stdclass(); -$filter->doc = new stdclass(); -$filter->product = new stdclass(); -$filter->branch = new stdclass(); -$filter->qa = new stdclass(); -$filter->story = new stdclass(); -$filter->task = new stdclass(); -$filter->testcase = new stdclass(); -$filter->program = new stdclass(); -$filter->project = new stdclass(); -$filter->testreport = new stdclass(); -$filter->testsuite = new stdclass(); -$filter->todo = new stdclass(); -$filter->testtask = new stdclass(); -$filter->upgrade = new stdclass(); -$filter->sso = new stdclass(); -$filter->misc = new stdclass(); -$filter->mail = new stdclass(); -$filter->user = new stdclass(); -$filter->block = new stdclass(); -$filter->file = new stdclass(); -$filter->repo = new stdclass(); -$filter->webhook = new stdclass(); -$filter->git = new stdclass(); -$filter->svn = new stdclass(); -$filter->search = new stdclass(); +$filter->bug = new stdclass(); +$filter->caselib = new stdclass(); +$filter->doc = new stdclass(); +$filter->product = new stdclass(); +$filter->branch = new stdclass(); +$filter->qa = new stdclass(); +$filter->story = new stdclass(); +$filter->task = new stdclass(); +$filter->testcase = new stdclass(); +$filter->program = new stdclass(); +$filter->project = new stdclass(); +$filter->projectstory = new stdclass(); +$filter->testreport = new stdclass(); +$filter->testsuite = new stdclass(); +$filter->todo = new stdclass(); +$filter->testtask = new stdclass(); +$filter->upgrade = new stdclass(); +$filter->sso = new stdclass(); +$filter->misc = new stdclass(); +$filter->mail = new stdclass(); +$filter->user = new stdclass(); +$filter->block = new stdclass(); +$filter->file = new stdclass(); +$filter->repo = new stdclass(); +$filter->webhook = new stdclass(); +$filter->git = new stdclass(); +$filter->svn = new stdclass(); +$filter->search = new stdclass(); $filter->block->default = new stdclass(); $filter->block->main = new stdclass(); @@ -94,6 +95,7 @@ $filter->project->browse = new stdclass(); $filter->project->story = new stdclass(); $filter->project->export = new stdclass(); $filter->project->task = new stdclass(); +$filter->projectstory->story = new stdclass(); $filter->qa->default = new stdclass(); $filter->story->create = new stdclass(); $filter->story->export = new stdclass(); @@ -194,6 +196,8 @@ $filter->project->task->cookie['projectTaskOrder'] = 'reg::orderBy'; $filter->project->task->cookie['windowWidth'] = 'int'; $filter->project->export->cookie['checkedItem'] = 'reg::checked'; +$filter->projectstory->story->cookie['storyModuleParam'] = 'int'; + $filter->qa->default->cookie['lastProduct'] = 'int'; $filter->qa->default->cookie['preBranch'] = 'int'; $filter->qa->default->cookie['preProductID'] = 'int'; diff --git a/db/update15.0.sql b/db/update15.0.sql index 89ff0d7c93..0454c02f16 100644 --- a/db/update15.0.sql +++ b/db/update15.0.sql @@ -1 +1,3 @@ ALTER TABLE `zt_project` CHANGE `lifetime` `lifetime` char(30) NOT NULL DEFAULT ''; +ALTER TABLE `zt_story` ADD `category` varchar(30) NOT NULL DEFAULT 'feature' AFTER `type`; +ALTER TABLE `zt_testtask` ADD `type` varchar(255) NOT NULL DEFAULT '' AFTER `build`; diff --git a/db/zentao.sql b/db/zentao.sql index 7887d5a9d3..19468f47c2 100644 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -822,6 +822,7 @@ CREATE TABLE IF NOT EXISTS `zt_story` ( `title` varchar(255) NOT NULL, `keywords` varchar(255) NOT NULL, `type` varchar(30) NOT NULL default 'story', + `category` varchar(30) NOT NULL default 'feature', `pri` tinyint(3) unsigned NOT NULL default '3', `estimate` float unsigned NOT NULL, `status` enum('','changed','active','draft','closed') NOT NULL default '', @@ -1050,6 +1051,7 @@ CREATE TABLE IF NOT EXISTS `zt_testtask` ( `name` char(90) NOT NULL, `execution` mediumint(8) unsigned NOT NULL default '0', `build` char(30) NOT NULL, + `type` varchar(255) NOT NULL, `owner` varchar(30) NOT NULL, `pri` tinyint(3) unsigned NOT NULL default '0', `begin` date NOT NULL, diff --git a/module/block/view/dynamic.html.php b/module/block/view/dynamic.html.php index 05b98b0f15..2447f62507 100644 --- a/module/block/view/dynamic.html.php +++ b/module/block/view/dynamic.html.php @@ -2,7 +2,7 @@
| story->reviewedBy;?> | -+ |
- reviewedBy, 'class="form-control chosen"');?>
+ reviewedBy, 'class="form-control chosen" multiple');?>
story->checkForceReview()):?>
story->needNotReview, '', "id='needNotReview' {$needReview}");?>
@@ -34,7 +34,6 @@
|
- |||||
|---|---|---|---|---|---|---|---|
| story->status;?> | diff --git a/module/story/view/create.html.php b/module/story/view/create.html.php index f7aeab84ea..ad3e2091ff 100644 --- a/module/story/view/create.html.php +++ b/module/story/view/create.html.php @@ -100,10 +100,10 @@|||||||
| story->reviewedBy;?> | -+ |
- PO : '', "class='form-control chosen'");?>
+ PO : '', "class='form-control chosen' multiple");?>
story->checkForceReview()):?>
diff --git a/module/task/control.php b/module/task/control.php
index 762703d031..c86f3c476d 100644
--- a/module/task/control.php
+++ b/module/task/control.php
@@ -131,6 +131,9 @@ class task extends control
$this->executeHooks($taskID);
+ /* Return task id when call the API. */
+ if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $taskID));
+
/* If link from no head then reload. */
if(isonlybody()) $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
@@ -284,6 +287,12 @@ class task extends control
$mails = $this->task->batchCreate($executionID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
+ $taskIDList = array();
+ foreach($mails as $mail) $taskIDList[] = $mail->taskID;
+
+ /* Return task id list when call the API. */
+ if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $taskIDList));
+
/* Locate the browser. */
if(!empty($iframe)) $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $taskLink));
diff --git a/module/testcase/control.php b/module/testcase/control.php
index ee0a1ec24e..c613b0c0a4 100644
--- a/module/testcase/control.php
+++ b/module/testcase/control.php
@@ -324,6 +324,7 @@ class testcase extends control
$this->executeHooks($caseID);
+ if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $caseID));
/* If link from no head then reload. */
if(isonlybody()) $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true));
@@ -473,10 +474,12 @@ class testcase extends control
$this->loadModel('story');
if(!empty($_POST))
{
- $caseID = $this->testcase->batchCreate($productID, $branch, $storyID);
+ $caseIDList = $this->testcase->batchCreate($productID, $branch, $storyID);
if(dao::isError()) die(js::error(dao::getError()));
if(isonlybody()) die(js::closeModal('parent.parent', 'this'));
+ if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $caseIDList));
+
setcookie('caseModule', 0, 0, $this->config->webRoot, '', $this->config->cookieSecure, false);
$currentModule = $this->app->openApp == 'project' ? 'project' : 'testcase';
$currentMethod = $this->app->openApp == 'project' ? 'testcase' : 'browse';
diff --git a/module/testcase/model.php b/module/testcase/model.php
index 4d8bc59ec6..f60252da2a 100644
--- a/module/testcase/model.php
+++ b/module/testcase/model.php
@@ -97,9 +97,10 @@ class testcaseModel extends model
* Batch create cases.
*
* @param int $productID
+ * @param int $branch
* @param int $storyID
* @access public
- * @return void
+ * @return array
*/
function batchCreate($productID, $branch, $storyID)
{
@@ -181,6 +182,7 @@ class testcaseModel extends model
}
}
+ $caseIDList = array();
foreach($data as $i => $case)
{
$this->dao->insert(TABLE_CASE)->data($case)
@@ -194,7 +196,8 @@ class testcaseModel extends model
die(js::reload('parent'));
}
- $caseID = $this->dao->lastInsertID();
+ $caseID = $this->dao->lastInsertID();
+ $caseIDList[] = $caseID;
/* If the story is linked project, make the case link the project. */
$this->syncCase2Project($case, $caseID);
@@ -206,6 +209,7 @@ class testcaseModel extends model
if($this->app->openApp == 'execution') $this->action->create('case', $caseID, 'linked2execution', '', $this->session->execution);
}
if(!dao::isError()) $this->loadModel('score')->create('ajax', 'batchCreate');
+ return $caseIDList;
}
/**
diff --git a/module/testreport/control.php b/module/testreport/control.php
index c82957a115..e13c21359a 100644
--- a/module/testreport/control.php
+++ b/module/testreport/control.php
@@ -165,6 +165,7 @@ class testreport extends control
$reportID = $this->testreport->create();
if(dao::isError()) die(js::error(dao::getError()));
$this->loadModel('action')->create('testreport', $reportID, 'Opened');
+ if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $reportID));
die(js::locate(inlink('view', "reportID=$reportID"), 'parent'));
}
diff --git a/module/testsuite/control.php b/module/testsuite/control.php
index b2e1e312ce..be08277c8a 100644
--- a/module/testsuite/control.php
+++ b/module/testsuite/control.php
@@ -122,6 +122,8 @@ class testsuite extends control
$this->executeHooks($suiteID);
+ if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $suiteID));
+
$response['locate'] = $this->createLink('testsuite', 'browse', "productID=$productID");
$this->send($response);
}
diff --git a/module/testtask/control.php b/module/testtask/control.php
index 6660051352..5d502fa5cd 100644
--- a/module/testtask/control.php
+++ b/module/testtask/control.php
@@ -216,6 +216,8 @@ class testtask extends control
$this->loadModel('action')->create('testtask', $taskID, 'opened');
$this->executeHooks($taskID);
+ if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $taskID));
+
$task = $this->dao->findById($taskID)->from(TABLE_TESTTASK)->fetch();
if($this->app->openApp == 'project') $link = $this->createLink('project', 'testtask', "projectID=$task->project");
if($this->app->openApp == 'execution') $link = $this->createLink('execution', 'testtask', "executionID=$task->execution");
diff --git a/module/testtask/lang/de.php b/module/testtask/lang/de.php
index 2d3cd8e457..d12016a28d 100644
--- a/module/testtask/lang/de.php
+++ b/module/testtask/lang/de.php
@@ -59,6 +59,7 @@ $lang->testtask->common = 'Testaufgabe';
$lang->testtask->product = $lang->productCommon;
$lang->testtask->project = 'Project';
$lang->testtask->execution = $lang->execution->common;
+$lang->testtask->type = 'Typ';
$lang->testtask->build = 'Build';
$lang->testtask->owner = 'Besitzer';
$lang->testtask->executor = 'Executor';
@@ -193,3 +194,9 @@ $lang->testtask->unitTag['thisWeek'] = 'This week';
$lang->testtask->unitTag['lastWeek'] = 'Last week';
$lang->testtask->unitTag['thisMonth'] = 'This month';
$lang->testtask->unitTag['lastMonth'] = 'Last month';
+
+$lang->testtask->typeList['integrate'] = 'Integrate';
+$lang->testtask->typeList['system'] = 'System';
+$lang->testtask->typeList['acceptance'] = 'Acceptance';
+$lang->testtask->typeList['performance'] = 'Performance';
+$lang->testtask->typeList['safety'] = 'Safety';
diff --git a/module/testtask/lang/en.php b/module/testtask/lang/en.php
index afb1798101..057257218e 100644
--- a/module/testtask/lang/en.php
+++ b/module/testtask/lang/en.php
@@ -62,6 +62,7 @@ $lang->testtask->common = 'Request';
$lang->testtask->product = $lang->productCommon;
$lang->testtask->project = 'Project';
$lang->testtask->execution = $lang->execution->common;
+$lang->testtask->type = 'Type';
$lang->testtask->build = 'Build';
$lang->testtask->owner = 'Owner';
$lang->testtask->executor = 'Executor';
@@ -196,3 +197,9 @@ $lang->testtask->unitTag['thisWeek'] = 'This week';
$lang->testtask->unitTag['lastWeek'] = 'Last week';
$lang->testtask->unitTag['thisMonth'] = 'This month';
$lang->testtask->unitTag['lastMonth'] = 'Last month';
+
+$lang->testtask->typeList['integrate'] = 'Integrate';
+$lang->testtask->typeList['system'] = 'System';
+$lang->testtask->typeList['acceptance'] = 'Acceptance';
+$lang->testtask->typeList['performance'] = 'Performance';
+$lang->testtask->typeList['safety'] = 'Safety';
diff --git a/module/testtask/lang/fr.php b/module/testtask/lang/fr.php
index fa45220580..1169714119 100644
--- a/module/testtask/lang/fr.php
+++ b/module/testtask/lang/fr.php
@@ -59,6 +59,7 @@ $lang->testtask->common = 'Recette';
$lang->testtask->product = $lang->productCommon;
$lang->testtask->project = 'Project';
$lang->testtask->execution = $lang->execution->common;
+$lang->testtask->type = 'Type';
$lang->testtask->build = 'Build';
$lang->testtask->owner = 'Owner';
$lang->testtask->executor = 'Executeur';
@@ -193,3 +194,9 @@ $lang->testtask->unitTag['thisWeek'] = 'This week';
$lang->testtask->unitTag['lastWeek'] = 'Last week';
$lang->testtask->unitTag['thisMonth'] = 'This month';
$lang->testtask->unitTag['lastMonth'] = 'Last month';
+
+$lang->testtask->typeList['integrate'] = 'Integrate';
+$lang->testtask->typeList['system'] = 'System';
+$lang->testtask->typeList['acceptance'] = 'Acceptance';
+$lang->testtask->typeList['performance'] = 'Performance';
+$lang->testtask->typeList['safety'] = 'Safety';
diff --git a/module/testtask/lang/vi.php b/module/testtask/lang/vi.php
index 5f2ed5aeae..95907cb5f6 100644
--- a/module/testtask/lang/vi.php
+++ b/module/testtask/lang/vi.php
@@ -59,6 +59,7 @@ $lang->testtask->common = 'Yêu cầu';
$lang->testtask->product = $lang->productCommon;
$lang->testtask->project = 'Project';
$lang->testtask->execution = $lang->execution->common;
+$lang->testtask->type = 'Kiểu';
$lang->testtask->build = 'Bản dựng';
$lang->testtask->owner = 'Sở hữu';
$lang->testtask->executor = 'Executor';
@@ -193,3 +194,9 @@ $lang->testtask->unitTag['thisWeek'] = 'This week';
$lang->testtask->unitTag['lastWeek'] = 'Last week';
$lang->testtask->unitTag['thisMonth'] = 'This month';
$lang->testtask->unitTag['lastMonth'] = 'Last month';
+
+$lang->testtask->typeList['integrate'] = 'Integrate';
+$lang->testtask->typeList['system'] = 'System';
+$lang->testtask->typeList['acceptance'] = 'Acceptance';
+$lang->testtask->typeList['performance'] = 'Performance';
+$lang->testtask->typeList['safety'] = 'Safety';
diff --git a/module/testtask/lang/zh-cn.php b/module/testtask/lang/zh-cn.php
index 99fd6a3e23..13e956d258 100644
--- a/module/testtask/lang/zh-cn.php
+++ b/module/testtask/lang/zh-cn.php
@@ -62,6 +62,7 @@ $lang->testtask->common = '测试单';
$lang->testtask->product = '所属' . $lang->productCommon;
$lang->testtask->project = '所属项目';
$lang->testtask->execution = '所属' . $lang->execution->common;
+$lang->testtask->type = '测试类型';
$lang->testtask->build = '版本';
$lang->testtask->owner = '负责人';
$lang->testtask->executor = '执行人';
@@ -196,3 +197,9 @@ $lang->testtask->unitTag['thisWeek'] = '本周';
$lang->testtask->unitTag['lastWeek'] = '上周';
$lang->testtask->unitTag['thisMonth'] = '本月';
$lang->testtask->unitTag['lastMonth'] = '上月';
+
+$lang->testtask->typeList['integrate'] = '集成测试';
+$lang->testtask->typeList['system'] = '系统测试';
+$lang->testtask->typeList['acceptance'] = '验收测试';
+$lang->testtask->typeList['performance'] = '性能测试';
+$lang->testtask->typeList['safety'] = '安全测试';
diff --git a/module/testtask/lang/zh-tw.php b/module/testtask/lang/zh-tw.php
index d33811642e..0642b1dab4 100644
--- a/module/testtask/lang/zh-tw.php
+++ b/module/testtask/lang/zh-tw.php
@@ -62,6 +62,7 @@ $lang->testtask->common = '測試單';
$lang->testtask->product = '所屬' . $lang->productCommon;
$lang->testtask->project = '所屬項目';
$lang->testtask->execution = '所屬' . $lang->execution->common;
+$lang->testtask->type = '測試類型';
$lang->testtask->build = '版本';
$lang->testtask->owner = '負責人';
$lang->testtask->executor = '執行人';
@@ -196,3 +197,9 @@ $lang->testtask->unitTag['thisWeek'] = '本週';
$lang->testtask->unitTag['lastWeek'] = '上周';
$lang->testtask->unitTag['thisMonth'] = '本月';
$lang->testtask->unitTag['lastMonth'] = '上月';
+
+$lang->testtask->typeList['integrate'] = '集成測試';
+$lang->testtask->typeList['system'] = '系統測試';
+$lang->testtask->typeList['acceptance'] = '接受度測試';
+$lang->testtask->typeList['performance'] = '性能測試';
+$lang->testtask->typeList['safety'] = '安全測試';
diff --git a/module/testtask/model.php b/module/testtask/model.php
index 02109736cc..aa7c293c6f 100644
--- a/module/testtask/model.php
+++ b/module/testtask/model.php
@@ -33,7 +33,8 @@ class testtaskModel extends model
->setIF($this->config->systemMode == 'new', 'project', $projectID)
->stripTags($this->config->testtask->editor->create['id'], $this->config->allowedTags)
->join('mailto', ',')
- ->remove('uid,contactListMenu')
+ ->join('type', ',')
+ ->remove('files,labels,uid,contactListMenu')
->get();
$task = $this->loadModel('file')->processImgURL($task, $this->config->testtask->editor->create['id'], $this->post->uid);
@@ -49,6 +50,7 @@ class testtaskModel extends model
{
$taskID = $this->dao->lastInsertID();
$this->file->updateObjectID($this->post->uid, $taskID, 'testtask');
+ $this->file->saveUpload('testtask', $taskID);
return $taskID;
}
}
@@ -267,6 +269,7 @@ class testtaskModel extends model
$task = $this->loadModel('file')->replaceImgURL($task, 'desc');
if($setImgSize) $task->desc = $this->loadModel('file')->setImgSize($task->desc);
+ $task->files = $this->loadModel('file')->getByObject('testtask', $task->id);
return $task;
}
@@ -730,7 +733,7 @@ class testtaskModel extends model
public function update($taskID)
{
$oldTask = $this->dao->select("*")->from(TABLE_TESTTASK)->where('id')->eq((int)$taskID)->fetch();
- $task = fixer::input('post')->stripTags($this->config->testtask->editor->edit['id'], $this->config->allowedTags)->join('mailto', ',')->remove('uid,comment,contactListMenu')->get();
+ $task = fixer::input('post')->stripTags($this->config->testtask->editor->edit['id'], $this->config->allowedTags)->join('mailto', ',')->join('type', ',')->remove('files,labels,uid,comment,contactListMenu')->get();
$task = $this->loadModel('file')->processImgURL($task, $this->config->testtask->editor->edit['id'], $this->post->uid);
$this->dao->update(TABLE_TESTTASK)->data($task)
->autoCheck()
@@ -741,6 +744,7 @@ class testtaskModel extends model
if(!dao::isError())
{
$this->file->updateObjectID($this->post->uid, $taskID, 'testtask');
+ $this->file->saveUpload('testtask', $taskID);
return common::createChanges($oldTask, $task);
}
}
diff --git a/module/testtask/view/browse.html.php b/module/testtask/view/browse.html.php
index c63321b09b..a2beb118cd 100644
--- a/module/testtask/view/browse.html.php
+++ b/module/testtask/view/browse.html.php
@@ -107,7 +107,7 @@ $status = $this->session->testTaskVersionStatus;
common::printIcon('testtask', 'linkCase', "taskID=$task->id&type=all¶m=myQueryID", $task, 'list', 'link');
common::printIcon('testreport', 'browse', "objectID=$task->product&objectType=product&extra=$task->id", $task, 'list','flag');
echo ' ';
- common::printIcon('testtask', 'view', "taskID=$task->id", '', 'list', 'list-alt','','iframe',true);
+ common::printIcon('testtask', 'view', "taskID=$task->id", '', 'list', 'list-alt','','iframe',true, "data-width='90%'");
common::printIcon('testtask', 'edit', "taskID=$task->id", $task, 'list');
if(common::hasPriv('testtask', 'delete', $task))
{
diff --git a/module/testtask/view/create.html.php b/module/testtask/view/create.html.php
index fd35e0498b..0820726f43 100644
--- a/module/testtask/view/create.html.php
+++ b/module/testtask/view/create.html.php
@@ -50,6 +50,10 @@
|
|||||
| testtask->type;?> | +testtask->typeList, '', "class='form-control chosen' multiple");?> | +||||||
| testtask->owner;?> | @@ -82,6 +86,10 @@ | testtask->desc;?> | |||||
| files;?> | +fetch('file', 'buildform');?> | +||||||
| testtask->mailto;?> | diff --git a/module/testtask/view/edit.html.php b/module/testtask/view/edit.html.php index 05ad141a09..9eeaad1b15 100644 --- a/module/testtask/view/edit.html.php +++ b/module/testtask/view/edit.html.php @@ -39,6 +39,10 @@ | build, "class='form-control chosen'");?> | |||||
| testtask->type;?> | +testtask->typeList, $task->type, "class='form-control chosen' multiple");?> | +||||||
| testtask->owner;?> | @@ -75,6 +79,10 @@ | comment;?> | |||||
| files;?> | +fetch('file', 'buildform');?> | +||||||
| testtask->mailto;?> |
diff --git a/module/testtask/view/view.html.php b/module/testtask/view/view.html.php
index 20c0914883..a98f1d9a40 100644
--- a/module/testtask/view/view.html.php
+++ b/module/testtask/view/view.html.php
@@ -33,6 +33,7 @@
testtask->desc;?>
desc) ? $task->desc : $lang->noData;?>
+ fetch('file', 'printFiles', array('files' => $task->files, 'fieldset' => 'true', 'object' => $task));?>
report):?>
testtask->report;?>
@@ -97,6 +98,12 @@
?>
|
||||||
| testtask->type;?> | + + type) as $type) $testType .= zget($lang->testtask->typeList, $type) . ' ';?> ++ | ||||||
| testtask->owner;?> | owner);?> | diff --git a/module/todo/control.php b/module/todo/control.php index 732ef0b358..1d3808939d 100644 --- a/module/todo/control.php +++ b/module/todo/control.php @@ -69,7 +69,8 @@ class todo extends control $this->send(array('result' => 'success', 'id' => $todoID, 'name' => $todo->name, 'pri' => $todo->pri, 'priName' => $this->lang->todo->priList[$todo->pri], 'time' => date(DT_DATE4, strtotime($todo->date)) . ' ' . $todo->begin)); } - if($this->app->getViewType() == 'xhtml') die(js::locate($this->createLink('todo', 'view', "todoID=$todoID"), 'parent')); + if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $todoID)); + if($this->viewType == 'xhtml') die(js::locate($this->createLink('todo', 'view', "todoID=$todoID"), 'parent')); if(isonlybody()) die(js::closeModal('parent.parent')); die(js::locate($this->createLink('my', 'todo', "type=all&userID=&status=all&orderBy=id_desc"), 'parent')); } @@ -96,7 +97,7 @@ class todo extends control if($date == 'today') $date = date(DT_DATE1, time()); if(!empty($_POST)) { - $this->todo->batchCreate(); + $todoIDList = $this->todo->batchCreate(); if(dao::isError()) die(js::error(dao::getError())); /* Locate the browser. */ @@ -109,6 +110,8 @@ class todo extends control { $date= 'today'; } + + if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $todoIDList)); if(isonlybody())die(js::reload('parent.parent')); die(js::locate($this->createLink('my', 'todo', "type=$date"), 'parent')); } diff --git a/module/todo/model.php b/module/todo/model.php index d73ef85c02..df64c634f8 100644 --- a/module/todo/model.php +++ b/module/todo/model.php @@ -101,7 +101,7 @@ class todoModel extends model * Create batch todo * * @access public - * @return void + * @return array */ public function batchCreate() { @@ -164,6 +164,7 @@ class todoModel extends model } } + $todoIDList = array(); foreach($validTodos as $todo) { $this->dao->insert(TABLE_TODO)->data($todo)->autoCheck()->exec(); @@ -172,10 +173,13 @@ class todoModel extends model echo js::error(dao::getError()); die(js::reload('parent')); } - $todoID = $this->dao->lastInsertID(); + $todoID = $this->dao->lastInsertID(); + $todoIDList[] = $todoID; $this->loadModel('score')->create('todo', 'create', $todoID); $this->loadModel('action')->create('todo', $todoID, 'opened'); } + + return $todoIDList; } /** diff --git a/module/tree/control.php b/module/tree/control.php index eaf069b278..e02f14bf6c 100644 --- a/module/tree/control.php +++ b/module/tree/control.php @@ -371,8 +371,9 @@ class tree extends control { if(!empty($_POST)) { - $this->tree->manageChild($rootID, $viewType); + $moduleIDList = $this->tree->manageChild($rootID, $viewType); + if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $moduleIDList)); if($viewType == 'doc' and isonlybody()) die(js::reload('parent.parent')); if(isonlybody()) die(js::closeModal('parent.parent', '', "function(){parent.parent.$('a.refresh').click()}")); diff --git a/module/tree/model.php b/module/tree/model.php index 1042dead60..9bfb5e20c5 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -1542,7 +1542,7 @@ class treeModel extends model * @param int $rootID * @param string $type * @access public - * @return void + * @return array */ public function manageChild($rootID, $type) { @@ -1580,6 +1580,8 @@ class treeModel extends model $parentPath = ','; } $i = 1; + + $moduleIDList = array(); foreach($childs as $moduleID => $moduleName) { if(empty($moduleName)) continue; @@ -1607,8 +1609,9 @@ class treeModel extends model $module->type = $type; $module->order = $order; $this->dao->insert(TABLE_MODULE)->data($module)->exec(); - $moduleID = $this->dao->lastInsertID(); - $childPath = $parentPath . "$moduleID,"; + $moduleID = $this->dao->lastInsertID(); + $moduleIDList[] = $moduleID; + $childPath = $parentPath . "$moduleID,"; $this->dao->update(TABLE_MODULE)->set('path')->eq($childPath)->where('id')->eq($moduleID)->limit(1)->exec(); } else @@ -1619,6 +1622,8 @@ class treeModel extends model $this->dao->update(TABLE_MODULE)->set('name')->eq(strip_tags(trim($moduleName)))->set('short')->eq($short)->set('order')->eq($order)->where('id')->eq($moduleID)->limit(1)->exec(); } } + + return $moduleIDList; } /** diff --git a/module/user/control.php b/module/user/control.php index 04aba479ba..da4a04c6f3 100644 --- a/module/user/control.php +++ b/module/user/control.php @@ -516,9 +516,10 @@ class user extends control $this->send(array('result' => 'fail', 'message' => str_replace('ID ', '', sprintf($this->lang->user->error->reserved, $_POST['account'])))); } - $this->user->create(); + $userID = $this->user->create(); if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); + if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $userID)); $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('company', 'browse'))); } @@ -568,7 +569,9 @@ class user extends control if(!empty($_POST)) { - $this->user->batchCreate(); + $userIDList = $this->user->batchCreate(); + + if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $userIDList)); die(js::locate($this->createLink('company', 'browse'), 'parent')); } diff --git a/module/user/model.php b/module/user/model.php index b21d70430b..aafa1289d0 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -233,7 +233,7 @@ class userModel extends model * Create a user. * * @access public - * @return void + * @return int */ public function create() { @@ -302,6 +302,8 @@ class userModel extends model $this->loadModel('action')->create('user', $userID, 'Created'); $this->loadModel('mail'); if($this->config->mail->mta == 'sendcloud' and !empty($user->email)) $this->mail->syncSendCloud('sync', $user->email, $user->realname); + + return $usereID; } } @@ -310,7 +312,7 @@ class userModel extends model * * @param int $users * @access public - * @return void + * @return array */ public function batchCreate() { @@ -400,6 +402,7 @@ class userModel extends model } $this->loadModel('mail'); + $userIDList = array(); foreach($data as $user) { if($user->group) @@ -413,7 +416,8 @@ class userModel extends model $this->dao->insert(TABLE_USER)->data($user)->autoCheck()->exec(); /* Fix bug #2941 */ - $userID = $this->dao->lastInsertID(); + $userID = $this->dao->lastInsertID(); + $userIDList[] = $userID; $this->loadModel('action')->create('user', $userID, 'Created'); if(dao::isError()) @@ -427,6 +431,7 @@ class userModel extends model if($this->config->mail->mta == 'sendcloud' and !empty($user->email)) $this->mail->syncSendCloud('sync', $user->email, $user->realname); } } + return $userIDList; } /** diff --git a/module/webhook/control.php b/module/webhook/control.php index df969f3426..0e4762b49c 100644 --- a/module/webhook/control.php +++ b/module/webhook/control.php @@ -62,8 +62,9 @@ class webhook extends control { if($_POST) { - $this->webhook->create(); + $webhookID = $this->webhook->create(); if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); + if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $webhookID)); $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse'))); } diff --git a/module/webhook/model.php b/module/webhook/model.php index 306d100d21..d68eae960f 100644 --- a/module/webhook/model.php +++ b/module/webhook/model.php @@ -211,7 +211,7 @@ class webhookModel extends model ->batchCheck($this->config->webhook->create->requiredFields, 'notempty') ->autoCheck() ->exec(); - return !dao::isError(); + return $this->dao->lastInsertId(); } /**||||||