Include lettersearch when forcing preferences

This commit is contained in:
Nathan Gray 2015-03-16 22:28:18 +00:00
parent 9e1625c983
commit 984bbf4d44
2 changed files with 12 additions and 1 deletions

View File

@ -1056,19 +1056,25 @@ class etemplate_widget_nextmatch extends etemplate_widget
{ {
$GLOBALS['egw']->preferences->delete($app,$pref_name,'forced'); $GLOBALS['egw']->preferences->delete($app,$pref_name,'forced');
$GLOBALS['egw']->preferences->delete($app,$refresh_pref_name,'forced'); $GLOBALS['egw']->preferences->delete($app,$refresh_pref_name,'forced');
$GLOBALS['egw']->preferences->delete($app,$pref_name.'-size','forced');
$GLOBALS['egw']->preferences->delete($app,$pref_name.'-lettersearch','forced');
$GLOBALS['egw']->preferences->save_repository(true,'forced'); $GLOBALS['egw']->preferences->save_repository(true,'forced');
} }
// Set columns + refresh as default for all users // Set columns + refresh as default for all users
// Columns included in submit, preference might not be updated yet // Columns included in submit, preference might not be updated yet
$cols = $value['selectcols']; $cols = $value['selectcols'];
$GLOBALS['egw']->preferences->read(); $GLOBALS['egw']->preferences->read_repository(true);
$GLOBALS['egw']->preferences->add($app,$pref_name,is_array($cols) ? implode(',',$cols) : $cols, $pref_level); $GLOBALS['egw']->preferences->add($app,$pref_name,is_array($cols) ? implode(',',$cols) : $cols, $pref_level);
// Autorefresh // Autorefresh
$refresh = $value['nm_autorefresh']; $refresh = $value['nm_autorefresh'];
$GLOBALS['egw']->preferences->add($app,$refresh_pref_name,(int)$refresh,$pref_level); $GLOBALS['egw']->preferences->add($app,$refresh_pref_name,(int)$refresh,$pref_level);
// Lettersearch
$lettersearch = is_array($cols) && in_array('lettersearch', $cols);
$GLOBALS['egw']->preferences->add($app,$pref_name.'-lettersearch',(int)$lettersearch,$pref_level);
$GLOBALS['egw']->preferences->save_repository(true,$pref_level); $GLOBALS['egw']->preferences->save_repository(true,$pref_level);
$GLOBALS['egw']->preferences->read(true); $GLOBALS['egw']->preferences->read(true);
@ -1077,6 +1083,7 @@ class etemplate_widget_nextmatch extends etemplate_widget
// Clear column + refresh preference so users go back to default // Clear column + refresh preference so users go back to default
$GLOBALS['egw']->preferences->delete_preference($app,$pref_name); $GLOBALS['egw']->preferences->delete_preference($app,$pref_name);
$GLOBALS['egw']->preferences->delete_preference($app,$pref_name.'-size'); $GLOBALS['egw']->preferences->delete_preference($app,$pref_name.'-size');
$GLOBALS['egw']->preferences->delete_preference($app,$pref_name.'-lettersearch');
$GLOBALS['egw']->preferences->delete_preference($app,$refresh_pref_name); $GLOBALS['egw']->preferences->delete_preference($app,$refresh_pref_name);
} }
} }

View File

@ -1379,6 +1379,10 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin
// Set default or clear forced? // Set default or clear forced?
if(defaultCheck.get_value()) if(defaultCheck.get_value())
{ {
if(show_letters)
{
self.activeFilters.selectcols.push('lettersearch');
}
self.getInstanceManager().submit(); self.getInstanceManager().submit();
} }
self.selectPopup = null; self.selectPopup = null;