diff --git a/module/common/view/datatable.fix.html.php b/module/common/view/datatable.fix.html.php
index 31d1f0b871..0d9f8abd03 100644
--- a/module/common/view/datatable.fix.html.php
+++ b/module/common/view/datatable.fix.html.php
@@ -9,17 +9,19 @@
diff --git a/module/common/view/datatable.html.php b/module/common/view/datatable.html.php
index 8ab39192b0..a0b330d100 100644
--- a/module/common/view/datatable.html.php
+++ b/module/common/view/datatable.html.php
@@ -84,16 +84,17 @@ $(document).ready(function()
}
});
- window.saveDatatableConfig = function(name, value, reload)
+ window.saveDatatableConfig = function(name, value, reload, global)
{
+ if('app->user->account?>' == 'guest') return;
var datatableId = '';
if(typeof value === 'object') value = JSON.stringify(value);
- if('app->user->account?>' == 'guest') return;
+ if(typeof global === 'undefined') global = 0;
$.ajax(
{
type: "POST",
dataType: 'json',
- data: {target: datatableId, name: name, value: value},
+ data: {target: datatableId, name: name, value: value, global: global},
success:function(e){if(reload) window.location.reload();},
url: 'createLink('datatable', 'ajaxSave')?>'
});
diff --git a/module/datatable/control.php b/module/datatable/control.php
index dd64f58d75..02391e4667 100644
--- a/module/datatable/control.php
+++ b/module/datatable/control.php
@@ -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§ion=$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§ion=$target&key=$key");
die(js::reload('parent'));
diff --git a/module/datatable/lang/en.php b/module/datatable/lang/en.php
index e53e67ac3e..099a89c79e 100644
--- a/module/datatable/lang/en.php
+++ b/module/datatable/lang/en.php
@@ -4,12 +4,16 @@ $lang->datatable->common = 'Data Table';
$lang->datatable->width = 'Width';
$lang->datatable->show = 'Show';
$lang->datatable->hide = 'Hide';
+$lang->datatable->reset = 'Reset';
$lang->datatable->custom = 'Custom Columns';
$lang->datatable->customTip = 'Check Columns to Display';
$lang->datatable->switchToTable = 'Switch to Table';
$lang->datatable->switchToDatatable = 'Switch to Datatable';
$lang->datatable->required = 'Required';
+$lang->datatable->confirmReset = 'Do you want to restore the default settings?';
+$lang->datatable->setGlobal = 'Global';
+$lang->datatable->resetGlobal = 'Reset Global Default';
$lang->datatable->branch = 'Branch';
$lang->datatable->platform = 'Platform';
diff --git a/module/datatable/lang/zh-cn.php b/module/datatable/lang/zh-cn.php
index 94b051d384..613343395e 100644
--- a/module/datatable/lang/zh-cn.php
+++ b/module/datatable/lang/zh-cn.php
@@ -12,6 +12,8 @@ $lang->datatable->switchToTable = '切换到简单表格';
$lang->datatable->switchToDatatable = '切换到高级表格';
$lang->datatable->required = '必选';
$lang->datatable->confirmReset = '是否恢复默认设置?';
+$lang->datatable->setGlobal = '全局';
+$lang->datatable->resetGlobal = '全局恢复默认';
$lang->datatable->branch = '分支';
$lang->datatable->platform = '平台';
diff --git a/module/datatable/model.php b/module/datatable/model.php
index 35d9bf5b63..28d2e68fbf 100644
--- a/module/datatable/model.php
+++ b/module/datatable/model.php
@@ -49,9 +49,12 @@ class datatableModel extends model
{
$datatableId = $module . ucfirst($this->app->getMethodName());
+ $mode = isset($this->config->datatable->$datatableId->mode) ? $this->config->datatable->$datatableId->mode : 'table';
+ $key = $mode == 'datatable' ? 'cols' : 'tablecols';
+
$module = zget($this->config->datatable->moduleAlias, $module, $module);
if(!isset($this->config->$module)) $this->loadModel($module);
- if(isset($this->config->datatable->$datatableId->cols)) $setting = json_decode($this->config->datatable->$datatableId->cols);
+ if(isset($this->config->datatable->$datatableId->$key)) $setting = json_decode($this->config->datatable->$datatableId->$key);
$fieldList = $this->getFieldList($module);
if(empty($setting))
@@ -120,7 +123,7 @@ class datatableModel extends model
$id = $col->id;
if($col->show)
{
- echo "
";
+ echo " | ";
if($id == 'actions')
{
echo $this->lang->actions;
diff --git a/module/datatable/view/ajaxcustom.html.php b/module/datatable/view/ajaxcustom.html.php
index 945fa25946..ea1c2686d3 100644
--- a/module/datatable/view/ajaxcustom.html.php
+++ b/module/datatable/view/ajaxcustom.html.php
@@ -12,7 +12,7 @@
?>
|