PDA

View Full Version : Design Discussion - Feedback and Ideas Appreciated



danh2000
22 Aug 2008, 4:36 AM
Hi,

Like many other people at the moment I've created a CalendarPanel with Month, Day, Week views etc, and the ability to load and display events via a DataStore.

8930

.. But I'm not ready to realease it yet:

My current implementation works well, but if I'm going to realease this as a user component I'm going to need to abstract out the implementation details: My Views need to know how to access data from the event records in the store, but I recognise that different users will have different methods of storing/defining events.

For instance one user may store an event startDate and startTime as seperate fields, another may store them together, one user may use the startTime and endTime to define all day events and another may have a boolean allDay flag...

Anyway, the only reliable way that I can come up with to abstract this out is to ask the developer using the calendar component to provide the field definitions, and to provide methods that know how to access the data that the calendar view needs (like implementing interface methods).

Something like this:



Ext.ux.xcalendar.EventRecord = function(){
var _define = function(fields,methods){
var r = Ext.data.Record.create(fields);
Ext.apply(r.prototype,methods);
return r;
};
return {
define: _define
};
}();

And to use:


var EventRecord = Ext.ux.xcalendar.EventRecord.define([
{name: 'id',type:'int'},
{name: 'startDate', type:'date', dateFormat:'d/m/Y'},
{name: 'startTime', type:'date', dateFormat:'H:i'},
{name: 'endDate', type:'date', dateFormat:'d/m/Y'},
{name: 'endTime', type:'date', dateFormat:'H:i'},
{name: 'allDay',type:'boolean'},
{name: 'title'},
{name: 'detail'}
],{
isAllDay : function() {
return this.get('allDay');
},
getStartTime:
getStartDay:
getStartMonth:
getTitle:
....
....
....
....


This could then be passed into the store which the calendar uses, and the calendar views would use the interface methods to access, filter and display the event details.

However I'm not entirely happy with this approach for some reason. Can anyone come up with an alternate approach or maybe some suggestions for improvement?

Thanks in advance,

dan.plifeye
2 Sep 2008, 3:13 AM
Looks great.

Am really after something like this at the moment for a project management app I'm writing for where I work.

At the web consultancy where I work we rely heavily on shared calendars via iCal and Windows Calendar with each member of staffs calendar store file being held on a private server in the ICS file format (http://en.wikipedia.org/wiki/ICalendar).

We employ many freelancers who work remotely so the app I'm writing will be essential for centralising data (jobs, tasks, timesheets, invoicing, etc..), and part of that data would be the ability for remote freelancers to view and update my company's shared calendars which in turn would update what we see on our desktop apps (iCal/Windows Calendar).

If I were to use your extension I would expect to use a PHP script/class to convert each of our ICS files into JSON which in turn would be fed into the store for your extension. And vice versa.

Below is a basic outline of a single ICS/vCalendar entry:


BEGIN:VCALENDAR
VERSION:1.0
BEGIN:VEVENT
CATEGORIES:MEETING
STATUS:TENTATIVE
DTSTART:19960401T033000Z
DTEND:19960401T043000Z
SUMMARY:Your Proposal Review
DESCRIPTION:Steve and John to review newest proposal material
CLASS:PRIVATE
END:VEVENT
END:VCALENDARThe variables I would pass/receive to/from your extension and store would be:

Unique ID
Start date & time
End date & time
Status
Summary
Description

It would be upto me to handle reading/writing to either a database or ICS file outside of your extension/ExtJS.

Just my t'pence worth :)