Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#769 2011-12-12 07:45:37

kr37
Member
From: Colorado
Registered: 2011-11-06
Posts: 28

Re: smd_calendar: complete schedule / event / calendar / diary

OK, I think I’m starting to get the hang of smd_calendar working with smd_article_event. Two things seem quirky, I’ll keep trying to understand what I’m doing wrong but maybe someone has a suggestion:

Cellform is:
{day}<br/>{events}<br/>
SORTED:<br/>
<txp:smd_article_event time=“any” stepfield=“custom_2” omitfield=“custom_3” extrafield=“custom_4” firstday=“0” dayformat=”{Sun,Mon,Tue,Wed,Thu,Fri,Sat}” sort=“custom_5 asc” from=’{year}-{month}-{dayzeros} 00:00:00’ to=’{year}-{month}-{dayzeros} 23:59:59’ limit=10 form=“calendar_event” />

This gives basically a duplicate set of events(for testing purposes). From {events} I get everything, but not sorted how I like. From article_event I get most things sorted nicely but
1. An event whose stepfield is “29 ?month” shows up on the 28th for the smd_article_event and on the 29th using {events}
2. An event whose stepfield is “10000 days” and whose extrafield is “5-dec-2011=>9-dec-2011,12-dec-2011=>16-dec-2011,19-dec-2011=>23-dec-2011,30-dec-2011” appears correctly using {events}, but only appears on the first day of each of the date ranges (5 dec, 12 dec, 19 dec, and 30 dec) using smd_article_event.

Any suggestions?

