diff --git a/apps/calendar/ajax/cache/rescan.php b/apps/calendar/ajax/cache/rescan.php index 1355179b95..3417f1ae4b 100644 --- a/apps/calendar/ajax/cache/rescan.php +++ b/apps/calendar/ajax/cache/rescan.php @@ -7,5 +7,9 @@ */ 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 +$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser()); +foreach($calendars as $calendar){ + OC_Calendar_Repeat::cleancalendar($calendar['id']); + OC_Calendar_Repeat::generatecalendar($calendar['id']); +} +OCP\JSON::success(); \ No newline at end of file diff --git a/apps/calendar/ajax/cache/status.php b/apps/calendar/ajax/cache/status.php index e69de29bb2..d2806d4789 100644 --- a/apps/calendar/ajax/cache/status.php +++ b/apps/calendar/ajax/cache/status.php @@ -0,0 +1,22 @@ + + * 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'); +$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser()); +$allcached = true; +foreach($calendars as $calendar){ + if(!OC_Calendar_Repeat::is_calendar_cached($calendar['id'])){ + $allcached = false; + } +} +$l = new OC_L10N('calendar'); +if(!$allcached){ + OCP\JSON::error(array('message'=>'Not all calendars are completely cached', 'l10n'=>$l->t('Not all calendars are completely cached'))); +}else{ + OCP\JSON::success(array('message'=>'Everything seems to be completely cached', 'l10n'=>$l->t('Everything seems to be completely cached'))); +} \ No newline at end of file diff --git a/apps/calendar/js/settings.js b/apps/calendar/js/settings.js index f42e024d08..eafd503c99 100644 --- a/apps/calendar/js/settings.js +++ b/apps/calendar/js/settings.js @@ -45,6 +45,23 @@ $(document).ready(function(){ $('#firstday').chosen(); }); $('#cleancalendarcache').click(function(){ - $.getJSON(OC.filePath('calendar', 'ajax/cache', 'rescan.php')); + $.getJSON(OC.filePath('calendar', 'ajax/cache', 'rescan.php'), function(){ + calendarcachecheck(); + }); }); + calendarcachecheck(); }); +function calendarcachecheck(){ + $.getJSON(OC.filePath('calendar', 'ajax/cache', 'status.php'), function(jsondata, status) { + $('#cleancalendarcache').attr('title', jsondata.l10n); + if(jsondata.status == 'success'){ + $('#cleancalendarcache').css('background', '#90EE90'); + $('#cleancalendarcache').css('color', '#333'); + $('#cleancalendarcache').css('text-shadow', '#fff 0 1px 0'); + }else{ + $('#cleancalendarcache').css('background', '#DC143C'); + $('#cleancalendarcache').css('color', '#FFFFFF'); + $('#cleancalendarcache').css('text-shadow', '0px 0px 0px #fff, 0px 0px #fff'); + } + }); +} \ No newline at end of file