Page 1 of 10

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

Posted: Mon 29. Jan 2007, 16:17
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

Wohooo

Posted: Mon 29. Jan 2007, 16:34
by phalancs
Wohooo,

great man! Much appreciated :)

Posted: Mon 29. Jan 2007, 17:40
by Klappstuhl28
looks good - thumbs up :D

Posted: Tue 30. Jan 2007, 11:01
by JensZ
Fixed some errors, so now we're up to version 1.0.1.

Posted: Thu 8. Feb 2007, 11:58
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

Posted: Wed 28. Feb 2007, 16:19
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

Posted: Mon 5. Mar 2007, 09:25
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

Posted: Thu 8. Mar 2007, 16:46
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

Posted: Thu 8. Mar 2007, 21:30
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:

Posted: Fri 9. Mar 2007, 09:43
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

Posted: Fri 9. Mar 2007, 11:07
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 ?

Posted: Fri 9. Mar 2007, 11:15
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

Posted: Fri 9. Mar 2007, 16:11
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 :-)

Posted: Fri 9. Mar 2007, 16:27
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

Posted: Fri 9. Mar 2007, 18:50
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: