[imp] delete emails permanently
Khanh Truong
k11h12anh at gmail.com
Tue Aug 26 17:19:01 UTC 2008
Thanks Arminas,
I made the solution a little bit cleaner which also preserves the undelete
function.
first of all I added the line below to file
imp/templates/mailbox/actions.html
<!-- ADD THE LINE BELOW THIS LINE --> <li><tag:delete /></li>
<if:delete_perm><li><tag:delete_perm /></li></if:delete_perm>
then in imp/mailbox.php
$a_template->set('delete', Horde::widget('#', _("Delete"), 'widget', '',
"messages_submit('delete_messages'); return false;", _("_Delete")));
//**** ADD THE LINE BELOW AFTER THE LINE ABOVE *****
$a_template->set('delete_perm', Horde::widget('#', _("Delete Permanently"),
'widget', '', "if (confirm('" . addslashes(_("Are you sure you wish to
permanently delete these messages?")) . "')) {
messages_submit('delete_messages'); } return false;", _("_Delete
Permanently")));
}
also in the same file replace the select case blocks/sections
delete_messages and undelete_messages with:
case 'delete_messages':
case 'delete_messages_perm':
case 'undelete_messages':
if (!empty($indices)) {
require_once IMP_BASE . '/lib/Message.php';
$imp_message = &IMP_Message::singleton();
if ($actionID == 'delete_messages')
$imp_message->delete($indices);
elseif ($actionID == 'delete_messages_perm')
$imp_message->delete($indices, true);
else
$imp_message->undelete($indices);
}
break;
That is all there is to it. This preserves the undelete, and you don't have
to modify the library file Messages.php
Ken
It was easier for me to add such feature, because I'm not using
> "undelete" function. So here is my changes:
>
> -------------------------------------------------
> in imp/mailbox.php I've added line:
>
> $a_template->set('undelete', Horde::widget('#', _("Delete
> Permanently"), 'widget', '', "if (confirm('" . addslashes(_("Are you
> sure you wish to perma
> nently delete these messages?")) . "')) {
> messages_submit('undelete_messages'); } return false;", _("Delete
> Permanently")));
>
> and in the same file changed action handler:
>
> case 'undelete_messages':
> if (!empty($indices)) {
> require_once IMP_BASE . '/lib/Message.php';
> $imp_message = &IMP_Message::singleton();
> /* ($actionID == 'delete_messages')
> ? $imp_message->delete($indices, false)
> : */ $imp_message->delete($indices, true);
> }
> break;
>
> -------------------------
>
> Take a look at the arguments for the function delete(); I've added on
> more argument to detect weather we are deleting messages permanenlty
> or not. So we must change this in the file imp/lib/Message.php
>
> function delete(&$indices, $smth, $keeplog = false)
> {
> $nuke = $smth;
> .................
> }
>
> And this is it. I guess there might be a "cleaner" way to do this, but
> if youre using function for undeleting messages, so you might want to
> create your own action.
>
More information about the imp
mailing list