Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Calendar style output

I keep one article per event for my non-profit organization. (http://www.beitrayim.org)

The ForEach statement produces a nice list of events for me.

However, has anyone ever come up with a ForEach stmt that outputs events as a calendar. Y'know, like the calendar on your wall, with events filled in?

Do I have to use javascript for this?

Thanks!

-Bob

Bob Bloom
Thursday, October 23, 2003

Bob :re "Calendar style output"

Check out the excellent HTML Month creator by John

http://www.johnsadventures.com/general/Backend.html

http://www.johnsadventures.com/backend/HTMLMonthCreator/HTMLMonthCreator.html

David Mozer
Thursday, October 23, 2003

David,

Thank you for your excellent and speedy post.

I've seen this page before, and I recall that it needs an extra install... Hmm, yup, there it is: "You are required to install the Microsoft.NET Framework 1.1 to get it to run (sorry about that, it's about a 23MB download...".

I won't be installing the NET Framework... so any more ideas?

Bob Bloom
Thursday, October 23, 2003

Copyboy also requires .net framework, so if you are using that you would already have it.

Ron Lane
Thursday, October 23, 2003

Hi people...  I also am after one, but have difficulty getting the concept to John's correctly and have difficulty working with XML..  (Inexperienced) I know that there is a number of calendar JS's at hotscripts.com which produce basic calendars and then I suppose manual manipulation will make links etc etc ...

Isn there a tutorial with Johns or can someone do a simple one for us dummies (Sorry Me)  :-)

Thanks all.
Grant

Grant
Friday, October 24, 2003

All my calendar app does is generate the html for a given month that you can then paste into either a variable in CityDesk or the html view of an article.

You don't need to know anything about xml to get it to work. There are instructions on my site about how I use it but it goes something like this...

I choose a month (the current one for example) and add the CityDesk magic names of each article published in that month along with the day each is published on using the 'Add' button. I then click the 'Copy' button to copy the html to the clipboard. I can flip over to CityDesk and paste it (Ctrl+V) into a variable or article (in html mode). I then save the list of links for month using the 'Save' button so I can update it when I post another article later (and replace the html I pasted into CityDesk). That's about it really.

There's a configuration file with it that lets you format the outputted html but you don't really need to touch it.

If anybody has a different idea as to how to do it I'd be happy to knock something together.

John C
Friday, October 24, 2003

your a star thanks John... 

Grant
Friday, October 24, 2003

Thank you for your excellent posts.

I've looked at the js script sites. There is one script where you enter events in a text file, and the js script evaluates these entries and puts the events in the proper box on the calendar. Still, the thought of integrating js with cityscript gives me a headache.

A quick-and-dirty idea: I'd love to build a table within a ForEach statement (well, the TD and the TR tags, the TABLE tag would be before the ForEach line). But there is no regular IF..THEN statement available in cityscript to evaluate if an article's fileddate=the 8th of the month (or the 10th of the month...). Then I could add IF day="Sunday" THEN </TD></TR><TR><TD> (to start a new row). And I'd just force the block of cityscript to start the calendar on the day of the week that that particular month started.

Hey, maybe there is a way to kludge this? Any ideas?

It's clear to me that for CityDesk to evolve, it needs a richer programming language, and this is yet another example of the need for a regular IF...THEN...ELSE statement.

Bob Bloom
Friday, October 24, 2003

I've started playing with a Perl script  to run after publishing that would convert a list to a 7 cell x 4 or 5 row table and place list items in the cell for the appropriate date. It will probably take me a few days to find time to finish it.

Ken McKinney
Saturday, October 25, 2003

Ken,

Thanks for your effort!

Can your PERL script accomodate my ForEach stmt?

ForEach x in (and (KeyWord="event")(thisFolder))
...
Next

-Bob

Bob Bloom
Saturday, October 25, 2003

Hello,

I noticed that some people have a problem with the huge runtime if you want to run .net software. I saw here, that it was about 23 MB. That's also the reason that i didn't download John's program.

So i started writing my own version of the program in VB6.

I hope i didn't break any copyrights, but i am sure that John will tell me, if i did.

The html that is generated by my program is almost the same as john's.

My programm doesn't contain any load or save button's because date's and magic names are saved as soon as you enter them. The same is for the loading. When you select a month and/or a year the right file is loaded based on the name of the month and year.

The zip file also contains a data.dat file. This contains the names of every months, and days. This is easy to translate into your own language.

The english version, contained in the zip file is:
January
February
March
April
May
June
July
August
September
October
November
December
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S
M
T
W
T
F
S

The Dutch version of this would be:
januari
februari
maart
april
mei
juni
juli
augustus
september
oktober
november
december
jan
feb
mrt
apr
mei
jun
jul
aug
sep
okt
nov
dec
Z
M
D
W
D
V
Z

A very early Beta version can be downloaded at

http://members.home.nl/pmathijssen/cdcalendar.zip

It's only 8 KB. You will need the VB runtime that can be found at

http://members.home.nl/pmathijssen/vbrun60.exe

My program will most likely contain bugs, so i would appreciate some feedback.

Sorry for the long post.

With regards,

PeterM

PeterM
Sunday, October 26, 2003

Hey, sounds cool to me.

If anybody would like a copy of the source of my calendar app (PeterM particularly if you want to copy any of the code for instance) then feel free to send me an email.

John C
Sunday, October 26, 2003

I was thinking that maybe I can integrate a nice js calendar with CS.

http://wsabstract.com/script/cut20.shtml

My headache is starting!

-Bob

Bob Bloom
Sunday, October 26, 2003

