}
/**
- * Code to run on init when viewing prefs for this application.
+ * Populate dynamically-generated preference values.
*
* @param Horde_Core_Prefs_Ui $ui The UI object.
*/
- public function prefsInit($ui)
+ public function prefsEnum($ui)
{
global $conf, $prefs;
public $version = '1.0.1';
/**
- * Code to run on init when viewing prefs for this application.
+ * Populate dynamically-generated preference values.
*
* @param Horde_Core_Prefs_Ui $ui The UI object.
*/
- public function prefsInit($ui)
+ public function prefsEnum($ui)
{
switch ($ui->group) {
case 'share':
/* Load preferences. */
$this->_loadPrefs($this->app);
+
+ /* Populate enums. */
+ if ($this->group &&
+ $GLOBALS['registry']->hasAppMethod($this->app, 'prefsEnum') &&
+ $this->groupIsEditable($this->group)) {
+ $GLOBALS['registry']->callAppMethod($this->app, 'prefsEnum', array('args' => array($this)));
+ }
}
/**
break;
case 'enum':
- if (isset($this->prefs[$pref]['enum'][$this->vars->$pref])) {
+ $enum = isset($this->override[$pref])
+ ? $this->override[$pref]
+ : $this->prefs[$pref]['enum'];
+ if (isset($enum[$this->vars->$pref])) {
$updated |= $save->setValue($pref, $this->vars->$pref);
} else {
$notification->push(_("An illegal value was specified."), 'horde.error');
$set = array();
if (is_array($this->vars->$pref)) {
+ $enum = isset($this->override[$pref])
+ ? $this->override[$pref]
+ : $this->prefs[$pref]['enum'];
+
foreach ($this->vars->$pref as $val) {
- if (isset($this->prefs[$pref]['enum'][$val])) {
+ if (isset($enum[$val])) {
$set[] = $val;
} else {
$notification->push(_("An illegal value was specified."), 'horde.error');
// public function changeLanguage() {}
/**
+ * Populate dynamically-generated preference values.
+ *
+ * @param Horde_Core_Prefs_Ui $ui The UI object.
+ */
+ // public function prefsEnum($ui) {}
+
+ /**
* Code to run on init when viewing prefs for this application.
*
* @param Horde_Core_Prefs_Ui $ui The UI object.
}
/**
+ * Populate dynamically-generated preference values.
+ *
+ * @param Horde_Core_Prefs_Ui $ui The UI object.
+ */
+ public function prefsEnum($ui)
+ {
+ $GLOBALS['injector']->getInstance('Horde_Prefs_Ui')->prefsEnum($ui);
+ }
+
+ /**
* Code to run on init when viewing prefs for this application.
*
* @param Horde_Core_Prefs_Ui $ui The UI object.
class Horde_Prefs_Ui
{
/**
- * Code to run on init when viewing prefs for this application.
+ * Populate dynamically-generated preference values.
*
* @param Horde_Core_Prefs_Ui $ui The UI object.
*/
- public function prefsInit($ui)
+ public function prefsEnum($ui)
{
- global $conf, $prefs, $registry;
+ global $prefs, $registry;
switch ($ui->group) {
case 'display':
array_unshift($ui->override['timezone'], _("Default"));
}
break;
+ }
+ }
+
+ /**
+ * Code to run on init when viewing prefs for this application.
+ *
+ * @param Horde_Core_Prefs_Ui $ui The UI object.
+ */
+ public function prefsInit($ui)
+ {
+ global $conf;
+ switch ($ui->group) {
case 'remote':
Horde::addScriptFile('rpcprefs.js', 'horde');
$ui->nobuttons = true;
* IMP_Prefs_Ui so it doesn't have to be loaded on every page load. */
/**
+ * Populate dynamically-generated preference values.
+ *
+ * @param Horde_Core_Prefs_Ui $ui The UI object.
+ */
+ public function prefsEnum($ui)
+ {
+ $GLOBALS['injector']->getInstance('IMP_Prefs_Ui')->prefsEnum($ui);
+ }
+
+ /**
* Code to run on init when viewing prefs for this application.
*
* @param Horde_Core_Prefs_Ui $ui The UI object.
class IMP_Prefs_Ui
{
/**
+ * Populate dynamically-generated preference values.
+ *
+ * @param Horde_Core_Prefs_Ui $ui The UI object.
+ */
+ public function prefsEnum($ui)
+ {
+ global $prefs, $registry;
+
+ switch ($ui->group) {
+ case 'addressbooks':
+ if (!$prefs->isLocked('add_source')) {
+ try {
+ $sources = array();
+ foreach ($registry->call('contacts/sources', array(true)) as $source => $name) {
+ $sources[$source] = $name;
+ }
+ $ui->override['add_source'] = $sources;
+ } catch (Horde_Exception $e) {
+ $ui->suppress[] = 'add_source';
+ }
+ }
+ break;
+
+ case 'delmove':
+ if (isset($_SESSION['imp']['protocol']) &&
+ ($_SESSION['imp']['protocol'] == 'pop')) {
+ $tmp = $ui->prefs['delete_spam_after_report']['enum'];
+ unset($tmp[2]);
+ $ui->override['delete_spam_after_report'] = $tmp;
+ }
+ break;
+ }
+ }
+
+ /**
* Code to run on init when viewing prefs for this application.
*
* @param Horde_Core_Prefs_Ui $ui The UI object.
if (!$prefs->isLocked('sourceselect')) {
Horde_Core_Prefs_Ui_Widgets::addressbooksInit();
}
-
- if (!$prefs->isLocked('add_source')) {
- try {
- $sources = array();
- foreach ($registry->call('contacts/sources', array(true)) as $source => $name) {
- $sources[$source] = $name;
- }
- $ui->override['add_source'] = $sources;
- } catch (Horde_Exception $e) {
- $ui->suppress[] = 'add_source';
- }
- }
break;
case 'compose':
$ui->suppress[] = 'use_trash';
$ui->suppress[] = 'trashselect';
$ui->suppress[] = 'empty_trash_menu';
-
- $tmp = $ui->prefs['delete_spam_after_report']['enum'];
- unset($tmp[2]);
- $ui->override['delete_spam_after_report'] = $tmp;
} elseif ($prefs->isLocked('use_trash') ||
!$prefs->getValue('use_trash')) {
$ui->suppress[] = 'trashselect';
}
/**
- * Code to run on init when viewing prefs for this application.
+ * Populate dynamically-generated preference values.
*
* @param Horde_Core_Prefs_Ui $ui The UI object.
*/
- public function prefsInit($ui)
+ public function prefsEnum($ui)
{
global $conf, $prefs, $registry;
switch ($ui->group) {
- case 'addressbooks':
- if (!$prefs->isLocked('sourceselect')) {
- Horde_Core_Prefs_Ui_Widgets::addressbooksInit();
- }
- break;
-
case 'freebusy':
if (!$prefs->isLocked('fb_cals')) {
$fb_cals = Kronolith::ListCalendars();
}
break;
- case 'notification':
- if (empty($conf['alarms']['driver']) ||
- $prefs->isLocked('event_alarms') ||
- $prefs->isLocked('event_alarms_select')) {
- $ui->suppress[]= 'event_alarms';
- } else {
- Horde_Core_Prefs_Ui_Widgets::alarminit();
- }
- break;
-
case 'share':
if (!$prefs->isLocked('default_share')) {
$all_shares = Kronolith::listCalendars();
}
break;
}
+ }
+
+ /**
+ * Code to run on init when viewing prefs for this application.
+ *
+ * @param Horde_Core_Prefs_Ui $ui The UI object.
+ */
+ public function prefsInit($ui)
+ {
+ global $conf, $prefs, $registry;
+
+ switch ($ui->group) {
+ case 'addressbooks':
+ if (!$prefs->isLocked('sourceselect')) {
+ Horde_Core_Prefs_Ui_Widgets::addressbooksInit();
+ }
+ break;
+
+ case 'notification':
+ if (empty($conf['alarms']['driver']) ||
+ $prefs->isLocked('event_alarms') ||
+ $prefs->isLocked('event_alarms_select')) {
+ $ui->suppress[]= 'event_alarms';
+ } else {
+ Horde_Core_Prefs_Ui_Widgets::alarminit();
+ }
+ break;
+ }
/* Suppress prefGroups display. */
if (!$registry->hasMethod('contacts/sources')) {
*/
protected function _init()
{
- // Set the timezone variable.
- Horde_Nls::setTimeZone();
+ // Set the timezone variable.
+ Horde_Nls::setTimeZone();
- // Create a share instance.
- $GLOBALS['mnemo_shares'] = Horde_Share::singleton($GLOBALS['registry']->getApp());
+ // Create a share instance.
+ $GLOBALS['mnemo_shares'] = Horde_Share::singleton($GLOBALS['registry']->getApp());
- Mnemo::initialize();
+ Mnemo::initialize();
}
/**
- * Code to run on init when viewing prefs for this application.
+ * Populate dynamically-generated preference values.
*
* @param Horde_Core_Prefs_Ui $ui The UI object.
*/
- public function prefsInit($ui)
+ public function prefsEnum($ui)
{
- global $conf, $prefs, $registry;
-
switch ($ui->group) {
case 'share':
- if (!$prefs->isLocked('default_notepad')) {
+ if (!$GLOBALS['prefs']->isLocked('default_notepad')) {
$notepads = array();
foreach (Mnemo::listNotepads() as $key => $val) {
$notepads[htmlspecialchars($key)] = htmlspecialchars($val->get('name'));
}
/**
- * Code to run on init when viewing prefs for this application.
+ * Populate dynamically-generated preference values.
*
* @param Horde_Core_Prefs_Ui $ui The UI object.
*/
- public function prefsInit($ui)
+ public function prefsEnum($ui)
{
- global $conf, $prefs, $registry;
+ global $prefs, $registry;
switch ($ui->group) {
- case 'notification':
- if (empty($conf['alarms']['driver']) ||
- $prefs->isLocked('task_alarms') ||
- $prefs->isLocked('task_alarms_select')) {
- $ui->suppress[] = 'task_alarms';
- }
- break;
-
case 'share':
if (!$prefs->isLocked('default_tasklist')) {
$all_tasklists = Nag::listTasklists();
break;
}
- /* Hide appropriate prefGroups. */
$show_external = array();
if ($registry->hasMethod('getListTypes', 'whups')) {
$show_external['whups'] = $registry->get('name', 'whups');
$ui->override['show_external'] = $show_external;
} else {
$ui->suppress[] = 'show_external';
- $ui->suppresGroups[] = 'external';
+ $ui->suppressGroups[] = 'external';
+ }
+ }
+
+ /**
+ * Code to run on init when viewing prefs for this application.
+ *
+ * @param Horde_Core_Prefs_Ui $ui The UI object.
+ */
+ public function prefsInit($ui)
+ {
+ global $conf, $prefs;
+
+ switch ($ui->group) {
+ case 'notification':
+ if (empty($conf['alarms']['driver']) ||
+ $prefs->isLocked('task_alarms') ||
+ $prefs->isLocked('task_alarms_select')) {
+ $ui->suppress[] = 'task_alarms';
+ }
+ break;
}
}
}
/**
- * Code to run on init when viewing prefs for this application.
+ * Populate dynamically-generated preference values.
*
* @param Horde_Core_Prefs_Ui $ui The UI object.
*/
- public function prefsInit($ui)
+ public function prefsEnum($ui)
{
global $prefs;
switch ($ui->group) {
case 'addressbooks':
- Horde_Core_Prefs_Ui_Widgets::sourceInit();
-
if (!$prefs->isLocked('default_dir')) {
$out = array();
foreach ($GLOBALS['cfgSources'] as $key => $info) {
}
$ui->override['sync_books'] = $out;
break;
+ }
+ }
+
+ /**
+ * Code to run on init when viewing prefs for this application.
+ *
+ * @param Horde_Core_Prefs_Ui $ui The UI object.
+ */
+ public function prefsInit($ui)
+ {
+ global $prefs;
+
+ switch ($ui->group) {
+ case 'addressbooks':
+ Horde_Core_Prefs_Ui_Widgets::sourceInit();
+ break;
case 'columns':
Horde::addScriptFile('effects.js', 'horde');