summaryrefslogtreecommitdiffstats
path: root/core/js/share.js
diff options
context:
space:
mode:
Diffstat (limited to 'core/js/share.js')
-rw-r--r--core/js/share.js50
1 files changed, 29 insertions, 21 deletions
diff --git a/core/js/share.js b/core/js/share.js
index 0c6d39e446c..bcc04225b9f 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -7,24 +7,31 @@ OC.Share={
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.
+ * 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.
*
* @param itemType item type
* @param fileList file list instance, defaults to OCA.Files.App.fileList
*/
loadIcons:function(itemType, fileList) {
// 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;
- });
- OC.Share.updateIcons(itemType, fileList);
+ $.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;
+ });
+ OC.Share.updateIcons(itemType, fileList);
+ }
}
- });
+ );
},
/**
* Updates the files' "Share" icons according to the known
@@ -202,19 +209,20 @@ OC.Share={
itemSourceName: itemSourceName,
expirationDate: expirationDate
}, function (result) {
- if (result && result.status === 'success') {
- if (callback) {
- callback(result.data);
- }
- } else {
- if (result.data && result.data.message) {
- var msg = result.data.message;
+ if (result && result.status === 'success') {
+ if (callback) {
+ callback(result.data);
+ }
} else {
- var msg = t('core', 'Error');
+ if (result.data && result.data.message) {
+ var msg = result.data.message;
+ } else {
+ var msg = t('core', 'Error');
+ }
+ OC.dialogs.alert(msg, t('core', 'Error while sharing'));
}
- OC.dialogs.alert(msg, t('core', 'Error while sharing'));
}
- });
+ );
},
unshare:function(itemType, itemSource, shareType, shareWith, callback) {
$.post(OC.filePath('core', 'ajax', 'share.php'), { action: 'unshare', itemType: itemType, itemSource: itemSource, shareType: shareType, shareWith: shareWith }, function(result) {