cogShows how to integrate with Google Data
TypeSnippet
Category
Developed by

Ludovic Dubost

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Description

This code is being worked on. It's present online already for reference to a public discussion. It is not meant to be working yet...

Meeting invitation code sample

#*
1 Invitation à une réunion

#if($request.subject)

#set($gc = $xwiki.parseGroovyFromPage("GCalendarGroovy"))

$gc.addEntry($!request.subject, $!request.details, $!request.author, $!request.authoremail, "2006-04-23", "10:00", "2006-04-23", "12:00", "+01", "http://www.google.com/calendar/feeds/${request.user}/private/full",$request.user, $request.password)  

#else
Pour m'inviter à une réunion veuillez remplir le formulaire suivant:

<form action="" method="post">
<table>
<tr><td>Votre nom:</td><td><input type="text" name="author" value="$!request.author" size="30" /></td></tr>
<tr><td>Votre email:</td><td><input type="text" name="authoremail" value="$!request.authoremail" size="30" /></td></tr>
<tr><td>Date de début:/td>
<td>
<select name="anneedebut">
<option value="2006">2006</option>
<option value="2007" selected>2007</option>
</select>
-
<select name="moisdebut">
<option value="01">01</option>
<option value="02">03</option>
<option value="03">03</option>
<option value="04" selected>04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
<select name="jourdebut">
</select>
</td></tr>
<tr><td>Sujet:</td><td><input type="text" name="subject" value="$!request.subject" size="30" /></td></tr>
<tr><td colspan="2">Détails</td></tr>
<tr><td colspan="2">
<textarea name="detais" rows="5" cols="10">$!request.details

GCalendarGroovy

import com.google.gdata.client.*;
import com.google.gdata.client.calendar.*;
import com.google.gdata.data.*;
import com.google.gdata.data.extensions.*;
import com.google.gdata.util.*;

public class GCalendar {

 public GCalendar() {
 }

 public Feed getFeed(String url, String user, String pass) {
 // Set up the URL and the object that will handle the connection:
  URL feedUrl = new URL(url);
  GoogleService myService = new GoogleService("cl", "exampleCo-exampleApp-1");
  myService.setUserCredentials(user, pass);

 // Mark the feed as an Event feed:
  new EventFeed().declareExtensions(myService.getExtensionProfile());

 // Send the request and receive the response:
  com.google.gdata.data.Feed myFeed = myService.getFeed(feedUrl, Feed.class);
 return myFeed;
 }
}
Tags: google
     

Get Connected