<% @header [("title", ["Disk quota change requests"])]; val admin = Group.inGroupName "server"; if $"new" <> "" then ref url = "?cmd=request&msg=" ^ Web.urlEncode ($"msg"); ref changed = false; val uname = Init.getUserName (); %>Are you sure you want to request these quota changes? <% if changed then %> Yes, I'm sure! <% else %> Hm, no changes! <% end elseif $"cmd" = "request" then ref cmds = ""; val uname = Init.getUserName (); foreach vol in Quotas.getQuotas uname do val requested = Web.stoi ($(#vol vol)); if requested <> #quota vol then cmds := cmds ^ "fs sq " ^ Quotas.path (#vol vol) ^ " " ^ Int.toString requested ^ "\n# Current quota: " ^ Int.toString (#quota vol) ^ "\n" end end; val id = Quota.add (Init.getUserId (), cmds, $"msg"); if not (Quota.notifyNew id) then %>

Error sending e-mail notification

<% end %>

Request added

<% elseif $"cmd" = "open" then %>

Open requests

List all requests<% foreach (name, req) in Quota.listOpen () do %>


By: <% name %>
Time: <% #stamp req %>
Request: <% Web.htmlNl (#data req) %>
Reason: <% Web.html (#msg req) %>
<% if admin then %>
[Modify] [Delete]
<% end %> <% end elseif $"cmd" = "list" then %>

All requests

<% foreach (name, req) in Quota.list () do %>


By: <% name %>
Time: <% #stamp req %>
Request: <% Web.htmlNl (#data req) %>
Reason: <% Web.html (#msg req) %>
<% if admin then %>
[Modify] [Delete] <% end %> <% end elseif $"mod" <> "" then Group.requireGroupName "server"; val id = Web.stoi ($"mod"); val req = Quota.lookup id; val user = Init.lookupUser (#usr req) %>

Handle request

Requestor: <% #name user %>
Time: <% #stamp req %>
Status:
Request:
Message:
<% elseif $"save" <> "" then Group.requireGroupName "server"; val id = Web.stoi ($"save"); val req = Quota.lookup id; val oldStatus = #status req; val newStatus = Quota.statusFromInt (Web.stoi ($"status")); Quota.modify {req with data = $"req", msg = $"msg", status = newStatus}; if oldStatus <> newStatus then if not (Quota.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then %>

Error sending e-mail notification

<% end end %>

Request modified

Back to: open requests, all requests <% elseif $"del" <> "" then Group.requireGroupName "server"; val id = Web.stoi ($"del"); val req = Quota.lookup id; val user = Init.lookupUser (#usr req) %>

Are you sure you want to delete request by <% #name user %> for <% #data req %>?

Yes, I'm sure! <% elseif $"del2" <> "" then Group.requireGroupName "server"; val id = Web.stoi ($"del2"); Quota.delete id %>

Request deleted

Back to: open requests, all requests <% else %>

Request a disk quota change

<% foreach vol in Quotas.getQuotas (Init.getUserName ()) do %> <% end %>
Volume Used (kB) Quota now (kB) Requested quota (kB)
<% #vol vol %> <% #used vol %> <% #quota vol %>
Additional comments:
<% end %> <% @footer[] %>