if(img.call){
img=img(file);
}
- var html='<a href="#" original-title="' + t('files', 'Delete') + '" class="action delete" style="display:none" />';
+ // NOTE: Temporary fix to allow unsharing of files in root of Shared folder
+ if ($('#dir').val() == '/Shared') {
+ var html = '<a href="#" original-title="' + t('files', 'Unshare') + '" class="action delete" style="display:none" />';
+ } else {
+ var html='<a href="#" original-title="' + t('files', 'Delete') + '" class="action delete" style="display:none" />';
+ }
var element=$(html);
if(img){
element.append($('<img src="'+img+'"/>'));
return;
}
FileList.prepareDeletion(files);
- $('#notification').html(t('files', 'deleted')+' '+files+'<span class="undo">'+t('files', 'undo')+'</span>');
+ // NOTE: Temporary fix to change the text to unshared for files in root of Shared folder
+ if ($('#dir').val() == '/Shared') {
+ $('#notification').html(t('files', 'unshared')+' '+files+'<span class="undo">'+t('files', 'undo')+'</span>');
+ } else {
+ $('#notification').html(t('files', 'deleted')+' '+files+'<span class="undo">'+t('files', 'undo')+'</span>');
+ }
$('#notification').fadeIn();
},
finishDelete:function(ready,sync){
<th id="headerDate">
<span id="modified"><?php echo $l->t( 'Modified' ); ?></span>
<?php if ($_['permissions'] & OCP\Share::PERMISSION_DELETE): ?>
- <span class="selectedActions"><a href="" class="delete"><?php echo $l->t('Delete')?> <img class="svg" alt="<?php echo $l->t('Delete')?>" src="<?php echo OCP\image_path("core", "actions/delete.svg"); ?>" /></a></span>
+<!-- NOTE: Temporary fix to allow unsharing of files in root of Shared folder -->
+ <?php if ($_['dir'] == '/Shared'): ?>
+ <span class="selectedActions"><a href="" class="delete"><?php echo $l->t('Unshare')?> <img class="svg" alt="<?php echo $l->t('Unshare')?>" src="<?php echo OCP\image_path("core", "actions/delete.svg"); ?>" /></a></span>
+ <?php else: ?>
+ <span class="selectedActions"><a href="" class="delete"><?php echo $l->t('Delete')?> <img class="svg" alt="<?php echo $l->t('Delete')?>" src="<?php echo OCP\image_path("core", "actions/delete.svg"); ?>" /></a></span>
+ <?php endif; ?>
<?php endif; ?>
</th>
</tr>
// Remove Create permission if type is file
$file['permissions'] &= ~OCP\Share::PERMISSION_CREATE;
}
+ // NOTE: Temporary fix to allow unsharing of files in root of Shared directory
+ $file['permissions'] |= OCP\Share::PERMISSION_DELETE;
$files[] = $file;
}
return $files;
public function isDeletable($path) {
if ($path == '') {
- return false;
+ return true;
}
return ($this->getPermissions($path) & OCP\Share::PERMISSION_DELETE);
}
public function unlink($path) {
// Delete the file if DELETE permission is granted
- if (($source = $this->getSourcePath($path)) && $this->isDeletable($path)) {
- $storage = OC_Filesystem::getStorage($source);
- return $storage->unlink($this->getInternalPath($source));
+ if ($source = $this->getSourcePath($path)) {
+ if ($this->isDeletable($path)) {
+ $storage = OC_Filesystem::getStorage($source);
+ return $storage->unlink($this->getInternalPath($source));
+ } else if (dirname($path) == '/' || dirname($path) == '.') {
+ // Unshare the file from the user if in the root of the Shared folder
+ if ($this->is_dir($path)) {
+ $itemType = 'folder';
+ } else {
+ $itemType = 'file';
+ }
+ return OCP\Share::unshareFromSelf($itemType, $path);
+ }
}
return false;
}
// TODO
}
// Delete
- return self::delete($item['id'], true);
+ return self::delete($item['id']);
}
return false;
}
} else {
if ($itemType == 'file' || $itemType == 'folder') {
$where .= ' `file_target` = ?';
+ $item = \OC_Filesystem::normalizePath($item);
} else {
$where .= ' `item_target` = ?';
}