Generate rendered checkout output before common-header.inc is included so that
authorChuck Hagenbuch <chuck@horde.org>
Mon, 29 Nov 2010 03:21:47 +0000 (22:21 -0500)
committerChuck Hagenbuch <chuck@horde.org>
Mon, 29 Nov 2010 03:22:28 +0000 (22:22 -0500)
javascript and CSS is loaded correctly.

chora/co.php
chora/templates/checkout/checkout.inc

index a42898a..e481701 100644 (file)
@@ -62,6 +62,20 @@ if (!$plain) {
     /* Pretty-print the checked out copy */
     $pretty = Chora::pretty($mime_type, $checkOut);
 
+    if (strpos($mime_type, 'text/plain') !== false) {
+        $data = $pretty->render('inline');
+        $data = reset($data);
+        $rendered = '<div class="fixed">' . $GLOBALS['injector']->getInstance('Horde_Core_Factory_TextFilter')->filter($data['data'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) . '</div>';
+    } elseif (strpos($mime_type, 'image/') !== false) {
+        $rendered = Horde::img(Horde_Util::addParameter(Horde::selfUrl(true), 'p', 1), '', '', '');
+    } elseif ($pretty->canRender('inline')) {
+        $data = $pretty->render('inline');
+        $data = reset($data);
+        $rendered = $data['data'];
+    } else {
+        $rendered = Horde::link(Horde_Util::addParameter(Horde::selfUrl(true), 'p', 1)) . Horde::img('download.png') . ' ' . sprintf(_("Download revision %s"), $r) . '</a>';
+    }
+
     /* Get this revision's attributes in printable form. */
     $log = $file->queryLogs($r);
 
index 52eb5ef..97aabc9 100644 (file)
 </div>
 
 <h3 class="checkout"><?php echo _("Checkout") ?></h3>
-<div class="checkout">
-<?php
-if (strpos($mime_type, 'text/plain') !== false) {
-    $data = $pretty->render('inline');
-    $data = reset($data);
-    echo '<div class="fixed">' . $GLOBALS['injector']->getInstance('Horde_Core_Factory_TextFilter')->filter($data['data'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) . '</div>';
-} elseif (strpos($mime_type, 'image/') !== false) {
-    echo Horde::img(Horde_Util::addParameter(Horde::selfUrl(true), 'p', 1), '', '', '');
-} elseif ($pretty->canRender('inline')) {
-    $data = $pretty->render('inline');
-    $data = reset($data);
-    echo $data['data'];
-} else {
-    echo Horde::link(Horde_Util::addParameter(Horde::selfUrl(true), 'p', 1)) . Horde::img('download.png') . ' ' . sprintf(_("Download revision %s"), $r) . '</a>';
-}
-?>
-</div>
+<div class="checkout"><?php echo $rendered ?></div>