From 428c80cce1acba5b78156e0fe904cbe2ca2600b3 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Thu, 29 Jul 2010 11:17:32 -0600 Subject: [PATCH] More places to move javascript into static js files --- imp/js/message.js | 19 +++++++++++++++++++ imp/message.php | 12 ++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/imp/js/message.js b/imp/js/message.js index 2e84c49ad..034f27995 100644 --- a/imp/js/message.js +++ b/imp/js/message.js @@ -1,12 +1,20 @@ /** * Provides the javascript for the message.php script (standard view). * + * Copyright 2010 The Horde Project (http://www.horde.org/) + * * See the enclosed file COPYING for license information (GPL). If you * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. + * + * @author Michael Slusarz + * @category Horde + * @package IMP */ var ImpMessage = { + // Set in message.php: pop3delete, stripatc + _arrowHandler: function(e) { if (e.altKey || e.shiftKey || e.ctrlKey) { @@ -172,6 +180,12 @@ var ImpMessage = { while (Object.isElement(elt)) { if (elt.match('.msgactions A.widget')) { + if (this.pop3delete && elt.hasClassName('deleteAction')) { + if (!window.confirm(this.pop3delete)) { + e.stop(); + return; + } + } if (elt.hasClassName('moveAction')) { this._transfer('move_message'); } else if (elt.hasClassName('copyAction')) { @@ -180,6 +194,11 @@ var ImpMessage = { this.submit('spam_report'); } else if (elt.hasClassName('notspamAction')) { this.submit('notspam_report'); + } else if (elt.hasClassName('stripAllAtc')) { + if (!window.confirm(this.stripatc)) { + e.stop(); + return; + } } } else if (elt.hasClassName('unblockImageLink')) { IMP.unblockImages(e); diff --git a/imp/message.php b/imp/message.php index edb6387dc..06cb4157a 100644 --- a/imp/message.php +++ b/imp/message.php @@ -468,7 +468,12 @@ if (!$readonly) { if (in_array('\\deleted', $flags)) { $a_template->set('delete', Horde::widget($self_link->copy()->add('actionID', 'undelete_message'), _("Undelete"), 'widget', '', '', _("Undelete"), true)); } else { - $a_template->set('delete', Horde::widget($self_link->copy()->add('actionID', 'delete_message'), _("Delete"), 'widget', '', ($use_pop) ? "return window.confirm('" . addslashes(_("Are you sure you want to PERMANENTLY delete these messages?")) . "');" : '', _("_Delete"), true)); + $a_template->set('delete', Horde::widget($self_link->copy()->add('actionID', 'delete_message'), _("Delete"), 'widget', '', '', _("_Delete"), true)); + if ($use_pop) { + Horde::addInlineScript(array( + 'ImpMessage.pop3delete = ' . Horde_Serialize::serialize(_("Are you sure you want to PERMANENTLY delete these messages?"), Horde_Serialize::JSON, $registry->getCharset()) + )); + } } } @@ -614,7 +619,10 @@ if ($show_parts == 'atc') { if (count($inlineout['display_ids']) > 2) { $a_template->set('download_all', Horde::widget($imp_contents->urlView($imp_contents->getMIMEMessage(), 'download_all'), _("Download All Attachments (in .zip file)"), 'widget', '', '', _("Download All Attachments (in .zip file)"), true)); if ($strip_atc) { - $a_template->set('strip_all', Horde::widget(Horde::selfUrl(true)->remove(array('actionID'))->add(array('actionID' => 'strip_all', 'message_token' => $message_token)), _("Strip All Attachments"), 'widget', '', "return window.confirm('" . addslashes(_("Are you sure you want to PERMANENTLY delete all attachments?")) . "');", _("Strip All Attachments"), true)); + $a_template->set('strip_all', Horde::widget(Horde::selfUrl(true)->remove(array('actionID'))->add(array('actionID' => 'strip_all', 'message_token' => $message_token)), _("Strip All Attachments"), 'widget stripAllAtc', '', '', _("Strip All Attachments"), true)); + Horde::addInlineScript(array( + 'ImpMessage.stripatc = ' . Horde_Serialize::serialize(_("Are you sure you want to PERMANENTLY delete all attachments?"), Horde_Serialize::JSON, $registry->getCharset()) + )); } $show_atc = true; -- 2.11.0