Calendar_XH 1.4 released

Third Party Plugins to CMSimple - how to install, use and create plugins

Moderator: Tata

svasti
Posts: 1651
Joined: Wed Dec 17, 2008 5:08 pm

Re: Calendar_XH 1.4 released

Post by svasti » Sun May 20, 2012 9:50 am

Just fixed (2) with a little regular expression...

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Calendar_XH 1.4 released

Post by cmb » Sun May 20, 2012 9:30 pm

Hi Frank,
svasti wrote: I hope somebody else could shed some light on API vs CGI mode here...
The classic way to run PHP is in CGI mode, so PHP runs as separate process. API mode means it runs under Apache servers with mod_php (probably the most common way nowadays). You can test CGI mode with Portable_XH (I'm currently in a hurry; I'll have a further look at it tomorrow)

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

svasti
Posts: 1651
Joined: Wed Dec 17, 2008 5:08 pm

Re: Calendar_XH 1.4 released

Post by svasti » Mon May 21, 2012 8:53 am

Hi tanavots:
Just tested Calendar on php 5.3.10, which is the newest version I could get my hands on. Worked as expected.
Php 5.4.2 is very new, not even implemented on XAMPP yet.
Let's see what Christoph can find out.
Otherwise a possibility would be to let me test Calendar temporarily on your server. Probably just something small needs to be changed, as Calendar 1.3 beta 9 worked as you said.

svasti

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Calendar_XH 1.4 released

Post by cmb » Mon May 21, 2012 3:56 pm

Hi Alo, hi Frank,

I've just checked Calendar 1.4beta under PHP in CGI mode with

Code: Select all

<?php echo calendar()?>
in the template. It works in my test environment.

As PHP in CGI mode typically runs as a different user than in API mode, there might be missing file/folder permissions (probably not, as calendar() should only read the event file, and I doubt that it's permissions are set to 400). One change from Calendar 1.3beta9 to 1.4 is the use of the function easter_date(), which is only available, when PHP's calendar extension is available (but I guess that's not the problem in this case, as this would result in a fatal PHP error, which will cause the processing of the template immediately to stop, when calendar() is called).

So it might be best, to activate XH debug mode with level 5. This should give some hint, where the problem is.

@Alo: could you please try this and report back, what errors show up in the browser?

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

tanavots
Posts: 72
Joined: Sat Feb 25, 2012 4:18 pm

Re: Calendar_XH 1.4 released

Post by tanavots » Tue May 22, 2012 9:55 am

Hi Christoph,

You are right - Fatal error: Call to undefined function easter_date()
Is it possible write code so, that if easter call fails, it will be disabled?

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Calendar_XH 1.4 released

Post by cmb » Tue May 22, 2012 11:36 am

Hi Alo,
tanavots wrote:Is it possible write code so, that if easter call fails, it will be disabled?
Yes, that's one possible solution. Change lines 605-611 in plugins/calendar/includes/calendar.php:

Code: Select all

    $easter = function_exists('easter_date') ? date("m/d/Y",easter_date($displayyear)) : FALSE;

    $holidayarray = explode(";",$plugin_tx['calendar']['holydays']);
    foreach ($holidayarray as $value) {
        list($holiday_date,$holiday_name) = explode(",",$value);
        // holidays depending on the easter date
        if(strpos($holiday_date,'easter')!==FALSE && $easter!==FALSE){
 
But perhaps an alternative calculation method for the easter date could be used. This shouldn't be too hard to accomplish:
http://de2.php.net/manual/en/function.easter-date.php wrote:The date of Easter Day was defined by the Council of Nicaea in AD325 as the Sunday after the first full moon which falls on or after the Spring Equinox. The Equinox is assumed to always fall on 21st March, so the calculation reduces to determining the date of the full moon and the date of the following Sunday.
On http://quasar.as.utexas.edu/BillInfo/Re ... ndars.html a pretty simple formula is given. So in line 597 in plugins/calendar/includes/calendar.php might be added (instead of the modifications above):

Code: Select all

if (!function_exists('easter_date')) {
    function easter_date($year) {
    $g = $year % 19 + 1;
    $s = (11 * $g - 6) % 30;
    $s = $s == 0 ? $s - 1 : ($s == 1 && $g >= 12 ? $s - 2 : $s);
    $fm = mktime(0, 0, 0, 4, 19 - $s, $year);
    $w = date('w', $fm);
    $e = mktime(0, 0, 0, 4, 19 - $s + 7 - $w, $year);
    return $e;
    }
}
 
This function has exactly the same results for the years 1970-2037 (the range that could be processed by the "built-in" easter_date()), but doesn't require PHP's calendar extension.

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

svasti
Posts: 1651
Joined: Wed Dec 17, 2008 5:08 pm

Re: Calendar_XH 1.4 released

Post by svasti » Tue May 22, 2012 1:41 pm

Wow, Christoph, I must admit... wow... I am speechless.

Just getting Calendar 1.4 rc ready...
svasti

svasti
Posts: 1651
Joined: Wed Dec 17, 2008 5:08 pm

Re: Calendar_XH 1.4 released

Post by svasti » Tue May 22, 2012 5:26 pm

Okay, here is Calendar_XH 1.4 rc

Upgrading from 1.4 beta without loosing settings;
  • Save old settings through Presets>backup for both Event-list and also Calendar.
  • Keep calendar/content folder + calendar/templates/ folder, and calendar/config/config.php in case you have changed config settings. Replace all other files.
  • Activate your old presets by choosing Presets>backupname for both event-list and calendar. If you have kept your old config file, you need to add the line: $plugin_cf['calendar']['eventlist_start_moves_with_clicked_event']="1";
What's new? Internal links now can be selected from an options list. No limit to the number of links per event. If you go to a future or past month in a calender and click on an event, the eventlist will move to that month. This was how the old 2005 calendar-plugin did it. It is back again, but can be disabled.

svasti

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Calendar_XH 1.4 released

Post by cmb » Fri Jun 29, 2012 12:54 am

Hi svasti,

while doing some cleanup on my PC, I've stumbled across the easter algorithm. I've had a look at your demo site (http://www.frankziesing.de/cmsimple/) and saw, that all German holidays are signalized by Calendar. :) But what about other cultural spheres? E.g. in Russia (Orthodox Church) christmas is celebrated on January 6th; AFAIK the jews have totally different holidays; and I'm quite sure, that there are totally different holidays in other countries. Do you think it's feasible and reasonable to allow for more flexibility in this regard?

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

beate_r
Posts: 174
Joined: Thu May 22, 2008 11:44 pm
Location: Hessen / Germany

Re: Calendar_XH 1.4 released

Post by beate_r » Sun Jul 01, 2012 9:43 am

Hello,

maybe i ask this question here. I am currently formatting the event list of the calender.

I would like to avoid the popup for the long description of the event and simply have it added into the list entry. How do i disable that popup? I did not notice any hint in the documentation.

Secondly, and possibly more important: the format of the calendar database might lead to severe problems, if one of the entries contains a semicolon.
The semicolon is the separator of the entries. At least in long event descriptions, a semicolon IMO not be regarded safe not being used in its normal grammatical context. Therefor a less ambiguous separator should be used.
The simplest approach would be a character which is rarely used, e.g., the vertical line |, the tilde or even better an ASCII sign not reacheable from the keyboard. Maybe an ASCII value greater 27 (ESC) and 32 (SPACE) - at least that is what i would use in a flat file database (and yes, emacs will still allow to edit these files manaully...)

best

Beate

Post Reply