PeterM,

Great little program!

But how can I take a list of events for Sep, Oct, Nov and Dec, and list them right in your calendar?

And how can I automatically do this directly in an article?

Looking good!

Bob Bloom
Sunday, October 26, 2003

My program works the same as John's. So it just generates html that you have to put into a variable or in a article.

As you already said yourself, CityDesk isn't strong enough to make such a calendar just by using CityScript.

You asked:
But how can I take a list of events for Sep, Oct, Nov and Dec, and list them right in your calendar?

You mean be this, that you want a bigger calendar that shows every event inside the calendar?

PeterM
Monday, October 27, 2003

Any chance all you calendar obsessed types could put together a template or two for the template site?  That way all this knowledge won't get lost

Joel Goldstick
Monday, October 27, 2003

PeterM,

Yes, I want to produce something that looks like the calendar on your wall, with events listed in each day box.

It would be great to take a list of events and have a "wall calendar" produced automatically for each month that has an event.

Bob Bloom
Monday, October 27, 2003

Bob: re "Calendar style output"

So what you're saying Bob is that for "each" day in any given month you would have a Cell enclosed by 1px wide margins - then for "each" activity happening - and there could be multiple activities for each day requiring that cell [or every cell in that month] to be sized dynamically to accommodate the number of activities for that or any given day.

I seem to recall that I did see a Colander of that nature made available in a MS Word Style sheet but I cannot currently find it. I saw this being used in a large corporation where the senior VIP's would have their monthly activities printed out daily, by their admin secretaries , in that format on a letter sized piece of paper done in landscape. I also believe that the maximum number of activities for each given day could not exceed 10 lines of descriptive text. Some of those looked very untidy not because of broken lines but due to how crowded the text become as more daily activities were added in each cell. I also seem to recall that the maximum number of activities printed out were restricted to show only important events flagged by the VIP … In any case this can become very messy.

David Mozer
Tuesday, October 28, 2003

Hello Bob,

I made a new version of my program. With it you can choose to make a little calendar or a big one.

The little calendar is still almost the same as John's. On request of  Jeff Kolker i put in the option to specify a target with the link. Jeff uses frames on his site and he thought that would come in handy. If you don't use frames you can leave them empty.

With the big calender you can place one event per day. You also have to be aware not to make the text to long. The max. length allowed is 50 characters.

It can be found at

http://members.home.nl/pmathijssen/cdcalendar.zip

PETERM

PeterM
Tuesday, October 28, 2003

PeterM, David,

Thanks for your posts. PeterM, great program! You got it!

Oh gee, is there a way to connect your program to CityScript, so that I can generate the "big calendar" automatically? The only text I need to show for an event is the few words in the HEADLINE, with a LINK.

Here's hoping!
-Bob

Bob Bloom
Tuesday, October 28, 2003

Directly connecting to cityscript isn't possible. The only "solution" would be to modify my programm so that it could run after publishing but before ftp-ing.

It then could take a, cityscript generated, html page that looks something like:

January 2003
1;PTMFOG0000000026;New Year's Day
2;;
3;;
4;;
5;;
6;;
7;;
8;PTMFOG0000000028;Elvis born in '37
9;;
10;;

and turn it into a html file with a big calendar.

The original html page could be generated by a cityscript that, in it simplest form, would look like:

{$ forEach x in (folder "Calendar/January") $}
{$ x.headline $};{$ x.teaser$};{$ x.sidebar $}<br />
{$ next $}

That would mean that every event is an article.

To make it easier you could also use one article per month and generate the list yourself.

I will see what i can come up with.

PeterM

PeterM
Tuesday, October 28, 2003

More or less what I was aiming for with the perl script I mentioned earlier. I had it almost working last evening.  I'll put the whole thing in a template and upload it to the templates site. Probably this evening.

Ken McKinney
Tuesday, October 28, 2003

I posted a template called calendar-demo to the templates site.  It contains a perl script which when run as a post publishing step will convert a list specified by you, in a file specified by you to a table or tables of the right dimensions to display as a calendar.

I don't know if this really solves the large download problem - at least perl is only 8mb.  But it will create a calendar directly in city desk.

Ken McKinney
Tuesday, October 28, 2003

Hello Ken,

I have tested your perl script and it is looking great. And yes, de perl download is also big, so i deleted it after testing.

But anyway, i found two things.

First, the publish location wasn't there so i made my own.
Second, then it wouldn't work right, but maybe i made a mistake, so i started the script outside of cityscript and this time it worked.

I guess if Bob wants a calendar generated "automatically" your script is the closest there is.

PeterM

PeterM
Tuesday, October 28, 2003

Thanks for tring it Peter.  Yes it is rather dificult to tell what's happening when the script is run from within CityDesk.  Often all you can tell is that it worked or it didn't.

It may be easier to get it working if you Preview then cd to the temp directory and run the script. 

Ken McKinney
Wednesday, October 29, 2003

Hello Ken,

I tried different distributions of Perl, but the script seems only to work with ActiveState Perl. Other distributions are often smaller. Do you know of a distribution that also can handle your script.

PeterM

Peter Mathijssen
Wednesday, October 29, 2003

There shouldn't be anything in the script that's specific to ActiveState. At a guess one of the included modules can't be found or isn't included in the distribution. Although all of the modules I used are supposed to be part of the standard distribution. If you want to email me the details, what distribution, what errors you get I'll see if I can help.

I'll take a look around for lighter weight distro's when I get a chance.

Ken McKinney
Wednesday, October 29, 2003

*  Recent Topics

*  Fog Creek Home