|
43 | 43 | '</div>' + |
44 | 44 | ' {{/if}}' + |
45 | 45 | ' {{/if}}' + |
| 46 | + ' {{#if publicEditing}}' + |
| 47 | + '<div id="allowPublicEditingWrapper">' + |
| 48 | + ' <span class="icon-loading-small hidden"></span>' + |
| 49 | + ' <input type="checkbox" value="1" name="allowPublicEditing" id="sharingDialogAllowPublicEditing-{{cid}}" class="checkbox publicEditingCheckbox" {{{publicEditingChecked}}} />' + |
| 50 | + '<label for="sharingDialogAllowPublicEditing-{{cid}}">{{publicEditingLabel}}</label>' + |
| 51 | + '</div>' + |
| 52 | + ' {{/if}}' + |
46 | 53 | ' {{#if showPasswordCheckBox}}' + |
47 | 54 | '<input type="checkbox" name="showPassword" id="showPassword-{{cid}}" class="checkbox showPasswordCheckbox" {{#if isPasswordSet}}checked="checked"{{/if}} value="1" />' + |
48 | 55 | '<label for="showPassword-{{cid}}">{{enablePasswordLabel}}</label>' + |
|
87 | 94 | 'click .linkCheckbox': 'onLinkCheckBoxChange', |
88 | 95 | 'click .linkText': 'onLinkTextClick', |
89 | 96 | 'change .publicUploadCheckbox': 'onAllowPublicUploadChange', |
| 97 | + 'change .publicEditingCheckbox': 'onAllowPublicEditingChange', |
90 | 98 | 'change .hideFileListCheckbox': 'onHideFileListChange', |
91 | 99 | 'click .showPasswordCheckbox': 'onShowPasswordClick' |
92 | 100 | }, |
|
128 | 136 | 'onLinkTextClick', |
129 | 137 | 'onShowPasswordClick', |
130 | 138 | 'onHideFileListChange', |
131 | | - 'onAllowPublicUploadChange' |
| 139 | + 'onAllowPublicUploadChange', |
| 140 | + 'onAllowPublicEditingChange' |
132 | 141 | ); |
133 | 142 |
|
134 | 143 | var clipboard = new Clipboard('.clipboardButton'); |
|
266 | 275 | }); |
267 | 276 | }, |
268 | 277 |
|
| 278 | + onAllowPublicEditingChange: function() { |
| 279 | + var $checkbox = this.$('.publicEditingCheckbox'); |
| 280 | + $checkbox.siblings('.icon-loading-small').removeClass('hidden').addClass('inlineblock'); |
| 281 | + |
| 282 | + var permissions = OC.PERMISSION_READ; |
| 283 | + if($checkbox.is(':checked')) { |
| 284 | + permissions = OC.PERMISSION_UPDATE | OC.PERMISSION_READ; |
| 285 | + } |
| 286 | + |
| 287 | + this.model.saveLinkShare({ |
| 288 | + permissions: permissions |
| 289 | + }); |
| 290 | + }, |
| 291 | + |
269 | 292 | onHideFileListChange: function () { |
270 | 293 | var $checkbox = this.$('.hideFileListCheckbox'); |
271 | 294 | $checkbox.siblings('.icon-loading-small').removeClass('hidden').addClass('inlineblock'); |
|
307 | 330 | publicUploadChecked = 'checked="checked"'; |
308 | 331 | } |
309 | 332 |
|
| 333 | + var publicEditingChecked = ''; |
| 334 | + if(this.model.isPublicEditingAllowed()) { |
| 335 | + publicEditingChecked = 'checked="checked"'; |
| 336 | + } |
| 337 | + |
| 338 | + |
310 | 339 | var hideFileList = publicUploadChecked; |
311 | 340 |
|
312 | 341 | var hideFileListChecked = ''; |
|
320 | 349 | && ( !this.configModel.get('enforcePasswordForPublicLink') |
321 | 350 | || !this.model.get('linkShare').password); |
322 | 351 |
|
| 352 | + var publicEditable = |
| 353 | + !this.model.isFolder() |
| 354 | + && isLinkShare |
| 355 | + && this.model.updatePermissionPossible(); |
| 356 | + |
323 | 357 | this.$el.html(linkShareTemplate({ |
324 | 358 | cid: this.cid, |
325 | 359 | shareAllowed: true, |
|
337 | 371 | publicUploadChecked: publicUploadChecked, |
338 | 372 | hideFileListChecked: hideFileListChecked, |
339 | 373 | publicUploadLabel: t('core', 'Allow upload and editing'), |
| 374 | + publicEditing: publicEditable, |
| 375 | + publicEditingChecked: publicEditingChecked, |
| 376 | + publicEditingLabel: t('core', 'Allow editing'), |
340 | 377 | hideFileListLabel: t('core', 'File drop (upload only)'), |
341 | 378 | mailPrivatePlaceholder: t('core', 'Email link to person'), |
342 | 379 | mailButtonText: t('core', 'Send') |
|
0 commit comments