summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorRoman Geber <rgeber@owncloudapps.com>2013-06-25 12:24:14 +0200
committerRoman Geber <rgeber@owncloudapps.com>2013-06-25 12:24:14 +0200
commitddb0ff346d3d8063f88fdba8749e098a81b92d54 (patch)
tree69004e69ed8ca2537d1029d9729d112feb6b5c20 /core
parentc3b8f2bf64ef7b6cbdabb382b1c0a721bddb4041 (diff)
downloadnextcloud-server-ddb0ff346d3d8063f88fdba8749e098a81b92d54.tar.gz
nextcloud-server-ddb0ff346d3d8063f88fdba8749e098a81b92d54.zip
Public upload feature
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 36e4babedf9..cb37dd70366 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%;" />';
@@ -370,6 +387,7 @@ OC.Share={
$('#expiration').show();
$('#emailPrivateLink #email').show();
$('#emailPrivateLink #emailButton').show();
+ $('#allowPublicUploadWrapper').show();
},
hideLink:function() {
$('#linkText').hide('blind');
@@ -378,6 +396,7 @@ OC.Share={
$('#linkPass').hide();
$('#emailPrivateLink #email').hide();
$('#emailPrivateLink #emailButton').hide();
+ $('#allowPublicUploadWrapper').hide();
},
dirname:function(path) {
return path.replace(/\\/g,'/').replace(/\/[^\/]*$/, '');
@@ -543,6 +562,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') ) {