Specify host for database connections
[hcoop/portal.git] / portal.mlt
index a4cc617..e9d82fe 100644 (file)
@@ -1,28 +1,46 @@
 <% val you = Init.getUser();
 val bal = Balance.lookupBalance (#bal you);
+val deposit = Balance.depositAmount (#id bal);
+val showBal = Util.sub (#amount bal, deposit);
 @header [] %>
 
-<h3><b><a href="money">Your recent account activity</a></b></h3>
+<% @payment [] %>
 
+<h3><a href="money">Your recent account activity</a></h3>
+
+<% ref running = showBal %>
 <table>
-<tr> <td><b>Date</b></td> <td><b>Description</b></td> <td><b>Amount</b></td> </tr>
+<tr> <td><b>Date</b></td> <td><b>Description</b></td> <td><b>Amount</b></td> <td><b>Balance</b></td></tr>
 <% foreach (amount, trn) in Money.listUserTransactionsLimit (Init.getUserId (), 5) do %>
-<tr> <td><% #d trn %></td> <td><a href="money?trn=<% #id trn %>"><% Web.html (#descr trn) %></a></td> <td><% amount %>/<% #amount trn %></td> </tr>
-<% end %>
+<tr> <td><% #d trn %></td> <td><a href="money?trn=<% #id trn %>"><% Web.html (#descr trn) %></a></td> <td><% amount %>/<% #amount trn %></td>
+<td><% running %></tr>
+<% running := Util.sub (running, amount)
+end %>
 </table>
-<b>Balance: $<% #amount bal %></b>
+<a href="money?lookback=inf">Show all transactions</a><br>
+<b>Balance: $<% showBal %></b><br>
+<b>Deposit: $<% deposit %></b> (3 months of dues at the minimal <a href="pledge">pledge level</a>)
+
+<!--b>Balance: $<% #amount bal %></b-->
 
-<h3><b><a href="poll">Current polls</a></b></h3>
+<% val polls = Poll.listCurrentPolls ();
+switch polls of
+       _::_ => %>
+<h3><a href="poll">Current polls</a></h3>
 
-<% foreach pol in Poll.listCurrentPolls () do %>
+<% foreach pol in polls do %>
 <li> <a href="poll?id=<% #id pol %>"><% Web.html (#title pol) %></a>
 <% if Poll.takingVotes pol then %><a href="poll?vote=<% #id pol %>">[VOTE]</a><% end %>
 (<% Web.html (#starts pol) %> to <% Web.html (#ends pol) %>)</li>
-<% end %>
+<% end
+end %>
 
-<h3><b><a href="support">Open support issues</a></b></h3>
+<% val issues = Support.listOpenIssues (#id you);
+switch issues of
+       _::_ => %>
+<h3><a href="support">Open support issues</a></h3>
 
-<% foreach (name, issue) in Support.listOpenIssues (#id you) do %>
+<% foreach (name, issue) in issues do %>
 <a href="user?id=<% #usr issue %>"><% name %></a>: <a href="issue?cat=<% #cat issue %>&id=<% #id issue %>"><% Web.html (#title issue) %></a>
 <% switch #status issue of
          Support.NEW => %>(New)<%
@@ -30,6 +48,18 @@ val bal = Balance.lookupBalance (#bal you);
        | Support.CLOSED => %>(Closed)<%
 end %>
 <br>
-<% end %>
+<% end
+end;
+
+val {total, vhosts} = Stats.getWebbwUser {user = Init.getUserName (), last = 0};
+switch vhosts of
+       _ :: _ =>
+       %><h3>Your web traffic this month</h3>
+       <table><tr><th>Site</th> <th>Data transferred (kB)</th></tr><%
+       foreach e in vhosts do %>
+                      <tr><td align="right"><a href="<% if #ssl (#host e) then %>https<% else %>http<% end %>://<% #hostname (#host e) %>/"><% #hostname (#host e) %><% if #ssl (#host e) then %> (SSL)<% end %></a> <a href="/webalizer/<% #id (#host e) %>/">[detail]</a></td><td><% #size e %></td></tr>
+       <% end %>
+       </table>
+<% end;
 
-<% @footer [] %>
\ No newline at end of file
+@footer [] %>