Mercurial > hg > rc1
comparison plugins/contextmenu/skins/larry/functions.js @ 0:1e000243b222
vanilla 1.3.3 distro, I hope
author | Charlie Root |
---|---|
date | Thu, 04 Jan 2018 15:50:29 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1e000243b222 |
---|---|
1 /** | |
2 * ContextMenu plugin script | |
3 * | |
4 * @licstart The following is the entire license notice for the | |
5 * JavaScript code in this file. | |
6 * | |
7 * Copyright (C) 2014 Philip Weir | |
8 * | |
9 * The JavaScript code in this page is free software: you can redistribute it | |
10 * and/or modify it under the terms of the GNU General Public License | |
11 * as published by the Free Software Foundation, either version 3 of | |
12 * the License, or (at your option) any later version. | |
13 * | |
14 * @licend The above is the entire license notice | |
15 * for the JavaScript code in this file. | |
16 */ | |
17 | |
18 rcube_webmail.prototype.context_menu_popup_pattern = /UI\.toggle_popup\(\'([^\']+)\'/; | |
19 rcube_webmail.prototype.context_menu_button_active_class = new Array('active'); | |
20 rcube_webmail.prototype.context_menu_button_disabled_class = new Array('disabled'); | |
21 | |
22 function add_menu_text(menu, p) { | |
23 if (menu == 'composeto') { | |
24 if ($(p.item).children('a').hasClass('addto')) { | |
25 $(p.item).children('a').children('span').text($('#compose-contacts div.boxfooter a.addto').attr('title')); | |
26 } | |
27 else if ($(p.item).children('a').hasClass('addcc')) { | |
28 $(p.item).children('a').children('span').text($('#compose-contacts div.boxfooter a.addcc').attr('title')); | |
29 } | |
30 else if ($(p.item).children('a').hasClass('addbcc')) { | |
31 $(p.item).children('a').children('span').text($('#compose-contacts div.boxfooter a.addbcc').attr('title')); | |
32 } | |
33 else if ($(p.item).children('a').hasClass('vcard')) { | |
34 $(p.item).children('a').children('span').text($('#compose-contacts div.boxfooter a.vcard').attr('title')); | |
35 } | |
36 } | |
37 else if (menu == 'contactlist') { | |
38 if ($(p.item).children('a').hasClass('delete')) { | |
39 $(p.item).children('a').children('span').text($('#addresslist div.boxfooter a.delete').attr('title')); | |
40 } | |
41 else if ($(p.item).children('a').hasClass('removegroup')) { | |
42 $(p.item).children('a').children('span').text($('#addresslist div.boxfooter a.removegroup').attr('title')); | |
43 } | |
44 } | |
45 } | |
46 | |
47 function reorder_contact_menu(p) { | |
48 // put export link last | |
49 var ul = p.ref.container.find('ul:first'); | |
50 $(p.ref.container).find('a.export').parent('li').appendTo(ul); | |
51 | |
52 // put assign group link before remove | |
53 $(p.ref.container).find('a.assigngroup').parent('li').insertBefore($(p.ref.container).find('a.removegroup').parent('li')); | |
54 } | |
55 | |
56 $(document).ready(function() { | |
57 if (window.rcmail) { | |
58 if (rcmail.env.task == 'mail' && rcmail.env.action == '') { | |
59 rcmail.addEventListener('insertrow', function(props) { rcm_listmenu_init(props.row.id, {'menu_name': 'messagelist', 'menu_source': '#messagetoolbar'}); } ); | |
60 rcmail.add_onload("rcm_foldermenu_init('#mailboxlist li', {'menu_source': ['#rcmFolderMenu', '#mailboxoptionsmenu']})"); | |
61 } | |
62 else if (rcmail.env.task == 'mail' && rcmail.env.action == 'compose') { | |
63 rcmail.addEventListener('insertrow', function(props) { rcm_listmenu_init(props.row.id, {'menu_name': 'composeto', 'menu_source': '#compose-contacts div.boxfooter', 'list_object': rcmail.contact_list}, {'insertitem': function(p) { add_menu_text('composeto', p); }}); } ); | |
64 } | |
65 else if (rcmail.env.task == 'addressbook' && rcmail.env.action == '') { | |
66 rcmail.addEventListener('insertrow', function(props) { rcm_listmenu_init(props.row.id, {'menu_name': 'contactlist', 'menu_source': ['#addressbooktoolbar','#addresslist div.boxfooter a.delete','#addresslist div.boxfooter a.removegroup', '#rcmAddressBookMenu'], 'list_object': rcmail.contact_list}, { | |
67 'insertitem': function(p) { add_menu_text('contactlist', p); }, | |
68 'init': function(p) { reorder_contact_menu(p); }, | |
69 'afteractivate': function(p) { | |
70 p.ref.list_selection(false, rcmail.env.contextmenu_selection); | |
71 | |
72 // count the number of groups in the current addressbook | |
73 if (!rcmail.env.group || rcmail.env.readonly) | |
74 p.ref.container.find('a.removegroup').removeClass('active').addClass('disabled'); | |
75 | |
76 var groupcount = 0; | |
77 if (!rcmail.env.readonly && rcmail.env.address_sources[rcmail.env.source] && rcmail.env.address_sources[rcmail.env.source].groups) | |
78 $.each(rcmail.env.contactgroups, function(){ if (this.source === rcmail.env.source) groupcount++ }); | |
79 | |
80 if (groupcount > 0) | |
81 p.ref.container.find('a.assigngroup').removeClass('disabled').addClass('active'); | |
82 else | |
83 p.ref.container.find('a.assigngroup').removeClass('active').addClass('disabled'); | |
84 }, | |
85 'aftercommand': function(p) { | |
86 if ($(p.el).hasClass('active') && p.command == 'group-remove-selected') | |
87 rcmail.command('listgroup', {'source': rcmail.env.source, 'id': rcmail.env.group}, p.el); | |
88 } | |
89 }); } ); | |
90 rcmail.add_onload("rcm_abookmenu_init('#directorylist li, #savedsearchlist li', {'menu_source': ['#directorylist-footer', '#groupoptionsmenu']}, {'insertitem': function(p) { add_menu_text('abooklist', p); }})"); | |
91 rcmail.addEventListener('group_insert', function(props) { rcm_abookmenu_init(props.li, {'menu_source': ['#directorylist-footer', '#groupoptionsmenu']}); } ); | |
92 rcmail.addEventListener('abook_search_insert', function(props) { rcm_abookmenu_init(rcmail.savedsearchlist.get_item('S' + props.id), {'menu_source': ['#directorylist-footer', '#groupoptionsmenu']}); } ); | |
93 } | |
94 } | |
95 }); |