summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2014-01-22 16:32:46 +0000
committerTed Trask <ttrask01@yahoo.com>2014-01-22 16:32:46 +0000
commitdbbb88812817d58aa7dd53633f9d81a1a1fa6565 (patch)
treed598c632218a757c5f087a2dd86dd4c647404c20
parent52525eed79994b294af9cf905f6574fc75955369 (diff)
downloadacf-core-dbbb88812817d58aa7dd53633f9d81a1a1fa6565.tar.bz2
acf-core-dbbb88812817d58aa7dd53633f9d81a1a1fa6565.tar.xz
Modify HTML to replace DL,DT,DD with divs. Also cleanup other HTML.
-rw-r--r--app/acf-util/password-status-html.lsp54
-rw-r--r--app/acf-util/roles-read-html.lsp49
-rw-r--r--app/acf-util/roles-viewroles-html.lsp46
-rw-r--r--app/acf-util/skins-read-html.lsp10
-rw-r--r--app/acf-util/welcome-html.lsp2
-rw-r--r--app/debug-html.lsp8
-rw-r--r--app/filedetails-html.lsp20
-rw-r--r--app/status-html.lsp18
-rw-r--r--lib/htmlviewfunctions.lua68
9 files changed, 150 insertions, 125 deletions
diff --git a/app/acf-util/password-status-html.lsp b/app/acf-util/password-status-html.lsp
index f322b55..9316bda 100644
--- a/app/acf-util/password-status-html.lsp
+++ b/app/acf-util/password-status-html.lsp
@@ -4,35 +4,35 @@
<% htmlviewfunctions.displaycommandresults({"newuser", "edituser", "deleteuser"}, session) %>
-<H1>User Accounts</H1>
-<H2>Create new account</H2>
-<form action="<%= page_info.script .. page_info.prefix .. page_info.controller %>/newuser" method="POST">
+<h1>User Accounts</h1>
+<h2>Create new account</h2>
+<form action="<%= page_info.script .. page_info.prefix .. page_info.controller %>/newuser" method="post">
<input class="hidden" type="hidden" name="redir" value="<%= html.html_escape(page_info.orig_action) %>" >
-<dl><dt></dt><dd><input class="submit" type="submit" value="Create"></dd></dl>
+<div class='item'><p class='left'></p><div class='right'><input class="submit" type="submit" value="Create"></div></div><!-- end .item -->
</form>
-<H2>Existing account</H2>
-<DL>
+<h2>Existing account</h2>
<% for i,user in ipairs(form.value) do
local name = html.html_escape(user.value.userid.value) %>
- <DT><IMG SRC='<%= html.html_escape(page_info.wwwprefix..page_info.staticdir) %>/tango/16x16/apps/system-users.png' HEIGHT='16' WIDTH='16'> <%= name %></DT>
- <DD><TABLE>
- <TR>
- <TD STYLE='border:none;'><B><%= html.html_escape(user.value.userid.label) %></B></TD>
- <TD STYLE='border:none;' WIDTH='90%'><%= html.html_escape(user.value.userid.value) %></TD>
- </TR><TR>
- <TD STYLE='border:none;'><B><%= html.html_escape(user.value.username.label) %></B></TD>
- <TD STYLE='border:none;'><%= html.html_escape(user.value.username.value) %></TD>
- </TR><TR>
- <TD STYLE='border:none;'><B><%= html.html_escape(user.value.roles.label) %></B></TD>
- <TD STYLE='border:none;'><%= html.html_escape(table.concat(user.value.roles.value, ", ")) %></TD>
- </TR><TR>
- <TD STYLE='border:none;'><B>Option</B></TD>
- <TD STYLE='border:none;'>
- [<A HREF='edituser?userid=<%= name %>&redir=<%= html.html_escape(page_info.orig_action) %>'>Edit this account</A>]
- [<A HREF='deleteuser?userid=<%= name %>&submit=true'>Delete this account</A>]
- [<A HREF='<%= html.html_escape(page_info.script) %>/acf-util/roles/viewuserroles?userid=<%= name %>'>View roles for this account</A>]
- </TD>
- </TR>
- </TABLE></DD>
+ <div class='item'><p class='left'><img src='<%= html.html_escape(page_info.wwwprefix..page_info.staticdir) %>/tango/16x16/apps/system-users.png' height='16' width='16'> <%= name %></p>
+ <div class='right'>
+ <table><tbody>
+ <tr>
+ <td style='border:none;'><b><%= html.html_escape(user.value.userid.label) %></b></td>
+ <td style='border:none;' width='90%'><%= html.html_escape(user.value.userid.value) %></td>
+ </tr><tr>
+ <td style='border:none;'><b><%= html.html_escape(user.value.username.label) %></b></td>
+ <td style='border:none;'><%= html.html_escape(user.value.username.value) %></td>
+ </tr><tr>
+ <td style='border:none;'><b><%= html.html_escape(user.value.roles.label) %></b></td>
+ <td style='border:none;'><%= html.html_escape(table.concat(user.value.roles.value, ", ")) %></td>
+ </tr><tr>
+ <td style='border:none;'><b>Option</b></td>
+ <td style='border:none;'>
+ [<a href='edituser?userid=<%= name %>&redir=<%= html.html_escape(page_info.orig_action) %>'>Edit this account</a>]
+ [<a href='deleteuser?userid=<%= name %>&submit=true'>Delete this account</a>]
+ [<a href='<%= html.html_escape(page_info.script) %>/acf-util/roles/viewuserroles?userid=<%= name %>'>View roles for this account</a>]
+ </td>
+ </tr>
+ </tbody></table>
+ </div></div><!-- end .item -->
<% end %>
-</DL>
diff --git a/app/acf-util/roles-read-html.lsp b/app/acf-util/roles-read-html.lsp
index 9d1a003..c0fbaab 100644
--- a/app/acf-util/roles-read-html.lsp
+++ b/app/acf-util/roles-read-html.lsp
@@ -1,32 +1,48 @@
-<% local view= ... %>
+<% local view, viewlibrary, page_info, session = ... %>
<% html = require("acf.html") %>
+<script type="text/javascript">
+ if (typeof jQuery == 'undefined') {
+ document.write('<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery-latest.js"><\/script>');
+ }
+</script>
+
+<script type="text/javascript">
+ if (typeof $.tablesorter == 'undefined') {
+ document.write('<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery.tablesorter.js"><\/script>');
+ }
+</script>
+
+<script type="text/javascript">
+ $(document).ready(function() {
+ $("#permissions").tablesorter({headers: {1:{sorter: false}}, widgets: ['zebra']});
+ });
+</script>
+
<% if view.value.userid then %>
- <H1>Roles/Permission list for <%= html.html_escape(view.value.userid.value) %>:</H1>
+ <h1>Roles/Permission list for <%= html.html_escape(view.value.userid.value) %>:</h1>
<% elseif view.value.role then %>
- <H1>Permission list for <%= html.html_escape(view.value.role.value) %>:</H1>
+ <h1>Permission list for <%= html.html_escape(view.value.role.value) %>:</h1>
<% else %>
- <H1>Complete permission list:</H1>
+ <h1>Complete permission list:</h1>
<% end %>
<% if view.value.roles then %>
- <H2><%= html.html_escape(view.value.userid.value) %> is valid in these roles</H2>
- <DL>
+ <h2><%= html.html_escape(view.value.userid.value) %> is valid in these roles</h2>
<% for a,b in pairs(view.value.roles.value) do
- print("<dt>",html.html_escape(b),"</dt><dd>&nbsp;</dd>")
+ print("<p>",html.html_escape(b),"</p>")
end %>
- </DL>
<% end %>
<% if view.value.permissions then %>
<% if view.value.userid then %>
- <H2><%= html.html_escape(view.value.userid.value) %>'s full permissions are</H2>
+ <h2><%= html.html_escape(view.value.userid.value) %>'s full permissions are</h2>
<% elseif view.value.role then %>
- <H2><%= html.html_escape(view.value.role.value) %>'s full permissions are</H2>
+ <h2><%= html.html_escape(view.value.role.value) %>'s full permissions are</h2>
<% end %>
- <DL>
- <TABLE>
- <TR><TD CLASS='header'>Controller</TD><TD CLASS='header'>Action(s)</TD></TR>
+ <table id="permissions" class="tablesorter"><thead>
+ <tr><th>Controller</th><th>Action(s)</th></tr>
+ </thead><tbody>
<% local prefixes = {}
-- It's nice to have it in alphabetical order
for pref in pairs(view.value.permissions.value) do
@@ -41,7 +57,7 @@
end
table.sort(controllers)
for x,cont in ipairs(controllers) do
- print("<TR><TD STYLE='font-weight:bold;'>",html.html_escape(pref..cont),"</TD><TD>")
+ print("<tr><td style='font-weight:bold;'>",html.html_escape(pref..cont),"</td><td>")
-- Again, alphabetical order
local actions = {}
for act in pairs(view.value.permissions.value[pref][cont]) do
@@ -51,10 +67,9 @@
for y,act in pairs(actions) do
print((html.html_escape(act)))
end
- io.write("<TD></TR>")
+ io.write("</td></tr>")
end
end
%>
- </TABLE>
- </DL>
+ </tbody></table>
<% end %>
diff --git a/app/acf-util/roles-viewroles-html.lsp b/app/acf-util/roles-viewroles-html.lsp
index 779d8fc..59aa4e9 100644
--- a/app/acf-util/roles-viewroles-html.lsp
+++ b/app/acf-util/roles-viewroles-html.lsp
@@ -2,36 +2,54 @@
<% htmlviewfunctions = require("htmlviewfunctions") %>
<% html = require("acf.html") %>
+<script type="text/javascript">
+ if (typeof jQuery == 'undefined') {
+ document.write('<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery-latest.js"><\/script>');
+ }
+</script>
+
+<script type="text/javascript">
+ if (typeof $.tablesorter == 'undefined') {
+ document.write('<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery.tablesorter.js"><\/script>');
+ }
+</script>
+
+<script type="text/javascript">
+ $(document).ready(function() {
+ $("#list").tablesorter({headers: {1:{sorter: false}}, widgets: ['zebra']});
+ });
+</script>
+
<% htmlviewfunctions.displaycommandresults({"newrole", "editrole", "deleterole"}, session) %>
-<H1>Roles</H1>
-<H2>Create new role</H2>
+<h1>Roles</h1>
+<h2>Create new role</h2>
<form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller) %>/newrole" method="POST">
<input class="hidden" type="hidden" name="redir" value="<%= html.html_escape(page_info.orig_action) %>" >
-<dl><dt></dt><dd><input class="submit" type="submit" value="Create"></dd></dl>
+<div class='item'><p class='left'></p><div class='right'><input class="submit" type="submit" value="Create"></div></div><!-- end .item -->
</form>
-<H2>Existing roles</H2>
-<DL>
-<TABLE>
+<h2>Existing roles</h2>
+<table id="list" class="tablesorter"><thead>
+ <tr><th>Role</th><th>Action</th></tr>
+</thead><tbody>
<% if view.value.defined_roles then %>
<% for x,role in pairs(view.value.defined_roles.value) do %>
- <TR><TD><dt><img src='<%= html.html_escape(page_info.wwwprefix..page_info.staticdir) %>/tango/16x16/apps/system-users.png' height='16' width='16'> <%= html.html_escape(role) %></dt>
- <dd>
+ <tr><td><img src='<%= html.html_escape(page_info.wwwprefix..page_info.staticdir) %>/tango/16x16/apps/system-users.png' height='16' width='16'> <%= html.html_escape(role) %></td>
+ <td>
[<a href='viewroleperms?role=<%= html.html_escape(role) %>'>View this role</a>]
[<a href='editrole?role=<%= html.html_escape(role) %>&redir=<%= html.html_escape(page_info.orig_action) %>'>Edit this role</a>]
[<a href='deleterole?role=<%= html.html_escape(role) %>&submit=true'>Delete this role</a>]
- </dd></TD></TR>
+ </td></tr>
<% end %>
<% end %>
<% if view.value.default_roles then %>
<% for x,role in pairs(view.value.default_roles.value) do %>
- <TR><TD><dt><img src='<%= html.html_escape(page_info.wwwprefix..page_info.staticdir) %>/tango/16x16/categories/applications-system.png' height='16' width='16'> <%= html.html_escape(role) %></dt>
- <dd>
+ <tr><td><img src='<%= html.html_escape(page_info.wwwprefix..page_info.staticdir) %>/tango/16x16/categories/applications-system.png' height='16' width='16'> <%= html.html_escape(role) %></td>
+ <td>
[<a href='viewroleperms?role=<%= html.html_escape(role) %>'>View this role</a>]
[<a href='editrole?role=<%= html.html_escape(role) %>&redir=<%= html.html_escape(page_info.orig_action) %>'>Edit this role</a>]
- </dd></TD></TR>
+ </td></tr>
<% end %>
<% end %>
-</TABLE>
-</DL>
+</tbody></table>
diff --git a/app/acf-util/skins-read-html.lsp b/app/acf-util/skins-read-html.lsp
index dff5ae2..c2e0456 100644
--- a/app/acf-util/skins-read-html.lsp
+++ b/app/acf-util/skins-read-html.lsp
@@ -6,13 +6,13 @@
<h1>Available skins</h1>
-<DL>
<% for i,skin in ipairs(view.value) do %>
- <dt><%= html.html_escape(skin.value) %></dt>
+ <div class='item'><p class='left'><%= html.html_escape(skin.value) %></p>
+ <div class='right'>
<% if (skin.inuse) then %>
- <dd>in use</dd>
+ in use
<% else %>
- <dd>[<a href="update?skin=<%= html.html_escape(skin.value) %>&submit=true">use this skin</a>]</dd>
+ [<a href="update?skin=<%= html.html_escape(skin.value) %>&submit=true">use this skin</a>]
<% end %>
+ </div></div><!-- end .item -->
<% end %>
-</DL>
diff --git a/app/acf-util/welcome-html.lsp b/app/acf-util/welcome-html.lsp
index 7540b94..6a22375 100644
--- a/app/acf-util/welcome-html.lsp
+++ b/app/acf-util/welcome-html.lsp
@@ -1,7 +1,7 @@
<% view = ... %>
<% htmlviewfunctions = require("htmlviewfunctions") %>
<h1>Alpine Configuration Framework</h1>
-<DL><p>Welcome.</p></DL>
+<p>Welcome.</p>
<% --[[
io.write(htmlviewfunctions.cfe_unpack(view))
diff --git a/app/debug-html.lsp b/app/debug-html.lsp
index f857b4f..bf593f7 100644
--- a/app/debug-html.lsp
+++ b/app/debug-html.lsp
@@ -1,9 +1,9 @@
<% local data, viewlibrary, page_info, session = ... %>
<% htmlviewfunctions = require("htmlviewfunctions") %>
-<H1>Debugging</H1>
-<H2>View Data:</H2>
+<h1>Debugging</h1>
+<h2>View Data:</h2>
<%= htmlviewfunctions.cfe_unpack(data) %>
-<H2>Session:</H2>
+<h2>Session:</h2>
<%= htmlviewfunctions.cfe_unpack(session) %>
-<H2>Page Info:</H2>
+<h2>Page Info:</h2>
<%= htmlviewfunctions.cfe_unpack(page_info) %>
diff --git a/app/filedetails-html.lsp b/app/filedetails-html.lsp
index 1d5f446..2901841 100644
--- a/app/filedetails-html.lsp
+++ b/app/filedetails-html.lsp
@@ -3,36 +3,30 @@
<% html = require("acf.html") %>
<% if form.type == "form" then %>
-<H1>Configuration</H1>
-<H2>Expert Configuration</H2>
+<h1>Configuration</h1>
+<h2>Expert Configuration</h2>
<% else %>
-<H1>View File</H1>
+<h1>View File</h1>
<% end %>
-<H3>File Details</H3>
-<DL>
+<h3>File Details</h3>
<%
htmlviewfunctions.displayitem(form.value.filename)
htmlviewfunctions.displayitem(form.value.filesize)
htmlviewfunctions.displayitem(form.value.mtime)
%>
-</DL>
-<H3>File Content</H3>
+<h3>File Content</h3>
<% if form.type == "form" then %>
<% form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action %>
<% htmlviewfunctions.displayformstart(form) %>
<input type="hidden" name="filename" value="<%= html.html_escape(form.value.filename.value) %>">
-<% else %>
-<DL>
<% end %>
<textarea name="filecontent">
<%= html.html_escape(form.value.filecontent.value) %>
</textarea>
-<% if form.value.filecontent.errtxt then %><P CLASS='error'><%= string.gsub(html.html_escape(form.value.filecontent.errtxt), "\n", "<BR>") %></P><% end %>
-<% if form.value.filecontent.descr then %><P CLASS='descr'><%= string.gsub(html.html_escape(form.value.filecontent.descr), "\n", "<BR>") %></P><% end %>
+<% if form.value.filecontent.errtxt then %><p class='error'><%= string.gsub(html.html_escape(form.value.filecontent.errtxt), "\n", "<br/>") %></p><% end %>
+<% if form.value.filecontent.descr then %><p class='descr'><%= string.gsub(html.html_escape(form.value.filecontent.descr), "\n", "<br/>") %></p><% end %>
<% if form.type == "form" then %>
<% htmlviewfunctions.displayformend(form) %>
-<% else %>
-</DL>
<% end %>
diff --git a/app/status-html.lsp b/app/status-html.lsp
index d8f7b37..8fa6b33 100644
--- a/app/status-html.lsp
+++ b/app/status-html.lsp
@@ -6,31 +6,31 @@ html = require("acf.html")
<% htmlviewfunctions.displaycommandresults({"install","edit"}, session) %>
<% htmlviewfunctions.displaycommandresults({"startstop"}, session) %>
-<H1>System Info</H1>
-<DL>
+<h1>System Info</h1>
<%
htmlviewfunctions.displayitem(data.value.status)
htmlviewfunctions.displayitem(data.value.version)
if data.value.version and data.value.version.errtxt and viewlibrary.check_permission("apk-tools/apk/install") then
%>
- <DT>Install package</DT>
- <DD><form action="<%= html.html_escape(page_info.script .. "/apk-tools/apk/install") %>" method="POST">
+ <div class='item'><p class='left'>Install package</p>
+ <div class='right'><form action="<%= html.html_escape(page_info.script .. "/apk-tools/apk/install") %>" method="post">
<input type='hidden' name='package' value='<%= html.html_escape(data.value.version.name) %>'>
- <input class='submit' type='submit' name='submit' value='Install'></form></DD>
+ <input class='submit' type='submit' name='submit' value='Install'></form>
+ </div></div><!-- end .item -->
<%
end
htmlviewfunctions.displayitem(data.value.autostart)
if not (data.value.version and data.value.version.errtxt) and data.value.autostart and data.value.autostart.errtxt and viewlibrary.check_permission("alpine-baselayout/rc/edit") then
%>
- <DT>Enable autostart</DT>
- <DD><form action="<%= html.html_escape(page_info.script .. "/alpine-baselayout/rc/edit") %>" method="POST">
+ <div class='item'><p class='left'>Enable autostart</p>
+ <div class='right'><form action="<%= html.html_escape(page_info.script .. "/alpine-baselayout/rc/edit") %>" method="POST">
<input type='hidden' name='servicename' value='<%= html.html_escape(data.value.autostart.name) %>'>
<input type='hidden' name='redir' value='<%= html.html_escape(page_info.orig_action) %>'>
- <input class='submit' type='submit' value='Enable'></form></DD>
+ <input class='submit' type='submit' value='Enable'></form>
+ </div></div><!-- end .item -->
<% end %>
-</DL>
<% if viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("startstop") then
viewlibrary.dispatch_component("startstop")
diff --git a/lib/htmlviewfunctions.lua b/lib/htmlviewfunctions.lua
index 35d4ca4..5a348bc 100644
--- a/lib/htmlviewfunctions.lua
+++ b/lib/htmlviewfunctions.lua
@@ -26,13 +26,13 @@ function mymodule.displayitem(myitem, header_level, page_info)
if not myitem then return end
if myitem.type == "form" then
header_level = header_level or 1
- io.write("<H"..tostring(header_level)..">"..html.html_escape(myitem.label).."</H"..tostring(header_level)..">")
+ io.write("<h"..tostring(header_level)..">"..html.html_escape(myitem.label).."</h"..tostring(header_level)..">")
mymodule.displayform(myitem, nil, nil, page_info, header_level)
elseif myitem.type == "group" then
header_level = header_level or 1
- io.write("<H"..tostring(header_level)..">"..html.html_escape(myitem.label).."</H"..tostring(header_level)..">")
- if myitem.descr then io.write('<P CLASS="descr">' .. string.gsub(html.html_escape(myitem.descr), "\n", "<BR>") .. "</P>\n") end
- if myitem.errtxt then io.write('<P CLASS="error">' .. string.gsub(html.html_escape(myitem.errtxt), "\n", "<BR>") .. "</P>\n") end
+ io.write("<h"..tostring(header_level)..">"..html.html_escape(myitem.label).."</h"..tostring(header_level)..">")
+ if myitem.descr then io.write("<p class='descr'>" .. string.gsub(html.html_escape(myitem.descr), "\n", "<br/>") .. "</p>") end
+ if myitem.errtxt then io.write("<p class='error'>" .. string.gsub(html.html_escape(myitem.errtxt), "\n", "<br/>") .. "</p>") end
local seqorder = {}
local order = {}
for name,item in pairs(myitem.value) do
@@ -53,17 +53,17 @@ function mymodule.displayitem(myitem, header_level, page_info)
end
end
elseif myitem.type ~= "hidden" then
- io.write("<DT")
+ io.write("<div class='item")
if myitem.errtxt then
myitem.class = "error"
- io.write(' class="error"')
+ io.write(" error")
end
- io.write(">" .. html.html_escape(myitem.label) .. "</DT>\n")
- io.write("<DD>")
- io.write(string.gsub(html.html_escape(tostring(myitem.value)), "\n", "<BR>") .. "\n")
- if myitem.descr then io.write("<P CLASS='descr'>" .. string.gsub(html.html_escape(myitem.descr), "\n", "<BR>") .. "</P>\n") end
- if myitem.errtxt then io.write("<P CLASS='error'>" .. string.gsub(html.html_escape(myitem.errtxt), "\n", "<BR>") .. "</P>\n") end
- io.write("</DD>\n")
+ io.write("'><p class='left'>" .. html.html_escape(myitem.label) .. "</p>")
+ io.write("<div class='right'>")
+ io.write(string.gsub(html.html_escape(tostring(myitem.value)), "\n", "<br/>") .. "\n")
+ if myitem.descr then io.write("<p class='descr'>" .. string.gsub(html.html_escape(myitem.descr), "\n", "<br/>") .. "</p>") end
+ if myitem.errtxt then io.write("<p class='error'>" .. string.gsub(html.html_escape(myitem.errtxt), "\n", "<br/>") .. "</p>") end
+ io.write("</div></div><!-- end .item -->")
end
end
@@ -72,22 +72,22 @@ function mymodule.displayformitem(myitem, name, viewtype, header_level, group)
if name then myitem.name = name end
if group and group ~= "" then myitem.name = group.."."..myitem.name end
if myitem.type ~= "hidden" and myitem.type ~= "group" then
- io.write("<DT")
+ io.write("<div class='item")
if myitem.errtxt then
myitem.class = "error"
- io.write(' class="error"')
+ io.write(" error")
end
- io.write(">" .. html.html_escape(myitem.label) .. "</DT>\n")
- io.write("<DD>\n")
+ io.write("'><p class='left'>" .. html.html_escape(myitem.label) .. "</p>")
+ io.write("<div class='right'>")
end
if (viewtype == "viewonly") then
myitem.disabled = "true"
end
if myitem.type == "group" then
header_level = header_level or 2
- io.write("<H"..tostring(header_level)..">"..html.html_escape(myitem.label).."</H"..tostring(header_level)..">")
- if myitem.descr then io.write('<P CLASS="descr">' .. string.gsub(html.html_escape(myitem.descr), "\n", "<BR>") .. "</P>\n") end
- if myitem.errtxt then io.write('<P CLASS="error">' .. string.gsub(html.html_escape(myitem.errtxt), "\n", "<BR>") .. "</P>\n") end
+ io.write("<h"..tostring(header_level)..">"..html.html_escape(myitem.label).."</h"..tostring(header_level)..">")
+ if myitem.descr then io.write("<p class='descr'>" .. string.gsub(html.html_escape(myitem.descr), "\n", "<br/>") .. "</p>") end
+ if myitem.errtxt then io.write("<p class='error'>" .. string.gsub(html.html_escape(myitem.errtxt), "\n", "<br/>") .. "</p>") end
mymodule.displayformcontents(myitem, nil, nil, tonumber(header_level)+1, myitem.name)
elseif myitem.type == "multi" then
-- FIXME multiple select doesn't work in haserl, so use series of checkboxes
@@ -149,10 +149,10 @@ function mymodule.displayformitem(myitem, name, viewtype, header_level, group)
io.write((html.form[myitem.type](myitem) or "") .. "\n")
end
if myitem.type ~= "hidden" and myitem.type ~= "group" then
- if myitem.descr then io.write('<P CLASS="descr">' .. string.gsub(html.html_escape(myitem.descr), "\n", "<BR>") .. "</P>\n") end
- if myitem.default then io.write('<P CLASS="descr">Default:' .. string.gsub(html.html_escape(getlabel(myitem, myitem.default)), "\n", "<BR>") .. "</P>\n") end
- if myitem.errtxt then io.write('<P CLASS="error">' .. string.gsub(html.html_escape(myitem.errtxt), "\n", "<BR>") .. "</P>\n") end
- io.write("</DD>\n")
+ if myitem.descr then io.write("<p class='descr'>" .. string.gsub(html.html_escape(myitem.descr), "\n", "<br/>") .. "</p>") end
+ if myitem.default then io.write('<p class="descr">Default:' .. string.gsub(html.html_escape(getlabel(myitem, myitem.default)), "\n", "<br/>") .. "</p>\n") end
+ if myitem.errtxt then io.write("<p class='error'>" .. string.gsub(html.html_escape(myitem.errtxt), "\n", "<br/>") .. "</p>") end
+ io.write("</div></div><!-- end .item -->")
end
end
@@ -161,9 +161,8 @@ function mymodule.displayformstart(myform, page_info)
if not myform.action and page_info then
myform.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action
end
- io.write('<DL>\n')
- if myform.descr then io.write('<P CLASS="descr">' .. string.gsub(html.html_escape(myform.descr), "\n", "<BR>") .. "</P>\n") end
- if myform.errtxt then io.write('<P CLASS="error">' .. string.gsub(html.html_escape(myform.errtxt), "\n", "<BR>") .. "</P>\n") end
+ if myform.descr then io.write('<p class="descr">' .. string.gsub(html.html_escape(myform.descr), "\n", "<br/>") .. "</p>\n") end
+ if myform.errtxt then io.write('<p class="error">' .. string.gsub(html.html_escape(myform.errtxt), "\n", "<br/>") .. "</p>\n") end
io.write('<form action="' .. html.html_escape(myform.action) .. '" ')
if myform.enctype and myform.enctype ~= "" then
io.write('enctype="'..html.html_escape(myform.enctype)..'" ')
@@ -226,7 +225,7 @@ end
function mymodule.displayformend(myform)
if not myform then return end
local option = myform.submit or myform.option
- io.write('<DT></DT><DD>')
+ io.write("<div class='item'><p class='left'></p><div class='right'>")
if type(option) == "table" then
for i,v in ipairs(option) do
io.write('<input class="submit" type="submit" name="submit" value="' .. html.html_escape(v) .. '">\n')
@@ -234,9 +233,8 @@ function mymodule.displayformend(myform)
else
io.write('<input class="submit" type="submit" name="submit" value="' .. html.html_escape(myform.submit or myform.option) .. '">\n')
end
- io.write('</DD>\n')
- io.write('</FORM>')
- io.write('</DL>\n')
+ io.write("</div></div><!-- end .item -->")
+ io.write('</form>')
end
function mymodule.displayform(myform, order, finishingorder, page_info, header_level)
@@ -257,13 +255,13 @@ function mymodule.displaycommandresults(commands, session, preserveerrors)
end
end
if #cmdresult > 0 then
- io.write("<H1>Command Result</H1>\n<DL>\n")
+ io.write('<div class="command-results"><h1>Command Result</h1>')
for i,result in ipairs(cmdresult) do
- if type(result.value) == "string" and result.value ~= "" then io.write(string.gsub(html.html_escape(result.value), "\n", "<BR>") .. "\n") end
- if result.descr then io.write('<P CLASS="descr">' .. string.gsub(html.html_escape(result.descr), "\n", "<BR>") .. "</P>\n") end
- if result.errtxt then io.write('<P CLASS="error">' .. string.gsub(html.html_escape(result.errtxt), "\n", "<BR>") .. "</P>\n") end
+ if type(result.value) == "string" and result.value ~= "" then io.write('<p>' .. string.gsub(html.html_escape(result.value), "\n", "<br/>") .. "</p>") end
+ if result.descr then io.write('<p class="descr">' .. string.gsub(html.html_escape(result.descr), "\n", "<br/>") .. "</p>") end
+ if result.errtxt then io.write('<p class="error">' .. string.gsub(html.html_escape(result.errtxt), "\n", "<br/>") .. "</p>") end
end
- io.write("</DL>\n")
+ io.write('</div><!-- end .command-results -->')
end
end