From: Georg Ehrke Date: Mon, 11 Jun 2012 20:16:26 +0000 (+0200) Subject: add some information about repeating events caching on personal settings page X-Git-Tag: v4.5.0beta1~74^2~407^2~32 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3c9be43aa45d0d25b070289607bb78e38d7bc35c;p=nextcloud-server.git add some information about repeating events caching on personal settings page --- diff --git a/apps/calendar/ajax/cache/rescan.php b/apps/calendar/ajax/cache/rescan.php index 1355179b957..3417f1ae4b4 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 e69de29bb2d..d2806d47895 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 f42e024d083..eafd503c994 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