nextcloud/apps/calendar/templates/share.dropdown.php

77 lines
4.0 KiB
PHP
Raw Normal View History

2012-02-05 00:23:31 +04:00
<?php
if(array_key_exists('calid', $_)){
$id = $_['calid'];
$sharedelements = OC_Calendar_Share::allUsersSharedwith($_['calid'], OC_Calendar_Share::CALENDAR);
}else{
$sharedelements = OC_Calendar_Share::allUsersSharedwith($_['eventid'], OC_Calendar_Share::EVENT);
$id = $_['eventid'];
}
2012-02-05 00:23:31 +04:00
$users = array();$groups = array();$public = array();
foreach($sharedelements as $sharedelement){
if($sharedelement['sharetype'] == 'user'){
$users[] = $sharedelement;
}elseif($sharedelement['sharetype'] == 'group'){
$groups[] = $sharedelement;
}elseif($sharedelement['sharetype'] == 'public'){
$public = $sharedelement;
2012-02-05 00:23:31 +04:00
}
}
?>
<strong><?php echo $l->t('Users');?>:</strong><br>
<select id="share_user" title="<?php echo $l->t('select users');?>" data-placeholder="<?php echo $l->t('select users'); ?>">
2012-04-14 05:49:24 +04:00
<option value=""></option>
2012-02-05 00:23:31 +04:00
<?php
2012-05-01 20:50:31 +04:00
$allocusers = OCP\USER::getUsers();
2012-02-05 00:23:31 +04:00
$allusers = array();
foreach($allocusers as $ocuser){
$allusers[$ocuser] = $ocuser;
}
2012-05-01 20:50:31 +04:00
unset($allusers[OCP\USER::getUser()]);
2012-02-05 00:23:31 +04:00
$allusers = array_flip($allusers);
2012-05-07 01:00:36 +04:00
echo OCP\html_select_options($allusers, array());
2012-02-05 00:23:31 +04:00
?>
</select><br>
<ul id="sharewithuser_list">
<?php foreach($users as $user): ?>
<li id="sharewithuser_<?php echo $user['share']; ?>"><input type="checkbox" width="12px" <?php echo ($user['permissions']?'checked="checked"':'')?> style="visibility:hidden;" title="<?php echo $l->t('Editable'); ?>"><?php echo $user['share']; ?><img src="<?php echo OCP\Util::imagePath('core', 'actions/delete.svg'); ?>" class="svg action" style="display:none;float:right;"></li>
2012-02-05 00:23:31 +04:00
<script>
$('#sharewithuser_<?php echo $user['share']; ?> > img').click(function(){
$('#share_user option[value="<?php echo $user['share']; ?>"]').removeAttr('disabled');
2012-04-14 05:49:24 +04:00
Calendar.UI.Share.unshare(<?php echo $id; ?>, '<?php echo (array_key_exists('calid', $_)?'calendar':'event');?>', '<?php echo $user['share']; ?>', 'user');
2012-02-05 00:23:31 +04:00
$('#sharewithuser_<?php echo $user['share']; ?>').remove();
$("#share_user").trigger("liszt:updated");
});
$('#share_user option[value="<?php echo $user['share']; ?>"]').attr('disabled', 'disabled');
</script>
<?php endforeach; ?>
</ul>
<strong><?php echo $l->t('Groups');?>:</strong><br>
<select id="share_group" title="<?php echo $l->t('select groups');?>" data-placeholder="<?php echo $l->t('select groups'); ?>">
<option value=""></option>
<?php
$allocgroups = OC_Group::getGroups();
$allgroups = array();
foreach($allocgroups as $ocgroup){
$allgroups[$ocgroup] = $ocgroup;
}
2012-05-07 01:00:36 +04:00
echo OCP\html_select_options($allgroups, array());
2012-02-05 00:23:31 +04:00
?>
</select><br>
<ul id="sharewithgroup_list">
<?php foreach($groups as $group): ?>
<li id="sharewithgroup_<?php echo $group['share']; ?>"><input type="checkbox" width="12px" <?php echo ($group['permissions']?'checked="checked"':'')?> style="visibility:hidden;" title="<?php echo $l->t('Editable'); ?>"><?php echo $group['share']; ?><img src="<?php echo OCP\Util::imagePath('core', 'actions/delete.svg'); ?>" class="svg action" style="display:none;float:right;"></li>
2012-02-05 00:23:31 +04:00
<script>
$('#sharewithgroup_<?php echo $group['share']; ?> > img').click(function(){
$('#share_group option[value="<?php echo $group['share']; ?>"]').removeAttr('disabled');
Calendar.UI.Share.unshare(<?php echo $id; ?>, '<?php echo (array_key_exists('calid', $_)?'calendar':'event');?>', '<?php echo $group['share']; ?>', 'group');
2012-02-05 00:23:31 +04:00
$('#sharewithgroup_<?php echo $group['share']; ?>').remove();
$("#share_group").trigger("liszt:updated");
});
$('#share_group option[value="<?php echo $group['share']; ?>"]').attr('disabled', 'disabled');
</script>
<?php endforeach; ?>
</ul>
<div id="public">
2012-05-13 14:14:08 +04:00
<input type="checkbox" id="publish" <?php echo (array_key_exists('share', $public))?'checked="checked"':'' ?>><label for="publish"><?php echo $l->t('make public'); ?></label><br>
<input type="text" id="public_token" value="<?php if(array_key_exists('share', $public)){echo OCP\Util::linkToAbsolute('', 'public.php').'?service=calendar&t=' . $public['share']; } ?>" onmouseover="$('#public_token').select();" style="<?php echo (!array_key_exists('share', $public))?'display:none':'' ?>">
</div>