Edit: Those are work-around-able. What would be really nice is if extrafield worked with “2011-dec-10 18:30:00, 2011-dec-11 10:00:00” or even “5-dec-2011=>9-dec-2011 13:00:00” (though #2 above still applies) Thanks!

Last edited by kr37 (2011-12-14 14:05:46)

Offline

#770 2011-12-21 20:28:58

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: smd_calendar: complete schedule / event / calendar / diary

Apologies if this has been posted before, I searched the thread but couldn’t find it. I have an event from Dec. 12 2011 – Jan. 31 2012, and the Dec. 31 cell is also getting a ‘multilast’ class. Not sure if I overlooked something or if this is a bug?

This is my tag:

<txp:smd_calendar
   yearwidth="0,1"
   maintain="section,article"
   section="bookings"
   category="cozinha"
   expired="1"
   firstday="1"
   classlevels="cellplus"
   classprefixes=""
   eventwraptag=""
   form="smd_eventform"
   cellform="smd_cellform"
   select="month"
   navarrow="##prev##,##next##" />

Offline

#771 2012-01-03 13:42:18

maxk
Member
Registered: 2010-02-17
Posts: 11

Re: smd_calendar: complete schedule / event / calendar / diary

Sorry for posting on a issue that has probably been covered, but I can’t find a solution. I am having a problem with the days of the week header. The days of the week are shifted depending upon the time of day when the calendar is viewed. This has been a problem for quite a while. My server is mountain time zone and I am in eastern time, but shifting around the timezones doesn’t seem to help. I am using txp 4.4.1 and smd_calendar 0.52

My use of the calendar is simple. My code:

<txp:smd_calendar time=“any” section=“calendar” firstday=“0” yearwidth=“2,2” />

Here is a screenshot of the calendar at two different times. One late at night, one in morning.
http://www.swimdcrp.org/smd_calendar-daysofweek.jpg

Thanks for any suggestions.
max

Last edited by maxk (2012-01-03 13:42:47)

Offline

#772 2012-01-03 15:08:19

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: smd_calendar: complete schedule / event / calendar / diary

maxk wrote:

The days of the week are shifted depending upon the time of day when the calendar is viewed

Long standing issue that I think I’ve squashed. Please try v0.53 beta and see if things improve.

Els

The beta should solve your issue too. Thanks for the bug report.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#773 2012-01-03 15:30:15

maxk
Member
Registered: 2010-02-17
Posts: 11

Re: smd_calendar: complete schedule / event / calendar / diary

Thanks Bloke,

There is a change, but the result is the shifting of headers is occurring now during the day. I will have to wait and see if it is better late in evening.

http://www.swimdcrp.org/smd_calendar-daysofweek2.jpg

Is there an explanation about this problem that I can read? Is this something that only happens on servers with some certain set of parameters? How do others manage this problem? For me this has prevented me from trying to use the smd_calendar on other sites.

As a solution, I think I am going to hide the headers with css and create my own hardcoded headers and hopefully that will work out.

thanks
max

Offline

#774 2012-01-03 16:30:59

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: smd_calendar: complete schedule / event / calendar / diary

maxk wrote:

There is a change, but the result is the shifting of headers is occurring now during the day

Oh no! Sorry about that. I’m gradually tracking down each place where this kind of thing occurs and trying to make it work for all timezones. Guess I still have some work to do. I fixed it for Teemu’s setup (his server and website were separated by 13 hours) so maybe in fixing that one I’ve inadvertently cocked it up for people with other time differences.

The easiest thing for me to do — if you don’t mind, and your site is online — would be to log into your admin side so I can track down the plugin problem directly on your server setup. If I try and do it on mine I’ll be there forever trying to guess if it worked or not. If you would be so kind as to let me have a login then I shall do what I can to fix it.

Is there an explanation about this problem that I can read? Is this something that only happens on servers with some certain set of parameters?

Sadly, there’s no excuse. It’s just crappy coding on my behalf. I shall attempt to explain things a little here by way of documentation, without getting too technical. Unfortunately in the case of the day names the story begins with two lines of code from Marshall’s original plugin:

// This is done to make sure Sunday is always the first day of our array
// Unix time gets a little funky at the beginning depending upon your timezone.
$serveroffset = gmmktime(0,0,0) - mktime(0,0,0);
$start = (($serveroffset < 0) ? 4 : 3);

Now, quite what that piece of voodoo achieves I have no idea. On my server the difference is one hour (it reports a -3600 difference when DST is in effect, 0 otherwise… errr, or the other way round, can’t remember). On other server setups I see all manner of weird numbers for this serveroffset value.

I think that code is supposed to combat oddities that can occur at the 1970 UNIX Epoch. In Teemu’s case (and mine) it was solved by taking the radical approach of ignoring the calculation and setting $start to 3. Clearly that has backfired in your case, as does the original code in Marshall’s calendar implementation, upon which smd_calendar was based.

On top of this issue is the fact that Textpattern stores its posted / expiry dates with timezone offset already applied. So I need to remove that offset when dealing with such dates before displaying information to web visitors. It’s further convoluted if you have specified your own start/end dates in a custom field: in that situation the offset is not applied (because a custom field is stored verbatim) and I need to manually apply any timezone offset that might be in effect.

The calendar itself is generated from PHP code, which may or may not be running on the same server as the database that houses the events. The day names are generated as such based on the server time that is in effect when you view the web site. The same goes for the cells and the ISO week. Since the server time is more than likely different to the time you see on the clock on your wrist, when you hit the next day and the server is still on the previous day, the day names (and sometimes cells) appear to shift by one until the server catches up.

Textpattern has a safe_strftime() function which is supposed to shield me from all this and pull dates out of the database with timezone neutrality. It does a very good job but it’s been inconsistently applied throughout the plugin code and I’ve been fighting it from day one to detect whether to use it or not under the varying usage conditions, host configurations and website setups. And that’s before governments get involved and screw things up further with DST :-o

Every time I think I’ve nailed it and get the logic straight in my head, another anomaly crops up and I have to hope that fixing it doesn’t break any of the other servers I’ve previously tested it with.

The upshot is I have no hair left and an irrational fear of the word “Timezone”.

I think I am going to hide the headers with css and create my own hardcoded headers

Try using the dayformat attribute. By specifying your own list of days of the week (always starting on Sunday) you tell the plugin you don’t give a damn about the server’s timezone. You could try that and see how it works out, as a stab-in-the-dark until I can finally figure out the real issue.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#775 2012-01-03 16:49:39

maxk
Member
Registered: 2010-02-17
Posts: 11

Re: smd_calendar: complete schedule / event / calendar / diary

Bloke wrote:

The easiest thing for me to do — if you don’t mind, and your site is online — would be to log into your admin side so I can track down the plugin problem directly on your server setup. If I try and do it on mine I’ll be there forever trying to guess if it worked or not. If you would be so kind as to let me have a login then I shall do what I can to fix it.

I have created a user for you in that txp installation.

Thanks for the explanation, can’t say I understand it very well.

Try using the dayformat attribute. By specifying your own list of days of the week (always starting on Sunday) you tell the plugin you don’t give a damn about the server’s timezone. You could try that and see how it works out, as a stab-in-the-dark until I can finally figure out the real issue.

I will give this shot. (Ok, that seemed to do the trick)

Last edited by maxk (2012-01-03 16:53:45)

Offline

#776 2012-01-03 16:58:00

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: smd_calendar: complete schedule / event / calendar / diary

maxk wrote:

I have created a user for you in that txp installation.

Thanks. Is the site live yet? (i.e. will anyone complain if I put debug info to the screen or should I try and be discreet?)

Thanks for the explanation, can’t say I understand it very well.

You and me both! :-)

I will give this shot. (Ok, that seemed to do the trick)

Cool. It’s a useful workaround in these situations, I’ll be sure to document it somewhere.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#777 2012-01-03 17:03:32

maxk
Member
Registered: 2010-02-17
Posts: 11

Re: smd_calendar: complete schedule / event / calendar / diary

It is a live site, but not too worry, it is my site, so go ahead.

Offline

#778 2012-01-03 20:37:43

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: smd_calendar: complete schedule / event / calendar / diary

Bloke wrote:

Els

The beta should solve your issue too. Thanks for the bug report.

Yes it does. Thank you!

Offline

#779 2012-01-05 02:42:31

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: smd_calendar: complete schedule / event / calendar / diary

There are times on this planet when I really should be packed inside a cannon and fired into an active volcano. After a complete ‘duh’ moment, this is one of those times. If anyone can spare a cannon and/or a volcano, send them my way.

In the meantime, please download v0.53 beta in which I have proved that the mantra KISS should be stamped on the back of my hands so I have no excuse to type such gibberish as graced previous versions. The day names should now be static regardless of the time of day because I’ve anchored them to a fixed date in history.

Apologies for being a complete tool all this time, and thanks to maxk for the gracious use of his server upon which to debug my drivel.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#780 2012-01-05 11:07:53

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: smd_calendar: complete schedule / event / calendar / diary

Hi all,

Experimenting with this plugin. Is there a way to use custom fields for start-end dates?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB