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:
authorRoman Geber <rgeber@owncloudapps.com>2013-06-25 14:24:14 +0400
committerThomas Müller <thomas.mueller@tmit.eu>2013-07-01 21:38:15 +0400
commita987f9f4cf84f9ae7e1cf413637fe084c3db0e8b (patch)
treed32989c944d1603f2971ab0147c6b0e662553b77 /core
parent9e5983c5693e69146cb5ca7d374989f7158202ea (diff)
Public upload feature
Conflicts: apps/files/js/filelist.js
Diffstat (limited to 'core')
-rw-r--r--core/js/share.js43
1 files changed, 42 insertions, 1 deletions
diff --git a/core/js/share.js b/core/js/share.js
index 59d44880c2f..38c7a30d721 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -156,6 +156,19 @@ OC.Share={
html += '<br />';
}
if (possiblePermissions & OC.PERMISSION_SHARE) {
+ // Determine the Allow Public Upload status.
+ // Used later on to determine if the
+ // respective checkbox should be checked or
+ // not.
+
+ var allowPublicUploadStatus = false;
+ $.each(data.shares, function(key, value) {
+ if (allowPublicUploadStatus) {
+ return true;
+ }
+ allowPublicUploadStatus = (value.permissions & OC.PERMISSION_CREATE) ? true : false;
+ });
+
html += '<input id="shareWith" type="text" placeholder="'+t('core', 'Share with')+'" />';
html += '<ul id="shareWithList">';
html += '</ul>';
@@ -168,12 +181,16 @@ OC.Share={
html += '<div id="linkPass">';
html += '<input id="linkPassText" type="password" placeholder="'+t('core', 'Password')+'" />';
html += '</div>';
- html += '</div>';
+ html += '<div id="allowPublicUploadWrapper" style="display:none;">';
+ html += '<input type="checkbox" value="1" name="allowPublicUpload" id="sharingDialogAllowPublicUpload"' + ((allowPublicUploadStatus) ? 'checked="checked"' : '') + ' />';
+ html += '<label for="sharingDialogAllowPublicUpload">' + t('core', 'Allow Public Upload') + '</label>';
+ html += '</div></div>';
html += '<form id="emailPrivateLink" >';
html += '<input id="email" style="display:none; width:62%;" value="" placeholder="'+t('core', 'Email link to person')+'" type="text" />';
html += '<input id="emailButton" style="display:none;" type="submit" value="'+t('core', 'Send')+'" />';
html += '</form>';
}
+
html += '<div id="expiration">';
html += '<input type="checkbox" name="expirationCheckbox" id="expirationCheckbox" value="1" /><label for="expirationCheckbox">'+t('core', 'Set expiration date')+'</label>';
html += '<input id="expirationDate" type="text" placeholder="'+t('core', 'Expiration date')+'" style="display:none; width:90%;" />';
@@ -359,6 +376,7 @@ OC.Share={
$('#expiration').show();
$('#emailPrivateLink #email').show();
$('#emailPrivateLink #emailButton').show();
+ $('#allowPublicUploadWrapper').show();
},
hideLink:function() {
$('#linkText').hide('blind');
@@ -367,6 +385,7 @@ OC.Share={
$('#linkPass').hide();
$('#emailPrivateLink #email').hide();
$('#emailPrivateLink #emailButton').hide();
+ $('#allowPublicUploadWrapper').hide();
},
dirname:function(path) {
return path.replace(/\\/g,'/').replace(/\/[^\/]*$/, '');
@@ -532,6 +551,28 @@ $(document).ready(function() {
$(this).select();
});
+ // Handle the Allow Public Upload Checkbox
+ $(document).on('click', '#sharingDialogAllowPublicUpload', function() {
+
+ // Gather data
+ var allowPublicUpload = $(this).is(':checked');
+ var itemType = $('#dropdown').data('item-type');
+ var itemSource = $('#dropdown').data('item-source');
+ var permissions = 0;
+
+ // Calculate permissions
+ if (allowPublicUpload) {
+ permissions = OC.PERMISSION_UPDATE + OC.PERMISSION_CREATE + OC.PERMISSION_READ;
+ } else {
+ permissions = OC.PERMISSION_READ;
+ }
+
+ // Update the share information
+ OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', permissions, function(data) {
+ return;
+ });
+ });
+
$(document).on('click', '#dropdown #showPassword', function() {
$('#linkPass').toggle('blind');
if (!$('#showPassword').is(':checked') ) {