diff --git a/module/execution/js/task.js b/module/execution/js/task.js index d96b1ac4cc..20f58c4146 100644 --- a/module/execution/js/task.js +++ b/module/execution/js/task.js @@ -9,7 +9,7 @@ $(function() $td.find('a').eq(0).css('max-width', $td.width() - labelWidth - 60); }); - toggleFold('#executionTaskForm', unfoldTasks, executionID, 'project'); + toggleFold('#executionTaskForm', unfoldTasks, executionID, 'execution'); adjustTableFooter(); $('body').on('click', '#toggleFold', adjustTableFooter); diff --git a/module/misc/control.php b/module/misc/control.php index be72800419..0767ea4031 100644 --- a/module/misc/control.php +++ b/module/misc/control.php @@ -236,6 +236,53 @@ class misc extends control $captcha->build()->output(); } + /** + * Ajax set unfoldID. + * + * @param int $objectID + * @param string $objectType + * @param string $action add|delete + * @access public + * @return void + */ + public function ajaxSetUnfoldID($objectID, $objectType, $action = 'add') + { + $account = $this->app->user->account; + if($objectType == 'execution') + { + $condition = "owner={$account}&module={$objectType}§ion=task&key=unfoldTasks"; + $settingPath = $account . ".{$objectType}.task.unfoldTasks"; + } + else + { + $condition = "owner={$account}&module=product§ion=browse&key=unfoldStories"; + $settingPath = $account . ".{$objectType}.browse.unfoldStories"; + } + + $this->loadModel('setting'); + $setting = $this->setting->createDAO($this->setting->parseItemParam($condition), 'select')->fetch(); + $newUnfoldID = $this->post->newUnfoldID; + if(empty($newUnfoldID)) die(); + + $newUnfoldID = json_decode($newUnfoldID); + $unfoldIdList = $setting ? json_decode($setting->value, true) : array(); + foreach($newUnfoldID as $unfoldID) + { + unset($unfoldIdList[$objectID][$unfoldID]); + if($action == 'add') $unfoldIdList[$objectID][$unfoldID] = $unfoldID; + } + + if(empty($setting)) + { + $this->setting->setItem($settingPath, json_encode($unfoldIdList)); + } + else + { + $this->dao->update(TABLE_CONFIG)->set('value')->eq(json_encode($unfoldIdList))->where('id')->eq($setting->id)->exec(); + } + die('success'); + } + /** * Get annual remind. *