Progress of Calendar development

Progress of Calendar development

by John Papaioannou -
Number of replies: 77
As Martin suggested, starting a new thread. The length was beginning to annoy me too. smile

Yesterday we had some problems with our external internet connection, so I couldn't post or read people's postings. So I 'm posting now (first thing in the morning) and by the end of the day I'll probably post again.

Stuff from Jan 21:

Screenshots and notes:

Picture 1: Again, the sideblocks for the month view and upcoming events.Points of interest:

  1. I 've changed the colors a bit, the old ones were "development colors". The color on Jan 20 - 22 is the "user event" color (least significant), Jan 25 is the "course event" color (stands out) and the light green (not very intrusive but stands out A LOT) is for site-wide events. These would normally be rare, of course.
  2. There are separators between upcoming events.
  3. Notice that "January 2004" is hyperlinked. This will take you to the main calendar page, in the full month view. (I 've done no work on it yet, though).
  4. The same goes for the days, which are also hyperlinked. This will take you to a detailed 'day view'.
  5. Notice on Jan 23 and 28 the lines above and below the day? These denote that an event of a certain type (e.g. pale green for sitewide event) that has already started is continuing. You can deduce from the display, for example, that there is a sitewide event which starts on Jan 27 and ends on Jan 28.
  6. I 've made "Expired" events stand out more (expire in bold red letters)
  7. The upcoming events block now states the duration of events, if they have one (2nd, 4th, and 5th events in the screenshot). Notice the different way the duration is displayed in the 4th and 5th events. This is because the 4th ends the same day it starts, while the 5th does not.
  8. The 4th event has the modulename, instance, and courseid fields set in the database. This means that an activity module set it, so its icon is displayed before the event name (this is an Assignment).
  9. The Description field is no longer displayed. We just use Name (it's shorter).


Picture 2: A new screen, the "My Calendar" page. This is where you do anything regarding your calendar from. Points of interest:


  1. Mini display of previous, this, next month on top. Notice the tooltip which says "1 event". When taking the screenshot, I was hovering the "27" link with the mouse. So, hovering a link shows you how many events for that day. This is also true for the sideblock.
  2. Expanded Upcoming Events view. This also shows the Description field for events.
  3. In this screen, you see events from ALL courses you take part in (either as student or teacher). So, before the 4th event, you can see that we also display which course it concerns. The name is also hyperlinked for the user's convenience.
  4. The last visible event is sitewide. So the "Moodlesite" hyperlink takes you to the index page.

Martin:

I hope that something like the expanded event view in picture #2 is what you had in mind for the "MyMoodle" page. It's very easy to reproduce this part of the display in MyMoodle, just include calendar/lib.php and call a couple of functions. Am I going in a direction you like?

Average of ratings: Useful (1)
In reply to John Papaioannou

Re: Progress of Calendar development

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Looking terrific so far, Jon!
In reply to Martin Dougiamas

Re: Progress of Calendar development

by John Papaioannou -
What do you think about the "daily events popup" idea when you click on a date in the miniview? Should I do that, or just take you to the day view page? Or provide both options, with configuration?
In reply to John Papaioannou

Re: Progress of Calendar development

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
An effective trick for "popups" or "tooltips" is using DHTML ... as long as they were kept small it could be very useful ... see the very slick little library overLIB, which I have been intending to add to Moodle CVS anyway. These popups can contain HTML, such as links etc (see last example here). For people without Javascript, clicking on the date number would just go to a normal day view page (not a popup).

I like the display on the MyCalendar screen, that's pretty much what MyMoodle should contain I think, except the overview will be of all enrolled courses, obviously.


As with all new developments, we have to keep two general things in mind (obvious to some of you maybe but I just thought I'd mention them):

  1. How much will the increase in page size or number of page loads slow things down for modem users? I had a reminder of this in the past few days when I was away from home and working on a modem connection again.

  2. How much processing time will the new stuff add? It might not be much per user but many Moodle sites are thousands of users - every bit of speed helps.

I haven't looked at your code yet and don't know the answers to these in this case ... I'm just making a Moodly observation that may help some design decisions - ie keeping things as simple as possible without losing important functionality.

In reply to Martin Dougiamas

Re: Progress of Calendar development

by John Papaioannou -
Fair enough, I 'll do some kind overLib popups then. I 've used overLib before, so that shouldn't be much trouble.

As for the display in MyCalendar, it already is configured to show all enrolled courses. But I 've switched the 3 monthly views to the right side, because upcoming events need more vertical space (to show more of them) and not so much horizontal (this helps only for very long descriptions). Anyway, the extra vertical space makes the page more usable just about always, I think.

Right now I 'm finishing the detailed monthly view, and I hope to also do the day view and "specific event" view today.

About your two general points:

  1. On existing Moodle pages, the increase shouldn't be a problem. It is about as bad as it gets (many TDs, all with long class attributes if you want the mini month view), but it's just a table in pure HTML. That can't be too bad. And of course you can always switch it off.
  2. I don't know about overLib though... that's about 10k in the "lite" version, if I remember correctly.
  3. Processing time can't be helped very much. There are some things I can do (cut the foolproof code and just give them an error() if something's wrong), but I would be reluctant to do that. Even if it's code that just ensures you get a meaningful display if you tamper with the URLs and request the monthly view for month 14 of year -300.
  4. And of course, we can also lose functionality to optimize. But we 'd have to be desperate to do that.
In reply to John Papaioannou

Re: Progress of Calendar development

by Bryan Williams -

Jon,

This is all coming together very nicely indeed.  A personal note of thanks for everything you have done to make this valuable addition to Moodle a reality.  On the large calendar view at the top in your screenshot caption reads "Moodle Calendar."  Could this be set to <site_name> Calendar.  For my site it might be JLife Calendar, indicating the name on the front door link.

In reply to John Papaioannou

Re: Progress of Calendar development

by John Papaioannou -
Calling it a day once more...

Stuff from Jan 22:


General notes:

  1. styles.php: In answer to Grant McWilliams's last post on the other thread, my styles.php is no less than 30(!) CSS rules richer than a normal copy. Note: 30 new rules. Not 30 new classes!
  2. Compatibility: Speaking of CSS... I 'm constantly testing this on Firebird 0.7 and IE6 SP1, both under Windows 2000. It all works like a charm. The only thing that I don't like is that Firebird's rounded borders from some blocks aren't drawn correctly. You can see this for example in my screenshot #3 for today. Anyone have any idea why? Also, if anyone can provide feedback in regard to compatibility with other browsers, please do so.
  3. Heading: The site shortname is now displayed as the first heading (suggested by Brian Williams)
  4. Popups from the mini monthly view: Since there is so much demand for this feature, it's going to happen. Tomorrow. smile
  5. Layering of events from various sources: OK, this might also be useful. But before starting to work on it, I want to be sure that it's going to be used. So I want a little more input. Which screens should the filters be present in? And what kind of filters? How do you propose to maintain the filtering when the user uses another calendar link, or even a link which I have no control over? Should it (the filtering) be maintained at all in such a case?

Screenshots and more notes:

Yesterday's picture #1 is still valid. Read about it in my first post.

Picture #1: This shows the fully expanded month view. It's really a bigger version of the mini view, with these changes:

  1. Each day you get to see the names of the events that happen. You can also click on them to see all information available about this event.
  2. Events with a duration are also shown until they expire, but they are dimmed and you cannot click on them. I wanted to make them unobtrusive, since they could very well fill up the calendar. They are always displayed after the day's new events.

Picture #2: This shows the fully expanded day view. You can see details about all events which start that day. Events which have started in the past and continue through that day are NOT shown, because I think they would add quite a lot of overhead. However it IS possible to show them (use a query like timestart < thisdaymidnight AND timestart + timeduration >= thisdaymidnight), so what do you say about that? Also:

  1. Notice how there is a "start time" and "end time" for events with duration, while just "time" for events without.
  2. The second event (which is what would be automatically set by the assignment module) has links for the course and module instance it belongs to.
  3. The month's name, on top, is hyperlinked. This goes to the expanded month view.

Picture #3: Martin's wish. Based on what discussion we 've had, this would be just about right? Notes:

  1. See the hyperlinked "Calendar" up at the navigation bar, just below the site name? This is where it brings you.
In reply to John Papaioannou

Re: Progress of Calendar development

by W Page -

Hey Jon!

OuttaSight!!

Just two little requests. 

  • What about making the module pages printer-friendly/pdf converted/mailto(???)?
  • Allow Admin to determine if the pages can be printer-friendly, converted to PDF, and/or mailed to others.

Just one little question. 

  • If a student is in more that one course will all the events from all the other courses also be listed?
WP1
In reply to John Papaioannou

Re: Progress of Calendar development

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers

Hi -

I just installed this version and input my own event in the event table, but I can't get the event to show up in the event list. In fact I get an error from "print_side_block":

Warning

 

: Invalid argument supplied for foreach() in C:\Inetpub\wwwroot\dotrust\moodle\course\lib.php on line 742 (This is because, since there is no "content", it tries to walk the array "list", which isn't an array.)

Anyway, any idea why my event won't show? I filled in a 'name', 'description' and 'timestart'. Here's the data record:

SQL-query: SELECT * FROM `mdl_event` LIMIT 0, 30;

100Board PresentationPresentation of the Moodle system to the Board.11075131000100
In reply to Mike Churchward

Re: Progress of Calendar development

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers

Hmmmm.

I outputted the SQL query that goes to the event database. It looks like this:

timestart + timeduration >= 1074747600 AND timestart <= 1076561999 AND ( userid = 1 OR (courseid = 0 AND userid = 0 AND groupid = 0) OR courseid IN (4)) ORDER BY timestart

My "event" table doesn't have the 'timeduration', 'userid' or 'courseid' fields. Am I using the right table?!?

Aha! There is no SQL script setup. I'm using the old event table from Webcalendar. Of course. I have to set this table up manually don't I?

Okay Jon, I've gone back through the discussion chain, but I can't find the SQL definitions. Can you repost the 'event' table description?

mike

In reply to Mike Churchward

Re: Progress of Calendar development

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Get the latest CVS version of Moodle and it will create the table for you.
In reply to Martin Dougiamas

Re: Progress of Calendar development

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers

Thanks Martin.

I didn't realize it had been checked into CVS already.

mike

In reply to John Papaioannou

Re: Progress of Calendar development

by W Page -
Hi!

I attempted to install the calendar but I have a few questions after ending up with a blank "index.php"

1. The changes in the format.php.
I was only able to make the changes in two files in the "format" directory inside of the course directory. One of the files in that director did not have the line,

print_side_block($stractivities, "", $moddata, $modicon);

(unfortunately I am not by me FTP program so I can say for sure which one but I know that one inside the format foldear did not have the line.)

2. Does the Calendar folder go inside the main MOODLE directory or inside of the "mod" directory?

3. You need to make it clear that the style changes have to be done inside of each color folder in the "style.php" file.

Folks like me need explicit instructions . ;) smile

Initially I got a "calendar needs permissions" type of error message at the top of the index page. I when in through my FTP program and checked the permissions for the other folders. I got 644. So I CHMODed the Calendar directory located in the main MOODLE folder to 644. Now I have a blank "index.php".

Anybody who can help me out? Pleaseeee!!

WP1
In reply to W Page

Re: Progress of Calendar development

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Dear WP1 (strange name!),

I don't want to discourage you from learning about Moodle and Unix but this Calendar stuff is very very new and still being developed - notice this is the Developer forum... would you rather the developers spent time helping users with a half-finished product or would you rather they used the time to finish it and make it easy to use? wink
Average of ratings: Useful (1)
In reply to Martin Dougiamas

Re: Progress of Calendar development

by W Page -

Hi!

I got the site back, but I am still getting the "Module 'calendar' is not readable - check permissions" message at the top of the home page.

All I really need is the correct permission of the calendar directory and its correct placement in the files and directories.

I make it clear I am not a programmer but developers should hear from those of us who use the product and know the needs (I do understand that some of the developers are instructors/teachers as well) before development is completed.  A big complaint of those of us who use products, is, on many occasions the product lacks many of the things needed to work well.  By then it is too late to make significant changes.

Also, instructions do count.  We tell our students that all the time.  I will attempt to be more invisible. wink

BTW, it was the  "format.php" inside the "social" directory that did not have the following string in it,
print_side_block($stractivities, "", $moddata, $modicon);
that is,
/moodle/course/format/social/format.php

WP1

In reply to W Page

Re: Progress of Calendar development

by John Papaioannou -
Quick answers:

  1. I 'm using the topics format, so I didn't bother with the other two for now. It doesn't make any difference anyway, as long as you put the code somewhere "near" the right place.
  2. Inside the Moodle directory. The fact that this isn't a mod was made explicitly clear from Gustav's very first post on the previous thread.
  3. Not when developing, you just modify the one you 're using! smile

Please keep in mind that my instructions aren't meant for everyone, but for other developers that want to see how it comes along. This is the reason I 'm posting screenshots and comments each day, so that you don't have to install it if you just want to have a look. You 're welcome to try, but of course as Martin said, I prefer to spend my time coding rather than writing user manuals.

Anyway, when this is finished there will be no such problems: either it 'll be included in the Moodle distribution (so you have it automatically) or I 'll write more detailed instructions. WHEN it is finished.
Average of ratings: Useful (1)
In reply to John Papaioannou

Progress of Calendar development: Slowly wrapping it up

by John Papaioannou -
Stuff from Jan 23:

  1. Popups are done, and with them also the "event details" view. For now this is just a watered-down version of the day view, but maybe sometime in the future it will be expanded. For example, maybe it can have a different layout according to what kind of event it shows etc. You can see a screenshot of this, along with a popup, here.
  2. Today I 'm not posting code, since I didn't find overLib in CVS (Martin? time lag?) so I had to wing it a little. There are also some loose ends that I 'd prefer to take care of, but I don't have time to do it today. And there really isn't any functional change other than popups.
  3. During the weekend I probably won't be around an internet connection, so it's possible that next time I check in will be Monday.
  4. Starting Monday, I 'll implement event filtering (I have a nice idea of how to do it), tie up the loose ends and begin to wrap the package up. The time I have available to work on this is slowly running out... sad
In reply to John Papaioannou

Re: Progress of Calendar development: Slowly wrapping it up

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Looking forward to seeing it. About CVS ...

a) Overlib is in there but public/anonymous CVS does lag on Sourceforge by about a day - if you email me your username I can add you as a developer which has no lag at all

b) CVS in general has been cactus lately for everyone ... Sourceforge are having issues ...
In reply to John Papaioannou

