Commit 7675a312 authored by Ted Trask's avatar Ted Trask

Added config to fetchmail to configure globals and multiple entries. Also...

Added config to fetchmail to configure globals and multiple entries.  Also added ability to run once and test.  Still need support for ETRN and SSL.

git-svn-id: svn://svn.alpinelinux.org/acf/fetchmail/trunk@1437 ab2d0c66-481e-0410-8bed-d214d4d58bed
parent 0441e224
<% local form = ... <% local view, viewlibrary, page_info, session = ... %>
require("viewfunctions") <% require("viewfunctions") %>
%>
<%
--[[ DEBUG INFORMATION
io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>")
io.write(html.cfe_unpack(form))
io.write("</span>")
--]]
%>
<H1>SYSTEM INFO</H1> <% displaycommandresults({"deleteentry"}, session) %>
<DL>
<%
local myform = form.status
local tags = { "status", "version", "autostart", }
displayinfo(myform,tags,"viewonly")
%>
</DL>
<H1>CONFIGURATION</H1>
<% local myform = form.config %>
<form action="<%= form.option.script .. "/" .. form.option.prefix ..
form.option.controller .. "/" .. form.option.action %>" method="POST">
<H2>GUIDED CONFIGURATION</H2> <% if viewlibrary and viewlibrary.dispatch_component then
<% --[[ %> viewlibrary.dispatch_component("status")
<H3>FREQUENCY</H3> end %>
<P>Select how often the mailboxes will be checked. For ETRN transfers (below) this specifies how often transfers are initiated</P>
<%
local tags = { "freq", }
displayinfo(myform,tags)
%>
<% --]] %>
<H3>MAILBOXES</H3> <H1>Global Settings</H1>
<P>You will need to specify the remote mailbox and password, as well as the local (internal) mailbox to forward the mail to. The SMTP host is the name or address of the SMTP server to send the mail to.</P>
<P>If you want to use POP3 account for the entire domain, selecting the <U>pop3domain</U> method will setup the appropriate configuration for retrieving and distributing the mail appropriately. The <B>domain</B> information should be your internet smtp domain. The <B>mailbox</B> field is ignored when this method is selected.</P>
<P>When selecting the <U>pop3</U> or <U>imap</U> methods, the <B>domain</B> field should be left blank.</P>
<% -- START - SPECIAL VIEW FOR SHOWING AVAILABLE MAILBOXES %>
<%
local tags = "mailboxes"
local mailboxform = myform[tags]["value"]
%>
<DL> <DL>
<% <dt>Edit global settings</dt>
io.write("\n\t<CENTER><TABLE STYLE='border:1px solid #ccc;background:#eee'>\n\t\t<TR>\n\t\t\t<TD CLASS='header' WIDTH='150px'>") <dd><form action="<%= page_info.script .. page_info.prefix .. page_info.controller .. "/editconfig" %>" method="POST">
io.write("<CENTER>METHOD</CENTER></TD>\n\t\t\t<TD CLASS='header' COLSPAN=2>") <input type=submit value="Edit" class="submit">
io.write("<CENTER>REMOTE</CENTER></TD>\n\t\t\t<TD CLASS='header' COLSPAN=2>") </form></dd>
io.write("<CENTER>LOCAL</CENTER></TD>\n\t\t</TR>")
for i=1, table.maxn(mailboxform) do
leftpadd="30px"
rightpadd="5px"
io.write("\n\t\t<TR>\n\t\t\t<TD>")
val = "method"
io.write(html.form[mailboxform[i][val]["type"]](mailboxform[i][val]))
io.write("</TD>\n\t\t\t<TD style='padding-left:".. leftpadd .. ";padding-right:".. rightpadd .. ";' WIDTH='5%'>")
val = "remotehost"
io.write(mailboxform[i][val]["label"])
io.write(":</TD>\n\t\t\t<TD>")
io.write(html.form[mailboxform[i][val]["type"]](mailboxform[i][val]))
io.write("</TD>\n\t\t\t<TD style='padding-left:".. leftpadd .. ";padding-right:".. rightpadd .. ";' WIDTH='5%'>")
val = "localhost"
io.write(mailboxform[i][val]["label"])
io.write(":</TD>\n\t\t\t<TD>")
io.write(html.form[mailboxform[i][val]["type"]](mailboxform[i][val]))
io.write("</TD>\n\t\t</TR>")
io.write("\n\t\t<TR>\n\t\t\t<TD>")
val = "disabled"
io.write(html.form[mailboxform[i][val]["type"]](mailboxform[i][val]))
io.write(" " .. mailboxform[i][val]["label"])
io.write("</TD>\n\t\t\t<TD style='padding-left:".. leftpadd .. ";padding-right:".. rightpadd .. ";'>")
val = "remotemailbox"
io.write(mailboxform[i][val]["label"])
io.write(":</TD>\n\t\t\t<TD>")
io.write(html.form[mailboxform[i][val]["type"]](mailboxform[i][val]))
io.write("</TD>\n\t\t\t<TD style='padding-left:".. leftpadd .. ";padding-right:".. rightpadd .. ";'>")
val = "localmailbox"
io.write(mailboxform[i][val]["label"])
io.write(":</TD>\n\t\t\t<TD>")
io.write(html.form[mailboxform[i][val]["type"]](mailboxform[i][val]))
io.write("</TD>\n\t\t</TR>")
io.write("\n\t\t<TR>\n\t\t\t<TD>")
io.write("</TD>\n\t\t\t<TD style='padding-left:".. leftpadd .. ";padding-right:".. rightpadd .. ";'>")
val = "remotepassword"
io.write(mailboxform[i][val]["label"])
io.write(":</TD>\n\t\t\t<TD>")
io.write(html.form[mailboxform[i][val]["type"]](mailboxform[i][val]))
io.write("</TD>\n\t\t\t<TD style='padding-left:".. leftpadd .. ";padding-right:".. rightpadd .. ";'>")
val = "localdomain"
io.write(mailboxform[i][val]["label"])
io.write(":</TD>\n\t\t\t<TD>")
io.write(html.form[mailboxform[i][val]["type"]](mailboxform[i][val]))
io.write("</TD>\n\t\t</TR>")
io.write("\n\t\t<TR>\n\t\t\t<TD COLSPAN=5><HR></TD>\n\t\t</TR>")
end
io.write("</TABLE></CENTER>")
%>
</DL> </DL>
<% -- START - SPECIAL VIEW FOR SHOWING AVAILABLE MAILBOXES %>
<H3>LAST RESORT</H3>
<P>The Postmaster address is the address of last resort when fetchmail cannot determine how to send a mail message. If left blank, undelieverable mail may be discarded.</P>
<%
local tags = { "postmaster", }
displayinfo(myform,tags)
%>
<H3>ETRN</H3>
<P>This is for branches that have DNS mail domains hosted by an ISP that allows for ETRN dequeueing. ETRN dequeueing causes the SMTP mail exchanger at the ISP to forward mail to you via SMTP. You will need to make sure that DNS is setup appropriately and that your ISP supports ETRN. If you have not arranged with your ISP to have ETRN support, leave these fields blank.</P>
<%
local tags = { "etrnremote","etrnquedomain", }
displayinfo(myform,tags)
%>
<% --[[ %>
<H2>ADVANCED CONFIGURATION</H2>
<H3>GENERAL</H3>
<%
local tags = { "logfile", "loglevel", "smallerlogs", }
displayinfo(myform,tags)
%>
<% --]] %>
<H2>SAVE AND APPLY ABOVE SETTINGS</H2>
<%
local tags = { "cmdsave","cmdtest", }
displayinfo(myform,tags)
%>
</form>
<%
local cmdform = form.management
local tags = { "start", "stop", "restart" }
if (cmdform) and (cmdform[tags[1]]) then
%>
<form name="management" action="" method="POST">
<H1>MANAGEMENT</H1>
<dl>
<dt><%= cmdform[tags[1]]["label"] %></dt>
<dd>
<% for k,v in pairs(tags) do %>
<% if (cmdform[v]) then %>
<% io.write(html.form[cmdform[v].type](cmdform[v])) %>
<% end %>
<% end %>
</dd>
<% if (form.cmdmanagement) and (#form.cmdmanagement.descr > 0) then %> <% if viewlibrary and viewlibrary.dispatch_component then
<dt>Previous action result</dt> viewlibrary.dispatch_component("listentries")
<dd><pre><%= form.cmdmanagement.descr %></pre></dd> end %>
<% end %>
</dl>
</form>
<% end %> <% if viewlibrary and viewlibrary.dispatch_component then
viewlibrary.dispatch_component("startstop")
end %>
...@@ -11,11 +11,27 @@ end ...@@ -11,11 +11,27 @@ end
function startstop(self) function startstop(self)
return controllerfunctions.handle_startstop(self, self.model.startstop_service, self.model.getstatus, self.clientdata) return controllerfunctions.handle_startstop(self, self.model.startstop_service, self.model.getstatus, self.clientdata)
end end
--[[
function config(self) function editconfig(self)
return controllerfunctions.handle_form(self, self.model.getconfig, self.model.updateconfig, self.clientdata, "Save", "Edit Config", "Configuration Set") return controllerfunctions.handle_form(self, self.model.getconfig, self.model.updateconfig, self.clientdata, "Save", "Edit Config", "Configuration Set")
end end
--]]
function expert(self) function expert(self)
return controllerfunctions.handle_form(self, self.model.get_filedetails, self.model.update_filecontent, self.clientdata, "Save", "Edit Config", "Configuration Set") return controllerfunctions.handle_form(self, self.model.get_filedetails, self.model.update_filecontent, self.clientdata, "Save", "Edit Config", "Configuration Set")
end end
function listentries(self)
return self.model.readentries()
end
function editentry(self)
return controllerfunctions.handle_form(self, function() return self.model.readentry(self.clientdata.entry) end, self.model.updateentry, self.clientdata, "Save", "Edit Entry", "Entry Saved")
end
function createentry(self)
return controllerfunctions.handle_form(self, self.model.readentry, self.model.createentry, self.clientdata, "Create", "Create Entry", "Entry Created")
end
function deleteentry(self)
return self:redirect_to_referrer(self.model.deleteentry(self.clientdata.entry))
end
fetchmail-editentry-html.lsp
\ No newline at end of file
../form-html.lsp
\ No newline at end of file
<% local form, viewlibrary, page_info = ...
require("viewfunctions")
%>
<H1><%= form.label %></H1>
<%
form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action
if page_info.action == "editentry" then
form.value.remotehost.contenteditable = false
end
local order = { "remotehost", "enabled", "method", "remotemailbox", "remotepassword", "localhost", "localmailbox", "localdomain" }
displayform(form, order)
%>
<% local data, viewlibrary, page_info, session = ...
require("viewfunctions")
%>
<%
--[[ DEBUG INFORMATION
io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>")
io.write(html.cfe_unpack(data))
io.write("</span>")
--]]
%>
<% displaycommandresults({"deleteentry"}, session) %>
<h1>Edit/View Fetchmail Entries</h1>
<DL>
<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">Enabled</TD>
<TD style="white-space:nowrap;text-align:left;" class="header">Method</TD>
</TR>
<% 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, label="Edit " }) %>
<% io.write(html.link{value = "deleteentry?entry=" .. entry.entry, label="Delete " }) %>
</TD>
<TD style="padding-right:20px;white-space:nowrap;"><%= entry.entry %></TD>
<TD style="padding-right:20px;white-space:nowrap;"><%= entry.enabled %></TD>
<TD style="white-space:nowrap;" width="90%"><%= entry.method %></TD>
</TR>
<% end %>
</TABLE>
<DT>Add new entry</DT>
<DD><form action="<%= page_info.script .. page_info.prefix .. page_info.controller .. "/createentry" %>" method="POST">
<input type=submit value="New" class="submit">
</form></DD>
</DL>
This diff is collapsed.
../startstop-html.lsp
\ No newline at end of file
#CAT GROUP/DESC TAB ACTION #CAT GROUP/DESC TAB ACTION
Networking 30Fetchmail Status status Networking 30Fetchmail Status status
#Networking 30Fetchmail Config config Networking 30Fetchmail Config config
Networking 30Fetchmail Expert expert Networking 30Fetchmail Expert expert
READ=fetchmail:status READ=fetchmail:status
UPDATE=fetchmail:expert,fetchmail:startstop UPDATE=fetchmail:expert,fetchmail:startstop,fetchmail:config,fetchmail:editconfig,fetchmail:listentries,fetchmail:editentry
DELETE=fetchmail:deleteentry
CREATE=fetchmail:createentry
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