From dbbb88812817d58aa7dd53633f9d81a1a1fa6565 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Wed, 22 Jan 2014 16:32:46 +0000 Subject: Modify HTML to replace DL,DT,DD with divs. Also cleanup other HTML. --- app/acf-util/password-status-html.lsp | 54 ++++++++++++++-------------- app/acf-util/roles-read-html.lsp | 49 ++++++++++++++++--------- app/acf-util/roles-viewroles-html.lsp | 46 ++++++++++++++++-------- app/acf-util/skins-read-html.lsp | 10 +++--- app/acf-util/welcome-html.lsp | 2 +- app/debug-html.lsp | 8 ++--- app/filedetails-html.lsp | 20 ++++------- app/status-html.lsp | 18 +++++----- lib/htmlviewfunctions.lua | 68 +++++++++++++++++------------------ 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) %> -

User Accounts

-

Create new account

-
+

User Accounts

+

Create new account

+ -
+

-

Existing account

-
+

Existing account

<% for i,user in ipairs(form.value) do local name = html.html_escape(user.value.userid.value) %> -
<%= name %>
-
- - - - - - - - - - - - - -
<%= html.html_escape(user.value.userid.label) %><%= html.html_escape(user.value.userid.value) %>
<%= html.html_escape(user.value.username.label) %><%= html.html_escape(user.value.username.value) %>
<%= html.html_escape(user.value.roles.label) %><%= html.html_escape(table.concat(user.value.roles.value, ", ")) %>
Option - [Edit this account] - [Delete this account] - [View roles for this account] -
+

<%= name %>

+
+ + + + + + + + + + + + + + +
<%= html.html_escape(user.value.userid.label) %><%= html.html_escape(user.value.userid.value) %>
<%= html.html_escape(user.value.username.label) %><%= html.html_escape(user.value.username.value) %>
<%= html.html_escape(user.value.roles.label) %><%= html.html_escape(table.concat(user.value.roles.value, ", ")) %>
Option + [Edit this account] + [Delete this account] + [View roles for this account] +
+
<% end %> -
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") %> + + + + + + <% if view.value.userid then %> -

Roles/Permission list for <%= html.html_escape(view.value.userid.value) %>:

+

Roles/Permission list for <%= html.html_escape(view.value.userid.value) %>:

<% elseif view.value.role then %> -

Permission list for <%= html.html_escape(view.value.role.value) %>:

+

Permission list for <%= html.html_escape(view.value.role.value) %>:

<% else %> -

Complete permission list:

+

Complete permission list:

<% end %> <% if view.value.roles then %> -

<%= html.html_escape(view.value.userid.value) %> is valid in these roles

-
+

<%= html.html_escape(view.value.userid.value) %> is valid in these roles

