pax_global_header00006660000000000000000000000064123373314750014522gustar00rootroot0000000000000052 comment=bc622e96fef9ce9689850f62fd25120f8ca68eae rcmail-thunderbird-labels-1.0.0/000077500000000000000000000000001233733147500165375ustar00rootroot00000000000000rcmail-thunderbird-labels-1.0.0/Changelog000066400000000000000000000032511233733147500203520ustar00rootroot00000000000000v1.0 --- + added Ukranian translation by Mykyta Solomko - completed German translation by thomas.cr82 + Added Section for Roundcube Settings (Issue 14) - fixed issue 13: bullets below navigation in separate window - fixed issue 15: listing of adressbook was impaired by tb_labels v0.9.6 --- + added Spanish translation by JPL TSolucio, S.L. (Joe Bordes) v0.9.5 --- + added Italian translation by Samuele Tognini + added Bulgarian translation by Deyan Stoykov + added Catalan translation by Lluís Forns Puigmartí + added options for configuring the plugin by Stephane Martin v0.9 --- + added Latvian translation by Artem Ushakov + added good looking icon for skin "Larry" by Stephane Martin v0.6 --- - disable plugin output for print message mode, suggestion via email by Markus Neubauer + added Hungarian translation donated by Daniel P. v0.5 --- + added Polish translation donated by master771 + show message color in headers table backgroundcolor (preview mode and single-message view) + modify thunderbird label from single message view + fixed broken layout in Firefox when in single message view v0.4.1 --- - fixed issue 2 "preview pane is broken" v0.4 --- + Improved javascript to use native rcmail popup functionality + fixed label detection/setting for roundcube 0.6 while staying compatible to <0.5.4 v0.3 --- + Added Russian Translation by Николай Николай + Labeling multiple messages now works exactly like in Thunderbird + Shortcut keys 0-5 added for quick labeling like in Thunderbird + attach a Thunderbird Label submenu for contextmenu plugin if it is available v0.2 --- - bugfix for Thunderbird versions using lowercase $labelX flags v0.1 --- - initial release rcmail-thunderbird-labels-1.0.0/README000066400000000000000000000026041233733147500174210ustar00rootroot00000000000000Thunderbird Labels Plugin for Roundcube Webmail --- Features --- - Displays the message rows using the same colors as Thunderbird does - Label of a message can be changed/set exactly like in Thunderbird - works together with the contextmenu plugin (when it's active and configured) - Shortcut keys 0-5 set the label for the marked messages - currently available translations: English, French, German, Polish, Russian TODO --- - allow users to have an arbitrary number of labels INSTALL --- - unpack to plugins directory - add 'thunderbird_labels' to $rcmail_config['plugins'] in main.inc.php CONFIGURE --- See config.inc.php - tb_label_enable = true/false (can be changed by user in prefs UI) - tb_label_modify_labels/false = true - tb_label_enable_contextmenu = true/false - tb_label_enable_shortcuts = true/false (can be changed by user in prefs UI) - tb_label_style = 'bullets' or 'thunderbird' Author --- Michael Kefeder http://code.google.com/p/rcmail-thunderbird-labels/ History --- This plugin is based on a patch I found for roundcube 0.3 a long time ago. Since roundcube is now able to handle the labels without modification of its source I decided to create a plugin. There exists a "Tags plugin for RoundCube" http://sourceforge.net/projects/tagspluginrc/ which does something similar, my plugin emulates thunderbirds behaviour better I think (coloring the message rows for example) rcmail-thunderbird-labels-1.0.0/composer.json000066400000000000000000000010101233733147500212510ustar00rootroot00000000000000{ "name": "weird-birds/thunderbird_labels", "type": "roundcube-plugin", "keywords": ["mail","labels","tags"], "authors": [ { "name": "Michael Kefeder", "homepage": "http://code.google.com/p/rcmail-thunderbird-labels/", "role": "Developer" } ], "repositories": [ { "type": "composer", "url": "http://plugins.roundcube.net" } ], "require": { "roundcube/plugin-installer": ">=0.1.3" } } rcmail-thunderbird-labels-1.0.0/config.inc.php000066400000000000000000000007431233733147500212710ustar00rootroot00000000000000 * http://code.google.com/p/rcmail-thunderbird-labels/ */ $labels = array(); $labels['label'] = 'Etichette Thunderbird'; $labels['label0'] = 'Nessuna etichetta'; $labels['label1'] = 'Importante'; $labels['label2'] = 'Lavoro'; $labels['label3'] = 'Personale'; $labels['label4'] = 'Da fare'; $labels['label5'] = 'Piu\' tardi'; $labels['tb_label_options'] = 'Opzioni Etichette Thunderbird'; $labels['tb_label_enable_option'] = 'Abilita Etichette'; $labels['tb_label_enable_shortcuts_option'] = 'Abilita tasti rapidi'; $labels['tb_label_button_label'] = 'Etichette'; $labels['tb_label_button_title'] = 'Assegna etichette al messaggio'; $labels['tb_label_contextmenu_title'] = 'Etichette'; $labels['tb_label_style_option'] = "Stile UI per etichette"; $labels['tb_label_label'] = "Label"; $messages = array(); rcmail-thunderbird-labels-1.0.0/localization/lv_LV.inc000066400000000000000000000005741233733147500227520ustar00rootroot00000000000000 D IDATxW[lW;wco.$!vIMT(REH"xT@AEJ)UZB(I8vq^}v U ̜߳?AOb)_N ̊c,9BW󰝧wmul]DY,ge&K(`Ps:x_ez}ے<՞'G&<<8/qz <t$ZFX3,=0:]Vlp?Zez,zWYos_h6o5:E :ê.+5\CpDNJED4yS!! |K4%4giaecZ`vys|<'ۆ3_>^osSq:R}hnF`80L -q$VeL.G X$̀<1ј:xeWx7.3C9kna.Z8utT ȦLdU4q6mѥLTu 5h4% FA%6 h,\yэvau$Df<<m]d, ͕*"J t q#P685݆D DKU<$`@Tc8˘0>ЍJFܼWdOô\,UPLNmm)C# "Q8:Ē*j.QBʀQ$ r W#׵sg*RChR[aᝪY'M< ӴhT+Rfef! Pz6!# VI䈾;ҕsP|"dY{twbbfYAz|ڀ\D3yrR5"d!H>8)Ke:|Xn>evo9Wq'ƛe(O#nr\U#ҴJU.FR j UV(! IHDWTI)E9|M!;3y*,u## 5 >P3NVFvPQ΀cXGeum:|Xccԣ'ڑio>`0&ʩ: iɻX*L2LAF!>I8x Ab`$LJLJi'Leq<̗u8^_y`+@'>7؃=\$v~Xbh$ZOMȉfzz2xW]h!p*RL2y}^)~x *5@%EQIeRm ӽLXPnV@81%Y׮x 0J[~(? {(}4me51ŅU Ԧƍhum|,`[ BqԻE !mr@l(h"phFnZ*y޽*GR x[r]ϵm4-dXJ$$L 4Pdv%Ma9q*,LKlYVFk,.$N*<P31z&ԄGTwJ L`tSI>lW?JEÿ_ 0&Z4IENDB`rcmail-thunderbird-labels-1.0.0/skins/default/000077500000000000000000000000001233733147500213125ustar00rootroot00000000000000rcmail-thunderbird-labels-1.0.0/skins/default/tb_label.css000066400000000000000000000057641233733147500236040ustar00rootroot00000000000000/** * 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; } */ rcmail-thunderbird-labels-1.0.0/skins/default/thunderbird_32.png000066400000000000000000000062401233733147500246400ustar00rootroot00000000000000PNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<$iTXtXML:com.adobe.xmp D IDATxW[lW;wco.$!vIMT(REH"xT@AEJ)UZB(I8vq^}v U ̜߳?AOb)_N ̊c,9BW󰝧wmul]DY,ge&K(`Ps:x_ez}ے<՞'G&<<8/qz <t$ZFX3,=0:]Vlp?Zez,zWYos_h6o5:E :ê.+5\CpDNJED4yS!! |K4%4giaecZ`vys|<'ۆ3_>^osSq:R}hnF`80L -q$VeL.G X$̀<1ј:xeWx7.3C9kna.Z8utT ȦLdU4q6mѥLTu 5h4% FA%6 h,\yэvau$Df<<m]d, ͕*"J t q#P685݆D DKU<$`@Tc8˘0>ЍJFܼWdOô\,UPLNmm)C# "Q8:Ē*j.QBʀQ$ r W#׵sg*RChR[aᝪY'M< ӴhT+Rfef! Pz6!# VI䈾;ҕsP|"dY{twbbfYAz|ڀ\D3yrR5"d!H>8)Ke:|Xn>evo9Wq'ƛe(O#nr\U#ҴJU.FR j UV(! IHDWTI)E9|M!;3y*,u## 5 >P3NVFvPQ΀cXGeum:|Xccԣ'ڑio>`0&ʩ: iɻX*L2LAF!>I8x Ab`$LJLJi'Leq<̗u8^_y`+@'>7؃=\$v~Xbh$ZOMȉfzz2xW]h!p*RL2y}^)~x *5@%EQIeRm ӽLXPnV@81%Y׮x 0J[~(? {(}4me51ŅU Ԧƍhum|,`[ BqԻE !mr@l(h"phFnZ*y޽*GR x[r]ϵm4-dXJ$$L 4Pdv%Ma9q*,LKlYVFk,.$N*<P31z&ԄGTwJ L`tSI>lW?JEÿ_ 0&Z4IENDB`rcmail-thunderbird-labels-1.0.0/skins/larry/000077500000000000000000000000001233733147500210175ustar00rootroot00000000000000rcmail-thunderbird-labels-1.0.0/skins/larry/tb_label.css000066400000000000000000000100271233733147500232750ustar00rootroot00000000000000/** * 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, span.label1 { color: #FF0000; } #messagelist tr.label2 td, #messagelist tr.label2 td a, .toolbarmenu li.label2, .toolbarmenu li.label2 a.active, span.label2 { color: #FF9900; } #messagelist tr.label3 td, #messagelist tr.label3 td a, .toolbarmenu li.label3, .toolbarmenu li.label3 a.active, span.label3 { color: #009900; } #messagelist tr.label4 td, #messagelist tr.label4 td a, span.label4 { 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, span.label5 { 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; } span.tb_label_dots { float: right; height: 0px; display: block; position:relative; } /* hack for firefox : doesnt display the bullets at the correct height */ @-moz-document url-prefix() { span.tb_label_dots { top: -19px; } } span.tb_label_dots span { font-size: 32px; vertical-align: middle; line-height: 0px; } div#labelbox { white-space: nowrap; position: absolute; right: 67px; top: 40px; } div#labelbox span { margin: 0 3px; padding: 3px; border: 1px solid black; border-radius: 3px; color: #black; font-weight: bold; } div#labelbox span.tb_label_span1 { background-color: #FF2200; } div#labelbox span.tb_label_span2 { background-color: #FF9900; } div#labelbox span.tb_label_span3 { background-color: #00CC00; } div#labelbox span.tb_label_span4 { background-color: #0CF; } div#labelbox span.tb_label_span5 { background-color: #FF33FF; } /* icon for settings-section */ #sections-table tbody #rcmrowthunderbird_labels td.section { background-image: url(thunderbird_24.png); background-position: 3px 3px; } /* 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; } */ rcmail-thunderbird-labels-1.0.0/skins/larry/thunderbird_24.png000066400000000000000000000033521233733147500243470ustar00rootroot00000000000000PNG  IHDRw=bKGD pHYs B4tIME %)SwIDATHDžmLƟsPaQwkbՊfq h#ִpFoF|!1&&1$b-pj6)!!o3r0M23y~g?(^XX먬Dww7!INNF4!ϟ?Eq,Y!y{{; PYYw\8e2rjj l۶mp:$==WO?N*yAA\ 8wZ[[}HsB ιJ)%ssOMMUUU{#:::B~B!={n;33DuV룅 ",xdY Ŏ'q`0/S囥KBuB/ ͕,ˉ#GDf5MMMQQۊ+rJhnb1̥bj*Hsѣ9|hll0::Xer!++ i1 I( t]PUB`,C۷oGss39u&''[#rQ9"55Buh֭[ѣGÇ΢у Q\\ݻP(Fn7x<0MnCa 6tBeh]r:󑖖իWSߟ7<<,dggDQsQe"EQlٲͳ@wڅ;w}vX̌-]k(i4 @)E4(TU8tjkk󆇇(b+((a Hnh4d,(ER466b||ͱXE555&+WdMLLJ$bNNۼy3vfbK)c4 F"K^^^ CCCX쟪wޙ`Y(TU 0 hjj###B?&[n/++Cmm-XKK N<)ZQo޼Aff&dY(E,CB I~?"X/x`0a~@Pz9`ǎ8ppv[I&&&ߑ8lD^IENDB`rcmail-thunderbird-labels-1.0.0/skins/larry/thunderbird_32.png000066400000000000000000000051461233733147500243510ustar00rootroot00000000000000PNG  IHDR szzbKGD pHYs B4 IDATXWmLTW~ιw>P!h&nllKNZkZRXiB`?DR$[vh ~+,֡@3MjE*1`[&m w>9g܅ڏ&'ɜ{!?+V\rp /_.+駟X,F(^RRbk.xb)xׯ_ d&?~ d Il3!a ##H49zGes!t]~? BX$cs)!RB/$IH$BgǎJ/^$e3~CHmm-jeiBE0ga$_Md:{Bŋ\Й*..3x" VtwwjeY4MC=<\.t19c4Ml۶ !}}}32yWWΝ;k׮bٹNQcs4#<˅%KrAuX˲`=RI$***PRR  W^%8}􆉉d23裏>\:u:sJ`0 BjAQQ.]EQ@)UD" zweY"ahoo+Wmmmu?,;N۹(tCFF ØE}ݗE}|>ߝVXsTU*++ykkNUU5J)]t),X`9ᰥ*p:|B2a0 x1Ml"H{RjS0|H)FlJKKJ<;r[nj&dYŘ7o ;;sIFnvoJ)&&& P%hT iRl?L&LWYYrsssnX `M ˲ @("h4`0ظqFGkkikسgOয়~:cȐ|IR MNnHOOc\.R2c#  @A{n444o7yft@uYYYmKNvq0`^~!.ϓ͛7_.((cYV!ܼ~4o<snW{ v]!28uO䤈b$HѱmiǏ7f:_$ޒv4Ma< oB Ƙ9Ȳ 0C[[n߾m*B?;;;jkkiGGGwAQQfv{_677oec꺎n|! ؜tĄPUoׯ> p׮]hjjBMM =q>iFBIq,ZeAupΡi;h4*4M#,҂/ї/_Faa 9rɗNN˲a`0k׮A$[j4M9rn2''' cii0LVUUgy`PĖ-[h[[eY~s.%Iq$Ic R۷HDqGzzzK(G N:_q֭hnns=G>#vwM97dYvVWWc…hnnĄudff  /9sƆR$<Ӧ7;|2),,uزe \.w躾K!۷d2ٹBbUUUvBgz뭳30 儐O(y6l oRJ90 Dx<w̝;sի(ldduuuꫯRgO<ˇ?YW^%0888+j@yy95kZj(-- 0ܹS0ƞYW\w555ؼy]3O?tի7M;`Μ9HQs^>66& @efid\t IJe˖۷gt"??qRzvdddv)Kejp|sϞ=|RUUERB믿&)40xOG~PnIENDB`rcmail-thunderbird-labels-1.0.0/tb_label.js000066400000000000000000000301541233733147500206440ustar00rootroot00000000000000/** * Version: * $Revision$ * 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 * (called when a new message in inserted in list of messages) * maybe slow ? called for each message in mailbox at init */ function rcm_tb_label_insert(uid, row) { if (typeof rcmail.env == 'undefined' || typeof rcmail.env.messages == 'undefined') return; var message = rcmail.env.messages[uid]; var rowobj = $(row.obj); // add span container for little colored bullets rowobj.find("td.subject").append(""); if (message.flags && message.flags.tb_labels) { if (message.flags.tb_labels.length) { var spanobj = rowobj.find("td.subject span.tb_label_dots"); message.flags.tb_labels.sort(function(a,b) {return a-b;}); if (rcmail.env.tb_label_style=='bullets') { // bullets UI style for (idx in message.flags.tb_labels) { spanobj.append(""); } } else { // thunderbird UI style 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) { if (rcmail.env.tb_label_style=='bullets') { $('#labelbox').append("" + rcmail.env.tb_label_custom_labels[toggle_label_no] + ""); } else { headers_table.addClass('label'+toggle_label_no); } // add to flag list tb_labels_for_message.push(toggle_label_no); } else { if (rcmail.env.tb_label_style=='bullets') { $("span.tb_label_span"+toggle_label_no).remove(); } else { 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); var spanobj = rowobj.find("td.subject span.tb_label_dots"); if (rcmail.env.tb_label_style=='bullets') { spanobj.append(""); } else { 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); if (rcmail.env.tb_label_style=='bullets') { rowobj.find("td.subject span.tb_label_dots span.label"+toggle_label_no).remove(); } else { 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++) { // find the "HTML a tags" of tb-label submenus 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'); // call PHP set_flags to set the flags in IMAP server 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 keyboard and keypad if pref tb_label_enable_shortcuts=true if (rcmail.env.tb_label_enable_shortcuts) { $(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) { var labelbox_parent = $('div.message-headers'); // larry skin if (!labelbox_parent.length) { labelbox_parent = $("table.headers-table tbody tr:first-child"); // classic skin } labelbox_parent.append("
"); tb_labels_for_message.sort(function(a,b) {return a-b;}); 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 = $('').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; }; }); rcmail-thunderbird-labels-1.0.0/thunderbird_labels.php000066400000000000000000000276551233733147500231230ustar00rootroot00000000000000rc = rcmail::get_instance(); $this->load_config(); $this->add_texts('localization/', false); $this->setCustomLabels(); if ($this->rc->task == 'mail') { # -- disable plugin when printing message if ($this->rc->action == 'print') return; if (!$this->rc->config->get('tb_label_enable')) // disable plugin according to prefs return; // pass 'tb_label_enable_shortcuts' and 'tb_label_style' prefs to JS $this->rc->output->set_env('tb_label_enable_shortcuts', $this->rc->config->get('tb_label_enable_shortcuts')); $this->rc->output->set_env('tb_label_style', $this->rc->config->get('tb_label_style')); $this->include_script('tb_label.js'); $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); # -- 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' => 'tb_label_button_title', 'domain' => $this->ID, 'type' => 'link', 'content' => ($this->rc->config->get('skin') == 'larry') ? $this->gettext('tb_label_button_label') : ' ', 'class' => ($this->rc->config->get('skin') == 'larry') ? 'button' : 'tb_noclass', ), 'toolbar' ); // JS function "set_flags" => PHP function "set_flags" $this->register_action('plugin.thunderbird_labels.set_flags', array($this, 'set_flags')); if (method_exists($this, 'require_plugin') && in_array('contextmenu', $this->rc->config->get('plugins')) && $this->require_plugin('contextmenu') && $this->rc->config->get('tb_label_enable_contextmenu')) { if ($this->rc->action == '') $this->add_hook('render_mailboxlist', array($this, 'show_tb_label_contextmenu')); } } elseif ($this->rc->task == 'settings') { $this->include_stylesheet($this->local_skin_path() . '/tb_label.css'); $this->add_hook('preferences_list', array($this, 'prefs_list')); $this->add_hook('preferences_sections_list', array($this, 'prefs_section')); $this->add_hook('preferences_save', array($this, 'prefs_save')); } } private function setCustomLabels() { $c = $this->rc->config->get('tb_label_custom_labels'); if (empty($c)) { // if no user specific labels, use localized strings by default $this->rc->config->set('tb_label_custom_labels', array( 0 => $this->getText('label0'), 1 => $this->getText('label1'), 2 => $this->getText('label2'), 3 => $this->getText('label3'), 4 => $this->getText('label4'), 5 => $this->getText('label5') )); } // pass label strings to JS $this->rc->output->set_env('tb_label_custom_labels', $this->rc->config->get('tb_label_custom_labels')); } // create a section for the tb-labels Settings public function prefs_section($args) { $args['list']['thunderbird_labels'] = array( 'id' => 'thunderbird_labels', 'section' => Q($this->gettext('tb_label_options')) ); return $args; } // display thunderbird-labels prefs in Roundcube Settings public function prefs_list($args) { if ($args['section'] != 'thunderbird_labels') return $args; $this->load_config(); $dont_override = (array) $this->rc->config->get('dont_override', array()); $args['blocks']['tb_label'] = array(); $args['blocks']['tb_label']['name'] = $this->gettext('tb_label_options'); $key = 'tb_label_enable'; if (!in_array($key, $dont_override)) { $input = new html_checkbox(array( 'name' => $key, 'id' => $key, 'value' => 1 )); $content = $input->show($this->rc->config->get($key)); $args['blocks']['tb_label']['options'][$key] = array( 'title' => $this->gettext('tb_label_enable_option'), 'content' => $content ); } $key = 'tb_label_enable_shortcuts'; if (!in_array($key, $dont_override)) { $input = new html_checkbox(array( 'name' => $key, 'id' => $key, 'value' => 1 )); $content = $input->show($this->rc->config->get($key)); $args['blocks']['tb_label']['options'][$key] = array( 'title' => $this->gettext('tb_label_enable_shortcuts_option'), 'content' => $content ); } $key = 'tb_label_style'; if (!in_array($key, $dont_override)) { $select = new html_select(array( 'name' => $key, 'id' => $key )); $select->add(array('thunderbird', 'bullets'), array('thunderbird', 'bullets')); $content = $select->show($this->rc->config->get($key)); $args['blocks']['tb_label']['options'][$key] = array( 'title' => $this->gettext('tb_label_style_option'), 'content' => $content ); } $key = 'tb_label_custom_labels'; if (!in_array($key, $dont_override) && $this->rc->config->get('tb_label_modify_labels')) { $old = $this->rc->config->get($key); for($i=1; $i<=5; $i++) { $input = new html_inputfield(array( 'name' => $key.$i, 'id' => $key.$i, 'type' => 'text', 'autocomplete' => 'off', 'value' => $old[$i])); $args['blocks']['tb_label']['options'][$key.$i] = array( 'title' => $this->gettext('tb_label_label')." ".$i, 'content' => $input->show() ); } } return $args; } // save prefs after modified in UI public function prefs_save($args) { if ($args['section'] != 'thunderbird_labels') return $args; $this->load_config(); $dont_override = (array) $this->rc->config->get('dont_override', array()); if (!in_array('tb_label_enable', $dont_override)) $args['prefs']['tb_label_enable'] = get_input_value('tb_label_enable', RCUBE_INPUT_POST) ? true : false; if (!in_array('tb_label_enable_shortcuts', $dont_override)) $args['prefs']['tb_label_enable_shortcuts'] = get_input_value('tb_label_enable_shortcuts', RCUBE_INPUT_POST) ? true : false; if (!in_array('tb_label_style', $dont_override)) $args['prefs']['tb_label_style'] = get_input_value('tb_label_style', RCUBE_INPUT_POST); if (!in_array('tb_label_custom_labels', $dont_override) && $this->rc->config->get('tb_label_modify_labels')) { $args['prefs']['tb_label_custom_labels'] = array( 0 => $this->gettext('label0'), 1 => get_input_value('tb_label_custom_labels1', RCUBE_INPUT_POST), 2 => get_input_value('tb_label_custom_labels2', RCUBE_INPUT_POST), 3 => get_input_value('tb_label_custom_labels3', RCUBE_INPUT_POST), 4 => get_input_value('tb_label_custom_labels4', RCUBE_INPUT_POST), 5 => get_input_value('tb_label_custom_labels5', RCUBE_INPUT_POST) ); } return $args; } public function show_tb_label_contextmenu($args) { #$this->api->output->add_label('copymessage.copyingmessage'); $li = html::tag('li', array('class' => 'submenu'), ''.Q($this->gettext('tb_label_contextmenu_title')).'' . $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) { $out = ''; $custom_labels = $this->rc->config->get('tb_label_custom_labels'); for ($i = 0; $i < 6; $i++) { $separator = ($i == 0)? ' separator_below' :''; $out .= '
  • '. $i.' '.$custom_labels[$i]. '
  • '; } $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 (!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'] .= ''; return $p; } public function read_flags($args) { #write_log($this->name, print_r($args, true)); // add color information for all messages // dont loop over all messages if we dont have any highlights or no msgs if (!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); } // set flags in IMAP server function set_flags() { #write_log($this->name, print_r($_GET, true)); $imap = $this->rc->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() { $custom_labels = $this->rc->config->get('tb_label_custom_labels'); $out = '
    '; $this->rc->output->add_gui_object('tb_label_popup_obj', 'tb_label_popup'); $this->rc->output->add_footer($out); } }