Move the message and thread/date index PHP pages out of the MHonarc resource
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Sat, 7 Mar 2009 23:01:31 +0000 (23:01 +0000)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Sat, 7 Mar 2009 23:01:31 +0000 (23:01 +0000)
file and into its own PHP page, and improve it to display the left-hand menus
from the JSON file instead of the old ugly hardcoded way.

git-svn-id: file:///Users/dpage/pgweb/svn-repo/trunk@2423 8f5c7a92-453e-0410-a47f-ad33c8a6b003

archives/bin/resource-common
archives/html/msgtop.php [new file with mode: 0644]

index f1828664cddab8cef61185fa56e2be11eb87dfe4..99672cb943d32db747df5ea83b537b24b2f26335 100644 (file)
@@ -74,25 +74,10 @@ php
 </MSGPGSSMARKUP>
 
 <MSGPGBEGIN>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" dir="ltr">
-<head>
-  <base href="http://archives.postgresql.org/$LIST$/$YEAR$-$MONTH$/" />
-  <meta name="robots" content="all" />
-  <meta name="MSSmartTagsPreventParsing" content="TRUE" />
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-  <meta name="keywords" content="postgresql, hackers, general, sql, admin, novice, interfaces, odbc, jdbc" />
-  <meta name="rating" content="General" />
-  <meta name="distribution" content="Global" />
-  <meta name="revisit-after"  content="7 days" />
-  <meta name="robots" content="nofollow, index, archive" />
-  <meta http-equiv="Last-Modified" content="$DATE$" />
-  <title>$SUBJECTNA:72$</title>
-<? 
-  require($$_SERVER['DOCUMENT_ROOT']."/includes/top_config.php"); 
+<?php
+ $$title = "$SUBJECTNA:72$";
+ require "../../msgtop.php";
 ?>
-
 </MSGPGBEGIN>                                                         
 
 <REFSBEGIN>
@@ -144,23 +129,10 @@ $LINK(TPREV)$$LINK(TNEXT)$
 <!-- Date Index Page Formatting -->
 
 <IDXPGBEGIN>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" dir="ltr">
-<head>
-  <meta name="robots" content="all" />
-  <meta name="MSSmartTagsPreventParsing" content="TRUE" />
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-  <meta name="keywords" content="postgresql, hackers, general, sql, admin, novice, interfaces, odbc, jdbc" />
-  <meta name="rating" content="General" />
-  <meta name="distribution" content="Global" />
-  <meta name="revisit-after"  content="7 days" />
-  <meta name="robots" content="follow, noindex, noarchive" />
-  <title>$LIST$ $YEAR$-$MONTH$ Chronological Index ($PAGENUM$/$NUMOFPAGES$)</title>
-<? 
-  require($$_SERVER['DOCUMENT_ROOT']."/includes/top_config.php"); 
+<?php
+$$title="$LIST$ $YEAR$-$MONTH$ Chronological Index ($PAGENUM$/$NUMOFPAGES$)";
+require "../../msgtop.php";
 ?>
-
   <h2>$LIST$ $YEAR$-$MONTH$ Chronological Index ($PAGENUM$/$NUMOFPAGES$)</h2>
 
 </IDXPGBEGIN>
@@ -214,21 +186,9 @@ $NUMOFMSG$ messages<br />
 </TLEVELS>
 
 <TIDXPGBEGIN>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" dir="ltr">
-<head>
-  <meta name="robots" content="all" />
-  <meta name="MSSmartTagsPreventParsing" content="TRUE" />
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-  <meta name="keywords" content="postgresql, hackers, general, sql, admin, novice, interfaces, odbc, jdbc" />
-  <meta name="rating" content="General" />
-  <meta name="distribution" content="Global" />
-  <meta name="revisit-after"  content="7 days" />
-  <meta name="robots" content="follow, noindex, noarchive" />
-  <title>$LIST$ $YEAR$-$MONTH$ Thread Index ($PAGENUM$/$NUMOFPAGES$)</title>
-<? 
-  require($$_SERVER['DOCUMENT_ROOT']."/includes/top_config.php"); 
+<?php
+$$title = "$LIST$ $YEAR$-$MONTH$ Thread Index ($PAGENUM$/$NUMOFPAGES$)";
+require "../../msgtop.php";
 ?>
 
   <h2>$LIST$ $YEAR$-$MONTH$ Thread Index ($PAGENUM$/$NUMOFPAGES$)</h2>
diff --git a/archives/html/msgtop.php b/archives/html/msgtop.php
new file mode 100644 (file)
index 0000000..b72c2f1
--- /dev/null
@@ -0,0 +1,65 @@
+<?php
+ini_set('include_path', $_SERVER['DOCUMENT_ROOT']."/../pearlib");
+dl('json.so');
+
+require 'HTML/Template/Sigma.php';
+
+$tmpldir = $_SERVER['DOCUMENT_ROOT'] . "/../templates";
+?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" dir="ltr">
+<head>
+  <meta name="robots" content="all" />
+  <meta name="MSSmartTagsPreventParsing" content="TRUE" />
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <meta name="keywords" content="postgresql, hackers, general, sql, admin, novice, interfaces, odbc, jdbc" />
+  <meta name="rating" content="General" />
+  <meta name="distribution" content="Global" />
+  <meta name="revisit-after"  content="7 days" />
+  <meta name="robots" content="follow, noindex, noarchive" />
+
+<?
+echo "<title>$title</title>\n";
+
+$tpl =& new HTML_Template_Sigma($tmpldir."/html");
+$tpl->loadTemplateFile('top_config.html');
+
+// extract the list name from the URL
+list($listname) = sscanf($_SERVER['PHP_SELF'], "/%[^/]s");
+
+/* fill the left-side menu with all the group names, expanding lists
+ * for the group this list belongs */
+$groups = json_decode(file_get_contents($tmpldir."/groups.json"), true);
+$lists = json_decode(file_get_contents($tmpldir."/lists.json"), true);
+ksort($groups);
+$mygroup = $lists[$listname]["group"];
+
+foreach ($groups as $group) {
+        $tpl->setCurrentBlock('top_listgroup');
+        $tpl->setVariable('top_groupname', $group["name"]);
+        $tpl->setVariable('top_group_firstlist', $group["lists"][0]);
+
+        /* When we detect the group that this list belongs to, expand the lists
+         * on the group */
+        if ($group["id"] == $mygroup) {
+                $tpl->setCurrentBlock('top_list');
+                foreach ($group["lists"] as $list) {
+                        // use the shortdesc if it exists
+                        if (isset($lists[$list]["shortdesc"]))
+                                $desc = $lists[$list]["shortdesc"];
+                        else
+                                $desc = $list;
+                        $tpl->setVariable('top_name', $list);
+                        $tpl->setVariable('top_desc', $desc);
+                        $tpl->parse('top_list');
+                }
+        }
+        $tpl->parse('top_listgroup');
+}
+
+$tpl->parse();
+$tpl->show();
+
+?>