@ -29,6 +29,7 @@ function rcube_webmail()
this . commands = new Object ( ) ;
this . selection = new Array ( ) ;
this . last _selected = 0 ;
this . in _message _list = false ;
// create public reference to myself
rcube _webmail _client = this ;
@ -256,8 +257,8 @@ function rcube_webmail()
// reset last clicked if user clicks on anything other than the message table
this . reset _click = function ( )
{
this . in _message _list = false ;
} ;
this . in _message _list = false ;
} ;
this . click _on _list = function ( e )
{
@ -328,8 +329,12 @@ function rcube_webmail()
for ( var r = 0 ; r < msg _list . tBodies [ 0 ] . childNodes . length ; r ++ )
{
row = msg _list . tBodies [ 0 ] . childNodes [ r ] ;
while ( row && ( row . nodeType != 1 || row . style . display == 'none' ) ) {
row = row . nextSibling ;
r ++ ;
}
//row = msg_list.tBodies[0].rows[r];
this . init _message _row ( row ) ;
if ( row ) this. init _message _row ( row ) ;
}
}
@ -989,7 +994,7 @@ function rcube_webmail()
// set command enabled or disabled
this . enable _command = function ( )
{
var args = this . enable _command . arguments ;
var args = arguments ;
if ( ! args . length ) return - 1 ;
var command ;
@ -1001,6 +1006,7 @@ function rcube_webmail()
this . commands [ command ] = enable ;
this . set _button ( command , ( enable ? 'act' : 'pas' ) ) ;
}
return true ;
} ;
@ -1355,9 +1361,11 @@ function rcube_webmail()
// reset selection first
this . clear _selection ( ) ;
for ( var n in this . list _rows )
for ( var n in this . list _rows ) {
if ( ! filter || this . list _rows [ n ] [ filter ] == true )
this . highlight _row ( n , true ) ;
this . highlight _row ( n , true ) ;
}
return true ;
} ;
@ -1520,6 +1528,7 @@ function rcube_webmail()
// send request to server
var url = '_mbox=' + escape ( mbox ) ;
this . http _request ( 'purge' , url + add _url , lock ) ;
return true ;
} ;
@ -1611,10 +1620,11 @@ function rcube_webmail()
this . permanently _remove _messages ( ) ;
// if there isn't a defined trash mailbox and the config is set to flag for deletion
else if ( ! this . env . trash _mailbox && this . env . flag _for _deletion ) {
this . mark _message ( 'delete' , this . env . uid ) ;
flag = 'delete' ;
this . mark _message ( flag ) ;
if ( this . env . action == "show" ) {
this . command ( 'nextmessage' , '' , this ) ;
} else {
} else if ( this . selection . length == 1 ) {
next _row = this . get _next _row ( ) ;
prev _row = this . get _prev _row ( ) ;
new _row = ( next _row ) ? next _row : prev _row ;
@ -1653,11 +1663,9 @@ function rcube_webmail()
break ;
case 'delete' :
case 'undelete' :
this . toggle _delete _status ( flag, a_uids ) ;
this . toggle _delete _status ( a_uids ) ;
break ;
}
// send request to server
this . http _request ( 'mark' , '_uid=' + a _uids . join ( ',' ) + '&_flag=' + flag ) ;
} ;
// set class to read/unread
@ -1694,10 +1702,11 @@ function rcube_webmail()
this . message _rows [ uid ] . icon . src = icn _src ;
}
}
this . http _request ( 'mark' , '_uid=' + a _uids . join ( ',' ) + '&_flag=' + flag ) ;
}
// mark all message rows as deleted/undeleted
this . toggle _delete _status = function ( flag, a_uids ) {
this . toggle _delete _status = function ( a_uids ) {
if ( this . env . read _when _deleted ) {
this . toggle _read _status ( 'read' , a _uids ) ;
}
@ -1705,41 +1714,86 @@ function rcube_webmail()
if ( this . env . action == "show" )
return false ;
if ( a _uids . length == 1 ) {
if ( this . message _rows [ uid ] . classname . indexOf ( 'deleted' ) < 0 ) {
this . flag _as _deleted ( a _uids )
} else {
this . flag _as _undeleted ( a _uids )
}
return true ;
}
var all _deleted = true ;
for ( var i = 0 ; i < a _uids . length ; i ++ ) {
uid = a _uids [ i ] ;
if ( this . message _rows [ uid ] ) {
if ( this . message _rows [ uid ] . classname . indexOf ( 'deleted' ) < 0 ) {
all _deleted = false ;
break ;
}
}
}
if ( all _deleted )
this . flag _as _undeleted ( a _uids ) ;
else
this . flag _as _deleted ( a _uids ) ;
return true ;
}
this . flag _as _undeleted = function ( a _uids ) {
// if deleting message from "view message" don't bother with delete icon
if ( this . env . action == "show" )
return false ;
var icn _src ;
for ( var i = 0 ; i < a _uids . length ; i ++ )
{
for ( var i = 0 ; i < a _uids . length ; i ++ ) {
uid = a _uids [ i ] ;
if ( this . message _rows [ uid ] )
{
this . message _rows [ uid ] . deleted = ( flag == 'undelete' ? false : true ) ;
if ( this . message _rows [ uid ] ) {
this . message _rows [ uid ] . deleted = false ;
if ( this . message _rows [ uid ] . classname . indexOf ( 'deleted' ) < 0 && this . message _rows [ uid ] . deleted )
{
this . message _rows [ uid ] . classname += ' deleted' ;
this . set _classname ( this . message _rows [ uid ] . obj , 'deleted' , true ) ;
if ( this . env . deletedicon )
icn _src = this . env . deletedicon ;
}
else if ( ! this . message _rows [ uid ] . deleted )
{
if ( this . message _rows [ uid ] . classname . indexOf ( 'deleted' ) > 0 ) {
this . message _rows [ uid ] . classname = this . message _rows [ uid ] . classname . replace ( /\s*deleted/ , '' ) ;
this . set _classname ( this . message _rows [ uid ] . obj , 'deleted' , false ) ;
if ( this . message _rows [ uid ] . unread && this . env . unreadicon )
icn _src = this . env . unreadicon ;
else if ( this . message _rows [ uid ] . replied && this . env . repliedicon )
icn _src = this . env . repliedicon ;
else if ( this . env . messageicon )
icn _src = this . env . messageicon ;
}
}
if ( this . message _rows [ uid ] . unread && this . env . unreadicon )
icn _src = this . env . unreadicon ;
else if ( this . message _rows [ uid ] . replied && this . env . repliedicon )
icn _src = this . env . repliedicon ;
else if ( this . env . messageicon )
icn _src = this . env . messageicon ;
if ( this . message _rows [ uid ] . icon && icn _src )
this . message _rows [ uid ] . icon . src = icn _src ;
}
}
}
this . http _request ( 'mark' , '_uid=' + a _uids . join ( ',' ) + '&_flag=undelete' ) ;
return true ;
}
this . flag _as _deleted = function ( a _uids ) {
// if deleting message from "view message" don't bother with delete icon
if ( this . env . action == "show" )
return false ;
for ( var i = 0 ; i < a _uids . length ; i ++ ) {
uid = a _uids [ i ] ;
if ( this . message _rows [ uid ] ) {
this . message _rows [ uid ] . deleted = true ;
if ( this . message _rows [ uid ] . classname . indexOf ( 'deleted' ) < 0 ) {
this . message _rows [ uid ] . classname += ' deleted' ;
this . set _classname ( this . message _rows [ uid ] . obj , 'deleted' , true ) ;
}
if ( this . message _rows [ uid ] . icon && this . env . deletedicon )
this . message _rows [ uid ] . icon . src = this . env . deletedicon ;
}
}
this . http _request ( 'mark' , '_uid=' + a _uids . join ( ',' ) + '&_flag=delete' ) ;
return true ;
}
/*********************************************************/
/********* message compose methods *********/
@ -1853,6 +1907,7 @@ function rcube_webmail()
input _message . value = message ;
this . env . identity = id ;
return true ;
} ;
@ -1880,6 +1935,8 @@ function rcube_webmail()
// clear upload form
if ( ! a && this . gui _objects . attachmentform && this . gui _objects . attachmentform != this . gui _objects . messageform )
this . gui _objects . attachmentform . reset ( ) ;
return true ;
} ;
@ -1929,6 +1986,7 @@ function rcube_webmail()
// set reference to the form object
this . gui _objects . attachmentform = form ;
return true ;
} ;
@ -1942,6 +2000,7 @@ function rcube_webmail()
var li = document . createElement ( 'LI' ) ;
li . innerHTML = name ;
this . gui _objects . attachmentlist . appendChild ( li ) ;
return true ;
} ;
@ -1950,6 +2009,8 @@ function rcube_webmail()
{
if ( value )
this . http _request ( 'addcontact' , '_address=' + value ) ;
return true ;
} ;
// send remote request to search mail
@ -1961,6 +2022,7 @@ function rcube_webmail()
this . set _busy ( true , 'searching' ) ;
this . http _request ( 'search' , '_search=' + value + '&_mbox=' + mbox , true ) ;
}
return true ;
} ;
// reset quick-search form
@ -1970,6 +2032,7 @@ function rcube_webmail()
this . gui _objects . qsearchbox . value = '' ;
this . env . search _request = null ;
return true ;
} ;
@ -2271,6 +2334,7 @@ function rcube_webmail()
this . set _busy ( true ) ;
target . location . href = this . env . comm _path + '&_action=' + action + '&_cid=' + cid + add _url ;
}
return true ;
} ;
@ -2307,6 +2371,7 @@ function rcube_webmail()
// send request to server
this . http _request ( 'delete' , '_cid=' + a _cids . join ( ',' ) + '&_from=' + ( this . env . action ? this . env . action : '' ) ) ;
return true ;
} ;
@ -2317,10 +2382,11 @@ function rcube_webmail()
return false ;
var row = this . contact _rows [ cid ] . obj ;
for ( var c = 0 ; c < cols _arr . length ; c ++ )
for ( var c = 0 ; c < cols _arr . length ; c ++ ) {
if ( row . cells [ c ] )
row . cells [ c ] . innerHTML = cols _arr [ c ] ;
}
return true ;
} ;
@ -2341,6 +2407,8 @@ function rcube_webmail()
if ( action == 'ldappublicsearch' )
target . location . href = this . env . comm _path + '&_action=' + action + add _url ;
return true ;
} ;
// add ldap contacts to address book
@ -2378,7 +2446,7 @@ function rcube_webmail()
this . load _identity = function ( id , action )
{
if ( action == 'edit-identity' && ( ! id || id == this . env . iid ) )
return ;
return false ;
var add _url = '' ;
var target = window ;
@ -2394,6 +2462,7 @@ function rcube_webmail()
this . set _busy ( true ) ;
target . location . href = this . env . comm _path + '&_action=' + action + '&_iid=' + id + add _url ;
}
return true ;
} ;
@ -2418,9 +2487,10 @@ function rcube_webmail()
// if (this.env.framed && id)
this . set _busy ( true ) ;
location . href = this . env . comm _path + '&_action=delete-identity&_iid=' + id ;
location . href = this . env . comm _path + '&_action=delete-identity&_iid=' + id ;
// else if (id)
// this.http_request('delete-identity', '_iid='+id);
return true ;
} ;