Compare commits
10 Commits
feature/do
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 75583089a6 | |||
| e623c8cb69 | |||
| 07ae847443 | |||
| c392ffde0d | |||
| 9c9bf61c7e | |||
| 0a7a57affa | |||
| 8193d8240c | |||
| c0ece61c28 | |||
| d08de624ea | |||
| d84f5d6803 |
0
.gitignore
vendored
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
0
DOCUMENTATION.md
Normal file → Executable file
0
DOCUMENTATION.md
Normal file → Executable file
0
LICENCE.md
Normal file → Executable file
0
LICENCE.md
Normal file → Executable file
3
Plugin.php
Normal file → Executable file
3
Plugin.php
Normal file → Executable file
@@ -17,8 +17,7 @@ class Plugin extends PluginBase {
|
|||||||
public function registerComponents() {
|
public function registerComponents() {
|
||||||
return [
|
return [
|
||||||
'NicoSt\GCalendar\Components\Upcoming' => 'upcoming',
|
'NicoSt\GCalendar\Components\Upcoming' => 'upcoming',
|
||||||
'NicoSt\GCalendar\Components\EmbeddedCalendar' => 'embeddedCalendar',
|
'NicoSt\GCalendar\Components\EmbeddedCalendar' => 'embeddedCalendar'
|
||||||
'NicoSt\GCalendar\Components\Download' => 'download'
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
0
classes/EventEntity.php
Normal file → Executable file
0
classes/EventEntity.php
Normal file → Executable file
28
classes/GoogleCalendarClient.php
Normal file → Executable file
28
classes/GoogleCalendarClient.php
Normal file → Executable file
@@ -1,7 +1,7 @@
|
|||||||
<?php namespace NicoSt\GCalendar\Classes;
|
<?php namespace NicoSt\GCalendar\Classes;
|
||||||
|
|
||||||
use Google_Client;
|
use Google\Client as Google_Client;
|
||||||
use Google_Service_Calendar;
|
use Google\Service\Calendar as Google_Service_Calendar;
|
||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
use NicoSt\GCalendar\Models\Settings;
|
use NicoSt\GCalendar\Models\Settings;
|
||||||
@@ -19,26 +19,25 @@ class GoogleCalendarClient {
|
|||||||
|
|
||||||
$this->client->setAccessType('offline');
|
$this->client->setAccessType('offline');
|
||||||
$this->client->setRedirectUri(url('/gcalendar/oauth2callback'));
|
$this->client->setRedirectUri(url('/gcalendar/oauth2callback'));
|
||||||
$this->client->addScope(Google_Service_Calendar::CALENDAR);
|
$this->client->addScope([Google_Service_Calendar::CALENDAR_READONLY , Google_Service_Calendar::CALENDAR_EVENTS_READONLY]);
|
||||||
|
|
||||||
// Set access toke on client if exist.
|
// Set access toke on client if exist.
|
||||||
$accessToken = Settings::get('access_token');
|
$accessToken = Settings::get('access_token', []);
|
||||||
if (!empty($accessToken)) {
|
if (!empty($accessToken)) {
|
||||||
$this->client->setAccessToken($accessToken);
|
$this->client->setAccessToken($accessToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there is no previous token or it's expired.
|
// Ensure valid access token.
|
||||||
if ($tryRefreshToken && $this->client->isAccessTokenExpired()) {
|
if ($tryRefreshToken && $this->client->isAccessTokenExpired()) {
|
||||||
// Refresh the token if possible.
|
|
||||||
if ($this->client->getRefreshToken()) {
|
|
||||||
$this->client->fetchAccessTokenWithRefreshToken($this->client->getRefreshToken());
|
|
||||||
// Save new access token
|
|
||||||
Settings::set('access_token', $this->client->getAccessToken());
|
|
||||||
} else {
|
|
||||||
Log::warning('G-Calendar: No valid access token given.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (!empty($this->client->getRefreshToken())) {
|
||||||
|
$this->client->fetchAccessTokenWithRefreshToken($this->client->getRefreshToken());
|
||||||
|
// Merge access token
|
||||||
|
Settings::set('access_token', array_merge($accessToken, $this->client->getAccessToken()));
|
||||||
|
} else {
|
||||||
|
Log::warning('G-Calendar: No valid refresh token given.');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getClient() {
|
public function getClient() {
|
||||||
@@ -49,5 +48,4 @@ class GoogleCalendarClient {
|
|||||||
|
|
||||||
return new Google_Service_Calendar($this->client);
|
return new Google_Service_Calendar($this->client);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
17
classes/GoogleCalendarService.php
Normal file → Executable file
17
classes/GoogleCalendarService.php
Normal file → Executable file
@@ -2,11 +2,12 @@
|
|||||||
|
|
||||||
use Log;
|
use Log;
|
||||||
use Cache;
|
use Cache;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
use NicoSt\GCalendar\Models\Settings;
|
use NicoSt\GCalendar\Models\Settings;
|
||||||
|
|
||||||
class GoogleCalendarService {
|
class GoogleCalendarService {
|
||||||
private $cacheTimeDefault = 15;
|
private $cacheTimeMinutesDefault = 15;
|
||||||
|
|
||||||
private $cacheKeyCalendarList = 'GCalendar-CalendarList';
|
private $cacheKeyCalendarList = 'GCalendar-CalendarList';
|
||||||
private $cacheKeyCalendarGet = 'GCalendar-CalendarGet#';
|
private $cacheKeyCalendarGet = 'GCalendar-CalendarGet#';
|
||||||
@@ -20,9 +21,9 @@ class GoogleCalendarService {
|
|||||||
|
|
||||||
public function getCalendar($calendarId, $maxEvents = '10') {
|
public function getCalendar($calendarId, $maxEvents = '10') {
|
||||||
$cachedCalendarGet = Cache::get($this->cacheKeyCalendarGet.$calendarId);
|
$cachedCalendarGet = Cache::get($this->cacheKeyCalendarGet.$calendarId);
|
||||||
$cacheTime = Settings::get('cache_time', $this->cacheTimeDefault);
|
$cacheTimeMinutes = Settings::get('cache_time', $this->cacheTimeMinutesDefault);
|
||||||
|
|
||||||
if(!isset($cachedCalendarGet) || $cacheTime == 0) {
|
if(!isset($cachedCalendarGet) || $cacheTimeMinutes == 0) {
|
||||||
// "timeMin" -> Set param to only get upcoming events
|
// "timeMin" -> Set param to only get upcoming events
|
||||||
// "singleEvents" -> Split recurring events into single events
|
// "singleEvents" -> Split recurring events into single events
|
||||||
// "orderBy" -> Order events by startTime
|
// "orderBy" -> Order events by startTime
|
||||||
@@ -38,7 +39,8 @@ class GoogleCalendarService {
|
|||||||
Log::debug('G-Calendar: Call google with #getCalendar for calendar with id: ' . $calendarId);
|
Log::debug('G-Calendar: Call google with #getCalendar for calendar with id: ' . $calendarId);
|
||||||
$response = $this->service->events->listEvents($calendarId, $params);
|
$response = $this->service->events->listEvents($calendarId, $params);
|
||||||
|
|
||||||
Cache::put($this->cacheKeyCalendarGet.$calendarId, $response, $cacheTime);
|
$expiresAt = Carbon::now()->addMinutes($cacheTimeMinutes);
|
||||||
|
Cache::put($this->cacheKeyCalendarGet.$calendarId, $response, $expiresAt);
|
||||||
return $response;
|
return $response;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$json = json_decode($e->getMessage(), true);
|
$json = json_decode($e->getMessage(), true);
|
||||||
@@ -52,14 +54,15 @@ class GoogleCalendarService {
|
|||||||
|
|
||||||
public function calendarList() {
|
public function calendarList() {
|
||||||
$cachedCalendarList = Cache::get($this->cacheKeyCalendarList);
|
$cachedCalendarList = Cache::get($this->cacheKeyCalendarList);
|
||||||
$cacheTime = Settings::get('cache_time', $this->cacheTimeDefault);
|
$cacheTimeMinutes = Settings::get('cache_time', $this->cacheTimeMinutesDefault);
|
||||||
|
|
||||||
if(!isset($cachedCalendarList) || $cacheTime == 0) {
|
if(!isset($cachedCalendarList) || $cacheTimeMinutes == 0) {
|
||||||
try {
|
try {
|
||||||
Log::debug('G-Calendar: Call google with #calendarList.');
|
Log::debug('G-Calendar: Call google with #calendarList.');
|
||||||
$response = $this->service->calendarList->listCalendarList()->getItems();
|
$response = $this->service->calendarList->listCalendarList()->getItems();
|
||||||
|
|
||||||
Cache::put($this->cacheKeyCalendarList, $response, $cacheTime);
|
$expiresAt = Carbon::now()->addMinutes($cacheTimeMinutes);
|
||||||
|
Cache::put($this->cacheKeyCalendarList, $response, $expiresAt);
|
||||||
return $response;
|
return $response;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$json = json_decode($e->getMessage(), true);
|
$json = json_decode($e->getMessage(), true);
|
||||||
|
|||||||
@@ -1,95 +0,0 @@
|
|||||||
<?php namespace NicoSt\GCalendar\Components;
|
|
||||||
|
|
||||||
use Cms\Classes\ComponentBase;
|
|
||||||
use NicoSt\GCalendar\Classes\GoogleCalendarService;
|
|
||||||
|
|
||||||
class Download extends ComponentBase {
|
|
||||||
private $calPropSeparator = '§§';
|
|
||||||
private $googleIcalUrl = 'https://calendar.google.com/calendar/ical/%s/public/basic.ics';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns information about this component, including name and description.
|
|
||||||
*/
|
|
||||||
public function componentDetails() {
|
|
||||||
return [
|
|
||||||
'name' => 'nicost.gcalendar::lang.component.download.name',
|
|
||||||
'description' => 'nicost.gcalendar::lang.component.download.description'
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function defineProperties() {
|
|
||||||
|
|
||||||
$calendars = $this->calendarProperties();
|
|
||||||
$customProperties = [];
|
|
||||||
|
|
||||||
$result = array_merge($customProperties, $calendars);
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCalendarDownloads() {
|
|
||||||
|
|
||||||
// Calenders from config
|
|
||||||
$calendarList = $this->getCalendarsFromProperties();
|
|
||||||
|
|
||||||
$data = [];
|
|
||||||
foreach($calendarList as $calendarData) {
|
|
||||||
$calendar = [];
|
|
||||||
$calendar['link'] = sprintf($this->googleIcalUrl, $calendarData['id']);
|
|
||||||
$calendar['title'] = $calendarData['title'];
|
|
||||||
|
|
||||||
array_push($data, $calendar);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function getCalendarsFromProperties() {
|
|
||||||
$calendars = [];
|
|
||||||
foreach($this->properties as $key => $value){
|
|
||||||
$exp_key = explode($this->calPropSeparator, $key);
|
|
||||||
if($exp_key[0] == 'cal' && $this->property($key) == true){
|
|
||||||
$calendar = [];
|
|
||||||
$calendar['id'] = $exp_key[1];
|
|
||||||
$calendar['title'] = $exp_key[2];
|
|
||||||
array_push($calendars, $calendar);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $calendars;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function calendarProperties() {
|
|
||||||
$service = new GoogleCalendarService();
|
|
||||||
$calendars = $service->calendarList();
|
|
||||||
|
|
||||||
if (isset($calendars['error'])) {
|
|
||||||
$calendars = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$calendarProperties = [];
|
|
||||||
if (!empty($calendars)) {
|
|
||||||
foreach ($calendars as &$calendar) {
|
|
||||||
$calendarData = [];
|
|
||||||
$calendarData['id'] = $calendar->id;
|
|
||||||
$calendarData['title'] = $calendar->summary;
|
|
||||||
|
|
||||||
$property = $this->createProperty($calendarData);
|
|
||||||
$calendarProperties = array_merge($calendarProperties, $property);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $calendarProperties;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function createProperty(array $calendarData) {
|
|
||||||
return [
|
|
||||||
'cal'.$this->calPropSeparator.$calendarData['id'].$this->calPropSeparator.$calendarData['title'] => [
|
|
||||||
'title' => $calendarData['title'],
|
|
||||||
'type' => 'checkbox',
|
|
||||||
'group' => 'nicost.gcalendar::lang.component.download.groups.calendars',
|
|
||||||
// Default to setting from config
|
|
||||||
'default' => 0,
|
|
||||||
]
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
12
components/EmbeddedCalendar.php
Normal file → Executable file
12
components/EmbeddedCalendar.php
Normal file → Executable file
@@ -2,9 +2,7 @@
|
|||||||
|
|
||||||
use Cms\Classes\ComponentBase;
|
use Cms\Classes\ComponentBase;
|
||||||
use NicoSt\GCalendar\Classes\GoogleCalendarService;
|
use NicoSt\GCalendar\Classes\GoogleCalendarService;
|
||||||
use Mobile_Detect;
|
use Detection\MobileDetect;
|
||||||
|
|
||||||
use Log;
|
|
||||||
|
|
||||||
class EmbeddedCalendar extends ComponentBase {
|
class EmbeddedCalendar extends ComponentBase {
|
||||||
private $calPropSeparator = '§§';
|
private $calPropSeparator = '§§';
|
||||||
@@ -158,7 +156,7 @@ class EmbeddedCalendar extends ComponentBase {
|
|||||||
} else if($viewMode == 'week') {
|
} else if($viewMode == 'week') {
|
||||||
$data += ['mode' => 'WEEK'];
|
$data += ['mode' => 'WEEK'];
|
||||||
} else if($viewMode == 'dynamic') {
|
} else if($viewMode == 'dynamic') {
|
||||||
$detect = new Mobile_Detect;
|
$detect = new MobileDetect();
|
||||||
if($detect->isMobile()) {
|
if($detect->isMobile()) {
|
||||||
$data += ['mode' => 'AGENDA'];
|
$data += ['mode' => 'AGENDA'];
|
||||||
} else {
|
} else {
|
||||||
@@ -176,7 +174,6 @@ class EmbeddedCalendar extends ComponentBase {
|
|||||||
$data += ['wkst' => 2];
|
$data += ['wkst' => 2];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calenders from config
|
|
||||||
$calendarList = $this->getCalendarsFromProperties();
|
$calendarList = $this->getCalendarsFromProperties();
|
||||||
$dataParams = http_build_query($data);
|
$dataParams = http_build_query($data);
|
||||||
|
|
||||||
@@ -221,9 +218,9 @@ class EmbeddedCalendar extends ComponentBase {
|
|||||||
$exp_key = explode($this->calPropSeparator, $key);
|
$exp_key = explode($this->calPropSeparator, $key);
|
||||||
if($exp_key[0] == 'cal' && $this->property($key) == true){
|
if($exp_key[0] == 'cal' && $this->property($key) == true){
|
||||||
$calendar = [];
|
$calendar = [];
|
||||||
$calendar['color'] = $exp_key[1];
|
|
||||||
$calendar['src'] = $exp_key[2];
|
$calendar['src'] = $exp_key[2];
|
||||||
array_push($calendars, $calendar);
|
$calendar['color'] = $exp_key[1];
|
||||||
|
$calendars[] = $calendar;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,6 +228,7 @@ class EmbeddedCalendar extends ComponentBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function calendarProperties() {
|
private function calendarProperties() {
|
||||||
|
// ToDo: Add cache => https://octobercms.com/docs/services/cache
|
||||||
$service = new GoogleCalendarService();
|
$service = new GoogleCalendarService();
|
||||||
$calendars = $service->calendarList();
|
$calendars = $service->calendarList();
|
||||||
|
|
||||||
|
|||||||
2
components/Upcoming.php
Normal file → Executable file
2
components/Upcoming.php
Normal file → Executable file
@@ -41,7 +41,7 @@ class Upcoming extends ComponentBase {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getEvents() {
|
public function events() {
|
||||||
$connector = new GoogleCalendarService();
|
$connector = new GoogleCalendarService();
|
||||||
$maxEvents = $this->property('maxEvents');
|
$maxEvents = $this->property('maxEvents');
|
||||||
$calendarEvents = $connector->allEventList($maxEvents);
|
$calendarEvents = $connector->allEventList($maxEvents);
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
<h3>Click on a calendar to download it and import it to you're device.</h3>
|
|
||||||
{% set calendars = __SELF__.calendarDownloads %}
|
|
||||||
{% for calendar in calendars %}
|
|
||||||
<a href="{{ calendar.link }}" target="_blank">{{ calendar.title }}</a><br />
|
|
||||||
{% endfor %}
|
|
||||||
0
components/embeddedcalendar/default.htm
Normal file → Executable file
0
components/embeddedcalendar/default.htm
Normal file → Executable file
2
components/upcoming/default.htm
Normal file → Executable file
2
components/upcoming/default.htm
Normal file → Executable file
@@ -1,4 +1,4 @@
|
|||||||
{% set events = __SELF__.events %}
|
{% set events = upcoming.events %}
|
||||||
|
|
||||||
{% if not events.error and events is not empty %}
|
{% if not events.error and events is not empty %}
|
||||||
<table>
|
<table>
|
||||||
|
|||||||
18
composer.json
Normal file → Executable file
18
composer.json
Normal file → Executable file
@@ -10,9 +10,23 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.0",
|
"php": ">=8.1",
|
||||||
"composer/installers": "~1.0",
|
"composer/installers": "~1.0",
|
||||||
"google/apiclient": "^2.0",
|
"google/apiclient": "^2.0",
|
||||||
"mobiledetect/mobiledetectlib": "^2.8"
|
"mobiledetect/mobiledetectlib": "^4.8"
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"allow-plugins": {
|
||||||
|
"composer/installers": true
|
||||||
|
},
|
||||||
|
"cache-read-only": true
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"pre-autoload-dump": "Google\\Task\\Composer::cleanup"
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"google/apiclient-services": [
|
||||||
|
"Calendar"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
645
composer.lock
generated
Normal file → Executable file
645
composer.lock
generated
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
2
controllers/GoogleCallback.php
Normal file → Executable file
2
controllers/GoogleCallback.php
Normal file → Executable file
@@ -31,7 +31,7 @@ class GoogleCallback extends Controller {
|
|||||||
$accessToken = $client->fetchAccessTokenWithAuthCode($code);
|
$accessToken = $client->fetchAccessTokenWithAuthCode($code);
|
||||||
$client->setAccessToken($accessToken);
|
$client->setAccessToken($accessToken);
|
||||||
|
|
||||||
Log::info('G-Calendar: Set access-token ['. print_r($client->getAccessToken(), true) .'].');
|
Log::info('G-Calendar: Set access_token ['. print_r($client->getAccessToken(), true) .'].');
|
||||||
Settings::set('access_token', $client->getAccessToken());
|
Settings::set('access_token', $client->getAccessToken());
|
||||||
|
|
||||||
return Redirect::to('/backend/system/settings/update/nicost/gcalendar/settings');
|
return Redirect::to('/backend/system/settings/update/nicost/gcalendar/settings');
|
||||||
|
|||||||
0
formwidgets/CalendarSelector.php
Normal file → Executable file
0
formwidgets/CalendarSelector.php
Normal file → Executable file
0
formwidgets/ClearCacheButton.php
Normal file → Executable file
0
formwidgets/ClearCacheButton.php
Normal file → Executable file
19
formwidgets/OAuth.php
Normal file → Executable file
19
formwidgets/OAuth.php
Normal file → Executable file
@@ -21,7 +21,6 @@ class OAuth extends FormWidgetBase {
|
|||||||
$this->vars['redirectUrl'] = $client->getRedirectUri();
|
$this->vars['redirectUrl'] = $client->getRedirectUri();
|
||||||
$this->vars['isAccessTokenExpired'] = $client->isAccessTokenExpired() ? '1' : '0';
|
$this->vars['isAccessTokenExpired'] = $client->isAccessTokenExpired() ? '1' : '0';
|
||||||
$this->vars['clientIdExist'] = null != Settings::get('client_id', null) ? '1' : '0';
|
$this->vars['clientIdExist'] = null != Settings::get('client_id', null) ? '1' : '0';
|
||||||
$this->vars['accessToken'] = print_r(Settings::get('access_token'), true);
|
|
||||||
|
|
||||||
return $this->makePartial('oauth');
|
return $this->makePartial('oauth');
|
||||||
}
|
}
|
||||||
@@ -30,28 +29,34 @@ class OAuth extends FormWidgetBase {
|
|||||||
|
|
||||||
$class = new GoogleCalendarClient(true);
|
$class = new GoogleCalendarClient(true);
|
||||||
$client = $class->getClient();
|
$client = $class->getClient();
|
||||||
|
$client->setPrompt('consent');
|
||||||
|
|
||||||
if ($client->isAccessTokenExpired()) {
|
if ($client->isAccessTokenExpired()) {
|
||||||
// Request authorization from the user.
|
// Request authorization from the user.
|
||||||
$authUrl = $client->createAuthUrl();
|
$authUrl = $client->createAuthUrl();
|
||||||
Log::info('G-Calendar: Request authorization with URL ['. $authUrl .'].');
|
//Log::info('G-Calendar: Request authorization with URL ['. $authUrl .'].');
|
||||||
|
|
||||||
$this->vars['auth_url'] = $authUrl;
|
$this->vars['auth_url'] = $authUrl;
|
||||||
|
|
||||||
return $this->makePartial('gaccess');
|
return $this->makePartial('gaccess');
|
||||||
}
|
}
|
||||||
|
|
||||||
Log::info('G-Calendar: Access token not expired.');
|
Flash::info(Lang::get('nicost.gcalendar::lang.message.accessTokenNotExpired'));
|
||||||
Flash::error(Lang::get('nicost.gcalendar::lang.message.accessTokenNotExpired'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onClearAccessToken() {
|
public function onClearAccessToken() {
|
||||||
Settings::set('access_token', '');
|
Settings::set('access_token', []);
|
||||||
Flash::success(Lang::get('nicost.gcalendar::lang.message.accessTokenRemoved'));
|
Flash::success(Lang::get('nicost.gcalendar::lang.message.accessTokenRemoved'));
|
||||||
|
|
||||||
$this->vars['isAccessTokenExpired'] = '1';
|
return $this->refreshTokenStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function refreshTokenStatus() {
|
||||||
|
$class = new GoogleCalendarClient(true);
|
||||||
|
$client = $class->getClient();
|
||||||
|
|
||||||
|
$this->vars['isAccessTokenExpired'] = $client->isAccessTokenExpired() ? '1' : '0';
|
||||||
|
|
||||||
return Redirect::refresh();
|
return Redirect::refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
4
formwidgets/calendarselector/partials/_selector.htm
Normal file → Executable file
4
formwidgets/calendarselector/partials/_selector.htm
Normal file → Executable file
@@ -3,7 +3,7 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="list-checkbox">
|
<th class="list-checkbox">
|
||||||
<div class="checkbox custom-checkbox nolabel">
|
<div class="checkbox nolabel">
|
||||||
<input type="checkbox" id="checkboxAll" />
|
<input type="checkbox" id="checkboxAll" />
|
||||||
<label for="checkboxAll"></label>
|
<label for="checkboxAll"></label>
|
||||||
</div>
|
</div>
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
<?php foreach ($calendars as $key=>$calendar): ?>
|
<?php foreach ($calendars as $key=>$calendar): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="list-checkbox nolink">
|
<td class="list-checkbox nolink">
|
||||||
<div class="checkbox custom-checkbox nolabel">
|
<div class="checkbox nolabel">
|
||||||
<input id="checkbox_<?= $key ?>"
|
<input id="checkbox_<?= $key ?>"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
name="Settings[calendar_selector][<?= $key ?>][checked]"
|
name="Settings[calendar_selector][<?= $key ?>][checked]"
|
||||||
|
|||||||
0
formwidgets/clearcachebutton/partials/_clearcachebutton.htm
Normal file → Executable file
0
formwidgets/clearcachebutton/partials/_clearcachebutton.htm
Normal file → Executable file
0
formwidgets/oauth/partials/_gaccess.htm
Normal file → Executable file
0
formwidgets/oauth/partials/_gaccess.htm
Normal file → Executable file
0
formwidgets/oauth/partials/_oauth.htm
Normal file → Executable file
0
formwidgets/oauth/partials/_oauth.htm
Normal file → Executable file
8
lang/de/lang.php
Normal file → Executable file
8
lang/de/lang.php
Normal file → Executable file
@@ -74,14 +74,8 @@
|
|||||||
],
|
],
|
||||||
'showCalendarList' => [
|
'showCalendarList' => [
|
||||||
'title' => 'Kalender Liste Anzeigen'
|
'title' => 'Kalender Liste Anzeigen'
|
||||||
]
|
|
||||||
]
|
|
||||||
],
|
],
|
||||||
'download' => [
|
|
||||||
'name' => 'Download Kalender',
|
|
||||||
'description' => 'Kalender als "ICS-Datei" downloaden.',
|
|
||||||
'groups' => [
|
|
||||||
'calendars' => 'Kalender'
|
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
|||||||
8
lang/en/lang.php
Normal file → Executable file
8
lang/en/lang.php
Normal file → Executable file
@@ -74,14 +74,8 @@
|
|||||||
],
|
],
|
||||||
'showCalendarList' => [
|
'showCalendarList' => [
|
||||||
'title' => 'Show Calendar List'
|
'title' => 'Show Calendar List'
|
||||||
]
|
|
||||||
]
|
|
||||||
],
|
],
|
||||||
'download' => [
|
|
||||||
'name' => 'Download Calendar',
|
|
||||||
'description' => 'Download calendar as "ICS-File".',
|
|
||||||
'groups' => [
|
|
||||||
'calendars' => 'Calendars'
|
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
|||||||
0
models/Settings.php
Normal file → Executable file
0
models/Settings.php
Normal file → Executable file
0
models/settings/fields.yaml
Normal file → Executable file
0
models/settings/fields.yaml
Normal file → Executable file
0
resources/calendar_language.json
Normal file → Executable file
0
resources/calendar_language.json
Normal file → Executable file
0
resources/calendar_timezone.json
Normal file → Executable file
0
resources/calendar_timezone.json
Normal file → Executable file
1
routes.php
Normal file → Executable file
1
routes.php
Normal file → Executable file
@@ -6,4 +6,3 @@ Route::group(['prefix' => 'gcalendar'], function () {
|
|||||||
'uses' => 'NicoSt\GCalendar\Controllers\GoogleCallback@oauth2callback'
|
'uses' => 'NicoSt\GCalendar\Controllers\GoogleCallback@oauth2callback'
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
14
updates/version.yaml
Normal file → Executable file
14
updates/version.yaml
Normal file → Executable file
@@ -1,9 +1,13 @@
|
|||||||
1.0.0:
|
1.0.0:
|
||||||
- Initialize plugin.
|
- Initialize plugin.
|
||||||
- Prepare for October marketplace.
|
- Prepare for October marketplace.
|
||||||
1.1.0:
|
1.0.1:
|
||||||
- Add new "Download" component to display a list of calendars to be downloaded as ics-file.
|
|
||||||
- Update dependencies
|
|
||||||
- Fix some minor bugs
|
|
||||||
1.1.1:
|
|
||||||
- Compatibility with October CMS 2
|
- Compatibility with October CMS 2
|
||||||
|
1.0.2:
|
||||||
|
- Fix missing checkboxes at the calendar selector in the backend
|
||||||
|
1.1.0:
|
||||||
|
- Update scopes for Calendar API to read only.
|
||||||
|
- Fix bug about missing refresh token after the update to the latest google client api version
|
||||||
|
- Remove unnecessary logging
|
||||||
|
1.1.1:
|
||||||
|
- Updated dependencies
|
||||||
|
|||||||
Reference in New Issue
Block a user