summaryrefslogtreecommitdiff
path: root/plugins/vcard_attachments
diff options
context:
space:
mode:
authortill <till@php.net>2010-03-20 14:20:01 +0000
committertill <till@php.net>2010-03-20 14:20:01 +0000
commit63a3dc5fde5a3ceed4f03c19c5015aab19050bee (patch)
tree50aafccdad5fe36c59f10d194298c35f046afd2f /plugins/vcard_attachments
parent0f8ff20ae2e8c949d58b9ca02bda95e388f7d142 (diff)
moved plugins
Diffstat (limited to 'plugins/vcard_attachments')
-rw-r--r--plugins/vcard_attachments/localization/de_CH.inc7
-rw-r--r--plugins/vcard_attachments/localization/de_DE.inc7
-rw-r--r--plugins/vcard_attachments/localization/en_US.inc7
-rw-r--r--plugins/vcard_attachments/localization/ru_RU.inc7
-rw-r--r--plugins/vcard_attachments/vcard_add_contact.pngbin1361 -> 0 bytes
-rw-r--r--plugins/vcard_attachments/vcard_attachments.php119
-rw-r--r--plugins/vcard_attachments/vcardattach.js10
7 files changed, 0 insertions, 157 deletions
diff --git a/plugins/vcard_attachments/localization/de_CH.inc b/plugins/vcard_attachments/localization/de_CH.inc
deleted file mode 100644
index dcc8ce713..000000000
--- a/plugins/vcard_attachments/localization/de_CH.inc
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
-
-$labels = array();
-$labels['addvardmsg'] = 'Kontakt im Adressbuch speichern';
-$labels['vcardsavefailed'] = 'Der Kontakt konnte nicht gespeichert werden';
-
-?> \ No newline at end of file
diff --git a/plugins/vcard_attachments/localization/de_DE.inc b/plugins/vcard_attachments/localization/de_DE.inc
deleted file mode 100644
index dcc8ce713..000000000
--- a/plugins/vcard_attachments/localization/de_DE.inc
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
-
-$labels = array();
-$labels['addvardmsg'] = 'Kontakt im Adressbuch speichern';
-$labels['vcardsavefailed'] = 'Der Kontakt konnte nicht gespeichert werden';
-
-?> \ No newline at end of file
diff --git a/plugins/vcard_attachments/localization/en_US.inc b/plugins/vcard_attachments/localization/en_US.inc
deleted file mode 100644
index 59a36e9bd..000000000
--- a/plugins/vcard_attachments/localization/en_US.inc
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
-
-$labels = array();
-$labels['addvardmsg'] = 'Add vCard to addressbook';
-$labels['vcardsavefailed'] = 'Unable to save vCard';
-
-?> \ No newline at end of file
diff --git a/plugins/vcard_attachments/localization/ru_RU.inc b/plugins/vcard_attachments/localization/ru_RU.inc
deleted file mode 100644
index e127b58d6..000000000
--- a/plugins/vcard_attachments/localization/ru_RU.inc
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
-
-$labels = array();
-$labels['addvardmsg'] = 'Добавить в контакты';
-$labels['vcardsavefailed'] = 'Не удалось сохранить vCard';
-
-?> \ No newline at end of file
diff --git a/plugins/vcard_attachments/vcard_add_contact.png b/plugins/vcard_attachments/vcard_add_contact.png
deleted file mode 100644
index 478c1f3f2..000000000
--- a/plugins/vcard_attachments/vcard_add_contact.png
+++ /dev/null
Binary files differ
diff --git a/plugins/vcard_attachments/vcard_attachments.php b/plugins/vcard_attachments/vcard_attachments.php
deleted file mode 100644
index d23cf37b1..000000000
--- a/plugins/vcard_attachments/vcard_attachments.php
+++ /dev/null
@@ -1,119 +0,0 @@
-<?php
-
-/**
- * Detect VCard attachments and show a button to add them to address book
- *
- * @version 1.0
- * @author Thomas Bruederli
- */
-class vcard_attachments extends rcube_plugin
-{
- public $task = 'mail';
-
- private $message;
- private $vcard_part;
-
- function init()
- {
- $rcmail = rcmail::get_instance();
- if ($rcmail->action == 'show' || $rcmail->action == 'preview') {
- $this->add_hook('message_load', array($this, 'message_load'));
- $this->add_hook('template_object_messagebody', array($this, 'html_output'));
- }
-
- $this->register_action('plugin.savevcard', array($this, 'save_vcard'));
- }
-
- /**
- * Check message attachments for vcards
- */
- function message_load($p)
- {
- $this->message = $p['object'];
-
- foreach ((array)$this->message->attachments as $attachment) {
- if (in_array($attachment->mimetype, array('text/vcard', 'text/x-vcard')))
- $this->vcard_part = $attachment->mime_id;
- }
-
- if ($this->vcard_part)
- $this->add_texts('localization');
- }
-
- /**
- * This callback function adds a box below the message content
- * if there is a vcard attachment available
- */
- function html_output($p)
- {
- if ($this->vcard_part) {
- $vcard = new rcube_vcard($this->message->get_part_content($this->vcard_part));
-
- // successfully parsed vcard
- if ($vcard->displayname) {
- $display = $vcard->displayname;
- if ($vcard->email[0])
- $display .= ' <'.$vcard->email[0].'>';
-
- // add box below messsage body
- $p['content'] .= html::p(array('style' => "margin:1em; padding:0.5em; border:1px solid #999; border-radius:4px; -moz-border-radius:4px; -webkit-border-radius:4px; width: auto;"),
- html::a(array(
- 'href' => "#",
- 'onclick' => "return plugin_vcard_save_contact('".JQ($this->vcard_part)."')",
- 'title' => $this->gettext('addvardmsg')),
- html::img(array('src' => $this->url('vcard_add_contact.png'), 'align' => "middle")))
- . ' ' . html::span(null, Q($display)));
-
- $this->include_script('vcardattach.js');
- }
- }
-
- return $p;
- }
-
- /**
- * Handler for request action
- */
- function save_vcard()
- {
- $this->add_texts('localization', true);
-
- $uid = get_input_value('_uid', RCUBE_INPUT_POST);
- $mbox = get_input_value('_mbox', RCUBE_INPUT_POST);
- $mime_id = get_input_value('_part', RCUBE_INPUT_POST);
-
- $rcmail = rcmail::get_instance();
- $part = $uid && $mime_id ? $rcmail->imap->get_message_part($uid, $mime_id) : null;
-
- $error_msg = $this->gettext('vcardsavefailed');
-
- if ($part && ($vcard = new rcube_vcard($part)) && $vcard->displayname && $vcard->email) {
- $contacts = $rcmail->get_address_book(null, true);
-
- // check for existing contacts
- $existing = $contacts->search('email', $vcard->email[0], true, false);
- if ($done = $existing->count) {
- $rcmail->output->command('display_message', $this->gettext('contactexists'), 'warning');
- }
- else {
- // add contact
- $success = $contacts->insert(array(
- 'name' => $vcard->displayname,
- 'firstname' => $vcard->firstname,
- 'surname' => $vcard->surname,
- 'email' => $vcard->email[0],
- 'vcard' => $vcard->export(),
- ));
-
- if ($success)
- $rcmail->output->command('display_message', $this->gettext('addedsuccessfully'), 'confirmation');
- else
- $rcmail->output->command('display_message', $error_msg, 'error');
- }
- }
- else
- $rcmail->output->command('display_message', $error_msg, 'error');
-
- $rcmail->output->send();
- }
-}
diff --git a/plugins/vcard_attachments/vcardattach.js b/plugins/vcard_attachments/vcardattach.js
deleted file mode 100644
index e03e5084d..000000000
--- a/plugins/vcard_attachments/vcardattach.js
+++ /dev/null
@@ -1,10 +0,0 @@
-
-function plugin_vcard_save_contact(mime_id)
-{
- rcmail.set_busy(true, 'loading');
- rcmail.http_post('plugin.savevcard', '_uid='+rcmail.env.uid+'&_mbox='+urlencode(rcmail.env.mailbox)+'&_part='+urlencode(mime_id), true);
-
- return false;
-}
-
-