diff options
author | Michael Gapczynski <mtgap@owncloud.com> | 2012-08-07 14:57:52 -0400 |
---|---|---|
committer | Michael Gapczynski <mtgap@owncloud.com> | 2012-08-07 14:57:52 -0400 |
commit | 9580d0ef290c5ba2431e6c2c52c7a6d660b031ec (patch) | |
tree | e1f279e04c10a30d579fbfb3b653ffbf6d369cab | |
parent | 3533f43d12f2a0246dcdde72d2e68002da61e601 (diff) | |
download | nextcloud-server-9580d0ef290c5ba2431e6c2c52c7a6d660b031ec.tar.gz nextcloud-server-9580d0ef290c5ba2431e6c2c52c7a6d660b031ec.zip |
Initial calendar sharing backend
-rw-r--r-- | apps/calendar/appinfo/app.php | 2 | ||||
-rw-r--r-- | apps/calendar/lib/share/calendar.php | 58 | ||||
-rw-r--r-- | apps/calendar/templates/part.choosecalendar.rowfields.php | 2 |
3 files changed, 61 insertions, 1 deletions
diff --git a/apps/calendar/appinfo/app.php b/apps/calendar/appinfo/app.php index 4fdba291262..8a793d1fac2 100644 --- a/apps/calendar/appinfo/app.php +++ b/apps/calendar/appinfo/app.php @@ -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'); diff --git a/apps/calendar/lib/share/calendar.php b/apps/calendar/lib/share/calendar.php new file mode 100644 index 00000000000..9b68437531f --- /dev/null +++ b/apps/calendar/lib/share/calendar.php @@ -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 + } + +}
\ No newline at end of file diff --git a/apps/calendar/templates/part.choosecalendar.rowfields.php b/apps/calendar/templates/part.choosecalendar.rowfields.php index d29113c9a61..64aaa797197 100644 --- a/apps/calendar/templates/part.choosecalendar.rowfields.php +++ b/apps/calendar/templates/part.choosecalendar.rowfields.php @@ -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> |