summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG1
-rwxr-xr-xplugins/attachment_reminder/attachment_reminder.js54
-rwxr-xr-xplugins/attachment_reminder/attachment_reminder.php81
-rw-r--r--plugins/attachment_reminder/localization/de_CH.inc5
-rw-r--r--plugins/attachment_reminder/localization/de_DE.inc5
-rw-r--r--plugins/attachment_reminder/localization/en_US.inc6
-rw-r--r--plugins/attachment_reminder/localization/es_ES.inc5
-rw-r--r--plugins/attachment_reminder/localization/fr_FR.inc5
-rw-r--r--plugins/attachment_reminder/localization/it_IT.inc6
-rw-r--r--plugins/attachment_reminder/localization/nl_NL.inc5
-rw-r--r--plugins/attachment_reminder/localization/pl_PL.inc6
-rw-r--r--plugins/attachment_reminder/localization/zh_CN.inc5
-rw-r--r--plugins/attachment_reminder/localization/zh_TW.inc5
-rw-r--r--plugins/attachment_reminder/package.xml66
14 files changed, 255 insertions, 0 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 7542fde2a..43935159f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
+- Added attachment_reminder plugin
- Fix IMAP connection issue with default_socket_timeout < 0 and imap_timeout < 0 (#1489090)
- Fix various PHP code bugs found using static analysis (#1489086)
- Fix backslash character handling on vCard import (#1489085)
diff --git a/plugins/attachment_reminder/attachment_reminder.js b/plugins/attachment_reminder/attachment_reminder.js
new file mode 100755
index 000000000..01f2b4993
--- /dev/null
+++ b/plugins/attachment_reminder/attachment_reminder.js
@@ -0,0 +1,54 @@
+/* Attachment Reminder plugin script */
+
+function rcmail_get_compose_message()
+{
+ var msg;
+
+ if (window.tinyMCE && (ed = tinyMCE.get(rcmail.env.composebody))) {
+ msg = ed.getContent();
+ msg = msg.replace(/<blockquote[^>]*>(.|[\r\n])*<\/blockquote>/gmi, '');
+ }
+ else {
+ msg = $('#' + rcmail.env.composebody).val();
+ msg = msg.replace(/^>.*$/gmi, '');
+ }
+
+ return msg;
+}
+
+function rcmail_check_message(msg)
+{
+ var i, rg, keywords = rcmail.gettext('keywords', 'attachment_reminder').split(",").concat([".doc", ".pdf"]);
+
+ for (i=0; i<keywords.length; i++) {
+ rg = new RegExp(keywords[i],'i');
+ if (msg.search(rg) != -1)
+ return true;
+ }
+
+ return false;
+}
+
+function rcmail_have_attachments()
+{
+ return rcmail.env.attachments && $('li', rcmail.gui_objects.attachmentlist).length;
+}
+
+
+if (window.rcmail) {
+ rcmail.addEventListener('beforesend', function(evt) {
+ var msg = rcmail_get_compose_message(),
+ subject = $('#compose-subject').val();
+
+ if (!rcmail_have_attachments() && (rcmail_check_message(msg) || rcmail_check_message(subject))) {
+ if (confirm(rcmail.gettext('forgotattachment', 'attachment_reminder'))) {
+ if (window.UI && UI.show_uploadform) // Larry skin
+ UI.show_uploadform();
+ else if (window.rcmail_ui && rcmail_ui.show_popup) // classic skin
+ rcmail_ui.show_popup('uploadmenu', true);
+
+ return false;
+ }
+ }
+ });
+}
diff --git a/plugins/attachment_reminder/attachment_reminder.php b/plugins/attachment_reminder/attachment_reminder.php
new file mode 100755
index 000000000..6eed3a96b
--- /dev/null
+++ b/plugins/attachment_reminder/attachment_reminder.php
@@ -0,0 +1,81 @@
+<?php
+/**
+ * Attachement Reminder
+ *
+ * A plugin that reminds a user to attach the files
+ *
+ * @version @package_version@
+ * @author Thomas Yu - Sian, Liu
+ * @author Aleksander Machniak <machniak@kolabsys.com>
+ *
+ * Copyright (C) 2013 Thomas Yu - Sian, Liu
+ * Copyright (C) 2013, Kolab Systems AG
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+class attachment_reminder extends rcube_plugin
+{
+ public $task = 'mail|settings';
+ public $noajax = true;
+
+
+ function init()
+ {
+ $rcmail = rcube::get_instance();
+
+ if ($rcmail->task == 'mail' && $rcmail->action == 'compose') {
+ $this->include_script('attachment_reminder.js');
+ $this->add_texts('localization/', array('keywords', 'forgotattachment'));
+ }
+
+ if ($rcmail->task == 'settings') {
+ $dont_override = $rcmail->config->get('dont_override', array());
+
+ if (!in_array('attachment_reminder', $dont_override)) {
+ $this->add_hook('preferences_list', array($this, 'prefs_list'));
+ $this->add_hook('preferences_save', array($this, 'prefs_save'));
+ }
+ }
+ }
+
+ function prefs_list($args)
+ {
+ if ($args['section'] == 'compose') {
+ $this->add_texts('localization/');
+ $reminder = rcube::get_instance()->config->get('attachment_reminder');
+ $field_id = 'rcmfd_attachment_reminder';
+ $checkbox = new html_checkbox(array('name' => '_attachment_reminder', 'id' => $field_id, 'value' => 1));
+
+ $args['blocks']['main']['options']['attachment_reminder'] = array(
+ 'title' => html::label($field_id, rcube::Q($this->gettext('reminderoption'))),
+ 'content' => $checkbox->show($reminder ? 1 : 0),
+ );
+ }
+
+ return $args;
+ }
+
+ function prefs_save($args)
+ {
+ if ($args['section'] == 'compose') {
+ $dont_override = rcube::get_instance()->config->get('dont_override', array());
+ if (!in_array('attachment_reminder', $dont_override)) {
+ $args['prefs']['attachment_reminder'] = !empty($_POST['_attachment_reminder']);
+ }
+ }
+ return $args;
+ }
+
+}
diff --git a/plugins/attachment_reminder/localization/de_CH.inc b/plugins/attachment_reminder/localization/de_CH.inc
new file mode 100644
index 000000000..bf6eef721
--- /dev/null
+++ b/plugins/attachment_reminder/localization/de_CH.inc
@@ -0,0 +1,5 @@
+<?php
+
+$messages = array();
+$messages['forgotattachment'] = "Haben Sie möglicherweise vergessen eine Datei anzuhängen?";
+$messages['keywords'] = "anbei,im anhang,angehängt,angefügt,beigefügt,beliegend";
diff --git a/plugins/attachment_reminder/localization/de_DE.inc b/plugins/attachment_reminder/localization/de_DE.inc
new file mode 100644
index 000000000..bf6eef721
--- /dev/null
+++ b/plugins/attachment_reminder/localization/de_DE.inc
@@ -0,0 +1,5 @@
+<?php
+
+$messages = array();
+$messages['forgotattachment'] = "Haben Sie möglicherweise vergessen eine Datei anzuhängen?";
+$messages['keywords'] = "anbei,im anhang,angehängt,angefügt,beigefügt,beliegend";
diff --git a/plugins/attachment_reminder/localization/en_US.inc b/plugins/attachment_reminder/localization/en_US.inc
new file mode 100644
index 000000000..a736682db
--- /dev/null
+++ b/plugins/attachment_reminder/localization/en_US.inc
@@ -0,0 +1,6 @@
+<?php
+
+$messages = array();
+$messages['forgotattachment'] = "Did you forget to attach a file?";
+$messages['reminderoption'] = "Remind about forgotten attachments";
+$messages['keywords'] = "attachment,file,attach,attached,attaching,enclosed,CV,cover letter";
diff --git a/plugins/attachment_reminder/localization/es_ES.inc b/plugins/attachment_reminder/localization/es_ES.inc
new file mode 100644
index 000000000..8e3512182
--- /dev/null
+++ b/plugins/attachment_reminder/localization/es_ES.inc
@@ -0,0 +1,5 @@
+<?php
+
+$messages = array();
+$messages['forgotattachment'] = "¿Olvidó adjuntar un fichero al mensaje?";
+$messages['keywords'] = "adjunto";
diff --git a/plugins/attachment_reminder/localization/fr_FR.inc b/plugins/attachment_reminder/localization/fr_FR.inc
new file mode 100644
index 000000000..ab48cc517
--- /dev/null
+++ b/plugins/attachment_reminder/localization/fr_FR.inc
@@ -0,0 +1,5 @@
+<?php
+
+$messages = array();
+$messages['forgotattachment'] = "Avez vous oublié d'attacher un fichier ?";
+$messages['keywords'] = "joins,joint,attaché,CV"; \ No newline at end of file
diff --git a/plugins/attachment_reminder/localization/it_IT.inc b/plugins/attachment_reminder/localization/it_IT.inc
new file mode 100644
index 000000000..2807bc185
--- /dev/null
+++ b/plugins/attachment_reminder/localization/it_IT.inc
@@ -0,0 +1,6 @@
+<?php
+
+$messages = array();
+$messages['forgotattachment'] = "Sembra che tu abbia dimenticato di allegare un file!\nPremere Annulla per inviare lo stesso.\nOK per tornare al messaggio senza inviare.";
+$messages['keywords'] = "allegato,allegati,allegata,allegate,allega,allego,alleghi,attaccato,file,attachment,attach";
+
diff --git a/plugins/attachment_reminder/localization/nl_NL.inc b/plugins/attachment_reminder/localization/nl_NL.inc
new file mode 100644
index 000000000..62564f103
--- /dev/null
+++ b/plugins/attachment_reminder/localization/nl_NL.inc
@@ -0,0 +1,5 @@
+<?php
+
+$messages = array();
+$messages['forgotattachment'] = "Ben je vergeten het bestand bij te voegen?";
+$messages['keywords'] = "attachment,bestand,bijgaand,bijgaande,brief,bijgevoegd,bijgesloten,CV";
diff --git a/plugins/attachment_reminder/localization/pl_PL.inc b/plugins/attachment_reminder/localization/pl_PL.inc
new file mode 100644
index 000000000..96f4f4989
--- /dev/null
+++ b/plugins/attachment_reminder/localization/pl_PL.inc
@@ -0,0 +1,6 @@
+<?php
+
+$messages = array();
+$messages['forgotattachment'] = "Czy nie zapomniałeś załączyć pliku?";
+$messages['reminderoption'] = "Włącz przypominanie o brakującym załączniku";
+$messages['keywords'] = "załącznik,plik,załącz,CV";
diff --git a/plugins/attachment_reminder/localization/zh_CN.inc b/plugins/attachment_reminder/localization/zh_CN.inc
new file mode 100644
index 000000000..27cf04b25
--- /dev/null
+++ b/plugins/attachment_reminder/localization/zh_CN.inc
@@ -0,0 +1,5 @@
+<?php
+
+$messages = array();
+$messages['forgotattachment'] = "您似乎忘記加入附件了,你確定要寄出?";
+$messages['keywords'] = "附件,附加,附檔,附上,附加檔案";
diff --git a/plugins/attachment_reminder/localization/zh_TW.inc b/plugins/attachment_reminder/localization/zh_TW.inc
new file mode 100644
index 000000000..27cf04b25
--- /dev/null
+++ b/plugins/attachment_reminder/localization/zh_TW.inc
@@ -0,0 +1,5 @@
+<?php
+
+$messages = array();
+$messages['forgotattachment'] = "您似乎忘記加入附件了,你確定要寄出?";
+$messages['keywords'] = "附件,附加,附檔,附上,附加檔案";
diff --git a/plugins/attachment_reminder/package.xml b/plugins/attachment_reminder/package.xml
new file mode 100644
index 000000000..39b0f4617
--- /dev/null
+++ b/plugins/attachment_reminder/package.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" packagerversion="1.9.0" version="2.0" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
+ http://pear.php.net/dtd/tasks-1.0.xsd
+ http://pear.php.net/dtd/package-2.0
+ http://pear.php.net/dtd/package-2.0.xsd">
+ <name>Attachment Reminder</name>
+ <summary>Roundcube plugin that prompts you if it looks like you wanted to attach a file but you didn't.</summary>
+ <description>
+ This Roundcube plugin reminds the user to attach a file if the composed message text indicates that there should be any.
+ </description>
+ <lead>
+ <name>Aleksander Machniak</name>
+ <user>alec</user>
+ <email>alec@alec.pl</email>
+ <active>yes</active>
+ </lead>
+ <lead>
+ <name>Thomas Yu - Sian , Liu</name>
+ <active>yes</active>
+ </lead>
+ <version>
+ <release>1.1</release>
+ <api>1.0</api>
+ </version>
+ <stability>
+ <release>stable</release>
+ <api>stable</api>
+ </stability>
+ <license uri="http://www.gnu.org/licenses/gpl-2.0.html">GNU GPLv2</license>
+ <notes>-</notes>
+ <contents>
+ <dir baseinstalldir="/" name="/">
+ <file name="attachment_reminder.php" role="php">
+ <tasks:replace from="@name@" to="name" type="package-info"/>
+ <tasks:replace from="@package_version@" to="version" type="package-info"/>
+ </file>
+ <file name="attachment_reminder.js" role="data">
+ <tasks:replace from="@name@" to="name" type="package-info"/>
+ <tasks:replace from="@package_version@" to="version" type="package-info"/>
+ </file>
+
+ <file name="localization/de_CH.inc" role="data"></file>
+ <file name="localization/de_DE.inc" role="data"></file>
+ <file name="localization/en_US.inc" role="data"></file>
+ <file name="localization/es_ES.inc" role="data"></file>
+ <file name="localization/fr_FR.inc" role="data"></file>
+ <file name="localization/it_IT.inc" role="data"></file>
+ <file name="localization/nl_NL.inc" role="data"></file>
+ <file name="localization/pl_PL.inc" role="data"></file>
+ <file name="localization/zh_CN.inc" role="data"></file>
+ <file name="localization/zh_TW.inc" role="data"></file>
+ </dir>
+ <!-- / -->
+ </contents>
+ <dependencies>
+ <required>
+ <php>
+ <min>5.2.1</min>
+ </php>
+ <pearinstaller>
+ <min>1.7.0</min>
+ </pearinstaller>
+ </required>
+ </dependencies>
+ <phprelease/>
+</package>