- changing column selection preference now works if 'nextmatch-' prefix is included in the columnselection_pref setting

- change column selection popup to reload every time it opens, just in case something changes in the columns
This commit is contained in:
Nathan Gray 2014-06-04 18:37:58 +00:00
parent 001eab9159
commit 2e09cf1ab1
2 changed files with 25 additions and 5 deletions

View File

@ -50,7 +50,7 @@
* 'total' => // O the total number of entries
* 'sel_options' => // O additional or changed sel_options set by the callback and merged into $tmpl->sel_options
* 'no_columnselection' => // I turns off the columnselection completly, turned on by default
* 'columnselection-pref' => // I name of the preference (plus 'nextmatch-' prefix), default = template-name
* 'columnselection_pref' => // I name of the preference (plus 'nextmatch-' prefix), default = template-name
* 'default_cols' => // I columns to use if there's no user or default pref (! as first char uses all but the named columns), default all columns
* 'options-selectcols' => // I array with name/label pairs for the column-selection, this gets autodetected by default. A name => false suppresses a column completly.
* 'return' => // IO allows to return something from the get_rows function if $query is a var-param!

View File

@ -684,11 +684,22 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput],
// Set preference name so changes are saved
this.options.settings.columnselection_pref = this.options.template;
}
var app = '';
if(this.options.settings.columnselection_pref) {
var pref = {};
var list = et2_csvSplit(this.options.settings.columnselection_pref, 2, ".");
var app = list[0];
// 'nextmatch-' prefix is there in preference name, but not in setting, so add it in
var pref = egw.preference("nextmatch-"+this.options.settings.columnselection_pref, list[0]);
if(this.options.settings.columnselection_pref.indexOf('nextmatch') == 0)
{
app = list[0].substring('nextmatch'.length+1);
pref = egw.preference(this.options.settings.columnselection_pref, app);
}
else
{
app = list[0];
// 'nextmatch-' prefix is there in preference name, but not in setting, so add it in
pref = egw.preference("nextmatch-"+this.options.settings.columnselection_pref, app);
}
if(pref)
{
negated = (pref[0] == "!");
@ -710,7 +721,14 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput],
var size = {};
if(this.options.settings.columnselection_pref && app)
{
size = this.egw().preference("nextmatch-"+this.options.settings.columnselection_pref+"-size", app);
var size_pref = this.options.settings.columnselection_pref +"-size";
// If columnselection pref is missing prefix, add it in
if(size_pref.indexOf('nextmatch') == -1)
{
size_pref = 'nextmatch-'+size_pref;
}
size = this.egw().preference(size_pref, app);
}
if(!size) size = {};
return {
@ -1272,12 +1290,14 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput],
{
self.getInstanceManager().submit();
}
self.selectPopup = null;
};
var cancelButton = et2_createWidget("buttononly", {}, this);
cancelButton.set_label(this.egw().lang("cancel"));
cancelButton.onclick = function() {
self.selectPopup.toggle();
self.selectPopup = null;
};
this.selectPopup = jQuery(document.createElement("div"))