Update preview pane functionality so it only refreshes message list when viewing...
[squirrelmail.git] / templates / default_advanced / read_menubar_nav.tpl
1 <?php
2 /**
3 * read_menubar_nav.tpl
4 *
5 * Template to generate the nav buttons while reading a message, e.g. "Previous",
6 * "Next", "Delete & Previous", etc. When used in conjunction with the
7 * read_menubar_nav tempalte, the entire menubar is generated.
8 *
9 * The following variables are available in this template:
10 * $nav_on_top - boolean TRUE if the navigation buttons are on top of the
11 * action buttons generated here.
12 * $prev_href - URL to move to the previous message. Empty if not avilable.
13 * $up_href - URL to move up in the message. Empty if not available.
14 * $next_href - URL to move to the next nessage. Empty when N/A.
15 * $del_prev_href - URL to delete this message and move to the next one. Empty if N/A.
16 * $del_next_href - URL to delete this message and move to the next one. Empty if N/A.
17 * $view_msg_href - URL to go back to the main message. Empty if N/A.
18 * $msg_list_href - URL to go to the message list.
19 * $search_href - URL to go back to the serach results. Empty if N/A.
20 * $form_extra - Extra elements required by the forms to delete, move or copy
21 * $compose_href - Base URL to forward, reply, etc. Note that a specific action
22 * must also be given by the form or in this URL.
23 * $on_click - Onclick event string for all buttons
24 * $forward_as_attachment_enabled - boolean TRUE if forwarding as attachments
25 * has been enabled.
26 * $can_resume_draft - boolean TRUE if the "resume draft" is legitimate for
27 * this message.
28 * $can_edit_as_new - boolean TRUE if the "reasume as new" action is legitimate
29 * for this message
30 * $mailboxes - array containing list of mailboxes available for move/copy action.
31 * $can_be_deleted - boolean TRUE if this message can be deleted.
32 * $can_be_moved - boolean TRUE if this message can be moved.
33 * $cab_be_copied - boolean TRUE if this message can be copied to another folder.
34 * $move_delete_form_action - the value for the ACTION attribute of forms to
35 * move, copy or delete a message
36 * $delete_form_extra - additional input elements needed by the DELETE form
37 * $move_form_extra - additional input elements needed by the MOVE form.
38 * $last_move_target - the last folder that a message was moved/copied to.
39 * *
40 * @copyright &copy; 1999-2006 The SquirrelMail Project Team
41 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
42 * @version $Id: read_menubar_nav.tpl 11850 2006-10-06 21:57:26Z stevetruckstuff $
43 * @package squirrelmail
44 * @subpackage templates
45 */
46
47 /** add required includes **/
48
49 /** extract template variables **/
50 extract($t);
51
52
53 /*FIXME: This is a place where Marc's idea for putting all the buttons and
54 links and other widgets into an array is sorely needed instead of
55 hard-coding everything. Whomever implements that, PLEASE, PLEASE
56 look at how the preview pane plugin code is used here to change
57 some links and buttons and make sure your implementation can support
58 it (tip: it may or may not be OK to let a plugin do the modification
59 of the widgets, since a template set can turn on the needed plugin,
60 but that might not be the most clear way to solve said issue).*/
61
62
63 /** preview pane prep */
64 global $data_dir, $username, $base_uri;
65 $pp_refresh_message_list = getPref($data_dir, $username, 'pp_refresh_message_list', 1);
66 $use_previewPane = getPref($data_dir, $username, 'use_previewPane', 0);
67 $show_preview_pane = checkForJavascript() && $use_previewPane;
68 $empty_frame_uri = $base_uri . 'plugins/preview_pane/empty_frame.php';
69 if ($show_preview_pane) { ?>
70 <script>
71 <!--
72 function refresh_message_list()
73 {
74 if (typeof(parent.right.delayed_page_load) != 'undefined')
75 parent.right.delayed_page_load("<?php echo $message_list_href; ?>");
76 }
77 // -->
78 </script>
79 <?php }
80
81
82 /** Begin template **/
83
84 if ($nav_on_top) {
85 $table_class = 'top';
86 $plugin_hook = 'read_body_menu_nav_top';
87 } else {
88 $table_class = 'bottom';
89 $plugin_hook = 'read_body_menu_nav_bottom';
90 }
91 ?>
92 <div class="readMenuBar">
93 <table cellspacing="0" class="<?php echo $table_class; ?>">
94 <tr class="nav">
95 <td class="nav">
96 <small>
97 [
98 <?php
99 if (empty($prev_href)) {
100 echo _("Previous");
101 } else {
102 ?>
103 <a href="<?php echo $prev_href; ?><?php
104
105 /** if preview pane turned on with "always refresh message list",
106 refresh message list frame too, but only if we are in the bottom frame!
107 and make sure the refresh is conditional upon the seen flag of the
108 message after it is loaded (see read_headers.tpl) */
109 if ($show_preview_pane && $pp_refresh_message_list)
110 // old code: unconditional refresh
111 //echo ' onclick="if (self.name == \'bottom\') { refresh_message_list(); } "';
112 echo '&amp;pp_rr=1';
113
114
115 echo '">' . _("Previous"); ?></a>
116 <?php
117 }
118 ?> |
119 <?php
120 if (empty($up_href)) {
121 # Do nothing
122 } else {
123 ?>
124 <a href="<?php echo $up_href; ?>"><?php echo _("Up"); ?></a> |
125 <?php
126 }
127
128 if (empty($next_href)) {
129 echo _("Next");
130 } else {
131 ?>
132 <a href="<?php echo $next_href; ?><?php
133
134 /** if preview pane turned on with "always refresh message list",
135 refresh message list frame too, but only if we are in the bottom frame!
136 and make sure the refresh is conditional upon the seen flag of the
137 message after it is loaded (see read_headers.tpl) */
138 if ($show_preview_pane && $pp_refresh_message_list)
139 // old code: unconditional refresh
140 //echo ' onclick="if (self.name == \'bottom\') { refresh_message_list(); } "';
141 echo '&amp;pp_rr=1';
142
143
144 echo '">' . _("Next"); ?></a>
145 <?php
146 }
147 ?>
148 ]
149 &nbsp;&nbsp;&nbsp;&nbsp;
150 <?php
151 if (!empty($del_prev_href) || !empty($del_next_href)) {
152 ?>
153 [
154 <?php
155 if (empty($del_prev_href)) {
156 echo _("Delete &amp; Previous");
157 } else {
158 ?>
159 <a href="<?php echo $del_prev_href; ?>"<?php
160
161 /** if preview pane turned on with "always refresh message list",
162 refresh message list frame too, but only if we are in the bottom frame! */
163 if ($show_preview_pane && $pp_refresh_message_list)
164 echo ' onclick="if (self.name == \'bottom\') { refresh_message_list(); } "';
165
166
167 echo '>' . _("Delete &amp; Previous"); ?></a>
168 <?php
169 }
170 ?>
171 |
172 <?php
173 if (empty($del_next_href)) {
174 echo _("Delete &amp; Next");
175 } else {
176 ?>
177 <a href="<?php echo $del_next_href; ?>"<?php
178
179 /** if preview pane turned on with "always refresh message list",
180 refresh message list frame too, but only if we are in the bottom frame! */
181 if ($show_preview_pane && $pp_refresh_message_list)
182 echo ' onclick="if (self.name == \'bottom\') { refresh_message_list(); } "';
183
184
185 echo '>' . _("Delete &amp; Next"); ?></a>
186 <?php
187 }
188 ?>
189 ]
190 &nbsp;&nbsp;&nbsp;&nbsp;
191 <?php
192 }
193
194 if (!empty($view_msg_href)) {
195 ?>
196 [ <a href="<?php echo $view_msg_href; ?>"><?php echo _("View Message"); ?></a> ]
197 &nbsp;&nbsp;&nbsp;&nbsp;
198 <?php
199 }
200 ?>
201 [ <a href="<?php echo $message_list_href; ?>"<?php
202
203 /** if preview pane turned on, retarget to message list frame & clear
204 bottom frame, but only if we are in the bottom frame! */
205 if ($show_preview_pane)
206 echo ' onclick="if (self.name == \'bottom\') { parent.right.document.location=\'' . $message_list_href . '\'; document.location=\'' . $empty_frame_uri . '\'; return false; } "';
207
208
209 echo '>' . _("Message List"); ?></a>
210 <?php
211 if (!empty($search_href)) {
212 ?>
213 | <a href="<?php echo $search_href; ?>"><?php echo _("Search Results"); ?></a>
214 <?php
215 }
216 ?>
217 ]
218 </small>
219 <?php if(!empty($plugin_output[$plugin_hook])) echo $plugin_output[$plugin_hook]; ?>
220 </td>
221 </tr>
222 </table>
223 </div>