My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 471: JSON feeds for testing
5 people starred this issue and may be notified of changes. Back to list
Status:  ExportedToGithub
Owner:  ----
Closed:  Aug 2015


Sign in to add a comment
 
Reported by cisack...@cox.net, Apr 30, 2010
I am among the many dozens of persons trying to us fullcalendar and simply 
need a link to a jason feed that works with this object.  With a real link 
and a real example, maybe we can get this working in a production 
environment.  The examples of hard coded dates is great for simplistic 
example - but useless in the real world.  After trying to read in 
eventSources of absolutely perfect json it looks like sending back even 
the simplest JSON event does not work, though those feeds work fine with 
plain Javascript to test those feeds on the client!!!!!

SOOOOOOO - Instead of this:
$('#calendar').fullCalendar({
    eventSources: [
        $.fullCalendar.gcalFeed("http://www.google.com/feed1"),
        $.fullCalendar.gcalFeed("http://www.google.com/feed2")
    ]
});

Why don't you give us an example of a real feed so we can get this thing 
tuned and useable?  I think a lot of us who already know JSON pretty well 
would appreciate the time this would same, and also illustrate the php you 
actually use to send the link back.

Would greatly appreciate a real json link ... thanks much in advance.
Apr 30, 2010
#1 naunaud...@gmail.com
I throw my JSON from PHP using json_encode() (I format it so that it matches the
Event Object specified in the doc)
(and of course I use utf8_encode() for strings that might have accents)

Apr 30, 2010
#2 cisack...@cox.net
Thank you, naunaud128.  
Apr 30, 2010
#3 naunaud...@gmail.com
You're welcome.

May 2, 2010
#4 cisack...@cox.net
I found a link to a working json fullcalendar events provider in the project on the
web site.  It at least proved I had the json correct, but still cannot provide for
the events being displayed, not even in an MVS application.  Some days are just that
way....
Oct 7, 2010
Project Member #5 adamrs...@gmail.com
(No comment was entered for this change.)
Status: Maybe
Oct 7, 2010
Project Member #6 adamrs...@gmail.com
(No comment was entered for this change.)
Status: Misc
Mar 8, 2011
#7 liakosko...@gmail.com
I am stuck with this this plugin, i need a real json example that works, is it so difficult to display one?
Jun 12, 2011
#8 yaasee...@gmail.com
omg... somebody come up with a working solution for the latest version of the plugin plz... preferably using vb.net!
Jun 13, 2011
#9 cisack...@cox.net
Here is my C# script to provide the event(s) feed to the FullCalendar page.  
I fill a CalendarEvent object with calendar event attributes from my workorder system (open work items needing attention) and then use an Ajax response to send the appropriatly formatted data to the FullCalendar.  The FullCalendar is extremely useful and flexible.  As an addtion, I provide a division at the bottom of the calendar that displays all the necessary attributes of each item that receives a mouseOver event..  The default calendar allows the events on the calenar to be moved by users and the resulting change in date is then used to update the database.  It is totally integrated into a production setting.

