minor fix -- part.linkshare is now item-type agnostic (well, it requires the 'item_type' template var to be set, and uses it)

master
Michał 'rysiek' Woźniak 2014-01-23 03:01:25 +01:00
parent 08f9a9a8c3
commit 55bd9d4ebf
2 changed files with 8 additions and 7 deletions

View File

@ -11,7 +11,7 @@
}
</style></noscript>
<div class="share-link-container displayable-container"
data-item-type="event"
data-item-type="<?php p($_['item_type']); ?>"
data-item="<?php p($_['item_id']); ?>"
data-possible-permissions="<?php p($_['permissions']) ?>"
data-link="true"
@ -19,24 +19,24 @@
<!-- the checkbox that enables and disables the whole thing -->
<form>
<h3><?php p($l->t('Share via link')); ?></h3>
<input type="checkbox" name="share-link" class="share-link displayable-control" value="0" id="share-link-event-<?php p($_['item_id']); ?>" <?php if (isset($_['link_share']['token'])): ?> checked="checked"<?php endif; ?>/>
<label for="share-link-event-<?php p($_['item_id']); ?>"><?php p($l->t('Share link')) ?></label>
<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 -->
<div class="share-link-enabled-container displayable">
<!-- link container, contains the share link (duh) -->
<input class="link-text" type="text" readonly="readonly" placeholder="<?php p($l->t('Sharing link will appear here')) ?>" value="<?php if ($_['link_share']['token']) { p(OCP\Util::linkToPublic('calendar') . '&t=' . $_['link_share']['token']); } ?>"/>
<!-- do we want the password shown? default: nope -->
<div class="password-protect-outer-container displayable-container">
<input type="checkbox" name="password-protect" class="password-protect displayable-control" value="0" id="password-protect-event-<?php p($_['item_id']); ?>" <?php if (isset($_['link_share']['share_with'])): ?> checked="checked"<?php endif; ?>/>
<label for="password-protect-event-<?php p($_['item_id']); ?>" class="password-protect-label"><?php p($l->t('Password protect')) ?></label>
<input type="checkbox" name="password-protect" class="password-protect displayable-control" value="0" id="password-protect-<?php p($_['item_type']); ?>-<?php p($_['item_id']); ?>" <?php if (isset($_['link_share']['share_with'])): ?> checked="checked"<?php endif; ?>/>
<label for="password-protect-<?php p($_['item_type']); ?>-<?php p($_['item_id']); ?>" class="password-protect-label"><?php p($l->t('Password protect')) ?></label>
<div class="password-container displayable">
<input class="share-link-password" type="password" placeholder="<?php if (isset($_['link_share']['share_with'])) { p($l->t('Password protected')); } else { p($l->t('Password')); } ?>" name="share-link-password"/>
</div>
</div>
<!-- do we want share expiration date? -->
<div class="expire-date-outer-container displayable-container">
<input type="checkbox" name="expire" class="expire displayable-control" value="0" id="expire-event-<?php p($_['item_id']); ?>" <?php if (isset($_['link_share']['expiration'])): ?> checked="checked"<?php endif; ?>/>
<label for="expire-event-<?php p($_['item_id']); ?>" class="expire-label"><?php p($l->t('Set expiration date')) ?></label>
<input type="checkbox" name="expire" class="expire displayable-control" value="0" id="expire-<?php p($_['item_type']); ?>-<?php p($_['item_id']); ?>" <?php if (isset($_['link_share']['expiration'])): ?> checked="checked"<?php endif; ?>/>
<label for="expire-<?php p($_['item_type']); ?>-<?php p($_['item_id']); ?>" class="expire-label"><?php p($l->t('Set expiration date')) ?></label>
<div class="expire-date-container displayable">
<input class="expire-date" type="date" placeholder="<?php p($l->t('Expiration date')) ?>" name="expire-date" value="<?php if (isset($_['link_share']['expiration'])) { p(substr($_['link_share']['expiration'], 0, 10)); } ?>"/>
</div>

View File

@ -79,6 +79,7 @@ if(is_array($sharedwithByEvent)) {
/* link-sharing an event */
$tmpl = new OCP\Template('calendar', 'part.linkshare');
$tmpl->assign('item_id', $_['eventid']);
$tmpl->assign('item_type', 'event');
$tmpl->assign('permissions', $_['permissions']);
$tmpl->assign('link_share', $linkShare);
$tmpl->assign('shared', $shared);