views:

488

answers:

2

Hi

I have some questions regarding calendars

  1. Is there any good calendar generates for either asp.net mvc or jquery. I would like to find something that can make calendars and have features like this.

    • Generates all the months (but of course only features the current month that is being displayed)
    • If the name of the calendar event is too long it cuts it off and if you click on it a popup comes showing you the full description
    • Ability to add a new task to the calendar. So when you click on it pops up a dialog box and you can fill out information.

    So basically what Google calendar can do. You can add a task then it pops up with like where, time notifications area.

    So is there any sort of solution like this for .net MVC or jquery? If not then I am willing to use other javascript frameworks if needed but rather not.

    I checked out http://arshaw.com/fullcalendar/ and it really does not have everything I need.

    I like this one http://www.redredred.com.au/projects/jquery-week-calendar/

    Since it almost does what I want but the major draw back this is that it only does weeks not a full month.

  2. Is there some sort of library that I can use to easily import google calendar data in, outlook calendar data in and basically any major calendar program.

    I know that icalendar is like the standard format so is there a C# library that will like parse this stuff?

  3. I going to need to store the calendar data in a database. How would the database table look like?

+2  A: 

I think that for the client side, you are asking for a little too much, to be honest. Your best bet is find the one that does the most that you want out-of-the-box but has enough customization to allow for you to fill in the functionality you are looking for. Either that, or write the code from scratch. To be honest, you are rendering a table with some jQuery on the front end for client-side events. It's tedious, but shouldn't be overly difficult.

As for a .NET library to handle calendar formats, I recommend DDay's iCal. It has some issues and requires some understanding to get running, but it works (I use it myself for a site that I project iCalendar entries from).

As for the calendar in the database, that's really up to you. The minimal amount of information you need is a date field, obviously. I'd recommend something with an offset (SQL Server 2008 has the datetimeoffset) since you might want to take into account time zones. Beyond that, any information you want to store is up to you.


In response to chobo2's comment about how to get the data to appear in the appropriate column, when you render the table, you are going to have a 7 x 5 table (seven days, five rows). I would suggest tagging each of them with the date.

Then, as you render your table, when you render the cell, you look to see if you have any events for your date, if you do, then render the cell appropriately.

casperOne
+1 for DDay's iCal, it worked great for a project we had!
brianng
Hmm ya I was looking at how to generate my own Calendar from server side. .Net has built in stuff like how many days are in the month but I am not sure how to get it to start on a certain day of the week. Like for instance December starts on a Tuesday. How would I get the first set of data to start in my 3 column(first column is sunday) of my table?
chobo2
Ya that is what I am planning to do. But my headers on my table are Sunday,Monday,Tuesday,.....Saturday I still have to label each table cell with a number (ie 1,2,3 till the end of the month). I can't just put the 1st in the first cell of my table since that would show that the 1st is a Sunday when in December the 1st is a Tuesday.
chobo2
@chobo2 - I still don't see the problem. Since you know the date of each of the cells, you can easily put the day component in the calendar. I think the problem you have is that you are thinking each cell should be keyed by the day, when it should be keyed by the *entire* date.
casperOne
I am not sure if I follow. To me it was a problem(I figured it out now) since if you look at any calendar it has the days of the week written at the very top. Now the 1st of the month is not always the same. Sometimes it is a Tuesday sometimes it might be a Friday. So you have to figure out where the first starts if it starts on a Friday then the 4 cells would be either blank or dates from the previous month. Now I am on the next problem and that is how to to generate the cells with the correct data efficiently. I don't want to have like 30 if statements checking what cell the stuff should be
chobo2
in do you have an example on how to maybe do this?
chobo2
+1  A: 

Why don't you start slightly less ambitiously? Google has a large team working on their calendar and for you to hope to replicate that without taking years will just end up with an unfinished project.

1

You said you didn't like FullCalendar but it does support 95% of the features you need from the calendar, minus actually clicking on days to add events.

FullCalendar is great for displaying events, but it isn't a complete solution for event content-management. Beyond dragging an event to a different time/day, you cannot change an event's name or other associated data. It is up to you to add this functionality through FullCalendar's event hooks

You get a dayClick event which you could use to add an event. I wouldn't bother though going this route though, and simply have a separate panel on the page with a text box for the name, a small icon which makes a Jquery UI calendar appear. It sounds low-tech but the pain of getting the click event working in all browsers would be a big task.

This textbox displays the full event name when you click on day which gets around your long text cropping issue. Alternatively this shows you a nice static html iCal-like solution which you may have looked at already.

Generating a month calendar for the year could be done statically using HTML instead of using jQuery.

2

If you stick to the iCalendar format for Outlook and Google, which both support it, then it's very easy to write a parser for that format as it's such a simple text format. This question has more details on making one, you could use an existing library for it.

3

A simple table of equivalent SQL types like below will be enough:

Events
Id
Name
Location
DateTime Start
DateTime End
bool IsRecurring

Recurring events will be the hardest part because of the calculations you have to perform to work out the next event. You don't store each occurrence in the database. Using the epoch for the calculations might help out, it's a technique Exchange uses.

Chris S