From 15d92fd41671ec99914d545f6f2c1831eaa34164 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 10 May 2013 15:56:35 +0000 Subject: [PATCH] implementation for type "notify" --- .../inc/class.preferences_settings.inc.php | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/preferences/inc/class.preferences_settings.inc.php b/preferences/inc/class.preferences_settings.inc.php index c54eff52bd..0f47441a06 100644 --- a/preferences/inc/class.preferences_settings.inc.php +++ b/preferences/inc/class.preferences_settings.inc.php @@ -192,7 +192,7 @@ class preferences_settings } } break; - case 'Array': // notifies + case 'Array': // notify $value = $GLOBALS['egw']->preferences->lang_notify($value, $types[$var], True); break; } @@ -291,9 +291,23 @@ class preferences_settings continue 2; case 'notify': - // ToDo: implementation ... - error_log(__METHOD__."('$appname', '$type') NOT implemented settings type '$old_type'!"); - // handle as textarea for now + $vars = $GLOBALS['egw']->preferences->vars; + if (is_array($setting['values'])) $vars += $setting['values']; + $GLOBALS['egw']->preferences->{$attribute}[$appname][$setting['name']] = + $GLOBALS['egw']->preferences->lang_notify($GLOBALS['egw']->preferences->{$attribute}[$appname][$setting['name']], $vars); + $types[$setting['name']] = $vars; // store vars for re-translation, instead type "notify" + if ($setting['help'] && !$setting['no_lang']) + { + $setting['help'] = lang($setting['help']); + } + $setting['help'] .= '

'.lang('Substitutions and their meanings:').''; + foreach($vars as $var => $var_help) + { + $lname = ($lname = lang($var)) == $var.'*' ? $var : $lname; + $setting['help'] .= "
\n".'$$'.$lname.'$$: '.$var_help; + } + $setting['help'] .= "

\n"; + // handle as textarea case 'textarea': $setting['type'] = is_a($tpl, 'etemplate_old') ? 'textarea' : 'textbox'; $tpl->setElementAttribute($tab.'['.$setting['name'].']', 'multiline', 'true'); @@ -327,7 +341,7 @@ class preferences_settings // move values/options to sel_options array if (isset($setting['values']) && is_array($setting['values'])) { - if ($old_type != 'multiselect') + if ($old_type != 'multiselect' && $old_type != 'notify') { switch($type) { @@ -368,7 +382,7 @@ class preferences_settings 'name' => $setting['name'], 'type' => $setting['type'], 'label' => preg_replace('||i', "\n", $setting['label']), - 'help' => $setting['help'], // is html + 'help' => lang($setting['help']), // is html 'size' => $setting['size'], // old eT 'default' => !empty($default) ? lang('Default').': '.$default : null, 'onchange' => $setting['onchange'],