diff --git a/etemplate/inc/class.etemplate_widget_nextmatch.inc.php b/etemplate/inc/class.etemplate_widget_nextmatch.inc.php index 2fab0270da..9ac912398d 100644 --- a/etemplate/inc/class.etemplate_widget_nextmatch.inc.php +++ b/etemplate/inc/class.etemplate_widget_nextmatch.inc.php @@ -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! diff --git a/etemplate/js/et2_extension_nextmatch.js b/etemplate/js/et2_extension_nextmatch.js index 8d9e106b4e..9b735c191e 100644 --- a/etemplate/js/et2_extension_nextmatch.js +++ b/etemplate/js/et2_extension_nextmatch.js @@ -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"))