From: tokul Date: Mon, 28 Feb 2005 09:16:41 +0000 (+0000) Subject: adding size controls for newmail popup window. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c8f452aa3b90b15f58264a5ead0d61f10a1963aa;p=squirrelmail.git adding size controls for newmail popup window. removing dublicate getPref calls. using for right side comments. using html_tag function for table formating git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@8914 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/plugins/newmail/newmail_opt.php b/plugins/newmail/newmail_opt.php index 7fb1871c..f028ec60 100644 --- a/plugins/newmail/newmail_opt.php +++ b/plugins/newmail/newmail_opt.php @@ -24,13 +24,8 @@ include_once(SM_PATH . 'plugins/newmail/functions.php'); displayPageHeader($color, 'None'); -$media_enable = getPref($data_dir,$username, 'newmail_enable', 'FALSE' ); -$media_popup = getPref($data_dir, $username,'newmail_popup'); -$media_allbox = getPref($data_dir,$username,'newmail_allbox'); -$media_recent = getPref($data_dir,$username,'newmail_recent'); -$media_changetitle = getPref($data_dir,$username,'newmail_changetitle'); -$media = getPref($data_dir,$username,'newmail_media', '(none)'); -$media_userfile_name = getPref($data_dir,$username,'newmail_userfile_name',''); +// plugin uses squirrelmail loading_pref hook. +// vars are already loaded in include/validate.php echo html_tag( 'table', '', 'center', $color[0], 'width="95%" cellpadding="1" cellspacing="0" border="0"' ) . "\n" . html_tag( 'tr' ) . "\n" . @@ -73,7 +68,7 @@ echo html_tag( 'tr' ) . html_tag( 'td', _("Check all boxes, not just INBOX").':', 'right', '', 'style="white-space: nowrap;"' ) . html_tag( 'td', '', 'left' ) . '' . "\n"; @@ -83,7 +78,7 @@ echo html_tag( 'tr' ) . html_tag( 'td', _("Count only messages that are RECENT").':', 'right', '', 'style="white-space: nowrap;"' ) . html_tag( 'td', '', 'left' ) . '' . "\n"; @@ -93,20 +88,34 @@ echo html_tag( 'tr' ) . html_tag( 'td', _("Change title on supported browsers").':', 'right', '', 'style="white-space: nowrap;"' ) . html_tag( 'td', '', 'left' ) . ' ('._("requires JavaScript to work").')' . "\n"; +echo 'name="media_changetitle" /> ('._("requires JavaScript to work").')' . "\n"; // Option: media_popup echo html_tag( 'tr' ) . html_tag( 'td', _("Show popup window on new mail").':', 'right', '', 'style="white-space: nowrap;"' ) . html_tag( 'td', '', 'left' ) . ' ('._("requires JavaScript to work").')' . "\n"; +echo 'name="media_popup" /> ('._("requires JavaScript to work").')' . "\n"; + +echo html_tag( 'tr' ) + . html_tag('td',_("Width of popup window:"),'right','', 'style="white-space: nowrap;"') + . html_tag('td','' + . ' (' . _("If set to 0, reverts to default value") . ')','left') + . "\n"; + +echo html_tag( 'tr' ) + . html_tag('td',_("Height of popup window:"),'right','', 'style="white-space: nowrap;"') + . html_tag('td','' + . ' (' . _("If set to 0, reverts to default value") . ')','left') + . "\n"; if ($newmail_allowsound) { // Option: media_enable @@ -114,7 +123,7 @@ if ($newmail_allowsound) { html_tag( 'td', _("Enable Media Playing").':', 'right', '', 'style="white-space: nowrap;"' ) . html_tag( 'td', '', 'left' ) . '' . "\n"; @@ -125,7 +134,7 @@ if ($newmail_allowsound) { html_tag( 'td', '', 'left' ) . ''. @@ -178,30 +187,26 @@ if ($newmail_allowsound) { "'width=150,height=30,scrollbars=no');" . 'return false;' . '" />'; - echo ''. - '' . _("Upload Media File:") . - ''. - ''. - ''. - ''; - - echo ''. - '' . _("Uploaded Media File:") . - ''. - ($media_userfile_name!='' ? htmlspecialchars($media_userfile_name) : _("unavailable")). - ''. - ''; - - if ($media_userfile_name!='') { + echo html_tag('tr') + . html_tag('td',_("Upload Media File:"),'right','','style="white-space: nowrap;"') + . html_tag('td','') + . "\n"; + + echo html_tag('tr') + . html_tag('td',_("Uploaded Media File:"),'right','','style="white-space: nowrap;"') + . html_tag('td',($newmail_userfile_name!='' ? htmlspecialchars($newmail_userfile_name) : _("unavailable"))) + ."\n"; + + if ($newmail_userfile_name!='') { echo '' .'' - .sprintf(_("Media file %s will be removed, if you upload other media file."),basename($media_userfile_name)) + .sprintf(_("Media file %s will be removed, if you upload other media file."),basename($newmail_userfile_name)) .''; } echo html_tag( 'tr', "\n" . html_tag( 'td', _("Current File:"), 'right', '', 'style="white-space: nowrap;"' ) . html_tag( 'td', '' . + htmlspecialchars($newmail_media) . '" name="media_default" />' . htmlspecialchars($media_output) . '', 'left' ) ) . "\n"; } diff --git a/plugins/newmail/setup.php b/plugins/newmail/setup.php index a1b8be2a..456eb88f 100644 --- a/plugins/newmail/setup.php +++ b/plugins/newmail/setup.php @@ -118,18 +118,30 @@ function newmail_sav() { $media_recent = ''; $media_changetitle = ''; $media_sel = ''; + $popup_width = ''; + $popup_height = ''; sqgetGlobalVar('media_enable', $media_enable, SQ_POST); sqgetGlobalVar('media_popup', $media_popup, SQ_POST); sqgetGlobalVar('media_allbox', $media_allbox, SQ_POST); sqgetGlobalVar('media_recent', $media_recent, SQ_POST); sqgetGlobalVar('media_changetitle', $media_changetitle, SQ_POST); + sqgetGlobalVar('popup_width', $popup_width, SQ_POST); + sqgetGlobalVar('popup_height', $popup_height, SQ_POST); + + // sanitize height and width + $popup_width = (int) $popup_width; + if ($popup_width<=0) $popup_width=200; + $popup_height = (int) $popup_height; + if ($popup_height<=0) $popup_height=130; setPref($data_dir,$username,'newmail_enable',$media_enable); setPref($data_dir,$username,'newmail_popup', $media_popup); setPref($data_dir,$username,'newmail_allbox',$media_allbox); setPref($data_dir,$username,'newmail_recent',$media_recent); setPref($data_dir,$username,'newmail_changetitle',$media_changetitle); + setPref($data_dir,$username,'newmail_popup_width',$popup_width); + setPref($data_dir,$username,'newmail_popup_height',$popup_height); if( sqgetGlobalVar('media_sel', $media_sel, SQ_POST) && $media_sel == '(none)' ) { @@ -177,16 +189,20 @@ function newmail_pref() { global $username,$data_dir; global $newmail_media,$newmail_enable,$newmail_popup,$newmail_allbox; global $newmail_recent, $newmail_changetitle; - global $newmail_userfile_type; + global $newmail_userfile_type, $newmail_userfile_name; + global $newmail_popup_width, $newmail_popup_height; $newmail_recent = getPref($data_dir,$username,'newmail_recent'); $newmail_enable = getPref($data_dir,$username,'newmail_enable'); $newmail_media = getPref($data_dir, $username, 'newmail_media', '(none)'); $newmail_popup = getPref($data_dir, $username, 'newmail_popup'); + $newmail_popup_width = getPref($data_dir, $username, 'newmail_popup_width',200); + $newmail_popup_height = getPref($data_dir, $username, 'newmail_popup_height',130); $newmail_allbox = getPref($data_dir, $username, 'newmail_allbox'); $newmail_changetitle = getPref($data_dir, $username, 'newmail_changetitle'); $newmail_userfile_type = getPref($data_dir, $username, 'newmail_userfile_type'); + $newmail_userfile_name = getPref($data_dir,$username,'newmail_userfile_name',''); } /** @@ -209,6 +225,7 @@ function newmail_plugin() { $newmail_recent, $newmail_changetitle, $imapConnection, $PHP_SELF; global $newmail_mmedia, $newmail_allowsound; global $newmail_userfile_type; + global $newmail_popup_width, $newmail_popup_height; if ($newmail_enable == 'on' || $newmail_popup == 'on' || @@ -279,20 +296,20 @@ function newmail_plugin() { } if ($totalNew > 0 && $newmail_popup == 'on') { + // Idea by: Nic Wolfe (Nic@TimelapseProductions.com) + // Web URL: http://fineline.xs.mw + // More code from Tyler Akins echo "\n"; }