Changes rolling out beta version
authorAdam Chlipala <adamc@hcoop.net>
Sun, 8 May 2005 02:01:27 +0000 (02:01 +0000)
committerAdam Chlipala <adamc@hcoop.net>
Sun, 8 May 2005 02:01:27 +0000 (02:01 +0000)
balances.mlt
group.sml
header.mlt
money.mlt
portal.mlt
static/gen.sml
users.mlt
util.sig
util.sml

index d2c19c9..250d28c 100644 (file)
@@ -46,7 +46,8 @@ elseif $"mod" <> "" then
 
 <% end %>
 
-<% if showNormal then %>
+<% if showNormal then
+       ref total = 0.0 %>
 <h3><b>New balance</b></h3>
 
 <form action="balances">
@@ -59,11 +60,14 @@ elseif $"mod" <> "" then
 <h3><b>Manage current balances</b></h3>
 
 <table>
-<% foreach balance in Balance.listBalances () do %>
+<% foreach balance in Balance.listBalances () do
+       total := Util.add (total, #amount balance) %>
        <tr> <td><% Web.html (#name balance) %></td> <td><% #amount balance %></td> <td><a href="balances?mod=<% #id balance %>">[Modify]</a> <a href="balances?del=<% #id balance %>">[Delete]</a></td> </tr>
 <% end %>
 </table>
 
+<br><b>Total</b>: $<% total %>
+
 <% end %>
 
 <% @footer [] %>
index 3481eb2..cc3d5ea 100644 (file)
--- a/group.sml
+++ b/group.sml
@@ -83,11 +83,10 @@ fun addToGroup (mem : membership) =
        val usr = #usr mem
        val grp = #grp mem
     in
-       if userInGroupNum (usr, grp) then
-           ()
-       else
-           ignore (C.dml (getDb ()) ($`INSERT INTO Membership (grp, usr)
-                                       VALUES (^(C.intToSql grp), ^(C.intToSql usr))`))
+       case C.oneOrNoRows (getDb ()) ($`SELECT * FROM Membership WHERE grp = ^(C.intToSql grp) AND usr = ^(C.intToSql usr)`) of
+           NONE => ignore (C.dml (getDb ()) ($`INSERT INTO Membership (grp, usr)
+                                               VALUES (^(C.intToSql grp), ^(C.intToSql usr))`))
+         | SOME _ => ()
     end
 
 fun addToGroups (usr, grps) =
index 68e3d67..fad659a 100644 (file)
@@ -6,8 +6,4 @@
 <title><% Web.html title %></title>
 </head><body>
 
-<% if Group.inGroupNum 0 then %>
-<p><b>Admin</b>: <a href="users">Members</a> | <a href="groups">Groups</a> | <a href="balances">Balances</a></p>
-<% end %>
-
 <h2><b><% Web.html title %></b></h2>
index b16b14a..a0994f0 100644 (file)
--- a/money.mlt
+++ b/money.mlt
@@ -3,6 +3,7 @@
 ref showNormal = true;
 
 if $"cmd" = "list" then
+       val admin = Group.inGroupName "money";
        showNormal := false %>
 
 <h3><b>Transactions</b></h3>
@@ -12,9 +13,14 @@ if $"cmd" = "list" then
 <% foreach trn in Money.listTransactions () do %>
 <tr> <td><% #d trn %></td> <td><a href="money?trn=<% #id trn %>"><% Web.html (#descr trn) %></a></td> <td><% #amount trn %></td> <td><% #stamp trn %></td>
 <% switch Money.listChargesWithNames (#id trn) of
-         [(name, cha)] => %><td><a href="user?id=<% #usr cha %>"><% name %></a></td> </tr><%
-       | _ => %><td><i>multi</i></td> </tr><%
+         [(name, cha)] => %><td><a href="user?id=<% #usr cha %>"><% name %></a></td><%
+       | _ => %><td><i>multi</i></td><%
+end;
+if admin then
+       %><td><a href="money?modHosting=<% #id trn %>">[Hosting]</a> <a href="money?modPay=<% #id trn %>">[Payment]</a> <a href="money?modEven=<% #id trn %>">[Other]</a></td>
+       <td><a href="money?del=<% #id trn %>">[Delete]</a></td><%
 end
+%></tr><%
 end %>
 </table>
 
index a4cc617..5839663 100644 (file)
@@ -2,6 +2,29 @@
 val bal = Balance.lookupBalance (#bal you);
 @header [] %>
 
+<% if Group.inGroupNum 0 then %>
+<b><h3>Admin</h3></b>
+<a href="users">Members</a><br>
+<a href="groups">Groups</a><br>
+<a href="balances">Balances</a><br>
+<a href="kind">Contact kinds</a><br>
+<% end %>
+
+<b><h3>Your account</h3></b>
+
+<a href="pref">Preferences</a><br>
+<a href="money">Financial</a><br>
+<a href="contact">Contact information</a><br>
+<a href="location">Your geographic locations</a><br>
+<a href="link">Public URL directory</a><br>
+
+<b><h3>Support requests</h3></b>
+
+<a href="domain">Request control of a domain with domtool</a><br>
+<a href="apt">Request Debian apt packages</a><br>
+<a href="list">Request a Mailman mailing list</a><br>
+<a href="support">Other support request</a><br>
+
 <h3><b><a href="money">Your recent account activity</a></b></h3>
 
 <table>
@@ -32,4 +55,16 @@ end %>
 <br>
 <% end %>
 
+<h3><b>Public pages</b></h3>
+
+<a href="http://hcoop.net/dyn/members.html">Member directory</a><br>
+<a href="http://hcoop.net/dyn/locs.html">Member location summary</a><br>
+<a href="http://hcoop.net/dyn/sites.html">URL directory</a><br>
+
+<h3><b>Miscellaneous</b></h3>
+
+<a href="apps">Review pending membership applications</a><br>
+<a href="dir">Contact information directory</a><br>
+<a href="poll">Polls</a><br>
+
 <% @footer [] %>
\ No newline at end of file
index 9844e2d..6bb6e8b 100644 (file)
@@ -10,7 +10,7 @@ end
 
 structure NM = BinaryMapFn(IntKey)
 
-val outputDir = "/var/www/home/html/static/"
+val outputDir = "/var/www/home/html/dyn/"
 
 fun generate () =
     let
@@ -189,6 +189,7 @@ fun generate () =
                    end
                  | doOne _ = raise Fail "Bad member row"
            in
+               ignore (OS.Process.system ("/bin/rm " ^ outputDir ^ "member/*.html"));
                C.app db doOne "SELECT id, name, rname, joined, usr FROM WebUser LEFT OUTER JOIN DirectoryPref ON usr = id"
            end
 
index 000efa5..c55ffcc 100644 (file)
--- a/users.mlt
+++ b/users.mlt
@@ -89,7 +89,7 @@ elseif $"mod" <> "" then
 <tr> <td align="right"><input type="checkbox" name="subscribe" checked></td> <td>Subscribe to hcoop-announce</td> </tr>
 <tr> <td align="right"><b>Groups</b>:</td> <td><select name="grp" size="5" multiple>
 <% foreach group in Group.listGroups () do %>
-       <option value="<% #id group %>"><% Web.html (#name group) %></option>
+       <option value="<% #id group %>"<% if #name group = "paying" then %> selected<% end %>><% Web.html (#name group) %></option>
 <% end %>
 </select></td></tr>
 <tr> <td><input type="submit" name="cmd" value="Create"></td> </tr>
index 3bfaccc..df2fda7 100644 (file)
--- a/util.sig
+++ b/util.sig
@@ -14,6 +14,7 @@ sig
     val id : 'a -> 'a
     val makeSet : ('a -> string) -> 'a list -> string
     val neg : real -> real
+    val add : real * real -> real
 
     val validHost : string -> bool
     val validDomain : string -> bool
index a5ae19e..c56a011 100644 (file)
--- a/util.sml
+++ b/util.sml
@@ -28,6 +28,7 @@ fun makeSet f items =
       | usr::rest => foldl (fn (usr, s) => s ^ ", " ^ f usr) ("(" ^ f usr) rest ^ ")"
 
 fun neg (r : real) = ~r
+fun add (r1 : real, r2) = r1 + r2
 
 fun isIdent ch = Char.isLower ch orelse Char.isDigit ch