Add [X]HTML5 DTD to header
[hcoop/portal.git] / apps.mlt
index c59d18a..e3ac4b2 100644 (file)
--- a/apps.mlt
+++ b/apps.mlt
@@ -1,12 +1,43 @@
 <% @header [("title", ["Membership applications"])];
 
 val you = Init.getUserId ();
-val board = Group.inGroupName "board";
+val board = Group.reallyInGroupName "board";
 val root = Group.inGroupNum 0;
 
 ref showNormal = true;
 
-if $"vote" <> "" then
+if $"show" <> "" then
+       showNormal := false;
+       val usr = Web.stoi ($"show");
+       val user = Init.lookupUser usr;
+       val appl = App.lookupApp (#app user) %>
+
+       <table class="blanks">
+       <tr> <td>Received:</td> <td><% #applied appl %> (<% Util.diffFromNow (#applied appl) %> ago)</td> </tr>
+       <tr> <td>Approved by:</td> <td><%
+               ref first = true;
+               ref found = false;
+               val votes = App.votes (#id appl);
+               foreach (id, name) in votes do
+                       if first then
+                               first := false
+                       else
+                               %>, <%
+                       end
+                       %><a href="user?id=<% id %>"><% name %></a><%
+                       if id = you then
+                               found := true
+                               %> <a href="apps?unvote=<% #id appl %>">[Unvote]</a><%
+                       end
+               end %> <% if (iff board then not found else false) then %><a href="apps?vote=<% #id appl %>">[Vote]</a><% end %></td> </tr>
+       <tr> <td>Username:</td> <td><% #name appl %></td> </tr>
+       <tr> <td>Real name:</td> <td><% Web.html (#rname appl) %></td> </tr>
+       <tr> <td>E-mail:</td> <td><a href="mailto:<% #email appl %>"><% #email appl %></a></td> </tr>
+       <tr> <td>Forward e-mail?</td> <td><% if #forward appl then %>yes<% else %>no<% end %></td> </tr>
+       <tr> <td>Proposed uses:</td> <td><% Web.htmlNl (#uses appl) %></td> </tr>
+       <tr> <td>Other information:</td> <td><% Web.htmlNl (#other appl) %></td> </tr>
+       </table>        
+<% elseif $"vote" <> "" then
        Group.requireGroupName "board";
        App.vote (you, Web.stoi ($"vote"))
        %><h3>Vote registered</h3><%
@@ -37,7 +68,7 @@ elseif $"approve" <> "" then
        %><h3>Approve application for <% #name appl %></h3>
        <form action="apps" method="post">
        <input type="hidden" name="approve2" value="<% $"approve" %>">
-       <b>Message</b>:<br>
+       <b>Message</b> (will be added at the end of <tt>~hcoop/portal/welcome.txt</tt>, so you might want to include some introductory text):<br>
        <textarea name="msg" rows="5" cols="80" wrap="soft"></textarea><br>
        <input type="submit" value="Submit">
        </form><%
@@ -53,10 +84,10 @@ elseif $"cmd" = "approved" then
 
        %><h3>Pending applications</h3><%
 
-       foreach appl in App.listApps App.ACCEPTED do %>
+       foreach appl in App.listApps [App.ACCEPTED, App.BEING_ADDED] do %>
                <br><hr><br>
                <table class="blanks">
-               <tr> <td>Received:</td> <td><% #applied appl %></td> </tr>
+               <tr> <td>Received:</td> <td><% #applied appl %> (<% Util.diffFromNow (#applied appl) %> ago)</td> </tr>
                <tr> <td>Approved by:</td> <td><%
                        ref first = true;
                        ref found = false;
@@ -80,6 +111,7 @@ elseif $"cmd" = "approved" then
        <tr> <td>Forward e-mail?</td> <td><% if #forward appl then %>yes<% else %>no<% end %></td> </tr>
        <tr> <td>Proposed uses:</td> <td><% Web.htmlNl (#uses appl) %></td> </tr>
        <tr> <td>Other information:</td> <td><% Web.htmlNl (#other appl) %></td> </tr>
+       <% if #status appl = App.BEING_ADDED then %><tr> <td colspan="2" align="left"><font color="red"><b>WARNING: Someone already followed the add link for this application.  Maybe he forgot to finish.</b></font></td></tr><% end %>
        </table>
 
        <% if root then %>
@@ -91,10 +123,10 @@ elseif $"add" <> "" then
        showNormal := false;
        val id = Web.stoi ($"add");
        val appl = App.lookupApp id;
-       App.add id %>
+       App.preAdd id %>
 
 First, run this on deleuze:
-<blockquote><tt>magic-create-user-wrapper <% #name appl %> "<% #rname appl %>"<% if #forward appl then %> "<% #email appl %>"<% end %></tt></blockquote>
+<blockquote><tt>new-user <% #name appl %> "<% #rname appl %>"<% if #forward appl then %> "<% #email appl %>"<% end %></tt></blockquote>
 
 <form action="users" method="post">
 <input type="hidden" name="app" value="<% #id appl %>">
@@ -109,7 +141,7 @@ First, run this on deleuze:
 </select></td></tr>
 <tr> <td>Initial transaction amount:</td> <td><input name="amount"></td> </tr>
 <tr> <td>Initial transaction description:</td> <td><input name="descr"></td> </tr>
-<tr> <td><input type="checkbox" name="subscribe" checked></td> <td>Subscribe to hcoop-announce</td> </tr>
+<!--tr> <td><input type="checkbox" name="subscribe" checked></td> <td>Subscribe to hcoop-announce</td> </tr-->
 <tr> <td>Groups:</td> <td><select name="grp" size="5" multiple>
 <% foreach group in Group.listGroups () do %>
        <option value="<% #id group %>"<% if #name group = "paying" then %> selected<% end %>><% Web.html (#name group) %></option>
@@ -130,10 +162,10 @@ end %>
 <% if showNormal then %>
 <h3>Pending applications</h3>
 
-<% foreach appl in App.listApps App.PENDING do %>
+<% foreach appl in App.listApps [App.PENDING] do %>
        <br><hr><br>
        <table class="blanks">
-       <tr> <td>Received:</td> <td><% #applied appl %></td> </tr>
+       <tr> <td>Received:</td> <td><% #applied appl %> (<% Util.diffFromNow (#applied appl) %> ago)</td></tr>
        <tr> <td>Approved by:</td> <td><%
                ref first = true;
                ref found = false;
@@ -165,10 +197,10 @@ end %>
        </table>
 
        <% if board then %>
-       <% if length votes >= 2 then %><a href="apps?approve=<% #id appl %>">Approve this member.</a><br><% end %>
+       <% if length votes >= 3 then %><a href="apps?approve=<% #id appl %>">Approve this member.</a><br><% end %>
        <a href="apps?deny=<% #id appl %>">Deny this application.</a>
        <% end %>
-<% end
+<% end 
 end %>
 
-<% @footer[] %>
\ No newline at end of file
+<% @footer[] %>