@ -251,7 +251,7 @@ function rcube_webmail()
}
}
else if ( this . env . action == 'compose' ) {
this . env . compose _commands = [ 'send-attachment' , 'remove-attachment' , 'send' , 'cancel' , 'toggle-editor' , 'list-adresses' , ' search', 'reset-search' , 'extwin' ] ;
this . env . compose _commands = [ 'send-attachment' , 'remove-attachment' , 'send' , 'cancel' , 'toggle-editor' , 'list-adresses' , ' pushgroup', ' search', 'reset-search' , 'extwin' ] ;
if ( this . env . drafts _mailbox )
this . env . compose _commands . push ( 'savedraft' )
@ -324,6 +324,8 @@ function rcube_webmail()
this . enable _command ( 'add' , 'import' , this . env . writable _source ) ;
this . enable _command ( 'list' , 'listgroup' , 'pushgroup' , 'listsearch' , 'advanced-search' , true ) ;
this . env . address _group _stack = [ ] ;
if ( this . gui _objects . contactslist ) {
this . contact _list = new rcube _list _widget ( this . gui _objects . contactslist ,
{ multiselect : true , draggable : this . gui _objects . folderlist ? true : false , keyboard : true } ) ;
@ -1081,7 +1083,11 @@ function rcube_webmail()
break ;
case 'pushgroup' :
// TODO: so some magic stuff here
// add group ID to stack
this . env . address _group _stack . push ( props . id ) ;
if ( obj && event )
rcube _event . cancel ( event ) ;
case 'listgroup' :
this . reset _qsearch ( ) ;
this . list _contacts ( props . source , props . id ) ;
@ -3061,7 +3067,13 @@ function rcube_webmail()
this . compose _recipient _select = function ( list )
{
this . enable _command ( 'add-recipient' , list . selection . length > 0 ) ;
var id , n , recipients = 0 ;
for ( n = 0 ; n < list . selection . length ; n ++ ) {
id = list . selection [ n ] ;
if ( this . env . contactdata [ id ] )
recipients ++ ;
}
this . enable _command ( 'add-recipient' , recipients ) ;
} ;
this . compose _add _recipient = function ( field )
@ -4030,7 +4042,7 @@ function rcube_webmail()
if ( this . preview _timer )
clearTimeout ( this . preview _timer ) ;
var n , id , sid , ref = this , writable = false ,
var n , id , sid , contact, ref = this , writable = false ,
source = this . env . source ? this . env . address _sources [ this . env . source ] : null ;
if ( id = list . get _single _selection ( ) )
@ -4044,29 +4056,35 @@ function rcube_webmail()
// we'll also need to know sources used in selection for copy
// and group-addmember operations (drag&drop)
this . env . selection _sources = [ ] ;
if ( ! source ) {
if ( source ) {
this . env . selection _sources . push ( this . env . source ) ;
}
for ( n in list . selection ) {
contact = list . data [ list . selection [ n ] ] ;
if ( ! source ) {
sid = String ( list . selection [ n ] ) . replace ( /^[^-]+-/ , '' ) ;
if ( sid && this . env . address _sources [ sid ] ) {
writable = writable || ! this . env . address _sources [ sid ] . readonly ;
writable = writable || ( ! this . env . address _sources [ sid ] . readonly && ! contact . readonly ) ;
this . env . selection _sources . push ( sid ) ;
}
}
this . env . selection _sources = $ . unique ( this . env . selection _sources ) ;
}
else {
this . env . selection _sources . push ( this . env . source ) ;
writable = ! source . readonly ;
writable = writable || ( ! source . readonly && ! contact . readonly ) ;
}
}
this . env . selection _sources = $ . unique ( this . env . selection _sources ) ;
}
// if a group is currently selected, and there is at least one contact selected
// thend we can enable the group-remove-selected command
this . enable _command ( 'group-remove-selected' , this . env . group && list . selection . length > 0 ) ;
this . enable _command ( 'group-remove-selected' , this . env . group && list . selection . length > 0 && writable ) ;
this . enable _command ( 'compose' , this . env . group || list . selection . length > 0 ) ;
this . enable _command ( 'export-selected' , list . selection . length > 0 ) ;
this . enable _command ( 'edit' , id && writable ) ;
this . enable _command ( 'delete' , list . selection . length && writable ) ;
this . enable _command ( 'delete' , list . selection . length > 0 && writable ) ;
return false ;
} ;
@ -4094,11 +4112,29 @@ function rcube_webmail()
else if ( ! this . env . search _request )
folder = group ? 'G' + src + group : src ;
this . select _folder ( folder , '' , true ) ;
this . env . source = src ;
this . env . group = group ;
// truncate groups listing stack
var index = $ . inArray ( this . env . group , this . env . address _group _stack ) ;
if ( index < 0 )
this . env . address _group _stack = [ ] ;
else
this . env . address _group _stack = this . env . address _group _stack . slice ( 0 , index ) ;
// make sure the current group is on top of the stack
if ( this . env . group ) {
this . env . address _group _stack . push ( this . env . group ) ;
// mark the first group on the stack as selected in the directory list
folder = 'G' + src + this . env . address _group _stack [ 0 ] ;
}
else if ( this . gui _objects . addresslist _title ) {
$ ( this . gui _objects . addresslist _title ) . html ( this . get _label ( 'contacts' ) ) ;
}
this . select _folder ( folder , '' , true ) ;
// load contacts remotely
if ( this . gui _objects . contactslist ) {
this . list _contacts _remote ( src , group , page ) ;
@ -4160,16 +4196,20 @@ function rcube_webmail()
this . enable _command ( 'compose' , this . env . group ? true : false ) ;
} ;
this . set _group _prop = function ( prop )
{
if ( this . gui _objects . addresslist _title )
$ ( this . gui _objects . addresslist _title ) . html ( prop . name ) ;
this . triggerEvent ( 'groupupdate' , prop ) ;
} ;
// load contact record
this . load _contact = function ( cid , action , framed )
{
var win , url = { } , target = window ,
rec = this . contact _list . data [ cid ] ;
if ( rec && rec . type == 'group' ) {
alert ( 'group ' + cid )
}
if ( win = this . get _frame _window ( this . env . contentframe ) ) {
url . _framed = 1 ;
target = win ;
@ -4178,7 +4218,9 @@ function rcube_webmail()
// load dummy content, unselect selected row(s)
if ( ! cid )
this . contact _list . clear _selection ( ) ;
this . enable _command ( 'delete' , 'compose' , 'export-selected' , cid ) ;
this . enable _command ( 'compose' , rec . email ) ;
this . enable _command ( 'export-selected' , rec . _type != 'group' ) ;
}
else if ( framed )
return false ;