From: Georg Ehrke Date: Wed, 18 Apr 2012 09:50:12 +0000 (+0200) Subject: implement shared calendar activation on server side X-Git-Tag: v4.0.0beta~244^2~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=de7184288816e4d542985eb4d6a7dc33c77fb4ff;p=nextcloud-server.git implement shared calendar activation on server side --- diff --git a/apps/calendar/ajax/share/activation.php b/apps/calendar/ajax/share/activation.php new file mode 100644 index 00000000000..a4a3ce48192 --- /dev/null +++ b/apps/calendar/ajax/share/activation.php @@ -0,0 +1,12 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ +require_once('../../../../lib/base.php'); +$id = strip_tags($_GET['id']); +$activation = strip_tags($_GET['activation']); +OC_Calendar_Share::set_active(OC_User::getUser(), $id, $activation); +OC_JSON::success(); \ No newline at end of file diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js index ebfe31723da..a16856938ce 100644 --- a/apps/calendar/js/calendar.js +++ b/apps/calendar/js/calendar.js @@ -501,6 +501,7 @@ Calendar={ idtype: '', activation:function(object,owner,id){ $.getJSON(OC.filePath('calendar', 'ajax/share', 'activation.php'),{id:id, idtype:'calendar', activation:object.checked?1:0}); + $('#calendar_holder').fullCalendar('refetchEvents'); }, dropdown:function(userid, calid){ $('.calendar_share_dropdown').remove(); diff --git a/apps/calendar/lib/share.php b/apps/calendar/lib/share.php index 16c10589671..8f91be97474 100644 --- a/apps/calendar/lib/share.php +++ b/apps/calendar/lib/share.php @@ -247,4 +247,13 @@ class OC_Calendar_Share{ } return $return; } + + /* + * @brief sets the active status of the calendar + * @param (string) $ + */ + public static function set_active($share, $id, $active){ + $stmt = OC_DB::prepare('UPDATE *PREFIX*calendar_share_calendar SET active = ? WHERE share = ? AND sharetype = "user" AND calendarid = ?'); + $stmt->execute(array($active, $share, $id)); + } } \ No newline at end of file diff --git a/apps/calendar/templates/part.choosecalendar.php b/apps/calendar/templates/part.choosecalendar.php index 3c6799d892e..d93a85aeca0 100644 --- a/apps/calendar/templates/part.choosecalendar.php +++ b/apps/calendar/templates/part.choosecalendar.php @@ -18,7 +18,7 @@ for($i = 0; $i < count($option_calendars); $i++){ -

">

+

">


@@ -28,7 +28,7 @@ for($i = 0; $i < count($option_calendars); $i++){ $share = OC_Calendar_Share::allSharedwithuser(OC_User::getUser(), OC_Calendar_Share::CALENDAR); $count = count($share); for($i = 0; $i < $count; $i++){ - $share[$i]['calendar'] = OC_Calendar_App::getCalendar($share[$i]['calendarid']); + $share[$i]['calendar'] = OC_Calendar_App::getCalendar($share[$i]['calendarid'], false, false); echo ''; $tmpl = new OC_Template('calendar', 'part.choosecalendar.rowfields.shared'); $tmpl->assign('share', $share[$i]);