Re: Progress of Calendar development

by Loren Winfrey -
Is there somewhere I can get these files. I get an error cannot resolve host?
In reply to John Papaioannou

Re: Progress of Calendar development

by John Papaioannou -
Hi everyone!

First of all, let me say that Calendar development continues and things are starting to take their final form. For all developers out there, now is a very good time to install this on your Moodle and see how things are. The installation process (read the installation instructions) is very simple and Calendar itself is very stable. A note: please make sure you have the absolutely latest nightly package before doing this!

Today I 've implemented a color legend for the sideblock, basic filtering (by event type: course, global, group, site), removed all hardcoded values and prepared to put the user preferences into the Moodle database.

Before finishing, I will also add: event adding/editing capabilities (admins/teachers mostly) and some sort of more detailed filtering (by specific course is what I have in mind). What I 'm thinking is that this latest filter will be present only in the full month view (there's no space in other screens).

So, if you want to see how it works and perhaps make a suggestion, download cal_dev.zip and happy tinkering!

In reply to John Papaioannou

Re: Progress of Calendar development

by Peter Sereinigg -

I am no developer, but is it possible and not to riski to try this version now? the possibilities whould be very usufull in my nex course ....and friends of mine like my "lucky" hand to find errors ....

Peter

In reply to Peter Sereinigg

