diff --git a/module/dept/control.php b/module/dept/control.php index 4078b36d2e..5125ec0118 100644 --- a/module/dept/control.php +++ b/module/dept/control.php @@ -14,8 +14,8 @@ class dept extends control const NEW_CHILD_COUNT = 10; /** - * Construct function, set menu. - * + * Construct function, set menu. + * * @access public * @return void */ @@ -27,8 +27,8 @@ class dept extends control /** * Browse a department. - * - * @param int $deptID + * + * @param int $deptID * @access public * @return void */ @@ -47,7 +47,7 @@ class dept extends control /** * Update the departments order. - * + * * @access public * @return void */ @@ -62,7 +62,7 @@ class dept extends control /** * Manage childs. - * + * * @access public * @return void */ @@ -70,15 +70,16 @@ class dept extends control { if(!empty($_POST)) { - $this->dept->manageChild($_POST['parentDeptID'], $_POST['depts']); + $deptIDList = $this->dept->manageChild($_POST['parentDeptID'], $_POST['depts']); + if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $deptIDList)); die(js::reload('parent')); } } /** - * Edit dept. - * - * @param int $deptID + * Edit dept. + * + * @param int $deptID * @access public * @return void */ @@ -107,8 +108,8 @@ class dept extends control /** * Delete a department. - * - * @param int $deptID + * + * @param int $deptID * @param string $confirm yes|no * @access public * @return void @@ -133,10 +134,10 @@ class dept extends control } /** - * Ajax get users - * - * @param int $dept - * @param string $user + * Ajax get users + * + * @param int $dept + * @param string $user * @access public * @return void */ diff --git a/module/dept/model.php b/module/dept/model.php index 038f2549c0..29a65424ed 100644 --- a/module/dept/model.php +++ b/module/dept/model.php @@ -318,7 +318,7 @@ class deptModel extends model * @param int $parentDeptID * @param string $childs * @access public - * @return void + * @return array */ public function manageChild($parentDeptID, $childs) { @@ -335,18 +335,21 @@ class deptModel extends model } $i = 1; + $deptIDList = array(); foreach($childs as $deptID => $deptName) { if(empty($deptName)) continue; if(is_numeric($deptID)) { + $dept = new stdclass(); $dept->name = strip_tags($deptName); $dept->parent = $parentDeptID; $dept->grade = $grade; $dept->order = $this->post->maxOrder + $i * 10; $this->dao->insert(TABLE_DEPT)->data($dept)->exec(); - $deptID = $this->dao->lastInsertID(); - $childPath = $parentPath . "$deptID,"; + $deptID = $this->dao->lastInsertID(); + $deptIDList[] = $deptID; + $childPath = $parentPath . "$deptID,"; $this->dao->update(TABLE_DEPT)->set('path')->eq($childPath)->where('id')->eq($deptID)->exec(); $i++; } @@ -356,6 +359,8 @@ class deptModel extends model $this->dao->update(TABLE_DEPT)->set('name')->eq(strip_tags($deptName))->where('id')->eq($deptID)->exec(); } } + + return $deptIDList; } /** diff --git a/module/doc/control.php b/module/doc/control.php index fa5403fa82..9e86e6fd5e 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -142,6 +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)); die(js::locate($this->createLink('doc', 'objectLibs', "type=$objectType&objectID=$objectID&libID=$libID"), 'parent.parent')); } else @@ -288,6 +289,7 @@ class doc extends control 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)); $objectID = zget($lib, $lib->type, ''); $params = "type={$lib->type}&objectID=$objectID&libID={$lib->id}&docID=" . $docResult['id']; $link = $this->createLink('doc', 'objectLibs', $params); diff --git a/module/entry/control.php b/module/entry/control.php index 225c1fe48a..e5055a82c0 100644 --- a/module/entry/control.php +++ b/module/entry/control.php @@ -5,19 +5,19 @@ * @copyright Copyright 2009-2017 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com) * @license ZPL (http://zpl.pub/page/zplv12.html) * @author Gang Liu - * @package entry + * @package entry * @version $Id$ * @link http://www.zentao.net */ class entry extends control { /** - * Browse entries. - * - * @param string $orderBy - * @param int $recTotal - * @param int $recPerPage - * @param int $pageID + * Browse entries. + * + * @param string $orderBy + * @param int $recTotal + * @param int $recPerPage + * @param int $pageID * @access public * @return void */ @@ -36,8 +36,8 @@ class entry extends control } /** - * Create an entry. - * + * Create an entry. + * * @access public * @return void */ @@ -49,6 +49,7 @@ class entry extends control if(dao::isError()) $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'))); } @@ -61,9 +62,9 @@ class entry extends control } /** - * Edit an entry. - * - * @param int $id + * Edit an entry. + * + * @param int $id * @access public * @return void */ @@ -93,9 +94,9 @@ class entry extends control } /** - * Delete an entry. - * - * @param int $id + * Delete an entry. + * + * @param int $id * @access public * @return void */ @@ -108,13 +109,13 @@ class entry extends control } /** - * Browse logs of an entry. - * - * @param int $id - * @param string $orderBy - * @param int $recTotal - * @param int $recPerPage - * @param int $pageID + * Browse logs of an entry. + * + * @param int $id + * @param string $orderBy + * @param int $recTotal + * @param int $recPerPage + * @param int $pageID * @access public * @return void */ diff --git a/module/execution/control.php b/module/execution/control.php index b405dfdaa6..73d5d7214b 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1287,6 +1287,8 @@ class execution extends control $this->executeHooks($executionID); + if($this->viewType == 'json') $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")));