Allow other plugins to indicate that preview_pane should load the URI being loaded...
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 5 Feb 2007 23:26:53 +0000 (23:26 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 5 Feb 2007 23:26:53 +0000 (23:26 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12224 7612ce4b-ef26-0410-bec9-ea0150e637f0

plugins/preview_pane/functions.php

index 1df2a326657edf47daf218e9aed13d666c3c54e3..2fbaf1b87cbfb1b3ec4f6cd82f376f8ed986a4f2 100644 (file)
@@ -89,8 +89,12 @@ function preview_pane_message_list_do()
 
    if (!checkForJavascript()) return;
 
+   // globalize $pp_forceTopURL and $pp_noPageHeader to synch
+   // with other plugins (sent_confirmation, for example)
+   //
    global $plugins, $archive_mail_button_has_been_printed,
-          $username, $data_dir, $PHP_SELF, $base_uri;
+          $username, $data_dir, $PHP_SELF, $base_uri,
+          $pp_forceTopURL, $pp_noPageHeader;
 
 
    $output = '';
@@ -116,7 +120,7 @@ function preview_pane_message_list_do()
 
       $output .= addButton(_("Clear Preview"), 'clear_preview',
                            array('onclick' => 'parent.bottom.document.location=\''
-                                            . $base_uri . '/plugins/preview_pane/empty_frame.php\'; '))
+                                            . $base_uri . 'plugins/preview_pane/empty_frame.php\'; '))
 
 
 
@@ -126,8 +130,19 @@ function preview_pane_message_list_do()
          . "<!--\n"
          . "\n"
          . "   if (self.name == 'bottom')\n"
-         . "   {\n"
-         . "      document.location = '" . $base_uri . "plugins/preview_pane/empty_frame.php'\n"
+         . "   {\n";
+
+// NOTE: we can also force the top frame to the URL that was being
+//       loaded in the bottom, but this is usually overkill...
+//       unless another plugin told us to do so (such as sent_confirmation)
+      if ($pp_forceTopURL == 'yes')
+      {
+//         $output .= "      parent.right.document.location = '" . $_SERVER['REQUEST_URI'] . "&pp=yes';\n";
+         $output .= "      parent.right.document.location = '" . $PHP_SELF . "&pp=yes';\n";
+      }
+
+
+      $output .= "      document.location = '" . $base_uri . "plugins/preview_pane/empty_frame.php'\n"
          . "   }\n"
          . "//-->\n"
          . "</script>\n";