Random fixin's in preparation for accepting new members
authoradamch <adamch>
Wed, 28 Sep 2005 14:54:19 +0000 (14:54 +0000)
committeradamch <adamch>
Wed, 28 Sep 2005 14:54:19 +0000 (14:54 +0000)
14 files changed:
app/.cvsignore
app/app.sml
app/join.mlt
app/mlt.conf
app/out/.cvsignore [new file with mode: 0644]
init.sml
listaddrs/.cvsignore [new file with mode: 0644]
listaddrs/Makefile [new file with mode: 0644]
listaddrs/listaddrs.sml [new file with mode: 0644]
listaddrs/sources.cm [new file with mode: 0644]
poll.mlt
poll.sig
poll.sml
pref.sml

index 854c999..297025f 100644 (file)
@@ -1,2 +1,3 @@
 .cm
-CM
\ No newline at end of file
+CM
+out
index 05c0d80..84ca130 100644 (file)
@@ -2,7 +2,7 @@ structure App :> APP =
 struct
 
 val baseUrl = "http://join.hcoop.net/join/"
-val portalUrl = "http://users.hcoop.net/portal/"
+val portalUrl = "https://members.hcoop.net/portal/"
 
 open Sql
 
@@ -14,7 +14,7 @@ val rnd = ref (Random.rand (0, 0))
 
 fun init () = 
     let
-       val c = C.conn "dbname='hcoop'"
+       val c = C.conn "dbname='hcoop_hcoop'"
     in
        db := SOME c;
        C.dml c "BEGIN";
@@ -46,9 +46,9 @@ fun readFile fname =
        before TextIO.closeIn inf
     end
 
-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"
+fun readTosBody () = readFile "/home/hcoop/public_html/tos.body.html"
+fun readTosAgree () = readFile "/home/hcoop/public_html/tos.agree.html"
+fun readTosMinorAgree () = readFile "/home/hcoop/public_html/tos.agree.minor.html"
 
 fun sendMail (to, subj, intro, footer, id) =
     let
@@ -164,4 +164,4 @@ fun confirm (id, passwd) =
          | NONE => false
     end
 
-end
\ No newline at end of file
+end
index 54b63f7..10164cd 100644 (file)
@@ -43,7 +43,7 @@ else
 <input type="hidden" name="cmd" value="app">
 <table>
 <tr> <td align="right" valign="top"><b>Desired username</b>:</td> <td><input name="name"><br>
-       You should follow usual UNIX conventions, and it's helpful to pick a name you wouldn't mind using to identify yourself to strangers.</td> </tr>
+       You should follow usual UNIX conventions, including limiting yourself to lowercase letters and at most 8 characters. It's helpful to pick a name you wouldn't mind using to identify yourself to both strangers and friends. Something based on your "real" name is a safe bet.</td> </tr>
 <% if minor then %>
 <tr> <td align="right"><b>New member's "real" name</b>:</td> <td><input name="rname"></td> </tr>
 <tr> <td align="right"><b>Legal guardian's name</b>:</td> <td><input name="gname"></td> </tr>
@@ -58,6 +58,10 @@ else
 <tr> <td align="right" valign="top"><b>Any other information about yourself</b></td> <td><textarea name="other" rows="5" cols="80" wrap="soft"></textarea></td> </tr>
 </table>
 
+<br><hr><br>
+
+You must agree to the following terms to be considered for membership:
+
 <h2><b>Terms of Service Agreement</b></h2>
 
 <% App.readTosBody () %>
index a3134a7..b3f7161 100644 (file)
@@ -6,7 +6,8 @@ after   after
 exn    exn
 
 out    out
-pub    /var/www/join.hcoop.net/cgi/join
+pub    /home/hcoop/join/cgi
 
+cm     $/smlnj-lib.cm
 cm     /usr/local/share/smlsql/smlsql.cm
 cm     /usr/local/share/smlsql/libpq/sources.cm
diff --git a/app/out/.cvsignore b/app/out/.cvsignore
new file mode 100644 (file)
index 0000000..f59ec20
--- /dev/null
@@ -0,0 +1 @@
+*
\ No newline at end of file
index 81f5b10..d8ceeb3 100644 (file)
--- a/init.sml
+++ b/init.sml
@@ -9,7 +9,7 @@ exception NeedTos
 
 val scratchDir = "/home/hcoop"
 val urlPrefix = "https://members.hcoop.net/portal/"
-val emailSuffix = "@new.hcoop.net"
+val emailSuffix = "@hcoop.net"
 val boardEmail = "board" ^ emailSuffix
 
 fun conn () = C.conn "dbname='hcoop_hcoop'"
