part.intarnalshare added, implementing the internal sharing interface

master
Michał 'rysiek' Woźniak 2014-01-24 03:50:45 +01:00
parent 5671ae0c30
commit 9dcdb93ef1
4 changed files with 209 additions and 25 deletions

View File

@ -3,17 +3,17 @@
|* | (c) 2014 Michał "rysiek" Woźniak <rysiek@hackerspace.pl> | *|
|* | Licensed under AGPL | *|
\* +-----------------------------------------------------------------------+ */
.share-link-container h3 {
.share-interface-container h3 {
font-weight:bold;
}
.share-link-container input[type="checkbox"] {
.share-interface-container input[type="checkbox"] {
vertical-align:middle;
}
.share-link-container input[type="text"],
.share-link-container input[type="e-mail"],
.share-link-container input[type="password"],
.share-link-container input[type="submit"],
.share-link-container input[type="date"] {
.share-interface-container input[type="text"],
.share-interface-container input[type="e-mail"],
.share-interface-container input[type="password"],
.share-interface-container input[type="submit"],
.share-interface-container input[type="date"] {
color:#333;
font-family: "Lucida Grande", Arial, Verdana, sans-serif;
font-size: 1em;
@ -29,20 +29,20 @@
min-width:10em;
box-sizing:border-box;
}
.share-link-container input[type="submit"] {
.share-interface-container input[type="submit"] {
cursor:pointer;
}
.share-link-container input:invalid {
.share-interface-container input:invalid {
background:#fee;
}
/* by default, in a .displayable-container do not display direct-descending .displayable */
.displayable-container > .displayable {
max-height:0px;
-moz-transition:max-height ease-out 0.5s, opacity ease-out 0.5s;
-webkit-transition:max-height ease-out 0.5s, opacity ease-out 0.5s;
transition:max-height ease-out 0.5s, opacity ease-out 0.5s;
overflow:hidden;
opacity:0.1;
-moz-transition:max-height ease-out 1s/*, opacity ease-out 0.5s*/; /* BUG? animating/transitioning on opacity makes elemets move just a tiny bit for the duration of the transition; doesn't look good */
-webkit-transition:max-height ease-out 1s/*, opacity ease-out 0.5s*/;
transition:max-height ease-out 1s/*, opacity ease-out 0.5s*/;
opacity:0.3;
}
/* a hidden control checkbox should be hidden */
.displayable-container > .displayable-control.hide {
@ -57,13 +57,18 @@
margin:0.2em auto 0.5em auto;
border-top:solid 1px #ddd;
}
.displayable-container > .displayable.displayable-container:last-child > .displayable:last-child::after,
.displayable-container > .displayable > .displayable-container:last-child > .displayable:last-child::after {
content:"";
display:none;
}
/* display the rest once the checkbox is :checked */
.displayable-container > .displayable-control:checked ~ .displayable {
max-height:500px;
opacity:1;
-moz-transition:max-height ease-in 1s, opacity ease-in 0.5s;
-webkit-transition:max-height ease-in 1s, opacity ease-in 0.5s;
transition:max-height ease-in 1s, opacity ease-in 0.5s;
-moz-transition:max-height ease-in 1s/* , opacity ease-in 0.5s */;
-webkit-transition:max-height ease-in 1s/* , opacity ease-in 0.5s */;
transition:max-height ease-in 1s/* , opacity ease-in 0.5s */;
}
/* e-mail form */
.e-mail-form-container {
@ -76,4 +81,40 @@
.e-mail-form-container > input[type="submit"] {
min-width:5em;
width:auto;
}
/* shared-with list */
.shared-with-list {
padding:0.5em 0em;
}
.shared-with-list > li {
text-align:right;
}
.shared-with-list > li img {
vertical-align:-20%;
opacity:0.5;
}
.shared-with-list > li *:hover > img {
opacity:1;
}
.shared-with-list > li label,
.shared-with-list > li label img {
cursor: pointer;
}
.shared-with-list > li .unshare {
float:right;
opacity:1;
}
.shared-with-list .share-options {
display: inline-table;
text-align: left;
}
.shared-with-list .share-options .share-label {
margin-left:0.5em;
}
.shared-with-list .username {
font-weight:bold;
float:left;
}
.shared-with-list .edit-options {
text-align:right;
}

View File

@ -9,6 +9,9 @@
</td>
<td width="20px">
<?php if($_['calendar']['permissions'] & OCP\PERMISSION_SHARE): ?>
<a href="#" class="share" data-item-type="calendar" data-item="<?php p($_['calendar']['id']); ?>"
data-possible-permissions="<?php p($_['calendar']['permissions']) ?>" data-link="true"
title="<?php p($l->t('Share Calendar')) ?>" class="action permanent" style="background-image: url(<?php print_unescaped($_['share_icon']); ?>);"></a>
<label
for="outer-share-link-calendar-<?php p($_['calendar']['id']) ?>"
title="<?php p($l->t('Share Calendar')) ?>"
@ -18,6 +21,7 @@
</td>
<td width="20px">
<?php
// this can be changed to use $_['shared_by'] TODO
if($_['calendar']['userid'] == OCP\USER::getUser()){
$caldav = rawurlencode(html_entity_decode($_['calendar']['uri'], ENT_QUOTES, 'UTF-8'));
}else{
@ -39,12 +43,20 @@ if($_['calendar']['userid'] == OCP\USER::getUser()){
<a href="#" id="chooseCalendar-delete" data-id="<?php p($_['calendar']['id']) ?>" title="<?php p($l->t('Delete')) ?>" class="action"><img class="svg action" src="<?php p(OCP\Util::imagePath('core', 'actions/delete.svg')) ?>"></a>
<?php } ?>
</td>
<?php /* public calendar link-sharing interface */ ?>
<?php /* calendar sharing interface */ ?>
<?php if($_['calendar']['permissions'] & OCP\PERMISSION_SHARE): ?>
</tr><tr>
<th class="displayable-container" colspan="7">
<input type="checkbox" class="displayable-control hide" id="outer-share-link-calendar-<?php p($_['calendar']['id']) ?>"/>
<div class="displayable noafter" style="padding-left:0.5em"><?php
<div class="displayable" style="padding-left:0.5em"><?php
/* internal calendar sharing interface */
$tmpl = new OCP\Template('calendar', 'part.internalshare');
$tmpl->assign('item_id', $_['calendar']['id']);
$tmpl->assign('item_type', 'calendar');
$tmpl->assign('permissions', $_['calendar']['permissions']);
$tmpl->assign('shared_with', $_['shared_with']);
$tmpl->printpage();
/* public calendar link-sharing interface */
$tmpl = new OCP\Template('calendar', 'part.linkshare');
$tmpl->assign('item_id', $_['calendar']['id']);
$tmpl->assign('item_type', 'calendar');
@ -52,8 +64,7 @@ if($_['calendar']['userid'] == OCP\USER::getUser()){
$tmpl->assign('link_share', $_['link_share']);
$tmpl->printpage();
?></div>
</td>
</th>
<?php /* end calendar sharing interface */ ?>
<?php endif; ?>
<?php /* end public calendar link-sharing interface */
?>
<!-- END -->

View File

@ -0,0 +1,133 @@
<?php /*
<div id="dropdown" class="drop" data-item-type="calendar" data-item-source="1">
<input id="shareWith" type="text" placeholder="Share with user or group …" class="ui-autocomplete-input" autocomplete="off">
<ul id="shareWithList">
<li style="clear: both;" data-share-type="1" data-share-with="test-group" title="test-group">
<a href="#" class="unshare">
<img class="svg" alt="Unshare" src="/core/img/actions/delete.svg">
</a>
<span class="username">test-group (group)</span>
<label>
<input type="checkbox" name="edit" class="permissions" checked="checked">can edit<a href="#" class="showCruds">
<img class="svg" alt="access control" src="/core/img/actions/triangle-s.svg">
</a>
</label>
<div class="cruds" style="display:none;">
<label><input type="checkbox" name="create" class="permissions" checked="checked" data-permissions="4">create</label>
<label><input type="checkbox" name="update" class="permissions" checked="checked" data-permissions="2">update</label>
<label><input type="checkbox" name="delete" class="permissions" checked="checked" data-permissions="8">delete</label>
<label><input type="checkbox" name="share" class="permissions" checked="checked" data-permissions="16">share</label>
</div>
</li>
<li style="clear: both;" data-share-type="0" data-share-with="Tester" title="Tester">
<a href="#" class="unshare">
<img class="svg" alt="Unshare" src="/core/img/actions/delete.svg">
</a>
<span class="username">Tester</span>
<label>
<input type="checkbox" name="edit" class="permissions" checked="checked">can edit<a href="#" class="showCruds">
<img class="svg" alt="access control" src="/core/img/actions/triangle-s.svg">
</a>
</label>
<div class="cruds" style="display:none;">
<label><input type="checkbox" name="create" class="permissions" checked="checked" data-permissions="4">create</label>
<label><input type="checkbox" name="update" class="permissions" checked="checked" data-permissions="2">update</label>
<label><input type="checkbox" name="delete" class="permissions" checked="checked" data-permissions="8">delete</label>
<label><input type="checkbox" name="share" class="permissions" checked="checked" data-permissions="16">share</label>
</div>
</li>
</ul>
</div>
<div id="tabs-5" aria-labelledby="ui-id-4" class="ui-tabs-panel ui-widget-content ui-corner-bottom" role="tabpanel" aria-expanded="true" aria-hidden="false" style="display: block;">
<input type="text" id="sharewith" placeholder="Share with user or group" data-item-source="1" class="ui-autocomplete-input" autocomplete="off"><span role="status" aria-live="polite" class="ui-helper-hidden-accessible"></span>
<ul class="sharedby eventlist">
<li data-share-with="Tester" data-item="1" data-item-type="event" data-link="true" data-permissions="17" data-share-type="0">Tester<span class="shareactions">
<label><input class="update" type="checkbox">can edit</label>
<label><input class="share" type="checkbox" checked="&quot;checked&quot;">can share</label>
<img src="/core/img/actions/delete.svg" class="svg action delete" title="Unshare">
</span></li>
</ul>*/ ?>
<div class="share-interface-container internal-share">
<input type="text" class="share-with ui-autocomplete-input"
placeholder="<?php p($l->t('Share with user or group')); ?>"
data-item-source="<?php p($_['item_id']); ?>" data-item-type="<?php p($_['item_type']); ?>" autocomplete="off" />
<ul class="shared-with-list">
<?php foreach($_['shared_with'] as $i => $sharee): ?>
<li
data-share-type="1"
data-share-with="<?php p($sharee['share_with']); ?>"
data-item="<?php p($_['item_id']); ?>"
data-item-type="<?php p($_['item_type']); ?>"
data-link="true"
data-permissions="<?php p($_['permissions']) ?>"
title="<?php p($sharee['share_with']); ?>">
<!-- the username -->
<span class="username"><?php p($sharee['share_with'] . ($sharee['share_type'] == OCP\Share::SHARE_TYPE_GROUP ? ' (group)' : '')); ?></span>
<!-- unshare link -->
<a href="#" class="unshare">
<img class="svg" alt="<?php p($l->t('Unshare')); ?>" src="<?php p(OCP\Util::imagePath('core', 'actions/delete.svg')); ?>">
</a>
<div class="displayable-container share-options">
<!-- "can edit" info checkbox -->
<input type="checkbox" name="edit" class="permissions" checked="checked" disabled="disabled"/>
<!-- "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')); ?><img class="svg" alt="access control" src="<?php p(OCP\Util::imagePath('core', 'actions/triangle-s.svg')); ?>"></label>
<label class="share-label"><input type="checkbox" name="share" class="permissions" data-permissions="16" <?php p(($sharee['permissions'] & OCP\PERMISSION_SHARE?'checked="checked"':''))?>><?php p($l->t('can share')); ?></label>
<!-- edit options displayable control and displayable itself -->
<input type="checkbox" class="displayable-control hide" name="share-can-edit-<?php p($_['item_type']); ?>-<?php p($_['item_id']); ?>-<?php p($i); ?>" id="share-can-edit-<?php p($_['item_type']); ?>-<?php p($_['item_id']); ?>-<?php p($i); ?>"/>
<div class="displayable edit-options">
<label><input type="checkbox" name="create" class="permissions" data-permissions="4" <?php p(($sharee['permissions'] & OCP\PERMISSION_CREATE?'checked="checked"':''))?>><?php p($l->t('create')); ?></label>
<label><input type="checkbox" name="update" class="permissions" data-permissions="2" <?php p(($sharee['permissions'] & OCP\PERMISSION_UPDATE?'checked="checked"':''))?>><?php p($l->t('update')); ?></label>
<label><input type="checkbox" name="delete" class="permissions" data-permissions="8" <?php p(($sharee['permissions'] & OCP\PERMISSION_DELETE?'checked="checked"':''))?>><?php p($l->t('delete')); ?></label>
</div>
</div>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php /*
<ul class="sharedby eventlist">
<?php foreach($eventsharees as $sharee): ?>
<li data-share-with="<?php p($sharee['share_with']); ?>"
data-item="<?php p($eventid); ?>"
data-item-type="event"
data-link="true"
data-permissions="<?php p($sharee['permissions']); ?>"
data-share-type="<?php p($sharee['share_type']); ?>">
<?php p($sharee['share_with'] . ($sharee['share_type'] == OCP\Share::SHARE_TYPE_GROUP ? ' (group)' : '')); ?>
<span class="shareactions">
<label>
<input class="update" type="checkbox" <?php p(($sharee['permissions'] & OCP\PERMISSION_UPDATE?'checked="checked"':''))?>>
</label>
<label>
<input class="share" type="checkbox" >
<?php p($l->t('can share')); ?>
</label>
<img src="" class="svg action delete"
title="">
</span>
</li>
<?php endforeach; ?>
</ul>
<?php if(!$eventsharees) {
$nobody = $l->t('Not shared with anyone');
print_unescaped('<div id="sharedWithNobody">' . OC_Util::sanitizeHTML($nobody) . '</div>');
} ?>
<br />
<input type="button" id="sendemailbutton" style="float:right;" class="submit" value="<?php p($l->t("Send Email")); ?>" data-eventid="<?php p($eventid);?>" data-location="<?php p($location);?>" data-description="<?php p($description);?>" data-dtstart="<?php p($dtstart);?>" data-dtend="<?php p($dtend);?>">
<br /> */ ?>

View File

@ -1,5 +1,5 @@
<?php /*
Public link-sharing of events/calendars (or, indeed, any items, once integrated into app's interface)
Public link-sharing of events/calendars (or, actually, any items, once integrated into app's interface)
(c) 2014 Michał "rysiek" Woźniak <rysiek@hackerspace.pl>
Licensed under AGPL.
*/ ?>
@ -10,12 +10,11 @@
display:none;
}
</style></noscript>
<div class="share-link-container displayable-container"
<div class="share-interface-container link-share displayable-container"
data-item-type="<?php p($_['item_type']); ?>"
data-item="<?php p($_['item_id']); ?>"
data-possible-permissions="<?php p($_['permissions']) ?>"
data-link="true"
data-js-enabled="javascript:alert('test')">
data-link="true">
<!-- the checkbox that enables and disables the whole thing -->
<form>
<h3><?php p($l->t('Share via link')); ?></h3>