Re: Progress of Calendar development

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
It's not finished ... it's not connected to the modules yet (so that events are created automatically).
In reply to John Papaioannou

Re: Progress of Calendar development

by Bryan Williams -

Jon,

Made a test Moodle installation tonite and installed Calender.... FANTASTIC.  Nice job on the instructions and I look forward to the next build.  Keep up the terrific work you are doing to make Moodle even greater than ever.  big grin big grin wink

In reply to John Papaioannou

Re: Progress of Calendar development

by John Papaioannou -
This thing is 95% ready! w00t! big grin big grin

All of the functionality planned is now done! New additions:

  • Event filtering by specific course (full month display only)
  • Interface to add new events!
  • Event editing (but not deleting... should this be allowed?)
  • Full support for group events (heh... unless there's a bug somewhere wink)

So you can now download it, read the installation instructions and have countless hours of fun playing with your brand new Moodle calendar!

Tomorrow is RC1 day...

Martin, thanks for all the help these past days. And the CVS access! smile
And of course, thanks to everyone who took the time to make suggestions and comments... this wouldn't be the same if you didn't point me in the right direction at times.
In reply to John Papaioannou

Re: Progress of Calendar development

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers

Cool!

If I get the latest CVS version of Moodle, will it come with the calendar already attached, or do I still need to download it and patch it in separate?

mike

In reply to John Papaioannou

Re: Progress of Calendar development

by Chris Weber -
Great Work here.  Two questions:
  • Are you planning to hook the calendar into the site's front page
    • That would be good for site-wide events, like holidays. 
  • What part of the calendar code governs which side the calendar block is on?
In reply to Chris Weber

Re: Progress of Calendar development

by John Papaioannou -

1. That's very easy to do, but of course it's up to Martin.

2. I presume you mean inside the course view. Well, at this time it's the exact line in which you call calendar_side_blocks(). There is no configuration for this. Do you think there should be? I mean, Moodle doesn't allow sideblock reordering etc, so is it a good idea to go on and "roll my own" solution just for the calendar? Even though there will be a "preferences" page...
In reply to John Papaioannou

Re: Progress of Calendar development

by Chris Weber -
I suppose for the front page, if Martin allows the calendar to appear on the front page, I would want the calendar to appear on the left-hand side. But for a course in topic or weekly format, I think I would want the calendar to appear on the left-hand side and the upcoming events and maybe a today's events sideblock to appear on the right hand side.

My reasoning is this: New content for courses (New forum posts, new participants, other updates) already appears on the right. I think updates to the calendar should appear there too, but in its block so that the calendar information can be more organized.

From an aestetic point of view, the addition of more right-hand blocks will make the look and feel seem more consistant. We might even have a situation where # of left-hand blocks = # of right-hand blocks.
In reply to John Papaioannou

Re: Progress of Calendar development

by Bryan Williams -
Jon,
This is looking better and better, thank you for a great addition to Moodle. approve

I also wonder if site-wide events will appear on front page in an "Upcoming Events" window area. Also, will top Moodle navigation links be preserved when you enter Calendar view or create new events, or is "Courses" area now serving this purpose?   Would it be advisable to put a "Time Zone" selection in the event creation properties area (US includes 6 zones I believe).  Although the correct zone for say a chat could be added to the event description, it's the Course: and Time: area that imediately gets your attention, so if you don't read description closely you could miss an event.

Amazing how quickly Moodle is evolving these days, thanks Martin! smile
In reply to Bryan Williams

Re: Progress of Calendar development

by John Papaioannou -
Hi, and thanks!

Upcoming events on the front page is Martin's call. I 'm not sure exactly what you mean in your next question, but if I understand correctly the answer is no, links won't be preserved. There is the "My courses" sideblock at the left in all calendar screens.

As for the time zone... to be truthful, I haven't thought of this. What would be a possible solution? Store all times as GMT and compensate when displaying them according to the timezone of the person who set a particular event?
In reply to John Papaioannou

Re: Progress of Calendar development

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
All times in Moodle are stored as GMT, and the events table will be the same.  When a user has selected a time from a menu in Moodle, the time always gets converted to GMT for consistent storage, using the make_timestamp() function.

When displaying times, you should use the userdate() function which will convert this GMT number into something the current user understands. 

In the calendar calculations you will need to include the current user's timezone to determine which box the event should appear in.  See usertime() for example.

(Timezone calculations can get very confusing - hope this helps)
In reply to Martin Dougiamas

Re: Progress of Calendar development

by John Papaioannou -

OK, so when I 'm about to store something, I make_timestamp() it. Simple.

When retrieving data, first we have to define the time window. For example, if events for Jan 29 are requested, I should retrieve events not for the GMT Jan 29, but for Jan 29 from the user's local time perspective, so:

  1. The user "gives us" the details for the time window (eg. Jan 29). I get the timestamps for the time window in GMT, again using make_timestamp().
  2. Retrieve records since we 're all talking GMT now.
  3. Having the records, I use usertime(), userdate() and usergetdate() as needed to convert back to the user's local time before displaying.

Did I get this right? smile
In reply to John Papaioannou

Re: Progress of Calendar development

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
In step 3, userdate() is probably all you need in practice. But yes, that's it.
In reply to John Papaioannou

Re: Progress of Calendar development

by Dr. Ali Abureesh -
Picture of Core developers Picture of Translators

I've just downloaded the moodle-latest.zip and followed the Installation instructions for the Calender, but I'm getting the following:

1- Module 'calendar' is not readable - check permissions.
2- when I try to turn editing on I get a blank page.
3- When I open a course that has Topic format I get Fatal error: Call to undefined function: calendar_print_side_blocks() in f:\phpdev5\www\moodle\course\format\topics\format.php on line 94

What could be wrong?!

In reply to Dr. Ali Abureesh

Re: Progress of Calendar development

by W Page -

Hi!

The Calendar module is not suppose to be placed inside of the "mod" directory.  It should be placed at the root or inside of the "moodle" directory,  I made the same mistake previously.  The path should be
/moodle/calendar  not  /moodle/mod/calendar

For # 3 I suggest you start all over and try again going very slowly so you can see where you may have made a mistake.  I tried 3 times before I got the calendar to display.

SUGGEST

  • You make your course format "topics". 
  • Then place the "format.php" file inside of the "topics" directory inside of the "course" directory into a script editor.
    /moodle/course/topics/format.php
  • Paste the proper code, "calendar_print_side_blocks(); " after the line instructed - Line 93 - print_side_block($stractivities, "", $moddata, $modicon);

    /// Links to all activity modules by type
        $moddata = array();
        $modicon = array();
        if ($modnamesused) {
            foreach ($modnamesused as $modname => $modfullname) {
                if ($modname != "label") {
                    $moddata[] = "<a href=\"../mod/$modname/index.php?id=$course->id\">".$modnamesplural[$modname]."</a>";
                    $modicon[] = "<img src=\"$CFG->modpixpath/$modname/icon.gif\" height=16 width=16 alt=\"\">";
                }
            }
        }
        print_side_block($stractivities, "", $moddata, $modicon);
        calendar_print_side_blocks();
    /// Print a form to search forums
        $searchform = forum_print_search_form($course, "", true);
        $searchform = "<div align=\"center\">$searchform</div>";
        print_side_block(get_string("search","forum"), $searchform);

See if it works.  If not, start from the top again. 

Jon may see you post in the meanwhile and give you a "more on the mark" solution.

WP1

In reply to W Page

Re: Progress of Calendar development

by Dr. Ali Abureesh -
Picture of Core developers Picture of Translators

Thanks, it worked. My mistake was that I placed the calendar directory inside "mod" directory.
I can't wait to see the officially release.

By the way, it works for weeks format as well.

In reply to Dr. Ali Abureesh

Re: Progress of Calendar development

by John Papaioannou -

Hmmm... please read the installation instructions carefully. All of your problems will go away. If not, then you could just wait until it's officially released....
In reply to John Papaioannou

Re: Progress of Calendar development

by Loren Winfrey -
Jon, As many have said before me, Thanks alot for working on this.

Next I installed this and I can add events and they are in the DB, but do not display, in small or large view. Any ideas?

Here is me event table.

CREATE TABLE mdl_event (
id int(10) NOT NULL auto_increment,
module int(10) NOT NULL default '0',
instance int(10) NOT NULL default '0',
name varchar(255) NOT NULL default '',
description text,
course int(10) NOT NULL default '1',
timestart int(10) NOT NULL default '0',
duration int(10) NOT NULL default '0',
calid int(10) NOT NULL default '0',
timemodified int(10) NOT NULL default '0',
PRIMARY KEY (id)
) TYPE=MyISAM COMMENT='for everything with a time associated to it';


Loren
In reply to Loren Winfrey

Re: Progress of Calendar development

by Gustav W Delius -

Dear Loren, you still have the mdl_event table from the old event module. You have to drop that and then create the new one:

CREATE TABLE `prefix_event` (
                              `id` int(10) unsigned NOT NULL auto_increment,
                              `name` varchar(255) NOT NULL default '',
                              `description` text NOT NULL,
                              `courseid` int(10) unsigned NOT NULL default '0',
                              `groupid` int(10) unsigned NOT NULL default '0',
                              `userid` int(10) unsigned NOT NULL default '0',
                              `modulename` varchar(20) NOT NULL default '',
                              `instance` int(10) unsigned NOT NULL default '0',
                              `eventtype` varchar(20) NOT NULL default '',
                              `timestart` int(10) unsigned NOT NULL default '0',
                              `timeduration` int(10) unsigned NOT NULL default '0',
                              `timemodified` int(10) unsigned NOT NULL default '0',
                              PRIMARY KEY  (`id`),
                              UNIQUE KEY `id` (`id`),
                              KEY `courseid` (`courseid`),
                              KEY `userid` (`userid`)
                            ) TYPE=MyISAM COMMENT='For everything with a time associated to it';
In reply to John Papaioannou

Re: Progress of Calendar development

by Loren Winfrey -
Issue and question.

I am the instructor for one course and I have two groups in this same course. I can't create an calendar event for the groups unless I "join" the group.

Now for the wuestion, Is there a way to add a "switch" of some sort to allow teachers to either belong to more than one group or allow the teacher to post an event to the groups if they do not belong?

I hope this makes sense.

Cheers,

Loren
In reply to Loren Winfrey

Re: Progress of Calendar development

by John Papaioannou -

You are right, you cannot add events for groups in which you do not belong. The problem I encountered with this feature is that the group-related library code in Moodle does not lend itself well to working the way I need it to work. So there were two choices: either do it the way it is now, or add "raw SQL" in the Calendar code, which I wanted to avoid in order to remain as portable as possible. Not to mention that in this case there will need to be a "dirty hack" to provide for the administrator, otherwise he 'll be swamped with a drop-down menu of 200 groups or something like that...

However I 'm not even satisfied with this situation myself, so there will be some kind of solution in the near future... as soon as I figure out a neat way to do it. For the record, I 'm not even satisfied with the way you select the group for adding an event. But it's working, and for now that's good enough.

I believe this also answers your question... just be a little patient. Oh, and keep in mind that only editing teachers can add group and course events.

Thanks for pointing this out, it looks like it's not only me! big grin

In reply to John Papaioannou

Re: Progress of Calendar development

by Loren Winfrey -
does that mean that currently there is no way to make a teacher available for more that one group, even if they are teaching them both?
In reply to Loren Winfrey

Re: Progress of Calendar development

by John Papaioannou -
Update: The latest CVS code now allows you to set events for all groups in courses where you are an editing teacher. Still haven't sorted out what to do with the poor administrator though...
In reply to John Papaioannou

Re: Progress of Calendar development

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
I'm planning to finally have a good look at your calendar code tomorrow, Jon, so I'll see if I can help.

Anyone who is not in a group is (in the existing group code so far) treated as if they are in a group numbered 0 (zero).  Perhaps this helps ... anyhow, I'll know better after having a look tomorrow - I should also be clearer about how this will fit into 1.2.
In reply to John Papaioannou

Re: Progress of Calendar development

by Bryan Williams -
As Calendar evolves it would be nice to see the HTML editor used on the Editing event screen.  This is only a wish-list item and in no way should delay the completion of Calendar.  Keep up the excellent work Jon, Gustav and Martin!
In reply to John Papaioannou

Re: Progress of Calendar development

by John Papaioannou -

IMPORTANT: I 'd also like to note that since Calendar is now in CVS, the links I 've posted above for the package contain code that is out of date. I don't know how often they will be updated (if at all).

So if you 'd like to work with it, please use CVS to get your copy. There is a web interface which allows read access for everyone, so that shouldn't be much trouble.

In reply to John Papaioannou

Re: Progress of Calendar development

by W Page -

Hello!

The Calendar folder in the CVS is empty.  Also the folder inside of it called Webcalendar is empty as well.

WP1

In reply to W Page

Re: Progress of Calendar development

by Gustav W Delius -
You are probably looking in the wrong place. The calendar is at cvs:/contrib/calendar/
In reply to Gustav W Delius

Re: Progress of Calendar development

by W Page -

Thank you!

Should all of these files be uploaded into the "calendar" directory inside of moodle?

moodle/calendar/event.php   
moodle/calendar/event_edit.html
moodle/calendar/event_new.html    
moodle/calendar/event_select.html   
moodle/calendar/lib.php   
moodle/calendar/overlib.cfg.php    
moodle/calendar/set.php   
moodle/calendar/view.php

Just leave the other files with the included changes as described in the previous instructions?

WP1

In reply to John Papaioannou

Re: Progress of Calendar development

by W Page -

Hello!

I am running MOODLE "Latest Version" Jan 28, 2004

I updated all the files from the "contrib" CVS for the "calendar".

The calendar displays "OK". However there are the following problems,

  • When I click on the links at the bottom of the calendar the page refreshes. I am not taken to any other/form page
  • The letter "P" appears now in the left upper corner of the page. See below.

QUESTIONS

  • Are these bugs?
  • Is there a way to get rid of the "P"?
  • Is there a way to connect to the linked pages?

Thanks in advance for any help anyone can give me with this.

WP1

Attachment l_upper_post_calendar.jpg
In reply to W Page

Re: Progress of Calendar development

by John Papaioannou -
Answers:

  • The "p" was a bug (an oversight, really... editor mangled the file a bit) and is now fixed.
  • The links don't take you anywhere because they toggle the event filters on and off. If you had pending events, you would see the difference.
  • Click on the current month's name to get access to other calendar screens.

In reply to John Papaioannou

Re: Progress of Calendar development

by Loren Winfrey -
Question for the upcoming events listing, it is working fine except that the date for the event is printing out a day ahead of the actual date for the item. When you click on the link to see the event the date is correct.

Any ideas?

Loren
In reply to Loren Winfrey

Re: Progress of Calendar development

by John Papaioannou -
Hmmm... tricky timezone issues probably.

I 've tested the timezone code quite thoroughly with different users in different timezones, and the thing is, events are supposed to move around if the timezone difference between the "setter" and the "viewer" is enough. But I 'm not sure if that's the case here.

I need more data to troubleshoot this. First of all, what exactly do you mean "is printing out"? Month view or upcoming events? Do you have the latest CVS source from cvs:/contrib/calendar ?

Can you email me a partial dump of your database (couple of events, user timezones etc), your server's timezone and a more detailed report or a screenshot? The chances to fix it will be much greater this way.

On a related subject:

Martin, since I delved into the time-manipulation code, a couple of days ago I began including timezone functionality into my very own pet application framework. What I found out was this (and please correct me if I have the wrong impression):

  • When you get a time from a user, it's enough to offset it according to his timezone, as Moodle does. Same when displaying a date.
  • But what do you do when you need the current GMT timestamp? The value returned by time() is the server's local time, which must be adjusted before e.g. being set in a "timeupdated" field. And I think this isn't done in Moodle. What gives?

I tested many scenarios on my XP system at home, and of course time() changed its return value as soon as I changed my timezone, so I believe the above remark is valid... is there something I don't understand correctly?
In reply to John Papaioannou

Re: Progress of Calendar development

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
No, time() is definitely the absolute number of seconds since epoch, which is January 1 1970 00:00:00 GMT.

Moodle time code has been very stable for the past year now, but it sure was a mindbender trying to work it out originally!   wide eyes
In reply to John Papaioannou

Re: Progress of Calendar development

by John Papaioannou -
"Be nice" feature added to CVS: Now the "Add event" button defaults to that day, if you were in day view. In month view, it defaults to "today" if you were viewing the current month, day 1 otherwise.
Average of ratings: Useful (1)
In reply to John Papaioannou

Re: Progress of Calendar development

by W Page -

Hello!

Thanks for your response.

Could you post the latest version of the complete calendar script/files in Zip format or indicate which specific files you have changed/updated.

I may be using the CVS incorrectly but it seems one has to DL all the files individually and therefore one has to know which files have been changed or DL all the files.

Thanks in advance.

WP1

In reply to John Papaioannou

Re: Progress of Calendar development

by Loren Winfrey -
Jon, Just to let you know, I've updated my system with the CVS version and I must be missing something, because I get a missing "get_user_preferences() error. Where is this set?

Loren
In reply to Loren Winfrey

Re: Progress of Calendar development

by John Papaioannou -
This is part of the latest and greatest additions to Moodle that will allow per-user options configuration in Moodle. Martin had something like this in mind and suggested that the Calendar could use it. So I helped him implement it and now have the... unfortunate distinction of being the first coder to actually use it! big grin

Seriously now, you just need to update your moodlelib.php as well. Martin committed the whole _preferences API 3-4 days ago.
In reply to John Papaioannou

Re: Progress of Calendar development

by Loren Winfrey -
Jon two questions,
1. The overlib doesn't seem to be working, is there a switch or something?

2. Is there a way to shift days, I have alot of confused students that would like to see the smal_cal displayed as sun mon tue ... instead of mon tue wed...

Is this possible?

Thanks

Loren
In reply to Loren Winfrey

Re: Progress of Calendar development

by John Papaioannou -

1. I don't know about that... there should be no need to do anything. More information about the problem is needed.... but read below:

BUG TIME... Everyone, can I have your attention please?

Last night I was working a bit on Calendar on a laptop I hadn't used before, running WinXP Home, latest stable PHP, Mysql 4, Apache 1. IE was having severe problems with the stylesheet (sometimes it wouldn't load?!?) and when this happened, I 'd also get javascript errors indicating that overlib.js wasn't loaded. With Firebird and its javascript console, I managed to get a bit more info: first of all, Firebird would ALWAYS refuse to load the stylesheet, even though it only issued a "Warning: Mime type for styles.php is "text/html", not "text/css", blah blah I loaded it as CSS anyway". What was an error though and not a warning was this "Overlib.js: parse error, line 1", it thought it had to do with a HTML 2.0 document, misinterpreted the comment slashes and refused to load it. Presumably this had something to do with the stylesheet too, because it said "stylesheet loaded nevertheless" when it fact it wasn't.

