| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * SquirrelMail Preview Pane Plugin |
| 5 | * |
| 6 | * @copyright 1999-2013 The SquirrelMail Project Team |
| 7 | * @author Paul Lesniewski <paul@squirrelmail.org> |
| 8 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
| 9 | * @version $Id$ |
| 10 | * @package plugins |
| 11 | * @subpackage preview_pane |
| 12 | */ |
| 13 | |
| 14 | |
| 15 | /** |
| 16 | * Register this plugin with SquirrelMail |
| 17 | */ |
| 18 | function squirrelmail_plugin_init_preview_pane() |
| 19 | { |
| 20 | |
| 21 | global $squirrelmail_plugin_hooks; |
| 22 | |
| 23 | |
| 24 | $squirrelmail_plugin_hooks['subject_link']['preview_pane'] |
| 25 | = 'preview_pane_change_message_target'; |
| 26 | $squirrelmail_plugin_hooks['optpage_loadhook_display']['preview_pane'] |
| 27 | = 'preview_pane_show_options'; |
| 28 | $squirrelmail_plugin_hooks['template_construct_message_list.tpl']['preview_pane'] |
| 29 | = 'preview_pane_message_list'; |
| 30 | $squirrelmail_plugin_hooks['template_construct_page_header.tpl']['preview_pane'] |
| 31 | = 'preview_pane_open_close_buttons'; |
| 32 | |
| 33 | } |
| 34 | |
| 35 | |
| 36 | if (!defined('SM_PATH')) |
| 37 | define('SM_PATH', '../'); |
| 38 | |
| 39 | |
| 40 | /** |
| 41 | * Returns info about this plugin |
| 42 | */ |
| 43 | function preview_pane_info() |
| 44 | { |
| 45 | |
| 46 | return array( |
| 47 | 'english_name' => 'Preview Pane', |
| 48 | 'version' => '2.0', |
| 49 | 'required_sm_version' => '1.5.2', |
| 50 | 'requires_configuration' => 0, |
| 51 | 'requires_source_patch' => 0, |
| 52 | 'required_plugins' => array( |
| 53 | ), |
| 54 | 'summary' => 'Provides a third frame below the message list for viewing message bodies.', |
| 55 | 'details' => 'This plugin allows the user to turn on an extra frame below the mailbox message list where the messages themselves are displayed, very similar to many other popular (typically non-web-based) email clients.', |
| 56 | ); |
| 57 | |
| 58 | } |
| 59 | |
| 60 | |
| 61 | |
| 62 | /** |
| 63 | * Returns version info about this plugin |
| 64 | */ |
| 65 | function preview_pane_version() |
| 66 | { |
| 67 | |
| 68 | $info = preview_pane_info(); |
| 69 | return $info['version']; |
| 70 | |
| 71 | } |
| 72 | |
| 73 | |
| 74 | |
| 75 | /** |
| 76 | * Build user options for display on "Display Preferences" page |
| 77 | */ |
| 78 | function preview_pane_show_options() |
| 79 | { |
| 80 | |
| 81 | include_once(SM_PATH . 'plugins/preview_pane/functions.php'); |
| 82 | preview_pane_show_options_do(); |
| 83 | |
| 84 | } |
| 85 | |
| 86 | |
| 87 | |
| 88 | /** |
| 89 | * Construct button that clears out any preview pane |
| 90 | * contents and inserts JavaScript function used by |
| 91 | * message subject link onclick handler. Also disallows |
| 92 | * the message list to be loaded into the bottom frame. |
| 93 | */ |
| 94 | function preview_pane_message_list() |
| 95 | { |
| 96 | |
| 97 | include_once(SM_PATH . 'plugins/preview_pane/functions.php'); |
| 98 | return preview_pane_message_list_do(); |
| 99 | |
| 100 | } |
| 101 | |
| 102 | |
| 103 | |
| 104 | /** |
| 105 | * Points message targets to open in the preview pane |
| 106 | * (and possibly refresh message list as well) |
| 107 | */ |
| 108 | function preview_pane_change_message_target($args) |
| 109 | { |
| 110 | |
| 111 | include_once(SM_PATH . 'plugins/preview_pane/functions.php'); |
| 112 | preview_pane_change_message_target_do($args); |
| 113 | |
| 114 | } |
| 115 | |
| 116 | |
| 117 | |
| 118 | /** |
| 119 | * Adds preview pane open/close (and clear) buttons next to |
| 120 | * "provider link" |
| 121 | */ |
| 122 | function preview_pane_open_close_buttons() |
| 123 | { |
| 124 | |
| 125 | include_once(SM_PATH . 'plugins/preview_pane/functions.php'); |
| 126 | return preview_pane_open_close_buttons_do(); |
| 127 | |
| 128 | } |
| 129 | |
| 130 | |
| 131 | |