More places to move javascript into static js files
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 29 Jul 2010 17:17:32 +0000 (11:17 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 29 Jul 2010 17:27:58 +0000 (11:27 -0600)
imp/js/message.js
imp/message.php

index 2e84c49..034f279 100644 (file)
@@ -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 <slusarz@curecanti.org>
+ * @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);
index edb6387..06cb415 100644 (file)
@@ -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;