X-Git-Url: http://git.hcoop.net/hcoop/portal.git/blobdiff_plain/5da9f4a91ea8e648812be0ca1afaeace2ba0423c..0b4db14f7226c2e419320aa1a5140056038ba0c3:/apt.mlt diff --git a/apt.mlt b/apt.mlt index 519040b..df5e26e 100644 --- a/apt.mlt +++ b/apt.mlt @@ -2,6 +2,10 @@ val admin = Group.inGroupName "server"; +val nodeNum = case $"node" of + "" => 2 + | node => Web.stoi node; + if $"new" <> "" then val pkgs = String.tokens Char.isSpace ($"new"); @@ -9,7 +13,7 @@ if $"new" <> "" then ref infos = []; foreach pkg in pkgs do - switch AptQuery.query pkg of + switch AptQuery.query {node = nodeNum, pkg = pkg} of NONE => ok := false; %>Error: Unknown package "<% Web.html pkg %>."
<% @@ -23,17 +27,18 @@ if $"new" <> "" then end end; - if ok then %> + if ok then + val debian = Init.nodeDebian nodeNum %> Are you sure these are the packages you wanted?

<% foreach info in infos do %> - + <% end %>
<% #name info %>
<% #name info %> <% Web.html (#descr info) %>


Reason:
<% Web.htmlNl ($"msg") %>

- ">Yes, I want to request these packages. + ">Yes, I want to request these packages. <% end @@ -43,7 +48,7 @@ elseif $"req" <> "" then ref ok = true; foreach pkg in pkgs do - switch AptQuery.query pkg of + switch AptQuery.query {node = nodeNum, pkg = pkg} of NONE => ok := false; %>Error: Unknown package "<% Web.html pkg %>."
<% @@ -56,26 +61,28 @@ elseif $"req" <> "" then end; if ok then - val id = Apt.add (Init.getUserId(), $"req", $"msg"); + val id = Apt.add {usr = Init.getUserId(), node = nodeNum, data = $"req", msg = $"msg"}; if not (Apt.notifyNew id) then - %>

Error sending e-mail notification

<% + %>

Error sending e-mail notification

<% end - %>

Request added

<% + %>

Request added

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

Open requests

+ %>

Open requests

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


- - - -<% +
By: <% name %>
Time: <% #stamp req %>
Packages:
+ + + +<% ref first = true; val pkgs = String.tokens Char.isSpace (#data req); + val debian = Init.nodeDebian (#node req); foreach pkg in pkgs do if first then @@ -83,16 +90,16 @@ elseif $"cmd" = "open" then else %><% end; - switch AptQuery.query pkg of + switch AptQuery.query {node = #node req, pkg = pkg} of NONE => %><% | SOME info => - %> + %><% end end %> - +
By: <% name %>
Time: <% #stamp req %> (<% Util.diffFromNow (#stamp req) %> ago)
Node: <% Web.html (Init.nodeName (#node req)) %>
Packages:
Error: Unknown package "<% Web.html pkg %>."<% #name info %><% #name info %> <% Web.html (#descr info) %>
Reason: <% Web.html (#msg req) %>
Reason: <% Web.html (#msg req) %>
<% if admin then %> @@ -105,17 +112,19 @@ elseif $"cmd" = "open" then <% end elseif $"cmd" = "list" then - %>

All requests

<% + %>

All requests

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


- - - -<% +
By: <% name %>
Time: <% #stamp req %>
Packages:
+ + + +<% ref first = true; val pkgs = String.tokens Char.isSpace (#data req); + val debian = Init.nodeDebian (#node req); foreach pkg in pkgs do if first then @@ -123,16 +132,16 @@ elseif $"cmd" = "list" then else %><% end; - switch AptQuery.query pkg of + switch AptQuery.query {node = #node req, pkg = pkg} of NONE => %><% | SOME info => - %> + %><% end end %> - +
By: <% name %>
Time: <% #stamp req %> (<% Util.diffFromNow (#stamp req) %> ago)
Node: <% Web.html (Init.nodeName (#node req)) %>
Packages:
Error: Unknown package "<% Web.html pkg %>."<% #name info %><% #name info %> <% Web.html (#descr info) %>
Reason: <% Web.html (#msg req) %>
Reason: <% Web.html (#msg req) %>
<% if admin then %> @@ -148,20 +157,25 @@ elseif $"mod" <> "" then val id = Web.stoi ($"mod"); val req = Apt.lookup id; val user = Init.lookupUser (#usr req) %> -

Handle request

+

Handle request

-
+ - - - -
Requestor: <% #name user %>
Time: <% #stamp req %>
Status: + + + - - + +
Requestor: <% #name user %>
Time: <% #stamp req %> (<% Util.diffFromNow (#stamp req) %> ago)
Node: +
Status:
Packages:
Message:
Packages:
Message:
@@ -169,16 +183,15 @@ elseif $"mod" <> "" then <% elseif $"save" <> "" then Group.requireGroupName "server"; val id = Web.stoi ($"save"); + val node = Web.stoi ($"node"); val req = Apt.lookup id; val oldStatus = #status req; val newStatus = Apt.statusFromInt (Web.stoi ($"status")); - Apt.modify {req with data = $"pkgs", msg = $"msg", status = newStatus}; - if oldStatus <> newStatus then - if not (Apt.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then - %>

Error sending e-mail notification

<% - end + Apt.modify {req with node = node, data = $"pkgs", msg = $"msg", status = newStatus}; + if not (Apt.notifyMod {old = oldStatus, new = newStatus, changer = Init.getUserName(), req = id}) then + %>

Error sending e-mail notification

<% end - %>

Request modified

+ %>

Request modified

Back to: open requests, all requests <% elseif $"del" <> "" then @@ -186,26 +199,31 @@ elseif $"mod" <> "" then val id = Web.stoi ($"del"); val req = Apt.lookup id; val user = Init.lookupUser (#usr req) - %>

Are you sure you want to delete request by <% #name user %> for <% #data 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"); Apt.delete id - %>

Request deleted

+ %>

Request deleted

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

Request new installations

+

Request new installations

List the package names you'd like, separated by any whitespace characters. -
- - - + +
Packages:
Reason:
+ + +
Machine:
Packages:
Reason: