<% local data, viewlibrary, page_info, session = ... 
htmlviewfunctions = require("htmlviewfunctions")
%>

<% htmlviewfunctions.displaycommandresults({"createdatabase"}, session, true) %>

<H1>Weblog Database Status</H1>
<DL>
<% local status
if viewlibrary and viewlibrary.dispatch_component then
	if viewlibrary.check_permission("postgresql/postgresql/status") then
		status = viewlibrary.dispatch_component("postgresql/postgresql/status", nil, true)
	end
end %>

<DT>Database status</DT><DD>
<% if status then %>
<% if status.value.status.errtxt then
	print(status.value.status.errtxt)
else
	print(status.value.status.value)
end %>
<% else %>
Unknown
<% end %>
</DD>

<DT>Weblog Database</DT><DD>
<% if data.value then %>
Present
<% else %>
Missing
<% end %>
</DD>
</DL>

<% if not data.value and viewlibrary and viewlibrary.dispatch_component then
	viewlibrary.dispatch_component("createdatabase")
end %>
