Source for file functions.php
Documentation is available at functions.php
* SquirrelMail Preview Pane Plugin
* @copyright 1999-2020 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: functions.php 14845 2020-01-07 08:09:34Z pdontthink $
* @subpackage preview_pane
* Build user options for display on "Display Preferences" page
global $data_dir, $username;
$use_previewPane =
getPref($data_dir, $username, 'use_previewPane', 0);
$previewPane_vertical_split =
getPref($data_dir, $username, 'previewPane_vertical_split', 0);
$previewPane_size =
getPref($data_dir, $username, 'previewPane_size', 300);
$pp_refresh_message_list =
getPref($data_dir, $username, 'pp_refresh_message_list', 1);
$previewPane_autohide =
getPref($data_dir, $username, 'previewPane_autohide', 0);
$optpage_data['vals'][1][] =
array(
'name' =>
'use_previewPane',
'caption' =>
_("Show Message Preview Pane"),
'initial_value' =>
$use_previewPane,
$optpage_data['vals'][1][] =
array(
'name' =>
'previewPane_vertical_split',
'caption' =>
_("Split Preview Pane Vertically"),
'initial_value' =>
$previewPane_vertical_split,
$optpage_data['vals'][1][] =
array(
'name' =>
'previewPane_size',
'caption' =>
_("Message Preview Pane Size"),
'initial_value' =>
$previewPane_size,
$optpage_data['vals'][1][] =
array(
'name' =>
'pp_refresh_message_list',
'caption' =>
_("Always Refresh Message List<br />When Using Preview Pane"),
'initial_value' =>
$pp_refresh_message_list,
$optpage_data['vals'][1][] =
array(
'name' =>
'previewPane_autohide',
'caption' =>
_("Automatically Hide Preview Pane<br />When Not Reading Messages"),
'initial_value' =>
$previewPane_autohide,
* This function determines if the preview pane is in use
* (and JavaScript is available)
* @return boolean TRUE if the preview pane should be showing currently.
global $data_dir, $username;
$use_previewPane =
getPref($data_dir, $username, 'use_previewPane', 0);
* Adds preview pane open/close (and clear) buttons next to
global $data_dir, $username, $base_uri, $oTemplate;
$previewPane_vertical_split =
getPref($data_dir, $username, 'previewPane_vertical_split', 0);
if ($previewPane_vertical_split)
$previewPane_size =
getPref($data_dir, $username, 'previewPane_size', 300);
$oTemplate->assign('previewPane_size', $previewPane_size);
$oTemplate->assign('base_uri', $base_uri);
$oTemplate->assign('orientation', $orientation);
$oTemplate->assign('down_arrow', $down_arrow, FALSE);
$oTemplate->assign('up_arrow', $up_arrow, FALSE);
$output =
$oTemplate->fetch('plugins/preview_pane/collapse_buttons.tpl');
return array('provider_link_before' =>
$output);
* Construct button that clears out any preview pane
* contents and inserts JavaScript function used by
* message subject link onclick handler. Also disallows
* the message list to be loaded into the bottom frame.
// globalize $pp_refresh_top, $pp_forceTopURL and $pp_noPageHeader to synch
// with other plugins (sent_confirmation, for example)
global $plugins, $archive_mail_button_has_been_printed,
$username, $data_dir, $PHP_SELF, $base_uri, $pp_refresh_top,
$pp_forceTopURL, $pp_noPageHeader;
$use_previewPane =
getPref($data_dir, $username, 'use_previewPane', 0);
// add refresh function called from code built in function
// preview_pane_change_message_target_do()
if ($use_previewPane ==
1)
// Bah, let's put this in anyway (even when the "always refresh thing is off),
// in case someone else wants to use it
// && getPref($data_dir, $username, 'pp_refresh_message_list', 1) == 1)
// sqgetGlobalVar('REQUEST_URI', $request_uri, SQ_SERVER);
$request_uri =
$PHP_SELF;
$output .=
"<script type=\"text/javascript\" language=\"JavaScript\">\n<!--\n function pp_refresh() { document.location = '$request_uri'; }\n// -->\n</script>\n";
if ($use_previewPane ==
1)
// why isn't this already available?
include_once(SM_PATH .
'functions/forms.php');
$output .=
addButton(_("Clear Preview"), 'clear_preview',
array('onclick' =>
'parent.bottom.document.location=\''
.
$base_uri .
'plugins/preview_pane/empty_frame.php\'; '))
// don't let message list load into preview pane at all
.
"\n<script language='JavaScript' type='text/javascript'>\n"
.
" if (self.name == 'bottom')\n"
// NOTE: we can also force the top frame to the URL that was being
// loaded in the bottom, but this is usually overkill...
// unless another plugin told us to do so (such as sent_confirmation)
if ($pp_forceTopURL ==
'yes')
// $output .= " parent.right.document.location = '" . $_SERVER['REQUEST_URI'] . "&pp=yes';\n";
$output .=
" parent.right.document.location = '" .
$PHP_SELF .
"&pp=yes';\n";
// if someone else asks for it, force the message list to reload
else if ($pp_refresh_top)
$output.=
" if (typeof(parent.right.pp_refresh) != 'undefined')\n"
.
" parent.right.pp_refresh()\n\n";
$output .=
" document.location = '" .
$base_uri .
"plugins/preview_pane/empty_frame.php'\n"
return array('mailbox_index_after' =>
$output);
* Points message targets to open in the preview pane
* (and possibly refresh message list as well)
global $data_dir, $username, $target, $onclick, $PHP_SELF;
// sqgetGlobalVar('REQUEST_URI', $request_uri, SQ_SERVER);
$request_uri =
$PHP_SELF;
if (getPref($data_dir, $username, 'use_previewPane', 0) ==
1)
$pp_refresh_message_list =
getPref($data_dir, $username, 'pp_refresh_message_list', 1);
// introduce a delay so read messages actually
// refresh after they are read, but only if they
// have not already been seen
if ($pp_refresh_message_list &&
empty($aMsg['FLAGS']['\seen']))
// old code without refresh delay
// $onclick .= ' onclick="document.location=\'' . $request_uri . '\'; " ';
$onclick .=
' setTimeout(\'pp_refresh()\', 500); ';
Documentation generated on Mon, 13 Jan 2020 04:22:32 +0100 by phpDocumentor 1.4.3