diff options
author | Morris Jobke <morris.jobke@gmail.com> | 2013-10-29 18:33:23 +0400 |
---|---|---|
committer | Morris Jobke <morris.jobke@gmail.com> | 2013-10-29 18:33:23 +0400 |
commit | 7223b5acceba1097fa1e983850f3a2652781ee4d (patch) | |
tree | c102d67fd0e7058ef50482bb0f77617c77b91475 /core | |
parent | b0b76fe064860d2074c91897a29e0f9ac5705db8 (diff) | |
parent | b56c936212fac36a6f67b978a5323ffc2507f610 (diff) |
Merge pull request #5396 from owncloud/fix-sharing-code
Fix sharing error message - id -> file name
Diffstat (limited to 'core')
-rw-r--r-- | core/ajax/share.php | 3 | ||||
-rw-r--r-- | core/js/share.js | 32 |
2 files changed, 25 insertions, 10 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php index 0dacc17d3a5..be02c056357 100644 --- a/core/ajax/share.php +++ b/core/ajax/share.php @@ -41,7 +41,8 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo $_POST['itemSource'], $shareType, $shareWith, - $_POST['permissions'] + $_POST['permissions'], + $_POST['itemSourceName'] ); if (is_string($token)) { diff --git a/core/js/share.js b/core/js/share.js index ff557652b67..c53fa4110b5 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -136,8 +136,17 @@ OC.Share={ return data; }, - share:function(itemType, itemSource, shareType, shareWith, permissions, callback) { - $.post(OC.filePath('core', 'ajax', 'share.php'), { action: 'share', itemType: itemType, itemSource: itemSource, shareType: shareType, shareWith: shareWith, permissions: permissions }, function(result) { + share:function(itemType, itemSource, shareType, shareWith, permissions, itemSourceName, callback) { + $.post(OC.filePath('core', 'ajax', 'share.php'), + { + action: 'share', + itemType: itemType, + itemSource: itemSource, + shareType: shareType, + shareWith: shareWith, + permissions: permissions, + itemSourceName: itemSourceName + }, function (result) { if (result && result.status === 'success') { if (callback) { callback(result.data); @@ -170,9 +179,9 @@ OC.Share={ } }); }, - showDropDown:function(itemType, itemSource, appendTo, link, possiblePermissions) { + showDropDown:function(itemType, itemSource, appendTo, link, possiblePermissions, filename) { var data = OC.Share.loadItem(itemType, itemSource); - var html = '<div id="dropdown" class="drop" data-item-type="'+itemType+'" data-item-source="'+itemSource+'">'; + var html = '<div id="dropdown" class="drop" data-item-type="'+itemType+'" data-item-source="'+itemSource+'"" data-item-source-name="'+filename+'">'; if (data !== false && data.reshare !== false && data.reshare.uid_owner !== undefined) { if (data.reshare.share_type == OC.Share.SHARE_TYPE_GROUP) { html += '<span class="reshare">'+t('core', 'Shared with you and the group {group} by {owner}', {group: escapeHTML(data.reshare.share_with), owner: escapeHTML(data.reshare.displayname_owner)})+'</span>'; @@ -276,12 +285,13 @@ OC.Share={ event.stopPropagation(); var itemType = $('#dropdown').data('item-type'); var itemSource = $('#dropdown').data('item-source'); + var itemSourceName = $('#dropdown').data('item-source-name'); var shareType = selected.item.value.shareType; var shareWith = selected.item.value.shareWith; $(this).val(shareWith); // Default permissions are Edit (CRUD) and Share var permissions = OC.PERMISSION_ALL; - OC.Share.share(itemType, itemSource, shareType, shareWith, permissions, function() { + OC.Share.share(itemType, itemSource, shareType, shareWith, permissions, itemSourceName, function() { OC.Share.addShareWith(shareType, shareWith, selected.item.label, permissions, possiblePermissions); $('#shareWith').val(''); OC.Share.updateIcon(itemType, itemSource); @@ -573,9 +583,10 @@ $(document).ready(function() { $(document).on('change', '#dropdown #linkCheckbox', function() { var itemType = $('#dropdown').data('item-type'); var itemSource = $('#dropdown').data('item-source'); + var itemSourceName = $('#dropdown').data('item-source-name'); if (this.checked) { // Create a link - OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', OC.PERMISSION_READ, function(data) { + OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', OC.PERMISSION_READ, itemSourceName, function(data) { OC.Share.showLink(data.token, null, itemSource); OC.Share.updateIcon(itemType, itemSource); }); @@ -604,6 +615,7 @@ $(document).ready(function() { var allowPublicUpload = $(this).is(':checked'); var itemType = $('#dropdown').data('item-type'); var itemSource = $('#dropdown').data('item-source'); + var itemSourceName = $('#dropdown').data('item-source-name'); var permissions = 0; // Calculate permissions @@ -614,7 +626,7 @@ $(document).ready(function() { } // Update the share information - OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', permissions, function(data) { + OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', permissions, itemSourceName, function(data) { }); }); @@ -623,6 +635,7 @@ $(document).ready(function() { if (!$('#showPassword').is(':checked') ) { var itemType = $('#dropdown').data('item-type'); var itemSource = $('#dropdown').data('item-source'); + var itemSourceName = $('#dropdown').data('item-source-name'); var allowPublicUpload = $('#sharingDialogAllowPublicUpload').is(':checked'); var permissions = 0; @@ -634,7 +647,7 @@ $(document).ready(function() { } - OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', permissions); + OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', permissions, itemSourceName); } else { $('#linkPassText').focus(); } @@ -648,6 +661,7 @@ $(document).ready(function() { var dropDown = $('#dropdown'); var itemType = dropDown.data('item-type'); var itemSource = dropDown.data('item-source'); + var itemSourceName = $('#dropdown').data('item-source-name'); var permissions = 0; // Calculate permissions @@ -657,7 +671,7 @@ $(document).ready(function() { permissions = OC.PERMISSION_READ; } - OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, $('#linkPassText').val(), permissions, function() { + OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, $('#linkPassText').val(), permissions, itemSourceName, function() { console.log("password set to: '" + linkPassText.val() +"' by event: " + event.type); linkPassText.val(''); linkPassText.attr('placeholder', t('core', 'Password protected')); |