summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
m---------3rdparty0
-rw-r--r--apps/files/js/file-upload.js2
-rw-r--r--apps/files/js/fileactions.js12
-rw-r--r--apps/files/js/filelist.js4
-rw-r--r--apps/files_sharing/js/share.js14
-rw-r--r--core/js/share.js97
-rw-r--r--lib/private/connector/sabre/server.php (renamed from lib/connector/sabre/server.php)0
-rw-r--r--lib/private/preview/movies.php2
-rw-r--r--lib/private/preview/office.php6
9 files changed, 87 insertions, 50 deletions
diff --git a/3rdparty b/3rdparty
-Subproject 98fdc3a4e2f56f7d231470418222162dbf95f46
+Subproject 42efd966284debadf83b761367e529bc45f806d
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js
index d0dbd65eaee..fefb06a8ac5 100644
--- a/apps/files/js/file-upload.js
+++ b/apps/files/js/file-upload.js
@@ -539,7 +539,7 @@ $(document).ready(function() {
lazyLoadPreview(path, result.data.mime, function(previewpath){
tr.find('td.filename').attr('style','background-image:url('+previewpath+')');
});
- FileActions.display(tr.find('td.filename'));
+ FileActions.display(tr.find('td.filename'), true);
} else {
OC.dialogs.alert(result.data.message, t('core', 'Error'));
}
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index e14e52eb6ca..03e23189a97 100644
--- a/apps/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
@@ -61,7 +61,13 @@ var FileActions = {
var actions = this.get(mime, type, permissions);
return actions[name];
},
- display: function (parent) {
+ /**
+ * Display file actions for the given element
+ * @param parent "td" element of the file for which to display actions
+ * @param triggerEvent if true, triggers the fileActionsReady on the file
+ * list afterwards (false by default)
+ */
+ display: function (parent, triggerEvent) {
FileActions.currentFile = parent;
var actions = FileActions.get(FileActions.getCurrentMimeType(), FileActions.getCurrentType(), FileActions.getCurrentPermissions());
var file = FileActions.getCurrentFile();
@@ -137,6 +143,10 @@ var FileActions = {
element.on('click', {a: null, elem: parent, actionFunc: actions['Delete']}, actionHandler);
parent.parent().children().last().append(element);
}
+
+ if (triggerEvent){
+ $('#fileList').trigger(jQuery.Event("fileActionsReady"));
+ }
},
getCurrentFile: function () {
return FileActions.currentFile.parent().attr('data-file');
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index e7edd2cf388..84ff1093253 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -151,7 +151,7 @@ var FileList={
if (hidden) {
tr.hide();
}
- FileActions.display(tr.find('td.filename'));
+ FileActions.display(tr.find('td.filename'), true);
return tr;
},
/**
@@ -817,7 +817,7 @@ $(document).ready(function(){
data.context.attr('data-permissions', file.permissions);
data.context.data('permissions', file.permissions);
}
- FileActions.display(data.context.find('td.filename'));
+ FileActions.display(data.context.find('td.filename'), true);
var path = getPathForPreview(file.name);
lazyLoadPreview(path, file.mime, function(previewpath){
diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js
index 03ed02f41ef..68f6f3ba76f 100644
--- a/apps/files_sharing/js/share.js
+++ b/apps/files_sharing/js/share.js
@@ -1,11 +1,19 @@
$(document).ready(function() {
- var disableSharing = $('#disableSharing').data('status');
+ var disableSharing = $('#disableSharing').data('status'),
+ sharesLoaded = false;
if (typeof OC.Share !== 'undefined' && typeof FileActions !== 'undefined' && !disableSharing) {
-
$('#fileList').on('fileActionsReady',function(){
- OC.Share.loadIcons('file');
+ 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) {
diff --git a/core/js/share.js b/core/js/share.js
index b472797b3cd..270eab356e1 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -4,57 +4,76 @@ OC.Share={
SHARE_TYPE_LINK:3,
SHARE_TYPE_EMAIL:4,
itemShares:[],
- statuses:[],
+ statuses:{},
droppedDown:false,
+ /**
+ * Loads ALL share statuses from server, stores them in OC.Share.statuses then
+ * calls OC.Share.updateIcons() to update the files "Share" icon to "Shared"
+ * according to their share status and share type.
+ */
loadIcons:function(itemType) {
// Load all share icons
$.get(OC.filePath('core', 'ajax', 'share.php'), { fetch: 'getItemsSharedStatuses', itemType: itemType }, function(result) {
if (result && result.status === 'success') {
+ OC.Share.statuses = {};
$.each(result.data, function(item, data) {
OC.Share.statuses[item] = data;
- var hasLink = data['link'];
- // Links override shared in terms of icon display
- if (hasLink) {
- var image = OC.imagePath('core', 'actions/public');
- } else {
- var image = OC.imagePath('core', 'actions/shared');
- }
- if (itemType != 'file' && itemType != 'folder') {
- $('a.share[data-item="'+item+'"]').css('background', 'url('+image+') no-repeat center');
- } else {
- var file = $('tr[data-id="'+item+'"]');
- if (file.length > 0) {
- var action = $(file).find('.fileactions .action[data-action="Share"]');
- var img = action.find('img').attr('src', image);
- action.addClass('permanent');
- action.html(' '+t('core', 'Shared')).prepend(img);
- } else {
- var dir = $('#dir').val();
- if (dir.length > 1) {
- var last = '';
- var path = dir;
- // Search for possible parent folders that are shared
- while (path != last) {
- if (path == data['path']) {
- var actions = $('.fileactions .action[data-action="Share"]');
- $.each(actions, function(index, action) {
- var img = $(action).find('img');
- if (img.attr('src') != OC.imagePath('core', 'actions/public')) {
- img.attr('src', image);
- $(action).addClass('permanent');
- $(action).html(' '+t('core', 'Shared')).prepend(img);
- }
- });
+ });
+ OC.Share.updateIcons(itemType);
+ }
+ });
+ },
+ /**
+ * Updates the files' "Share" icons according to the known
+ * sharing states stored in OC.Share.statuses.
+ * (not reloaded from server)
+ */
+ updateIcons:function(itemType){
+ var item;
+ for (item in OC.Share.statuses){
+ var data = OC.Share.statuses[item];
+
+ var hasLink = data['link'];
+ // Links override shared in terms of icon display
+ if (hasLink) {
+ var image = OC.imagePath('core', 'actions/public');
+ } else {
+ var image = OC.imagePath('core', 'actions/shared');
+ }
+ if (itemType != 'file' && itemType != 'folder') {
+ $('a.share[data-item="'+item+'"]').css('background', 'url('+image+') no-repeat center');
+ } else {
+ var file = $('tr[data-id="'+item+'"]');
+ if (file.length > 0) {
+ var action = $(file).find('.fileactions .action[data-action="Share"]');
+ var img = action.find('img').attr('src', image);
+ action.addClass('permanent');
+ action.html(' '+t('core', 'Shared')).prepend(img);
+ } else {
+ var dir = $('#dir').val();
+ if (dir.length > 1) {
+ var last = '';
+ var path = dir;
+ // Search for possible parent folders that are shared
+ while (path != last) {
+ if (path == data['path']) {
+ var actions = $('.fileactions .action[data-action="Share"]');
+ $.each(actions, function(index, action) {
+ var img = $(action).find('img');
+ if (img.attr('src') != OC.imagePath('core', 'actions/public')) {
+ img.attr('src', image);
+ $(action).addClass('permanent');
+ $(action).html(' '+t('core', 'Shared')).prepend(img);
}
- last = path;
- path = OC.Share.dirname(path);
- }
+ });
}
+ last = path;
+ path = OC.Share.dirname(path);
}
}
- });
+ }
}
- });
+ }
},
updateIcon:function(itemType, itemSource) {
var shares = false;
diff --git a/lib/connector/sabre/server.php b/lib/private/connector/sabre/server.php
index 41e8885917a..41e8885917a 100644
--- a/lib/connector/sabre/server.php
+++ b/lib/private/connector/sabre/server.php
diff --git a/lib/private/preview/movies.php b/lib/private/preview/movies.php
index dc50d160346..4d85e23c63c 100644
--- a/lib/private/preview/movies.php
+++ b/lib/private/preview/movies.php
@@ -11,7 +11,7 @@ namespace OC\Preview;
// movie preview is currently not supported on Windows
if (!\OC_Util::runningOnWindows()) {
$isShellExecEnabled = !in_array('shell_exec', explode(', ', ini_get('disable_functions')));
- $whichAVCONV = shell_exec('which avconv');
+ $whichAVCONV = ($isShellExecEnabled ? shell_exec('which avconv') : '');
$isAVCONVAvailable = !empty($whichAVCONV);
if($isShellExecEnabled && $isAVCONVAvailable) {
diff --git a/lib/private/preview/office.php b/lib/private/preview/office.php
index 673b16edc19..318ab51f851 100644
--- a/lib/private/preview/office.php
+++ b/lib/private/preview/office.php
@@ -9,11 +9,11 @@
if (extension_loaded('imagick')) {
$isShellExecEnabled = !in_array('shell_exec', explode(', ', ini_get('disable_functions')));
- // movie preview is currently not supported on Windows
+ // LibreOffice preview is currently not supported on Windows
if (!\OC_Util::runningOnWindows()) {
- $whichLibreOffice = shell_exec('which libreoffice');
+ $whichLibreOffice = ($isShellExecEnabled ? shell_exec('which libreoffice') : '');
$isLibreOfficeAvailable = !empty($whichLibreOffice);
- $whichOpenOffice = shell_exec('which libreoffice');
+ $whichOpenOffice = ($isShellExecEnabled ? shell_exec('which libreoffice') : '');
$isOpenOfficeAvailable = !empty($whichOpenOffice);
//let's see if there is libreoffice or openoffice on this machine
if($isShellExecEnabled && ($isLibreOfficeAvailable || $isOpenOfficeAvailable || is_string(\OC_Config::getValue('preview_libreoffice_path', null)))) {