Finish task#3247 管理员可以自定义所有人用的列表的默认布局。,cost:5 left:0

This commit is contained in:
wangyidong
2017-10-18 16:53:33 +08:00
parent 5f0c90a923
commit fe16db7484
7 changed files with 67 additions and 28 deletions
+18 -11
View File
@@ -33,6 +33,7 @@ class datatable extends control
if(!empty($_POST))
{
$account = $this->app->user->account;
if($this->post->global) $account = 'system';
if($account == 'guest') $this->send(array('result' => 'fail', 'target' => $target, 'message' => 'guest.'));
$name = $account . '.datatable.' . $this->post->target . '.' . $this->post->name;
@@ -52,11 +53,9 @@ class datatable extends control
*/
public function ajaxCustom($module, $method)
{
$account = $this->app->user->account;
$target = $module . ucfirst($method);
$mode = isset($this->config->datatable->$target->mode) ? $this->config->datatable->$target->mode : 'table';
$key = $mode == 'datatable' ? 'cols' : 'tablecols';
$name = "owner=$account&module=datatable&section=$target&key=$key";
$target = $module . ucfirst($method);
$mode = isset($this->config->datatable->$target->mode) ? $this->config->datatable->$target->mode : 'table';
$key = $mode == 'datatable' ? 'cols' : 'tablecols';
if($module == 'testtask')
{
@@ -72,12 +71,19 @@ class datatable extends control
$this->view->module = $module;
$this->view->method = $method;
$this->view->mode = $mode;
$module = zget($this->config->datatable->moduleAlias, $module, $module);
$setting = '';
if(isset($this->config->datatable->$target->$key)) $setting = $this->config->datatable->$target->$key;
if(empty($setting))
{
$this->loadModel($module);
$setting = json_encode($this->config->$module->datatable->defaultField);
}
$module = zget($this->config->datatable->moduleAlias, $module, $module);
$this->view->cols = $this->datatable->getFieldList($module);
$this->view->setting = $this->loadModel('setting')->getItem($name);
if(empty($this->view->setting)) $this->view->setting = json_encode($this->config->$module->datatable->defaultField);
$this->view->setting = $setting;
$this->display();
}
@@ -90,14 +96,15 @@ class datatable extends control
* @access public
* @return void
*/
public function ajaxReset($module, $method, $confirm = 'no')
public function ajaxReset($module, $method, $system = 0, $confirm = 'no')
{
if($confirm == 'no') die(js::confirm($this->lang->datatable->confirmReset, inlink('ajaxReset', "module=$module&method=$method&confirm=yes")));
if($confirm == 'no') die(js::confirm($this->lang->datatable->confirmReset, inlink('ajaxReset', "module=$module&method=$method&system=$system&confirm=yes")));
$account = $this->app->user->account;
$target = $module . ucfirst($method);
$mode = isset($this->config->datatable->$target->mode) ? $this->config->datatable->$target->mode : 'table';
$key = $mode == 'datatable' ? 'cols' : 'tablecols';
if($system) $account = 'system';
$this->loadModel('setting')->deleteItems("owner=$account&module=datatable&section=$target&key=$key");
die(js::reload('parent'));