Gossamer Forum
Home : Products : Gossamer Mail : Development, Plugins and Globals :

One-Click Empty Trash for Users

Quote Reply
One-Click Empty Trash for Users
Hey all,

I'm looking for a way to provide users a one-click empty trash option in their folders on the left. It would be best if I could have an "Empty" link after the Trash folder but I suspect that may require a tweak in the code as the folders list is built automatically.

I'll also be OK with a link at the bottom of the Folders list that simply says "Empty Trash". Can anyone help with what the link should look like?

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] One-Click Empty Trash for Users In reply to
Take a look at the html which is generated for the Empty Trash button when you're in the Trash folder. It'll be something like:
Code:
<form action="webmail.cgi" method="post" name="msgs">
<%form_hidden%>
<input type="hidden" name="page" value="msgs_list.htm"><%-- this is the page to return to --%>
<input type="hidden" name="msgtrack_fid" value="<%msgtrack_fid%>">
<input type="submit" name="do=messages-delete_folder;folders_fid=<%GMail::Folders::trash_fid%>" value="Empty Trash">
</form>

On new installations, such an action is restricted to POST only, so you'll have to use a form (or change the state file to allow the action to be a GET request). This is done so that no malicious email could make calls to empty your folders (Gossamer Mail does do XSS filtering, but it's not perfect).

Adrian

Last edited by:

brewt: Jun 20, 2004, 4:48 PM
Quote Reply
Re: [brewt] One-Click Empty Trash for Users In reply to
Thanks Adrian. Works like a charm. Smile

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] One-Click Empty Trash for Users In reply to
Nope - I spoke to soon.... Frown

This piece of code disables the "select all" check-box next to the Subject. You can still select messages individually but trying to select all messages in a folder doesn't work anymore.

Any idea where the conflict is?

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] One-Click Empty Trash for Users In reply to
You have to make sure you're not putting forms inside of forms.

Adrian
Quote Reply
Re: [brewt] One-Click Empty Trash for Users In reply to
Just checked it. As far as I can see I don't have any forms in forms....

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] One-Click Empty Trash for Users In reply to
Are there any javascript errors reported (Tools -> Javascript console for Mozilla/Firefox)?

Adrian
Quote Reply
Re: [brewt] One-Click Empty Trash for Users In reply to
Page seem to load fine. When I check the check box IE reports an "error on page" in the bottom left of the status bar. See the attachment. The part you can not read says: Line 11...

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] One-Click Empty Trash for Users In reply to
Oops, my example there has the name="msgs" in it, which needs to be removed.

Adrian
Quote Reply
Re: [brewt] One-Click Empty Trash for Users In reply to
Thanks! Smile

Safe swoops
Sangiro