proper handling of the "can edit" label depending on basic_edit_options and JS-enabled/disabled in part.internalshare; comments in part.linkshare
parent
2ec72feab9
commit
5d5cb244bb
|
@ -683,7 +683,7 @@ Calendar={
|
|||
$(document)
|
||||
.off('change', '.shared-with-entry-container input:checkbox[data-permissions]')
|
||||
.on('change', '.shared-with-entry-container input:checkbox[data-permissions]', function(){
|
||||
|
||||
console.log('PERMISSION CHECKBOX CHANGE')
|
||||
// get the data
|
||||
var container = $(this).parents('li').first();
|
||||
var permissions = parseInt(container.attr('data-permissions'));
|
||||
|
@ -703,6 +703,27 @@ Calendar={
|
|||
// save current permissions on the container
|
||||
container.attr('data-permissions', permissions);
|
||||
|
||||
// set statuses of all the checkboxes
|
||||
switch ($(this).attr('name')) {
|
||||
case 'create':
|
||||
case 'update':
|
||||
case 'delete':
|
||||
console.log('CREATE-UPDATE-DELETE: ' + permissions)
|
||||
$(this)
|
||||
.parents('.share-options')
|
||||
.find('input[type="checkbox"][name="edit"]')
|
||||
.prop('checked', permissions & ( OC.PERMISSION_CREATE | OC.PERMISSION_UPDATE | OC.PERMISSION_DELETE ) )
|
||||
break;
|
||||
case 'edit':
|
||||
console.log('EDIT: ' + permissions)
|
||||
$(this)
|
||||
.parents('.share-options')
|
||||
.find('input[type="checkbox"][name="create"]').prop('checked', permissions & OC.PERMISSION_CREATE )
|
||||
.siblings('input[type="checkbox"][name="update"]').prop('checked', permissions & OC.PERMISSION_UPDATE )
|
||||
.siblings('input[type="checkbox"][name="delete"]').prop('checked', permissions & OC.PERMISSION_DELETE )
|
||||
break;
|
||||
}
|
||||
|
||||
// run the request
|
||||
OC.Share.setPermissions(itemType, itemSource, shareType, shareWith, permissions);
|
||||
});
|
||||
|
|
|
@ -53,16 +53,34 @@
|
|||
otherwise the noscript tag makes space for a CSS/HTML "checkbox" showing the state of the create/update/delete checkboxes
|
||||
-->
|
||||
<noscript class="share-can-edit-space"><!--</noscript>
|
||||
|
||||
<input type="checkbox" class="permissions"
|
||||
<?php if(empty($_['basic_edit_options'])): ?>
|
||||
name="edit" data-permissions="<?php p(OCP\PERMISSION_UPDATE | OCP\PERMISSION_CREATE | OCP\PERMISSION_DELETE); ?>" <?php if ($sharee['permissions'] & (OCP\PERMISSION_UPDATE | OCP\PERMISSION_CREATE | OCP\PERMISSION_DELETE ) ): ?> checked="checked"<?php endif; ?>
|
||||
name="edit" data-permissions="<?php p(OCP\PERMISSION_UPDATE | OCP\PERMISSION_CREATE | OCP\PERMISSION_DELETE); ?>" <?php if ($sharee['permissions'] & (OCP\PERMISSION_UPDATE | OCP\PERMISSION_CREATE | OCP\PERMISSION_DELETE ) ): ?> checked="checked"<?php endif; ?> id="share-collective-edit-<?php p($_['item_type']); ?>-<?php p($_['item_id']); ?>-<?php p($i); ?>"
|
||||
<?php else: ?>
|
||||
name="update" data-permissions="<?php p(OCP\PERMISSION_UPDATE); ?>" <?php if ($sharee['permissions'] & OCP\PERMISSION_UPDATE): ?> checked="checked"<?php endif; ?> id="share-can-edit-<?php p($_['item_type']); ?>-<?php p($_['item_id']); ?>-<?php p($i); ?>"
|
||||
<?php endif; ?>
|
||||
/>
|
||||
<noscript>--></noscript>
|
||||
<!-- "can edit" displayable-control label -->
|
||||
<label for="share-can-edit-<?php p($_['item_type']); ?>-<?php p($_['item_id']); ?>-<?php p($i); ?>"><?php p($l->t('can edit')); ?><?php if(empty($_['basic_edit_options'])): ?><img class="svg" alt="access control" src="<?php p(OCP\Util::imagePath('core', 'actions/triangle-s.svg')); ?>"><?php endif; ?></label>
|
||||
|
||||
<?php /* "can edit" label for the above share-can-edit checkbox */ ?>
|
||||
<label
|
||||
<?php if(empty($_['basic_edit_options'])): ?>
|
||||
for="share-collective-edit-<?php p($_['item_type']); ?>-<?php p($_['item_id']); ?>-<?php p($i); ?>"
|
||||
<?php else: ?>
|
||||
for="share-can-edit-<?php p($_['item_type']); ?>-<?php p($_['item_id']); ?>-<?php p($i); ?>"
|
||||
<?php endif; ?>
|
||||
><?php p($l->t('can edit')); ?></label>
|
||||
|
||||
<noscript>-->
|
||||
<!-- "can edit" displayable-control label OR if basic_edit_options a label for the above share-can-edit checkbox -->
|
||||
<label for="share-can-edit-<?php p($_['item_type']); ?>-<?php p($_['item_id']); ?>-<?php p($i); ?>"><?php p($l->t('can edit')); ?></label>
|
||||
</noscript>
|
||||
|
||||
<!-- "can edit triangle" displayable-control label - not needed when only basic edit options are available -->
|
||||
<?php if(empty($_['basic_edit_options'])): ?>
|
||||
<label for="share-can-edit-<?php p($_['item_type']); ?>-<?php p($_['item_id']); ?>-<?php p($i); ?>"><?php if(empty($_['basic_edit_options'])): ?><img class="svg" alt="access control" src="<?php p(OCP\Util::imagePath('core', 'actions/triangle-s.svg')); ?>"><?php endif; ?></label>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- "can share" label and checkbox -->
|
||||
<label class="share-label"><input type="checkbox" name="share" class="permissions" data-permissions="<?php p(OCP\PERMISSION_SHARE); ?>" <?php if ($sharee['permissions'] & OCP\PERMISSION_SHARE): ?> checked="checked"<?php endif; ?>><?php p($l->t('can share')); ?></label>
|
||||
<!-- if we only have basic edit options available, there is no need for the advanced edit options controls, right? display these only when not in basic edit options regime -->
|
||||
|
|
|
@ -8,9 +8,13 @@
|
|||
data-item="<?php p($_['item_id']); ?>"
|
||||
data-possible-permissions="<?php p($_['permissions']) ?>"
|
||||
data-link="true">
|
||||
<!-- the checkbox that enables and disables the whole thing -->
|
||||
<!--
|
||||
TODO: prepare backend for direct submission, then fill-in the details of the form;
|
||||
if JS is disabled, the submit button will be available, automagically
|
||||
-->
|
||||
<form>
|
||||
<h3><?php p($l->t('Share via link')); ?></h3>
|
||||
<!-- the checkbox that enables and disables the whole thing -->
|
||||
<input type="checkbox" name="share-link" class="share-link displayable-control" value="0" id="share-link-<?php p($_['item_type']); ?>-<?php p($_['item_id']); ?>" <?php if (isset($_['link_share']['token'])): ?> checked="checked"<?php endif; ?>/>
|
||||
<label for="share-link-<?php p($_['item_type']); ?>-<?php p($_['item_id']); ?>"><?php p($l->t('Share link')) ?></label>
|
||||
<!-- this should be visible only when the share-link checkbox is :checked -->
|
||||
|
@ -38,7 +42,7 @@
|
|||
<input class="share-link-e-mail-address" value="" placeholder="<?php p($l->t('Email link to person')) ?>" type="e-mail"/>
|
||||
<!-- the send e-mail submit button (unneeded and invisible if JS is disabled) -->
|
||||
<noscript><!--</noscript>
|
||||
<input class="share-link-e-mail-send" type="submit" value="<?php p($l->t('Send')) ?>"/>
|
||||
<input class="share-link-e-mail-send" type="submit" name="send-e-mail" value="<?php p($l->t('Send')) ?>"/>
|
||||
<noscript>--></noscript>
|
||||
</div>
|
||||
<!-- the submit button (unneeded and invisible if JS is enabled) -->
|
||||
|
|
Loading…
Reference in New Issue