1 <% @header [("title", ["APT package installation requests"])];
3 val admin = Group.inGroupName "server";
6 val pkgs = String.tokens Char.isSpace ($"new");
11 foreach pkg in pkgs do
12 switch AptQuery.query pkg of
15 %><b>Error</b>: Unknown package "<% Web.html pkg %>."<br><%
17 if #installed info then
19 %><b>Error</b>: Package "<% pkg %>" is already installed!<br><%
21 infos := info :: infos
27 Are you sure these are the packages you wanted?<br><br>
29 <% foreach info in infos do %>
30 <tr> <td align="right"><a href="http://packages.debian.org/testing/<% #section info %>/<% #name info %>"><% #name info %></a></td>
31 <td><% Web.html (#descr info) %></td> </tr>
35 <b>Reason:</b> <blockquote><% Web.htmlNl ($"msg") %></blockquote><br>
36 <a href="apt?req=<% foreach info in infos do %><% #name info %>+<% end %>&msg=<% Web.urlEncode ($"msg") %>">Yes, I want to request these packages.</a>
40 elseif $"req" <> "" then
41 val pkgs = String.tokens Char.isSpace ($"req");
45 foreach pkg in pkgs do
46 switch AptQuery.query pkg of
49 %><b>Error</b>: Unknown package "<% Web.html pkg %>."<br><%
51 if #installed info then
53 %><b>Error</b>: Package "<% pkg %>" is already installed!<br><%
59 val id = Apt.add (Init.getUserId(), $"req", $"msg");
60 if not (Apt.notifyNew id) then
61 %><h3>Error sending e-mail notification</h3><%
63 %><h3>Request added</h3><%
66 elseif $"cmd" = "open" then
67 %><h3>Open requests</h3>
68 <a href="apt?cmd=list">List all requests</a><%
70 foreach (name, req) in Apt.listOpen () do %>
72 <table class="blanks">
73 <tr> <td>By:</td> <td colspan="2"><a href="user?id=<% #usr req %>"><% name %></a></td> </tr>
74 <tr> <td>Time:</td> <td colspan="2"><% #stamp req %></td> </tr>
75 <tr> <td>Packages:</td><%
78 val pkgs = String.tokens Char.isSpace (#data req);
80 foreach pkg in pkgs do
84 %></tr><tr> <td></td><%
86 switch AptQuery.query pkg of
88 %><td></td> <td><b>Error</b>: Unknown package "<% Web.html pkg %>."</td><%
90 %><td align="right"><a href="http://packages.debian.org/testing/<% #section info %>/<% #name info %>"><% #name info %></a></td>
91 <td><% Web.html (#descr info) %></td><%
95 <tr> <td>Reason:</td> <td colspan="2"><% Web.html (#msg req) %></td> </tr>
100 <a href="apt?mod=<% #id req %>">[Modify]</a>
101 <a href="apt?del=<% #id req %>">[Delete]</a><br>
102 To install, run: <tt>apt-get install<% foreach pkg in pkgs do %> <% pkg %><% end %></tt>
107 elseif $"cmd" = "list" then
108 %><h3>All requests</h3><%
110 foreach (name, req) in Apt.list () do %>
112 <table class="blanks">
113 <tr> <td>By:</td> <td colspan="2"><a href="user?id=<% #usr req %>"><% name %></a></td> </tr>
114 <tr> <td>Time:</td> <td colspan="2"><% #stamp req %></td> </tr>
115 <tr> <td>Packages:</td><%
118 val pkgs = String.tokens Char.isSpace (#data req);
120 foreach pkg in pkgs do
124 %></tr><tr> <td></td><%
126 switch AptQuery.query pkg of
128 %><td></td> <td><b>Error</b>: Unknown package "<% Web.html pkg %>."</td><%
130 %><td align="right"><a href="http://packages.debian.org/testing/<% #section info %>/<% #name info %>"><% #name info %></a></td>
131 <td><% Web.html (#descr info) %></td><%
135 <tr> <td>Reason:</td> <td colspan="2"><% Web.html (#msg req) %></td> </tr>
140 <a href="apt?mod=<% #id req %>">[Modify]</a>
141 <a href="apt?del=<% #id req %>">[Delete]</a>
146 elseif $"mod" <> "" then
147 Group.requireGroupName "server";
148 val id = Web.stoi ($"mod");
149 val req = Apt.lookup id;
150 val user = Init.lookupUser (#usr req) %>
151 <h3>Handle request</h3>
153 <form action="apt" method="post">
154 <input type="hidden" name="save" value="<% id %>">
155 <table class="blanks">
156 <tr> <td>Requestor:</td> <td><a href="user?id=<% #usr req %>"><% #name user %></a></td> </tr>
157 <tr> <td>Time:</td> <td><% #stamp req %></td> </tr>
158 <tr> <td>Status:</td> <td><select name="status">
159 <option value="0"<% if #status req = Apt.NEW then %> selected<% end %>>New</option>
160 <option value="1"<% if #status req = Apt.INSTALLED then %> selected<% end %>>Installed</option>
161 <option value="2"<% if #status req = Apt.REJECTED then %> selected<% end %>>Rejected</option>
163 <tr> <td>Packages:</td> <td><textarea name="pkgs" rows="5" cols="40" wrap="soft"><% Web.html (#data req) %></textarea></td> </tr>
164 <tr> <td>Message:</td> <td><textarea name="msg" rows="10" cols="80" wrap="soft"><% Web.html (#msg req) %></textarea></td> </tr>
165 <tr> <td><input type="submit" value="Save"></td> </tr>
169 <% elseif $"save" <> "" then
170 Group.requireGroupName "server";
171 val id = Web.stoi ($"save");
172 val req = Apt.lookup id;
173 val oldStatus = #status req;
174 val newStatus = Apt.statusFromInt (Web.stoi ($"status"));
175 Apt.modify {req with data = $"pkgs", msg = $"msg", status = newStatus};
176 if oldStatus <> newStatus then
177 if not (Apt.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then
178 %><h3>Error sending e-mail notification</h3><%
181 %><h3>Request modified</h3>
182 Back to: <a href="apt?cmd=open">open requests</a>, <a href="apt?cmd=list">all requests</a>
184 <% elseif $"del" <> "" then
185 Group.requireGroupName "server";
186 val id = Web.stoi ($"del");
187 val req = Apt.lookup id;
188 val user = Init.lookupUser (#usr req)
189 %><h3>Are you sure you want to delete request by <% #name user %> for <tt><% #data req %></tt>?</h3>
190 <a href="apt?del2=<% id %>">Yes, I'm sure!</a>
192 <% elseif $"del2" <> "" then
193 Group.requireGroupName "server";
194 val id = Web.stoi ($"del2");
196 %><h3>Request deleted</b><h3>
197 Back to: <a href="apt?cmd=open">open requests</a>, <a href="apt?cmd=list">all requests</a>
201 <h3>Request new installations</h3>
203 List the package names you'd like, separated by any whitespace characters.
205 <form action="apt" method="post">
206 <table class="blanks">
207 <tr> <td>Packages:</td> <td><textarea name="new" rows="10" cols="40" wrap="soft"></textarea></td> </tr>
208 <tr> <td>Reason:</td> <td><textarea name="msg" rows="5" cols="80" wrap="soft"></textarea></td> </tr>
209 <tr> <td><input type="submit" value="Request"></td> </tr>