summaryrefslogtreecommitdiff
path: root/plugins/thunderbird_labels
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/thunderbird_labels')
-rw-r--r--plugins/thunderbird_labels/localization/bg_BG.inc17
-rw-r--r--plugins/thunderbird_labels/localization/ca_ES.inc17
-rw-r--r--plugins/thunderbird_labels/localization/cs_CZ.inc18
-rw-r--r--plugins/thunderbird_labels/localization/de_DE.inc18
-rw-r--r--plugins/thunderbird_labels/localization/en_US.inc18
-rw-r--r--plugins/thunderbird_labels/localization/fr_FR.inc17
-rw-r--r--plugins/thunderbird_labels/localization/hu_HU.inc18
-rw-r--r--plugins/thunderbird_labels/localization/lv_LV.inc17
-rw-r--r--plugins/thunderbird_labels/localization/pl_PL.inc18
-rw-r--r--plugins/thunderbird_labels/localization/ru_RU.inc18
-rw-r--r--plugins/thunderbird_labels/skins/classic/tb_label.css183
-rw-r--r--plugins/thunderbird_labels/skins/classic/thunderbird_32.pngbin0 -> 3232 bytes
-rw-r--r--plugins/thunderbird_labels/skins/default/tb_label.css183
-rw-r--r--plugins/thunderbird_labels/skins/default/thunderbird_32.pngbin0 -> 3232 bytes
-rw-r--r--plugins/thunderbird_labels/skins/larry/tb_label.css170
-rw-r--r--plugins/thunderbird_labels/skins/larry/thunderbird_32.pngbin0 -> 2662 bytes
-rw-r--r--plugins/thunderbird_labels/tb_label.js369
-rw-r--r--plugins/thunderbird_labels/thunderbird_labels.php210
18 files changed, 1291 insertions, 0 deletions
diff --git a/plugins/thunderbird_labels/localization/bg_BG.inc b/plugins/thunderbird_labels/localization/bg_BG.inc
new file mode 100644
index 000000000..d4f9e45ad
--- /dev/null
+++ b/plugins/thunderbird_labels/localization/bg_BG.inc
@@ -0,0 +1,17 @@
+<?php
+/**
+* Author:
+* Deyan Stoykov
+* http://code.google.com/p/rcmail-thunderbird-labels/
+*/
+
+$labels = array();
+$labels['label'] = 'Thunderbird етикети';
+$labels['label0'] = 'Без етикет';
+$labels['label1'] = 'Важно';
+$labels['label2'] = 'Работно';
+$labels['label3'] = 'Лично';
+$labels['label4'] = 'За изпълнение';
+$labels['label5'] = 'Отложено';
+
+$messages = array();
diff --git a/plugins/thunderbird_labels/localization/ca_ES.inc b/plugins/thunderbird_labels/localization/ca_ES.inc
new file mode 100644
index 000000000..d34c8efc8
--- /dev/null
+++ b/plugins/thunderbird_labels/localization/ca_ES.inc
@@ -0,0 +1,17 @@
+<?php
+/**
+* Author:
+* Lluís Forns Puigmartí
+* http://code.google.com/p/rcmail-thunderbird-labels/
+*/
+
+$labels = array();
+$labels['label'] = 'Etiquetes';
+$labels['label0'] = 'Cap etiqueta';
+$labels['label1'] = 'Important';
+$labels['label2'] = 'Feina';
+$labels['label3'] = 'Personal';
+$labels['label4'] = 'Per fer';
+$labels['label5'] = 'Més tard';
+
+$messages = array();
diff --git a/plugins/thunderbird_labels/localization/cs_CZ.inc b/plugins/thunderbird_labels/localization/cs_CZ.inc
new file mode 100644
index 000000000..d5fae12bb
--- /dev/null
+++ b/plugins/thunderbird_labels/localization/cs_CZ.inc
@@ -0,0 +1,18 @@
+<?php
+/**
+* Author:
+* Miroslav Zidek
+* http://code.google.com/p/rcmail-thunderbird-labels/
+*/
+
+$labels = array();
+$labels['label'] = 'Štítky Thunderbirdu';
+$labels['label0'] = 'Žádný štítek';
+$labels['label1'] = 'Důležité';
+$labels['label2'] = 'Pracovní';
+$labels['label3'] = 'Osobní';
+$labels['label4'] = 'Udělat';
+$labels['label5'] = 'Později';
+
+$messages = array();
+
diff --git a/plugins/thunderbird_labels/localization/de_DE.inc b/plugins/thunderbird_labels/localization/de_DE.inc
new file mode 100644
index 000000000..86473f60a
--- /dev/null
+++ b/plugins/thunderbird_labels/localization/de_DE.inc
@@ -0,0 +1,18 @@
+<?php
+/**
+* Author:
+* Michael Kefeder
+* http://code.google.com/p/rcmail-thunderbird-labels/
+*/
+
+$labels = array();
+$labels['label'] = 'Thunderbird Schlagwörter';
+$labels['label0'] = 'Alle Entfernen';
+$labels['label1'] = 'Wichtig';
+$labels['label2'] = 'Dienstlich';
+$labels['label3'] = 'Persönlich'; // grün
+$labels['label4'] = 'Zu Erledigen'; // blau
+$labels['label5'] = 'Später';
+
+$messages = array();
+
diff --git a/plugins/thunderbird_labels/localization/en_US.inc b/plugins/thunderbird_labels/localization/en_US.inc
new file mode 100644
index 000000000..2d4237e05
--- /dev/null
+++ b/plugins/thunderbird_labels/localization/en_US.inc
@@ -0,0 +1,18 @@
+<?php
+/**
+* Author:
+* Michael Kefeder
+* http://code.google.com/p/rcmail-thunderbird-labels/
+*/
+
+$labels = array();
+$labels['label'] = 'Thunderbird Labels';
+$labels['label0'] = 'No Label';
+$labels['label1'] = 'Important';
+$labels['label2'] = 'Work';
+$labels['label3'] = 'Personal';
+$labels['label4'] = 'To Do';
+$labels['label5'] = 'Later';
+
+$messages = array();
+
diff --git a/plugins/thunderbird_labels/localization/fr_FR.inc b/plugins/thunderbird_labels/localization/fr_FR.inc
new file mode 100644
index 000000000..e50690a2a
--- /dev/null
+++ b/plugins/thunderbird_labels/localization/fr_FR.inc
@@ -0,0 +1,17 @@
+<?php
+/**
+* Author:
+* Michael Kefeder
+* http://code.google.com/p/rcmail-thunderbird-labels/
+*/
+
+$labels = array();
+
+$labels['label'] = 'Thunderbird Etiquettes';
+$labels['label0'] = 'Enlever toutes les &eacute;tiquettes';
+$labels['label1'] = 'Important';
+$labels['label2'] = 'Travail';
+$labels['label3'] = 'Personnel';
+$labels['label4'] = 'A faire';
+$labels['label5'] = 'Plus tard';
+
diff --git a/plugins/thunderbird_labels/localization/hu_HU.inc b/plugins/thunderbird_labels/localization/hu_HU.inc
new file mode 100644
index 000000000..eb450d899
--- /dev/null
+++ b/plugins/thunderbird_labels/localization/hu_HU.inc
@@ -0,0 +1,18 @@
+<?php
+/**
+* Author:
+* Daniel P.
+* http://code.google.com/p/rcmail-thunderbird-labels/
+*/
+
+$labels = array();
+$labels['label'] = 'Thunderbird Cimkék';
+$labels['label0'] = 'Minden cimke törlése';
+$labels['label1'] = 'Fontos';
+$labels['label2'] = 'Munka';
+$labels['label3'] = 'Személyes';
+$labels['label4'] = 'Teendők';
+$labels['label5'] = 'Később';
+
+$messages = array();
+
diff --git a/plugins/thunderbird_labels/localization/lv_LV.inc b/plugins/thunderbird_labels/localization/lv_LV.inc
new file mode 100644
index 000000000..00d557c7b
--- /dev/null
+++ b/plugins/thunderbird_labels/localization/lv_LV.inc
@@ -0,0 +1,17 @@
+<?php
+/**
+* Author:
+* Artem Ushakov
+* http://code.google.com/p/rcmail-thunderbird-labels/
+*/
+
+$labels = array();
+$labels['label'] = 'Vēstules atzīme';
+$labels['label0'] = 'Izdzēst visas atzīmes';
+$labels['label1'] = 'Svarīgs';
+$labels['label2'] = 'Darba';
+$labels['label3'] = 'Personāls';
+$labels['label4'] = 'Izpildei';
+$labels['label5'] = 'Atlikts';
+
+$messages = array();
diff --git a/plugins/thunderbird_labels/localization/pl_PL.inc b/plugins/thunderbird_labels/localization/pl_PL.inc
new file mode 100644
index 000000000..52284a802
--- /dev/null
+++ b/plugins/thunderbird_labels/localization/pl_PL.inc
@@ -0,0 +1,18 @@
+<?php
+/**
+* Author:
+* master771
+* http://code.google.com/p/rcmail-thunderbird-labels/
+*/
+
+$labels = array();
+$labels['label'] = 'Etykiety';
+$labels['label0'] = 'Brak';
+$labels['label1'] = 'Ważne';
+$labels['label2'] = 'Praca';
+$labels['label3'] = 'Osobiste';
+$labels['label4'] = 'Do zrobienia';
+$labels['label5'] = 'Później';
+
+$messages = array();
+
diff --git a/plugins/thunderbird_labels/localization/ru_RU.inc b/plugins/thunderbird_labels/localization/ru_RU.inc
new file mode 100644
index 000000000..d3bfa3220
--- /dev/null
+++ b/plugins/thunderbird_labels/localization/ru_RU.inc
@@ -0,0 +1,18 @@
+<?php
+/**
+* Author:
+* Николай Николай
+* http://code.google.com/p/rcmail-thunderbird-labels/
+*/
+
+$labels = array();
+$labels['label'] = 'Метка Thunderbird';
+$labels['label0'] = 'Удалить все метки';
+$labels['label1'] = 'Важное';
+$labels['label2'] = 'Рабочее';
+$labels['label3'] = 'Личное';
+$labels['label4'] = 'К исполнению';
+$labels['label5'] = 'Отложено';
+
+$messages = array();
+
diff --git a/plugins/thunderbird_labels/skins/classic/tb_label.css b/plugins/thunderbird_labels/skins/classic/tb_label.css
new file mode 100644
index 000000000..3daf6a793
--- /dev/null
+++ b/plugins/thunderbird_labels/skins/classic/tb_label.css
@@ -0,0 +1,183 @@
+/**
+* Author:
+* Michael Kefeder
+* http://code.google.com/p/rcmail-thunderbird-labels/
+*
+* CSS is Based on a patch for roundcube 0.3 I found a long time ago
+*/
+
+#tb_label_popuplink {
+ background-image: url(thunderbird_32.png);
+ background-repeat: no-repeat;
+ width: 32px;
+ height: 32px;
+ padding: 0px;
+ margin: 0px 5px 0px 5px;
+}
+
+#tb_label_popup
+{
+ width: auto;
+ position: absolute;
+}
+
+#tb_label_popup a.active
+{
+ color: inherit; /* fix for firefox */
+}
+
+.toolbarmenu li.label0 a
+{
+ color: #CCC;
+}
+.toolbarmenu li.label0,
+.toolbarmenu li.label0 a.active
+{
+ color: #333;
+}
+.toolbarmenu li.label1 a
+{
+ color: #FCC;
+}
+.toolbarmenu li.label2 a
+{
+ color: #FC3;
+}
+.toolbarmenu li.label3 a
+{
+ color: #3C3;
+}
+.toolbarmenu li.label4 a
+{
+ color: #99F;
+}
+.toolbarmenu li.label5 a
+{
+ color: #C9C;
+}
+/* Colors for single/preview message window headers display */
+table.label1
+{
+ background-color: #FCC;
+}
+table.label2
+{
+ background-color: #FC3;
+}
+table.label3
+{
+ background-color: #3C3;
+}
+table.label4
+{
+ background-color: #99F;
+}
+table.label5
+{
+ background-color: #C9C;
+}
+
+/* Support for Thunderbird label: definition of the 5 label color */
+/* Unselected (unfocused) messages */
+#messagelist tr.label1 td,
+#messagelist tr.label1 td a,
+.toolbarmenu li.label1,
+.toolbarmenu li.label1 a.active
+{
+ color: #FF0000;
+}
+
+#messagelist tr.label2 td,
+#messagelist tr.label2 td a,
+.toolbarmenu li.label2,
+.toolbarmenu li.label2 a.active
+{
+ color: #FF9900;
+}
+
+#messagelist tr.label3 td,
+#messagelist tr.label3 td a,
+.toolbarmenu li.label3,
+.toolbarmenu li.label3 a.active
+{
+ color: #009900;
+}
+
+#messagelist tr.label4 td,
+#messagelist tr.label4 td a,
+.toolbarmenu li.label4,
+.toolbarmenu li.label4 a.active
+{
+ color: #3333FF;
+}
+
+#messagelist tr.label5 td,
+#messagelist tr.label5 td a,
+.toolbarmenu li.label5,
+.toolbarmenu li.label5 a.active
+{
+ color: #993399;
+}
+
+/* Selected messages */
+#messagelist tr.selected.label1 td,
+#messagelist tr.selected.label1 td a
+{
+ color: #FFFFFF;
+ background-color: #FF0000;
+}
+
+#messagelist tr.selected.label2 td,
+#messagelist tr.selected.label2 td a
+{
+ color: #FFFFFF;
+ background-color: #FF9900;
+}
+
+#messagelist tr.selected.label3 td,
+#messagelist tr.selected.label3 td a
+{
+ color: #FFFFFF;
+ background-color: #009900;
+}
+
+#messagelist tr.selected.label4 td,
+#messagelist tr.selected.label4 td a
+{
+ color: #FFFFFF;
+ background-color: #3333FF;
+}
+
+#messagelist tr.selected.label5 td,
+#messagelist tr.selected.label5 td a
+{
+ color: #FFFFFF;
+ background-color: #993399;
+}
+
+/* Non-labeled selected message: changed to make it look "like" Thunderbird */
+/*#messagelist tr.selected td
+{
+ color: #000000;
+ background-color: #F0CB82;
+}
+*/
+/* Addition for selected RCM "flagged" message */
+/*#messagelist tr.selected.flagged td
+{
+ color: #FFFFFF;
+ background-color: #CC3333;
+}
+*/
+/* Non specific message : changed to make it look like Thunderbird */
+/*#messagelist tr.selected td a
+{
+ color: #000000;
+}
+*/
+/* Addition for selected RCM "flagged" message */
+/*#messagelist tr.selected.flagged td a
+{
+ color: #FFFFFF;
+}
+*/
diff --git a/plugins/thunderbird_labels/skins/classic/thunderbird_32.png b/plugins/thunderbird_labels/skins/classic/thunderbird_32.png
new file mode 100644
index 000000000..b51af5e04
--- /dev/null
+++ b/plugins/thunderbird_labels/skins/classic/thunderbird_32.png
Binary files differ
diff --git a/plugins/thunderbird_labels/skins/default/tb_label.css b/plugins/thunderbird_labels/skins/default/tb_label.css
new file mode 100644
index 000000000..3daf6a793
--- /dev/null
+++ b/plugins/thunderbird_labels/skins/default/tb_label.css
@@ -0,0 +1,183 @@
+/**
+* Author:
+* Michael Kefeder
+* http://code.google.com/p/rcmail-thunderbird-labels/
+*
+* CSS is Based on a patch for roundcube 0.3 I found a long time ago
+*/
+
+#tb_label_popuplink {
+ background-image: url(thunderbird_32.png);
+ background-repeat: no-repeat;
+ width: 32px;
+ height: 32px;
+ padding: 0px;
+ margin: 0px 5px 0px 5px;
+}
+
+#tb_label_popup
+{
+ width: auto;
+ position: absolute;
+}
+
+#tb_label_popup a.active
+{
+ color: inherit; /* fix for firefox */
+}
+
+.toolbarmenu li.label0 a
+{
+ color: #CCC;
+}
+.toolbarmenu li.label0,
+.toolbarmenu li.label0 a.active
+{
+ color: #333;
+}
+.toolbarmenu li.label1 a
+{
+ color: #FCC;
+}
+.toolbarmenu li.label2 a
+{
+ color: #FC3;
+}
+.toolbarmenu li.label3 a
+{
+ color: #3C3;
+}
+.toolbarmenu li.label4 a
+{
+ color: #99F;
+}
+.toolbarmenu li.label5 a
+{
+ color: #C9C;
+}
+/* Colors for single/preview message window headers display */
+table.label1
+{
+ background-color: #FCC;
+}
+table.label2
+{
+ background-color: #FC3;
+}
+table.label3
+{
+ background-color: #3C3;
+}
+table.label4
+{
+ background-color: #99F;
+}
+table.label5
+{
+ background-color: #C9C;
+}
+
+/* Support for Thunderbird label: definition of the 5 label color */
+/* Unselected (unfocused) messages */
+#messagelist tr.label1 td,
+#messagelist tr.label1 td a,
+.toolbarmenu li.label1,
+.toolbarmenu li.label1 a.active
+{
+ color: #FF0000;
+}
+
+#messagelist tr.label2 td,
+#messagelist tr.label2 td a,
+.toolbarmenu li.label2,
+.toolbarmenu li.label2 a.active
+{
+ color: #FF9900;
+}
+
+#messagelist tr.label3 td,
+#messagelist tr.label3 td a,
+.toolbarmenu li.label3,
+.toolbarmenu li.label3 a.active
+{
+ color: #009900;
+}
+
+#messagelist tr.label4 td,
+#messagelist tr.label4 td a,
+.toolbarmenu li.label4,
+.toolbarmenu li.label4 a.active
+{
+ color: #3333FF;
+}
+
+#messagelist tr.label5 td,
+#messagelist tr.label5 td a,
+.toolbarmenu li.label5,
+.toolbarmenu li.label5 a.active
+{
+ color: #993399;
+}
+
+/* Selected messages */
+#messagelist tr.selected.label1 td,
+#messagelist tr.selected.label1 td a
+{
+ color: #FFFFFF;
+ background-color: #FF0000;
+}
+
+#messagelist tr.selected.label2 td,
+#messagelist tr.selected.label2 td a
+{
+ color: #FFFFFF;
+ background-color: #FF9900;
+}
+
+#messagelist tr.selected.label3 td,
+#messagelist tr.selected.label3 td a
+{
+ color: #FFFFFF;
+ background-color: #009900;
+}
+
+#messagelist tr.selected.label4 td,
+#messagelist tr.selected.label4 td a
+{
+ color: #FFFFFF;
+ background-color: #3333FF;
+}
+
+#messagelist tr.selected.label5 td,
+#messagelist tr.selected.label5 td a
+{
+ color: #FFFFFF;
+ background-color: #993399;
+}
+
+/* Non-labeled selected message: changed to make it look "like" Thunderbird */
+/*#messagelist tr.selected td
+{
+ color: #000000;
+ background-color: #F0CB82;
+}
+*/
+/* Addition for selected RCM "flagged" message */
+/*#messagelist tr.selected.flagged td
+{
+ color: #FFFFFF;
+ background-color: #CC3333;
+}
+*/
+/* Non specific message : changed to make it look like Thunderbird */
+/*#messagelist tr.selected td a
+{
+ color: #000000;
+}
+*/
+/* Addition for selected RCM "flagged" message */
+/*#messagelist tr.selected.flagged td a
+{
+ color: #FFFFFF;
+}
+*/
diff --git a/plugins/thunderbird_labels/skins/default/thunderbird_32.png b/plugins/thunderbird_labels/skins/default/thunderbird_32.png
new file mode 100644
index 000000000..b51af5e04
--- /dev/null
+++ b/plugins/thunderbird_labels/skins/default/thunderbird_32.png
Binary files differ
diff --git a/plugins/thunderbird_labels/skins/larry/tb_label.css b/plugins/thunderbird_labels/skins/larry/tb_label.css
new file mode 100644
index 000000000..1c6936cd7
--- /dev/null
+++ b/plugins/thunderbird_labels/skins/larry/tb_label.css
@@ -0,0 +1,170 @@
+/**
+* Author:
+* Michael Kefeder
+* http://code.google.com/p/rcmail-thunderbird-labels/
+*
+* CSS is Based on a patch for roundcube 0.3 I found a long time ago
+*/
+
+#tb_label_popuplink {
+ background-image: url(thunderbird_32.png);
+ /*background-repeat: repeat;*/
+ background-position: 50% 0px;
+ width: 32px;
+ height: 13px;
+ padding: 28px 2px 0px 2px;
+ margin: 0px 5px 0px 5px;
+}
+
+#tb_label_popup
+{
+ width: auto;
+ position: absolute;
+}
+
+#tb_label_popup a.active
+{
+ color: inherit; /* fix for firefox */
+}
+
+.toolbarmenu li.label0,
+.toolbarmenu li.label0 a.active
+{
+ color: #EEE;
+}
+/* Colors for single/preview message window headers display */
+table.label1
+{
+ background-color: #FCC;
+}
+table.label2
+{
+ background-color: #FC3;
+}
+table.label3
+{
+ background-color: #3C3;
+}
+table.label4
+{
+ background-color: #99F;
+}
+table.label5
+{
+ background-color: #C9C;
+}
+
+/* Support for Thunderbird label: definition of the 5 label color */
+/* Unselected (unfocused) messages */
+#messagelist tr.label1 td,
+#messagelist tr.label1 td a,
+.toolbarmenu li.label1,
+.toolbarmenu li.label1 a.active
+{
+ color: #FF0000;
+}
+
+#messagelist tr.label2 td,
+#messagelist tr.label2 td a,
+.toolbarmenu li.label2,
+.toolbarmenu li.label2 a.active
+{
+ color: #FF9900;
+}
+
+#messagelist tr.label3 td,
+#messagelist tr.label3 td a,
+.toolbarmenu li.label3,
+.toolbarmenu li.label3 a.active
+{
+ color: #009900;
+}
+
+#messagelist tr.label4 td,
+#messagelist tr.label4 td a
+{
+ color: #3333FF;
+}
+
+/* lighter blue for dark-grey popup... */
+.toolbarmenu li.label4,
+.toolbarmenu li.label4 a.active
+{
+ color: #0CF;
+}
+
+#messagelist tr.label5 td,
+#messagelist tr.label5 td a
+{
+ color: #993399;
+}
+
+/* lighter purple for dark-grey popup... */
+.toolbarmenu li.label5,
+.toolbarmenu li.label5 a.active
+{
+ color: #B6F;
+}
+
+/* Selected messages */
+#messagelist tr.selected.label1 td,
+#messagelist tr.selected.label1 td a
+{
+ color: #FFFFFF;
+ background-color: #FF0000;
+}
+
+#messagelist tr.selected.label2 td,
+#messagelist tr.selected.label2 td a
+{
+ color: #FFFFFF;
+ background-color: #FF9900;
+}
+
+#messagelist tr.selected.label3 td,
+#messagelist tr.selected.label3 td a
+{
+ color: #FFFFFF;
+ background-color: #009900;
+}
+
+#messagelist tr.selected.label4 td,
+#messagelist tr.selected.label4 td a
+{
+ color: #FFFFFF;
+ background-color: #3333FF;
+}
+
+#messagelist tr.selected.label5 td,
+#messagelist tr.selected.label5 td a
+{
+ color: #FFFFFF;
+ background-color: #993399;
+}
+
+/* Non-labeled selected message: changed to make it look "like" Thunderbird */
+/*#messagelist tr.selected td
+{
+ color: #000000;
+ background-color: #F0CB82;
+}
+*/
+/* Addition for selected RCM "flagged" message */
+/*#messagelist tr.selected.flagged td
+{
+ color: #FFFFFF;
+ background-color: #CC3333;
+}
+*/
+/* Non specific message : changed to make it look like Thunderbird */
+/*#messagelist tr.selected td a
+{
+ color: #000000;
+}
+*/
+/* Addition for selected RCM "flagged" message */
+/*#messagelist tr.selected.flagged td a
+{
+ color: #FFFFFF;
+}
+*/
diff --git a/plugins/thunderbird_labels/skins/larry/thunderbird_32.png b/plugins/thunderbird_labels/skins/larry/thunderbird_32.png
new file mode 100644
index 000000000..c8254dd65
--- /dev/null
+++ b/plugins/thunderbird_labels/skins/larry/thunderbird_32.png
Binary files differ
diff --git a/plugins/thunderbird_labels/tb_label.js b/plugins/thunderbird_labels/tb_label.js
new file mode 100644
index 000000000..a9239f30f
--- /dev/null
+++ b/plugins/thunderbird_labels/tb_label.js
@@ -0,0 +1,369 @@
+/**
+ * Version:
+ * $Revision: 26 $
+ * Author:
+ * Michael Kefeder
+ * http://code.google.com/p/rcmail-thunderbird-labels/
+ */
+
+// global variable for contextmenu actions
+rcmail.tb_label_no = '';
+
+function rcmail_tb_label_menu(p)
+{
+ if (typeof rcmail_ui == "undefined")
+ rcmail_ui = UI;
+ if (!rcmail_ui.check_tb_popup())
+ rcmail_ui.tb_label_popup_add();
+
+ // Show the popup menu with tags
+ // -- skin larry vs classic
+ if (typeof rcmail_ui.show_popupmenu == "undefined")
+ rcmail_ui.show_popup('tb_label_popup');
+ else
+ rcmail_ui.show_popupmenu('tb_label_popup');
+
+ return false;
+}
+
+/**
+* Shows the colors based on flag info like in Thunderbird
+*/
+function rcm_tb_label_insert(uid, row)
+{
+ var message = rcmail.env.messages[uid];
+
+ if (message.flags && message.flags.tb_labels)
+ {
+ var rowobj = $(row.obj);
+ for (idx in message.flags.tb_labels)
+ rowobj.addClass('label' + message.flags.tb_labels[idx]);
+ }
+}
+
+/**
+* Shows the submenu of thunderbird labels
+*/
+function rcm_tb_label_submenu(p)
+{
+ if (typeof rcmail_ui == "undefined")
+ rcmail_ui = UI;
+ // setup onclick and active/non active classes
+ rcm_tb_label_create_popupmenu();
+
+ // -- create sensible popup, using roundcubes internals
+ if (!rcmail_ui.check_tb_popup())
+ rcmail_ui.tb_label_popup_add();
+ // -- skin larry vs classic
+ if (typeof rcmail_ui.show_popupmenu == "undefined")
+ rcmail_ui.show_popup('tb_label_popup');
+ else
+ rcmail_ui.show_popupmenu('tb_label_popup');
+ return false;
+}
+
+function rcm_tb_label_flag_toggle(flag_uids, toggle_label_no, onoff)
+{
+ var headers_table = $('table.headers-table');
+ var preview_frame = $('#messagecontframe');
+ // preview frame exists, simulate environment of single message view
+ if (preview_frame.length)
+ {
+ tb_labels_for_message = preview_frame.get(0).contentWindow.tb_labels_for_message;
+ headers_table = preview_frame.contents().find('table.headers-table');
+ }
+
+ if (!rcmail.message_list
+ && !headers_table)
+ return;
+ // for single message view
+ if (headers_table.length && flag_uids.length)
+ {
+ if (onoff == true)
+ {
+ // add color
+ headers_table.addClass('label'+toggle_label_no);
+ // add to flag list
+ tb_labels_for_message.push(toggle_label_no);
+ }
+ else
+ {
+ // remove color
+ headers_table.removeClass('label'+toggle_label_no);
+ var pos = jQuery.inArray(toggle_label_no, tb_labels_for_message);
+ if (pos > -1)
+ tb_labels_for_message.splice(pos, 1);
+ }
+ // exit function when in detail mode. when preview is active keep going
+ if (!rcmail.env.messages)
+ return;
+ }
+ jQuery.each(flag_uids, function (idx, uid) {
+ var message = rcmail.env.messages[uid];
+ var row = rcmail.message_list.rows[uid];
+ if (onoff == true)
+ {
+ // add colors
+ var rowobj = $(row.obj);
+ rowobj.addClass('label'+toggle_label_no);
+ // add to flag list
+ message.flags.tb_labels.push(toggle_label_no);
+ }
+ else
+ {
+ // remove colors
+ var rowobj = $(row.obj);
+ rowobj.removeClass('label'+toggle_label_no);
+ // remove from flag list
+ var pos = jQuery.inArray(toggle_label_no, message.flags.tb_labels);
+ if (pos > -1)
+ message.flags.tb_labels.splice(pos, 1);
+ }
+ });
+}
+
+function rcm_tb_label_flag_msgs(flag_uids, toggle_label_no)
+{
+ rcm_tb_label_flag_toggle(flag_uids, toggle_label_no, true);
+}
+
+function rcm_tb_label_unflag_msgs(unflag_uids, toggle_label_no)
+{
+ rcm_tb_label_flag_toggle(unflag_uids, toggle_label_no, false);
+}
+
+// helper function to get selected/active messages
+function rcm_tb_label_get_selection()
+{
+ var selection = rcmail.message_list ? rcmail.message_list.get_selection() : [];
+ if (selection.length == 0 && rcmail.env.uid)
+ selection = [rcmail.env.uid, ];
+ return selection;
+}
+
+function rcm_tb_label_create_popupmenu()
+{
+ for (i = 0; i < 6; i++)
+ {
+ var cur_a = $('li.label' + i +' a');
+
+ // add/remove active class
+ var selection = rcm_tb_label_get_selection();
+
+ if (selection.length == 0)
+ cur_a.removeClass('active');
+ else
+ cur_a.addClass('active');
+ }
+}
+
+function rcm_tb_label_init_onclick()
+{
+ for (i = 0; i < 6; i++)
+ {
+ var cur_a = $('#tb_label_popup li.label' + i +' a');
+
+ // TODO check if click event is defined instead of unbinding?
+ cur_a.unbind('click');
+ cur_a.click(function() {
+ var toggle_label = $(this).parent().attr('class');
+ var toggle_label_no = parseInt(toggle_label.replace('label', ''));
+ var selection = rcm_tb_label_get_selection();
+
+ if (!selection.length)
+ return;
+
+ var from = toggle_label_no;
+ var to = toggle_label_no + 1;
+ var unset_all = false;
+ // special case flag 0 means remove all flags
+ if (toggle_label_no == 0)
+ {
+ from = 1;
+ to = 6;
+ unset_all = true;
+ }
+ for (i = from; i < to; i++)
+ {
+ toggle_label = 'label' + i;
+ toggle_label_no = i;
+ // compile list of unflag and flag msgs and then send command
+ // Thunderbird modifies multiple message flags like it did the first in the selection
+ // e.g. first message has flag1, you click flag1, every message select loses flag1, the ones not having flag1 don't get it!
+ var first_toggle_mode = 'on';
+ if (rcmail.env.messages)
+ {
+ var first_message = rcmail.env.messages[selection[0]];
+ if (first_message.flags
+ && jQuery.inArray(toggle_label_no,
+ first_message.flags.tb_labels) >= 0
+ )
+ first_toggle_mode = 'off';
+ else
+ first_toggle_mode = 'on';
+ }
+ else // single message display
+ {
+ // flag already set?
+ if (jQuery.inArray(toggle_label_no,
+ tb_labels_for_message) >= 0)
+ first_toggle_mode = 'off';
+ }
+ var flag_uids = [];
+ var unflag_uids = [];
+ jQuery.each(selection, function (idx, uid) {
+ // message list not available (example: in detailview)
+ if (!rcmail.env.messages)
+ {
+ if (first_toggle_mode == 'on')
+ flag_uids.push(uid);
+ else
+ unflag_uids.push(uid);
+ // make sure for unset all there is the single message id
+ if (unset_all && unflag_uids.length == 0)
+ unflag_uids.push(uid);
+ return;
+ }
+ var message = rcmail.env.messages[uid];
+ if (message.flags
+ && jQuery.inArray(toggle_label_no,
+ message.flags.tb_labels) >= 0
+ )
+ {
+ if (first_toggle_mode == 'off')
+ unflag_uids.push(uid);
+ }
+ else
+ {
+ if (first_toggle_mode == 'on')
+ flag_uids.push(uid);
+ }
+ });
+
+ if (unset_all)
+ flag_uids = [];
+
+ // skip sending flags to backend that are not set anywhere
+ if (flag_uids.length == 0
+ && unflag_uids.length == 0)
+ continue;
+
+ var str_flag_uids = flag_uids.join(',');
+ var str_unflag_uids = unflag_uids.join(',');
+
+ var lock = rcmail.set_busy(true, 'loading');
+ rcmail.http_request('plugin.thunderbird_labels.set_flags', '_flag_uids=' + str_flag_uids + '&_unflag_uids=' + str_unflag_uids + '&_mbox=' + urlencode(rcmail.env.mailbox) + "&_toggle_label=" + toggle_label, lock);
+
+ // remove/add classes and tb labels from messages in JS
+ rcm_tb_label_flag_msgs(flag_uids, toggle_label_no);
+ rcm_tb_label_unflag_msgs(unflag_uids, toggle_label_no);
+ }
+ });
+ }
+}
+
+function rcmail_ctxm_label(command, el, pos)
+{
+ // my code works only on selected rows, contextmenu also on unselected
+ // so if no selection is available, use the uid set by contextmenu plugin
+ var selection = rcmail.message_list ? rcmail.message_list.get_selection() : [];
+
+ if (!selection.length && !rcmail.env.uid)
+ return;
+ if (!selection.length && rcmail.env.uid)
+ rcmail.message_list.select_row(rcmail.env.uid);
+
+ var cur_a = $('#tb_label_popup li.label' + rcmail.tb_label_no +' a');
+ if (cur_a)
+ {
+ cur_a.click();
+ }
+
+ return;
+}
+
+function rcmail_ctxm_label_set(which)
+{
+ // hack for my contextmenu submenu hack to propagate the selected label-no
+ rcmail.tb_label_no = which;
+}
+
+
+$(document).ready(function() {
+ rcm_tb_label_init_onclick();
+ // add keyboard shortcuts for normal keyboard and keypad
+ $(document).keyup(function(e) {
+ //console.log('Handler for .keyup() called.' + e.which);
+ var k = e.which;
+ if ((k > 47 && k < 58) || (k > 95 && k < 106))
+ {
+ var label_no = k % 48;
+ var cur_a = $('#tb_label_popup li.label' + label_no + ' a');
+
+ if (cur_a)
+ {
+ cur_a.click();
+ }
+ }
+ });
+
+ // if exists add contextmenu entries
+ if (window.rcm_contextmenu_register_command) {
+ rcm_contextmenu_register_command('ctxm_tb_label', rcmail_ctxm_label, $('#tb_label_ctxm_mainmenu'), 'moreacts', 'after', true);
+ }
+
+ // single message displayed?
+ if (window.tb_labels_for_message)
+ {
+ jQuery.each(tb_labels_for_message, function(idx, val)
+ {
+ rcm_tb_label_flag_msgs([-1,], val);
+ }
+ );
+ }
+
+ // add roundcube events
+ rcmail.addEventListener('insertrow', function(event) { rcm_tb_label_insert(event.uid, event.row); });
+
+ rcmail.addEventListener('init', function(evt) {
+ // create custom button, JS method, broken layout in Firefox 9 using PHP method now
+ /*var button = $('<A>').attr('href', '#').attr('id', 'tb_label_popuplink').attr('title', rcmail.gettext('label', 'thunderbird_labels')).html('');
+
+ button.bind('click', function(e) {
+ rcmail.command('plugin.thunderbird_labels.rcm_tb_label_submenu', this);
+ return false;
+ });
+
+ // add and register
+ rcmail.add_element(button, 'toolbar');
+ rcmail.register_button('plugin.thunderbird_labels.rcm_tb_label_submenu', 'tb_label_popuplink', 'link');
+ */
+ rcmail.register_command('plugin.thunderbird_labels.rcm_tb_label_submenu', rcm_tb_label_submenu, true);
+ });
+
+ // -- add my submenu to roundcubes UI (for roundcube classic only?)
+ if (window.rcube_mail_ui)
+ rcube_mail_ui.prototype.tb_label_popup_add = function() {
+ add = {
+ tb_label_popup: {id:'tb_label_popup'}
+ };
+ this.popups = $.extend(this.popups, add);
+ var obj = $('#'+this.popups.tb_label_popup.id);
+ if (obj.length)
+ this.popups.tb_label_popup.obj = obj;
+ else
+ delete this.popups.tb_label_popup;
+ };
+
+ if (window.rcube_mail_ui)
+ rcube_mail_ui.prototype.check_tb_popup = function() {
+ // larry skin doesn't have that variable, popup works automagically, return true
+ if (typeof this.popups == 'undefined')
+ return true;
+ if (this.popups.tb_label_popup)
+ return true;
+ else
+ return false;
+ };
+});
+
diff --git a/plugins/thunderbird_labels/thunderbird_labels.php b/plugins/thunderbird_labels/thunderbird_labels.php
new file mode 100644
index 000000000..e6487ae95
--- /dev/null
+++ b/plugins/thunderbird_labels/thunderbird_labels.php
@@ -0,0 +1,210 @@
+<?php
+/**
+ * Thunderbird Labels Plugin for Roundcube Webmail
+ *
+ * Plugin to show the 5 Message Labels Thunderbird Email-Client provides for IMAP
+ *
+ * @version $Revision: 24 $
+ * @author Michael Kefeder
+ * @url http://code.google.com/p/rcmail-thunderbird-labels/
+ */
+class thunderbird_labels extends rcube_plugin
+{
+ public $task = 'mail';
+ private $map;
+
+ function init()
+ {
+ $rcmail = rcmail::get_instance();
+ # -- disable plugin when printing message
+ if ($rcmail->action == 'print')
+ return;
+
+ $this->include_script('tb_label.js');
+ $this->add_texts('localization/', true);
+ $this->add_hook('messages_list', array($this, 'read_flags'));
+ $this->add_hook('message_load', array($this, 'read_single_flags'));
+ $this->add_hook('template_object_messageheaders', array($this, 'color_headers'));
+ $this->add_hook('render_page', array($this, 'tb_label_popup'));
+ $this->include_stylesheet($this->local_skin_path() . '/tb_label.css');
+
+ $this->name = get_class($this);
+ $this->prefs = array('show_labels' => true);
+ # -- additional TB flags
+ $this->add_tb_flags = array(
+ 'LABEL1' => '$Label1',
+ 'LABEL2' => '$Label2',
+ 'LABEL3' => '$Label3',
+ 'LABEL4' => '$Label4',
+ 'LABEL5' => '$Label5',
+ );
+ $this->message_tb_labels = array();
+
+ $this->add_button(
+ array(
+ 'command' => 'plugin.thunderbird_labels.rcm_tb_label_submenu',
+ 'id' => 'tb_label_popuplink',
+ 'title' => 'label', # gets translated
+ 'domain' => $this->ID,
+ 'type' => 'link',
+ 'content' => ' ', # maybe put translated version of "Labels" here?
+ 'class' => ($rcmail->config->get('skin') == 'larry') ? 'button' : 'tb_noclass',
+ ),
+ 'toolbar'
+ );
+
+ $this->register_action('plugin.thunderbird_labels.set_flags', array($this, 'set_flags'));
+
+
+ if (method_exists($this, 'require_plugin')
+ && in_array('contextmenu', $rcmail->config->get('plugins'))
+ && $this->require_plugin('contextmenu'))
+ {
+ if ($rcmail->action == '')
+ $this->add_hook('render_mailboxlist', array($this, 'show_tb_label_contextmenu'));
+ }
+ }
+
+ public function show_tb_label_contextmenu($args)
+ {
+ $rcmail = rcmail::get_instance();
+ $this->add_texts('localization/');
+ #$this->api->output->add_label('copymessage.copyingmessage');
+
+ $li = html::tag('li', array('class' => 'submenu'), Q($this->gettext('label')) . $this->_gen_label_submenu($args, 'tb_label_ctxm_submenu'));
+ $out .= html::tag('ul', array('id' => 'tb_label_ctxm_mainmenu'), $li);
+ $this->api->output->add_footer(html::div(array('style' => 'display: none;'), $out));
+ }
+
+ private function _gen_label_submenu($args, $id)
+ {
+ $rcmail = rcmail::get_instance();
+ $out = '';
+ for ($i = 0; $i < 6; $i++)
+ {
+ $separator = ($i == 0)? ' separator_below' :'';
+ $out .= '<li class="label'.$i.$separator.' ctxm_tb_label"><a href="#ctxm_tb_label" class="active" onclick="rcmail_ctxm_label_set('.$i.')">'.$i.' '.$this->gettext('label'.$i).'</a></li>';
+ }
+ $out = html::tag('ul', array('class' => 'popupmenu toolbarmenu folders', 'id' => $id), $out);
+ return $out;
+ }
+
+ public function read_single_flags($args)
+ {
+ #write_log($this->name, print_r(($args['object']), true));
+ if (!count($this->prefs)
+ or !isset($args['object'])
+ )
+ return;
+
+ if (is_array($args['object']->headers->flags))
+ {
+ $this->message_tb_labels = array();
+ foreach ($args['object']->headers->flags as $flagname => $flagvalue)
+ {
+ $flag = is_numeric("$flagvalue")? $flagname:$flagvalue;// for compatibility with < 0.5.4
+ $flag = strtolower($flag);
+ if (preg_match('/^\$?label/', $flag))
+ {
+ $flag_no = preg_replace('/^\$?label/', '', $flag);
+ #write_log($this->name, "Single message Flag: ".$flag." Flag_no:".$flag_no);
+ $this->message_tb_labels[] = (int)$flag_no;
+ }
+ }
+ }
+ # -- no return value for this hook
+ }
+
+ /**
+ * Writes labelnumbers for single message display
+ * Coloring of Message header table happens via Javascript
+ */
+ public function color_headers($p)
+ {
+ #write_log($this->name, print_r($p, true));
+ # -- always write array, even when empty
+ $p['content'] .= '<script type="text/javascript">
+ var tb_labels_for_message = ['.join(',', $this->message_tb_labels).'];
+ </script>';
+ return $p;
+ }
+
+ public function read_flags($args)
+ {
+ #write_log($this->name, print_r($args, true));
+ // add color information for all messages
+ #$rcmail = rcmail::get_instance();
+ #$this->prefs = $rcmail->config->get('thunderbird_labels', array());
+ // dont loop over all messages if we dont have any highlights or no msgs
+ if (!count($this->prefs)
+ or !isset($args['messages'])
+ or !is_array($args['messages']))
+ return $args;
+
+ // loop over all messages and add $LabelX info to the extra_flags
+ foreach($args['messages'] as $message)
+ {
+ #write_log($this->name, print_r($message->flags, true));
+ $message->list_flags['extra_flags']['tb_labels'] = array(); # always set extra_flags, needed for javascript later!
+ if (is_array($message->flags))
+ foreach ($message->flags as $flagname => $flagvalue)
+ {
+ $flag = is_numeric("$flagvalue")? $flagname:$flagvalue;// for compatibility with < 0.5.4
+ $flag = strtolower($flag);
+ if (preg_match('/^\$?label/', $flag))
+ {
+ $flag_no = preg_replace('/^\$?label/', '', $flag);
+ #write_log($this->name, "Flag:".$flag." Flag_no:".$flag_no);
+ $message->list_flags['extra_flags']['tb_labels'][] = (int)$flag_no;
+ }
+ }
+ }
+ return($args);
+ }
+
+ function set_flags()
+ {
+ #write_log($this->name, print_r($_GET, true));
+
+ $rcmail = rcmail::get_instance();
+ $imap = $rcmail->imap;
+ $cbox = get_input_value('_cur', RCUBE_INPUT_GET);
+ $mbox = get_input_value('_mbox', RCUBE_INPUT_GET);
+ $toggle_label = get_input_value('_toggle_label', RCUBE_INPUT_GET);
+ $flag_uids = get_input_value('_flag_uids', RCUBE_INPUT_GET);
+ $flag_uids = explode(',', $flag_uids);
+ $unflag_uids = get_input_value('_unflag_uids', RCUBE_INPUT_GET);
+ $unflag_uids = explode(',', $unflag_uids);
+
+ $imap->conn->flags = array_merge($imap->conn->flags, $this->add_tb_flags);
+
+ #write_log($this->name, print_r($flag_uids, true));
+ #write_log($this->name, print_r($unflag_uids, true));
+
+ if (!is_array($unflag_uids)
+ || !is_array($flag_uids))
+ return false;
+
+ $imap->set_flag($flag_uids, $toggle_label, $mbox);
+ $imap->set_flag($unflag_uids, "UN$toggle_label", $mbox);
+
+ $this->api->output->send();
+ }
+
+ function tb_label_popup()
+ {
+ $rcmail = rcmail::get_instance();
+ $out = '<div id="tb_label_popup" class="popupmenu">
+ <ul class="toolbarmenu">';
+ for ($i = 0; $i < 6; $i++)
+ {
+ $separator = ($i == 0)? ' separator_below' :'';
+ $out .= '<li class="label'.$i.$separator.'"><a href="#" class="active">'.$i.' '.$this->gettext('label'.$i).'</a></li>';
+ }
+ $out .= '</ul>
+ </div>';
+ $rcmail->output->add_gui_object('tb_label_popup_obj', 'tb_label_popup');
+ $rcmail->output->add_footer($out);
+ }
+}
+?>