commit | author | age
|
864745
|
1 |
<?php |
AM |
2 |
/** |
|
3 |
* Attachement Reminder |
|
4 |
* |
|
5 |
* A plugin that reminds a user to attach the files |
|
6 |
* |
|
7 |
* @version @package_version@ |
|
8 |
* @author Thomas Yu - Sian, Liu |
|
9 |
* @author Aleksander Machniak <machniak@kolabsys.com> |
|
10 |
* |
|
11 |
* Copyright (C) 2013 Thomas Yu - Sian, Liu |
|
12 |
* Copyright (C) 2013, Kolab Systems AG |
|
13 |
* |
c47239
|
14 |
* This program is free software: you can redistribute it and/or modify |
AM |
15 |
* it under the terms of the GNU General Public License as published by |
|
16 |
* the Free Software Foundation, either version 3 of the License, or |
|
17 |
* (at your option) any later version. |
864745
|
18 |
* |
AM |
19 |
* This program is distributed in the hope that it will be useful, |
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
c47239
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
864745
|
22 |
* GNU General Public License for more details. |
AM |
23 |
* |
c47239
|
24 |
* You should have received a copy of the GNU General Public License |
07c6c6
|
25 |
* along with this program. If not, see <http://www.gnu.org/licenses/> |
864745
|
26 |
*/ |
AM |
27 |
|
|
28 |
class attachment_reminder extends rcube_plugin |
|
29 |
{ |
|
30 |
public $task = 'mail|settings'; |
|
31 |
public $noajax = true; |
|
32 |
|
|
33 |
|
|
34 |
function init() |
|
35 |
{ |
|
36 |
$rcmail = rcube::get_instance(); |
|
37 |
|
|
38 |
if ($rcmail->task == 'mail' && $rcmail->action == 'compose') { |
4e12fd
|
39 |
if ($rcmail->config->get('attachment_reminder')) { |
AM |
40 |
$this->include_script('attachment_reminder.js'); |
|
41 |
$this->add_texts('localization/', array('keywords', 'forgotattachment')); |
|
42 |
$rcmail->output->add_label('addattachment', 'send'); |
|
43 |
} |
864745
|
44 |
} |
AM |
45 |
|
|
46 |
if ($rcmail->task == 'settings') { |
|
47 |
$dont_override = $rcmail->config->get('dont_override', array()); |
|
48 |
|
|
49 |
if (!in_array('attachment_reminder', $dont_override)) { |
|
50 |
$this->add_hook('preferences_list', array($this, 'prefs_list')); |
|
51 |
$this->add_hook('preferences_save', array($this, 'prefs_save')); |
|
52 |
} |
|
53 |
} |
|
54 |
} |
|
55 |
|
|
56 |
function prefs_list($args) |
|
57 |
{ |
|
58 |
if ($args['section'] == 'compose') { |
|
59 |
$this->add_texts('localization/'); |
|
60 |
$reminder = rcube::get_instance()->config->get('attachment_reminder'); |
|
61 |
$field_id = 'rcmfd_attachment_reminder'; |
|
62 |
$checkbox = new html_checkbox(array('name' => '_attachment_reminder', 'id' => $field_id, 'value' => 1)); |
|
63 |
|
|
64 |
$args['blocks']['main']['options']['attachment_reminder'] = array( |
|
65 |
'title' => html::label($field_id, rcube::Q($this->gettext('reminderoption'))), |
|
66 |
'content' => $checkbox->show($reminder ? 1 : 0), |
|
67 |
); |
|
68 |
} |
|
69 |
|
|
70 |
return $args; |
|
71 |
} |
|
72 |
|
|
73 |
function prefs_save($args) |
|
74 |
{ |
|
75 |
if ($args['section'] == 'compose') { |
|
76 |
$dont_override = rcube::get_instance()->config->get('dont_override', array()); |
|
77 |
if (!in_array('attachment_reminder', $dont_override)) { |
|
78 |
$args['prefs']['attachment_reminder'] = !empty($_POST['_attachment_reminder']); |
|
79 |
} |
|
80 |
} |
|
81 |
return $args; |
|
82 |
} |
|
83 |
|
|
84 |
} |