I didn't manage to figure out what was happening, and don't currently have the time to work on it. Maybe it was because of the Mime-Types configuration on my system? Anyone with a super bug-killer idea?

2. The good news: yes it is, and it is already coded in. It is a per-user setting, with a hard-coded global default. The bad news: there is no web interface to change it yet, so you 'll have to do it by hand.

calendar/lib.php line 11 gives some insight into this: If there is a record in user_preferences with preference name "cal_starting_wday", it's used to determine the first day. Sunday is 0, going up to 6 for Saturday. Setting this (I mean, adding a record in the database) will affect only one user, but in ALL calendar displays.

In the same line, you can see that the default for this setting is 1, or Monday. You can change this to what you like, and it will affect ALL users but only in THIS calendar display (the miniview, in this case). You will have to dig around a little in calendar/view.php to do the same for the detailed month view.

I 'll get to work on all of this sometime, but not now since I 'm really swamped. End of month seems a likely target.

In reply to John Papaioannou

Re: Progress of Calendar development

by Bryan Williams -
Ditto on thoughts about posting complete calendar.zip files.  I've noticed that when I retrieve things from CVS, Windows (or Tortoise) likes to change permission settings on directories. Have lost more hours than I care to count messing with this, and like the simple "nightly" download link on Moodle.org for getting the latest and greatest.  How about something similar for the latest calendar?
In reply to Bryan Williams

