On Wed, Jan 7, 2009 at 1:55 PM, Kyran <[email protected]> wrote:
>
> Hey,
>
> For my site I'm using the calendar api to format all events into a
> nice list. Nothing really fancy.
>
> As I'm using the mootools library I figured it would be if I could put
> all my google calendar functionality into a class.
>
> Unfortunately after restructuring the code this way I can no longer
> get the eventsfeed. I get the following error when the line
> "this.googleService.getEventsFeed(futureEventsQuery, this.handleFeed,
> this.handleError);"
> is executed :
> XML tag name mismatch (expected meta)
> http://www.google.com/uds/api/gdata/1.6/ade37c0dee097720d54a5070af58d559/core,finance,contacts,calendar,blogger,default.I.js
> Line 96
>
> Can I use the api from within a mootools class, or should I just
> reverse back to calling all the calendar api related stuff from the
> main function?
>
> Here's the code for the class:
> var googleCalendar = new Class({
>        Implements: [Options, Events],
>        options: {
>                calendarFeedUrl: "http://www.google.com/calendar/feeds/
> [email protected]/public/full",
>        },
>        initialize: function(options){
>                this.setOptions(options);
>                this.getCalendarFeed();
>        },
>        calendarFeedUrl: "",
>        googleService: "ieps",
>        entries: [],
>        getCalendarFeed: function(){
>                google.gdata.client.init(this.handleInitError);
>                this.googleService = new google.gdata.calendar.CalendarService
> ('exodub-exodub_calendar-1.0');
>
>                var futureEventsQuery = new 
> google.gdata.calendar.CalendarEventQuery
> (this.calendarFeedUrl);
>                futureEventsQuery.setFutureEvents();
>
>                this.googleService.getEventsFeed(futureEventsQuery, 
> this.handleFeed,
> this.handleError);
>        },
>        handleFeed: function(calendarFeed){
>                alert("yes");
>                this.entries = calendarFeed;
>        },
>        handleError: function(e){
>                alert("An error occured!");
>                alert(e.cause ? e.cause.statusText : e.message);
>        },
>        createEventTable: function(table){
>                alert((this.entries)[0].getTitle().getText());
>                for (var i = 0; i < (this.entries).length; i++){
>                        var eventEntry = this.entries[i];
>                        alert(eventEntry.getTitle().getText());
>                        var newHTMLRow = document.createElement('tr');
>
>                        HTMLContent = 
> (eventEntry.getTimes())[0].getStartTime().getDate
> ().toDateString();
>                        this.addTableElement(newHTMLRow, HTMLContent);
>
>                        HTMLContent = eventEntry.getTitle().getText();
>                        this.addTableElement(newHTMLRow, HTMLContent);
>
>                        HTMLContent = HTMLcontent = (eventEntry.getLocations())
> [0].getValueString();
>                        this.addTableElement(newHTMLRow, HTMLContent);
>
>                        table.appendChild(newHTMLRow);
>                }
>        },
>        addTableElement: function(row,content){
>                item = document.createElement('td');
>                item.innerHTML = content;
>                item.setStyle('visibility','hidden');
>                row.addChild(item);
>        },
>        handleInitError: function(e){
>                //Do nothing
>        },
> });
>
> In the main function (which is called after domready), I instantiate
> the class and call
>        googleCalendarInstance.createEventTable($('gigs_go_here'));
> but it already goes wrong during the instantiation.
>
> Thanks already
>
> Kyran

Kyran,
I'm not familiar with MooTools classes, but the most likely
explanation I can think of is that it's somehow interfering with the
callback after making a server request.

Maybe somebody else on this list is more familiar with it than I am.
Barring that, I'd recommend avoiding using MooTools if you can't get
it to work.

-- 
Trevor Johns

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Calendar Data API" group.
To post to this group, send email to 
[email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to