Update member directory stuff for new web site
authorClinton Ebadi <clinton@unknownlamer.org>
Mon, 14 Jan 2013 08:30:01 +0000 (03:30 -0500)
committerClinton Ebadi <clinton@unknownlamer.org>
Mon, 14 Jan 2013 08:30:01 +0000 (03:30 -0500)
Half complete, gets the job half done.

static/gen.sml

index 4ac67f4..c8a3a85 100644 (file)
@@ -10,7 +10,7 @@ end
 
 structure NM = BinaryMapFn(IntKey)
 
-val outputDir = "/home/hcoop/public_html/dyn/"
+val outputDir = "/home/hcoop/new-hcoop-website/"
 
 fun generate () =
     let
@@ -31,14 +31,14 @@ fun generate () =
            end
 
        fun header (outf, title) =
-           procOutput (outf, ("/usr/local/bin/hcoop_header", [title]))
+           (TextIO.output (outf, "<!--#include file=\"header.html\" -->\n<div id=\"main\">");
+            TextIO.output (outf, "<h2>" ^ title ^ "</h2>\n"))
 
-       fun footer outf =
-           procOutput (outf, ("/usr/local/bin/hcoop_footer", []))
+       fun footer outf = TextIO.output (outf, "</div>\n<!--#include file=\"footer.html\" -->\n");
 
        fun genMemberList () =
            let
-               val outf = TextIO.openOut (outputDir ^ "members.html")
+               val outf = TextIO.openOut (outputDir ^ "members.shtml")
 
                fun printOne ([name, rname, usr], (total, anon)) =
                    let
@@ -49,7 +49,7 @@ fun generate () =
                        if not isAnon then
                            (TextIO.output (outf, "<tr> <td><a href=\"member/");
                             TextIO.output (outf, name);
-                            TextIO.output (outf, ".html\">");
+                            TextIO.output (outf, ".shtml\">");
                             TextIO.output (outf, name);
                             TextIO.output (outf, "</a></td> <td>");
                             TextIO.output (outf, rname);
@@ -88,15 +88,17 @@ fun generate () =
                            ()
                        else
                            let
-                               val outf = TextIO.openOut (String.concat [outputDir, "member/", name, ".html"])
+                               val outf = TextIO.openOut (String.concat [outputDir, "member/", name, ".shtml"])
 
-                               val _ = header (outf, "HCoop member: " ^ name)
+                               val _ = header (outf, "HCoop Member: " ^ name)
+                               val _ = TextIO.output (outf, "<p><a href=\"/members.shtml\">Return to members directory</a></p>\n\n");
                                val _ = TextIO.output (outf, "<table>\n<tr> <td align=\"right\"><b>Member</b>:</td> <td>")
                                val _ = TextIO.output (outf, name)
                                val _ = TextIO.output (outf, "</td> </tr>\n<tr> <td align=\"right\"><b>Name</b>:</td> <td>")
                                val _ = TextIO.output (outf, rname)
                                val _ = TextIO.output (outf, "</td> </tr>\n<tr> <td align=\"right\"><b>Joined</b>:</td> <td>")
                                val _ = TextIO.output (outf, Date.toString (Date.fromTimeLocal joined))
+                               val _ = TextIO.output (outf, "</td></tr>\n\n");
 
                                fun doLocation [id] = C.intFromSql id
                                  | doLocation _ = raise Fail "Bad location row"
@@ -130,7 +132,7 @@ fun generate () =
                                val _ = case locations of
                                            [] => ()
                                          | _ =>
-                                           (TextIO.output (outf, "<tr> </tr>\n\n<tr> <td align=\"right\"><b>Locations</b>:</td> <td>");
+                                           (TextIO.output (outf, "<tr> <td align=\"right\"><b>Locations</b>:</td> <td>");
                                             app appLocation locations;
                                             TextIO.output (outf, "</td> </tr>\n"))
 
@@ -157,7 +159,7 @@ fun generate () =
                                val _ = case links of
                                            [] => ()
                                          | _ =>
-                                           (TextIO.output (outf, "<tr> </tr>\n\n<tr> <td><b>Hosted sites</b></td> </tr>\n");
+                                           (TextIO.output (outf, "<tr> <td><b>Hosted sites</b></td> </tr>\n");
                                             app appLink links)
 
                                fun doContact [v, name, url, urlPrefix, urlPostfix] =
@@ -189,7 +191,7 @@ fun generate () =
                                val _ = case contacts of
                                            [] => ()
                                          | _ =>
-                                           (TextIO.output (outf, "<tr> </tr>\n\n<tr> <td><b>Contact information</b></td> </tr>\n");
+                                           (TextIO.output (outf, "<tr> <td><b>Contact information</b></td> </tr>\n");
                                             app appContact contacts)
                            in
                                TextIO.output (outf, "</table>\n");
@@ -199,7 +201,7 @@ fun generate () =
                    end
                  | doOne _ = raise Fail "Bad member row"
            in
-               ignore (OS.Process.system ("/bin/rm " ^ outputDir ^ "member/*.html"));
+               ignore (OS.Process.system ("/bin/rm " ^ outputDir ^ "member/*.shtml"));
                C.app db doOne "SELECT id, name, rname, joined, usr FROM WebUserPaying LEFT OUTER JOIN DirectoryPref ON usr = id"
            end
 
@@ -276,7 +278,7 @@ fun generate () =
            let
                val outf = TextIO.openOut (outputDir ^ "sites.html")
 
-               val _ = header (outf, "HCoop: Hosted sites")
+               (* val _ = header (outf, "HCoop: Hosted sites") *)
 
                fun doLink [url, title, descr, name] = (C.stringFromSql url, C.stringFromSql title, C.stringFromSql descr, C.stringFromSql name)
                  | doLink _ = raise Fail "Bad link' row"
@@ -287,21 +289,21 @@ fun generate () =
                                                            " ORDER BY title"])
 
                fun appLink (url, title, descr, name) = 
-                   (TextIO.output (outf, "<tr> <td><b><a href=\"");
+                   (TextIO.output (outf, "<tr> <td><a href=\"");
                     TextIO.output (outf, Web.html url);
                     TextIO.output (outf, "\">");
                     TextIO.output (outf, Web.html title);
-                    TextIO.output (outf, "</a></b></td> <td>");
+                    TextIO.output (outf, "</a></td> <td>");
                     TextIO.output (outf, Web.html descr);
                     TextIO.output (outf, "</td> <td><a href=\"member/");
                     TextIO.output (outf, name);
-                    TextIO.output (outf, ".html\">");
+                    TextIO.output (outf, ".shtml\">");
                     TextIO.output (outf, name);
                     TextIO.output (outf, "</a></td> </tr>\n"))
            in
-               TextIO.output (outf, "<table>\n");
+               (* TextIO.output (outf, "<table>\n"); *)
                app appLink links;
-               footer outf;
+               (* footer outf; *)
                TextIO.closeOut outf
            end
     in