diff -ruN a/contextmenu/contextmenu.js b/contextmenu/contextmenu.js --- a/contextmenu/contextmenu.js 2011-09-06 14:45:03.000000000 +0800 +++ b/contextmenu/contextmenu.js 2012-01-09 02:09:48.000000000 +0800 @@ -2,8 +2,8 @@ * ContextMenu plugin script */ -rcmail.contextmenu_command_handlers = new Object(); -rcmail.contextmenu_disable_multi = new Array('#reply','#reply-all','#reply-list','#forward','#forward-attachment','#print','#edit','#viewsource','#download','#open','#edit'); +rcube_webmail.prototype.contextmenu_command_handlers = new Object(); +rcube_webmail.prototype.contextmenu_disable_multi = new Array('#reply','#reply-all','#reply-list','#forward','#forward-attachment','#print','#edit','#viewsource','#download','#open','#edit'); function rcm_contextmenu_update() { if (!rcmail.env.flag_for_deletion && rcmail.env.trash_mailbox && rcmail.env.mailbox != rcmail.env.trash_mailbox) @@ -319,7 +319,9 @@ else $('#rcmAddressMenu').enableContextMenuItems(rcmail.contextmenu_disable_multi.join(',')); - if (rcmail.env.address_sources[rcmail.env.source].readonly) + var ab_src = rcmail.env.source ? rcmail.env.source : matches[1].split('-', 2)[1]; + + if (rcmail.env.address_sources[ab_src].readonly) $('#rcmAddressMenu').disableContextMenuItems('#edit,#delete'); else $('#rcmAddressMenu').enableContextMenuItems('#edit,#delete'); @@ -364,9 +366,11 @@ case 'compose': case 'delete': case 'moveto': + var ab_src = rcmail.env.source ? rcmail.env.source : matches[1].split('-', 2)[1]; + if (command == 'moveto') { // check for valid taget - if (rcmail.env.rcm_destbook == rcmail.env.source || rcmail.env.contactfolders['G' + rcmail.env.rcm_destsource + rcmail.env.rcm_destgroup].id == rcmail.env.group) + if (rcmail.env.rcm_destbook == ab_src || (rcmail.env.rcm_destgroup && rcmail.env.contactfolders['G' + rcmail.env.rcm_destsource + rcmail.env.rcm_destgroup].id == rcmail.env.group)) return; } @@ -376,9 +380,6 @@ if (!rcmail.contact_list.in_selection(rcmail.env.cid)) { prev_sel = rcmail.contact_list.get_selection(); rcmail.contact_list.select(rcmail.env.cid); - - if (!(command == 'moveto' && rcmail.env.rcm_destbook.substring(0, 1) == 'G') && command != 'compose') - rcmail.contact_list.remove_row(rcmail.env.cid, false); } else if (rcmail.contact_list.get_single_selection() == rcmail.env.cid) { rcmail.env.cid = null; @@ -389,8 +390,14 @@ } } + if (command == 'delete') + rcmail.env.cid = null; + rcmail.drag_active = true; - rcmail.command(command, rcmail.env.contactfolders['G' + rcmail.env.rcm_destsource + rcmail.env.rcm_destgroup], $(el)); + if (rcmail.env.rcm_destgroup) + rcmail.command(command, rcmail.env.contactfolders['G' + rcmail.env.rcm_destsource + rcmail.env.rcm_destgroup], $(el)); + else + rcmail.command(command, rcmail.env.contactfolders[rcmail.env.rcm_destsource], $(el)); rcmail.drag_active = false; if (prev_sel) { @@ -497,7 +504,17 @@ .html('  ' + props.name); var li = $('
  • ').addClass('contactgroup').append(link); - $(li).insertAfter($('#rcm_contextaddr_' + props.source)); + + var sibling = $('#rcm_contextaddr_' + props.source); + $('a[id^="rcm_contextgrps_G"]').each(function(i, elem) { + if (props.name.toUpperCase().trim() >= $(this).text().toUpperCase().trim()) + sibling = $(elem).parent(); + else + return false; + }); + + $(li).insertAfter($(sibling)); + rcm_groupmenu_init(props.li); break; case 'update': @@ -518,6 +535,19 @@ else { $('#rcm_contextgrps_G' + gid).html('  ' + props.name); } + + row = $('#rcm_contextgrps_G' + gid).parent().clone(true); + $('#rcm_contextgrps_G' + gid).parent().remove(); + + var sibling = $('#rcm_contextaddr_' + props.source); + $('a[id^="rcm_contextgrps_G"]').each(function(i, elem) { + if (props.name.toUpperCase().trim() >= $(this).text().toUpperCase().trim()) + sibling = $(elem).parent(); + else + return false; + }); + + $(row).insertAfter($(sibling)); } break; @@ -530,25 +560,27 @@ } $(document).ready(function() { - // init message list menu - if ($('#rcmContextMenu').length > 0) { - rcmail.addEventListener('listupdate', function(props) { rcm_contextmenu_update(); } ); - rcmail.addEventListener('insertrow', function(props) { rcm_contextmenu_init(props.row.id); } ); - } - - // init folder list menu - if ($('#rcmFolderMenu').length > 0) - rcmail.add_onload('rcm_foldermenu_init();'); - - // init contact list menu - if ($('#rcmAddressMenu').length > 0) - rcmail.addEventListener('insertrow', function(props) { rcm_addressmenu_init(props.row.id); } ); - - // init group list menu - if ($('#rcmGroupMenu').length > 0) { - rcmail.add_onload('rcm_groupmenu_init("#directorylistbox li");'); - rcmail.addEventListener('group_insert', function(props) { rcm_groupmenu_update('insert', props); } ); - rcmail.addEventListener('group_update', function(props) { rcm_groupmenu_update('update', props); } ); - rcmail.addEventListener('group_delete', function(props) { rcm_groupmenu_update('remove', props); } ); + if (window.rcmail) { + // init message list menu + if ($('#rcmContextMenu').length > 0) { + rcmail.addEventListener('listupdate', function(props) { rcm_contextmenu_update(); } ); + rcmail.addEventListener('insertrow', function(props) { rcm_contextmenu_init(props.row.id); } ); + } + + // init folder list menu + if ($('#rcmFolderMenu').length > 0) + rcmail.add_onload('rcm_foldermenu_init();'); + + // init contact list menu + if ($('#rcmAddressMenu').length > 0) + rcmail.addEventListener('insertrow', function(props) { rcm_addressmenu_init(props.row.id); } ); + + // init group list menu + if ($('#rcmGroupMenu').length > 0) { + rcmail.add_onload('rcm_groupmenu_init("#directorylistbox li");'); + rcmail.addEventListener('group_insert', function(props) { rcm_groupmenu_update('insert', props); } ); + rcmail.addEventListener('group_update', function(props) { rcm_groupmenu_update('update', props); } ); + rcmail.addEventListener('group_delete', function(props) { rcm_groupmenu_update('remove', props); } ); + } } }); \ No newline at end of file diff -ruN a/contextmenu/contextmenu.php b/contextmenu/contextmenu.php --- a/contextmenu/contextmenu.php 2011-09-29 07:08:32.000000000 +0800 +++ b/contextmenu/contextmenu.php 2012-01-09 02:09:48.000000000 +0800 @@ -5,7 +5,7 @@ * * Plugin to add a context menu to the message list * - * @version 1.8 + * @version @package_version@ * @author Philip Weir */ class contextmenu extends rcube_plugin @@ -102,7 +102,7 @@ $lis .= html::tag('li', array('class' => 'edit'), html::a(array('href' => "#edit", 'class' => 'active'), Q($this->gettext('editasnew')))); $lis .= html::tag('li', array('class' => 'source separator_below'), html::a(array('href' => "#viewsource", 'class' => 'active'), Q($this->gettext('viewsource')))); $lis .= html::tag('li', array('class' => 'open'), html::a(array('href' => "#open", 'id' => 'rcm_open', 'class' => 'active'), Q($this->gettext('openinextwin')))); - $li .= html::tag('li', array('class' => 'submenu moreacts'), Q($this->gettext('messageactions')) . html::tag('ul', array('class' => 'popupmenu toolbarmenu moreacts'), $lis)); + $li .= html::tag('li', array('class' => 'submenu moreacts'), Q($this->gettext('moreactions')) . html::tag('ul', array('class' => 'popupmenu toolbarmenu moreacts'), $lis)); $out .= html::tag('ul', array('id' => 'rcmContextMenu', 'class' => 'popupmenu toolbarmenu'), $li); } diff -ruN a/contextmenu/jquery.contextMenu.js b/contextmenu/jquery.contextMenu.js --- a/contextmenu/jquery.contextMenu.js 2011-04-22 16:05:00.000000000 +0800 +++ b/contextmenu/jquery.contextMenu.js 2012-01-09 02:10:12.000000000 +0800 @@ -123,7 +123,7 @@ // When items are selected $('#' + o.menu).find('A').unbind('click'); - $('#' + o.menu).find('LI:not(.disabled) A').click( function() { + $('#' + o.menu).find('LI A:not(.disabled)').click( function() { $(document).unbind('click').unbind('keypress'); $(".contextMenu").hide(); srcElement.removeClass('contextRow'); @@ -231,7 +231,6 @@ var d = o.split(','); for( var i = 0; i < d.length; i++ ) { $(this).find('A[href="' + d[i] + '"]').addClass('disabled'); - } } }); @@ -250,7 +249,6 @@ var d = o.split(','); for( var i = 0; i < d.length; i++ ) { $(this).find('A[href="' + d[i] + '"]').removeClass('disabled'); - } } }); diff -ruN a/contextmenu/package.xml b/contextmenu/package.xml --- a/contextmenu/package.xml 1970-01-01 08:00:00.000000000 +0800 +++ b/contextmenu/package.xml 2012-01-09 02:09:48.000000000 +0800 @@ -0,0 +1,85 @@ + + + contextmenu + pear.roundcube.net + Adds context menus with common tasks to various parts of the system + Adds context menus to the message list, folder list and address book. Menu includes the abilities mark messages as read/unread, delete, reply and forward. + + Philip Weir + JohnDoh + roundcube@tehinterweb.co.uk + yes + + 2011-11-20 + + + 1.8 + 1.8 + + + stable + stable + + GNU GPLv2 + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5.2.1 + + + 1.7.0 + + + + +