I truly hope this helps anyone who looks this over, but remember, the C# can be any language - PHP, C++ or just plain javascript - providing the appropriate format to the 

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public class CalendarEvent
{
    private string id = string.Empty;
    private string startYear = string.Empty;
    private string startMonth = string.Empty;
    private string startDay = string.Empty;
    private string startHour = string.Empty;
    private string startMinute = string.Empty;
    private string title = string.Empty;
    private string url = string.Empty;

    public CalendarEvent() {}
    
    public string ID
    {
        get { return id; }
        set { id = value; }
    }

    public string StartYear
    {
        get {return startYear;}
        set{startYear = value;}
    }

    public string StartMonth
    {
        get { return startMonth; }
        set { startMonth = value; }
    }

    public string StartDay
    {
        get { return startDay; }
        set { startDay = value; }
    }

    public string StartHour
    {
        get { return startHour; }
        set { startHour = value; }
    }

    public string StartMinute
    {
        get { return startMinute; }
        set { startMinute = value; }
    }

    public string Title
    {
        get { return title; }
        set { title = value; }
    }

    public string URL
    {
        get { return url; }
        set { url = value; }
    }
}


 - This is an Ajax response (in C#) for the calendar's event feed:
using System.Text;
public partial class FullCalendar_EventsFeed : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
            if (System.Convert.ToInt32(Request.QueryString["groupId"]) != -95)
            {
                string stringForJavascript = this.tokenizeCalendarEvents(System.Convert.ToInt32(Request.QueryString["groupId"]));
                Response.Write(replaceSingleQuotes(stringForJavascript));
            }
            else
            {
                if (System.Convert.ToInt32(Request.QueryString["groupId"]) == -95)//drag-drop update
                {
                    DataAccess dataAccess = new DataAccess();
                    string woid = Request.QueryString["eventId"].ToString();
                    string newStartYear = Request.QueryString["YY"].ToString();
                    string newStartMonth = dataAccess.AddLeadingZero(Request.QueryString["MM"].ToString());
                    string newStartDay = dataAccess.AddLeadingZero(Request.QueryString["DD"].ToString());
                    string newStartHours = dataAccess.AddLeadingZero(Request.QueryString["HR"].ToString());
                    string newStartMinutes = dataAccess.AddLeadingZero(Request.QueryString["MIN"].ToString());
                    CalendarEvent calendarEvent = new CalendarEvent();
                    calendarEvent.ID = woid;
                    calendarEvent.StartDay = newStartDay;
                    calendarEvent.StartHour = newStartHours;
                    calendarEvent.StartMinute = newStartMinutes;
                    calendarEvent.StartMonth = newStartMonth;
                    calendarEvent.StartYear = newStartYear;
                    dataAccess.UpdateWorkOrderFromDragDrop(calendarEvent);
                    Response.Write(String.Format("<b>Updated Work Order #{0} starting date/time to {1}-{2}-{3}T{4}:{5}</b>", woid, newStartMonth, newStartDay, newStartYear, newStartHours, newStartMinutes));
                }
                else
                {
                    Response.Write("[{}]");
                }
            }
        }

        protected string replaceSingleQuotes(string forJavascriptArray)
        {
            string replacedString = string.Empty;
            string squote = "" + "'";
            string dquote = "" + (char)34;
            replacedString = forJavascriptArray.Replace(squote, dquote);
            return replacedString;
        }

        protected string tokenizeCalendarEvents(int groupId)
        {
            DataAccess dataAccess = new DataAccess();
            List<CalendarEvent> calEventList = dataAccess.ListCalendarEventsForGroupId(groupId);
            //string stringForJavascript = "[{'id':111,'title':'MainEvent','start':'2010-05-10T07:00:00','end':'2010-05-10T09:30:00','url':'?EventID=111','allDay':false},{'id':112,'title':'Event2','start':'2010-05-22T08:00:00','end':'2010-05-22T10:00:00','url':'?EventID=112','allDay':false},{'id':113,'title':'Event3','start':'2010-05-21T08:00:00','end':'2010-05-21T10:00:00','url':'?EventID=113','allDay':false},{'id':114,'title':'Event4','start':'2010-05-01T08:00:00','end':'2010-05-01T10:00:00','url':'?EventID=114','allDay':false},{'id':115,'title':'Event5','start':'2010-05-05T08:00:00','end':'2010-05-05T10:00:00','url':'?EventID=115','allDay':false}]";
            StringBuilder sb = new StringBuilder();
            sb.Append("[");
            int itemCount = 0;
            foreach (CalendarEvent item in calEventList)
            {
                itemCount++;
                sb.Append("{'id':" + item.ID + ", ");
                sb.Append("'title':'" + item.Title + "',");
                sb.Append("'start':'" + item.StartYear + "-" + item.StartMonth + "-" + item.StartDay + "T" + item.StartHour + ":" + item.StartMinute + ":00',");
                sb.Append("'url':'" + item.URL + "',");
                sb.Append("'allDay':false");
                if (itemCount == calEventList.Count)
                {
                    sb.Append("}");
                }
                else
                {
                    sb.Append("},");
                }
            }
            sb.Append("]");
            return sb.ToString();
        }
    }

Aug 13, 2013
Project Member #10 adamrs...@gmail.com
(No comment was entered for this change.)
Summary: JSON feeds for testing (was: Give us a real JSON link to test!!!)
Status: Accepted
Labels: -Type-Enhancement Type-Other
Aug 21, 2015
Project Member #11 adamrs...@gmail.com
Discussion for this issue has moved to the following URL:
https://github.com/fullcalendar/fullcalendar/issues/741

This is because Google Code is shutting down. Apologies if you are being pestered with these notifications. This is a one-time event.

Happy coding,
Adam
Status: ExportedToGithub
Sign in to add a comment

Powered by Google Project Hosting