Changes on new server
authoradamch <adamch>
Mon, 12 Sep 2005 03:35:35 +0000 (03:35 +0000)
committeradamch <adamch>
Mon, 12 Sep 2005 03:35:35 +0000 (03:35 +0000)
app.sml
aptquery.sml
init.sig
init.sml
poll.mlt
request.sml
static/gen.sml
support.sml

diff --git a/app.sml b/app.sml
index ecb7f7f..bd00049 100644 (file)
--- a/app.sml
+++ b/app.sml
@@ -82,7 +82,9 @@ fun deny (app, msg) =
 
        val mail = Mail.mopen ()
     in
-       Mail.mwrite (mail, "From: Hcoop Application System <join@hcoop.net>\nTo: ");
+       Mail.mwrite (mail, "From: Hcoop Application System <join");
+       Mail.mwrite (mail, emailSuffix);
+       Mail.mwrite (mail, ">\nTo: ");
        Mail.mwrite (mail, #email entry);
        Mail.mwrite (mail, "\nCc: ");
        Mail.mwrite (mail, boardEmail);
@@ -100,7 +102,9 @@ fun approve (app, msg) =
 
        val mail = Mail.mopen ()
     in
-       Mail.mwrite (mail, "From: Hcoop Application System <join@hcoop.net>\nTo: ");
+       Mail.mwrite (mail, "From: Hcoop Application System <join");
+       Mail.mwrite (mail, emailSuffix);
+       Mail.mwrite (mail, ">\nTo: ");
        Mail.mwrite (mail, #email entry);
        Mail.mwrite (mail, "\nCc: ");
        Mail.mwrite (mail, boardEmail);
@@ -136,4 +140,4 @@ fun readTosBody () = readFile "/var/www/home/html/tos.body.html"
 fun readTosAgree () = readFile "/var/www/home/html/tos.agree.html"
 fun readTosMinorAgree () = readFile "/var/www/home/html/tos.agree.minor.html"
 
-end
\ No newline at end of file
+end
index 1a5939e..bf0ec6a 100644 (file)
@@ -33,14 +33,7 @@ fun query name =
            let
                val _ = Unix.reap proc
 
-               val proc = Unix.execute ("/usr/bin/dpkg", ["-l", name])
-               val inf = Unix.textInstreamOf proc
-               val installed =
-                   case TextIO.inputLine inf of
-                       NONE => false
-                     | SOME line => String.sub (line, 0) = #"D"
-
-               val _ = Unix.reap proc
+               val installed = OS.Process.isSuccess (OS.Process.system ("/usr/bin/dpkg -p " ^ name ^ " >/dev/null 2>/dev/null"))
            in
                SOME {name = name, section = section, descr = descr, installed = installed}
            end
@@ -48,4 +41,4 @@ fun query name =
                  NONE)
     end
 
-end
\ No newline at end of file
+end
index 85000bf..9af4bc6 100644 (file)
--- a/init.sig
+++ b/init.sig
@@ -7,6 +7,8 @@ signature INIT = sig
     exception Access of string
     exception NeedTos
 
+    val emailSuffix : string
+
     type user = {id : int, name : string, rname : string, bal : int, joined : C.timestamp,
                 app : int}
 
@@ -41,4 +43,4 @@ signature INIT = sig
     val dateString : unit -> string
 
     val grandfatherUsers : unit -> unit
-end
\ No newline at end of file
+end
index 2b2df7b..0d1a920 100644 (file)
--- a/init.sml
+++ b/init.sml
@@ -7,10 +7,11 @@ structure C = PgClient
 exception Access of string
 exception NeedTos
 
-val urlPrefix = "http://users.hcoop.net/portal/"
-val boardEmail = "board.fake@hcoop.net"
+val urlPrefix = "https://members.hcoop.net/portal/"
+val emailSuffix = "@new.hcoop.net"
+val boardEmail = "board" ^ emailSuffix
 
-fun conn () = C.conn "dbname='hcoop'"
+fun conn () = C.conn "dbname='hcoop_hcoop'"
 val close = C.close
 
 type user = {id : int, name : string, rname : string, bal : int, joined : C.timestamp,
@@ -153,7 +154,7 @@ fun grandfatherUsers () =
                ignore (C.dml db ($`INSERT INTO MemberApp (id, name, rname, gname, email, forward, uses, other,
                                                        passwd, status, applied, confirmed, decided, msg)
                                 VALUES (^(C.intToSql aid), ^(C.stringToSql name), ^(C.stringToSql rname),
-                                        NULL, '^name@hcoop.net', FALSE, 'GRANDFATHERED', 'GRANDFATHERED',
+                                        NULL, '^name^(emailSuffix)', FALSE, 'GRANDFATHERED', 'GRANDFATHERED',
                                         'GRANDFATHERED', 4, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP,
                                         CURRENT_TIMESTAMP, 'GRANDFATHERED')`));
                ignore (C.dml db ($`UPDATE WebUser SET app = ^(C.intToSql aid) WHERE id = ^(C.intToSql id)`))
@@ -161,4 +162,4 @@ fun grandfatherUsers () =
     in
        C.app db mkApp "SELECT id, name, rname FROM WebUser WHERE app IS NULL"
     end
-end
\ No newline at end of file
+end
index 3abe588..ad8e152 100644 (file)
--- a/poll.mlt
+++ b/poll.mlt
@@ -72,9 +72,9 @@ elseif $"cmd" = "add" then
        val votes = Web.stoi ($"votes");
        if title = "" then
                %><h3><b>Your poll must have a title.</b></h3><%
-       elseif not (Poll.dateGeNow starts) then
+       elseif not pollAdmin and not (Poll.dateGeNow starts) then
                %><h3><b>That start date is in the past!</b></h3><%
-       elseif not (Poll.dateLe (starts, ends)) then
+       elseif not pollAdmin and not (Poll.dateLe (starts, ends)) then
                %><h3><b>The end date comes before the start date!</b></h3><%
        elseif votes <= 0 then
                %><h3><b>You must specify a positive number of votes per person.</b></h3><%
@@ -114,9 +114,9 @@ elseif $"mod" <> "" then
        val votes = Web.stoi ($"votes");
        if title = "" then
                %><h3><b>Your poll must have a title.</b></h3><%
-       elseif not (Poll.dateGeNow starts) then
+       elseif not pollAdmin and not (Poll.dateGeNow starts) then
                %><h3><b>That start date is in the past!</b></h3><%
-       elseif not (Poll.dateLe (starts, ends)) then
+       elseif not pollAdmin and not (Poll.dateLe (starts, ends)) then
                %><h3><b>The end date comes before the start date!</b></h3><%
        elseif votes <= 0 then
                %><h3><b>You must specify a positive number of votes per person.</b></h3><%
index 395bab4..738c341 100644 (file)
@@ -101,10 +101,12 @@ fun notify f req =
            end
          | doOne r = rowError (table ^ ".doOne", r)
     in
-       Mail.mwrite (mail, "From: Hcoop Portal <portal@hcoop.net>\nTo: ");
+       Mail.mwrite (mail, "From: Hcoop Portal <portal");
+       Mail.mwrite (mail, emailSuffix);
+       Mail.mwrite (mail, ">\nTo: ");
        Mail.mwrite (mail, #name user);
-       Mail.mwrite (mail, "@hcoop.net\n");
-       Mail.mwrite (mail, "Bcc: ");
+       Mail.mwrite (mail, emailSuffix);                     
+       Mail.mwrite (mail, "\nBcc: ");
        C.app (getDb ()) doOne ($`SELECT name
                                  FROM WebUser JOIN Membership ON (usr = id AND grp = ^(C.intToSql grp))`);
        Mail.mwrite (mail, "\nSubject: ");
@@ -146,4 +148,4 @@ fun notifyMod (oldStatus, newStatus, changer, req) =
                Mail.mwrite (mail, statusToString newStatus);
                Mail.mwrite (mail, ".\n\n"))) req
                
-end
\ No newline at end of file
+end
index 6bb6e8b..272e785 100644 (file)
@@ -10,11 +10,11 @@ end
 
 structure NM = BinaryMapFn(IntKey)
 
-val outputDir = "/var/www/home/html/dyn/"
+val outputDir = "/var/www/dyn/"
 
 fun generate () =
     let
-       val db = C.conn "dbname='hcoop'"
+       val db = C.conn "dbname='hcoop_hcoop'"
 
        fun header (outf, title) =
            (TextIO.output (outf, "<html><head>\n<title>");
@@ -313,4 +313,4 @@ fun main _ = (generate ())
                  List.app (fn s => print (s ^ "\n")) (SMLofNJ.exnHistory ex);
                  OS.Process.failure)
 
-end
\ No newline at end of file
+end
index 027c981..c629b4d 100644 (file)
@@ -289,9 +289,12 @@ fun notify (prefix, f) iss =
 
        val mail = Mail.mopen ()
     in
-       Mail.mwrite (mail, "From: Hcoop Support System <support@hcoop.net>\nTo: ");
+       Mail.mwrite (mail, "From: Hcoop Support System <support");
+       Mail.mwrite (mail, emailSuffix);
+       Mail.mwrite (mail, ">\nTo: ");
        Mail.mwrite (mail, #name user);
-       Mail.mwrite (mail, "@hcoop.net\n");
+       Mail.mwrite (mail, emailSuffix);
+       Mail.mwrite (mail, "\n");
        writeRecipients (mail, iss, cat, #name user);
        Mail.mwrite (mail, "Subject: ");
        Mail.mwrite (mail, prefix);
@@ -356,4 +359,4 @@ fun notifyStatus (usr, oldStatus, newStatus, iss) =
                    Mail.mwrite (mail, ".\n"))) iss
     end
               
-end
\ No newline at end of file
+end