Re-use common header code in common-header.inc for DIMP
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 29 Jul 2009 18:31:49 +0000 (12:31 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 29 Jul 2009 18:45:22 +0000 (12:45 -0600)
imp/lib/DIMP.php
imp/templates/common-header.inc

index 71d2d7f..63e6f1e 100644 (file)
@@ -78,22 +78,8 @@ class DIMP
             $page_title .= ' :: ' . $title;
         }
 
-        if (isset($GLOBALS['language'])) {
-            header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
-            header('Vary: Accept-Language');
-        }
-
-        echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"DTD/xhtml1-transitional.dtd\">\n" .
-             (!empty($GLOBALS['language']) ? '<html lang="' . strtr($GLOBALS['language'], '_', '-') . '"' : '<html') . ">\n".
-             "<head>\n";
-
-        echo '<title>' . htmlspecialchars($page_title) . "</title>\n" .
-             '<link href="' . $GLOBALS['registry']->getImageDir() . "/favicon.ico\" rel=\"SHORTCUT ICON\" />\n";
-        include IMP_BASE . '/templates/javascript_defs_dimp.php';
-
-        IMP::includeStylesheetFiles('dimp');
-
-        echo "</head>\n";
+        $GLOBALS['imp_view'] = 'dimp';
+        include IMP_BASE . '/templates/common-header.inc';
 
         // Send what we have currently output so the browser can start
         // loading CSS/JS. See:
@@ -190,7 +176,7 @@ class DIMP
      * 'l' (label) = The folder display label. [string] [DEFAULT: 'm' val]
      * 'm' (mbox) = The mailbox value. [string]
      * 'pa' (parent) = The parent element. [string] [DEFAULT:
-     *                                               DIMP.conf.base_mbox]
+     *                 DIMP.conf.base_mbox]
      * 'po' (polled) = Is the element polled? [boolean] [DEFAULT: no]
      * 's' (special) = Is this a "special" element? [boolean] [DEFAULT: no]
      * 't' (title) = The title value. [string] [DEFAULT: 'm' val]
index 5f84225..ea29eb9 100644 (file)
@@ -12,12 +12,25 @@ if (!empty($title)) $page_title .= ' :: ' . $title;
 if (!empty($refresh_time) && !empty($refresh_url)) {
     echo "<meta http-equiv=\"refresh\" content=\"$refresh_time;url=$refresh_url\" />\n";
 }
-echo Horde_Util::bufferOutput('require', IMP_TEMPLATES . '/javascript_defs.php');
-IMP::includeScriptFiles();
-IMP::includeStylesheetFiles();
+$imp_view = Horde_Util::nonInputVar('imp_view');
+switch ($imp_view) {
+case 'dimp':
+    include IMP_TEMPLATES . '/javascript_defs_dimp.php';
+    IMP::includeStylesheetFiles('dimp');
+    break;
+
+default:
+    include IMP_TEMPLATES . '/javascript_defs.php';
+    IMP::includeScriptFiles();
+    IMP::includeStylesheetFiles();
+    break;
+}
 ?>
 <title><?php echo htmlspecialchars($page_title) ?></title>
 <link href="<?php echo $GLOBALS['registry']->getImageDir() ?>/favicon.ico" rel="SHORTCUT ICON" />
+<?php if ($imp_view == 'dimp'): ?>
+</head>
+<?php else: ?>
 <?php if ($mailbox_url = Horde_Util::nonInputVar('mailbox_url')): ?>
 <link href="<?php echo $mailbox_url ?>" rel="Up" />
 <?php elseif (!Horde_Util::nonInputVar('login_page')): ?>
@@ -45,3 +58,4 @@ IMP::includeStylesheetFiles();
 </head>
 
 <body<?php if ($bc = Horde_Util::nonInputVar('bodyClass')) echo ' class="' . $bc . '"' ?><?php if ($bi = Horde_Util::nonInputVar('bodyId')) echo ' id="' . $bi . '"'; ?>>
+<?php endif; ?>