Templatize (un)collapse buttons; move all templates to default_advanced, since defaul...
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 10 Mar 2007 05:48:35 +0000 (05:48 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 10 Mar 2007 05:48:35 +0000 (05:48 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12332 7612ce4b-ef26-0410-bec9-ea0150e637f0

plugins/preview_pane/functions.php
plugins/preview_pane/templates/default_advanced/collapse_buttons.tpl [new file with mode: 0644]
plugins/preview_pane/templates/default_advanced/empty_frame.tpl [moved from plugins/preview_pane/templates/default/empty_frame.tpl with 100% similarity]

index 4afe471..43e139a 100644 (file)
@@ -88,7 +88,7 @@ function preview_pane_open_close_buttons_do()
 
    if (!show_preview_pane()) return;
 
-   global $data_dir, $username, $base_uri;
+   global $data_dir, $username, $base_uri, $oTemplate;
    $previewPane_vertical_split = getPref($data_dir, $username, 'previewPane_vertical_split', 0);
    if ($previewPane_vertical_split)
    {
@@ -106,26 +106,13 @@ function preview_pane_open_close_buttons_do()
 
    $previewPane_size = getPref($data_dir, $username, 'previewPane_size', 300);
 
+   $oTemplate->assign('previewPane_size', $previewPane_size);
+   $oTemplate->assign('base_uri', $base_uri);
+   $oTemplate->assign('split', $split);
+   $oTemplate->assign('down_arrow', $down_arrow);
+   $oTemplate->assign('up_arrow', $up_arrow);
 
-   $output = "\n<script type=\"text/javascript\">\n"
-      . "<!--\n"
-      . "   function set_preview_pane_size(new_size)\n"
-      . "   {\n"
-      . "      if (document.all)\n"
-      . "      {\n"
-      . "         parent.document.all[\"fs2\"].$split = \"*, \" + new_size;\n"
-      . "      }\n"
-      . "      else if (this.document.getElementById)\n"
-      . "      {\n"
-      . "         parent.document.getElementById(\"fs2\").$split = \"*, \" + new_size;\n"
-      . "      }\n"
-      . "   }\n"
-      . "// -->\n</script>\n"
-      . '<form style="margin:0">'
-      . '<input type="button" value="' . $down_arrow . '" onclick="set_preview_pane_size(0)" />'
-      . '<input type="button" value="X" onclick="parent.bottom.document.location=\'' . $base_uri . 'plugins/preview_pane/empty_frame.php\'" />'
-      . '<input type="button" value="' . $up_arrow . '" onclick="set_preview_pane_size(' . $previewPane_size . ')" />'
-      . '</form>';
+   $output = $oTemplate->fetch('plugins/preview_pane/collapse_buttons.tpl');
 
    return array('provider_link_before' => $output);
 
diff --git a/plugins/preview_pane/templates/default_advanced/collapse_buttons.tpl b/plugins/preview_pane/templates/default_advanced/collapse_buttons.tpl
new file mode 100644 (file)
index 0000000..0ac48e8
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+
+/**
+  * collapse_buttons.tpl
+  *
+  * Template for building (un)collapse (and clear) buttons for preview pane.
+  *
+  * The following variables are available in this template:
+  *    + $split            - Either "cols" or "rows" depending on how the 
+  *                          preview pane is oriented
+  *    + $down_arrow       - The value to be displayed on the collapse button
+  *    + $up_arrow         - The value to be displayed on the uncollapse button
+  *    + $base_uri         - The SquirrelMail base URI
+  *    + $previewPane_size - The user's configured size of the preview pane
+  *
+  * @copyright &copy; 1999-2007 The SquirrelMail Project Team
+  * @author Paul Lesneiwski <paul@squirrelmail.org>
+  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+  * @version $Id$
+  * @package plugins
+  * @subpackage preview_pane
+  *
+  */
+
+
+// retrieve the template vars
+//
+extract($t);
+
+
+?><script type="text/javascript">
+<!--
+
+   function set_preview_pane_size(new_size)
+   {
+      if (document.all)
+      {
+         parent.document.all["fs2"].<?php echo $split; ?> = "*, " + new_size;
+      }
+      else if (this.document.getElementById)
+      {
+         parent.document.getElementById("fs2").<?php echo $split; ?> = "*, " + new_size;
+      }
+   }
+// -->\n</script>
+<form style="margin:0">
+   <input type="button" value="<?php echo $down_arrow; ?>" onclick="set_preview_pane_size(0)" />
+   <input type="button" value="X" onclick="parent.bottom.document.location='<?php echo $base_uri; ?>plugins/preview_pane/empty_frame.php'" />
+   <input type="button" value="<?php echo $up_arrow; ?>" onclick="set_preview_pane_size(<?php echo $previewPane_size; ?>)" />
+</form>