}
/**
- * TODO
- */
- public function prefsHandle($item, $updated)
- {
- switch ($item) {
- case 'default_category_select':
- $default_category = Horde_Util::getFormData('default_category_select');
- if (!is_null($default_category)) {
- $GLOBALS['prefs']->setValue('default_category', $default_category);
- return true;
- }
- break;
-
- case 'default_gallerystyle_select':
- $default_style = Horde_Util::getFormData('default_gallerystyle_select');
- if (!is_null($default_style)) {
- $GLOBALS['prefs']->setValue('default_gallerystyle', $default_style);
- return true;
- }
- break;
- }
-
- return $updated;
- }
-
- /**
- * Generate the menu to use on the prefs page.
- *
- * @return Horde_Menu A Horde_Menu object.
- */
- public function prefsMenu()
- {
- return Ansel::getMenu();
- }
-
- /**
* Browse through Ansel's gallery tree.
*
* @param string $path The level of the tree to browse.
class Ansel_Application extends Horde_Registry_Application
{
public $version = 'H4 (2.0-git)';
+
+ /**
+ * Special preferences handling on update.
+ *
+ * @param string $item The preference name.
+ * @param boolean $updated Set to true if preference was updated.
+ *
+ * @return boolean True if preference was updated.
+ */
+ public function prefsHandle($item, $updated)
+ {
+ switch ($item) {
+ case 'default_category_select':
+ $default_category = Horde_Util::getFormData('default_category_select');
+ if (!is_null($default_category)) {
+ $GLOBALS['prefs']->setValue('default_category', $default_category);
+ return true;
+ }
+ break;
+
+ case 'default_gallerystyle_select':
+ $default_style = Horde_Util::getFormData('default_gallerystyle_select');
+ if (!is_null($default_style)) {
+ $GLOBALS['prefs']->setValue('default_gallerystyle', $default_style);
+ return true;
+ }
+ break;
+ }
+
+ return $updated;
+ }
+
+ /**
+ * Generate the menu to use on the prefs page.
+ *
+ * @return Horde_Menu A Horde_Menu object.
+ */
+ public function prefsMenu()
+ {
+ return Ansel::getMenu();
+ }
+
}
return $perms;
}
- /**
- * Generate the menu to use on the prefs page.
- *
- * @return Horde_Menu A Horde_Menu object.
- */
- public function prefsMenu()
- {
- return Chora::getMenu();
- }
-
}
* @var string
*/
public $version = 'H4 (3.0-git)';
+
+ /**
+ * Generate the menu to use on the prefs page.
+ *
+ * @return Horde_Menu A Horde_Menu object.
+ */
+ public function prefsMenu()
+ {
+ return Chora::getMenu();
+ }
+
}
+++ /dev/null
-<?php
-class Crumb_Api extends Horde_Registry_Api
-{
- /**
- * Generate the menu to use on the prefs page.
- *
- * @return Horde_Menu A Horde_Menu object.
- */
- public function prefsMenu()
- {
- return Crumb::getMenu();
- }
-
-}
class Crumb_Application extends Horde_Registry_Application
{
public $version = 'H4 (0.1-git)';
+
+ /**
+ * Generate the menu to use on the prefs page.
+ *
+ * @return Horde_Menu A Horde_Menu object.
+ */
+ public function prefsMenu()
+ {
+ return Crumb::getMenu();
+ }
+
}
+++ /dev/null
-<?php
-class Fima_Api extends Horde_Regsitry_Api
-{
- /**
- * TODO
- */
- public function prefsHandle($item, $updated)
- {
- switch ($item) {
- case 'ledgerselect':
- $active_ledger = Horde_Util::getFormData('active_ledger');
- if (!is_null($active_ledger)) {
- $ledgers = Fima::listLedgers();
- if (is_array($ledgers) &&
- array_key_exists($active_ledger, $ledgers)) {
- $GLOBALS['prefs']->setValue('active_ledger', $active_ledger);
- return true;
- }
- }
- break;
-
- case 'closedperiodselect':
- $period = Horde_Util::getFormData('closedperiod');
- if ((int)$period['year'] > 0 && (int)$period['month'] > 0) {
- $period = mktime(0, 0, 0, $period['month'] + 1, 0, $period['year']);
- } else {
- $period = 0;
- }
- $GLOBALS['prefs']->setValue('closed_period', $period);
- return true;
- }
-
- return $updated;
- }
-
- /**
- * Generate the menu to use on the prefs page.
- *
- * @return Horde_Menu A Horde_Menu object.
- */
- public function prefsMenu()
- {
- return Fima::getMenu();
- }
-
-}
class Fima_Application extends Horde_Regsitry_Application
{
public $version = '1.0.1';
+
+ /**
+ * Special preferences handling on update.
+ *
+ * @param string $item The preference name.
+ * @param boolean $updated Set to true if preference was updated.
+ *
+ * @return boolean True if preference was updated.
+ */
+ public function prefsHandle($item, $updated)
+ {
+ switch ($item) {
+ case 'ledgerselect':
+ $active_ledger = Horde_Util::getFormData('active_ledger');
+ if (!is_null($active_ledger)) {
+ $ledgers = Fima::listLedgers();
+ if (is_array($ledgers) &&
+ array_key_exists($active_ledger, $ledgers)) {
+ $GLOBALS['prefs']->setValue('active_ledger', $active_ledger);
+ return true;
+ }
+ }
+ break;
+
+ case 'closedperiodselect':
+ $period = Horde_Util::getFormData('closedperiod');
+ if ((int)$period['year'] > 0 && (int)$period['month'] > 0) {
+ $period = mktime(0, 0, 0, $period['month'] + 1, 0, $period['year']);
+ } else {
+ $period = 0;
+ }
+ $GLOBALS['prefs']->setValue('closed_period', $period);
+ return true;
+ }
+
+ return $updated;
+ }
+
+ /**
+ * Generate the menu to use on the prefs page.
+ *
+ * @return Horde_Menu A Horde_Menu object.
+ */
+ public function prefsMenu()
+ {
+ return Fima::getMenu();
+ }
+
}
}
/**
- * Generate the menu to use on the prefs page.
- *
- * @return Horde_Menu A Horde_Menu object.
- */
- public function prefsMenu()
- {
- return Folks::getMenu();
- }
-
- /**
* Returns profile image URL.
*
* @param string $user User uid
class Folks_Application extends Horde_Registry_Application
{
public $version = 'H4 (0.1-git)';
+
+ /**
+ * Generate the menu to use on the prefs page.
+ *
+ * @return Horde_Menu A Horde_Menu object.
+ */
+ public function prefsMenu()
+ {
+ return Folks::getMenu();
+ }
+
}
}
/**
- * TODO
- */
- public function prefsHandle($item, $updated)
- {
- switch ($item) {
- case 'columnselect':
- $columns = Horde_Util::getFormData('columns');
- if (!empty($columns)) {
- $GLOBALS['prefs']->setValue('columns', $columns);
- return true;
- }
- break;
- }
-
- return $updated;
- }
-
- /**
- * Generate the menu to use on the prefs page.
- *
- * @return Horde_Menu A Horde_Menu object.
- */
- public function prefsMenu()
- {
- return Gollem::getMenu();
- }
-
- /**
* Browses through the VFS tree.
*
* Each VFS backend is listed as a directory at the top level. No modify
* @var string
*/
public $version = 'H4 (2.0-git)';
+
+ /**
+ * Special preferences handling on update.
+ *
+ * @param string $item The preference name.
+ * @param boolean $updated Set to true if preference was updated.
+ *
+ * @return boolean True if preference was updated.
+ */
+ public function prefsHandle($item, $updated)
+ {
+ switch ($item) {
+ case 'columnselect':
+ $columns = Horde_Util::getFormData('columns');
+ if (!empty($columns)) {
+ $GLOBALS['prefs']->setValue('columns', $columns);
+ return true;
+ }
+ break;
+ }
+
+ return $updated;
+ }
+
+ /**
+ * Generate the menu to use on the prefs page.
+ *
+ * @return Horde_Menu A Horde_Menu object.
+ */
+ public function prefsMenu()
+ {
+ return Gollem::getMenu();
+ }
+
}
}
}
- /**
- * Code to run when viewing prefs for this application.
- *
- * @param string $group The prefGroup name.
- */
- public function prefsInit($group)
- {
- /* Add necessary javascript files here (so they are added to the
- * document HEAD). */
- switch ($group) {
- case 'flags':
- Horde::addScriptFile('colorpicker.js', 'horde', true);
- Horde::addScriptFile('flagmanagement.js', 'imp', true);
-
- Horde::addInlineScript(array(
- 'ImpFlagmanagement.new_prompt = ' . Horde_Serialize::serialize(_("Please enter the label for the new flag:"), Horde_Serialize::JSON, Horde_Nls::getCharset()),
- 'ImpFlagmanagement.confirm_delete = ' . Horde_Serialize::serialize(_("Are you sure you want to delete this flag?"), Horde_Serialize::JSON, Horde_Nls::getCharset())
- ));
- break;
- }
- }
-
- /**
- * TODO
- */
- public function prefsHandle($item, $updated)
- {
- switch ($item) {
- case 'sentmailselect':
- return $this->_prefsSentmailSelect($updated);
-
- case 'draftsselect':
- return $updated | $this->_prefsHandleFolders($updated, 'drafts_folder', 'drafts', 'drafts_new');
-
- case 'spamselect':
- return $updated | $this->_prefsHandleFolders($updated, 'spam_folder', 'spam', 'spam_new');
-
- case 'trashselect':
- return $this->_prefsTrashSelect($updated);
-
- case 'sourceselect':
- return $this->_prefsSourceSelect($updated);
-
- case 'initialpageselect':
- $this->_prefsInitialPageSelect();
- return true;
-
- case 'encryptselect':
- $this->_prefsEncryptSelect();
- return true;
-
- case 'defaultsearchselect':
- $this->_prefsDefaultSearchSelect();
- return true;
-
- case 'soundselect':
- return $GLOBALS['prefs']->setValue('nav_audio', Horde_Util::getFormData('nav_audio'));
-
- case 'flagmanagement':
- $this->_prefsFlagManagement();
- return false;
- }
- }
-
- /**
- * Do anything that we need to do as a result of certain preferences
- * changing.
- */
- public function prefsCallback()
- {
- global $prefs;
-
- /* Always check to make sure we have a valid trash folder if delete to
- * trash is active. */
- if (($prefs->isDirty('use_trash') || $prefs->isDirty('trash_folder')) &&
- $prefs->getValue('use_trash') &&
- !$prefs->getValue('trash_folder') &&
- !$prefs->getValue('use_vtrash')) {
- $GLOBALS['notification']->push(_("You have activated move to Trash but no Trash folder is defined. You will be unable to delete messages until you set a Trash folder in the preferences."), 'horde.warning');
- }
-
- if ($prefs->isDirty('use_vtrash') || $prefs->isDirty('use_vinbox')) {
- $imp_search = new IMP_Search();
- $imp_search->initialize(true);
- }
-
- if ($prefs->isDirty('subscribe') || $prefs->isDirty('tree_view')) {
- $imp_folder = IMP_Folder::singleton();
- $imp_folder->clearFlistCache();
- $imaptree = IMP_Imap_Tree::singleton();
- $imaptree->init();
- }
-
- if ($prefs->isDirty('mail_domain')) {
- $maildomain = preg_replace('/[^-\.a-z0-9]/i', '', $prefs->getValue('mail_domain'));
- $prefs->setValue('maildomain', $maildomain);
- if (!empty($maildomain)) {
- $_SESSION['imp']['maildomain'] = $maildomain;
- }
- }
-
- if ($prefs->isDirty('compose_popup')) {
- Horde::addInlineScript(array(
- 'if (window.parent.frames.horde_menu) window.parent.frames.horde_menu.location.reload();'
- ));
- }
- }
-
- /**
- * Generate the menu to use on the prefs page.
- *
- * @return Horde_Menu A Horde_Menu object.
- */
- public function prefsMenu()
- {
- return IMP::getMenu();
- }
-
- /**
- * Setup notifications handler for the preferences page. This will only
- * be called if in dimp view mode.
- */
- public function prefsStatus()
- {
- require_once dirname(__FILE__) . '/Application.php';
- new IMP_Application(array('init' => array('authentication' => 'none')));
-
- $notification = Horde_Notification::singleton();
- $notification->detach('status');
- $notification->attach('status', array('prefs' => true, 'viewmode' => 'dimp'), 'IMP_Notification_Listener_Status');
- }
-
- /**
- * TODO
- */
- protected function _prefsSentmailSelect($updated)
- {
- if (!$GLOBALS['conf']['user']['allow_folders'] ||
- $GLOBALS['prefs']->isLocked('sent_mail_folder')) {
- return $updated;
- }
-
- $sent_mail_folder = Horde_Util::getFormData('sent_mail_folder');
- $sent_mail_new = Horde_String::convertCharset(Horde_Util::getFormData('sent_mail_new'), Horde_Nls::getCharset(), 'UTF7-IMAP');
- $sent_mail_default = $GLOBALS['prefs']->getValue('sent_mail_folder');
-
- if (empty($sent_mail_folder) && !empty($sent_mail_new)) {
- $sent_mail_folder = $GLOBALS['imp_imap']->appendNamespace($sent_mail_new);
- } elseif (($sent_mail_folder == '-1') && !empty($sent_mail_default)) {
- $sent_mail_folder = $GLOBALS['imp_imap']->appendNamespace($sent_mail_default);
- }
-
- if (!empty($sent_mail_folder)) {
- $imp_folder = IMP_Folder::singleton();
- if (!$imp_folder->exists($sent_mail_folder)) {
- $imp_folder->create($sent_mail_folder, $GLOBALS['prefs']->getValue('subscribe'));
- }
- }
- $GLOBALS['identity']->setValue('sent_mail_folder', IMP::folderPref($sent_mail_folder, false));
-
- return true;
- }
-
- /**
- * TODO
- */
- protected function _prefsHandlefolders($updated, $pref, $folder, $new)
- {
- if (!$GLOBALS['conf']['user']['allow_folders']) {
- return $updated;
- }
-
- $folder = Horde_Util::getFormData($folder);
- if (isset($folder) && !$GLOBALS['prefs']->isLocked($pref)) {
- $new = Horde_String::convertCharset(Horde_Util::getFormData($new), Horde_Nls::getCharset(), 'UTF7-IMAP');
- if ($folder == IMP::PREF_NO_FOLDER) {
- $GLOBALS['prefs']->setValue($pref, '');
- } else {
- if (empty($folder) && !empty($new)) {
- $folder = $GLOBALS['imp_imap']->appendNamespace($new);
- $imp_folder = IMP_Folder::singleton();
- if (!$imp_folder->create($folder, $GLOBALS['prefs']->getValue('subscribe'))) {
- $folder = null;
- }
- }
- if (!empty($folder)) {
- $GLOBALS['prefs']->setValue($pref, IMP::folderPref($folder, false));
- return true;
- }
- }
- }
-
- return $updated;
- }
-
- /**
- * TODO
- */
- protected function _prefsTrashSelect($updated)
- {
- global $prefs;
-
- if (Horde_Util::getFormData('trash') == IMP::PREF_VTRASH) {
- if ($prefs->isLocked('use_vtrash')) {
- return false;
- }
-
- $prefs->setValue('use_vtrash', 1);
- $prefs->setValue('trash_folder', '');
- } else {
- if ($prefs->isLocked('trash_folder')) {
- return false;
- }
-
- $updated = $updated | $this->_prefsHandleFolders($updated, 'trash_folder', 'trash', 'trash_new');
- if ($updated) {
- $prefs->setValue('use_vtrash', 0);
- $prefs->setDirty('trash_folder', true);
- }
- }
-
- return $updated;
- }
-
- /**
- * TODO
- */
- protected function _prefsSourceSelect($updated)
- {
- $search_sources = Horde_Util::getFormData('search_sources');
- if (!is_null($search_sources)) {
- $GLOBALS['prefs']->setValue('search_sources', $search_sources);
- unset($_SESSION['imp']['cache']['ac_ajax']);
- $updated = true;
- }
-
- $search_fields_string = Horde_Util::getFormData('search_fields_string');
- if (!is_null($search_fields_string)) {
- $GLOBALS['prefs']->setValue('search_fields', $search_fields_string);
- $updated = true;
- }
-
- $add_source = Horde_Util::getFormData('add_source');
- if (!is_null($add_source)) {
- $GLOBALS['prefs']->setValue('add_source', $add_source);
- $updated = true;
- }
-
- return $updated;
- }
-
- /**
- * TODO
- */
- protected function _prefsInitialPageSelect()
- {
- $initial_page = Horde_Util::getFormData('initial_page');
- $GLOBALS['prefs']->setValue('initial_page', $initial_page);
- }
-
- /**
- * TODO
- */
- protected function _prefsEncryptSelect()
- {
- $default_encrypt = Horde_Util::getFormData('default_encrypt');
- $GLOBALS['prefs']->setValue('default_encrypt', $default_encrypt);
- }
-
- /**
- * TODO
- */
- protected function _prefsDefaultSearchSelect()
- {
- $default_search = Horde_Util::getFormData('default_search');
- $GLOBALS['prefs']->setValue('default_search', $default_search);
- }
-
- /**
- * TODO
- */
- protected function _prefsFlagManagement()
- {
- $imp_flags = IMP_Imap_Flags::singleton();
- $action = Horde_Util::getFormData('flag_action');
- $data = Horde_Util::getFormData('flag_data');
-
- if ($action == 'add') {
- $imp_flags->addFlag($data);
- return;
- }
-
- $def_color = $GLOBALS['prefs']->getValue('msgflags_color');
-
- // Don't set updated on these actions. User may want to do more actions.
- foreach ($imp_flags->getList() as $key => $val) {
- $md5 = hash('md5', $key);
-
- switch ($action) {
- case 'delete':
- if ($data == ('bg_' . $md5)) {
- $imp_flags->deleteFlag($key);
- }
- break;
-
- default:
- /* Change labels for user-defined flags. */
- if ($val['t'] == 'imapp') {
- $label = Horde_Util::getFormData('label_' . $md5);
- if (strlen($label) && ($label != $val['l'])) {
- $imp_flags->updateFlag($key, array('l' => $label));
- }
- }
-
- /* Change background for all flags. */
- $bg = strtolower(Horde_Util::getFormData('bg_' . $md5));
- if ((isset($val['b']) && ($bg != $val['b'])) ||
- (!isset($val['b']) && ($bg != $def_color))) {
- $imp_flags->updateFlag($key, array('b' => $bg));
- }
- break;
- }
- }
- }
-
/* IMP-specific functions. */
/**
IMP::initialize();
}
+ /* Horde_Auth_Application methods. */
+
/**
* Return login parameters used on the login page.
*
return $auth->listUsers();
}
+ /* Preferences display/handling methods. */
+
+ /**
+ * Code to run when viewing prefs for this application.
+ *
+ * @param string $group The prefGroup name.
+ *
+ * @return array A list of variables to export to the prefs display page.
+ */
+ public function prefsInit($group)
+ {
+ /* Add necessary javascript files here (so they are added to the
+ * document HEAD). */
+ switch ($group) {
+ case 'flags':
+ Horde::addScriptFile('colorpicker.js', 'horde', true);
+ Horde::addScriptFile('flagmanagement.js', 'imp', true);
+
+ Horde::addInlineScript(array(
+ 'ImpFlagmanagement.new_prompt = ' . Horde_Serialize::serialize(_("Please enter the label for the new flag:"), Horde_Serialize::JSON, Horde_Nls::getCharset()),
+ 'ImpFlagmanagement.confirm_delete = ' . Horde_Serialize::serialize(_("Are you sure you want to delete this flag?"), Horde_Serialize::JSON, Horde_Nls::getCharset())
+ ));
+ break;
+ }
+ }
+
+ /**
+ * Special preferences handling on update.
+ *
+ * @param string $item The preference name.
+ * @param boolean $updated Set to true if preference was updated.
+ *
+ * @return boolean True if preference was updated.
+ */
+ public function prefsHandle($item, $updated)
+ {
+ switch ($item) {
+ case 'sentmailselect':
+ return $this->_prefsSentmailSelect($updated);
+
+ case 'draftsselect':
+ return $updated | $this->_prefsHandleFolders($updated, 'drafts_folder', 'drafts', 'drafts_new');
+
+ case 'spamselect':
+ return $updated | $this->_prefsHandleFolders($updated, 'spam_folder', 'spam', 'spam_new');
+
+ case 'trashselect':
+ return $this->_prefsTrashSelect($updated);
+
+ case 'sourceselect':
+ return $this->_prefsSourceSelect($updated);
+
+ case 'initialpageselect':
+ $this->_prefsInitialPageSelect();
+ return true;
+
+ case 'encryptselect':
+ $this->_prefsEncryptSelect();
+ return true;
+
+ case 'defaultsearchselect':
+ $this->_prefsDefaultSearchSelect();
+ return true;
+
+ case 'soundselect':
+ return $GLOBALS['prefs']->setValue('nav_audio', Horde_Util::getFormData('nav_audio'));
+
+ case 'flagmanagement':
+ $this->_prefsFlagManagement();
+ return false;
+ }
+ }
+
+ /**
+ * Do anything that we need to do as a result of certain preferences
+ * changing.
+ */
+ public function prefsCallback()
+ {
+ global $prefs;
+
+ /* Always check to make sure we have a valid trash folder if delete to
+ * trash is active. */
+ if (($prefs->isDirty('use_trash') || $prefs->isDirty('trash_folder')) &&
+ $prefs->getValue('use_trash') &&
+ !$prefs->getValue('trash_folder') &&
+ !$prefs->getValue('use_vtrash')) {
+ $GLOBALS['notification']->push(_("You have activated move to Trash but no Trash folder is defined. You will be unable to delete messages until you set a Trash folder in the preferences."), 'horde.warning');
+ }
+
+ if ($prefs->isDirty('use_vtrash') || $prefs->isDirty('use_vinbox')) {
+ $imp_search = new IMP_Search();
+ $imp_search->initialize(true);
+ }
+
+ if ($prefs->isDirty('subscribe') || $prefs->isDirty('tree_view')) {
+ $imp_folder = IMP_Folder::singleton();
+ $imp_folder->clearFlistCache();
+ $imaptree = IMP_Imap_Tree::singleton();
+ $imaptree->init();
+ }
+
+ if ($prefs->isDirty('mail_domain')) {
+ $maildomain = preg_replace('/[^-\.a-z0-9]/i', '', $prefs->getValue('mail_domain'));
+ $prefs->setValue('maildomain', $maildomain);
+ if (!empty($maildomain)) {
+ $_SESSION['imp']['maildomain'] = $maildomain;
+ }
+ }
+
+ if ($prefs->isDirty('compose_popup')) {
+ Horde::addInlineScript(array(
+ 'if (window.parent.frames.horde_menu) window.parent.frames.horde_menu.location.reload();'
+ ));
+ }
+ }
+
+ /**
+ * Generate the menu to use on the prefs page.
+ *
+ * @return Horde_Menu A Horde_Menu object.
+ */
+ public function prefsMenu()
+ {
+ return IMP::getMenu();
+ }
+
+ /**
+ * Setup notifications handler for the preferences page. This will only
+ * be called if in dimp view mode.
+ */
+ public function prefsStatus()
+ {
+ require_once dirname(__FILE__) . '/Application.php';
+ new IMP_Application(array('init' => array('authentication' => 'none')));
+
+ $notification = Horde_Notification::singleton();
+ $notification->detach('status');
+ $notification->attach('status', array('prefs' => true, 'viewmode' => 'dimp'), 'IMP_Notification_Listener_Status');
+ }
+
+ /**
+ * TODO
+ */
+ protected function _prefsSentmailSelect($updated)
+ {
+ if (!$GLOBALS['conf']['user']['allow_folders'] ||
+ $GLOBALS['prefs']->isLocked('sent_mail_folder')) {
+ return $updated;
+ }
+
+ $sent_mail_folder = Horde_Util::getFormData('sent_mail_folder');
+ $sent_mail_new = Horde_String::convertCharset(Horde_Util::getFormData('sent_mail_new'), Horde_Nls::getCharset(), 'UTF7-IMAP');
+ $sent_mail_default = $GLOBALS['prefs']->getValue('sent_mail_folder');
+
+ if (empty($sent_mail_folder) && !empty($sent_mail_new)) {
+ $sent_mail_folder = $GLOBALS['imp_imap']->appendNamespace($sent_mail_new);
+ } elseif (($sent_mail_folder == '-1') && !empty($sent_mail_default)) {
+ $sent_mail_folder = $GLOBALS['imp_imap']->appendNamespace($sent_mail_default);
+ }
+
+ if (!empty($sent_mail_folder)) {
+ $imp_folder = IMP_Folder::singleton();
+ if (!$imp_folder->exists($sent_mail_folder)) {
+ $imp_folder->create($sent_mail_folder, $GLOBALS['prefs']->getValue('subscribe'));
+ }
+ }
+ $GLOBALS['identity']->setValue('sent_mail_folder', IMP::folderPref($sent_mail_folder, false));
+
+ return true;
+ }
+
+ /**
+ * TODO
+ */
+ protected function _prefsHandlefolders($updated, $pref, $folder, $new)
+ {
+ if (!$GLOBALS['conf']['user']['allow_folders']) {
+ return $updated;
+ }
+
+ $folder = Horde_Util::getFormData($folder);
+ if (isset($folder) && !$GLOBALS['prefs']->isLocked($pref)) {
+ $new = Horde_String::convertCharset(Horde_Util::getFormData($new), Horde_Nls::getCharset(), 'UTF7-IMAP');
+ if ($folder == IMP::PREF_NO_FOLDER) {
+ $GLOBALS['prefs']->setValue($pref, '');
+ } else {
+ if (empty($folder) && !empty($new)) {
+ $folder = $GLOBALS['imp_imap']->appendNamespace($new);
+ $imp_folder = IMP_Folder::singleton();
+ if (!$imp_folder->create($folder, $GLOBALS['prefs']->getValue('subscribe'))) {
+ $folder = null;
+ }
+ }
+ if (!empty($folder)) {
+ $GLOBALS['prefs']->setValue($pref, IMP::folderPref($folder, false));
+ return true;
+ }
+ }
+ }
+
+ return $updated;
+ }
+
+ /**
+ * TODO
+ */
+ protected function _prefsTrashSelect($updated)
+ {
+ global $prefs;
+
+ if (Horde_Util::getFormData('trash') == IMP::PREF_VTRASH) {
+ if ($prefs->isLocked('use_vtrash')) {
+ return false;
+ }
+
+ $prefs->setValue('use_vtrash', 1);
+ $prefs->setValue('trash_folder', '');
+ } else {
+ if ($prefs->isLocked('trash_folder')) {
+ return false;
+ }
+
+ $updated = $updated | $this->_prefsHandleFolders($updated, 'trash_folder', 'trash', 'trash_new');
+ if ($updated) {
+ $prefs->setValue('use_vtrash', 0);
+ $prefs->setDirty('trash_folder', true);
+ }
+ }
+
+ return $updated;
+ }
+
+ /**
+ * TODO
+ */
+ protected function _prefsSourceSelect($updated)
+ {
+ $search_sources = Horde_Util::getFormData('search_sources');
+ if (!is_null($search_sources)) {
+ $GLOBALS['prefs']->setValue('search_sources', $search_sources);
+ unset($_SESSION['imp']['cache']['ac_ajax']);
+ $updated = true;
+ }
+
+ $search_fields_string = Horde_Util::getFormData('search_fields_string');
+ if (!is_null($search_fields_string)) {
+ $GLOBALS['prefs']->setValue('search_fields', $search_fields_string);
+ $updated = true;
+ }
+
+ $add_source = Horde_Util::getFormData('add_source');
+ if (!is_null($add_source)) {
+ $GLOBALS['prefs']->setValue('add_source', $add_source);
+ $updated = true;
+ }
+
+ return $updated;
+ }
+
+ /**
+ * TODO
+ */
+ protected function _prefsInitialPageSelect()
+ {
+ $initial_page = Horde_Util::getFormData('initial_page');
+ $GLOBALS['prefs']->setValue('initial_page', $initial_page);
+ }
+
+ /**
+ * TODO
+ */
+ protected function _prefsEncryptSelect()
+ {
+ $default_encrypt = Horde_Util::getFormData('default_encrypt');
+ $GLOBALS['prefs']->setValue('default_encrypt', $default_encrypt);
+ }
+
+ /**
+ * TODO
+ */
+ protected function _prefsDefaultSearchSelect()
+ {
+ $default_search = Horde_Util::getFormData('default_search');
+ $GLOBALS['prefs']->setValue('default_search', $default_search);
+ }
+
+ /**
+ * TODO
+ */
+ protected function _prefsFlagManagement()
+ {
+ $imp_flags = IMP_Imap_Flags::singleton();
+ $action = Horde_Util::getFormData('flag_action');
+ $data = Horde_Util::getFormData('flag_data');
+
+ if ($action == 'add') {
+ $imp_flags->addFlag($data);
+ return;
+ }
+
+ $def_color = $GLOBALS['prefs']->getValue('msgflags_color');
+
+ // Don't set updated on these actions. User may want to do more actions.
+ foreach ($imp_flags->getList() as $key => $val) {
+ $md5 = hash('md5', $key);
+
+ switch ($action) {
+ case 'delete':
+ if ($data == ('bg_' . $md5)) {
+ $imp_flags->deleteFlag($key);
+ }
+ break;
+
+ default:
+ /* Change labels for user-defined flags. */
+ if ($val['t'] == 'imapp') {
+ $label = Horde_Util::getFormData('label_' . $md5);
+ if (strlen($label) && ($label != $val['l'])) {
+ $imp_flags->updateFlag($key, array('l' => $label));
+ }
+ }
+
+ /* Change background for all flags. */
+ $bg = strtolower(Horde_Util::getFormData('bg_' . $md5));
+ if ((isset($val['b']) && ($bg != $val['b'])) ||
+ (!isset($val['b']) && ($bg != $def_color))) {
+ $imp_flags->updateFlag($key, array('b' => $bg));
+ }
+ break;
+ }
+ }
+ }
+
}
}
/**
- * Generate the menu to use on the prefs page.
- *
- * @return Horde_Menu A Horde_Menu object.
- */
- public function prefsMenu()
- {
- return Ingo::getMenu();
- }
-
- /**
* Removes user data.
*
* @param string $user Name of user to remove data for.
* @var string
*/
public $version = 'H4 (2.0-git)';
+
+ /**
+ * Generate the menu to use on the prefs page.
+ *
+ * @return Horde_Menu A Horde_Menu object.
+ */
+ public function prefsMenu()
+ {
+ return Ingo::getMenu();
+ }
+
}
+++ /dev/null
-<?php
-class Jeta_Api extends Horde_Registry_Api
-{
- /**
- * Generate the menu to use on the prefs page.
- *
- * @return Horde_Menu A Horde_Menu object.
- */
- public function prefsMenu()
- {
- return Jeta::getMenu();
- }
-
-}
class Jeta_Application extends Horde_Registry_Application
{
public $version = 'H4 (2.0-git)';
+
+ /**
+ * Generate the menu to use on the prefs page.
+ *
+ * @return Horde_Menu A Horde_Menu object.
+ */
+ public function prefsMenu()
+ {
+ return Jeta::getMenu();
+ }
+
}
+++ /dev/null
-<?php
-class Kastalia_Api extends Horde_Registry_Api
-{
- /**
- * Generate the menu to use on the prefs page.
- *
- * @return Horde_Menu A Horde_Menu object.
- */
- public function prefsMenu()
- {
- return Kastalia::getMenu();
- }
-
-}
class Kastalia_Application extends Horde_Registry_Application
{
public $version = '1.0.1';
+
+ /**
+ * Generate the menu to use on the prefs page.
+ *
+ * @return Horde_Menu A Horde_Menu object.
+ */
+ public function prefsMenu()
+ {
+ return Kastalia::getMenu();
+ }
+
}
}
/**
- * Code to run when viewing prefs for this application.
- *
- * @param string $group The prefGroup name.
- *
- * @return array A list of variables to export to the prefs display page.
- */
- public function prefsInit($group)
- {
- $out = array();
-
- if (!$GLOBALS['prefs']->isLocked('day_hour_start') ||
- !$GLOBALS['prefs']->isLocked('day_hour_end')) {
- $out['day_hour_start_options'] = array();
- for ($i = 0; $i <= 48; ++$i) {
- $out['day_hour_start_options'][$i] = date(($GLOBALS['prefs']->getValue('twentyFour')) ? 'G:i' : 'g:ia', mktime(0, $i * 30, 0));
- }
- $out['day_hour_end_options'] = $out['day_hour_start_options'];
- }
-
- if (!empty($GLOBALS['conf']['holidays']['enable'])) {
- if (class_exists('Date_Holidays')) {
- foreach (Date_Holidays::getInstalledDrivers() as $driver) {
- if ($driver['id'] == 'Composite') {
- continue;
- }
- $_prefs['holiday_drivers']['enum'][$driver['id']] = $driver['title'];
- }
- asort($_prefs['holiday_drivers']['enum']);
- } else {
- $GLOBALS['notification']->push(_("Holidays support is not available on this server."), 'horde.error');
- }
- }
-
- return $out;
- }
-
- /**
- * TODO
- */
- public function prefsHandle($item, $updated)
- {
- switch ($item) {
- case 'remote_cal_management':
- return $this->_prefsRemoteCalManagement($updated);
-
- case 'shareselect':
- return $this->_prefsShareSelect($updated);
-
- case 'holiday_drivers':
- $this->_prefsHolidayDrivers($updated);
- return true;
-
- case 'sourceselect':
- return $this->_prefsSourceSelect($updated);
-
- case 'fb_cals_select':
- $this->_prefsFbCalsSelect($updated);
- return true;
-
- case 'default_alarm_management':
- $GLOBALS['prefs']->setValue('default_alarm', (int)Horde_Util::getFormData('alarm_value') * (int)Horde_Util::getFormData('alarm_unit'));
- return true;
- }
- }
-
- /**
- * TODO
- */
- public function prefsCallback()
- {
- if ($GLOBALS['prefs']->isDirty('event_alarms')) {
- $alarms = $GLOBALS['registry']->callByPackage('kronolith', 'listAlarms', array($_SERVER['REQUEST_TIME']));
- if (!is_a($alarms, 'PEAR_Error') && !empty($alarms)) {
- $horde_alarm = Horde_Alarm::factory();
- foreach ($alarms as $alarm) {
- $alarm['start'] = new Horde_Date($alarm['start']);
- $alarm['end'] = new Horde_Date($alarm['end']);
- $horde_alarm->set($alarm);
- }
- }
- }
- }
-
- /**
- * Generate the menu to use on the prefs page.
- *
- * @return Horde_Menu A Horde_Menu object.
- */
- public function prefsMenu()
- {
- return Kronolith::getMenu();
- }
-
- /**
- * TODO
- */
- protected function _prefsRemoteCalManagement($updated)
- {
- $calName = Horde_Util::getFormData('remote_name');
- $calUrl = trim(Horde_Util::getFormData('remote_url'));
- $calUser = trim(Horde_Util::getFormData('remote_user'));
- $calPasswd = trim(Horde_Util::getFormData('remote_password'));
-
- $key = Horde_Auth::getCredential('password');
- if ($key) {
- $calUser = base64_encode(Secret::write($key, $calUser));
- $calPasswd = base64_encode(Secret::write($key, $calPasswd));
- }
-
- $calActionID = Horde_Util::getFormData('remote_action', 'add');
-
- if ($calActionID == 'add') {
- if (!empty($calName) && !empty($calUrl)) {
- $cals = unserialize($GLOBALS['prefs']->getValue('remote_cals'));
- $cals[] = array('name' => $calName,
- 'url' => $calUrl,
- 'user' => $calUser,
- 'password' => $calPasswd);
- $GLOBALS['prefs']->setValue('remote_cals', serialize($cals));
- return $updated;
- }
- } elseif ($calActionID == 'delete') {
- $cals = unserialize($GLOBALS['prefs']->getValue('remote_cals'));
- foreach ($cals as $key => $cal) {
- if ($cal['url'] == $calUrl) {
- unset($cals[$key]);
- break;
- }
- }
- $GLOBALS['prefs']->setValue('remote_cals', serialize($cals));
- return $updated;
- } elseif ($calActionID == 'edit') {
- $cals = unserialize($GLOBALS['prefs']->getValue('remote_cals'));
- foreach ($cals as $key => $cal) {
- if ($cal['url'] == $calUrl) {
- $cals[$key]['name'] = $calName;
- $cals[$key]['url'] = $calUrl;
- $cals[$key]['user'] = $calUser;
- $cals[$key]['password'] = $calPasswd;
- break;
- }
- }
- $GLOBALS['prefs']->setValue('remote_cals', serialize($cals));
- return $updated;
- }
-
- return false;
- }
-
- /**
- * TODO
- */
- protected function _prefsShareSelect($updated)
- {
- $default_share = Horde_Util::getFormData('default_share');
- if (!is_null($default_share)) {
- $sharelist = Kronolith::listCalendars();
- if ((is_array($sharelist)) > 0 &&
- isset($sharelist[$default_share])) {
- $GLOBALS['prefs']->setValue('default_share', $default_share);
- return true;
- }
- }
-
- return $updated;
- }
-
- /**
- * TODO
- */
- protected function _prefsHolidayDrivers()
- {
- $holiday_driversSelected = Horde_Util::getFormData('holiday_drivers');
- $holiday_driversFiltered = array();
-
- if (is_array($holiday_driversSelected)) {
- foreach ($holiday_driversSelected as $holiday_driver) {
- $holiday_driversFiltered[] = $holiday_driver;
- }
- }
-
- $GLOBALS['prefs']->setValue('holiday_drivers', serialize($holiday_driversFiltered));
- }
-
- /**
- * TODO
- */
- protected function _prefsSourceSelect($updated)
- {
- $search_sources = Horde_Util::getFormData('search_sources');
- if (!is_null($search_sources)) {
- $GLOBALS['prefs']->setValue('search_sources', $search_sources);
- $updated = true;
- }
-
- $search_fields_string = Horde_Util::getFormData('search_fields_string');
- if (!is_null($search_fields_string)) {
- $GLOBALS['prefs']->setValue('search_fields', $search_fields_string);
- $updated = true;
- }
-
- return $updated;
- }
-
- /**
- * TODO
- */
- protected function _prefsHandleFbCalsSelect()
- {
- $fb_calsSelected = Horde_Util::getFormData('fb_cals');
- $fb_cals = Kronolith::listCalendars();
- $fb_calsFiltered = array();
-
- if (isset($fb_calsSelected) && is_array($fb_calsSelected)) {
- foreach ($fb_calsSelected as $fb_cal) {
- $fb_calsFiltered[] = $fb_cal;
- }
- }
-
- $GLOBALS['prefs']->setValue('fb_cals', serialize($fb_calsFiltered));
- }
-
- /**
* Removes user data.
*
* @param string $user Name of user to remove data for.
class Kronolith_Application extends Horde_Registry_Application
{
public $version = 'H3 (3.0-git)';
+
+ /**
+ * Code to run when viewing prefs for this application.
+ *
+ * @param string $group The prefGroup name.
+ *
+ * @return array A list of variables to export to the prefs display page.
+ */
+ public function prefsInit($group)
+ {
+ $out = array();
+
+ if (!$GLOBALS['prefs']->isLocked('day_hour_start') ||
+ !$GLOBALS['prefs']->isLocked('day_hour_end')) {
+ $out['day_hour_start_options'] = array();
+ for ($i = 0; $i <= 48; ++$i) {
+ $out['day_hour_start_options'][$i] = date(($GLOBALS['prefs']->getValue('twentyFour')) ? 'G:i' : 'g:ia', mktime(0, $i * 30, 0));
+ }
+ $out['day_hour_end_options'] = $out['day_hour_start_options'];
+ }
+
+ if (!empty($GLOBALS['conf']['holidays']['enable'])) {
+ if (class_exists('Date_Holidays')) {
+ foreach (Date_Holidays::getInstalledDrivers() as $driver) {
+ if ($driver['id'] == 'Composite') {
+ continue;
+ }
+ $_prefs['holiday_drivers']['enum'][$driver['id']] = $driver['title'];
+ }
+ asort($_prefs['holiday_drivers']['enum']);
+ } else {
+ $GLOBALS['notification']->push(_("Holidays support is not available on this server."), 'horde.error');
+ }
+ }
+
+ return $out;
+ }
+
+ /**
+ * Special preferences handling on update.
+ *
+ * @param string $item The preference name.
+ * @param boolean $updated Set to true if preference was updated.
+ *
+ * @return boolean True if preference was updated.
+ */
+ public function prefsHandle($item, $updated)
+ {
+ switch ($item) {
+ case 'remote_cal_management':
+ return $this->_prefsRemoteCalManagement($updated);
+
+ case 'shareselect':
+ return $this->_prefsShareSelect($updated);
+
+ case 'holiday_drivers':
+ $this->_prefsHolidayDrivers($updated);
+ return true;
+
+ case 'sourceselect':
+ return $this->_prefsSourceSelect($updated);
+
+ case 'fb_cals_select':
+ $this->_prefsFbCalsSelect($updated);
+ return true;
+
+ case 'default_alarm_management':
+ $GLOBALS['prefs']->setValue('default_alarm', (int)Horde_Util::getFormData('alarm_value') * (int)Horde_Util::getFormData('alarm_unit'));
+ return true;
+ }
+ }
+
+ /**
+ * Do anything that we need to do as a result of certain preferences
+ * changing.
+ */
+ public function prefsCallback()
+ {
+ if ($GLOBALS['prefs']->isDirty('event_alarms')) {
+ $alarms = $GLOBALS['registry']->callByPackage('kronolith', 'listAlarms', array($_SERVER['REQUEST_TIME']));
+ if (!is_a($alarms, 'PEAR_Error') && !empty($alarms)) {
+ $horde_alarm = Horde_Alarm::factory();
+ foreach ($alarms as $alarm) {
+ $alarm['start'] = new Horde_Date($alarm['start']);
+ $alarm['end'] = new Horde_Date($alarm['end']);
+ $horde_alarm->set($alarm);
+ }
+ }
+ }
+ }
+
+ /**
+ * Generate the menu to use on the prefs page.
+ *
+ * @return Horde_Menu A Horde_Menu object.
+ */
+ public function prefsMenu()
+ {
+ return Kronolith::getMenu();
+ }
+
+ /**
+ * TODO
+ */
+ protected function _prefsRemoteCalManagement($updated)
+ {
+ $calName = Horde_Util::getFormData('remote_name');
+ $calUrl = trim(Horde_Util::getFormData('remote_url'));
+ $calUser = trim(Horde_Util::getFormData('remote_user'));
+ $calPasswd = trim(Horde_Util::getFormData('remote_password'));
+
+ $key = Horde_Auth::getCredential('password');
+ if ($key) {
+ $calUser = base64_encode(Secret::write($key, $calUser));
+ $calPasswd = base64_encode(Secret::write($key, $calPasswd));
+ }
+
+ $calActionID = Horde_Util::getFormData('remote_action', 'add');
+
+ if ($calActionID == 'add') {
+ if (!empty($calName) && !empty($calUrl)) {
+ $cals = unserialize($GLOBALS['prefs']->getValue('remote_cals'));
+ $cals[] = array('name' => $calName,
+ 'url' => $calUrl,
+ 'user' => $calUser,
+ 'password' => $calPasswd);
+ $GLOBALS['prefs']->setValue('remote_cals', serialize($cals));
+ return $updated;
+ }
+ } elseif ($calActionID == 'delete') {
+ $cals = unserialize($GLOBALS['prefs']->getValue('remote_cals'));
+ foreach ($cals as $key => $cal) {
+ if ($cal['url'] == $calUrl) {
+ unset($cals[$key]);
+ break;
+ }
+ }
+ $GLOBALS['prefs']->setValue('remote_cals', serialize($cals));
+ return $updated;
+ } elseif ($calActionID == 'edit') {
+ $cals = unserialize($GLOBALS['prefs']->getValue('remote_cals'));
+ foreach ($cals as $key => $cal) {
+ if ($cal['url'] == $calUrl) {
+ $cals[$key]['name'] = $calName;
+ $cals[$key]['url'] = $calUrl;
+ $cals[$key]['user'] = $calUser;
+ $cals[$key]['password'] = $calPasswd;
+ break;
+ }
+ }
+ $GLOBALS['prefs']->setValue('remote_cals', serialize($cals));
+ return $updated;
+ }
+
+ return false;
+ }
+
+ /**
+ * TODO
+ */
+ protected function _prefsShareSelect($updated)
+ {
+ $default_share = Horde_Util::getFormData('default_share');
+ if (!is_null($default_share)) {
+ $sharelist = Kronolith::listCalendars();
+ if ((is_array($sharelist)) > 0 &&
+ isset($sharelist[$default_share])) {
+ $GLOBALS['prefs']->setValue('default_share', $default_share);
+ return true;
+ }
+ }
+
+ return $updated;
+ }
+
+ /**
+ * TODO
+ */
+ protected function _prefsHolidayDrivers()
+ {
+ $holiday_driversSelected = Horde_Util::getFormData('holiday_drivers');
+ $holiday_driversFiltered = array();
+
+ if (is_array($holiday_driversSelected)) {
+ foreach ($holiday_driversSelected as $holiday_driver) {
+ $holiday_driversFiltered[] = $holiday_driver;
+ }
+ }
+
+ $GLOBALS['prefs']->setValue('holiday_drivers', serialize($holiday_driversFiltered));
+ }
+
+ /**
+ * TODO
+ */
+ protected function _prefsSourceSelect($updated)
+ {
+ $search_sources = Horde_Util::getFormData('search_sources');
+ if (!is_null($search_sources)) {
+ $GLOBALS['prefs']->setValue('search_sources', $search_sources);
+ $updated = true;
+ }
+
+ $search_fields_string = Horde_Util::getFormData('search_fields_string');
+ if (!is_null($search_fields_string)) {
+ $GLOBALS['prefs']->setValue('search_fields', $search_fields_string);
+ $updated = true;
+ }
+
+ return $updated;
+ }
+
+ /**
+ * TODO
+ */
+ protected function _prefsHandleFbCalsSelect()
+ {
+ $fb_calsSelected = Horde_Util::getFormData('fb_cals');
+ $fb_cals = Kronolith::listCalendars();
+ $fb_calsFiltered = array();
+
+ if (isset($fb_calsSelected) && is_array($fb_calsSelected)) {
+ foreach ($fb_calsSelected as $fb_cal) {
+ $fb_calsFiltered[] = $fb_cal;
+ }
+ }
+
+ $GLOBALS['prefs']->setValue('fb_cals', serialize($fb_calsFiltered));
+ }
+
}
}
/**
- * TODO
- */
- public function prefsHandle($item, $updated)
- {
- switch ($item) {
- case 'tasklistselect':
- $default_tasklist = Horde_Util::getFormData('default_tasklist');
- if (!is_null($default_tasklist)) {
- $tasklists = Nag::listTasklists();
- if (is_array($tasklists) &&
- isset($tasklists[$default_tasklist])) {
- $GLOBALS['prefs']->setValue('default_tasklist', $default_tasklist);
- return true;
- }
- }
- break;
-
- case 'showsummaryselect':
- $GLOBALS['prefs']->setValue('summary_categories', Horde_Util::getFormData('summary_categories'));
- return true;
-
- case 'defaultduetimeselect':
- $GLOBALS['prefs']->setValue('default_due_time', Horde_Util::getFormData('default_due_time'));
- return true;
- }
-
- return $updated;
- }
-
- /**
- * Generate the menu to use on the prefs page.
- *
- * @return Horde_Menu A Horde_Menu object.
- */
- public function prefsMenu()
- {
- return Nag::getMenu();
- }
-
- /**
* Removes user data.
*
* @param string $user Name of user to remove data for.
*/
public $version = 'H4 (3.0-git)';
+ /**
+ * Special preferences handling on update.
+ *
+ * @param string $item The preference name.
+ * @param boolean $updated Set to true if preference was updated.
+ *
+ * @return boolean True if preference was updated.
+ */
+ public function prefsHandle($item, $updated)
+ {
+ switch ($item) {
+ case 'tasklistselect':
+ $default_tasklist = Horde_Util::getFormData('default_tasklist');
+ if (!is_null($default_tasklist)) {
+ $tasklists = Nag::listTasklists();
+ if (is_array($tasklists) &&
+ isset($tasklists[$default_tasklist])) {
+ $GLOBALS['prefs']->setValue('default_tasklist', $default_tasklist);
+ return true;
+ }
+ }
+ break;
+
+ case 'showsummaryselect':
+ $GLOBALS['prefs']->setValue('summary_categories', Horde_Util::getFormData('summary_categories'));
+ return true;
+
+ case 'defaultduetimeselect':
+ $GLOBALS['prefs']->setValue('default_due_time', Horde_Util::getFormData('default_due_time'));
+ return true;
+ }
+
+ return $updated;
+ }
+
+ /**
+ * Generate the menu to use on the prefs page.
+ *
+ * @return Horde_Menu A Horde_Menu object.
+ */
+ public function prefsMenu()
+ {
+ return Nag::getMenu();
+ }
+
}
}
/**
- * Generate the menu to use on the prefs page.
- *
- * @return Horde_Menu A Horde_Menu object.
- */
- public function prefsMenu()
- {
- return News::getMenu();
- }
-
- /**
* Callback for comment API
*
- * @param int $id Internal data identifier
- * @param string $type Type of data to retreive (title, owner...)
- * @param array $params Additional parameters
+ * @param int $id Internal data identifier
+ * @param string $type Type of data to retreive (title, owner...)
+ * @param array $params Additional parameters
*/
public function commentCallback($id, $type = 'title', $params = null)
{
class News_Application extends Horde_Registry_Application
{
public $version = 'H4 (0.1-git)';
+
+ /**
+ * Generate the menu to use on the prefs page.
+ *
+ * @return Horde_Menu A Horde_Menu object.
+ */
+ public function prefsMenu()
+ {
+ return News::getMenu();
+ }
+
}
<?php
class Skeleton_Api extends Horde_Registry_Api
{
- /**
- * Generate the menu to use on the prefs page.
- *
- * @return Horde_Menu A Horde_Menu object.
- */
- public function prefsMenu()
- {
- return Skeleton::getMenu();
- }
-
}
class Skeleton_Api extends Horde_Registry_Api
{
public $version = 'H4 (0.1-git)';
+
+ /**
+ * Generate the menu to use on the prefs page.
+ *
+ * @return Horde_Menu A Horde_Menu object.
+ */
+ public function prefsMenu()
+ {
+ return Skeleton::getMenu();
+ }
+
}
+++ /dev/null
-<?php
-class Skoli_Api extends Horde_Registry_Api
-{
- /**
- * Generate the menu to use on the prefs page.
- *
- * @return Horde_Menu A Horde_Menu object.
- */
- public function prefsMenu()
- {
- return Skoli::getMenu();
- }
-
-}
class Skoli_Application extends Horde_Registry_Application
{
public $version = 'H4 (0.1-git)';
+
+ /**
+ * Generate the menu to use on the prefs page.
+ *
+ * @return Horde_Menu A Horde_Menu object.
+ */
+ public function prefsMenu()
+ {
+ return Skoli::getMenu();
+ }
+
}
}
/**
- * Code to run when viewing prefs for this application.
- *
- * @param string $group The prefGroup name.
- *
- * @return array A list of variables to export to the prefs display page.
- */
- public function prefsInit($group)
- {
- $out = array();
-
- /* Assign variables for select lists. */
- if (!$GLOBALS['prefs']->isLocked('default_dir')) {
- require TURBA_BASE . '/config/sources.php';
- $out['default_dir_options'] = array();
- foreach ($cfgSources as $key => $info) {
- $out['default_dir_options'][$key] = $info['title'];
- }
- }
-
- foreach (Turba::getAddressBooks() as $key => $curSource) {
- if (empty($curSource['map']['__uid'])) {
- continue;
- }
- if (!empty($curSource['browse'])) {
- $GLOBALS['_prefs']['sync_books']['enum'][$key] = $curSource['title'];
- }
- $sync_books = @unserialize($GLOBALS['prefs']->getValue('sync_books'));
- if (empty($sync_books)) {
- $GLOBALS['prefs']->setValue('sync_books', serialize(array(Turba::getDefaultAddressbook())));
- }
- }
-
- return $out;
- }
-
- /**
- * TODO
- */
- public function prefsHandle($item, $updated)
- {
- switch ($item) {
- case 'columnselect':
- $columns = Horde_Util::getFormData('columns');
- if (!empty($columns)) {
- $GLOBALS['prefs']->setValue('columns', $columns);
- return true;
- }
- break;
-
- case 'addressbookselect':
- $addressbooks = Horde_Util::getFormData('addressbooks');
- $GLOBALS['prefs']->setValue('addressbooks', str_replace("\r", '', $addressbooks));
- return true;
- }
-
- return $updated;
- }
-
- /**
- * Generate the menu to use on the prefs page.
- *
- * @return Horde_Menu A Horde_Menu object.
- */
- public function prefsMenu()
- {
- return Turba::getMenu();
- }
-
- /**
* Removes user data.
*
* @param string $user Name of user to remove data for.
*/
public $version = 'H3 (3.0-git)';
+ /**
+ * Code to run when viewing prefs for this application.
+ *
+ * @param string $group The prefGroup name.
+ *
+ * @return array A list of variables to export to the prefs display page.
+ */
+ public function prefsInit($group)
+ {
+ $out = array();
+
+ /* Assign variables for select lists. */
+ if (!$GLOBALS['prefs']->isLocked('default_dir')) {
+ require TURBA_BASE . '/config/sources.php';
+ $out['default_dir_options'] = array();
+ foreach ($cfgSources as $key => $info) {
+ $out['default_dir_options'][$key] = $info['title'];
+ }
+ }
+
+ foreach (Turba::getAddressBooks() as $key => $curSource) {
+ if (empty($curSource['map']['__uid'])) {
+ continue;
+ }
+ if (!empty($curSource['browse'])) {
+ $GLOBALS['_prefs']['sync_books']['enum'][$key] = $curSource['title'];
+ }
+ $sync_books = @unserialize($GLOBALS['prefs']->getValue('sync_books'));
+ if (empty($sync_books)) {
+ $GLOBALS['prefs']->setValue('sync_books', serialize(array(Turba::getDefaultAddressbook())));
+ }
+ }
+
+ return $out;
+ }
+
+ /**
+ * Special preferences handling on update.
+ *
+ * @param string $item The preference name.
+ * @param boolean $updated Set to true if preference was updated.
+ *
+ * @return boolean True if preference was updated.
+ */
+ public function prefsHandle($item, $updated)
+ {
+ switch ($item) {
+ case 'columnselect':
+ $columns = Horde_Util::getFormData('columns');
+ if (!empty($columns)) {
+ $GLOBALS['prefs']->setValue('columns', $columns);
+ return true;
+ }
+ break;
+
+ case 'addressbookselect':
+ $addressbooks = Horde_Util::getFormData('addressbooks');
+ $GLOBALS['prefs']->setValue('addressbooks', str_replace("\r", '', $addressbooks));
+ return true;
+ }
+
+ return $updated;
+ }
+
+ /**
+ * Generate the menu to use on the prefs page.
+ *
+ * @return Horde_Menu A Horde_Menu object.
+ */
+ public function prefsMenu()
+ {
+ return Turba::getMenu();
+ }
+
}