mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Initial calendar sharing backend
This commit is contained in:
parent
3533f43d12
commit
9580d0ef29
3 changed files with 61 additions and 1 deletions
|
|
@ -10,6 +10,7 @@ OC::$CLASSPATH['OC_Calendar_Share'] = 'apps/calendar/lib/share.php';
|
|||
OC::$CLASSPATH['OC_Search_Provider_Calendar'] = 'apps/calendar/lib/search.php';
|
||||
OC::$CLASSPATH['OC_Calendar_Export'] = 'apps/calendar/lib/export.php';
|
||||
OC::$CLASSPATH['OC_Calendar_Import'] = 'apps/calendar/lib/import.php';
|
||||
OC::$CLASSPATH['OC_Share_Backend_Calendar'] = 'apps/calendar/lib/share/calendar.php';
|
||||
//General Hooks
|
||||
OCP\Util::connectHook('OC_User', 'post_createUser', 'OC_Calendar_Hooks', 'createUser');
|
||||
OCP\Util::connectHook('OC_User', 'post_deleteUser', 'OC_Calendar_Hooks', 'deleteUser');
|
||||
|
|
@ -35,3 +36,4 @@ OCP\App::addNavigationEntry( array(
|
|||
'name' => $l->t('Calendar')));
|
||||
OCP\App::registerPersonal('calendar', 'settings');
|
||||
OC_Search::registerProvider('OC_Search_Provider_Calendar');
|
||||
OCP\Share::registerBackend('calendar', 'OC_Share_Backend_Calendar');
|
||||
|
|
|
|||
58
apps/calendar/lib/share/calendar.php
Normal file
58
apps/calendar/lib/share/calendar.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
/**
|
||||
* ownCloud
|
||||
*
|
||||
* @author Michael Gapczynski
|
||||
* @copyright 2012 Michael Gapczynski mtgap@owncloud.com
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
class OC_Share_Backend_Calendar implements OCP\Share_Backend_Collection {
|
||||
|
||||
const FORMAT_CALENDAR = 0;
|
||||
|
||||
private static $calendar;
|
||||
|
||||
public function isValidSource($itemSource, $uidOwner) {
|
||||
if (self::$calendar = OC_Calendar_App::getCalendar($itemSource)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function generateTarget($itemSource, $shareWith, $exclude = null) {
|
||||
if (isset(self::$calendar)) {
|
||||
return self::$calendar['displayname'];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function formatItems($items, $format, $parameters = null) {
|
||||
$calendars = array();
|
||||
if ($format == self::FORMAT_CALENDAR) {
|
||||
foreach ($items as $item) {
|
||||
$calendar = OC_Calendar_App::getCalendar($item['item_source']);
|
||||
$calendar['displaynamename'] = $item['item_target'];
|
||||
$calendars[] = $calendar;
|
||||
}
|
||||
}
|
||||
return $calendars;
|
||||
}
|
||||
|
||||
public function getChildren($itemSource) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
<label for="active_<?php echo $_['calendar']['id'] ?>"><?php echo $_['calendar']['displayname'] ?></label>
|
||||
</td>
|
||||
<td width="20px">
|
||||
<a href="#" onclick="Calendar.UI.Share.dropdown('<?php echo OCP\USER::getUser() ?>', <?php echo $_['calendar']['id'] ?>);" title="<?php echo $l->t('Share Calendar') ?>" class="action"><img class="svg action" src="<?php echo (!$_['shared']) ? OCP\Util::imagePath('core', 'actions/share.svg') : OCP\Util::imagePath('core', 'actions/shared.svg') ?>"></a>
|
||||
<a href="#" class="share" data-item-type="calendar" data-item="<?php echo $_['calendar']['id']; ?>" title="<?php echo $l->t('Share Calendar') ?>" class="action"><img class="svg action" src="<?php echo (!$_['shared']) ? OCP\Util::imagePath('core', 'actions/share.svg') : OCP\Util::imagePath('core', 'actions/shared.svg') ?>"></a>
|
||||
</td>
|
||||
<td width="20px">
|
||||
<a href="#" onclick="Calendar.UI.showCalDAVUrl('<?php echo OCP\USER::getUser() ?>', '<?php echo rawurlencode(html_entity_decode($_['calendar']['uri'], ENT_QUOTES, 'UTF-8')) ?>');" title="<?php echo $l->t('CalDav Link') ?>" class="action"><img class="svg action" src="<?php echo OCP\Util::imagePath('core', 'actions/public.svg') ?>"></a>
|
||||
|
|
|
|||
Loading…
Reference in a new issue