Commit 5059daaa authored by Ted Trask's avatar Ted Trask

Removed call to redirect_to_referrer

parent 16919572
......@@ -23,7 +23,7 @@ function createpeer(self)
end
function deletepeer(self)
return self:redirect_to_referrer(self.model.delete_peer(self.clientdata.name))
return self.handle_form(self, self.model.get_delete_peer, self.model.delete_peer, self.clientdata, "Delete", "Delete Peer File", "Peer File Deleted")
end
function editpeer(self)
......
......@@ -15,7 +15,7 @@ require("htmlviewfunctions")
<TR>
<TD style="padding-right:20px;white-space:nowrap;">
<%
if viewlibrary.check_permission("deletepeer") then io.write(html.link{value = "deletepeer?name=" .. file, label="Delete " }) end
if viewlibrary.check_permission("deletepeer") then io.write(html.link{value = "deletepeer?submit=true&name=" .. file, label="Delete " }) end
if viewlibrary.check_permission("editpeer") then io.write(html.link{value = "editpeer?name=" .. file.."&redir="..page_info.orig_action, label="Edit " }) end
%>
</TD>
......
......@@ -94,19 +94,26 @@ function create_peer(self, newpeer)
return newpeer
end
function delete_peer(name)
local retval = cfe({ value="Failed to delete peer", label="Delete Peer Result", errtxt="Peer not found" })
function get_delete_peer(self, clientdata)
retval = {}
retval.name = cfe({ value=clientdata.name or "", label="Name" })
return cfe({ type="group", value=retval, label="Delete Peer File" })
end
function delete_peer(self, delpeer)
delpeer.errtxt = "Failed to delete peer"
delpeer.value.name.errtxt="Peer not found"
for file in fs.find(nil, peerspath) do
if name == file then
if delpeer.value.name.value == file then
os.remove(file)
retval.value = "Peer Deleted"
retval.errtxt = nil
delpeer.errtxt = nil
delpeer.value.name.errtxt = nil
break
end
end
return retval
return delpeer
end
function read_peerfile(name)
......
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