From: pdontthink Date: Wed, 15 Apr 2009 00:55:09 +0000 (+0000) Subject: Move HTML output from compose.php to templates. Also fixes broken send functionality... X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=253ad9426a8086ccde1a0bc1950adae6a2ad07c9;ds=sidebyside Move HTML output from compose.php to templates. Also fixes broken send functionality under some circumstances. Also removes compose_bottom hook. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@13540 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/src/compose.php b/src/compose.php index c42266a2..069623e3 100644 --- a/src/compose.php +++ b/src/compose.php @@ -1344,32 +1344,32 @@ function showInputForm ($session, $values=false) { } // End of file_uploads if-block /* End of attachment code */ -//FIXME: no direct echoing to browser, no HTML output in core! - echo addHidden('username', $username). - addHidden('smaction', $action). - addHidden('mailbox', $mailbox); + $oTemplate->assign('username', $username); + $oTemplate->assign('smaction', $action); + $oTemplate->assign('mailbox', $mailbox); sqgetGlobalVar('QUERY_STRING', $queryString, SQ_SERVER); -//FIXME: no direct echoing to browser, no HTML output in core! - echo addHidden('composesession', $composesession). - addHidden('querystring', $queryString). - (!empty($attach_array) ? - addHidden('attachments', urlencode(serialize($attach_array))) : ''). - "\n"; + $oTemplate->assign('querystring', $queryString); + $oTemplate->assign('composesession', $composesession); + $oTemplate->assign('send_button_count', unique_widget_name('send', TRUE)); + if (!empty($attach_array)) + $oTemplate->assign('attachments', urlencode(serialize($attach_array))); + + $aUserNotices = array(); + + // File uploads are off, so we didn't show that part of the form. + // To avoid bogus bug reports, tell the user why. if (!(bool) ini_get('file_uploads')) { - /* File uploads are off, so we didn't show that part of the form. - To avoid bogus bug reports, tell the user why. */ -//FIXME: no direct echoing to browser, no HTML output in core! - echo '

' - . _("Because PHP file uploads are turned off, you can not attach files to this message. Please see your system administrator for details.") - . "

\r\n"; + $aUserNotices[] = _("Because PHP file uploads are turned off, you can not attach files to this message. Please see your system administrator for details."); } + $oTemplate->assign('user_notices', $aUserNotices); + + $oTemplate->display('compose_form_close.tpl'); + if ($compose_new_win=='1') { $oTemplate->display('compose_newwin_close.tpl'); } - do_hook('compose_bottom', $null); - $oErrorHandler->setDelayedErrors(false); $oTemplate->display('footer.tpl'); } diff --git a/templates/default/compose_body.tpl b/templates/default/compose_body.tpl index 4f0e977a..f8503622 100644 --- a/templates/default/compose_body.tpl +++ b/templates/default/compose_body.tpl @@ -42,4 +42,3 @@ extract($t); ?> - diff --git a/templates/default/compose_form_close.tpl b/templates/default/compose_form_close.tpl new file mode 100644 index 00000000..263fa8e2 --- /dev/null +++ b/templates/default/compose_form_close.tpl @@ -0,0 +1,62 @@ + tag to the browser + * along with any other elements to be added before the form is closed out. + * + * Plugins can add output before the form is closed by registering on the + * "template_construct_compose_form_close.tpl" hook and return an array + * with a single key/value pair where the key is "compose_bottom" and the + * value is the desired output (typically some hidden form elements or some + * JavaScript). + * + * The following variables are available in this template: + * $plugin_output array An array of extra output that may be added by plugin(s). + * $username string The current user's username + * $smaction string The form action we have just finished processing + * $mailbox string The mailbox currently being viewed or acted upon + * $querystring string The current page view's query string arguments + * $composesession string The current message compose session ID (internal to SM; + * not the same as the PHP session ID) + * $send_button_count string The count of the number of send buttons on this screen + * $user_notices array A list of notices to be displayed to the user + * (usually just a notice about PHP file uploads + * being disabled causing the attachment form not + * to be displayed) + * $attachments string A serialized string containing information about + * any attachments being sent with this message + * (when no attachments have been added, this will + * not be provided here) + * + * @copyright © 1999-2009 The SquirrelMail Project Team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + * @version $Id$ + * @package squirrelmail + * @subpackage templates + */ + +/** extract template variables **/ +extract($t); + +/** Begin template **/ +?> + + + + + + + + + + + + + + + +' . $notice . "

\n"; +} ?> +