Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit 75304af

Browse files
author
Barry de Graaff
committed
enable multi-select from the UI to upload to DAV
1 parent ad0cd6d commit 75304af

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

zimlet/tk_barrydegraaff_owncloud_zimlet.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,7 @@ ownCloudZimlet.prototype.addMenuButton = function (controller , menu) {
882882
index : moveOpIndex + 1
883883
};
884884
var mi = menu.createOp (ID , params);
885+
menu.addPopupListener(new AjxListener(this, this._onRightClickMenu, [controller, menu]));
885886
mi.addSelectionListener (new AjxListener (this , this._menuButtonListener , controller));
886887
}
887888
};
@@ -904,6 +905,27 @@ ownCloudZimlet.prototype._menuButtonListener = function (controller) {
904905
zimletInstance.targetFolderPicker(zimletInstance._doDropPropfindCbk,[items]);
905906
};
906907

908+
909+
/**
910+
* Listener called when the menu pops up, changes the buttons depending on the number of selected items
911+
* @param controller
912+
* @param actionMenu
913+
*/
914+
ownCloudZimlet.prototype._onRightClickMenu = function(controller, actionMenu) {
915+
var menu = actionMenu.getMenuItem("ownCloudZimlet_MENU_ITEM")._menu;
916+
917+
/* Here you can get the number of selected items, to make the menu do different things based on single/multiselect
918+
* we do not need it now, as we just want to enable the menu for all possible selections
919+
var selected = controller.getListView().getDnDSelection()
920+
selected = (selected instanceof Array) ? selected : [selected];
921+
selected = selected.length;*/
922+
923+
// default behaviour is disable for more than one, changed here
924+
actionMenu.enable("ownCloudZimlet_MENU_ITEM", true);
925+
926+
927+
};
928+
907929
/**
908930
* Handle the action 'drop' on the Zimlet Menu Item.
909931
* @param {ZmItem[]} zmObjects Objects dropped on the Zimlet Menu Item.
@@ -967,12 +989,12 @@ ownCloudZimlet.prototype._doDropPropfindCbk = function(zmObjects, callback, erro
967989
msgObj = msgObj.getFirstHotMsg();
968990
tmpObj.id = msgObj.id;
969991
type = 'MESSAGE';
970-
fileName = (tmpObj.subject ? tmpObj.subject + '.eml' : tmpObj.id + '.eml');
992+
fileName = (tmpObj.subject ? tmpObj.subject + ' ' + tmpObj.id + '.eml' : tmpObj.id + '.eml');
971993
}
972994

973995
if(tmpObj.type ==='MSG')
974996
{
975-
fileName = (tmpObj.subject ? tmpObj.subject + '.eml' : tmpObj.id + '.eml');
997+
fileName = (tmpObj.subject ? tmpObj.subject + ' ' + tmpObj.id + '.eml' : tmpObj.id + '.eml');
976998
}
977999

9781000
if (tmpObj.id < 0) {

0 commit comments

Comments
 (0)