Refactor message list control widgets into their own template file; useful if we...
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 1 Jan 2007 00:37:42 +0000 (00:37 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 1 Jan 2007 00:37:42 +0000 (00:37 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12041 7612ce4b-ef26-0410-bec9-ea0150e637f0

templates/default/message_list.tpl
templates/default/message_list_controls.tpl [new file with mode: 0644]

index a8623307935564670181d86986e9fb80892cc9aa..712ab353cfda96e537c0fba76c7f579f132e2d43 100644 (file)
@@ -147,69 +147,14 @@ $clickedColor = (empty($color[16])) ? $color[2] : $color[16];
 <!-- start message list form control -->
       <tr class="message_list_controls">
         <td>
-          <table class="table_empty" cellspacing="0">
-            <tr>
-              <td class="message_control_buttons">
-
-<?php
-        foreach ($aFormElements as $widget_name => $widget_attrs) {
-            switch ($widget_attrs['type']) {
-            case 'submit':
-                if ($widget_name != 'moveButton' && $widget_name != 'copyButton' && $widget_name != 'delete' && $widget_name != 'undeleteButton') { // add these later in another table cell
-                    echo '<input type="submit" name="' . $widget_name . '" value="' . $widget_attrs['value'] . '" class="message_control_button" />&nbsp;';
-                }
-                break;
-            case 'checkbox':
-                if ($widget_name != 'bypass_trash') {
-                    echo '<input type="checkbox" name="' . $widget_name . '" id="' . $widget_name . '" /><label for="' . $widget_name . '">' . $widget_attrs['value'] . '</label>&nbsp;';
-                }
-                break;
-            case 'hidden':
-                echo '<input type="hidden" name="'.$widget_name.'" value="'. $widget_attrs['value']."\">\n";
-                break;
-            default: break;
-            }
-        }
-?>
-              </td>
-              <td class="message_control_delete">
-<?php
-        if (isset($aFormElements['delete'])) {
-            echo '<input type="submit" name="delete" value="' . $aFormElements['delete']['value'] . '" class="message_control_button" />&nbsp;';
-            if (isset($aFormElements['bypass_trash'])) {
-                echo '<input type="checkbox" name="bypass_trash" id="bypass_trash" /><label for="bypass_trash">' . $aFormElements['bypass_trash']['value'] . '</label>&nbsp;';
-            }
-            if (isset($aFormElements['undeleteButton'])) {
-                echo '<input type="submit" name="undeleteButton" value="' . $aFormElements['undeleteButton']['value'] . '" class="message_control_button" />&nbsp;';
-            }
-?>
-
-              </td>
-
-<?php
-        } // if (isset($aFormElements['delete']))
-        if (isset($aFormElements['moveButton']) || isset($aFormElements['copyButton'])) {
-?>
-              <td class="message_control_move">
-                    <select name="targetMailbox">
-                       <?php echo $aFormElements['targetMailbox']['options_list'];?>
-                    </select>
-<?php         
-            if (isset($aFormElements['moveButton'])) { 
-                echo '<input type="submit" name="moveButton" value="' . $aFormElements['moveButton']['value'] . '" class="message_control_button" />';
-            }
-            if (isset($aFormElements['copyButton'])) {
-                echo '<input type="submit" name="copyButton" value="' . $aFormElements['copyButton']['value'] . '" class="message_control_button" />';
-            } 
-?>
-
-              </td>
-
-<?php
-        } // if (isset($aFormElements['moveButton']) || isset($aFormElements['copyButton']))
-?>
-            </tr>
-          </table>
+                  <?php
+                     /**
+                       * The following line gets the output from a separate
+                       * template altogether (called "message_list_controls.tpl").
+                       * $this is the Template class object.
+                       */
+                      $message_list_controls = $this->fetch('message_list_controls.tpl');
+                      echo $message_list_controls ."\n"; ?>
         </td>
       </tr>
 <!-- end message list form control -->
diff --git a/templates/default/message_list_controls.tpl b/templates/default/message_list_controls.tpl
new file mode 100644 (file)
index 0000000..bd650ed
--- /dev/null
@@ -0,0 +1,144 @@
+<?php
+
+/**
+ * message_list_controls.tpl
+ *
+ * Template for the form control widgets on the message list page
+ *
+ * The following variables are available in this template:
+//FIXME: need to clean (and document) this list, it is just a dump of the array keys of $t
+ *    $sTemplateID
+ *    $icon_theme_path
+ *    $javascript_on
+ *    $delayed_errors
+ *    $frames
+ *    $lang
+ *    $page_title
+ *    $header_tags
+ *    $plugin_output
+ *    $header_sent
+ *    $body_tag_js
+ *    $shortBoxName
+ *    $sm_attribute_str
+ *    $frame_top
+ *    $urlMailbox
+ *    $startMessage
+ *    $hide_sm_attributions
+ *    $uri
+ *    $text
+ *    $onclick
+ *    $class
+ *    $id
+ *    $target
+ *    $color
+ *    $form_name
+ *    $form_id
+ *    $page_selector
+ *    $page_selector_max
+ *    $messagesPerPage
+ *    $showall
+ *    $end_msg
+ *    $align
+ *    $iNumberOfMessages
+ *    $aOrder
+ *    $aFormElements
+ *    $sort
+ *    $pageOffset
+ *    $baseurl
+ *    $aMessages
+ *    $trash_folder
+ *    $sent_folder
+ *    $draft_folder
+ *    $thread_link_str
+ *    $php_self
+ *    $mailbox
+ *    $enablesort
+ *    $icon_theme
+ *    $use_icons
+ *    $alt_index_colors
+ *    $fancy_index_highlite
+ *    $aSortSupported
+ *    $show_label_columns
+ *    $compact_paginator
+ *    $aErrors
+ *
+ * @copyright &copy; 1999-2006 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id$
+ * @package squirrelmail
+ * @subpackage templates
+ */
+
+
+/* retrieve the template vars */
+extract($t);
+
+
+    if (count($aFormElements)) {
+?>
+          <table class="table_empty" cellspacing="0">
+            <tr>
+              <td class="message_control_buttons">
+
+<?php
+        foreach ($aFormElements as $widget_name => $widget_attrs) {
+            switch ($widget_attrs['type']) {
+            case 'submit':
+                if ($widget_name != 'moveButton' && $widget_name != 'copyButton' && $widget_name != 'delete' && $widget_name != 'undeleteButton') { // add these later in another table cell
+                    echo '<input type="submit" name="' . $widget_name . '" value="' . $widget_attrs['value'] . '" class="message_control_button" />&nbsp;';
+                }
+                break;
+            case 'checkbox':
+                if ($widget_name != 'bypass_trash') {
+                    echo '<input type="checkbox" name="' . $widget_name . '" id="' . $widget_name . '" /><label for="' . $widget_name . '">' . $widget_attrs['value'] . '</label>&nbsp;';
+                }
+                break;
+            case 'hidden':
+                echo '<input type="hidden" name="'.$widget_name.'" value="'. $widget_attrs['value']."\">\n";
+                break;
+            default: break;
+            }
+        }
+?>
+              </td>
+              <td class="message_control_delete">
+<?php
+        if (isset($aFormElements['delete'])) {
+            echo '<input type="submit" name="delete" value="' . $aFormElements['delete']['value'] . '" class="message_control_button" />&nbsp;';
+            if (isset($aFormElements['bypass_trash'])) {
+                echo '<input type="checkbox" name="bypass_trash" id="bypass_trash" /><label for="bypass_trash">' . $aFormElements['bypass_trash']['value'] . '</label>&nbsp;';
+            }
+            if (isset($aFormElements['undeleteButton'])) {
+                echo '<input type="submit" name="undeleteButton" value="' . $aFormElements['undeleteButton']['value'] . '" class="message_control_button" />&nbsp;';
+            }
+?>
+
+              </td>
+
+<?php
+        } // if (isset($aFormElements['delete']))
+        if (isset($aFormElements['moveButton']) || isset($aFormElements['copyButton'])) {
+?>
+              <td class="message_control_move">
+                    <select name="targetMailbox">
+                       <?php echo $aFormElements['targetMailbox']['options_list'];?>
+                    </select>
+<?php
+            if (isset($aFormElements['moveButton'])) {
+                echo '<input type="submit" name="moveButton" value="' . $aFormElements['moveButton']['value'] . '" class="message_control_button" />';
+            }
+            if (isset($aFormElements['copyButton'])) {
+                echo '<input type="submit" name="copyButton" value="' . $aFormElements['copyButton']['value'] . '" class="message_control_button" />';
+            }
+?>
+
+              </td>
+
+<?php
+        } // if (isset($aFormElements['moveButton']) || isset($aFormElements['copyButton']))
+?>
+            </tr>
+          </table>
+<?php 
+    } // if (count($aFormElements))
+