Re: Progress of Calendar development

by W Page -

Thanks!  It might also encourage folks to test the script so it will get a better and more extensive "work out" before the final release.

That CVS stuff really mixes me up but I am not a developer so maybe it does not matter.

WP1

In reply to W Page

Re: Progress of Calendar development

by John Papaioannou -

I hope I 'll get to that in a few days, since a) It won't be included in 1.2 so there's gonna be time for more testing/development, b) I 'm out of town (having university examinations) right now and don't have much time to spend on this.

Only don't expect anything like a "nightly" cause this will be dependent on a) whether there is any new development, b) I 'm too lazy to make a new package wink

In reply to John Papaioannou

Re: Progress of Calendar development

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers

Hi Jon -

I'd like to propose a slight modification to your wonderful calendar application. cool

I use some custom view pages on my site, and I would like to use the mini-calendar on them as well. Right now, your 'calendar_print_side_blocks' assume that I am doing this from a 'view.php' file with a 'courseid' argument. That's not always the case on my site.

What I'd like to do is add an optional argument to 'calendar_print_side_blocks' called '$callstr'. If this argument is present, it would contain the procedure to call and any required arguments it needs. If it is set, 'calendar_print_side_blocks' would call 'calendar_top_controls' with a type 'custom' (instead of 'course'), and insert a 'callstr' argument into the $data array with the value of the '$callstr' argument.

