<% 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 [] %>
* vhosts to kilobytes, and a mapping from usernames to their vhosts and bandwidth
* totals. *)
+ val getWebbwUser : {user : string, last : int} -> {total : int,
+ vhosts : {host : host, size : int} list}
+
type disk = {uname : string, (* UNIX username *)
kbs : int} (* Number of kilobytes space used *)
before TextIO.closeIn inf
end
- type disk = {uname : string,
+ fun getWebbwUser {user, last} =
+ let
+ val {vhosts, users, ...} = getWebbw last
+ in
+ case List.find (fn {user = u, ...} => u = user) users of
+ NONE => {total = 0, vhosts = []}
+ | SOME {hosts, size, ...} =>
+ {total = size, vhosts = List.filter (fn {host, ...} => List.exists (fn host' => host' = host) hosts) vhosts}
+ end
+
+
+ type disk = {uname : string,
kbs : int}
structure StringKey = struct