Blame view

sources/apps/files_sharing/js/share.js 1.57 KB
03e52840d   Kload   Init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
  $(document).ready(function() {
  
  	var disableSharing = $('#disableSharing').data('status'),
  		sharesLoaded = false;
  
  	if (typeof OC.Share !== 'undefined' && typeof FileActions !== 'undefined'  && !disableSharing) {
  		$('#fileList').on('fileActionsReady',function(){
  			if (!sharesLoaded){
  				OC.Share.loadIcons('file');
  				// assume that we got all shares, so switching directories
  				// will not invalidate that list
  				sharesLoaded = true;
  			}
  			else{
  				OC.Share.updateIcons('file');
  			}
  		});
  
  		FileActions.register('all', 'Share', OC.PERMISSION_READ, OC.imagePath('core', 'actions/share'), function(filename) {
  			if ($('#dir').val() == '/') {
  				var item = $('#dir').val() + filename;
  			} else {
  				var item = $('#dir').val() + '/' + filename;
  			}
  			var tr = $('tr').filterAttr('data-file', filename);
  			if ($(tr).data('type') == 'dir') {
  				var itemType = 'folder';
  			} else {
  				var itemType = 'file';
  			}
  			var possiblePermissions = $(tr).data('permissions');
  			var appendTo = $(tr).find('td.filename');
  			// Check if drop down is already visible for a different file
  			if (OC.Share.droppedDown) {
  				if ($(tr).data('id') != $('#dropdown').attr('data-item-source')) {
  					OC.Share.hideDropDown(function () {
  						$(tr).addClass('mouseOver');
31b7f2792   Kload   Upgrade to ownclo...
38
  						OC.Share.showDropDown(itemType, $(tr).data('id'), appendTo, true, possiblePermissions, filename);
03e52840d   Kload   Init
39
40
41
42
43
44
  					});
  				} else {
  					OC.Share.hideDropDown();
  				}
  			} else {
  				$(tr).addClass('mouseOver');
31b7f2792   Kload   Upgrade to ownclo...
45
  				OC.Share.showDropDown(itemType, $(tr).data('id'), appendTo, true, possiblePermissions, filename);
03e52840d   Kload   Init
46
47
48
49
  			}
  		});
  	}
  });