<% for a,b in pairs(view.value.roles.value) do - print("
",html.html_escape(b),"
 
") + print("

",html.html_escape(b),"

") end %> -
<% end %> <% if view.value.permissions then %> <% if view.value.userid then %> -

<%= html.html_escape(view.value.userid.value) %>'s full permissions are

+

<%= html.html_escape(view.value.userid.value) %>'s full permissions are

<% elseif view.value.role then %> -

<%= html.html_escape(view.value.role.value) %>'s full permissions are

+

<%= html.html_escape(view.value.role.value) %>'s full permissions are

<% end %> -
- - +
ControllerAction(s)
+ + <% 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("") + io.write("") end end %> -
ControllerAction(s)
",html.html_escape(pref..cont),"") + print("
",html.html_escape(pref..cont),"") -- 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("
-
+ <% 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") %> + + + + + + <% htmlviewfunctions.displaycommandresults({"newrole", "editrole", "deleterole"}, session) %> -

Roles

-

Create new role

+

Roles

+

Create new role

-
+

-

Existing roles

-
- +

Existing roles

+
+ + <% if view.value.defined_roles then %> <% for x,role in pairs(view.value.defined_roles.value) do %> - + + <% end %> <% end %> <% if view.value.default_roles then %> <% for x,role in pairs(view.value.default_roles.value) do %> - + + <% end %> <% end %> -
RoleAction
<%= html.html_escape(role) %>
-
+
<%= html.html_escape(role) %> [View this role] [Edit this role] [Delete this role] -
<%= html.html_escape(role) %>
-
+
<%= html.html_escape(role) %> [View this role] [Edit this role] -
-
+ 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 @@

Available skins

-
<% for i,skin in ipairs(view.value) do %> -
<%= html.html_escape(skin.value) %>
+

<%= html.html_escape(skin.value) %>

+
<% if (skin.inuse) then %> -
in use
+ in use <% else %> -
[use this skin]
+ [use this skin] <% end %> +
<% end %> -
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") %>

Alpine Configuration Framework

-

Welcome.

+

Welcome.

<% --[[ 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") %> -

Debugging

-

View Data:

+

Debugging

+

View Data:

<%= htmlviewfunctions.cfe_unpack(data) %> -

Session:

+

Session:

<%= htmlviewfunctions.cfe_unpack(session) %> -

Page Info:

+

Page Info:

<%= 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 %> -

Configuration

-

Expert Configuration

+

Configuration

+

Expert Configuration

<% else %> -

View File

+

View File

<% end %> -

File Details

-
+

File Details

<% htmlviewfunctions.displayitem(form.value.filename) htmlviewfunctions.displayitem(form.value.filesize) htmlviewfunctions.displayitem(form.value.mtime) %> -
-

File Content

+

File Content

<% if form.type == "form" then %> <% form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action %> <% htmlviewfunctions.displayformstart(form) %> -<% else %> -
<% end %> -<% if form.value.filecontent.errtxt then %>

<%= string.gsub(html.html_escape(form.value.filecontent.errtxt), "\n", "
") %>

<% end %> -<% if form.value.filecontent.descr then %>

<%= string.gsub(html.html_escape(form.value.filecontent.descr), "\n", "
") %>

<% end %> +<% if form.value.filecontent.errtxt then %>

<%= string.gsub(html.html_escape(form.value.filecontent.errtxt), "\n", "
") %>

<% end %> +<% if form.value.filecontent.descr then %>

<%= string.gsub(html.html_escape(form.value.filecontent.descr), "\n", "
") %>

<% end %> <% if form.type == "form" then %> <% htmlviewfunctions.displayformend(form) %> -<% else %> -
<% 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) %> -

System Info

-
+

System Info

<% 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 %> -
Install package
-
" method="POST"> +

Install package

+
" method="post"> -
+ + <% 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 %> -
Enable autostart
-
" method="POST"> +

Enable autostart

+
" method="POST"> -
+ + <% end %> -
<% 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(""..html.html_escape(myitem.label).."") + io.write(""..html.html_escape(myitem.label).."") mymodule.displayform(myitem, nil, nil, page_info, header_level) elseif myitem.type == "group" then header_level = header_level or 1 - io.write(""..html.html_escape(myitem.label).."") - if myitem.descr then io.write('

' .. string.gsub(html.html_escape(myitem.descr), "\n", "
") .. "

\n") end - if myitem.errtxt then io.write('

' .. string.gsub(html.html_escape(myitem.errtxt), "\n", "
") .. "

\n") end + io.write(""..html.html_escape(myitem.label).."") + if myitem.descr then io.write("

" .. string.gsub(html.html_escape(myitem.descr), "\n", "
") .. "

") end + if myitem.errtxt then io.write("

" .. string.gsub(html.html_escape(myitem.errtxt), "\n", "
") .. "

") 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("" .. html.html_escape(myitem.label) .. "\n") - io.write("
") - io.write(string.gsub(html.html_escape(tostring(myitem.value)), "\n", "
") .. "\n") - if myitem.descr then io.write("

" .. string.gsub(html.html_escape(myitem.descr), "\n", "
") .. "

\n") end - if myitem.errtxt then io.write("

" .. string.gsub(html.html_escape(myitem.errtxt), "\n", "
") .. "

\n") end - io.write("
\n") + io.write("'>

" .. html.html_escape(myitem.label) .. "

") + io.write("
") + io.write(string.gsub(html.html_escape(tostring(myitem.value)), "\n", "
") .. "\n") + if myitem.descr then io.write("

" .. string.gsub(html.html_escape(myitem.descr), "\n", "
") .. "

") end + if myitem.errtxt then io.write("

" .. string.gsub(html.html_escape(myitem.errtxt), "\n", "
") .. "

") end + io.write("
") 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("" .. html.html_escape(myitem.label) .. "\n") - io.write("
\n") + io.write("'>

" .. html.html_escape(myitem.label) .. "

") + io.write("
") end if (viewtype == "viewonly") then myitem.disabled = "true" end if myitem.type == "group" then header_level = header_level or 2 - io.write(""..html.html_escape(myitem.label).."") - if myitem.descr then io.write('

' .. string.gsub(html.html_escape(myitem.descr), "\n", "
") .. "

\n") end - if myitem.errtxt then io.write('

' .. string.gsub(html.html_escape(myitem.errtxt), "\n", "
") .. "

\n") end + io.write(""..html.html_escape(myitem.label).."") + if myitem.descr then io.write("

" .. string.gsub(html.html_escape(myitem.descr), "\n", "
") .. "

") end + if myitem.errtxt then io.write("

" .. string.gsub(html.html_escape(myitem.errtxt), "\n", "
") .. "

") 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('

' .. string.gsub(html.html_escape(myitem.descr), "\n", "
") .. "

\n") end - if myitem.default then io.write('

Default:' .. string.gsub(html.html_escape(getlabel(myitem, myitem.default)), "\n", "
") .. "

\n") end - if myitem.errtxt then io.write('

' .. string.gsub(html.html_escape(myitem.errtxt), "\n", "
") .. "

\n") end - io.write("
\n") + if myitem.descr then io.write("

" .. string.gsub(html.html_escape(myitem.descr), "\n", "
") .. "

") end + if myitem.default then io.write('

Default:' .. string.gsub(html.html_escape(getlabel(myitem, myitem.default)), "\n", "
") .. "

\n") end + if myitem.errtxt then io.write("

" .. string.gsub(html.html_escape(myitem.errtxt), "\n", "
") .. "

") end + io.write("") 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('
\n') - if myform.descr then io.write('

' .. string.gsub(html.html_escape(myform.descr), "\n", "
") .. "

\n") end - if myform.errtxt then io.write('

' .. string.gsub(html.html_escape(myform.errtxt), "\n", "
") .. "

\n") end + if myform.descr then io.write('

' .. string.gsub(html.html_escape(myform.descr), "\n", "
") .. "

\n") end + if myform.errtxt then io.write('

' .. string.gsub(html.html_escape(myform.errtxt), "\n", "
") .. "

\n") end io.write('
') + io.write("

") if type(option) == "table" then for i,v in ipairs(option) do io.write('\n') @@ -234,9 +233,8 @@ function mymodule.displayformend(myform) else io.write('\n') end - io.write('
\n') - io.write('
') - io.write('
\n') + io.write("") + io.write('') 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("

Command Result

\n
\n") + io.write('

Command Result

') 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", "
") .. "\n") end - if result.descr then io.write('

' .. string.gsub(html.html_escape(result.descr), "\n", "
") .. "

\n") end - if result.errtxt then io.write('

' .. string.gsub(html.html_escape(result.errtxt), "\n", "
") .. "

\n") end + if type(result.value) == "string" and result.value ~= "" then io.write('

' .. string.gsub(html.html_escape(result.value), "\n", "
") .. "

") end + if result.descr then io.write('

' .. string.gsub(html.html_escape(result.descr), "\n", "
") .. "

") end + if result.errtxt then io.write('

' .. string.gsub(html.html_escape(result.errtxt), "\n", "
") .. "

") end end - io.write("
\n") + io.write('') end end -- cgit v1.2.3