From 1d2cae170dd5040d5214e0dd8bc7751a01db319a Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Wed, 28 Sep 2005 14:54:19 +0000 Subject: [PATCH] Random fixin's in preparation for accepting new members --- app/.cvsignore | 3 ++- app/app.sml | 12 ++++++------ app/join.mlt | 6 +++++- app/mlt.conf | 3 ++- app/out/.cvsignore | 1 + init.sml | 2 +- listaddrs/.cvsignore | 4 ++++ listaddrs/Makefile | 2 ++ listaddrs/listaddrs.sml | 15 +++++++++++++++ listaddrs/sources.cm | 7 +++++++ poll.mlt | 13 +++++++++++++ poll.sig | 7 ++++++- poll.sml | 15 ++++++++++++++- pref.sml | 8 ++++---- 14 files changed, 82 insertions(+), 16 deletions(-) create mode 100644 app/out/.cvsignore create mode 100644 listaddrs/.cvsignore create mode 100644 listaddrs/Makefile create mode 100644 listaddrs/listaddrs.sml create mode 100644 listaddrs/sources.cm diff --git a/app/.cvsignore b/app/.cvsignore index 854c999..297025f 100644 --- a/app/.cvsignore +++ b/app/.cvsignore @@ -1,2 +1,3 @@ .cm -CM \ No newline at end of file +CM +out diff --git a/app/app.sml b/app/app.sml index 05c0d80..84ca130 100644 --- a/app/app.sml +++ b/app/app.sml @@ -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 diff --git a/app/join.mlt b/app/join.mlt index 54b63f7..10164cd 100644 --- a/app/join.mlt +++ b/app/join.mlt @@ -43,7 +43,7 @@ else + 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. <% if minor then %> @@ -58,6 +58,10 @@ else
Desired username:
- You should follow usual UNIX conventions, and it's helpful to pick a name you wouldn't mind using to identify yourself to strangers.
New member's "real" name:
Legal guardian's name:
Any other information about yourself
+


+ +You must agree to the following terms to be considered for membership: +

Terms of Service Agreement

<% App.readTosBody () %> diff --git a/app/mlt.conf b/app/mlt.conf index a3134a7..b3f7161 100644 --- a/app/mlt.conf +++ b/app/mlt.conf @@ -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 index 0000000..f59ec20 --- /dev/null +++ b/app/out/.cvsignore @@ -0,0 +1 @@ +* \ No newline at end of file diff --git a/init.sml b/init.sml index 81f5b10..d8ceeb3 100644 --- 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 index 0000000..04cf57d --- /dev/null +++ b/listaddrs/.cvsignore @@ -0,0 +1,4 @@ +*.x86-linux +.cm +CM +listaddrs diff --git a/listaddrs/Makefile b/listaddrs/Makefile new file mode 100644 index 0000000..a829c3b --- /dev/null +++ b/listaddrs/Makefile @@ -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 index 0000000..15a224c --- /dev/null +++ b/listaddrs/listaddrs.sml @@ -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 index 0000000..1e575d3 --- /dev/null +++ b/listaddrs/sources.cm @@ -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 diff --git a/poll.mlt b/poll.mlt index ad8e152..9cc9c60 100644 --- a/poll.mlt +++ b/poll.mlt @@ -207,6 +207,17 @@ elseif $"delChoice" <> "" then

Vote Report

+

Voters: +<% ref first = true; + foreach user in Poll.listPollVoters id do + if first then + first := false + else + %>, <% + end + %><% #name user %><% + end %>

+ @@ -257,6 +268,8 @@ end %>

Choices<% if Poll.takingVotes poll then %>(Vote!)<% end %>

+

<% Poll.countVoters (#id poll) %> people have voted.

+ <% if Poll.takingVotes poll then %>
Poll#: <% id %>
Title: <% Web.html (#title poll) %>
diff --git a/poll.sig b/poll.sig index d459f04..8111fe9 100644 --- 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 diff --git a/poll.sml b/poll.sml index 32e588d..e549218 100644 --- 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 diff --git a/pref.sml b/pref.sml index 8476410..5c20e6f 100644 --- 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 -- 2.20.1
You Total