From: <pdo...@us...> - 2007-05-18 06:30:10
|
Revision: 12408 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=12408&view=rev Author: pdontthink Date: 2007-05-17 23:30:07 -0700 (Thu, 17 May 2007) Log Message: ----------- Add ability to collapse headers into one line; works with but is unrelated to preview pane functionality. Added Paths: ----------- trunk/squirrelmail/templates/default_advanced/read_headers.tpl Added: trunk/squirrelmail/templates/default_advanced/read_headers.tpl =================================================================== --- trunk/squirrelmail/templates/default_advanced/read_headers.tpl (rev 0) +++ trunk/squirrelmail/templates/default_advanced/read_headers.tpl 2007-05-18 06:30:07 UTC (rev 12408) @@ -0,0 +1,121 @@ +<?php +/** + * read_headers.tpl + * + * Template to display the envelope headers when viewing a message. + * + * The following variables are available in this template: + * + * $headers_to_display - Array containing the list of all elements that need + * to be displayed. The index of each element is the + * translated name of the field to be displayed. The + * value of each element is the value to be displayed + * for that field. Many values can be controled through + * additional templates. + * + * + * @copyright © 1999-2006 The SquirrelMail Project Team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + * @version $Id: read_headers.tpl 11998 2006-12-10 21:06:24Z pdontthink $ + * @package squirrelmail + * @subpackage templates + */ + +/** add required includes **/ + +/** extract template variables **/ +extract($t); + +/** Begin template **/ +?> +<div class="readHeaders"> +<table cellspacing="0" class="spacer"> + <tr> + <td> + </td> + </tr> +</table> +<table cellspacing="0" class="table2"> + <?php + + // detect if we want to show reduced header or regular (expanded) header list + // default is to show the reduced header when the preview pane is turned on + // + // note that this is an example of a template page making use of its own + // value placed on the page's query string; we like to keep things like + // that in the core, but for template-specific add-on functionalities, this + // kind of thing is perfectly acceptable + // + global $data_dir, $username, $PHP_SELF; + $use_previewPane = getPref($data_dir, $username, 'use_previewPane', 0); + $show_preview_pane = checkForJavascript() && $use_previewPane; + if (!sqGetGlobalVar('expand_header', $expand_header, SQ_FORM, 0)) + if (!$show_preview_pane) + $expand_header = 1; + + // show reduced (collapsed) header + if (!$expand_header) { + + $subject = (!empty($headers_to_display['Subject']) + ? $headers_to_display['Subject'] : _("(no subject)")); + $date = (!empty($headers_to_display['Date']) + ? $headers_to_display['Date'] : _("Unknown date")); + $from = (!empty($headers_to_display['From']) + ? $headers_to_display['From'] : _("Unknown sender")); + // if available, print "real" name instead of email addr + if (strpos($from,"<") !== FALSE) { + list($from, $ignore) = $parts = explode('<', $from); + $from = trim($from); + $from = preg_replace('/^( )+|( )+$/', '', $from); + $from = preg_replace('/^(")+|(")+$/', '', $from); + $from = preg_replace('/"$/', '', trim($from)); + } + $reduced_header = sprintf(_("<b>%s</b> From <b>%s</b> On <b>%s</b>"), $subject, $from, $date); + $expand_link = str_replace('&expand_header=0', '', $PHP_SELF) . '&expand_header=1'; + + echo '<tr><td colspan="2" align="center" valign="top">' + . '<a href="' . $expand_link . '">' + . getIcon($icon_theme_path, 'plus.png', '-', _("Expand Header")) + . '</a> ' + . $reduced_header + . '</td></tr>'; + + // show normal/full/expanded header listing + } else { + + $collapse_link = str_replace('&expand_header=1', '', $PHP_SELF) . '&expand_header=0'; + $first_time = TRUE; + foreach ($headers_to_display as $field_name=>$value) { + if (empty($value)) { + # Skip enpty headers + continue; + } + ?> + <tr> + <td class="fieldName"> +<?php + if ($first_time) + echo '<a href="' . $collapse_link . '">' + . getIcon($icon_theme_path, 'minus.png', '-', _("Collapse Header")) + . '</a> '; + echo $field_name . ':'; + $first_time = FALSE; +?> + </td> + <td class="fieldValue"> + <?php echo $value; ?> + </td> + </tr> +<?php + } + } + if (!empty($plugin_output['read_body_header'])) echo $plugin_output['read_body_header']; +?> +</table> +<table cellspacing="0" class="spacer"> + <tr> + <td> + </td> + </tr> +</table> +</div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pdo...@us...> - 2008-01-05 11:22:16
|
Revision: 12858 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=12858&view=rev Author: pdontthink Date: 2008-01-05 03:22:08 -0800 (Sat, 05 Jan 2008) Log Message: ----------- Allow preview pane message list refresh mechanism to be forced by others Modified Paths: -------------- trunk/squirrelmail/templates/default_advanced/read_headers.tpl Modified: trunk/squirrelmail/templates/default_advanced/read_headers.tpl =================================================================== --- trunk/squirrelmail/templates/default_advanced/read_headers.tpl 2008-01-05 11:19:29 UTC (rev 12857) +++ trunk/squirrelmail/templates/default_advanced/read_headers.tpl 2008-01-05 11:22:08 UTC (rev 12858) @@ -122,6 +122,9 @@ <?php // do a conditional refresh of message list if needed // "pp_rr" = "preview pane read refresh" -if (sqGetGlobalVar('pp_rr', $pp_rr, SQ_FORM) && $show_preview_pane && $first_time_reading) { - echo "<script language=\"JavaScript\" type=\"text/javascript\">\n<!--\nif (self.name == 'bottom') { refresh_message_list(); }\n// -->\n</script>\n"; +// "pp_rr_force" = force pp_rr even if this is not the first time the message has been read +if ($show_preview_pane + && (sqGetGlobalVar('pp_rr_force', $pp_rr_force, SQ_FORM) + || (sqGetGlobalVar('pp_rr', $pp_rr, SQ_FORM) && $first_time_reading))) { + echo "<script language=\"JavaScript\" type=\"text/javascript\">\n<!--\nif (self.name == 'bottom') { refresh_message_list(); }\n// -->\n</script>\n"; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2008-01-15 09:08:37
|
Revision: 12882 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=12882&view=rev Author: jervfors Date: 2008-01-15 01:08:36 -0800 (Tue, 15 Jan 2008) Log Message: ----------- Removing HTML from a string. Modified Paths: -------------- trunk/squirrelmail/templates/default_advanced/read_headers.tpl Modified: trunk/squirrelmail/templates/default_advanced/read_headers.tpl =================================================================== --- trunk/squirrelmail/templates/default_advanced/read_headers.tpl 2008-01-15 09:08:04 UTC (rev 12881) +++ trunk/squirrelmail/templates/default_advanced/read_headers.tpl 2008-01-15 09:08:36 UTC (rev 12882) @@ -70,7 +70,8 @@ $from = preg_replace('/^(")+|(")+$/', '', $from); $from = preg_replace('/"$/', '', trim($from)); } - $reduced_header = sprintf(_("<b>%s</b> From <b>%s</b> On <b>%s</b>"), $subject, $from, $date); + // i18n: The parameters are: subject, sender, and date. + $reduced_header = sprintf(_("%s from %s on %s"), "<b>$subject</b>", "<b>$from</b>", "<b>$date</b>"); $expand_link = str_replace('&expand_header=0', '', $PHP_SELF) . '&expand_header=1'; echo '<tr><td colspan="2" align="center" valign="top">' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pdo...@us...> - 2008-01-15 20:00:15
|
Revision: 12884 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=12884&view=rev Author: pdontthink Date: 2008-01-15 12:00:14 -0800 (Tue, 15 Jan 2008) Log Message: ----------- Using str_replace instead of sprintf because some languages need to change the order of the replaced strings Modified Paths: -------------- trunk/squirrelmail/templates/default_advanced/read_headers.tpl Modified: trunk/squirrelmail/templates/default_advanced/read_headers.tpl =================================================================== --- trunk/squirrelmail/templates/default_advanced/read_headers.tpl 2008-01-15 09:10:53 UTC (rev 12883) +++ trunk/squirrelmail/templates/default_advanced/read_headers.tpl 2008-01-15 20:00:14 UTC (rev 12884) @@ -71,7 +71,9 @@ $from = preg_replace('/"$/', '', trim($from)); } // i18n: The parameters are: subject, sender, and date. - $reduced_header = sprintf(_("%s from %s on %s"), "<b>$subject</b>", "<b>$from</b>", "<b>$date</b>"); + $reduced_header = str_replace(array('%1', '%2', '%3'), + array("<b>$subject</b>", "<b>$from</b>", "<b>$date</b>"), + _("%1 from %2 on %3")); $expand_link = str_replace('&expand_header=0', '', $PHP_SELF) . '&expand_header=1'; echo '<tr><td colspan="2" align="center" valign="top">' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Alexandros V. <av...@no...> - 2008-01-15 21:42:00
|
On Tue, 15 Jan 2008 12:00:14 -0800 pdo...@us... wrote: > Using str_replace instead of sprintf because some languages need to > change the order of the replaced strings Nah, translators can already do this with sprintf() . To quote php manual: $format = 'The %2$s contains %1$d monkeys. That\'s a nice %2$s full of %1$d monkeys.'; i.e. a translator can use %2$s instead of %s to change order in his string. I suggest reverting to sprintf-syntax. :-) Alexandros |
From: Paul L. <pa...@sq...> - 2008-01-15 22:27:30
|
On Jan 15, 2008 1:41 PM, Alexandros Vellis <av...@no...> wrote: > On Tue, 15 Jan 2008 12:00:14 -0800 > pdo...@us... wrote: > > > Using str_replace instead of sprintf because some languages need to > > change the order of the replaced strings > > Nah, translators can already do this with sprintf() . To quote > php manual: > > $format = 'The %2$s contains %1$d monkeys. > That\'s a nice %2$s full of %1$d monkeys.'; > > i.e. a translator can use %2$s instead of %s to change order in his > string. > > I suggest reverting to sprintf-syntax. :-) ok |