From: Michael M Slusarz Date: Fri, 23 Apr 2010 06:40:27 +0000 (-0600) Subject: Move some javascript out of PHP script file X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=9c078bc25ad56f126dafab18d31b8bfc594fa44a;p=horde.git Move some javascript out of PHP script file --- diff --git a/imp/js/mailbox.js b/imp/js/mailbox.js index 67e11b99b..2a533b6b7 100644 --- a/imp/js/mailbox.js +++ b/imp/js/mailbox.js @@ -261,6 +261,16 @@ var ImpMailbox = { this.selectRow(i, $F('checkAll')); }, this); return; + + case 'delete_vfolder': + this.confirmDialog(elt.readAttribute('href'), IMP.text.mailbox_delete_vfolder); + e.stop(); + return; + + case 'empty_mailbox': + this.confirmDialog(elt.readAttribute('href'), IMP.text.mailbox_delete_all); + e.stop(); + return; } if (elt.match('TH') && diff --git a/imp/mailbox.php b/imp/mailbox.php index 0543be7dd..85324a127 100644 --- a/imp/mailbox.php +++ b/imp/mailbox.php @@ -335,6 +335,10 @@ if ($search_mbox) { $unread = $imp_mailbox->unseenMessages(Horde_Imap_Client::SORT_RESULTS_COUNT); } +horde::addInlineScript(array( + 'ImpMailbox.unread = ' . intval($unread) +)); + /* Get the recent message count. */ $newmsgs = 0; if ($prefs->getValue('nav_popup') || $prefs->getValue('nav_audio')) { @@ -399,6 +403,8 @@ IMP::quota(); /* Prepare the header template. */ $hdr_template = $injector->createInstance('Horde_Template'); +$hdr_template->setOption('gettext', true); + $hdr_template->set('title', $title); $hdr_template->set('pagetitle', $pagetitle); if ($readonly) { @@ -413,12 +419,15 @@ if ($_SESSION['imp']['protocol'] != 'pop') { if (!$search_mbox) { $hdr_template->set('search', Horde::link(Horde::applicationUrl('search-basic.php')->add('search_mailbox', $imp_mbox['mailbox']), sprintf(_("Search %s"), $rawtitle)) . Horde::img('search.png', _("Search")) . ''); if (!$readonly) { - $hdr_template->set('empty', Horde::link($mailbox_imp_url->copy()->add(array('actionID' => 'empty_mailbox', 'mailbox' => $imp_mbox['mailbox'], 'mailbox_token' => $mailbox_token)), _("Empty folder"), '', '', "ImpMailbox.confirmDialog(this.href, '" . addslashes(_("Are you sure you wish to delete all mail in this folder?")) . "'); return false;") . Horde::img('empty_spam.png', _("Empty folder")) . ''); + $hdr_template->set('empty', $mailbox_imp_url->copy()->add(array('actionID' => 'empty_mailbox', 'mailbox' => $imp_mbox['mailbox'], 'mailbox_token' => $mailbox_token))); + $hdr_template->set('empty_img', Horde::img('empty_spam.png', _("Empty folder"))); } } else { if ($imp_search->isEditableVFolder()) { $edit_search = sprintf(_("Edit Virtual Folder Definition for %s"), htmlspecialchars($rawtitle)); - $hdr_template->set('delete_vfolder', Horde::link($imp_search->deleteUrl(), sprintf(_("Delete Virtual Folder Definition for %s"), htmlspecialchars($rawtitle)), null, null, "if (confirm('" . addslashes(_("Are you sure you want to delete this Virtual Folder Definition?")) . "')) { return true; } else { return false; }") . Horde::img('delete.png', sprintf(_("Delete Virtual Folder Definition for %s"), $rawtitle)) . ''); + $hdr_template->set('delete_vfolder_url', $imp_search->deleteUrl()); + $hdr_template->set('delete_vfolder_label', sprintf(_("Delete Virtual Folder Definition for %s"), htmlspecialchars($rawtitle))); + $hdr_template->set('delete_vfolder_img', Horde::img('delete.png', sprintf(_("Delete Virtual Folder Definition for %s"), $rawtitle))); } elseif ($search_mbox && !isset($query_text)) { /* Mini search results. */ $search_mailbox = reset($imp_search->getSearchFolders()); @@ -839,8 +848,4 @@ if (($pageOb['end'] - $pageOb['begin']) >= 20) { echo $n_template->fetch(IMP_TEMPLATES . '/imp/mailbox/navbar.html'); } -Horde::addInlineScript(array( - 'ImpMailbox.unread = ' . strval($unread) -)); - require $registry->get('templates', 'horde') . '/common-footer.inc'; diff --git a/imp/templates/imp/javascript_defs.php b/imp/templates/imp/javascript_defs.php index 300e1cce7..c088c2dd7 100644 --- a/imp/templates/imp/javascript_defs.php +++ b/imp/templates/imp/javascript_defs.php @@ -31,6 +31,8 @@ $code = array( /* Strings used in mailbox.js */ 'mailbox_submit' => _("You must select at least one message first."), 'mailbox_delete' => _("Are you sure you wish to PERMANENTLY delete these messages?"), + 'mailbox_delete_all' => _("Are you sure you wish to delete all mail in this mailbox?"), + 'mailbox_delete_vfolder' => _("Are you sure you want to delete this Virtual Folder Definition?"), 'mailbox_selectone' => _("You must select at least one message first."), 'yes' => _("Yes"), 'no' => _("No"), diff --git a/imp/templates/imp/mailbox/header.html b/imp/templates/imp/mailbox/header.html index f02bd1bc0..8ac9b6386 100644 --- a/imp/templates/imp/mailbox/header.html +++ b/imp/templates/imp/mailbox/header.html @@ -6,8 +6,12 @@ - - + + + + +