123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?php
-
-
- 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') {
- if ($rcmail->config->get('attachment_reminder')) {
- $this->include_script('attachment_reminder.js');
- $this->add_texts('localization/', array('keywords', 'forgotattachment'));
- $rcmail->output->add_label('addattachment', 'send');
- }
- }
-
- 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;
- }
-
- }
|