* return before $this->send.

This commit is contained in:
zhujinyong
2021-07-16 09:40:41 +08:00
parent 437ed911c8
commit 1677574443
40 changed files with 286 additions and 286 deletions
+2 -2
View File
@@ -158,8 +158,8 @@ class action extends control
else
{
dao::$errors['submit'][] = $this->lang->action->historyEdit;
$this->send(array('result' => 'fail', 'message' => dao::getError()));
return $this->send(array('result' => 'fail', 'message' => dao::getError()));
}
$this->send(array('result' => 'success', 'locate' => 'reload'));
return $this->send(array('result' => 'success', 'locate' => 'reload'));
}
}
+4 -4
View File
@@ -174,7 +174,7 @@ class admin extends control
{
$data = fixer::input('post')->get();
$this->loadModel('setting')->setItems('system.common.safe', $data);
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'reload'));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'reload'));
}
$this->view->title = $this->lang->admin->safe->common . $this->lang->colon . $this->lang->admin->safe->set;
$this->view->position[] = $this->lang->admin->safe->common;
@@ -326,11 +326,11 @@ class admin extends control
{
if($_POST)
{
if(!validater::checkInt($this->post->days)) $this->send(array('result' => 'fail', 'message' => array('days' => sprintf($this->lang->admin->notice->int, $this->lang->admin->days))));
if(!validater::checkInt($this->post->days)) return $this->send(array('result' => 'fail', 'message' => array('days' => sprintf($this->lang->admin->notice->int, $this->lang->admin->days))));
$this->loadModel('setting')->setItem('system.admin.log.saveDays', $this->post->days);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
}
$this->loadModel('message');
+7 -7
View File
@@ -178,7 +178,7 @@ class backup extends control
*/
public function restore($fileName, $confirm = 'no')
{
if($confirm == 'no') $this->send(array('result' => 'fail', 'message' => $this->lang->backup->confirmRestore));
if($confirm == 'no') return $this->send(array('result' => 'fail', 'message' => $this->lang->backup->confirmRestore));
set_time_limit(0);
@@ -189,12 +189,12 @@ class backup extends control
$this->backup->removeFileHeader($sqlBackup);
$result = $this->backup->restoreSQL($sqlBackup);
$this->backup->addFileHeader($sqlBackup);
if(!$result->result) $this->send(array('result' => 'fail', 'message' => sprintf($this->lang->backup->error->restoreSQL, $result->error)));
if(!$result->result) return $this->send(array('result' => 'fail', 'message' => sprintf($this->lang->backup->error->restoreSQL, $result->error)));
}
elseif(file_exists("{$this->backupPath}{$fileName}.sql"))
{
$result = $this->backup->restoreSQL("{$this->backupPath}{$fileName}.sql");
if(!$result->result) $this->send(array('result' => 'fail', 'message' => sprintf($this->lang->backup->error->restoreSQL, $result->error)));
if(!$result->result) return $this->send(array('result' => 'fail', 'message' => sprintf($this->lang->backup->error->restoreSQL, $result->error)));
}
/* Restore attatchments. */
@@ -204,20 +204,20 @@ class backup extends control
$this->backup->removeFileHeader($fileBackup);
$result = $this->backup->restoreFile($fileBackup);
$this->backup->addFileHeader($fileBackup);
if(!$result->result) $this->send(array('result' => 'fail', 'message' => sprintf($this->lang->backup->error->restoreFile, $result->error)));
if(!$result->result) return $this->send(array('result' => 'fail', 'message' => sprintf($this->lang->backup->error->restoreFile, $result->error)));
}
elseif(file_exists("{$this->backupPath}{$fileName}.file.zip"))
{
$result = $this->backup->restoreFile("{$this->backupPath}{$fileName}.file.zip");
if(!$result->result) $this->send(array('result' => 'fail', 'message' => sprintf($this->lang->backup->error->restoreFile, $result->error)));
if(!$result->result) return $this->send(array('result' => 'fail', 'message' => sprintf($this->lang->backup->error->restoreFile, $result->error)));
}
elseif(file_exists("{$this->backupPath}{$fileName}.file"))
{
$result = $this->backup->restoreFile("{$this->backupPath}{$fileName}.file");
if(!$result->result) $this->send(array('result' => 'fail', 'message' => sprintf($this->lang->backup->error->restoreFile, $result->error)));
if(!$result->result) return $this->send(array('result' => 'fail', 'message' => sprintf($this->lang->backup->error->restoreFile, $result->error)));
}
$this->send(array('result' => 'success', 'message' => $this->lang->backup->success->restore));
return $this->send(array('result' => 'success', 'message' => $this->lang->backup->success->restore));
}
/**
+8 -8
View File
@@ -140,9 +140,9 @@ class block extends control
{
$this->dao->delete()->from(TABLE_BLOCK)->where('`id`')->eq($id)->andWhere('account')->eq($this->app->user->account)->andWhere('module')->eq($module)->exec();
}
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->loadModel('score')->create('block', 'set');
$this->send(array('result' => 'success'));
return $this->send(array('result' => 'success'));
}
/**
@@ -167,9 +167,9 @@ class block extends control
$this->dao->replace(TABLE_BLOCK)->data($block)->exec();
}
if(dao::isError()) $this->send(array('result' => 'fail'));
if(dao::isError()) return $this->send(array('result' => 'fail'));
$this->loadModel('score')->create('block', 'set');
$this->send(array('result' => 'success'));
return $this->send(array('result' => 'success'));
}
/**
@@ -186,17 +186,17 @@ class block extends control
$field = '';
if($type == 'vertical') $field = 'height';
if($type == 'horizontal') $field = 'grid';
if(empty($field)) $this->send(array('result' => 'fail', 'code' => 400));
if(empty($field)) return $this->send(array('result' => 'fail', 'code' => 400));
$block->$field = $data;
$block->params = helper::jsonEncode($block->params);
$this->dao->replace(TABLE_BLOCK)->data($block)->exec();
if(dao::isError()) $this->send(array('result' => 'fail', 'code' => 500));
$this->send(array('result' => 'success'));
if(dao::isError()) return $this->send(array('result' => 'fail', 'code' => 500));
return $this->send(array('result' => 'success'));
}
else
{
$this->send(array('result' => 'fail', 'code' => 404));
return $this->send(array('result' => 'fail', 'code' => 404));
}
}
+1 -1
View File
@@ -25,7 +25,7 @@ class branch extends control
if($_POST)
{
$newBranches = $this->branch->manage($productID);
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $newBranches));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $newBranches));
die(js::reload('parent'));
}
+9 -9
View File
@@ -354,7 +354,7 @@ class bug extends control
{
$response['result'] = 'fail';
$response['message'] = dao::getError();
$this->send($response);
return $this->send($response);
}
$bugID = $bugResult['id'];
@@ -362,7 +362,7 @@ class bug extends control
{
$response['message'] = sprintf($this->lang->duplicate, $this->lang->bug->common);
$response['locate'] = $this->createLink('bug', 'view', "bugID=$bugID");
$this->send($response);
return $this->send($response);
}
/* Record related action, for example FromFeedback. */
@@ -386,12 +386,12 @@ class bug extends control
$this->executeHooks($bugID);
/* Return bug id when call the API. */
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $bugID));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $bugID));
/* If link from no head then reload. */
if(isonlybody()) $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
if(defined('RUN_MODE') && RUN_MODE == 'api') $this->send(array('status' => 'success', 'data' => $bugID));
if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'success', 'data' => $bugID));
if($this->app->openApp == 'execution')
{
@@ -408,7 +408,7 @@ class bug extends control
}
if($this->app->getViewType() == 'xhtml') $location = $this->createLink('bug', 'view', "bugID=$bugID");
$response['locate'] = $location;
$this->send($response);
return $this->send($response);
}
/* Get product, then set menu. */
@@ -627,7 +627,7 @@ class bug extends control
if($this->viewType == 'json')
{
$bugIDList = array_keys($actions);
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $bugIDList));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $bugIDList));
}
setcookie('bugModule', 0, 0, $this->config->webRoot, '', $this->config->cookieSecure, false);
@@ -784,7 +784,7 @@ class bug extends control
{
if(defined('RUN_MODE') && RUN_MODE == 'api')
{
$this->send(array('status' => 'error', 'message' => dao::getError()));
return $this->send(array('status' => 'error', 'message' => dao::getError()));
}
else
{
@@ -801,7 +801,7 @@ class bug extends control
$actionID = $this->action->create('bug', $bugID, $action, $fileAction . $this->post->comment);
$this->action->logHistory($actionID, $changes);
}
if(defined('RUN_MODE') && RUN_MODE == 'api') $this->send(array('status' => 'success', 'data' => $bugID));
if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'success', 'data' => $bugID));
$bug = $this->bug->getById($bugID);
$this->executeHooks($bugID);
+10 -10
View File
@@ -29,17 +29,17 @@ class build extends control
{
$executionID = empty($executionID) ? $this->post->execution : $executionID;
if(empty($executionID)) dao::$errors['execution'] = $this->lang->build->emptyExecution;
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$buildID = $this->build->create($executionID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->loadModel('action')->create('build', $buildID, 'opened');
$this->executeHooks($buildID);
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $buildID));
if(isonlybody()) $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'callback' => "parent.loadExecutionBuilds($executionID)")); // Code for task #5126.
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('build', 'view', "buildID=$buildID")));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $buildID));
if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'callback' => "parent.loadExecutionBuilds($executionID)")); // Code for task #5126.
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('build', 'view', "buildID=$buildID")));
}
/* Set menu. */
@@ -96,7 +96,7 @@ class build extends control
if(!empty($_POST))
{
$changes = $this->build->update($buildID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$files = $this->loadModel('file')->saveUpload('build', $buildID);
if($changes or $files)
@@ -109,7 +109,7 @@ class build extends control
$this->executeHooks($buildID);
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "buildID=$buildID")));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "buildID=$buildID")));
}
$this->loadModel('execution');
@@ -296,7 +296,7 @@ class build extends control
$response['result'] = 'success';
$response['message'] = '';
}
$this->send($response);
return $this->send($response);
}
$link = $this->app->openApp == 'project' ? $this->createLink('project', 'build', "projectID=$build->project") : $this->createLink('execution', 'build', "executionID=$build->execution");
@@ -517,7 +517,7 @@ class build extends control
$response['result'] = 'success';
$response['message'] = '';
}
$this->send($response);
return $this->send($response);
}
die(js::reload('parent'));
}
@@ -637,7 +637,7 @@ class build extends control
$response['result'] = 'success';
$response['message'] = '';
}
$this->send($response);
return $this->send($response);
}
die(js::reload('parent'));
}
+6 -6
View File
@@ -39,7 +39,7 @@ class caselib extends control
{
$response['result'] = 'fail';
$response['message'] = dao::getError();
$this->send($response);
return $this->send($response);
}
$this->loadModel('action')->create('caselib', $libID, 'opened');
@@ -47,11 +47,11 @@ class caselib extends control
if($this->viewType == 'json')
{
$response['id'] = $libID;
$this->send($response);
return $this->send($response);
}
$response['locate'] = $this->createLink('caselib', 'browse', "libID=$libID");
$this->send($response);
return $this->send($response);
}
/* Set menu. */
@@ -84,7 +84,7 @@ class caselib extends control
{
$response['result'] = 'fail';
$response['message'] = dao::getError();
$this->send($response);
return $this->send($response);
}
if($changes)
{
@@ -95,7 +95,7 @@ class caselib extends control
$this->executeHooks($libID);
$response['locate'] = inlink('view', "libID=$libID");
$this->send($response);
return $this->send($response);
}
/* Set lib menu. */
@@ -145,7 +145,7 @@ class caselib extends control
$response['result'] = 'success';
$response['message'] = '';
}
$this->send($response);
return $this->send($response);
}
die(js::reload('parent'));
}
+25 -25
View File
@@ -102,8 +102,8 @@ class custom extends control
if($module == 'project' and $field == 'unitList')
{
$data = fixer::input('post')->join('unitList', ',')->get();
if(empty($data->unitList)) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->currencyNotEmpty));
if(empty($data->defaultCurrency)) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->defaultNotEmpty));
if(empty($data->unitList)) return $this->send(array('result' => 'fail', 'message' => $this->lang->custom->currencyNotEmpty));
if(empty($data->defaultCurrency)) return $this->send(array('result' => 'fail', 'message' => $this->lang->custom->defaultNotEmpty));
$this->loadModel('setting')->setItems("system.$module", $data);
}
elseif($module == 'story' and $field == 'review')
@@ -157,29 +157,29 @@ class custom extends control
/* Invalid key. It should be numbers. (It includes severityList in bug module and priList in stroy, task, bug, testcasea, testtask and todo module.) */
if($field == 'priList' or $field == 'severityList')
{
if(!is_numeric($key) or $key > 255) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->invalidNumberKey));
if(!is_numeric($key) or $key > 255) return $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->invalidNumberKey));
}
if(!empty($key) and !isset($oldCustoms[$key]) and $key != 'n/a' and !validater::checkREG($key, '/^[a-z_A-Z_0-9]+$/')) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->invalidStringKey));
if(!empty($key) and !isset($oldCustoms[$key]) and $key != 'n/a' and !validater::checkREG($key, '/^[a-z_A-Z_0-9]+$/')) return $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->invalidStringKey));
/* The length of roleList in user module and typeList in todo module is less than 10. check it when saved. */
if($field == 'roleList' or $module == 'todo' and $field == 'typeList')
{
if(strlen($key) > 10) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->invalidStrlen['ten']));
if(strlen($key) > 10) return $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->invalidStrlen['ten']));
}
/* The length of sourceList in story module and typeList in task module is less than 20, check it when saved. */
if($field == 'sourceList' or $module == 'task' and $field == 'typeList')
{
if(strlen($key) > 20) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->invalidStrlen['twenty']));
if(strlen($key) > 20) return $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->invalidStrlen['twenty']));
}
/* The length of stageList in testcase module is less than 255, check it when saved. */
if($module == 'testcase' and $field == 'stageList' and strlen($key) > 255) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->invalidStrlen['twoHundred']));
if($module == 'testcase' and $field == 'stageList' and strlen($key) > 255) return $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->invalidStrlen['twoHundred']));
/* The length of field that in bug and testcase module and reasonList in story and task module is less than 30, check it when saved. */
if($module == 'bug' or $field == 'reasonList' or $module == 'testcase')
{
if(strlen($key) > 30) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->invalidStrlen['thirty']));
if(strlen($key) > 30) return $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->invalidStrlen['thirty']));
}
}
@@ -194,8 +194,8 @@ class custom extends control
$this->custom->setItem("{$lang}.{$module}.{$field}.{$key}.{$system}", $value);
}
}
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('custom', 'set', "module=$module&field=$field&lang=" . str_replace('-', '_', isset($this->config->langs[$lang]) ? $lang : 'all'))));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('custom', 'set', "module=$module&field=$field&lang=" . str_replace('-', '_', isset($this->config->langs[$lang]) ? $lang : 'all'))));
}
/* Check whether the current language has been customized. */
@@ -264,7 +264,7 @@ class custom extends control
if($_POST)
{
$this->loadModel('setting')->setItem('system.common.global.flow', $this->post->flow);
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'reload'));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'reload'));
}
$this->view->title = $this->lang->custom->working;
@@ -286,7 +286,7 @@ class custom extends control
if($this->server->request_method == 'POST')
{
$this->custom->saveRequiredFields($moduleName);
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('required', "moduleName=$moduleName")));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('required', "moduleName=$moduleName")));
}
foreach($this->config->custom->requiredModules as $requiredModule) $this->app->loadLang($requiredModule);
@@ -321,7 +321,7 @@ class custom extends control
if($_POST)
{
$this->loadModel('setting')->setItem('system.common.global.scoreStatus', $this->post->score);
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'reload'));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'reload'));
}
$this->view->title = $this->lang->custom->score;
@@ -341,7 +341,7 @@ class custom extends control
if(strtolower($_SERVER['REQUEST_METHOD']) == "post")
{
$this->loadModel('setting')->setItems('system.common', fixer::input('post')->get());
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'reload'));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'reload'));
}
unset($this->lang->admin->menu->custom['subModule']);
@@ -378,10 +378,10 @@ class custom extends control
if($_POST)
{
$result = $this->custom->setURAndSR();
if(!$result) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->URSREmpty));
if(!$result) return $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->URSREmpty));
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
}
$this->view->title = $this->lang->custom->setStoryConcept;
@@ -402,10 +402,10 @@ class custom extends control
if($_POST)
{
$result = $this->custom->updateURAndSR($key);
if(!$result) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->URSREmpty));
if(!$result) return $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->URSREmpty));
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
}
$lang = $this->app->getClientLang();
@@ -476,7 +476,7 @@ class custom extends control
if($_POST)
{
$this->loadModel('setting')->setItem('system.common.CRExecution', $this->post->execution);
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'reload'));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'reload'));
}
$this->view->title = $this->lang->custom->execution;
@@ -497,7 +497,7 @@ class custom extends control
if($_POST)
{
$this->loadModel('setting')->setItem('system.common.CRProduct', $this->post->product);
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'reload'));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'reload'));
}
$this->view->title = $this->lang->custom->product;
@@ -524,7 +524,7 @@ class custom extends control
$this->app->loadLang('common');
$locate = $this->config->systemMode == 'new' ? inlink('flow') : 'top';
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locate));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locate));
}
$this->view->title = $this->lang->custom->flow;
@@ -641,7 +641,7 @@ class custom extends control
$menus = header::safe64Decode($menus);
}
if(empty($menus)) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->saveFail));
if(empty($menus)) return $this->send(array('result' => 'fail', 'message' => $this->lang->custom->saveFail));
if(is_array($menus))
{
@@ -656,7 +656,7 @@ class custom extends control
$this->custom->saveCustomMenu($menus, $module, $method);
}
$this->send(array('result' => 'success'));
return $this->send(array('result' => 'success'));
}
/**
+3 -3
View File
@@ -33,15 +33,15 @@ class datatable extends control
if(!empty($_POST))
{
$account = $this->app->user->account;
if($account == 'guest') $this->send(array('result' => 'fail', 'target' => $target, 'message' => 'guest.'));
if($account == 'guest') return $this->send(array('result' => 'fail', 'target' => $target, 'message' => 'guest.'));
$name = 'datatable.' . $this->post->target . '.' . $this->post->name;
$this->loadModel('setting')->setItem($account . '.' . $name, $this->post->value);
if($this->post->allModule !== false) $this->setting->setItem("$account.execution.task.allModule", $this->post->allModule);
if($this->post->global) $this->setting->setItem('system.' . $name, $this->post->value);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => 'dao error.'));
$this->send(array('result' => 'success'));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => 'dao error.'));
return $this->send(array('result' => 'success'));
}
}
+1 -1
View File
@@ -71,7 +71,7 @@ class dept extends control
if(!empty($_POST))
{
$deptIDList = $this->dept->manageChild($_POST['parentDeptID'], $_POST['depts']);
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $deptIDList));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $deptIDList));
die(js::reload('parent'));
}
}
+14 -14
View File
@@ -142,7 +142,7 @@ class doc extends control
$this->action->create('docLib', $libID, 'Created');
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $libID));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $libID));
die(js::locate($this->createLink('doc', 'objectLibs', "type=$objectType&objectID=$objectID&libID=$libID"), 'parent.parent'));
}
else
@@ -199,7 +199,7 @@ class doc extends control
$response['message'] = $this->lang->saveSuccess;
$response['result'] = 'success';
$response['locate'] = 'parent';
$this->send($response);
return $this->send($response);
}
$lib = $this->doc->getLibByID($libID);
@@ -275,25 +275,25 @@ class doc extends control
{
setcookie('lastDocModule', (int)$this->post->module, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, false);
$docResult = $this->doc->create();
if(!$docResult or dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(!$docResult or dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$docID = $docResult['id'];
$files = zget($docResult, 'files', '');
$lib = $this->doc->getLibByID($this->post->lib);
if($docResult['status'] == 'exists')
{
$this->send(array('result' => 'fail', 'message' => sprintf($this->lang->duplicate, $this->lang->doc->common), 'locate' => $this->createLink('doc', 'view', "docID=$docID")));
return $this->send(array('result' => 'fail', 'message' => sprintf($this->lang->duplicate, $this->lang->doc->common), 'locate' => $this->createLink('doc', 'view', "docID=$docID")));
}
$fileAction = '';
if(!empty($files)) $fileAction = $this->lang->addFiles . join(',', $files) . "\n" ;
$this->action->create('doc', $docID, 'Created', $fileAction);
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $docID));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $docID));
$objectID = zget($lib, $lib->type, '');
$params = "type={$lib->type}&objectID=$objectID&libID={$lib->id}&docID=" . $docResult['id'];
$link = $this->createLink('doc', 'objectLibs', $params);
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link));
}
if($this->app->openApp == 'product')
@@ -355,7 +355,7 @@ class doc extends control
if($comment == false || $comment == 'false')
{
$result = $this->doc->update($docID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$changes = $result['changes'];
$files = $result['files'];
}
@@ -375,8 +375,8 @@ class doc extends control
$link = $this->createLink('doc', 'objectLibs', "type=$objectType&objectID=$objectID&libID=$libID&docID=$docID");
}
if(isonlybody()) $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link));
if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link));
}
/* Get doc and set menu. */
@@ -553,7 +553,7 @@ class doc extends control
$response['locate'] = $this->createLink('doc', 'objectLibs', "type=$objectType");
}
}
$this->send($response);
return $this->send($response);
}
die(js::locate($this->session->docList, 'parent'));
@@ -625,7 +625,7 @@ class doc extends control
$this->dao->update($table)->set('collector')->eq($collectors)->where('id')->eq($objectID)->exec();
$this->send(array('status' => $hasCollect ? 'no' : 'yes'));
return $this->send(array('status' => $hasCollect ? 'no' : 'yes'));
}
/**
@@ -639,11 +639,11 @@ class doc extends control
{
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
if(empty($_POST)) $this->send(array('result' => 'fail', 'message' => $this->lang->doc->errorEmptyLib));
if(empty($_POST)) return $this->send(array('result' => 'fail', 'message' => $this->lang->doc->errorEmptyLib));
foreach($_POST as $id => $order) $this->dao->update(TABLE_DOCLIB)->set('order')->eq($order)->where('id')->eq($id)->exec();
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->send(array('result' => 'success'));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
return $this->send(array('result' => 'success'));
}
if($type)
+7 -7
View File
@@ -46,11 +46,11 @@ class entry extends control
if($_POST)
{
$id = $this->entry->create();
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->loadModel('action')->create('entry', $id, 'created');
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $id));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $id));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
}
$this->view->title = $this->lang->entry->common . $this->lang->colon . $this->lang->entry->create;
@@ -73,14 +73,14 @@ class entry extends control
if($_POST)
{
$changes = $this->entry->update($id);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
if($changes)
{
$actionID = $this->loadModel('action')->create('entry', $id, 'edited');
$this->action->logHistory($actionID, $changes);
}
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
}
$entry = $this->entry->getById($id);
@@ -103,9 +103,9 @@ class entry extends control
public function delete($id)
{
$this->entry->delete(TABLE_ENTRY, $id);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->send(array('result' => 'success'));
return $this->send(array('result' => 'success'));
}
/**
+13 -13
View File
@@ -1285,20 +1285,20 @@ class execution extends control
if(!empty($_POST))
{
$executionID = $this->execution->create($copyExecutionID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->execution->updateProducts($executionID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->loadModel('action')->create($this->objectType, $executionID, 'opened', '', join(',', $_POST['products']));
$this->executeHooks($executionID);
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $executionID));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $executionID));
if($this->app->openApp == 'doc')
{
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('doc', 'objectLibs', "type=execution")));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('doc', 'objectLibs', "type=execution")));
}
$planID = '';
@@ -1312,11 +1312,11 @@ class execution extends control
if(!empty($planID))
{
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('create', "projectID=$projectID&executionID=$executionID&copyExecutionID=&planID=$planID&confirm=no")));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('create', "projectID=$projectID&executionID=$executionID&copyExecutionID=&planID=$planID&confirm=no")));
}
else
{
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('create', "projectID=$projectID&executionID=$executionID")));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('create', "projectID=$projectID&executionID=$executionID")));
}
}
@@ -1379,10 +1379,10 @@ class execution extends control
$oldProducts = $this->execution->getProducts($executionID);
$changes = $this->execution->update($executionID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->execution->updateProducts($executionID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
if($action == 'undelete')
{
$this->loadModel('action');
@@ -1415,7 +1415,7 @@ class execution extends control
}
$this->executeHooks($executionID);
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "executionID=$executionID")));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "executionID=$executionID")));
}
/* Set menu. */
@@ -2335,7 +2335,7 @@ class execution extends control
$response['result'] = 'success';
$response['message'] = '';
}
$this->send($response);
return $this->send($response);
}
die(js::locate($this->inlink('team', "executionID=$executionID"), 'parent'));
}
@@ -2492,7 +2492,7 @@ class execution extends control
$response['result'] = 'success';
$response['message'] = '';
}
$this->send($response);
return $this->send($response);
}
die(js::locate($this->app->session->storyList, 'parent'));
}
@@ -2777,11 +2777,11 @@ class execution extends control
{
$response['result'] = 'fail';
$response['message'] = dao::getError();
$this->send($response);
return $this->send($response);
}
$this->loadModel('action')->create('story', $storyID, 'estimated', '', $executionID);
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('execution', 'storyEstimate', "executionID=$executionID&storyID=$storyID")));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('execution', 'storyEstimate', "executionID=$executionID&storyID=$storyID")));
}
$estimateInfo = $this->story->getEstimateInfo($storyID, $round);
+14 -14
View File
@@ -51,8 +51,8 @@ class gitlab extends control
$this->checkToken();
$gitlabID = $this->gitlab->create();
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
}
$this->view->title = $this->lang->gitlab->common . $this->lang->colon . $this->lang->gitlab->create;
@@ -77,8 +77,8 @@ class gitlab extends control
{
$this->checkToken();
$this->gitlab->update($id);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
}
$this->view->position[] = html::a(inlink('browse'), $this->lang->gitlab->common);
@@ -112,7 +112,7 @@ class gitlab extends control
$accountList[$user] = $openID;
}
if(count($repeatUsers)) $this->send(array('result' => 'fail', 'message' => sprintf($this->lang->gitlab->bindUserError, join(',', $repeatUsers))));
if(count($repeatUsers)) return $this->send(array('result' => 'fail', 'message' => sprintf($this->lang->gitlab->bindUserError, join(',', $repeatUsers))));
$user = new stdclass;
$user->providerID = $gitlabID;
@@ -136,7 +136,7 @@ class gitlab extends control
$this->dao->insert(TABLE_OAUTH)->data($user)->exec();
}
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->server->http_referer));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->server->http_referer));
}
$gitlab = $this->gitlab->getByID($gitlabID);
@@ -186,13 +186,13 @@ class gitlab extends control
*/
public function checkToken()
{
if(strpos($this->post->url, 'http') !== 0) $this->send(array('result' => 'fail', 'message' => array('url' => array($this->lang->gitlab->hostError))));
if(!$this->post->token) $this->send(array('result' => 'fail', 'message' => array('token' => array($this->lang->gitlab->tokenError))));
if(strpos($this->post->url, 'http') !== 0) return $this->send(array('result' => 'fail', 'message' => array('url' => array($this->lang->gitlab->hostError))));
if(!$this->post->token) return $this->send(array('result' => 'fail', 'message' => array('token' => array($this->lang->gitlab->tokenError))));
$user = $this->gitlab->apiGetCurrentUser($this->post->url, $this->post->token);
if(!is_object($user)) $this->send(array('result' => 'fail', 'message' => array('url' => array($this->lang->gitlab->hostError))));
if(!isset($user->is_admin) or !$user->is_admin) $this->send(array('result' => 'fail', 'message' => array('token' => array($this->lang->gitlab->tokenError))));
if(!is_object($user)) return $this->send(array('result' => 'fail', 'message' => array('url' => array($this->lang->gitlab->hostError))));
if(!isset($user->is_admin) or !$user->is_admin) return $this->send(array('result' => 'fail', 'message' => array('token' => array($this->lang->gitlab->tokenError))));
}
/**
@@ -304,12 +304,12 @@ class gitlab extends control
}
else
{
if($productList[$issueID] != 0) $this->send(array('result' => 'fail', 'message' => $this->lang->gitlab->importIssueError, 'locate' => $this->server->http_referer));
if($productList[$issueID] != 0) return $this->send(array('result' => 'fail', 'message' => $this->lang->gitlab->importIssueError, 'locate' => $this->server->http_referer));
}
}
if($failedIssues) $this->send(array('result' => 'success', 'message' => $this->lang->gitlab->importIssueWarn, 'locate' => $this->server->http_referer));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->server->http_referer));
if($failedIssues) return $this->send(array('result' => 'success', 'message' => $this->lang->gitlab->importIssueWarn, 'locate' => $this->server->http_referer));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->server->http_referer));
}
$savedIssueIDList = $this->dao->select('BID as issueID')->from(TABLE_RELATION)
@@ -359,7 +359,7 @@ class gitlab extends control
*/
public function ajaxGetExecutionsByProduct($productID)
{
if(!$productID) $this->send(array('message' => array()));
if(!$productID) return $this->send(array('message' => array()));
$executions = $this->loadModel('product')->getAllExecutionPairsByProduct($productID);
$options = "<option value=''></option>";
+6 -6
View File
@@ -59,7 +59,7 @@ class group extends control
{
$groupID = $this->group->create();
if(dao::isError()) die(js::error(dao::getError()));
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $groupID));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $groupID));
if(isonlybody()) die(js::closeModal('parent.parent', 'this'));
die(js::locate($this->createLink('group', 'browse'), 'parent'));
}
@@ -130,10 +130,10 @@ class group extends control
if($_POST)
{
$this->group->updateView($groupID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$link = isonlybody() ? 'parent' : $this->createLink('group', 'browse');
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link));
}
/* Get the group data by id. */
@@ -179,9 +179,9 @@ class group extends control
{
if($type == 'byGroup') $result = $this->group->updatePrivByGroup($groupID, $menu, $version);
if($type == 'byModule') $result = $this->group->updatePrivByModule();
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
}
if($type == 'byGroup')
@@ -345,7 +345,7 @@ class group extends control
$response['result'] = 'success';
$response['message'] = '';
}
$this->send($response);
return $this->send($response);
}
die(js::locate($this->createLink('group', 'browse'), 'parent'));
}
+5 -5
View File
@@ -62,9 +62,9 @@ class jenkins extends control
if($_POST)
{
$jenkinsID = $this->jenkins->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' => $jenkinsID));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $jenkinsID));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
}
$this->view->title = $this->lang->jenkins->common . $this->lang->colon . $this->lang->jenkins->create;
@@ -87,8 +87,8 @@ class jenkins extends control
if($_POST)
{
$this->jenkins->update($id);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
}
$this->view->title = $this->lang->jenkins->common . $this->lang->colon . $this->lang->jenkins->edit;
+5 -5
View File
@@ -64,9 +64,9 @@ class job extends control
if($_POST)
{
$jobID = $this->job->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' => $jobID));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $jobID));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
}
$this->app->loadLang('action');
@@ -104,8 +104,8 @@ class job extends control
if($_POST)
{
$this->job->update($id);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
}
$repo = $this->loadModel('repo')->getRepoByID($job->repo);
+3 -3
View File
@@ -57,11 +57,11 @@ class message extends control
{
$response['result'] = 'fail';
$response['message'] = dao::getError();
$this->send($response);
return $this->send($response);
}
$response['locate'] = $this->createLink('message', 'browser');
$this->send($response);
return $this->send($response);
}
$this->view->title = $this->lang->message->browser;
@@ -85,7 +85,7 @@ class message extends control
$data = fixer::input('post')->get();
$data->messageSetting = json_encode($data->messageSetting);
$this->loadModel('setting')->setItem('system.message.setting', $data->messageSetting);
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'reload'));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'reload'));
}
$this->loadModel('webhook');
+2 -2
View File
@@ -168,13 +168,13 @@ class personnel extends control
if($_POST)
{
$this->personnel->addWhitelist($objectType, $objectID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => $this->getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => $this->getError()));
$this->loadModel('action')->create('whitelist', $objectID, 'managedWhitelist', '', $objectType);
$locateLink = $this->session->whitelistList ? $this->session->whitelistList : $this->createLink($module, 'whitelist', "objectID=$objectID");
$openApp = $module == 'program' ? ($from == 'project' || $from == 'my' ? '#open=project' : '#open=program') : '';
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locateLink . $openApp));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locateLink . $openApp));
}
$this->loadModel('dept');
+9 -9
View File
@@ -49,14 +49,14 @@ class productplan extends control
if(!empty($_POST))
{
$planID = $this->productplan->create();
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->loadModel('action')->create('productplan', $planID, 'opened');
$this->executeHooks($planID);
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $planID));
if(isonlybody()) $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'callback' => 'parent.refreshPlan()'));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('productplan', 'browse', "productID=$productID&branch=$branchID")));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $planID));
if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'callback' => 'parent.refreshPlan()'));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('productplan', 'browse', "productID=$productID&branch=$branchID")));
}
$this->commonAction($productID, $branchID);
@@ -97,14 +97,14 @@ class productplan extends control
if(!empty($_POST))
{
$changes = $this->productplan->update($planID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
if($changes)
{
$actionID = $this->loadModel('action')->create('productplan', $planID, 'edited');
$this->action->logHistory($actionID, $changes);
}
$this->executeHooks($planID);
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "planID=$planID")));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "planID=$planID")));
}
$plan = $this->productplan->getByID($planID);
@@ -187,7 +187,7 @@ class productplan extends control
$response['result'] = 'success';
$response['message'] = '';
}
$this->send($response);
return $this->send($response);
}
die(js::locate(inlink('browse', "productID=$plan->product&branch=$plan->branch"), 'parent'));
}
@@ -456,7 +456,7 @@ class productplan extends control
$response['result'] = 'success';
$response['message'] = '';
}
$this->send($response);
return $this->send($response);
}
die(js::reload('parent'));
}
@@ -593,7 +593,7 @@ class productplan extends control
$response['result'] = 'success';
$response['message'] = '';
}
$this->send($response);
return $this->send($response);
}
die(js::reload('parent'));
}
+5 -5
View File
@@ -125,11 +125,11 @@ class program extends control
if($_POST)
{
$programID = $this->program->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' => $programID));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $programID));
$this->loadModel('action')->create('program', $programID, 'opened');
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
}
$this->view->title = $this->lang->program->create;
@@ -159,14 +159,14 @@ class program extends control
if($_POST)
{
$changes = $this->program->update($programID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
if($changes)
{
$actionID = $this->loadModel('action')->create('program', $programID, 'edited');
$this->action->logHistory($actionID, $changes);
}
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inLink('browse')));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inLink('browse')));
}
$program = $this->program->getByID($programID);
+18 -18
View File
@@ -277,7 +277,7 @@ class project extends control
if($_POST)
{
$projectID = $this->project->create();
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->loadModel('action')->create('project', $projectID, 'opened');
@@ -305,15 +305,15 @@ class project extends control
}
}
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $projectID));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $projectID));
if($this->app->openApp == 'program')
{
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('program', 'browse')));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('program', 'browse')));
}
elseif($this->app->openApp == 'doc')
{
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('doc', 'objectLibs', "type=project&objectID=$projectID")));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('doc', 'objectLibs', "type=project&objectID=$projectID")));
}
else
{
@@ -321,10 +321,10 @@ class project extends control
{
$productID = $this->loadModel('product')->getProductIDByProject($projectID, true);
$this->session->set('projectPlanList', $this->createLink('programplan', 'browse', "projectID=$projectID&productID=$productID&type=lists", '', '', $projectID), 'project');
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('programplan', 'create', "projectID=$projectID", '', '', $projectID)));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('programplan', 'create', "projectID=$projectID", '', '', $projectID)));
}
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('project', 'browse', "programID=0&browseType=all", '', '', $projectID)));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('project', 'browse', "programID=0&browseType=all", '', '', $projectID)));
}
}
@@ -419,7 +419,7 @@ class project extends control
$diffResult = array_diff($oldPlans, $_POST['plans']);
$changes = $this->project->update($projectID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
if($changes)
{
@@ -433,10 +433,10 @@ class project extends control
$this->loadModel('productplan')->linkProject($projectID, $_POST['plans'], $oldPlanStories);
}
if(isonlybody()) $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
$locateLink = $this->session->projectList ? $this->session->projectList : inLink('view', "projectID=$projectID");
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locateLink));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locateLink));
}
$linkedBranches = array();
@@ -621,7 +621,7 @@ class project extends control
$_POST['project'] = $projectID;
$groupID = $this->group->create();
if(dao::isError()) die(js::error(dao::getError()));
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $groupID));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $groupID));
die(js::closeModal('parent.parent'));
}
@@ -994,9 +994,9 @@ class project extends control
if($_POST)
{
$this->group->updateView($groupID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('group', "projectID=$projectID&programID=$programID")));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('group', "projectID=$projectID&programID=$programID")));
}
$this->project->setMenu($projectID);
@@ -1043,9 +1043,9 @@ class project extends control
if(!empty($_POST))
{
if($type == 'byGroup') $result = $this->group->updatePrivByGroup($groupID, $menu, $version);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('group', "projectID=$group->project")));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('group', "projectID=$group->project")));
}
$this->project->setMenu($projectID);
@@ -1108,7 +1108,7 @@ class project extends control
$this->loadModel('action')->create('team', $projectID, 'ManagedTeam');
$link = $this->createLink('project', 'manageMembers', "projectID=$projectID");
$this->send(array('message' => $this->lang->saveSuccess, 'result' => 'success', 'locate' => $link));
return $this->send(array('message' => $this->lang->saveSuccess, 'result' => 'success', 'locate' => $link));
}
$project = $this->project->getById($projectID);
@@ -1518,12 +1518,12 @@ class project extends control
if(!isset($_POST['products']))
{
dao::$errors['message'][] = $this->lang->project->errorNoProducts;
$this->send(array('result' => 'fail', 'message' => dao::getError()));
return $this->send(array('result' => 'fail', 'message' => dao::getError()));
}
$oldProducts = $this->project->getProducts($projectID);
$this->project->updateProducts($projectID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$oldProducts = array_keys($oldProducts);
$newProducts = $this->project->getProducts($projectID);
@@ -1534,7 +1534,7 @@ class project extends control
$locateLink = inLink('manageProducts', "projectID=$projectID");
if($from == 'program') $locateLink = $this->createLink('program', 'browse');
if($from == 'programproject') $locateLink = $this->session->programProject ? $this->session->programProject : inLink('programProject', "projectID=$projectID");
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locateLink));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locateLink));
}
$project = $this->project->getById($projectID);
+8 -8
View File
@@ -104,13 +104,13 @@ class projectrelease extends control
if(!empty($_POST))
{
$releaseID = $this->projectrelease->create();
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->loadModel('action')->create('release', $releaseID, 'opened');
$this->executeHooks($releaseID);
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $releaseID));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $releaseID));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "releaseID=$releaseID")));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "releaseID=$releaseID")));
}
/* Get the builds that can select. */
@@ -146,7 +146,7 @@ class projectrelease extends control
if(!empty($_POST))
{
$changes = $this->projectrelease->update($releaseID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$files = $this->loadModel('file')->saveUpload('release', $releaseID);
if($changes or $files)
{
@@ -156,7 +156,7 @@ class projectrelease extends control
if(!empty($changes)) $this->action->logHistory($actionID, $changes);
}
$this->executeHooks($releaseID);
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "releaseID=$releaseID")));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "releaseID=$releaseID")));
}
$this->loadModel('story');
$this->loadModel('bug');
@@ -298,7 +298,7 @@ class projectrelease extends control
$release = $this->release->getById($releaseID);
$this->dao->update(TABLE_BUILD)->set('deleted')->eq(1)->where('id')->eq($release->build)->andWhere('name')->eq($release->name)->exec();
}
$this->send($response);
return $this->send($response);
}
die(js::locate($this->session->releaseList, 'parent'));
}
@@ -514,7 +514,7 @@ class projectrelease extends control
$response['result'] = 'success';
$response['message'] = '';
}
$this->send($response);
return $this->send($response);
}
die(js::reload('parent'));
}
@@ -644,7 +644,7 @@ class projectrelease extends control
$response['result'] = 'success';
$response['message'] = '';
}
$this->send($response);
return $this->send($response);
}
die(js::reload('parent'));
}
+9 -9
View File
@@ -65,14 +65,14 @@ class release extends control
if(!empty($_POST))
{
$releaseID = $this->release->create($productID, $branch);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->loadModel('action')->create('release', $releaseID, 'opened');
$this->executeHooks($releaseID);
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $releaseID));
if(isonlybody()) $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'callback' => "parent.loadProductBuilds($productID)"));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "releaseID=$releaseID")));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $releaseID));
if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'callback' => "parent.loadProductBuilds($productID)"));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "releaseID=$releaseID")));
}
$builds = $this->loadModel('build')->getProductBuildPairs($productID, $branch, 'notrunk|withbranch', false);
@@ -101,7 +101,7 @@ class release extends control
if(!empty($_POST))
{
$changes = $this->release->update($releaseID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$files = $this->loadModel('file')->saveUpload('release', $releaseID);
if($changes or $files)
{
@@ -111,7 +111,7 @@ class release extends control
if(!empty($changes)) $this->action->logHistory($actionID, $changes);
}
$this->executeHooks($releaseID);
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "releaseID=$releaseID")));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "releaseID=$releaseID")));
}
$this->loadModel('story');
$this->loadModel('bug');
@@ -248,7 +248,7 @@ class release extends control
$release = $this->release->getById($releaseID);
$this->dao->update(TABLE_BUILD)->set('deleted')->eq(1)->where('id')->eq($release->build)->andWhere('name')->eq($release->name)->exec();
}
$this->send($response);
return $this->send($response);
}
die(js::locate($this->session->releaseList, 'parent'));
}
@@ -463,7 +463,7 @@ class release extends control
$response['result'] = 'success';
$response['message'] = '';
}
$this->send($response);
return $this->send($response);
}
die(js::reload('parent'));
}
@@ -593,7 +593,7 @@ class release extends control
$response['result'] = 'success';
$response['message'] = '';
}
$this->send($response);
return $this->send($response);
}
die(js::reload('parent'));
}
+8 -8
View File
@@ -117,11 +117,11 @@ class repo extends control
{
$repoID = $this->repo->create();
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $repoID));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $repoID));
$link = $this->repo->createLink('showSyncCommit', "repoID=$repoID&objectID=$objectID", '', false);
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link));
}
$repoID = $this->repo->saveState(0, $objectID);
@@ -155,14 +155,14 @@ class repo extends control
if($_POST)
{
$noNeedSync = $this->repo->update($repoID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(!$noNeedSync)
{
$link = $this->repo->createLink('showSyncCommit', "repoID=$repoID");
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link));
}
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('maintain')));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('maintain')));
}
$this->app->loadLang('action');
@@ -833,7 +833,7 @@ class repo extends control
if($_POST)
{
$this->loadModel('setting')->setItem('system.repo.rules', json_encode($this->post->rules));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('setRules')));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('setRules')));
}
$repoID = $this->session->repoID;
@@ -1120,7 +1120,7 @@ class repo extends control
{
$projects = $this->loadModel('gitlab')->apiGetProjects($host);
if(!$projects) $this->send(array('message' => array()));
if(!$projects) return $this->send(array('message' => array()));
$projectIdList = $projectIdList ? explode(',', $projectIdList) : null;
$options = "<option value=''></option>";
foreach($projects as $project)
+3 -3
View File
@@ -51,15 +51,15 @@ class score extends control
if(helper::isAjaxRequest())
{
$result = $this->score->reset($lastID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
if($result['status'] == 'finish')
{
$this->send(array('result' => 'finished', 'message' => $this->lang->score->resetFinish));
return $this->send(array('result' => 'finished', 'message' => $this->lang->score->resetFinish));
}
else
{
$this->send(array('result' => 'unfinished', 'message' => $this->lang->score->resetLoading, 'lastID' => $result['lastID'], 'total' => $result['number']));
return $this->send(array('result' => 'unfinished', 'message' => $this->lang->score->resetLoading, 'lastID' => $result['lastID'], 'total' => $result['number']));
}
}
$this->display();
+3 -3
View File
@@ -159,14 +159,14 @@ class search extends control
if(helper::isAjaxRequest())
{
$result = $this->search->buildAllIndex($type, $lastID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(isset($result['finished']) and $result['finished'])
{
$this->send(array('result' => 'finished', 'message' => $this->lang->search->buildSuccessfully));
return $this->send(array('result' => 'finished', 'message' => $this->lang->search->buildSuccessfully));
}
else
{
$this->send(array('result' => 'unfinished', 'message' => sprintf($this->lang->search->buildResult, zget($this->lang->searchObjects, ($result['type'] == 'case' ? 'testcase' : $result['type']), $result['type']), $result['count']),'next' => inlink('buildIndex', "type={$result['type']}&lastID={$result['lastID']}") ));
return $this->send(array('result' => 'unfinished', 'message' => sprintf($this->lang->search->buildResult, zget($this->lang->searchObjects, ($result['type'] == 'case' ? 'testcase' : $result['type']), $result['type']), $result['count']),'next' => inlink('buildIndex', "type={$result['type']}&lastID={$result['lastID']}") ));
}
}
+1 -1
View File
@@ -280,7 +280,7 @@ class sso extends control
if($_POST)
{
$result = $this->sso->createUser();
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $result['id']));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $result['id']));
if($result['status'] != 'success') die($result['data']);
die('success');
}
+6 -6
View File
@@ -57,17 +57,17 @@ class stakeholder extends control
{
$response['result'] = 'fail';
$response['message'] = dao::getError();
$this->send($response);
return $this->send($response);
}
$actionID = $this->loadModel('action')->create('stakeholder', $stakeholderID, 'added');
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $stakeholderID));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $stakeholderID));
$moduleName = $this->app->openApp == 'program' ? 'program' : $this->moduleName;
$methodName = $this->app->openApp == 'program' ? 'stakeholder' : 'browse';
$param = $this->app->openApp == 'program' ? "programID=$objectID" : "projectID=$objectID";
$locate = $this->createLink($moduleName, $methodName, $param);
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locate));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locate));
}
if($this->app->openApp == 'program')
@@ -104,7 +104,7 @@ class stakeholder extends control
if($_POST)
{
$stakeholderList = $this->stakeholder->batchCreate($projectID);
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $stakeholderList));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $stakeholderList));
die(js::locate($this->createLink('stakeholder', 'browse', "projectID=$projectID"), 'parent'));
}
@@ -160,13 +160,13 @@ class stakeholder extends control
{
$response['result'] = 'fail';
$response['message'] = dao::getError();
$this->send($response);
return $this->send($response);
}
$actionID = $this->loadModel('action')->create('stakeholder', $stakeholderID, 'Edited');
$this->action->logHistory($actionID, $changes);
$response['locate'] = $this->createLink('stakeholder', 'browse', "projectID=$stakeholder->objectID");
$this->send($response);
return $this->send($response);
}
$users = array('' => '');
+1 -1
View File
@@ -1327,7 +1327,7 @@ class story extends control
return $this->send($response);
}
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $tasks));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $tasks));
$response['locate'] = $this->createLink('execution', 'task', "executionID=$executionID");
return $this->send($response);
}
+7 -7
View File
@@ -306,7 +306,7 @@ class testcase extends control
{
$response['result'] = 'fail';
$response['message'] = dao::getError();
$this->send($response);
return $this->send($response);
}
$caseID = $caseResult['id'];
@@ -314,7 +314,7 @@ class testcase extends control
{
$response['message'] = sprintf($this->lang->duplicate, $this->lang->testcase->common);
$response['locate'] = $this->createLink('testcase', 'view', "caseID=$caseID");
$this->send($response);
return $this->send($response);
}
$this->loadModel('action');
@@ -324,13 +324,13 @@ class testcase extends control
$this->executeHooks($caseID);
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $caseID));
if($this->viewType == 'json') return $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));
if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true));
setcookie('caseModule', 0, 0, $this->config->webRoot, '', $this->config->cookieSecure, false);
$response['locate'] = ($this->session->caseList and strpos($this->session->caseList, 'dynamic') === false) ? $this->session->caseList : $this->createLink('testcase', 'browse', "productID={$this->post->product}&branch={$this->post->branch}&browseType=all&param=0&orderBy=id_desc");
$this->send($response);
return $this->send($response);
}
if(empty($this->products)) $this->locate($this->createLink('product', 'create'));
@@ -478,7 +478,7 @@ class testcase extends control
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));
if($this->viewType == 'json') return $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';
@@ -1006,7 +1006,7 @@ class testcase extends control
$response['result'] = 'success';
$response['message'] = '';
}
$this->send($response);
return $this->send($response);
}
die(js::locate($this->session->caseList, 'parent'));
}
+1 -1
View File
@@ -165,7 +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));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $reportID));
die(js::locate(inlink('view', "reportID=$reportID"), 'parent'));
}
+7 -7
View File
@@ -116,16 +116,16 @@ class testsuite extends control
{
$response['result'] = 'fail';
$response['message'] = dao::getError();
$this->send($response);
return $this->send($response);
}
$actionID = $this->loadModel('action')->create('testsuite', $suiteID, 'opened');
$this->executeHooks($suiteID);
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $suiteID));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $suiteID));
$response['locate'] = $this->createLink('testsuite', 'browse', "productID=$productID");
$this->send($response);
return $this->send($response);
}
/* Set menu. */
@@ -215,7 +215,7 @@ class testsuite extends control
{
$response['result'] = 'fail';
$response['message'] = dao::getError();
$this->send($response);
return $this->send($response);
}
if($changes)
{
@@ -226,7 +226,7 @@ class testsuite extends control
$this->executeHooks($suiteID);
$response['locate'] = inlink('view', "suiteID=$suiteID");
$this->send($response);
return $this->send($response);
}
if($suite->type == 'private' and $suite->addedBy != $this->app->user->account and !$this->app->user->admin) die(js::error($this->lang->error->accessDenied) . js::locate('back'));
@@ -280,7 +280,7 @@ class testsuite extends control
$response['result'] = 'success';
$response['message'] = '';
}
$this->send($response);
return $this->send($response);
}
die(js::reload('parent'));
}
@@ -371,7 +371,7 @@ class testsuite extends control
$response['result'] = 'fail';
$response['message'] = dao::getError();
}
$this->send($response);
return $this->send($response);
}
}
+22 -22
View File
@@ -212,17 +212,17 @@ class testtask extends control
if(!empty($_POST))
{
$taskID = $this->testtask->create($projectID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$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));
if($this->viewType == 'json') return $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");
if($this->app->openApp == 'qa') $link = $this->createLink('testtask', 'browse', "productID=$productID");
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link));
}
/* Set menu. */
@@ -712,7 +712,7 @@ class testtask extends control
if(!empty($_POST))
{
$changes = $this->testtask->update($taskID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
if($changes or $this->post->comment)
{
$actionID = $this->loadModel('action')->create('testtask', $taskID, 'edited', $this->post->comment);
@@ -722,7 +722,7 @@ class testtask extends control
$this->executeHooks($taskID);
$link = isonlybody() ? 'parent' : $this->session->testtaskList;
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link));
}
/* Set menu. */
@@ -774,7 +774,7 @@ class testtask extends control
if(!empty($_POST))
{
$changes = $this->testtask->start($taskID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
if($this->post->comment != '' or !empty($changes))
{
@@ -784,8 +784,8 @@ class testtask extends control
$this->executeHooks($taskID);
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")));
if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('testtask', 'view', "taskID=$taskID")));
}
/* Get task info. */
@@ -816,7 +816,7 @@ class testtask extends control
if(!empty($_POST))
{
$changes = $this->testtask->activate($taskID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
if($this->post->comment != '' or !empty($changes))
{
@@ -826,8 +826,8 @@ class testtask extends control
$this->executeHooks($taskID);
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")));
if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('testtask', 'view', "taskID=$taskID")));
}
/* Get task info. */
@@ -858,7 +858,7 @@ class testtask extends control
if(!empty($_POST))
{
$changes = $this->testtask->close($taskID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
if($this->post->comment != '' or !empty($changes))
{
@@ -868,8 +868,8 @@ class testtask extends control
$this->executeHooks($taskID);
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")));
if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
return $this->send(array('result' => 'success', 'message' => $this->lang->success, 'locate' => $this->createLink('testtask', 'view', "taskID=$taskID")));
}
/* Get task info. */
@@ -901,7 +901,7 @@ class testtask extends control
if(!empty($_POST))
{
$changes = $this->testtask->block($taskID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
if($this->post->comment != '' or !empty($changes))
{
@@ -911,8 +911,8 @@ class testtask extends control
$this->executeHooks($taskID);
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")));
if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('testtask', 'view', "taskID=$taskID")));
}
/* Get task info. */
@@ -965,7 +965,7 @@ class testtask extends control
$response['result'] = 'success';
$response['message'] = '';
}
$this->send($response);
return $this->send($response);
}
$browseList = $this->createLink('testtask', 'browse', "productID=$task->product");
@@ -1085,7 +1085,7 @@ class testtask extends control
$response['message'] = dao::getError();
}
$this->loadModel('action')->create('case' ,$testRun->case, 'unlinkedfromtesttask', '', $testRun->task);
$this->send($response);
return $this->send($response);
}
}
@@ -1145,7 +1145,7 @@ class testtask extends control
$response['result'] = 'success';
$response['locate'] = $this->createLink('testtask', 'results',"runID=$runID&caseID=$caseID&version=$version");
die($this->send($response));
return $this->send($response);
}
else
{
@@ -1161,14 +1161,14 @@ class testtask extends control
$response['result'] = 'success';
$response['next'] = 'success';
$response['locate'] = inlink('runCase', "runID=$nextRunID&caseID=$nextCaseID&version=$nextVersion");
die($this->send($response));
return $this->send($response);
}
else
{
$response['result'] = 'success';
$response['locate'] = 'reload';
$response['target'] = 'parent';
die($this->send($response));
return $this->send($response);
}
}
}
+5 -5
View File
@@ -59,16 +59,16 @@ class todo extends control
$date = 'today';
}
if(!empty($_POST['idvalue'])) $this->send(array('result' => 'success'));
if(!empty($_POST['idvalue'])) return $this->send(array('result' => 'success'));
if($from == 'block')
{
$todo = $this->todo->getById($todoID);
$this->app->loadClass('date');
$todo->begin = date::formatTime($todo->begin);
$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));
return $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->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $todoID));
if($this->viewType == 'json') return $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'));
@@ -110,7 +110,7 @@ class todo extends control
$date= 'today';
}
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $todoIDList));
if($this->viewType == 'json') return $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'));
}
@@ -432,7 +432,7 @@ class todo extends control
$response['result'] = 'success';
$response['message'] = '';
}
$this->send($response);
return $this->send($response);
}
if(isonlybody())die(js::reload('parent.parent'));
+1 -1
View File
@@ -373,7 +373,7 @@ class tree extends control
{
$moduleIDList = $this->tree->manageChild($rootID, $viewType);
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $moduleIDList));
if($this->viewType == 'json') return $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()}"));
+2 -2
View File
@@ -52,12 +52,12 @@ class tutorial extends control
{
if($_POST && isset($_POST['finish'])) $finish = $_POST['finish'];
if($finish == 'keepAll') $this->send(array('result' => 'fail', 'message' => $this->lang->tutorial->ajaxSetError));
if($finish == 'keepAll') return $this->send(array('result' => 'fail', 'message' => $this->lang->tutorial->ajaxSetError));
$account = $this->app->user->account;
$this->session->set('tutorialMode', false);
$this->loadModel('setting')->setItem("$account.tutorial.tasks.setting", $finish);
$this->session->set('tutorialMode', true);
$this->send(array('result' => 'success'));
return $this->send(array('result' => 'success'));
}
/**
+19 -19
View File
@@ -513,14 +513,14 @@ class user extends control
{
if(strtolower($_POST['account']) == 'guest')
{
$this->send(array('result' => 'fail', 'message' => str_replace('ID ', '', sprintf($this->lang->user->error->reserved, $_POST['account']))));
return $this->send(array('result' => 'fail', 'message' => str_replace('ID ', '', sprintf($this->lang->user->error->reserved, $_POST['account']))));
}
$userID = $this->user->create();
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $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')));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $userID));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('company', 'browse')));
}
$groups = $this->dao->select('id, name, role')->from(TABLE_GROUP)->fetchAll();
@@ -571,7 +571,7 @@ class user extends control
{
$userIDList = $this->user->batchCreate();
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $userIDList));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $userIDList));
die(js::locate($this->createLink('company', 'browse'), 'parent'));
}
@@ -614,10 +614,10 @@ class user extends control
if(!empty($_POST))
{
$this->user->update($userID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$link = $this->session->userList ? $this->session->userList : $this->createLink('company', 'browse');
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link));
}
$user = $this->user->getById($userID, 'id');
@@ -713,7 +713,7 @@ class user extends control
$response['result'] = 'success';
$response['message'] = '';
}
$this->send($response);
return $this->send($response);
}
die(js::locate($this->session->userList, 'parent.parent'));
}
@@ -740,7 +740,7 @@ class user extends control
}
/**
* Unbind Ranzhi
* Unbind Ranzhi
*
* @param string $userID
* @param string $confirm
@@ -821,12 +821,12 @@ class user extends control
)
{
$response['locate'] = $this->referer;
$this->send($response);
return $this->send($response);
}
else
{
$response['locate'] = $this->config->webRoot;
$this->send($response);
return $this->send($response);
}
}
@@ -846,14 +846,14 @@ class user extends control
$response['result'] = 'fail';
$response['message'] = sprintf($this->lang->user->loginLocked, $this->config->user->lockMinutes);
if($this->app->getViewType() == 'json') die(helper::removeUTF8Bom(json_encode(array('status' => 'failed', 'reason' => $failReason))));
$this->send($response);
return $this->send($response);
}
if((!empty($this->config->safe->loginCaptcha) and strtolower($this->post->captcha) != strtolower($this->session->captcha) and $this->app->getViewType() != 'json'))
{
$response['result'] = 'fail';
$response['message'] = $this->lang->user->errorCaptcha;
$this->send($response);
return $this->send($response);
}
$user = $this->user->identify($account, $password);
@@ -896,12 +896,12 @@ class user extends control
if(common::hasPriv($module, $method))
{
$response['locate'] = $this->post->referer;
$this->send($response);
return $this->send($response);
}
else
{
$response['locate'] = $this->config->webRoot;
$this->send($response);
return $this->send($response);
}
}
else
@@ -914,7 +914,7 @@ class user extends control
$response['locate'] = $this->config->webRoot;
$response['result'] = 'success';
$this->send($response);
return $this->send($response);
}
}
else
@@ -926,16 +926,16 @@ class user extends control
if($remainTimes <= 0)
{
$response['message'] = sprintf($this->lang->user->loginLocked, $this->config->user->lockMinutes);
$this->send($response);
return $this->send($response);
}
else if($remainTimes <= 3)
{
$response['message'] = sprintf($this->lang->user->lockWarning, $remainTimes);
$this->send($response);
return $this->send($response);
}
$response['message'] = $this->lang->user->loginFailed;
$this->send($response);
return $this->send($response);
}
}
else
+6 -6
View File
@@ -63,9 +63,9 @@ class webhook extends control
if($_POST)
{
$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')));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $webhookID));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
}
$this->app->loadLang('action');
@@ -90,8 +90,8 @@ class webhook extends control
if($_POST)
{
$this->webhook->update($id);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
}
$webhook = $this->webhook->getByID($id);
@@ -118,7 +118,7 @@ class webhook extends control
public function delete($id)
{
$this->webhook->delete(TABLE_WEBHOOK, $id);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->send(array('result' => 'success'));
}