Fullcalendar, remove element can't fire events of plugin

key4625

New Member
Hi, I've problem with the plugin full calendar and fabrik.

I inserted in the events list plugin, some php code to synchronize with google calendar. When I use standard fabrik layout the events are fired correctly (I use onDeleteRowsForm and onAfterDeleteRowsForm) , but when I use the full calendar visualization, the creation and modification take place correctly while the cancellation does not fire events.

Someone can help me?
 
No, nothing...

I'm trying to sync my calendar with google calendar
In the script in the module page of Fabrik I have this:
Event on onDeleteRowsForm
Code:
session_start();
$_SESSION['operation']='delete';
foreach($_POST['ids'] as $idAppuntamento){
  $idAppuntamento_google = file_get_contents('http://***/gcal2/db_operation.php?operation=getGoogleId&idAppuntamento='.$idAppuntamento);
  $_SESSION['idAppuntamento_google'] = $idAppuntamento_google;
}

Event on onAfterDeleteRowsForm
Code:
session_start();
if ($_SESSION['operation']=='delete'){
  if ($_SESSION['idAppuntamento_google']!=''){
    header('Location: /gcal2/home.php?operation=delete&idAppuntamentoGoogle='.$_SESSION['idAppuntamento_google']);
    exit;
  }
}

I know that header location call is not a good thing in that place for script but in the normal layout is working good..

It seems like the call to delete operation on model and controller of fullcalendar is different than the fabrik one...

I searched on the fullcalendar model on deleteEvent() method and this part maybe do the work... but not fire the event
Code:
$listModel = JModelLegacy::getInstance('list', 'FabrikFEModel');
$listModel->setId($listid);
$ok = $listModel->deleteRows($ids);
 
Last edited:
The deleteRows() plugin definitely fires the onDeleteRows and onDeleteRowsForm plugins.

https://github.com/Fabrik/fabrik/blob/master/components/com_fabrik/models/list.php#L8913

But I'm really not sure where you have put your code, and no, using the header like that is definitely a no-no.

I'm actually working on a Google calendar sync, using their "new" API, to replace the old one we had that used to use the (now defunct) ZenGData API. Hopefully it'll be ready some time in the next month or so.

-- hugh
 
Just FYI, I took a couple of hours this afternoon to finish off the changes to the 'gcalsync' cron (scheduled task) plugin, and it now works. I haven't committed the changes yet, though. And maybe later tonight or tomorrow, I'll start adding code to the 'fullcalendar' plugin to sync with gcal (at least one way sync, to events added / modifed / deleted through the fullcalendar plugin will sync to gcal ... obviously for syncing from gcal the scheduled task is the way to go).

I finally found a way to do it that doesn't require nasty OAuth redirects (where you have to redirect to the Google auth page and approve the access), by using a Service account. Not 100% ideal, as it requires a little footling around in the Google API manager, creating a JSON auth file and uploading it to your server ... but it works.

-- hugh
 
Not sure what you mean. We don't use gcals directly, but the cron (scheduled task) code I just worked on allows you to run a scheduled task that will sync a Fabrik calendar to a gcal, either one way (pulling the gcal to the Fabrik calendar) or bidirectional (syncing gcal to Fabrik, and Fabrik to gcal).

The missing piece which I'll work on soon is doing it directly from the fullcalendar plugin, so if you have sync'ing enabled, it'll update the gcal in real time when you submit changes through the calendar (deleting, editing and adding events). But you'd still need the scheduled task to sync from gcal.

As I said in my last post, I haven't pushed the code to github yet, as I want to do more testing. If you are interested in helping test the scheduled task, let me know and I'll publish the branch so you can load the code.

-- hugh
 
I meant that users have their own personal calendar in the system that should synchronize with their Google Calendar. If what you are working on has this functionality I would be grateful if you sent me the code to test it.

Thank you a lot
 
Nope, the work I'm doing only allows syncing with one calendar, through a Google service account. In order to sync with individual's calendars, we would need to somehow allow each user to authenticate and grant OAuth access, which would be fiendishly difficult.

-- hugh
 
Having said that, if you have a G Suite account, it would be possible for the service account to "impersonate" users in your domain. But I don't have a G Suite account, so I can't really test that functionality.

-- hugh
 
Not sure what you mean. We don't use gcals directly, but the cron (scheduled task) code I just worked on allows you to run a scheduled task that will sync a Fabrik calendar to a gcal, either one way (pulling the gcal to the Fabrik calendar) or bidirectional (syncing gcal to Fabrik, and Fabrik to gcal).

The missing piece which I'll work on soon is doing it directly from the fullcalendar plugin, so if you have sync'ing enabled, it'll update the gcal in real time when you submit changes through the calendar (deleting, editing and adding events). But you'd still need the scheduled task to sync from gcal.

As I said in my last post, I haven't pushed the code to github yet, as I want to do more testing. If you are interested in helping test the scheduled task, let me know and I'll publish the branch so you can load the code.

-- hugh
Hugh, I'm interested in this functionality (fullcalendar & cron). Is this still in development? If so I wouldn't mind testing it, if it would help. Also, I do have a G Suite account.
 
I just got hold of a GSuite account to test with, as it happens ... literally a few minutes before I saw your message.

I've done a little more work on it, and will be able to commit something you can test with this week some time.

The last piece of the puzzle (at least for the 'cron' plugin) is being able to "impersonate" users, using the service account, so the plugin can insert events with the correct creator, rather than the rather cryptic email of the service account (like fabrik-test-service@cheesegrits1.iam.gserviceaccount.com).

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top