Commit 17b82b3f authored by Ted Trask's avatar Ted Trask

Made changes to remove redirect_to_referrer and remote inconsistent and confusing use of 'entry'

parent 6443949d
......@@ -23,7 +23,7 @@ function listentries(self)
end
function editentry(self)
return self.handle_form(self, function() return self.model.readentry(self.clientdata.entry, self.clientdata.method, self.clientdata.remotemailbox, self.clientdata.localdomain) end, self.model.updateentry, self.clientdata, "Save", "Edit Entry", "Entry Saved")
return self.handle_form(self, function() return self.model.readentry(self.clientdata.remotehost, self.clientdata.method, self.clientdata.remotemailbox, self.clientdata.localdomain) end, self.model.updateentry, self.clientdata, "Save", "Edit Entry", "Entry Saved")
end
function createentry(self)
......@@ -31,5 +31,5 @@ function createentry(self)
end
function deleteentry(self)
return self:redirect_to_referrer(self.model.deleteentry(self.clientdata.entry, self.clientdata.method, self.clientdata.remotemailbox, self.clientdata.localdomain))
return self.handle_form(self, self.model.get_deleteentry, self.model.deleteentry, self.clientdata, "Delete", "Delete Entry", "Entry Deleted")
end
......@@ -9,7 +9,7 @@ require("htmlviewfunctions")
<TABLE>
<TR style="background:#eee;font-weight:bold;">
<TD style="padding-right:20px;white-space:nowrap;text-align:left;" class="header">Action</TD>
<TD style="padding-right:20px;white-space:nowrap;text-align:left;" class="header">Entry</TD>
<TD style="padding-right:20px;white-space:nowrap;text-align:left;" class="header">Remote Host</TD>
<TD style="padding-right:20px;white-space:nowrap;text-align:left;" class="header">Enabled</TD>
<TD style="padding-right:20px;white-space:nowrap;text-align:left;" class="header">Method</TD>
<TD style="white-space:nowrap;text-align:left;" class="header">Remote Mailbox / Domain</TD>
......@@ -17,10 +17,10 @@ require("htmlviewfunctions")
<% for i,entry in ipairs(data.value) do %>
<TR>
<TD style="padding-right:20px;white-space:nowrap;">
<% io.write(html.link{value = "editentry?entry=" .. entry.entry.."&method="..entry.method.."&remotemailbox="..entry.remotemailbox.."&localdomain="..entry.localdomain.."&redir="..page_info.orig_action, label="Edit " }) %>
<% io.write(html.link{value = "deleteentry?entry=" .. entry.entry.."&method="..entry.method.."&remotemailbox="..entry.remotemailbox.."&localdomain="..entry.localdomain, label="Delete " }) %>
<% io.write(html.link{value = "editentry?remotehost=" .. entry.remotehost.."&method="..entry.method.."&remotemailbox="..entry.remotemailbox.."&localdomain="..entry.localdomain.."&redir="..page_info.orig_action, label="Edit " }) %>
<% io.write(html.link{value = "deleteentry?submit=true&remotehost=" .. entry.remotehost.."&method="..entry.method.."&remotemailbox="..entry.remotemailbox.."&localdomain="..entry.localdomain, label="Delete " }) %>
</TD>
<TD style="padding-right:20px;white-space:nowrap;"><%= html.html_escape(entry.entry) %></TD>
<TD style="padding-right:20px;white-space:nowrap;"><%= html.html_escape(entry.remotehost) %></TD>
<TD style="padding-right:20px;white-space:nowrap;"><%= html.html_escape(tostring(entry.enabled)) %></TD>
<TD style="padding-right:20px;white-space:nowrap;"><%= html.html_escape(entry.method) %></TD>
<TD style="white-space:nowrap;" width="90%"><% if entry.localdomain and entry.localdomain ~= "" then io.write(html.html_escape(entry.localdomain)) else io.write(html.html_escape(entry.remotemailbox)) end %></TD>
......
......@@ -511,7 +511,7 @@ function readentries()
if reverseentry["username"] and entry[reverseentry["username"]+1] then
username = entry[reverseentry["username"]+1]
end
table.insert(entries.value, {entry=entry[2], method=method, enabled=enabled, remotemailbox=username, localdomain=localdomain})
table.insert(entries.value, {remotehost=entry[2], method=method, enabled=enabled, remotemailbox=username, localdomain=localdomain})
end
end
return entries
......@@ -607,14 +607,23 @@ function createentry(self, entrystruct)
return entrystruct
end
function deleteentry(entryname, method, remotemailbox, localdomain)
local retval = cfe({ value="Deleted entry", label="Delete Fetchmail Entry Result" })
local entry = findentryline(entryname, method, remotemailbox, localdomain)
function get_deleteentry(self, clientdata)
local retval = {}
retval.remotehost = cfe({ value=clientdata.remotehost or "", label="Remote Host" })
retval.method = cfe({ type="select", value=clientdata.method or "pop3", label="Method", option=methods })
retval.remotemailbox = cfe({ value=clientdata.remotemailbox or "", label="Remote Mailbox" })
retval.localdomain = cfe({ value=clientdata.localdomain or "", label="Local Domain" })
return cfe({ type="group", value=retval, label="Delete Entry" })
end
function deleteentry(self, ent)
local entry = findentryline(ent.value.remotehost.value, ent.value.method.value, ent.value.remotemailbox.value, ent.value.localdomain.value)
if entry then
writeentryline(nil, entry)
else
retval.value = "Failed to delete entry - not found"
ent.errtxt = "Failed to delete entry - not found"
end
return retval
return ent
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment