mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 17:18:54 +01:00
Save as default checkbox - still a problem getting value on server
This commit is contained in:
parent
87ac5880db
commit
dfe5d21ea4
@ -76,6 +76,11 @@ class etemplate_widget_nextmatch extends etemplate_widget
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legacy options
|
||||||
|
*/
|
||||||
|
protected $legacy_options = 'template';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of rows to send initially
|
* Number of rows to send initially
|
||||||
*/
|
*/
|
||||||
@ -578,20 +583,20 @@ class etemplate_widget_nextmatch extends etemplate_widget
|
|||||||
{
|
{
|
||||||
$form_name = self::form_name($cname, $this->id);
|
$form_name = self::form_name($cname, $this->id);
|
||||||
$value = self::get_array($content, $form_name);
|
$value = self::get_array($content, $form_name);
|
||||||
error_log("nextmatch value: " . array2string($value));
|
|
||||||
|
|
||||||
// Save current column settings as default (admins only)
|
// Save current column settings as default (admins only)
|
||||||
if($value['as_default'])
|
if($value['as_default'])
|
||||||
{
|
{
|
||||||
unset($value['as_default']);
|
unset($value['as_default']);
|
||||||
if($GLOBALS['egw_info']['user']['apps']['admin'])
|
list($app) = explode('.',$this->attrs['template']);
|
||||||
|
if($GLOBALS['egw_info']['user']['apps']['admin'] && $app)
|
||||||
{
|
{
|
||||||
list($app) = explode('.',$this->template);
|
$pref_name = 'nextmatch-' . (isset($value['columnselection_pref']) ? $value['columnselection_pref'] : $this->attrs['template'].'-details');
|
||||||
$pref_name = 'nextmatch-' . (isset($this->columnselection_pref) ? $this->columnselection_pref : $this->template);
|
// Columns already saved to user's preferences, use from there
|
||||||
// Columns already saved to user's preferences
|
|
||||||
$cols = $GLOBALS['egw']->preferences->read();
|
$cols = $GLOBALS['egw']->preferences->read();
|
||||||
$cols = $cols[$pref_name];
|
$cols = $cols[$app][$pref_name];
|
||||||
$GLOBALS['egw']->preferences->add($app,$pref_name,is_array($cols) ? implode(',',$cols) : $cols,'default');
|
$GLOBALS['egw']->preferences->add($app,$pref_name,is_array($cols) ? implode(',',$cols) : $cols,'default');
|
||||||
|
|
||||||
$GLOBALS['egw']->preferences->save_repository(false,'default');
|
$GLOBALS['egw']->preferences->save_repository(false,'default');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -349,10 +349,8 @@ var et2_nextmatch = et2_DOMWidget.extend(et2_IResizeable, {
|
|||||||
/**
|
/**
|
||||||
* Take current column display settings and store them in egw.preferences
|
* Take current column display settings and store them in egw.preferences
|
||||||
* for next time
|
* for next time
|
||||||
*
|
|
||||||
* @param setDefault boolean From checkbox, for admins to set default settings
|
|
||||||
*/
|
*/
|
||||||
_updateUserPreferences: function(setDefault) {
|
_updateUserPreferences: function() {
|
||||||
var colMgr = this.dataviewContainer.getColumnMgr()
|
var colMgr = this.dataviewContainer.getColumnMgr()
|
||||||
if(!this.options.settings.columnselection_pref) {
|
if(!this.options.settings.columnselection_pref) {
|
||||||
this.options.settings.columnselection_pref = this.options.template;
|
this.options.settings.columnselection_pref = this.options.template;
|
||||||
@ -385,13 +383,6 @@ var et2_nextmatch = et2_DOMWidget.extend(et2_IResizeable, {
|
|||||||
// Save adjusted column sizes
|
// Save adjusted column sizes
|
||||||
egw.set_preference(app, "nextmatch-"+this.options.settings.columnselection_pref+"-size", colSize);
|
egw.set_preference(app, "nextmatch-"+this.options.settings.columnselection_pref+"-size", colSize);
|
||||||
|
|
||||||
// Save as default, if set
|
|
||||||
if(setDefault)
|
|
||||||
{
|
|
||||||
this.getInstanceManager().submit();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update query value, so data source can use visible columns to exclude expensive sub-queries
|
// Update query value, so data source can use visible columns to exclude expensive sub-queries
|
||||||
var oldCols = this.activeFilters.selectcols ? this.activeFilters.selectcols : [];
|
var oldCols = this.activeFilters.selectcols ? this.activeFilters.selectcols : [];
|
||||||
this.activeFilters.selectcols = colDisplay;
|
this.activeFilters.selectcols = colDisplay;
|
||||||
@ -443,7 +434,7 @@ var et2_nextmatch = et2_DOMWidget.extend(et2_IResizeable, {
|
|||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
// Register handler to update preferences when column properties are changed
|
// Register handler to update preferences when column properties are changed
|
||||||
this.dataviewContainer.onUpdateColumns = function(setDefault) { self._updateUserPreferences(setDefault);};
|
this.dataviewContainer.onUpdateColumns = function() { self._updateUserPreferences();};
|
||||||
|
|
||||||
// Register handler for column selection popup
|
// Register handler for column selection popup
|
||||||
this.dataviewContainer.selectColumnsClick = function(event) { self._selectColumnsClick(event);};
|
this.dataviewContainer.selectColumnsClick = function(event) { self._selectColumnsClick(event);};
|
||||||
@ -559,7 +550,7 @@ var et2_nextmatch = et2_DOMWidget.extend(et2_IResizeable, {
|
|||||||
var apps = egw.user('apps');
|
var apps = egw.user('apps');
|
||||||
if(apps['admin'])
|
if(apps['admin'])
|
||||||
{
|
{
|
||||||
this.selectPopup.append(defaultCheck.getDOMNode())
|
this.selectPopup.append(defaultCheck.getSurroundings().getDOMNode(defaultCheck.getDOMNode()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user