summaryrefslogtreecommitdiffstats
path: root/cron-listjobs-html.lsp
blob: 6cc4463f0b63672c0542bdb1a03dd69059d12164 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<% local view, viewlibrary, page_info, session = ... %>
<% require("viewfunctions") %>

<% displaycommandresults({"editjob", "deletejob", "movejob"}, session) %>
<% displaycommandresults({"createjob"}, session, true) %>

<% if viewlibrary and viewlibrary.dispatch_component then
	viewlibrary.dispatch_component("status")
end %>

<% -- set up the form for the move action
local formstart = '<form action="'..html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/movejob")..'" method="POST">'
formstart = formstart .. '<input type="hidden" name="name" value="'
local formend = '">\n<select name="period" style="width:150px">'
for i,tabl in ipairs(view.value) do
	if i == 1 then
		formend = formend .. '<option selected value="'..tabl.period..'">'..tabl.period..'</option>'
	else
		formend = formend .. '<option value="'..tabl.period..'">'..tabl.period..'</option>'
	end
end
formend = formend .. '</select>\n<input class="submit" type="submit" name="Move" value="Move"></form>'
local function createmoveform(name)
	io.write(formstart, name, formend)
end
%>

<H1>Cron Jobs</H1>
<% for i,tabl in ipairs(view.value) do %>
<H2><%= html.html_escape(tabl.period) %></H2>
<DL>
	<% if #tabl.jobs == 0 then %>
No jobs
	<% else %>
<TABLE>
	<TR style="background:#eee;font-weight:bold;">
		<TD style="padding-right:20px;white-space:nowrap;text-align:left;" class="header">Job</TD>
		<TD style="white-space:nowrap;text-align:left;" class="header">Action</TD>
		<TD style="white-space:nowrap;text-align:left;" class="header"></TD>
	</TR>
		<% for i,job in ipairs(tabl.jobs) do %>
	<TR>
		<TD style="white-space:nowrap;"><%= html.html_escape(string.gsub(job, "^.*/", "")) %></TD>
		<TD style="padding-right:20px;white-space:nowrap;">
			<%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/editjob?name="..job.."&redir="..page_info.orig_action, label="Edit "} %>
			<%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/deletejob?name="..job, label="Delete "} %>
			</TD><TD>
			<% createmoveform(job, tabl.period) %>
		</TD>
	</TR>
		<% end %>
</TABLE>
	<% end %>
</DL>
<% end %>

<% if viewlibrary.check_permission("createjob") then
	viewlibrary.dispatch_component("createjob")
end %>