This would allow me to use the same mini-calendar display on any page I choose and remove the responsibility of determining what to call from the calendar application.

The changes would look like this:

in calendar_print_side_blocks:

function calendar_print_side_blocks($callstr=null) {
...
if ($callstr) {
    echo calendar_top_controls('custom', array('callstr' => $callstr, 'm' => $_GET['cal_m'], 'y' => $_GET['cal_y'
]));
}
else
{
    echo calendar_top_controls('course', array('id' => $course->id, 'm' => $_GET['cal_m'], 'y' => $_GET['cal_y'
]));
}
...

in calendar_top_controls:

...
case 'custom':
...
    $nextlink = calendar_get_link_tag('&gt;&gt;', $data['callstr'].'&amp;', 0, $nextmonth, $nextyear);
    $prevlink = calendar_get_link_tag('&lt;&lt;', $data['callstr'].'&amp;', 0, $prevmonth, $prevyear);
...

What do you think?

mike

In reply to Mike Churchward

Re: Progress of Calendar development

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers

Hi again Jon -

I oversimplified the solution in my last post. I've gone through the code, and I think I have come up with a solution that will handle the calendar in any view.

When I'm done, I'll post the files here for you to look at.

mike

In reply to Mike Churchward

Re: Progress of Calendar development

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers

Hi Jon -

I've attached the changes I made in this post. With these changes, you can add the mini-calendar to any page (not just courses).

I had to change some of your code to pass a 'courseid', rather than depend on a global '$course' variable. I also updated the 'top_controls' to use '$_GET' values and '$PHP_SELF'.

It works on my installation, except for changing filters. They still expect a valid course id, so I have to look at this still. Also, can you see any reason not to show user, group and course events on the mini-calendar in non-course views?

mike

p.s. - I can't seem to upload a file. Gives me a server error. I'll try again tomorrow.

In reply to Mike Churchward

Re: Progress of Calendar development

by John Papaioannou -
Hi Mike,

This sounds like a good idea! Looking at the source, there is calendar_get_mini() you can use to get the bare calendar, without navigation and filtering, so I 'm not sure if calendar_print_side_blocks() is the correct place to make changes for this purpose. Maybe another wrapper around calendar_get_mini() would be more appropriate. When you are able to, post or email me your proposed code and, if you can, an explanation of exactly what you are trying to achieve, it's possible we can do something generic enough to be useful to everyone.

As for user, group, course events in non-course views, I definitely think they should be shown. But for course events (and maybe later group events, support for which is a bit underdeveloped at this point) we need to be extra careful with the session variables that control event filtering. You can see code that specifically watches for this kind of think at the start of calendar_print_side_blocks(). Otherwise, a teacher in courses A and B could go to monthly view, filter course events only for course A, and then in the main course view of B, course events would register as "being shown" while in fact they wouldn't be...

Jon
In reply to John Papaioannou

Re: Progress of Calendar development

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers

Here's the files that I already worked on. The only changes I made to 'calendar_print_side_block' was to pass the optional 'courseid' and call 'top_controls' with 'course' or 'custom'. I'll take another look and see if it makes more sense to use a different wrapper as you suggest.

I wonder if it makes sense to have different calendar types instead of filters? What I mean is, in a course, I would see "Course Calendar". That would display the course events only. Then maybe provide a toggle or switch (maybe the "Course Calendar" heading?) to switch to "My Calendar", which shows the items I want. The key thing would be to make sure all of the function runs through a standard included calendar display function (such as the 'calendar_print_side_block') so that it doesn't matter what page the calendar is on.

I'll try my upload again.

mike

In reply to Mike Churchward

Re: Progress of Calendar development

by John Papaioannou -

I don't think that the whole idea with the different calendar types is useful. You 're saying that we could have a bunch of "presets", but in that case:

  • If the presets would be user-editable, we need a separate user interface for that (too much trouble for the same functionality we have with filters now)
  • If they aren't supposed to be editable (i.e., we 're talking hardcoded), then very simply you can get just about any behavior you want by manipulating the $defaultcourses argument and maybe providing a way for the calendar function to use arguments instead of the relevant $SESSION variables (if we don't want to mess up the user's filtering)
