New Calendar Mod: QCalendar with Ajax [Updated v1.0.8]

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
Post Reply
JensZ
Posts: 136
Joined: Wed 16. Feb 2005, 12:18
Location: Stockholm, Sweden
Contact:

New Calendar Mod: QCalendar with Ajax [Updated v1.0.8]

Post by JensZ »

Hi,

Latest version: v.1.0.8

I have made an attempt to write another calendar module that supports ajax as well as all of the features included in Ionrocks calendar mod. Check it out at http://www.ikfrej.se/index.php?downloads. Please be advised that this is an beta release.

The QCalendar includes the following features:
* Uses Ajax, thanks to Mike West (http://mikewest.org/archive/datarequestor)
* Export to iCal using iCalcreator, thanks to Kjell-Inge
Gustafsson (http://www.kigkonsult.se/iCalcreator/index.php)
* Overlib for tooltip texts, thanks to Erik Bosrup
(http://www.bosrup.com/web/overlib/)
* PopupWindows, thanks to Matt Kruse
(http://www.mattkruse.com/javascript/calendarpopup/)
* Handles single events and recurring events.
* Templates
* Language support (only English and Swedish at the moment)
* Straight-forward administration

Frontend replacement tag:
{QCAL[:calendar_id[:lang_id[:main_template[:event_template[:css]]]]]}
where:
calendar_id - the calendar category Id OR calendar name
lang_id - the language id, e.g "en", "se", etc
main_template - the main template file name
event_template - the event template file name
css - the main CSS class name

Code: Select all

// Show events in all calendar categories with default settings
{QCAL}     

// Show calendar with calendar category id 1
{QCAL:1} 

// Show calendar with calendar category name 'MyCalendar'
{QCAL:MyCalendar} 

// Show calendar with calendar id 1, english language
{QCAL:1:en} 

// Show calendar with calendar id 1, english language, and the file
//my.template.php as the main template file. Please see
//include/inc_module/mod_qcal/inc_front/tmpl for sample templates.
{QCAL:1:en:my.template.php} 

// Show calendar with calendar id 1, english language, the file
//my.template.php as the main template file, and my.event.template.php
//as your event template file.
{QCAL:1:en:my.template.php:my.event.template.php}
Frontend demo:
http://www.ikfrej.se
http://www.ikfrej.se/index.php?yearcalendar

Download:
http://www.ikfrej.se/index.php?downloads

Screenshots:
Image

Image

Image

Cheers,

Jens
Last edited by JensZ on Mon 4. Feb 2008, 10:40, edited 7 times in total.
phalancs
Posts: 793
Joined: Thu 19. Feb 2004, 05:09
Location: Germany

Wohooo

Post by phalancs »

Wohooo,

great man! Much appreciated :)
2008
User avatar
Klappstuhl28
Posts: 833
Joined: Fri 4. Mar 2005, 01:58
Location: Hamburg
Contact:

Post by Klappstuhl28 »

looks good - thumbs up :D
Lars

Don't say you don't have enough time. You have exactly the same number of hours per day that were given to Helen Keller, Pasteur, Michaelangelo, Mother Teresa, Leonardo da Vinci, Thomas Jefferson, and Albert Einstein. - H. Jackson Brown -
JensZ
Posts: 136
Joined: Wed 16. Feb 2005, 12:18
Location: Stockholm, Sweden
Contact:

Post by JensZ »

Fixed some errors, so now we're up to version 1.0.1.
JensZ
Posts: 136
Joined: Wed 16. Feb 2005, 12:18
Location: Stockholm, Sweden
Contact:

Post by JensZ »

Now up to 1.0.3:

2007-01-30 Jens Zetterström Version 1.0.1
* Fix error with event sets record count
* Add copy events to another calendar category
* Add form headings
2007-02-07 Jens Zetterström Version 1.0.2
* Fix week start day
* Fix validation error for time duration (18:00-20:00 is ok)
2007-02-08 Jens Zetterström Version 1.0.3
* Fix event list for frontend
* Add new setting "show all categories"
* Change event templates
* Allow links in event detail description
JensZ
Posts: 136
Joined: Wed 16. Feb 2005, 12:18
Location: Stockholm, Sweden
Contact:

Post by JensZ »

Version 1.0.4 ready!

2007-02-27 Jens Zetterström Version 1.0.4
* Added setting to use ajax call when opening events in frontend
* Step one for themes; CSS file templates
* Fixed XmlHttpRequest issue with encoding charsets
* Upgraded datarequestor to 1.6
* Fixed IE javascript error when switching calendar in
backend using dropdown.

Enjoy,

Jens
JensZ
Posts: 136
Joined: Wed 16. Feb 2005, 12:18
Location: Stockholm, Sweden
Contact:

Post by JensZ »

Sorry, the zip file was missing a few javascript files that I for some reason thought was part of the phpwcms package. However, they are not so I have now uploaded version 1.0.5 to my server http://www.ikfrej.se/?downloads. Alternatively, download AnchorPosition.js, CalendarPopup.js, and PopupWindow.js from http://www.mattkruse.com/javascript/cal ... ource.html and store them in include/inc_js.

Hope this will get your installation working!

/Jens
WeirdJerk
Posts: 8
Joined: Fri 14. Oct 2005, 09:57

Post by WeirdJerk »

Hi there,

first: Thank you very much for your great work.

I installed the calendar as described in the readme, and things seemed to work out fine. But when trying to creae a new calendar, i get this message:

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /*/*****/htdocs/phpwcms/include/inc_module/mod_qcal/inc_lib/QCalendar.php on line 434
Error:SELECT event.*, cat.name as catName FROM DB_PREPENDphpwcms_cm_events AS event INNER JOIN DB_PREPENDphpwcms_cm_categories AS cat ON cat.id = event.category WHERE approved = 1 AND ((MONTH(date) + (YEAR(date) * 12)) <= (3 + (2007 * 12))) AND ((MONTH(DATE_ADD(date, INTERVAL(span - 1) DAY)) + (YEAR(DATE_ADD(date, INTERVAL(span - 1) DAY)) * 12)) >= (3 + (2007 * 12))) ORDER BY date ASC, time ASC



Any idea, whats wrong ? Creation of database fields with install.sql worked with no error messages.

Thanks in advance,

WJ
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post by DeXXus »

JenZ has a couple choices to edit for correction. He ~may~ decide to append a <space> to:

Code: Select all

$dbPrefix = DB_PREPEND;
In the meantime you can ~try~ editing "/include/inc_module/mod_qcal/conf.inc.php"

FIND:

Code: Select all

$tables['events'] = $dbPrefix."phpwcms_cm_events";
$tables['categories'] = $dbPrefix."phpwcms_cm_categories";
REPLACE WITH:

Code: Select all

$tables['events'] = $dbPrefix." phpwcms_cm_events";
$tables['categories'] = $dbPrefix." phpwcms_cm_categories";
NOTE the single <space> before the text 'phpwcms'. This would be temprary, until JenZ decides how to handle that concatenation.
Single-quotes and Double-quotes usage should be "standardized", particularly regarding strings versus variables, etc. :wink:
JensZ
Posts: 136
Joined: Wed 16. Feb 2005, 12:18
Location: Stockholm, Sweden
Contact:

Post by JensZ »

Hello,

Unfortunately I don't think what Dexxus suggested will solve the issue. There should not be a space after DB_PREPEND.

The qcalendar was developed on an unofficial 1.2.7, and I think there have been some changes in 1.2.8 with regards to how the database connection is being done, as well as the setting of the DB_PREPEND define. If you look in qcal.php (in the phpwcms root dir), I include default.inc.php, where the database connection used to be done. However, in 1.2.8 there is a new file called include/inc_lib/dbcon.inc.php where this is being done. This file must be included in qcal.php for this to work. In my next release, I will try to make qcalendar version-independent, but I currently do not have a 1.2.8+ running.

Add the following line to qcal.php:

Code: Select all

require("include/inc_lib/dbcon.inc.php");
Maybe, you'll need to keep default.inc.php or maybe it needs to be removed, I don't know.

There's another bug in include/inc_module/mod_qcal/inc_html/frontend.inc.html. Replace:

Code: Select all

<script language="javaScript" src="include/inc_module/mod_calendar/inc_js/overlib.js"></script>
with:

Code: Select all

<script language="javaScript" src="include/inc_js/overlib.js"></script>
All of this will be fixed in a coming release (it might be a little while). Sorry for the inconvenience, but I'm not really proud of my testing skills, I just hack my way through life.

Cheers,

Jens
WeirdJerk
Posts: 8
Joined: Fri 14. Oct 2005, 09:57

Post by WeirdJerk »

Hello,

thanks for the quick help. The code changes altered the situation a bit. The Calendar is correctly displayed in the backend. Alas i still get an error message, when trying to Create a new Calendar or try clicking anywhere on the calendar:

Error:SELECT event.*, cat.name as catName FROM DB_PREPENDphpwcms_cm_events AS event INNER JOIN DB_PREPENDphpwcms_cm_categories AS cat ON cat.id = event.category WHERE approved = 1 AND ((MONTH(date) + (YEAR(date) * 12)) <= (3 + (2007 * 12))) AND ((MONTH(DATE_ADD(date, INTERVAL(span - 1) DAY)) + (YEAR(DATE_ADD(date, INTERVAL(span - 1) DAY)) * 12)) >= (3 + (2007 * 12))) ORDER BY date ASC, time ASCTable 'sql*****.DB_PREPENDphpwcms_cm_events' doesn't exist


I looked up in the sqp db and found both date and time table in phpwcms_cm_events
date is of "date" type and time is "varchar(100)"


Any ideas what could be wrong ?
JensZ
Posts: 136
Joined: Wed 16. Feb 2005, 12:18
Location: Stockholm, Sweden
Contact:

Post by JensZ »

It looks like you still have the same problem. The problem is this part:

Code: Select all

DB_PREPENDphpwcms_cm_events
It seems like it doesn't know what DB_PREPEND is. When you click on 'New Calendar' or any link for that matter there is an ajax call to the qcal.php script. Here you must include the file that defines DB_PREPEND and stores the db connection in the $db variable. Find the file that does this in your installation and include it in qcal.php.

Sorry that's all I can think of at the moment.

Jens
WeirdJerk
Posts: 8
Joined: Fri 14. Oct 2005, 09:57

Post by WeirdJerk »

JensZ wrote:It looks like you still have the same problem. The problem is this part:

Code: Select all

DB_PREPENDphpwcms_cm_events
It seems like it doesn't know what DB_PREPEND is. When you click on 'New Calendar' or any link for that matter there is an ajax call to the qcal.php script. Here you must include the file that defines DB_PREPEND and stores the db connection in the $db variable. Find the file that does this in your installation and include it in qcal.php.

Sorry that's all I can think of at the moment.

Jens
Hmh i think conf.inc.php does that ? It is "required once" in qcal.php and gets DB name correctly so i am quit confused why it doesnt get the DB_PREPEND right.

*confused*

Maybe something important is different with the 1.3.0 im running now. Ill have a look :-)
JensZ
Posts: 136
Joined: Wed 16. Feb 2005, 12:18
Location: Stockholm, Sweden
Contact:

Post by JensZ »

Well, in 1.3.0 it seems to be defined in dbcon.inc.php:

Code: Select all

define ('DB_PREPEND', $phpwcms["db_prepend"] ? $phpwcms["db_prepend"].'_' : '');
Try messing with $phpwcms["db_prepend"] and echo($phpwcms["db_prepend"]) as well as echo(DB_PREPEND) to see what it gives you!

//Jens
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post by DeXXus »

Sorry, I didn't mean to confuse or give out bad info. I don't use the mod and did just a cursory look and shot off my mouth! :oops:
Post Reply