CalendarXP.net Support Forum Index CalendarXP.net Support
Most forums here are private and invisible to public.
 
 FAQFAQ   SearchSearch   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to load agenda events using csv file instead of javascript js file?

 
Post new topic   Reply to topic    CalendarXP.net Support Forum Index -> CalendarXP F.A.Q.
View previous topic :: View next topic  
Author Message
calendarxp
Site Admin


Joined: 30 Jan 2005
Posts: 409

PostPosted: Wed Oct 03, 2007 10:05 pm    Post subject: How to load agenda events using csv file instead of javascript js file? Reply with quote

By default, the standard way to load agenda is adding fAppendEvent() calls in the agenda.js. It's not very intuitive especially for non-programmers.

Actually, we can write the events in csv file (can be edited directly using MS Excel) and load it via the fLoadScript() function and then translate it into fAppendEvent() calls in javascript. You just need:
1. create a csv file in the same directory with agenda.js, e.g. events.csv
2. add the following code to agenda.js:
Code:
function parseCsvAgenda(req) {
   var csvText = req.responseText;
   
   var EventData=csvText.split("\n");
   for(i=0;i<EventData.length;i++) {
     var e=EventData[i].split(",");
     fAppendEvent(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10]);
   }

   fRepaint();  // refresh screen after loading finished
}

fLoadScript("/path/to/events.csv", parseCsvAgenda);

_________________
Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved.


Last edited by calendarxp on Tue Feb 02, 2010 6:54 pm; edited 2 times in total
Back to top
View user's profile Send private message
amcgibbon



Joined: 29 Dec 2009
Posts: 13

PostPosted: Wed Jan 27, 2010 6:01 pm    Post subject: Reply with quote

I'm trying to get this to work but have not been able to. Can anyone tell me what the field names need to be in the CSV so that they are pulled in?
Back to top
View user's profile Send private message
calendarxp
Site Admin


Joined: 30 Jan 2005
Posts: 409

PostPosted: Fri Jan 29, 2010 7:38 pm    Post subject: Reply with quote

You don't need to name any field/column. But you do need to arrange the fields/columns in the following sequence(leave field empty if no value):

Code:
year, month, day, message, action, bgcolor, fgcolor, bgimg, boxit, html, etc

_________________
Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    CalendarXP.net Support Forum Index -> CalendarXP F.A.Q. All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Copyright 2003- Idemfactor Solutions, Inc. All rights reserved.
Powered by phpBB © 2001, 2005 phpBB Group