That being said, Mike, thanks a lot for your interesting ideas and feedback. It will be a while until I can have a good look at your code, since I 'll be out of town again for 5 days or so.

In the meanwhile (this is a general announcement):

I am aware of several bugs and issues in the current downloadable implementation of calendar!

The most easily noticeable one is that filtering is (was) quite buggy. It isn't anymore, because these issues (and there are several) have been addressed and fixed as necessary. Please be a little patient until I can get together a new release with the fixed code.

In reply to John Papaioannou

Bug with Month Display

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers

Hi Jon -

I know you're working on this, and may have already fixed it, but I'm getting strange behaviour moving through months in the month display. When I try to go back to January from February, I am propelled into December. From there, I can't move forward to January; I stay in December.

I looked at the code, and it seems to have something to do with the line:

$date= usergetdate(calendar_gmmktime_check($m, 1, $y)); // Nominal datetime

in the 'calendar_show_month_detailed' procedure.

The '$m' argument is '1' and '$y' is 2004, but when they come back from the 'gmmktime' call in 'calendar_gmmktime_check' procedure, the time is now a time on Dec. 31, 2003. I'm guessing this is a time-zone issue?

If I change this call to: 'usergetdate(calendar_mktime_check($m, 1, $y))' everything seems to work.

(Similarly, in 'calendar_get_mini', making the same change fixes an issue I was having with the mini view).

