[Cosmo-dev] [Fwd: Re: Question regarding Cosmo's Day View and Month View]

Matthew Eernisse mde at osafoundation.org
Wed Feb 7 13:49:31 PST 2007


Melissa said it was fine to forward this on to the list. She had some 
questions about the Cosmo UI code. Just for context, here's the intro 
text from her message that I'm replying to:

> I have some questions regarding Cosmo's Day View and Month View.  
> From the proposed project plan, I know that day view and month 
> view will only be available pass Cosmo Preview.  I have a tight 
> deadline to build an Ajax calendar.  After a lot of research, 
> i have found Cosmo to be my closest starting point.
> I am looking into using Cosmo as my project base code.  
> I am a newbie to Ajax.  If it's not too much trouble, can you 
> please help answer a few of my questions? 

-------- Original Message --------
Subject: Re: Question regarding Cosmo's Day View and Month View
Date: Wed, 07 Feb 2007 13:42:53 -0600
From: Matthew Eernisse <mde at osafoundation.org>
To: Melissa Choy <melissa.choy at gmail.com>
References: <2750cda20702061036k4fb23054p2093decc4c3d5e7c at mail.gmail.com>

Melissa,

Thanks for the interest in Cosmo. You've got some really interesting
questions, and I'll try to respond to each one as best I can below.

> 1) I am wondering will it take a lot of effort to develop my own Day 
> View and Month View's page?  What will be your guess estimate days of 
> effort?

A lot of this depends on what your capabilities are with JavaScript/DOM/CSS.

The Day View would not be horribly difficult, relatively speaking,
because it's very similar to the existing Week View -- just narrowed
down to a single column. For an experienced developer who's familiar
with the codebase, it would not take so long -- maybe around a week or so?

For someone not familiar with the code, and new to Ajax, it would likely
take somewhat longer.

Month View would take a lot longer, since it's not similar to anything
we currently have. The length of time to develop it would depend on a
couple of factors:

1. How complicated or Ajaxey you want to make it -- a bare-bones month
view would be a lot faster to do than one that has a lot of fancy
styling or interactivity.
2. How integrated you want to make it with the rest of the Cosmo UI --
if you were just to pop the Month View up in a separate window, you
wouldn't have to move around any of the existing Cosmo UI elements to
make it fit in.

> 2) I am planning to have my calendar to take a XML feed to display all 
> my calendar's events, does the current cosmo's architecture support that? 
>     Sorry, hehe..i have to ask, will it be hard to tweak it to take xml 
> feed?

The current way that the Cosmo UI code talks to the server to get
calendar events is with an RPC service -- in the JavaScript code, it's here:

cosmo.ui.cal_main.Cal.serv

So if you have the Firebug JavaScript shell available, you can actually
make calls the the server with the console, with a JS command like this:

cosmo.ui.cal_main.Cal.serv.getEvents("24e55f6c-1507-414c-8d15-0996cec32b3f", 

1171087200000, 1171864799000);

The first parameter is the UID of the desired collection (calendar), and
the second and third are UTC date stamps for the range of the events you
want to get back from the service.

All the different service methods available to the UI code are all laid
out in webapp/js/cosmo/service/service_stub.js.

The results come back from the server as an array of CalEventData
objects in the JSON data format, which the Cosmo UI code then transforms
into actual JavaScript objects. We are not using XML with any of the UI
code related to calendar events.

However, the Cosmo server does implement a lot of CalDAV, which is an
XML-based method (based on WebDAV) of talking to calendaring servers.
You can find some info about that here:

http://wiki.osafoundation.org/Projects/CosmoCaldav

So if you wanted to write a front-end that talks CalDAV, you could get
your XML back that way.

We are also working on a better way of communicating with the server to
replace the RPC approach we're using now (possibly something
GData-based), that will likely support both XML and JSON.

> 3) Is it just a property setting to have a read-only calendar?

Each collection (calendar) has a 'privileges' property that tells you if
the user has write access. So, for example, in the code that draws the
event 'lozenges' (the little block things that represent events), you
see code that looks like this:

if (!Cal.currentCollection.privileges.write) {
     cursorChange = 'pointer';
}

>  
> Thanks.  Keep up the good work, the calendar looks fabulous.

Thanks very much for the kinds words, and for the interest in Cosmo. I
hope I answered your questions adequately.

Since other people out there may have an interest in this information,
or in what you're hoping to accomplish with Cosmo, is it okay if I
forward this message to the general Cosmo development mailing list? I'll
wait til I receive a reply from you to post it.

Thanks.


Matthew

p.s. Hope you've been able to use Cosmo okay in IE7 -- we've been doing
a lot more ongoing testing with it now that it's an officially supported
browser.



More information about the cosmo-dev mailing list