@@ -314,6 +314,40 @@ ownCloudZimlet._addOwnCloudLink =
314
314
return linkHtml ;
315
315
} ;
316
316
317
+ /**Called when a message is viewed
318
+ * */
319
+ ownCloudZimlet . prototype . onMsgView = function ( msg , oldMsg , msgView ) {
320
+ try {
321
+ //We add an download all to dav link if the message has attachments
322
+ var zimletInstance = appCtxt . _zimletMgr . getZimletByName ( 'tk_barrydegraaff_owncloud_zimlet' ) . handlerObject ;
323
+ var div = document . createElement ( 'div' ) ;
324
+ div . id = 'ownCloudZimlet-msgViewActions' + msg . id ;
325
+ div . innerHTML = '<img style="vertical-align:middle" src="' + zimletInstance . getResource ( 'icon.png' ) + '"> <a style="text-decoration:underline" class="FakeAnchor">' +
326
+ ( ( zimletInstance . getMessage ( 'saveAllTo' ) . indexOf ( '???' ) == 0 ) ? 'Save all to' : zimletInstance . getMessage ( 'saveAllTo' ) ) + ' ' + zimletInstance . _zimletContext . getConfig ( "owncloud_zimlet_app_title" ) + '</a>' ;
327
+ if ( document . getElementById ( 'zv__CLV__main_MSGC' + msg . id + '_attLinks' ) )
328
+ {
329
+ //conversation view, top item
330
+ document . getElementById ( 'zv__CLV__main_MSGC' + msg . id + '_attLinks' ) . appendChild ( div ) ;
331
+ }
332
+ else
333
+ {
334
+ //by message view, conversation view expanded item
335
+ document . getElementById ( appCtxt . getCurrentView ( ) . _itemView . _attLinksId ) . appendChild ( div ) ;
336
+ }
337
+ div . onclick = AjxCallback . simpleClosure ( zimletInstance . saveAll , zimletInstance , msg ) ;
338
+ } catch ( err ) { }
339
+ }
340
+
341
+ /**
342
+ * Called when save all to webdav link is clicked in mailview
343
+ * */
344
+ ownCloudZimlet . prototype . saveAll =
345
+ function ( msg ) {
346
+ var zimletInstance = appCtxt . _zimletMgr . getZimletByName ( 'tk_barrydegraaff_owncloud_zimlet' ) . handlerObject ;
347
+ zimletInstance . saveAllBatch = msg . _attInfo ;
348
+ ownCloudZimlet . saveAttachment ( zimletInstance . saveAllBatch [ 0 ] . url , zimletInstance . sanitizeFileName ( zimletInstance . saveAllBatch [ 0 ] . label ) , true ) ;
349
+ } ;
350
+
317
351
/**
318
352
* Show a Zimbra Status message (toast notification).
319
353
* @param {string } text The message.
@@ -327,9 +361,6 @@ ownCloudZimlet.prototype.status =
327
361
328
362
/**
329
363
* Save an attachment to OwnCloud.
330
- * @param {string } mid The message id
331
- * @param {string } part The part of the message.
332
- * @param {string } label The label (usually the file name)
333
364
* @static
334
365
*/
335
366
ownCloudZimlet . saveAttachment =
@@ -352,7 +383,7 @@ ownCloudZimlet.prototype.targetFolderPicker =
352
383
function ( method , args ) {
353
384
var zimletInstance = appCtxt . _zimletMgr . getZimletByName ( 'tk_barrydegraaff_owncloud_zimlet' ) . handlerObject ;
354
385
355
- var newFolderBtnId = Dwt . getNextId ( ) ;
386
+ var newFolderBtnId = 'ownCloudZimletNewFolderBtn' ;
356
387
var newFolderBtn = new DwtDialog_ButtonDescriptor ( newFolderBtnId , ZmMsg . newFolder , DwtDialog . ALIGN_LEFT ) ;
357
388
358
389
zimletInstance . _folderPickerDialog = new ZmDialog ( {
@@ -499,6 +530,7 @@ ownCloudZimlet.prototype._saveAttachment =
499
530
zimletInstance . _folderPickerDialog . setTitle ( ZmMsg . loading ) ;
500
531
zimletInstance . _folderPickerDialog . setButtonVisible ( DwtDialog . OK_BUTTON , false ) ;
501
532
zimletInstance . _folderPickerDialog . setButtonVisible ( DwtDialog . CANCEL_BUTTON , false ) ;
533
+ zimletInstance . _folderPickerDialog . setButtonVisible ( 'ownCloudZimletNewFolderBtn' , false ) ;
502
534
}
503
535
else
504
536
{
@@ -528,12 +560,19 @@ ownCloudZimlet.prototype._saveAttachment =
528
560
var zimletInstance = appCtxt . _zimletMgr . getZimletByName ( 'tk_barrydegraaff_owncloud_zimlet' ) . handlerObject ;
529
561
if ( edit == true )
530
562
{
531
- zimletInstance . _folderPickerDialog . popdown ( ) ;
532
- try {
533
- zimletInstance . docEditor . destroyEditor ( ) ;
534
- } catch ( err ) { }
563
+ if ( zimletInstance . saveAllBatch . length > 1 )
564
+ {
565
+ zimletInstance . saveAllBatch . shift ( ) ;
566
+ zimletInstance . _saveAttachment ( zimletInstance . saveAllBatch [ 0 ] . url , zimletInstance . sanitizeFileName ( zimletInstance . saveAllBatch [ 0 ] . label ) , true ) ;
567
+ }
568
+ else
569
+ {
570
+ zimletInstance . _folderPickerDialog . popdown ( ) ;
571
+ try {
572
+ zimletInstance . docEditor . destroyEditor ( ) ;
573
+ } catch ( err ) { }
535
574
zimletInstance . editenable = true ;
536
- ownCloudZimlet . prototype . clicked ( null , 'zimbradav:/' + path + ownCloudZimlet . prototype . sanitizeFileName ( fileName ) ) ;
575
+ }
537
576
}
538
577
}
539
578
}
@@ -1017,38 +1056,6 @@ ownCloudZimlet.prototype._onRightClickMenu = function(controller, actionMenu) {
1017
1056
1018
1057
} ;
1019
1058
1020
- /**
1021
- * Handle the action 'drop' on the Zimlet Menu Item.
1022
- * @param {ZmItem[] } zmObjects Objects dropped on the Zimlet Menu Item.
1023
- */
1024
- ownCloudZimlet . prototype . doDrop =
1025
- function ( dropObjects ) {
1026
- /*
1027
- var zimletInstance = appCtxt._zimletMgr.getZimletByName('tk_barrydegraaff_owncloud_zimlet').handlerObject;
1028
- if(!tk_barrydegraaff_owncloud_zimlet_HandlerObject.settings['owncloud_zimlet_password'])
1029
- {
1030
- zimletInstance.status(ZmMsg.requiredLabel + ' ' + ZmMsg.password, ZmStatusView.LEVEL_INFO);
1031
- zimletInstance.displayDialog(1, ZmMsg.preferences, null);
1032
- return;
1033
- }
1034
-
1035
- // Single selects result in an object passed,
1036
- //Multi selects results in an array of objects passed.
1037
- //Always make it an array
1038
- if(!dropObjects[0])
1039
- {
1040
- dropObjects = [dropObjects];
1041
- }
1042
- var i = 0;
1043
- var zmObjects = [];
1044
- dropObjects.forEach(function(dropObject)
1045
- {
1046
- zmObjects[i++] = dropObject.srcObj;
1047
- });
1048
- zimletInstance.targetFolderPicker(zimletInstance._doDropPropfindCbk,[zmObjects]);
1049
- */
1050
- } ;
1051
-
1052
1059
/**
1053
1060
* Send a list of ZmObjects to OwnCloud.
1054
1061
* The real copy will be made on the server, this optimization will avoid to saturate the user bandwidth.
0 commit comments