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