Any thoughts?

mike

In reply to Mike Churchward

Re: Bug with Month Display

by John Papaioannou -
Hi Mike,

I haven't encountered this particular issue myself. Must be something I missed when I was thinking about the correct way to do the time stuff. Can you please tell me the timezone of your user and your server so I can try to duplicate this?

Also, since I see that lately you are working a lot with calendar, would you be interested in getting access to our bugtracker?

Cheers
Jon

In reply to John Papaioannou

Re: Bug with Month Display

by W Page -
Hello!

I experienced the same thing as Mike.

WP1

In reply to John Papaioannou

Re: Bug with Month Display

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers

Sure. I'm using my personal machine, so its EST (GMT-5). When I looked at those lines, I don't think you would want to check against GMT, since the calendar would be relevent to the user, and therefore their timezone. It caused some bizarre behaviour.

Access to the bugtracker would be great. I wasn't trying to push the calendar, its just that I had promised it to my group when I saw your work several weeks ago. So, I figured if I could make it happen...

Anyway, I'm happy to help.

mike

In reply to John Papaioannou

Re: Progress of Calendar development

by Rob Barreca -
I'm just started to do some work on the calendar for our Moodle installation and just saw this thread. Have these changes been incorporated into 1.5.3+? Or, is there something I'm missing that I should know about before doing any more calendar development?