Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-10-23 20:39:37 +0400
committerThomas Müller <thomas.mueller@tmit.eu>2013-10-23 20:39:37 +0400
commit1317b7c03dbbd98165ef29b50aa26bb1dd283cba (patch)
tree1cbdf778789f17a948cf6f2e2d0242fdb5190fc9 /core
parent1909288fcb9231006ae7703422f046309635b4e2 (diff)
pass the name of the item source from the browser to the server - no need to get the data via complicated db queries
Diffstat (limited to 'core')
-rw-r--r--core/ajax/share.php3
-rw-r--r--core/js/share.js24
2 files changed, 21 insertions, 6 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 281cccaaef8..352ad4d4ca8 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);
@@ -588,6 +598,7 @@ $(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) {
@@ -619,6 +630,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
@@ -638,6 +650,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;
@@ -663,6 +676,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