@ -558,14 +558,7 @@ function rcube_webmail()
else if ( this . gui _objects . responseslist ) {
else if ( this . gui _objects . responseslist ) {
this . responses _list = new rcube _list _widget ( this . gui _objects . responseslist , { multiselect : false , draggable : false , keyboard : true } ) ;
this . responses _list = new rcube _list _widget ( this . gui _objects . responseslist , { multiselect : false , draggable : false , keyboard : true } ) ;
this . responses _list
this . responses _list
. addEventListener ( 'select' , function ( list ) {
. addEventListener ( 'select' , function ( o ) { ref . response _select ( o ) ; } )
var win , id = list . get _single _selection ( ) ;
ref . enable _command ( 'delete' , ! ! id && $ . inArray ( id , ref . env . readonly _responses ) < 0 ) ;
if ( id && ( win = ref . get _frame _window ( ref . env . contentframe ) ) ) {
ref . set _busy ( true ) ;
ref . location _href ( { _action : 'edit-response' , _key : id , _framed : 1 } , win ) ;
}
} )
. init ( )
. init ( )
. focus ( ) ;
. focus ( ) ;
}
}
@ -592,7 +585,7 @@ function rcube_webmail()
// display 'loading' message on form submit, lock submit button
// display 'loading' message on form submit, lock submit button
$ ( 'form' ) . submit ( function ( ) {
$ ( 'form' ) . submit ( function ( ) {
$ ( ' input [type=submit]', this ) . prop ( 'disabled' , true ) ;
$ ( ' [type=submit]', this ) . prop ( 'disabled' , true ) ;
ref . clear _messages ( ) ;
ref . clear _messages ( ) ;
ref . display _message ( '' , 'loading' ) ;
ref . display _message ( '' , 'loading' ) ;
} ) ;
} ) ;
@ -919,24 +912,15 @@ function rcube_webmail()
case 'add' :
case 'add' :
if ( this . task == 'addressbook' )
if ( this . task == 'addressbook' )
this . load _contact ( 0 , 'add' ) ;
this . load _contact ( 0 , 'add' ) ;
else if ( this . task == 'settings' && this . env . action == 'responses' ) {
else if ( this . task == 'settings' && this . env . action == 'responses' )
var frame ;
this . load _response ( 0 , 'add-response' ) ;
if ( ( frame = this . get _frame _window ( this . env . contentframe ) ) ) {
else if ( this . task == 'settings' )
this . set _busy ( true ) ;
this . location _href ( { _action : 'add-response' , _framed : 1 } , frame ) ;
}
}
else if ( this . task == 'settings' ) {
this . identity _list . clear _selection ( ) ;
this . load _identity ( 0 , 'add-identity' ) ;
this . load _identity ( 0 , 'add-identity' ) ;
}
break ;
break ;
case 'edit' :
case 'edit' :
if ( this . task == 'addressbook' && ( cid = this . get _single _cid ( ) ) )
if ( this . task == 'addressbook' && ( cid = this . get _single _cid ( ) ) )
this . load _contact ( cid , 'edit' ) ;
this . load _contact ( cid , 'edit' ) ;
else if ( this . task == 'settings' && props )
this . load _identity ( props , 'edit-identity' ) ;
else if ( this . task == 'mail' && ( uid = this . get _single _uid ( ) ) ) {
else if ( this . task == 'mail' && ( uid = this . get _single _uid ( ) ) ) {
url = { _mbox : this . get _message _mailbox ( uid ) } ;
url = { _mbox : this . get _message _mailbox ( uid ) } ;
url [ this . env . mailbox == this . env . drafts _mailbox && props != 'new' ? '_draft_uid' : '_uid' ] = uid ;
url [ this . env . mailbox == this . env . drafts _mailbox && props != 'new' ? '_draft_uid' : '_uid' ] = uid ;
@ -947,11 +931,8 @@ function rcube_webmail()
case 'save' :
case 'save' :
var input , form = this . gui _objects . editform ;
var input , form = this . gui _objects . editform ;
if ( form ) {
if ( form ) {
// adv. search
if ( this . env . action == 'search' ) {
}
// user prefs
// user prefs
else if ( ( input = $ ( "input[name='_pagesize']" , form ) ) && input . length && isNaN ( parseInt ( input . val ( ) ) ) ) {
if ( ( input = $ ( "input[name='_pagesize']" , form ) ) && input . length && isNaN ( parseInt ( input . val ( ) ) ) ) {
alert ( this . get _label ( 'nopagesizewarning' ) ) ;
alert ( this . get _label ( 'nopagesizewarning' ) ) ;
input . focus ( ) ;
input . focus ( ) ;
break ;
break ;
@ -1148,12 +1129,14 @@ function rcube_webmail()
else if ( this . contact _list )
else if ( this . contact _list )
a _cids = this . contact _list . get _selection ( ) ;
a _cids = this . contact _list . get _selection ( ) ;
if ( a _cids . length )
if ( a _cids . length ) {
this . http _post ( 'mailto' , { _cid : a _cids . join ( ',' ) , _source : this . env . source } , true ) ;
this . http _post ( 'mailto' , { _cid : a _cids . join ( ',' ) , _source : this . env . source } , true ) ;
else if ( this . env . group )
break ;
}
else if ( this . env . group ) {
this . http _post ( 'mailto' , { _gid : this . env . group , _source : this . env . source } , true ) ;
this . http _post ( 'mailto' , { _gid : this . env . group , _source : this . env . source } , true ) ;
break ;
break ;
}
}
}
}
}
else if ( props && typeof props == 'string' ) {
else if ( props && typeof props == 'string' ) {
@ -1362,19 +1345,41 @@ function rcube_webmail()
break ;
break ;
case 'import' :
case 'import' :
if ( this . env . action == 'import' && this . gui _objects . importform ) {
var reload = false ,
var file = document . getElementById ( 'rcmimportfile' ) ;
dialog = $ ( '<iframe>' ) . attr ( 'src' , this . url ( 'import' , { _framed : 1 , _target : this . env . source } ) ) ,
if ( file && ! file . value ) {
import _func = function ( e ) {
alert ( this . get _label ( 'selectimportfile' ) ) ;
var win = dialog [ 0 ] . contentWindow ,
aborted = true ;
form = win . rcmail . gui _objects . importform ;
break ;
}
if ( form ) {
this . gui _objects . importform . submit ( ) ;
var lock , file = win . $ ( '#rcmimportfile' ) [ 0 ] ;
this . set _busy ( true , 'importwait' ) ;
if ( file && ! file . value ) {
this . lock _form ( this . gui _objects . importform , true ) ;
alert ( win . rcmail . get _label ( 'selectimportfile' ) ) ;
}
return ;
else
}
this . goto _url ( 'import' , ( this . env . source ? '_target=' + urlencode ( this . env . source ) + '&' : '' ) ) ;
lock = win . rcmail . set _busy ( true , 'importwait' ) ;
$ ( 'input[name="_unlock"]' , form ) . val ( lock ) ;
form . submit ( ) ;
win . rcmail . lock _form ( form , true ) ;
// disable Import button
$ ( e . target ) . attr ( 'disabled' , true ) ;
reload = true ;
}
} ,
close _func = function ( event , ui ) {
$ ( this ) . remove ( ) ;
if ( reload )
ref . command ( 'list' ) ;
} ;
this . simple _dialog ( dialog , this . gettext ( 'importcontacts' ) , import _func , {
close : close _func ,
button : 'import' ,
width : 500 ,
height : 300
} ) ;
break ;
break ;
case 'export' :
case 'export' :
@ -2569,10 +2574,9 @@ function rcube_webmail()
// load message list to target frame/window
// load message list to target frame/window
if ( mbox ) {
if ( mbox ) {
this . set _busy ( true , 'loading' ) ;
url . _mbox = mbox ;
url . _mbox = mbox ;
if ( page )
url . _page = page ;
url . _page = page ;
this . set _busy ( true , 'loading' ) ;
this . location _href ( url , target ) ;
this . location _href ( url , target ) ;
}
}
} ;
} ;
@ -2593,9 +2597,10 @@ function rcube_webmail()
if ( typeof url != 'object' )
if ( typeof url != 'object' )
url = { } ;
url = { } ;
url . _layout = this . env . layout
url . _mbox = mbox ;
url . _mbox = mbox ;
if ( page )
url . _page = page ;
url . _page = page ;
// Disable double-click on the list when preview pane is on
// Disable double-click on the list when preview pane is on
// to make the delay when opening a message in preview pane minimal (#5199)
// to make the delay when opening a message in preview pane minimal (#5199)
@ -3914,17 +3919,13 @@ function rcube_webmail()
} ) ;
} ) ;
// display dialog with missing keys
// display dialog with missing keys
ref . s how_popup _dialog (
ref . s imple _dialog (
$ ( '<div>' )
$ ( '<div>' )
. append ( $ ( '<p>' ) . html ( ref . get _label ( 'encryptpubkeysfound' ) ) )
. append ( $ ( '<p>' ) . html ( ref . get _label ( 'encryptpubkeysfound' ) ) )
. append ( ul ) ,
. append ( ul ) ,
ref . get _label ( 'importpubkeys' ) ,
ref . get _label ( 'importpubkeys' ) ,
[ {
null ,
text : ref . get _label ( 'close' ) ,
{ cancel _label : 'close' , cancel _button : 'close' }
click : function ( ) {
( ref . is _framed ( ) ? parent . $ : $ ) ( this ) . dialog ( 'close' ) ;
}
} ]
) ;
) ;
// delegate handler for import button clicks
// delegate handler for import button clicks
@ -4049,21 +4050,12 @@ function rcube_webmail()
content = $ ( '<div>' ) . append ( nodes ) ;
content = $ ( '<div>' ) . append ( nodes ) ;
$ ( 'input:not([disabled]):first' , content ) . attr ( 'checked' , true ) ;
$ ( 'input:not([disabled]):first' , content ) . attr ( 'checked' , true ) ;
this . show _popup _dialog ( content , this . get _label ( 'markallread' ) ,
this . simple _dialog ( content , this . get _label ( 'markallread' ) ,
[ {
function ( ) {
'class' : 'mainaction' ,
ref . mark _all _read ( folder , $ ( 'input:checked' , this ) . val ( ) ) ;
text : this . get _label ( 'mark' ) ,
return true ;
click : function ( ) {
ref . mark _all _read ( folder , $ ( 'input:checked' , this ) . val ( ) ) ;
$ ( this ) . dialog ( 'close' ) ;
}
} ,
} ,
{
{ button : 'mark' }
text : this . get _label ( 'cancel' ) ,
click : function ( ) {
$ ( this ) . dialog ( 'close' ) ;
}
} ]
) ;
) ;
return ;
return ;
@ -4267,7 +4259,7 @@ function rcube_webmail()
this . get _label ( 'restoremessage' ) ,
this . get _label ( 'restoremessage' ) ,
[ {
[ {
text : this . get _label ( 'restore' ) ,
text : this . get _label ( 'restore' ) ,
'class' : 'mainaction ',
'class' : 'mainaction restore ',
click : function ( ) {
click : function ( ) {
ref . restore _compose _form ( key , html _mode ) ;
ref . restore _compose _form ( key , html _mode ) ;
ref . remove _compose _data ( key ) ; // remove old copy
ref . remove _compose _data ( key ) ; // remove old copy
@ -4286,6 +4278,7 @@ function rcube_webmail()
} ,
} ,
{
{
text : this . get _label ( 'ignore' ) ,
text : this . get _label ( 'ignore' ) ,
'class' : 'cancel' ,
click : function ( ) {
click : function ( ) {
$ ( this ) . dialog ( 'close' ) ;
$ ( this ) . dialog ( 'close' ) ;
show _next ( i ) ;
show _next ( i ) ;
@ -4315,7 +4308,7 @@ function rcube_webmail()
// the message has been sent but not saved, ask the user what to do
// the message has been sent but not saved, ask the user what to do
if ( ! saveonly && this . env . is _sent ) {
if ( ! saveonly && this . env . is _sent ) {
return this . simple _dialog ( this . get _label ( 'messageissent' ) , '' ,
return this . simple _dialog ( this . get _label ( 'messageissent' ) , '' , // TODO: dialog title
function ( ) {
function ( ) {
ref . submit _messageform ( false , true ) ;
ref . submit _messageform ( false , true ) ;
return true ;
return true ;
@ -4474,7 +4467,8 @@ function rcube_webmail()
click : function ( ) { save _func ( true ) ; }
click : function ( ) { save _func ( true ) ; }
} , {
} , {
text : this . get _label ( 'cancel' ) ,
text : this . get _label ( 'cancel' ) ,
click : function ( ) { dialog . dialog ( 'close' ) ; }
click : function ( ) { dialog . dialog ( 'close' ) ; } ,
'class' : 'cancel'
} ] ,
} ] ,
{ dialogClass : 'warning' }
{ dialogClass : 'warning' }
) ;
) ;
@ -4500,10 +4494,11 @@ function rcube_webmail()
this . get _label ( 'nosubjecttitle' ) ,
this . get _label ( 'nosubjecttitle' ) ,
[ {
[ {
text : this . get _label ( 'sendmessage' ) ,
text : this . get _label ( 'sendmessage' ) ,
click : function ( ) { save _func ( ) ; } ,
'class' : 'mainaction send' ,
'class' : 'mainaction'
click : function ( ) { save _func ( ) ; }
} , {
} , {
text : this . get _label ( 'cancel' ) ,
text : this . get _label ( 'cancel' ) ,
'class' : 'cancel' ,
click : function ( ) {
click : function ( ) {
input _subject . focus ( ) ;
input _subject . focus ( ) ;
dialog . dialog ( 'close' ) ;
dialog . dialog ( 'close' ) ;
@ -4594,7 +4589,7 @@ function rcube_webmail()
$ ( this ) . dialog ( 'close' ) ;
$ ( this ) . dialog ( 'close' ) ;
} ;
} ;
this . show _popup _dialog ( html , this . get _label ( 'newresponse' ) , buttons , { button _classes : [ 'mainaction '] } ) ;
this . show _popup _dialog ( html , this . get _label ( 'newresponse' ) , buttons , { button _classes : [ 'mainaction save', 'cancel '] } ) ;
$ ( '#ffresponsetext' ) . val ( text ) ;
$ ( '#ffresponsetext' ) . val ( text ) ;
$ ( '#ffresponsename' ) . select ( ) ;
$ ( '#ffresponsename' ) . select ( ) ;
@ -5226,9 +5221,6 @@ function rcube_webmail()
if ( ! search && this . gui _objects . qsearchbox )
if ( ! search && this . gui _objects . qsearchbox )
search = this . gui _objects . qsearchbox . value ;
search = this . gui _objects . qsearchbox . value ;
if ( filter )
url . _filter = filter ;
if ( this . gui _objects . search _interval )
if ( this . gui _objects . search _interval )
url . _interval = $ ( this . gui _objects . search _interval ) . val ( ) ;
url . _interval = $ ( this . gui _objects . search _interval ) . val ( ) ;
@ -5245,8 +5237,10 @@ function rcube_webmail()
}
}
}
}
if ( scope )
url . _layout = this . env . layout ;
url . _scope = scope ;
url . _filter = filter ;
url . _scope = scope ;
if ( mbox && scope != 'all' )
if ( mbox && scope != 'all' )
url . _mbox = mbox ;
url . _mbox = mbox ;
@ -5455,16 +5449,7 @@ function rcube_webmail()
if ( id === null || ! this . env . contacts [ id ] || ! this . ksearch _input )
if ( id === null || ! this . env . contacts [ id ] || ! this . ksearch _input )
return ;
return ;
// get cursor pos
var trigger = false , insert = '' , delim = ', ' ;
var inp _value = this . ksearch _input . value ,
cpos = this . get _caret _pos ( this . ksearch _input ) ,
p = inp _value . lastIndexOf ( this . ksearch _value , cpos ) ,
trigger = false ,
insert = '' ,
delim = ', ' ,
// replace search string with full address
pre = inp _value . substring ( 0 , p ) ,
end = inp _value . substring ( p + this . ksearch _value . length , inp _value . length ) ;
this . ksearch _destroy ( ) ;
this . ksearch _destroy ( ) ;
@ -5483,10 +5468,7 @@ function rcube_webmail()
trigger = true ;
trigger = true ;
}
}
this . ksearch _input . value = pre + insert + end ;
this . ksearch _input _replace ( this . ksearch _value , insert ) ;
// set caret to insert pos
this . set _caret _pos ( this . ksearch _input , p + insert . length ) ;
if ( trigger ) {
if ( trigger ) {
this . triggerEvent ( 'autocomplete_insert' , { field : this . ksearch _input , insert : insert , data : this . env . contacts [ id ] , search : this . ksearch _value _last , result _type : 'person' } ) ;
this . triggerEvent ( 'autocomplete_insert' , { field : this . ksearch _input , insert : insert , data : this . env . contacts [ id ] , search : this . ksearch _value _last , result _type : 'person' } ) ;
@ -5498,7 +5480,7 @@ function rcube_webmail()
this . replace _group _recipients = function ( id , recipients )
this . replace _group _recipients = function ( id , recipients )
{
{
if ( this . group2expand [ id ] ) {
if ( this . group2expand [ id ] ) {
this . group2expand[ id ] . input . value = this . group2expand [ id ] . input . value . replace ( this . group2expand [ id ] . name , recipients ) ;
this . ksearch_input _replace ( this . group2expand [ id ] . name , recipients , this . group2expand [ id ] . input ) ;
this . triggerEvent ( 'autocomplete_insert' , { field : this . group2expand [ id ] . input , insert : recipients , data : this . group2expand [ id ] , search : this . ksearch _value _last , result _type : 'group' } ) ;
this . triggerEvent ( 'autocomplete_insert' , { field : this . group2expand [ id ] . input , insert : recipients , data : this . group2expand [ id ] , search : this . ksearch _value _last , result _type : 'group' } ) ;
this . ksearch _value _last = null ;
this . ksearch _value _last = null ;
this . group2expand [ id ] = null ;
this . group2expand [ id ] = null ;
@ -5509,17 +5491,11 @@ function rcube_webmail()
// address search processor
// address search processor
this . ksearch _get _results = function ( props )
this . ksearch _get _results = function ( props )
{
{
var inp _value = this . ksearch _input ? this . ksearch _input . value : null ;
if ( inp _value === null )
return ;
if ( this . ksearch _pane && this . ksearch _pane . is ( ":visible" ) )
if ( this . ksearch _pane && this . ksearch _pane . is ( ":visible" ) )
this . ksearch _pane . hide ( ) ;
this . ksearch _pane . hide ( ) ;
// get string from cursor position back to the last comma or semicolon
// get string from cursor position back to the last comma or semicolon
var cpos = this . get _caret _pos ( this . ksearch _input ) ,
var q = this . ksearch _input _get ( ) ,
q = inp _value . substr ( 0 , cpos ) . split ( /[,;]/ ) . pop ( ) ,
min = this . env . autocomplete _min _length ,
min = this . env . autocomplete _min _length ,
data = this . ksearch _data ;
data = this . ksearch _data ;
@ -5585,9 +5561,14 @@ function rcube_webmail()
// create results pane if not present
// create results pane if not present
if ( ! this . ksearch _pane ) {
if ( ! this . ksearch _pane ) {
ul = $ ( '<ul>' ) ;
ul = $ ( '<ul>' ) ;
this . ksearch _pane = $ ( '<div>' ) . attr ( 'id' , 'rcmKSearchpane' ) . attr ( 'role' , 'listbox' )
this . ksearch _pane = $ ( '<div>' )
. css ( { position : 'absolute' , 'z-index' : 30000 } ) . append ( ul ) . appendTo ( document . body ) ;
. attr ( { id : 'rcmKSearchpane' , role : 'listbox' } )
. css ( { position : 'absolute' , 'z-index' : 30000 } )
. append ( ul )
. appendTo ( document . body ) ;
this . ksearch _pane . _ _ul = ul [ 0 ] ;
this . ksearch _pane . _ _ul = ul [ 0 ] ;
this . triggerEvent ( 'autocomplete_create' , { obj : this . ksearch _pane } ) ;
}
}
ul = this . ksearch _pane . _ _ul ;
ul = this . ksearch _pane . _ _ul ;
@ -5647,6 +5628,65 @@ function rcube_webmail()
this . ksearch _data . num -- ;
this . ksearch _data . num -- ;
} ;
} ;
// Getter for input value (with support for non-input content-editable elements)
// returns a string from last comma to current cursor position
this . ksearch _input _get = function ( )
{
if ( ! this . ksearch _input )
return '' ;
var sel , range , sp , cp = 0 , value = '' ;
if ( this . ksearch _input . value === undefined ) {
if ( ( sel = window . getSelection ( ) ) && ( range = sel . getRangeAt ( 0 ) ) ) {
value = $ ( range . endContainer ) . text ( ) ;
cp = range . endOffset ;
}
else {
value = $ ( this . ksearch _input ) . text ( ) ;
}
}
else {
cp = this . get _caret _pos ( this . ksearch _input ) ;
value = this . ksearch _input . value ;
}
return value . substr ( 0 , cp ) . split ( /[,;]/ ) . pop ( ) ;
} ;
// Setter for input value (with support for non-input content-editable elements)
// replaces 'from' string with 'to' and sets cursor position at the end
this . ksearch _input _replace = function ( from , to , input )
{
if ( ! this . ksearch _input && ! input )
return ;
if ( ! input )
input = this . ksearch _input ;
if ( input . value === undefined ) {
var node = $ ( input ) . contents ( ) . filter ( function ( ) { return this . nodeType == 3 ; } ) . last ( ) ;
// here we assume there's only one text node
if ( node . length ) {
$ ( node ) [ 0 ] . textContent = to ;
}
}
else {
var cpos = this . get _caret _pos ( input ) ,
p = input . value . lastIndexOf ( from , cpos ) ,
pre = input . value . substring ( 0 , p ) ,
end = input . value . substring ( p + from . length , input . value . length ) ;
input . value = pre + to + end ;
// set caret to insert pos
this . set _caret _pos ( input , p + to . length ) ;
}
// run onchange action on the element
$ ( input ) . change ( ) ;
} ;
this . ksearch _click = function ( node )
this . ksearch _click = function ( node )
{
{
if ( this . ksearch _input )
if ( this . ksearch _input )
@ -5720,7 +5760,7 @@ function rcube_webmail()
source = this . env . source ? this . env . address _sources [ this . env . source ] : null ;
source = this . env . source ? this . env . address _sources [ this . env . source ] : null ;
// we don't have dblclick handler here, so use 50 instead of this.dblclick_time
// we don't have dblclick handler here, so use 50 instead of this.dblclick_time
if ( this . env . contentframe && ( id = list . get _single _selection ( ) ) )
if ( this . env . contentframe && ! list . multi _selecting && ( id = list . get _single _selection ( ) ) )
this . preview _timer = setTimeout ( function ( ) { ref . load _contact ( id , 'show' ) ; } , 50 ) ;
this . preview _timer = setTimeout ( function ( ) { ref . load _contact ( id , 'show' ) ; } , 50 ) ;
else if ( this . env . contentframe )
else if ( this . env . contentframe )
this . show _contentframe ( false ) ;
this . show _contentframe ( false ) ;
@ -5761,7 +5801,6 @@ function rcube_webmail()
// if a group is currently selected, and there is at least one contact selected
// if a group is currently selected, and there is at least one contact selected
// thend we can enable the group-remove-selected command
// thend we can enable the group-remove-selected command
this . enable _command ( 'group-remove-selected' , this . env . group && selected && writable ) ;
this . enable _command ( 'group-remove-selected' , this . env . group && selected && writable ) ;
this . enable _command ( 'compose' , this . env . group || selected ) ;
this . enable _command ( 'print' , selected == 1 ) ;
this . enable _command ( 'print' , selected == 1 ) ;
this . enable _command ( 'export-selected' , 'copy' , selected > 0 ) ;
this . enable _command ( 'export-selected' , 'copy' , selected > 0 ) ;
this . enable _command ( 'edit' , id && writable ) ;
this . enable _command ( 'edit' , id && writable ) ;
@ -5884,7 +5923,6 @@ function rcube_webmail()
this . contact _list . clear ( true ) ;
this . contact _list . clear ( true ) ;
this . show _contentframe ( false ) ;
this . show _contentframe ( false ) ;
this . enable _command ( 'delete' , 'move' , 'copy' , 'print' , false ) ;
this . enable _command ( 'delete' , 'move' , 'copy' , 'print' , false ) ;
this . enable _command ( 'compose' , this . env . group ) ;
} ;
} ;
this . set _group _prop = function ( prop )
this . set _group _prop = function ( prop )
@ -5923,7 +5961,6 @@ function rcube_webmail()
if ( ! cid )
if ( ! cid )
this . contact _list . clear _selection ( ) ;
this . contact _list . clear _selection ( ) ;
this . enable _command ( 'compose' , rec && rec . email ) ;
this . enable _command ( 'export-selected' , 'print' , rec && rec . _type != 'group' ) ;
this . enable _command ( 'export-selected' , 'print' , rec && rec . _type != 'group' ) ;
}
}
else if ( framed )
else if ( framed )
@ -6537,15 +6574,28 @@ function rcube_webmail()
// load advanced search page
// load advanced search page
this . advanced _search = function ( )
this . advanced _search = function ( )
{
{
var win , url = { _form : 1 , _action : 'search' } , target = window ;
var dialog = $ ( '<iframe>' ) . attr ( 'src' , this . url ( 'search' , { _form : 1 , _framed : 1 } ) ) ,
search _func = function ( ) {
var valid = false , form = { _adv : 1 } ;
if ( win = this . get _frame _window ( this . env . contentframe ) ) {
$ . each ( $ ( dialog [ 0 ] . contentWindow . rcmail . gui _objects . editform ) . serializeArray ( ) , function ( ) {
url . _framed = 1 ;
if ( this . name . match ( /^_search/ ) && this . value != '' ) {
target = win ;
form [ this . name ] = this . value ;
this . contact _list . clear _selection ( ) ;
valid = true ;
}
}
} ) ;
if ( valid ) {
ref . http _post ( 'search' , form , ref . set _busy ( true , 'searching' ) ) ;
return true ;
}
} ;
this . location _href ( url , target , true ) ;
this . simple _dialog ( dialog , this . gettext ( 'advsearch' ) , search _func , {
button : 'search' ,
width : 600 ,
height : 500
} ) ;
return true ;
return true ;
} ;
} ;
@ -6642,18 +6692,12 @@ function rcube_webmail()
this . qrcode = function ( )
this . qrcode = function ( )
{
{
var title = this . get _label ( 'qrcode' ) ,
var title = this . get _label ( 'qrcode' ) ,
buttons = [ {
options = { button : false , cancel _button : 'close' , width : 310 , height : 410 } ,
text : this . get _label ( 'close' ) ,
'class' : 'mainaction' ,
click : function ( ) {
( ref . is _framed ( ) ? parent . $ : $ ) ( this ) . dialog ( 'destroy' ) ;
}
} ] ,
img = new Image ( 300 , 300 ) ;
img = new Image ( 300 , 300 ) ;
img . src = this . url ( 'addressbook/qrcode' , { _source : this . env . source , _cid : this . env . cid } ) ;
img . src = this . url ( 'addressbook/qrcode' , { _source : this . env . source , _cid : this . env . cid } ) ;
return this . s how_popup _dialog ( img , title , buttons , { width : 310 , height : 410 } ) ;
return this . simple _dialog ( img , title , null , options ) ;
} ;
} ;
@ -6664,25 +6708,46 @@ function rcube_webmail()
// preferences section select and load options frame
// preferences section select and load options frame
this . section _select = function ( list )
this . section _select = function ( list )
{
{
var win , id = list . get _single _selection ( ) , target = window ,
var win , id = list . get _single _selection ( ) ;
url = { _action : 'edit-prefs' , _section : id } ;
if ( id && ( win = this . get _frame _window ( this . env . contentframe ) ) ) {
this . location _href ( { _action : 'edit-prefs' , _section : id , _framed : 1 } , win , true ) ;
}
} ;
this . response _select = function ( list )
{
var id = list . get _single _selection ( ) ;
this . enable _command ( 'delete' , ! ! id && $ . inArray ( id , this . env . readonly _responses ) < 0 ) ;
if ( id ) {
if ( id ) {
if ( win = this . get _frame _window ( this . env . contentframe ) ) {
this . load _response ( id , 'edit-response' ) ;
url . _framed = 1 ;
target = win ;
}
this . location _href ( url , target , true ) ;
}
}
} ;
return true ;
// load response record
this . load _response = function ( id , action )
{
var win ;
if ( win = this . get _frame _window ( this . env . contentframe ) ) {
if ( id || action == 'add-response' ) {
if ( ! id )
this . responses _list . clear _selection ( ) ;
this . location _href ( { _action : action , _key : id , _framed : 1 } , win , true ) ;
}
}
} ;
} ;
this . identity _select = function ( list )
this . identity _select = function ( list )
{
{
var id ;
var id = list . get _single _selection ( ) ;
if ( id = list . get _single _selection ( ) ) {
this . enable _command ( 'delete' , list . rowcount > 1 && this . env . identities _level < 2 ) ;
this . enable _command ( 'delete' , ! ! id && list . rowcount > 1 && this . env . identities _level < 2 ) ;
if ( id ) {
this . load _identity ( id , 'edit-identity' ) ;
this . load _identity ( id , 'edit-identity' ) ;
}
}
} ;
} ;
@ -6690,22 +6755,16 @@ function rcube_webmail()
// load identity record
// load identity record
this . load _identity = function ( id , action )
this . load _identity = function ( id , action )
{
{
if ( action == 'edit-identity' && ( ! id || id == this . env . iid ) )
var win ;
return false ;
var win , target = window ,
url = { _action : action , _iid : id } ;
if ( win = this . get _frame _window ( this . env . contentframe ) ) {
if ( win = this . get _frame _window ( this . env . contentframe ) ) {
url . _framed = 1 ;
if ( id || action == 'add-identity' ) {
target = win ;
if ( ! id )
}
this . identity _list . clear _selection ( ) ;
if ( id || action == 'add-identity' ) {
this . location _href ( { _action : action , _iid : id , _framed : 1 } , win , true ) ;
this . location _href ( url , target , true ) ;
}
}
}
return true ;
} ;
} ;
this . delete _identity = function ( id )
this . delete _identity = function ( id )
@ -7310,7 +7369,7 @@ function rcube_webmail()
obj . className = button [ state ] ;
obj . className = button [ state ] ;
}
}
// disable/enable input buttons
// disable/enable input buttons
if ( button . type == 'input' ) {
if ( button . type == 'input' || button . type == 'button' ) {
obj . disabled = state == 'pas' ;
obj . disabled = state == 'pas' ;
}
}
else if ( button . type == 'uibutton' ) {
else if ( button . type == 'uibutton' ) {
@ -7441,7 +7500,7 @@ function rcube_webmail()
if ( this . messages [ key ] ) {
if ( this . messages [ key ] ) {
// replace label
// replace label
if ( this . messages [ key ] . obj )
if ( this . messages [ key ] . obj )
this . messages [ key ] . obj . html ( msg ) ;
$ ( 'div.content' , this . messages [ key ] . obj ) . html ( msg ) ;
// store label in stack
// store label in stack
if ( type == 'loading' ) {
if ( type == 'loading' ) {
this . messages [ key ] . labels . push ( { 'id' : id , 'msg' : msg } ) ;
this . messages [ key ] . labels . push ( { 'id' : id , 'msg' : msg } ) ;
@ -7453,7 +7512,7 @@ function rcube_webmail()
}
}
// create DOM object and display it
// create DOM object and display it
var obj = $ ( '<div>' ) . addClass ( type ) . html ( msg ) . data ( 'key' , key ) ,
var obj = $ ( '<div>' ) . addClass ( type + ' content' ) . html ( msg ) . data ( 'key' , key ) ,
cont = $ ( this . gui _objects . message ) . append ( obj ) . show ( ) ;
cont = $ ( this . gui _objects . message ) . append ( obj ) . show ( ) ;
this . messages [ key ] = { 'obj' : obj , 'elements' : [ id ] } ;
this . messages [ key ] = { 'obj' : obj , 'elements' : [ id ] } ;
@ -7513,7 +7572,7 @@ function rcube_webmail()
}
}
else {
else {
o = m [ k ] . labels [ i ] . msg ;
o = m [ k ] . labels [ i ] . msg ;
m[ k ] . obj . html ( o ) ;
$( 'div.content' , m[ k ] . obj ) . html ( o ) ;
}
}
}
}
}
}
@ -7527,7 +7586,7 @@ function rcube_webmail()
this . hide _message _object = function ( o , fade )
this . hide _message _object = function ( o , fade )
{
{
if ( fade )
if ( fade )
o . fadeOut ( 600 , function ( ) { $ ( this ) . remove ( ) ; } ) ;
o . fadeOut ( 600 , function ( ) { $ ( this ) . remove ( ) ; } ) ;
else
else
o . hide ( ) . remove ( ) ;
o . hide ( ) . remove ( ) ;
} ;
} ;
@ -7588,8 +7647,11 @@ function rcube_webmail()
var popup = $ ( '<div class="popup">' ) ;
var popup = $ ( '<div class="popup">' ) ;
if ( typeof content == 'object' )
if ( typeof content == 'object' ) {
popup . append ( content ) ;
popup . append ( content ) ;
if ( $ ( content ) . is ( 'iframe' ) )
popup . addClass ( 'iframe' ) ;
}
else
else
popup . html ( content ) ;
popup . html ( content ) ;
@ -7615,31 +7677,34 @@ function rcube_webmail()
// assign special classes to dialog buttons
// assign special classes to dialog buttons
$ . each ( options . button _classes || [ ] , function ( i , v ) {
$ . each ( options . button _classes || [ ] , function ( i , v ) {
if ( v ) $ ( $ ( '.ui-dialog-buttonpane button .ui-button ', popup . parent ( ) ) . get ( i ) ) . addClass ( v ) ;
if ( v ) $ ( $ ( '.ui-dialog-buttonpane button ', popup . parent ( ) ) . get ( i ) ) . addClass ( v ) ;
} ) ;
} ) ;
return popup ;
return popup ;
} ;
} ;
// show_popup_dialog() wrapper for simple dialogs with Save and Cancel buttons
// show_popup_dialog() wrapper for simple dialogs with action and Cancel buttons
this . simple _dialog = function ( content , title , butt on_func , options )
this . simple _dialog = function ( content , title , acti on_func , options )
{
{
var title = this . get _label ( title ) ,
var title = this . get _label ( title ) ,
cancel _label = ( options || { } ) . cancel _button || 'cancel' ,
save _label = ( options || { } ) . button || 'save' ,
close _func = function ( e , ui , dialog ) { ( ref . is _framed ( ) ? parent . $ : $ ) ( dialog || this ) . dialog ( 'close' ) ; } ,
buttons = [ {
buttons = [ {
text : this . get _label ( ( options || { } ) . button || 'save' ) ,
text : ref . get _label ( cancel _label ) ,
'class' : 'mainaction' ,
'class' : 'cancel' ,
click : function ( ) {
click : close _func
if ( button _func ( ) )
$ ( this ) . dialog ( 'close' ) ;
}
} ,
{
text : ref . get _label ( 'cancel' ) ,
click : function ( ) {
$ ( this ) . dialog ( 'close' ) ;
}
} ] ;
} ] ;
if ( ! action _func )
buttons [ 0 ] [ 'class' ] += ' mainaction' ;
else
buttons . unshift ( {
text : this . get _label ( save _label ) ,
'class' : 'mainaction ' + save _label ,
click : function ( e , ui ) { if ( action _func ( e ) ) close _func ( e , ui , this ) ; }
} ) ;
return this . show _popup _dialog ( content , title , buttons , options ) ;
return this . show _popup _dialog ( content , title , buttons , options ) ;
} ;
} ;
@ -7926,12 +7991,12 @@ function rcube_webmail()
row = $ ( '<li>' ) ;
row = $ ( '<li>' ) ;
if ( folder . virtual )
if ( folder . virtual )
a . addClass ( 'virtual' ) . attr ( 'aria-disabled' , 'true' ) . attr ( 'tabindex' , '-1' ) ;
a . addClass ( 'virtual' ) . attr ( { 'aria-disabled' : 'true' , tabindex : '-1' } ) ;
else
else
a . addClass ( 'active' ) . data ( 'id' , folder . id ) ;
a . addClass ( 'active' ) . data ( 'id' , folder . id ) ;
if ( folder [ 'class' ] )
if ( folder [ 'class' ] )
a . addClass ( folder [ 'class' ] ) ;
row . addClass ( folder [ 'class' ] ) ;
// calculate/set indentation level
// calculate/set indentation level
while ( ( s = id . indexOf ( delim , s ) ) >= 0 ) {
while ( ( s = id . indexOf ( delim , s ) ) >= 0 ) {
@ -7957,7 +8022,7 @@ function rcube_webmail()
container . css ( 'max-height' , $ ( 'li' , container ) [ 0 ] . offsetHeight * 10 + 9 ) ;
container . css ( 'max-height' , $ ( 'li' , container ) [ 0 ] . offsetHeight * 10 + 9 ) ;
// register delegate event handler for folder item clicks
// register delegate event handler for folder item clicks
container . on ( 'click' , 'a.active' , function ( e ) {
container . on ( 'click' , 'a.active' , function ( e ) {
container . data ( 'callback' ) ( $ ( this ) . data ( 'id' ) ) ;
container . data ( 'callback' ) ( $ ( this ) . data ( 'id' ) ) ;
return false ;
return false ;
} ) ;
} ) ;
@ -8409,7 +8474,6 @@ function rcube_webmail()
writable = ! this . env . address _sources [ this . env . source ] . readonly ;
writable = ! this . env . address _sources [ this . env . source ] . readonly ;
}
}
}
}
this . enable _command ( 'compose' , ( uid && this . contact _list . rows [ uid ] ) ) ;
this . enable _command ( 'delete' , 'edit' , writable ) ;
this . enable _command ( 'delete' , 'edit' , writable ) ;
this . enable _command ( 'export' , ( this . contact _list && this . contact _list . rowcount > 0 ) ) ;
this . enable _command ( 'export' , ( this . contact _list && this . contact _list . rowcount > 0 ) ) ;
this . enable _command ( 'export-selected' , 'print' , false ) ;
this . enable _command ( 'export-selected' , 'print' , false ) ;