]> source.dussan.org Git - nextcloud-server.git/commitdiff
implement shared calendar activation on server side
authorGeorg Ehrke <dev@georgswebsite.de>
Wed, 18 Apr 2012 09:50:12 +0000 (11:50 +0200)
committerGeorg Ehrke <dev@georgswebsite.de>
Wed, 18 Apr 2012 09:50:12 +0000 (11:50 +0200)
apps/calendar/ajax/share/activation.php [new file with mode: 0644]
apps/calendar/js/calendar.js
apps/calendar/lib/share.php
apps/calendar/templates/part.choosecalendar.php

diff --git a/apps/calendar/ajax/share/activation.php b/apps/calendar/ajax/share/activation.php
new file mode 100644 (file)
index 0000000..a4a3ce4
--- /dev/null
@@ -0,0 +1,12 @@
+<?php
+/**
+ * Copyright (c) 2012 Georg Ehrke <ownclouddev@georgswebsite.de>
+ * 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
index ebfe31723da6f4e335ad9287e37fda86f69de8a0..a16856938ce0b43cb893491e907a24d5fe1702dc 100644 (file)
@@ -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();
index 16c10589671a3b697a8e86102a8f1b63993acc0d..8f91be974740ef9a4163fe93dcfd7755a9b6ce5e 100644 (file)
@@ -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
index 3c6799d892eda6ff0569fd976f05161474339e8c..d93a85aeca04ecc26a4c1d3e41c89da240d6d1cf 100644 (file)
@@ -18,7 +18,7 @@ for($i = 0; $i < count($option_calendars); $i++){
 </tr>
 <tr>
        <td colspan="6">
-               <p style="margin: 0 auto;width: 90%;"><input style="display:none;width: 90%;float: left;" type="text" id="caldav_url" onmouseover="$('#caldav_url').select();" title="<?php echo $l->t("CalDav Link"); ?>"><img id="caldav_url_close" style="height: 20px;vertical-align: middle;display: none;" src="../../core/img/actions/delete.svg" alt="close" onclick="$('#caldav_url').hide();$('#caldav_url_close').hide();"/></p>\r
+               <p style="margin: 0 auto;width: 90%;"><input style="display:none;width: 90%;float: left;" type="text" id="caldav_url" onmouseover="$('#caldav_url').select();" title="<?php echo $l->t("CalDav Link"); ?>"><img id="caldav_url_close" style="height: 20px;vertical-align: middle;display: none;" src="../../core/img/actions/delete.svg" alt="close" onclick="$('#caldav_url').hide();$('#caldav_url_close').hide();"/></p>
        </td>
 </tr>
 </table><br>
@@ -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 '<tr>';
        $tmpl = new OC_Template('calendar', 'part.choosecalendar.rowfields.shared');
        $tmpl->assign('share', $share[$i]);