Jump to content

Calendar Projects?


rpaterick

Recommended Posts

Anyone done a calendar project?

 

I'll try to keep this simple on what I'm trying to do.

 

Each month, certain days in the calendars numbers(see attached .jpeg for example) would be high-lighted and driven from data.

 

Below, the high-lighted events would then state what the day signifies as stated in the data file. Example you see has the wrong month but you get the idea.

 

Any ideas as to where to start on the calendar chart/table and how the data should be setup?

 

Is this even possible in FusionPro?

 

Thanks,

Ryan

cal.jpg.589cddffd27fc6a3a0d4055a797525ed.jpg

Link to comment
Share on other sites

Sure, this is definitely possible. Here's an example which generates a table representing a calendar for a particular month, based on the "Itinerary" tables in the Frodo Travel tutorial:

function IsAHoliday(date)
{
 // Placeholder; we celebrate the third of every month here in Dan-istan!
 return date.getDate() == 3;
}

var Month = 1; // EDIT THIS (1 for January, 2 for February, etc.)
var Year = 2010; // EDIT THIS

var result = "";

var JSMonth = (Month-1)%12; // zero-based
var theDate = new Date(Year, JSMonth, 1);
var MonthName = FormatDate(theDate, "lm") ;

result += '<table columns="7" ' +
         'title = "above" ' +
         'alignment = "left" ' +
         'space = "above:120;below:120" ' +
         'margins = "top:60;bottom:40;left:600;right:600" ' +
         'columnrules = "freq:1;default:Thin,Black;alternate:Thin,Black" ' +
         'rowrules = "freq:4;default:Thin,Black;alternate:Thin,Black" ' +
         'HeaderRules = "rule:Thin,Black;separator:Double,Black" ' +
         'boxrules = "top:Thin,Black;bottom:Thin,Black;left:Thin,Black;right:Thin,Black" ' +
         'drawbrule = "false" ' +
         'shadestyle = "by:row;first:2,Black,0;next:2,Black,0" ' +
         'rowformat = "min:100;max:700;start:AsIs;keepnext:false;keepprev:false">\n'

for (var day = 1; day <= 7; day++)
 result += "< column width = 8000 />\n";

result += "<title gap = 25><para>" + MonthName + "</para></title>\n";

//result += "<row><cell>Sunday<cell>Monday<cell>Tuesday<cell>Wednesday<cell>Thursday<cell>Friday<cell>Saturday";
result += "<row><cell>s<cell>m<cell>t<cell>w<cell>th<cell>f<cell>s\n";

// Initialize to the first Sunday of the week containing the first day of this month.
theDate.setDate(theDate.getDate() - theDate.getDay());

do
{
 result += "\n<row>";  
 for (var day = 0; day < 7; day++)
 {
   result += "\n\t<cell>";
   if (theDate.getMonth() == JSMonth)
   {
     if (IsAHoliday(theDate))
       result += "<color name=Red>" + theDate.getDate() + "</color>";
     else
       result += theDate.getDate();
   }

   theDate.setDate(theDate.getDate() + 1);
 }
}
while (theDate.getMonth() != (JSMonth+1)%12)

result += "\n</table>";
return result;

You can modify the logic in the IsAHoliday function, or the code that calls it, to indicate a "special" date that you want to appear differently (in Red in this example). You could also easily put all of this code (after the initial declaration of "result") into a loop such as this to get an entire year:

for (var Month = 1; Month <= 12; Month++)

Please refer to the Tags Reference Guide for detailed information on how to modify the table tagging to get the results you want.

 

I hope this helps to get you started!

Link to comment
Share on other sites

 

I hope this helps to get you started!

 

Hi Dan,

 

Attached is a sample data file that will be used along with the .jpeg that is here also. Not sure if you saw this latest .jpeg as I posted two different calendar versions by accident.

 

I would have to run three tables, one for each month correct? How would you call out just the column position or column name for each month for that particular table?

 

Sorry I wasn't more clear in the beginning.

 

Thanks Dan for your help!

cal.jpg.3027474b0bd9cc89d1af7c8e35ab447b.jpg

January.txt

Link to comment
Share on other sites

Well, I can't build the whole job for you. I was only trying to help get you started by answering this question:

Any ideas as to where to start on the calendar chart/table and how the data should be setup?

And this question:

Is this even possible in FusionPro?

The answer to which, of course, is Yes.

I would have to run three tables, one for each month correct?

Yes.

How would you call out just the column position or column name for each month for that particular table?

I would just use three separate text frames, and have them call three different rules, like so:

return GenerateCalendar(1, 2010);

return GenerateCalendar(2, 2010);

return GenerateCalendar(3, 2010);

Putting the logic from my previous post into a function in the JavaScript Globals with parameters for the month and year,which would start like this:

function GenerateCalendar(Month, Year)
{
//...

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...