diff --git a/listaddrs/.cvsignore b/listaddrs/.cvsignore
new file mode 100644 (file)
index 0000000..04cf57d
--- /dev/null
@@ -0,0 +1,4 @@
+*.x86-linux
+.cm
+CM
+listaddrs
diff --git a/listaddrs/Makefile b/listaddrs/Makefile
new file mode 100644 (file)
index 0000000..a829c3b
--- /dev/null
@@ -0,0 +1,2 @@
+listaddrs.x86-linux: listaddrs.sml sources.cm
+       /usr/local/sml/bin/ml-build sources.cm Main.main listaddrs
diff --git a/listaddrs/listaddrs.sml b/listaddrs/listaddrs.sml
new file mode 100644 (file)
index 0000000..15a224c
--- /dev/null
@@ -0,0 +1,15 @@
+structure Main = struct
+
+structure C = PgClient
+
+fun main _ =
+    let
+       val db = C.conn "dbname='hcoop_hcoop'"
+
+       fun printOne [name] = print (C.stringFromSql name ^ "@hcoop.net\n")
+    in
+       C.app db printOne "SELECT name FROM WebUser";
+       C.close db;
+       OS.Process.success
+    end
+end
diff --git a/listaddrs/sources.cm b/listaddrs/sources.cm
new file mode 100644 (file)
index 0000000..1e575d3
--- /dev/null
@@ -0,0 +1,7 @@
+Group is
+       $/basis.cm
+
+       /usr/local/share/smlsql/libpq/sources.cm
+       /usr/local/share/smlsql/smlsql.cm
+
+       listaddrs.sml
\ No newline at end of file
index ad8e152..9cc9c60 100644 (file)
--- a/poll.mlt
+++ b/poll.mlt
@@ -207,6 +207,17 @@ elseif $"delChoice" <> "" then
 
 <h3><b>Vote Report</b></h3>
 
+<p>Voters:
+<%     ref first = true;
+       foreach user in Poll.listPollVoters id do
+               if first then
+                       first := false
+               else
+                       %>, <%
+               end
+               %><a href="user?id=<% #id user %>"><% #name user %></a><%
+       end %></p>
+
 <table>
 <tr> <td align="right"><b>Poll#</b>:</td> <td><% id %></td> </tr>
 <tr> <td align="right"><b>Title</b>:</td> <td><% Web.html (#title poll) %></td> </tr>
@@ -257,6 +268,8 @@ end %>
 
 <h3><b>Choices<% if Poll.takingVotes poll then %><a href="poll?vote=<% id %>">(Vote!)</a><% end %></b></h3>
 
+<p><% Poll.countVoters (#id poll) %> people have voted.</p>
+
 <% if Poll.takingVotes poll then %>
 <table>
 <tr> <td><b>You</b></td> <td><b>Total</b></td> </tr>
index d459f04..8111fe9 100644 (file)
--- a/poll.sig
+++ b/poll.sig
@@ -36,4 +36,9 @@ signature POLL = sig
 
     val noDupes : ''a list -> bool
     val listVoters : int -> Init.user list
-end
\ No newline at end of file
+    (* This operates on choice IDs. *)
+
+    (* These operate on poll IDs. *)
+    val countVoters : int -> int
+    val listPollVoters : int -> Init.user list
+end
index 32e588d..e549218 100644 (file)
--- a/poll.sml
+++ b/poll.sml
@@ -202,4 +202,17 @@ fun listVoters cho =
                                     AND cho = ^(C.intToSql cho)
                                  ORDER BY name`)
 
-end
\ No newline at end of file
+fun countVoters pol =
+    case C.oneRow (getDb ()) ($`SELECT COUNT(DISTINCT usr)
+                               FROM Vote JOIN PollChoice ON id = cho AND pol = ^(C.intToSql pol)`) of
+       [count] => C.intFromSql count
+      | row => Init.rowError ("countVoters", row)
+
+fun listPollVoters pol =
+    C.map (getDb ()) mkUserRow ($`SELECT DISTINCT WebUser.id, name, rname, bal, joined, app
+                                 FROM WebUser, Vote JOIN PollChoice ON cho = PollChoice.id
+                                 WHERE pol = ^(C.intToSql pol)
+                                    AND usr = WebUser.id
+                                 ORDER BY name`)
+
+end
index 8476410..5c20e6f 100644 (file)
--- a/pref.sml
+++ b/pref.sml
@@ -18,21 +18,21 @@ fun unsetDirectory usr =
     ignore (C.dml (getDb ()) ($`DELETE FROM DirectoryPref WHERE usr = ^(C.intToSql usr)`))
 
 fun subscribed (list, address) = OS.Process.isSuccess (OS.Process.system (String.concat
-                                                                        ["/usr/bin/sudo /usr/local/bin/portalsub ",
+                                                                        ["/usr/bin/sudo -u list /usr/local/bin/portalsub ",
                                                                          list,
                                                                          " check ",
                                                                          address]))
 
 fun subscribe (list, address) = OS.Process.isSuccess (OS.Process.system (String.concat
-                                                                        ["/usr/bin/sudo /usr/local/bin/portalsub ",
+                                                                        ["/usr/bin/sudo -u list /usr/local/bin/portalsub ",
                                                                          list,
                                                                          " add ",
                                                                          address]))
 
 fun unsubscribe (list, address) = OS.Process.isSuccess (OS.Process.system (String.concat
-                                                                              ["/usr/bin/sudo /usr/local/bin/portalsub ",
+                                                                              ["/usr/bin/sudo -u list /usr/local/bin/portalsub ",
                                                                                list,
                                                                                " rm ",
                                                                                address]))
 
-end
\ No newline at end of file
+end