Skip to content

Commit

Permalink
[mms] Add 'dynamic_prefs' hook to allow for changing of default value…
Browse files Browse the repository at this point in the history
…s for browser-based preferences in dynamic view.
  • Loading branch information
slusarz committed Aug 15, 2014
1 parent 2aab31c commit ce36d5e
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 1 deletion.
37 changes: 37 additions & 0 deletions imp/config/hooks.php.dist
Expand Up @@ -607,6 +607,43 @@ class IMP_Hooks
// }


/**
* Default browser-based preference values for the dynamic view.
* Any value not returned here will use the default value (listed below).
*
* @return array The list of pref keys / default values.
*/
public function dynamic_prefs()
{
return array(
/* Preview pane. Valid values:
* - 'horiz': Horizontal mode
* - 'vert': Vertical mode
* - [empty value]: No preview */
// 'preview' => 'horiz',

/* Quicksearch field (search box on mailbox page). Valid values:
* - 'all': Search entire message (body & headers)
* - 'body': Search message body
* - 'from': Search from header
* - 'recip': Search recipients (To/CC/BCC) headers
* - 'subject': Search subject */
// qsearch_field: 'all',

/* Splitbar (horizontal) height. Value is number of messages to
* show. 0 means auto-determine default size. */
// splitbar_horiz: 0,

/* Splitbar (vertical) width. Value is width (in pixels) of the
* mailbox listing. 0 means auto-determine default size. */
// splitbar_vert: 0,

/* Toggle headers in preview. 1 to show headers, 0 to hide. */
// toggle_hdrs: 0,
);
}


/**
* Dynamically disable composing messages.
*
Expand Down
2 changes: 2 additions & 0 deletions imp/docs/CHANGES
Expand Up @@ -2,6 +2,8 @@
v6.3.0-git
----------

[mms] Add 'dynamic_prefs' hook to allow for changing of default values for
browser-based preferences in dynamic view.
[mms] Removed compose 'use_vfs' configuration option.
[mjr] Add IMP_Api::addFlags().
[mms] Allow multiple independent attachment actions on the dynamic compose
Expand Down
8 changes: 8 additions & 0 deletions imp/docs/UPGRADING
Expand Up @@ -53,6 +53,14 @@ The following options have been removed::
$conf['compose']['use_vfs']


Hooks (hooks.php)
-----------------

The following hooks have been added::

dynamic_prefs



Upgrading IMP From 6.1.x To 6.2
===============================
Expand Down
15 changes: 14 additions & 1 deletion imp/lib/Script/Package/DynamicBase.php
Expand Up @@ -28,7 +28,20 @@ class IMP_Script_Package_DynamicBase extends Horde_Script_Package
*/
public function __construct()
{
$this->_files[] = new Horde_Script_File_JsDir('dimpcore.js', 'imp');
global $injector;

$ob = new Horde_Script_File_JsDir('dimpcore.js', 'imp');

try {
$hooks = $injector->getInstance('Horde_Core_Hooks');
$dprefs = $hooks->callHook('dynamic_prefs', 'imp');
foreach ($dprefs as $key => $val) {
$ob->jsvars['DimpCore.prefs.' . $key] = $val;
}
} catch (Horde_Exception $e) {}

$this->_files[] = $ob;

$this->_files[] = new Horde_Script_File_JsDir('viewport_utils.js', 'imp');
$this->_files[] = new Horde_Script_File_JsDir('contextsensitive.js', 'horde');
$this->_files[] = new Horde_Script_File_JsDir('imple.js', 'horde');
Expand Down
1 change: 1 addition & 0 deletions imp/package.xml
Expand Up @@ -33,6 +33,7 @@
</stability>
<license uri="http://www.horde.org/licenses/gpl">GPL-2.0</license>
<notes>
* [mms] Add &apos;dynamic_prefs&apos; hook to allow for changing of default values for browser-based preferences in dynamic view.
* [mms] Removed compose &apos;use_vfs&apos; configuration option.
* [mjr] Add IMP_Api::addFlags().
* [mms] Allow multiple independent attachment actions on the dynamic compose screen.
Expand Down

0 comments on commit ce36d5e

Please sign in to comment.