Welcome to mirror list, hosted at ThFree Co, Russian Federation.

share.dropdown.php « templates « calendar « apps - github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b11a4ef94cf98628c1bc3e9630b825c474bbb263 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?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'];
}
$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;
	}
}
?>
<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'); ?>">
<option value=""></option>
<?php
$allocusers = OCP\USER::getUsers();
$allusers = array();
foreach($allocusers as $ocuser){
	$allusers[$ocuser] = $ocuser;
}
unset($allusers[OCP\USER::getUser()]);
$allusers = array_flip($allusers);
echo html_select_options($allusers, array());
?>
</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  OC::$WEBROOT; ?>/core/img/actions/delete.svg" class="svg action" style="display:none;float:right;"></li>
	<script>
		$('#sharewithuser_<?php echo $user['share']; ?> > img').click(function(){
			$('#share_user option[value="<?php echo $user['share']; ?>"]').removeAttr('disabled');
			Calendar.UI.Share.unshare(<?php echo $id; ?>, '<?php echo (array_key_exists('calid', $_)?'calendar':'event');?>', '<?php echo $user['share']; ?>', 'user');
			$('#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;
}
echo html_select_options($allgroups, array());
?>
</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  OC::$WEBROOT; ?>/core/img/actions/delete.svg" class="svg action" style="display:none;float:right;"></li>
	<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'); ?>
			$('#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">
	<input type="checkbox" id="publish" <?php echo ($public['share'])?'checked="checked"':'' ?>><label for="publish"><?php echo $l->t('make public'); ?></label><br>
	<input type="text" id="public_token" value="<?php echo OCP\Util::linkToAbsolute('apps/calendar', 'share.php?t=' . $public['share'], null, true) ; ?>" onmouseover="$('#public_token').select();" style="<?php echo (!$public['share'])?'display:none':'' ?>">
</div>