Change the share file action icon if the file is already shared with someone

This commit is contained in:
Michael Gapczynski 2011-08-12 11:34:17 -04:00
parent d78b75a0d1
commit a8e6be6016
2 changed files with 22 additions and 4 deletions

View File

@ -4,5 +4,5 @@
-moz-border-radius-bottomright:1em; -webkit-border-bottom-right-radius:1em; border-bottom-right-radius:1em; }
#shared_list { padding:0.5em; list-style-type: none; }
#public { border-top:1px solid #ddd; padding-top:0.5em; }
a.unshare { float:right; display:inline; margin:0 .5em; padding:.3em .3em 0 .3em !important; }
a.unshare:hover { background:#fff; -moz-box-shadow:0 0 10px #fff; -webkit-box-shadow:0 0 10px #fff; box-shadow:0 0 10px #fff; -moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px; }
a.unshare { float:right; display:inline; margin:0 .5em; padding:.3em .3em 0 .3em !important; opacity:.5; }
a.unshare:hover { opacity:1; }

View File

@ -1,7 +1,25 @@
$(document).ready(function() {
if (typeof FileActions !== 'undefined') {
FileActions.register('all', 'Share', OC.imagePath('core', 'actions/share'), function(filename) {
if (($('#dropdown').length)) {
FileActions.register('all', 'Share', function(filename) {
var icon;
var file = $('#dir').val()+'/'+filename;
$.ajax({
type: 'GET',
url: OC.linkTo('files_sharing', 'ajax/getitem.php'),
dataType: 'json',
data: 'source='+file,
async: false,
success: function(users) {
if (users.length > 0) {
icon = OC.imagePath('core', 'actions/shared');
} else {
icon = OC.imagePath('core', 'actions/share');
}
}
});
return icon;
}, function(filename) {
if (($('#dropdown').length > 0)) {
$('#dropdown').hide('blind', function() {
var dropdownFile = $('#dropdown').data('file')
var file = $('#dir').val()+'/'+filename;