add some hooks to fix calendar sharing

This commit is contained in:
Georg Ehrke 2012-06-29 17:26:29 +02:00
parent 7e9455c382
commit 3bcf176a53
2 changed files with 28 additions and 1 deletions

View File

@ -8,12 +8,17 @@ OC::$CLASSPATH['OC_Connector_Sabre_CalDAV'] = 'apps/calendar/lib/connector_sabre
OC::$CLASSPATH['OC_Calendar_Repeat'] = 'apps/calendar/lib/repeat.php';
OC::$CLASSPATH['OC_Calendar_Share'] = 'apps/calendar/lib/share.php';
OC::$CLASSPATH['OC_Search_Provider_Calendar'] = 'apps/calendar/lib/search.php';
//General Hooks
OCP\Util::connectHook('OC_User', 'post_deleteUser', 'OC_Calendar_Hooks', 'deleteUser');
//Repeating Events Hooks
OCP\Util::connectHook('OC_Calendar', 'addEvent', 'OC_Calendar_Repeat', 'generate');
OCP\Util::connectHook('OC_Calendar', 'editEvent', 'OC_Calendar_Repeat', 'update');
OCP\Util::connectHook('OC_Calendar', 'deleteEvent', 'OC_Calendar_Repeat', 'clean');
OCP\Util::connectHook('OC_Calendar', 'moveEvent', 'OC_Calendar_Repeat', 'update');
OCP\Util::connectHook('OC_Calendar', 'deleteCalendar', 'OC_Calendar_Repeat', 'cleanCalendar');
//Sharing Hooks
OCP\Util::connectHook('OC_Calendar', 'deleteEvent', 'OC_Calendar_Share', 'post_eventdelete');
OCP\Util::connectHook('OC_Calendar', 'deleteCalendar', 'OC_Calendar_Share', 'post_caldelete');
OCP\Util::addscript('calendar','loader');
OCP\Util::addscript("3rdparty", "chosen/chosen.jquery.min");
OCP\Util::addStyle("3rdparty", "chosen/chosen");

View File

@ -258,7 +258,7 @@ class OC_Calendar_Share{
}
/*
* @brief delete all shared calendars / events after a user was deleted
* @brief deletes all shared calendars / events after a user was deleted
* @param (string) $userid
* @return (bool)
*/
@ -273,4 +273,26 @@ class OC_Calendar_Share{
$stmt->execute(array($userid));
return true;
}
/*
* @brief deletes all shared events of a calendar
* @param integer $calid
* @return boolean
*/
public static function post_caldelete($calid){
$stmt = OCP\DB::prepare('DELETE FROM *PREFIX*calendar_share_calendar WHERE calendarid = ?');
$stmt->execute(array($calid));
return true;
}
/*
* @brief deletes all shares of an event
* @param integer $eventid
* @return boolean
*/
public static function post_eventdelete($eventid){
$stmt = OCP\DB::prepare('DELETE FROM *PREFIX*calendar_share_event WHERE eventid = ?');
$stmt->execute(array($eventid));
return true;
}
}