* revert ajaxSetUnfoldID.

This commit is contained in:
王怡栋
2021-11-11 16:19:56 +08:00
parent 2c296a129b
commit 1f8bb88e8c
2 changed files with 48 additions and 1 deletions
+1 -1
View File
@@ -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);
+47
View File
@@ -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}&section=task&key=unfoldTasks";
$settingPath = $account . ".{$objectType}.task.unfoldTasks";
}
else
{
$condition = "owner={$account}&module=product&section=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.
*