@@ -3163,60 +3163,7 @@ function rcube_webmail()
3163
3163
3164
3164
// check for locally stored compose data
3165
3165
if ( window . localStorage ) {
3166
- var index = this . local_storage_get_item ( 'compose.index' , [ ] ) ;
3167
-
3168
- for ( var key , i = 0 ; i < index . length ; i ++ ) {
3169
- key = index [ i ] , formdata = this . local_storage_get_item ( 'compose.' + key , null , true ) ;
3170
- if ( ! formdata ) {
3171
- continue ;
3172
- }
3173
- // restore saved copy of current compose_id
3174
- if ( formdata . changed && key == this . env . compose_id ) {
3175
- this . restore_compose_form ( key , html_mode ) ;
3176
- break ;
3177
- }
3178
- // skip records from 'other' drafts
3179
- if ( this . env . draft_id && formdata . draft_id && formdata . draft_id != this . env . draft_id ) {
3180
- continue ;
3181
- }
3182
- // skip records on reply
3183
- if ( this . env . reply_msgid && formdata . reply_msgid != this . env . reply_msgid ) {
3184
- continue ;
3185
- }
3186
- // show dialog asking to restore the message
3187
- if ( formdata . changed && formdata . session != this . env . session_id ) {
3188
- this . show_popup_dialog (
3189
- this . get_label ( 'restoresavedcomposedata' )
3190
- . replace ( '$date' , new Date ( formdata . changed ) . toLocaleString ( ) )
3191
- . replace ( '$subject' , formdata . _subject )
3192
- . replace ( / \n / g, '<br/>' ) ,
3193
- this . get_label ( 'restoremessage' ) ,
3194
- [ {
3195
- text : this . get_label ( 'restore' ) ,
3196
- click : function ( ) {
3197
- ref . restore_compose_form ( key , html_mode ) ;
3198
- ref . remove_compose_data ( key ) ; // remove old copy
3199
- ref . save_compose_form_local ( ) ; // save under current compose_id
3200
- $ ( this ) . dialog ( 'close' ) ;
3201
- }
3202
- } ,
3203
- {
3204
- text : this . get_label ( 'delete' ) ,
3205
- click : function ( ) {
3206
- ref . remove_compose_data ( key ) ;
3207
- $ ( this ) . dialog ( 'close' ) ;
3208
- }
3209
- } ,
3210
- {
3211
- text : this . get_label ( 'ignore' ) ,
3212
- click : function ( ) {
3213
- $ ( this ) . dialog ( 'close' ) ;
3214
- }
3215
- } ]
3216
- ) ;
3217
- break ;
3218
- }
3219
- }
3166
+ this . compose_restore_dialog ( 0 , html_mode )
3220
3167
}
3221
3168
3222
3169
if ( input_to . val ( ) == '' )
@@ -3235,6 +3182,72 @@ function rcube_webmail()
3235
3182
this . auto_save_start ( ) ;
3236
3183
} ;
3237
3184
3185
+ this . compose_restore_dialog = function ( j , html_mode )
3186
+ {
3187
+ var i , key , formdata , index = this . local_storage_get_item ( 'compose.index' , [ ] ) ;
3188
+
3189
+ var show_next = function ( i ) {
3190
+ if ( ++ i < index . length )
3191
+ ref . compose_restore_dialog ( i , html_mode )
3192
+ }
3193
+
3194
+ for ( i = j || 0 ; i < index . length ; i ++ ) {
3195
+ key = index [ i ] ;
3196
+ formdata = this . local_storage_get_item ( 'compose.' + key , null , true ) ;
3197
+ if ( ! formdata ) {
3198
+ continue ;
3199
+ }
3200
+ // restore saved copy of current compose_id
3201
+ if ( formdata . changed && key == this . env . compose_id ) {
3202
+ this . restore_compose_form ( key , html_mode ) ;
3203
+ break ;
3204
+ }
3205
+ // skip records from 'other' drafts
3206
+ if ( this . env . draft_id && formdata . draft_id && formdata . draft_id != this . env . draft_id ) {
3207
+ continue ;
3208
+ }
3209
+ // skip records on reply
3210
+ if ( this . env . reply_msgid && formdata . reply_msgid != this . env . reply_msgid ) {
3211
+ continue ;
3212
+ }
3213
+ // show dialog asking to restore the message
3214
+ if ( formdata . changed && formdata . session != this . env . session_id ) {
3215
+ this . show_popup_dialog (
3216
+ this . get_label ( 'restoresavedcomposedata' )
3217
+ . replace ( '$date' , new Date ( formdata . changed ) . toLocaleString ( ) )
3218
+ . replace ( '$subject' , formdata . _subject )
3219
+ . replace ( / \n / g, '<br/>' ) ,
3220
+ this . get_label ( 'restoremessage' ) ,
3221
+ [ {
3222
+ text : this . get_label ( 'restore' ) ,
3223
+ click : function ( ) {
3224
+ ref . restore_compose_form ( key , html_mode ) ;
3225
+ ref . remove_compose_data ( key ) ; // remove old copy
3226
+ ref . save_compose_form_local ( ) ; // save under current compose_id
3227
+ $ ( this ) . dialog ( 'close' ) ;
3228
+ }
3229
+ } ,
3230
+ {
3231
+ text : this . get_label ( 'delete' ) ,
3232
+ click : function ( ) {
3233
+ ref . remove_compose_data ( key ) ;
3234
+ $ ( this ) . dialog ( 'close' ) ;
3235
+ show_next ( i ) ;
3236
+ }
3237
+ } ,
3238
+ {
3239
+ text : this . get_label ( 'ignore' ) ,
3240
+ click : function ( ) {
3241
+ $ ( this ) . dialog ( 'close' ) ;
3242
+ show_next ( i ) ;
3243
+ }
3244
+ } ]
3245
+ ) ;
3246
+ break ;
3247
+ }
3248
+ }
3249
+ }
3250
+
3238
3251
this . init_address_input_events = function ( obj , props )
3239
3252
{
3240
3253
this . env . recipients_delimiter = this . env . recipients_separator + ' ' ;
0 commit comments