From b1bbcb7c2287f62a372af43955a84f7a76c53620 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 23 May 2018 14:55:33 +0800 Subject: [PATCH] * finish task #4225. --- module/custom/control.php | 24 ++++++++++++------------ module/custom/view/flow.html.php | 2 +- module/custom/view/required.html.php | 2 +- module/custom/view/score.html.php | 4 ++-- module/custom/view/set.html.php | 2 +- module/custom/view/working.html.php | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/module/custom/control.php b/module/custom/control.php index 4efba93390..0fb47cb64a 100644 --- a/module/custom/control.php +++ b/module/custom/control.php @@ -119,29 +119,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) die(js::alert($this->lang->custom->notice->invalidNumberKey)); + if(!is_numeric($key) or $key > 255) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->invalidNumberKey)); } - if(!empty($key) and $key != 'n/a' and !validater::checkREG($key, '/^[a-z_0-9]+$/')) die(js::alert($this->lang->custom->notice->invalidStringKey)); + if(!empty($key) and $key != 'n/a' and !validater::checkREG($key, '/^[a-z_0-9]+$/')) $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) die(js::alert($this->lang->custom->notice->invalidStrlen['ten'])); + if(strlen($key) > 10) $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) die(js::alert($this->lang->custom->notice->invalidStrlen['twenty'])); + if(strlen($key) > 20) $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) die(js::alert($this->lang->custom->notice->invalidStrlen['twoHundred'])); + if($module == 'testcase' and $field == 'stageList' and strlen($key) > 255) $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) die(js::alert($this->lang->custom->notice->invalidStrlen['thirty'])); + if(strlen($key) > 30) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->invalidStrlen['thirty'])); } } @@ -156,8 +156,8 @@ class custom extends control $this->custom->setItem("{$lang}.{$module}.{$field}.{$key}.{$system}", $value); } } - if(dao::isError()) die(js::error(dao::getError())); - die(js::locate($this->createLink('custom', 'set', "module=$module&field=$field&lang=" . str_replace('-', '_', $lang)), 'parent')); + if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); + $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'reload')); } /* Check whether the current language has been customized. */ @@ -237,7 +237,7 @@ class custom extends control $this->dao->update(TABLE_BLOCK)->set("`title` = REPLACE(`title`, '{$projectCommonList[$oldProjectIndex]}', '{$projectCommonList[$newProjectIndex]}')")->where('source')->eq('project')->exec(); } - die(js::reload('parent')); + $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'reload')); } $this->view->title = $this->lang->custom->flow; @@ -250,7 +250,7 @@ class custom extends control if($_POST) { $this->loadModel('setting')->setItem('system.common.global.flow', $this->post->flow); - die(js::reload('parent')); + $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'reload')); } $this->view->title = $this->lang->custom->working; @@ -272,7 +272,7 @@ class custom extends control if($_POST) { $this->custom->saveRequiredFields($moduleName); - die(js::reload('parent.parent')); + $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'reload')); } foreach($this->config->custom->requiredModules as $requiredModule) $this->app->loadLang($requiredModule); @@ -306,7 +306,7 @@ class custom extends control if($_POST) { $this->loadModel('setting')->setItem('system.common.global.scoreStatus', $this->post->score); - die(js::reload('parent')); + $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'reload')); } $this->view->title = $this->lang->custom->score; diff --git a/module/custom/view/flow.html.php b/module/custom/view/flow.html.php index 95e2fdd323..31af5a105c 100644 --- a/module/custom/view/flow.html.php +++ b/module/custom/view/flow.html.php @@ -14,7 +14,7 @@
-
+
custom->flow?> diff --git a/module/custom/view/required.html.php b/module/custom/view/required.html.php index 71f71c1df5..c02b0a334e 100644 --- a/module/custom/view/required.html.php +++ b/module/custom/view/required.html.php @@ -26,7 +26,7 @@
- +
$moduleName->common?> diff --git a/module/custom/view/score.html.php b/module/custom/view/score.html.php index 01db559cdc..12a567ec1a 100644 --- a/module/custom/view/score.html.php +++ b/module/custom/view/score.html.php @@ -13,7 +13,7 @@
- +
custom->score?> @@ -25,7 +25,7 @@ global->scoreStatus) ? $config->global->scoreStatus : 0;?> custom->scoreStatus as $key => $value):?> -

+

diff --git a/module/custom/view/set.html.php b/module/custom/view/set.html.php index 94dfd06ccf..ac39c8385e 100644 --- a/module/custom/view/set.html.php +++ b/module/custom/view/set.html.php @@ -45,7 +45,7 @@ EOT;
- +
custom->object[$module] . $lang->arrow . $lang->custom->$module->fields[$field]?> diff --git a/module/custom/view/working.html.php b/module/custom/view/working.html.php index c1b73bf130..f134856c9e 100644 --- a/module/custom/view/working.html.php +++ b/module/custom/view/working.html.php @@ -14,7 +14,7 @@
- +
custom->working?>