diff options
Diffstat (limited to 'apps/calendar')
-rw-r--r-- | apps/calendar/ajax/cache/rescan.php | 11 | ||||
-rw-r--r-- | apps/calendar/appinfo/app.php | 1 | ||||
-rw-r--r-- | apps/calendar/js/settings.js | 3 | ||||
-rw-r--r-- | apps/calendar/lib/repeat.php | 102 | ||||
-rw-r--r-- | apps/calendar/templates/settings.php | 6 |
5 files changed, 122 insertions, 1 deletions
diff --git a/apps/calendar/ajax/cache/rescan.php b/apps/calendar/ajax/cache/rescan.php new file mode 100644 index 00000000000..1355179b957 --- /dev/null +++ b/apps/calendar/ajax/cache/rescan.php @@ -0,0 +1,11 @@ +<?php +/** + * Copyright (c) 2012 Georg Ehrke <georg@ownCloud.com> + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ +OCP\JSON::checkLoggedIn(); +OCP\JSON::checkAppEnabled('calendar'); +OC_Calendar_Repeat::cleancalendar(OCP\USER::getUser()); +OC_Calendar_Repeat::generatecalendar(OCP\USER::getUser());
\ No newline at end of file diff --git a/apps/calendar/appinfo/app.php b/apps/calendar/appinfo/app.php index 886c218f7c1..253844c1f08 100644 --- a/apps/calendar/appinfo/app.php +++ b/apps/calendar/appinfo/app.php @@ -5,6 +5,7 @@ OC::$CLASSPATH['OC_Calendar_Calendar'] = 'apps/calendar/lib/calendar.php'; OC::$CLASSPATH['OC_Calendar_Object'] = 'apps/calendar/lib/object.php'; OC::$CLASSPATH['OC_Calendar_Hooks'] = 'apps/calendar/lib/hooks.php'; OC::$CLASSPATH['OC_Connector_Sabre_CalDAV'] = 'apps/calendar/lib/connector_sabre.php'; +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'; OCP\Util::connectHook('OC_User', 'post_deleteUser', 'OC_Calendar_Hooks', 'deleteUser'); diff --git a/apps/calendar/js/settings.js b/apps/calendar/js/settings.js index c768a47a797..f42e024d083 100644 --- a/apps/calendar/js/settings.js +++ b/apps/calendar/js/settings.js @@ -44,4 +44,7 @@ $(document).ready(function(){ $('#' + jsondata.firstday).attr('selected',true); $('#firstday').chosen(); }); + $('#cleancalendarcache').click(function(){ + $.getJSON(OC.filePath('calendar', 'ajax/cache', 'rescan.php')); + }); }); diff --git a/apps/calendar/lib/repeat.php b/apps/calendar/lib/repeat.php new file mode 100644 index 00000000000..89cafa388c6 --- /dev/null +++ b/apps/calendar/lib/repeat.php @@ -0,0 +1,102 @@ +<?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. + */ +/* + * This class manages the caching of repeating events + * Events will be cached for the current year ± 5 years + */ +class OC_Calendar_Repeat{ + /* + * @brief returns the cache of an event + * @param (int) $id - id of the event + * @return (array) + */ + public static function get($id){ + $stmt = OCP\DB::prepare('SELECT * FROM *PREFIX*calendar_repeat WHERE eventid = ?'); + $result = $stmt->execute(array($id)); + $return = array(); + while($row = $result->fetchRow()){ + $return[] = $row; + } + return $return; + } + /* + * @brief returns the cache of an event in a specific peroid + * @param (int) $id - id of the event + * @param (string) $from - start for period in UTC + * @param (string) $until - end for period in UTC + * @return (array) + */ + public static function get_inperiod($id, $from, $until){ + + } + /* + * @brief returns the cache of all repeating events of a calendar + * @param (int) $id - id of the calendar + * @return (array) + */ + public static function getcalendar($id){ + + } + /* + * @brief returns the cache of all repeating events of a calendar in a specific period + * @param (int) $id - id of the event + * @param (string) $from - start for period in UTC + * @param (string) $until - end for period in UTC + */ + public static function getcalendar_inperiod($id, $from, $until){ + + } + /* + * @brief generates the cache the first time + */ + public static function generate($id){ + + } + /* + * @brief generates the cache the first time for all repeating event of an calendar + */ + public static function generatecalendar($id){ + + } + /* + * @brief updates an event that is already cached + */ + public static function update($id){ + + } + /* + * @brief updates all repating events of a calendar that are already cached + */ + public static function updatecalendar($id){ + + } + /* + * @brief checks if an event is already cached + */ + public static function is_cached($id){ + + } + /* + * @brief checks if a whole calendar is already cached + */ + public static function is_calendar_cached($id){ + + } + /* + * @brief removes the cache of an event + */ + public static function clean($id){ + + } + /* + * @brief removes the cache of all events of a calendar + */ + public static function cleancalendar($id){ + + } +}
\ No newline at end of file diff --git a/apps/calendar/templates/settings.php b/apps/calendar/templates/settings.php index 12117750ca5..40cef079593 100644 --- a/apps/calendar/templates/settings.php +++ b/apps/calendar/templates/settings.php @@ -1,7 +1,7 @@ <?php /** * Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl> - * Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de> + * Copyright (c) 2012 Georg Ehrke <ownclouddev at georgswebsite dot de> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. @@ -44,6 +44,10 @@ </select> </td></tr> + <tr><td><label for="" class="bold"><?php echo $l->t('Cache');?></label></td><td> + <input id="cleancalendarcache" type="button" class="button" value="<?php echo $l->t('Clear cache for repeating events');?>"> + </td></tr> + </table> <?php echo $l->t('Calendar CalDAV syncing address:');?> |