Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#469 2010-02-14 19:43:22

PascalL
Member
From: Switzerland
Registered: 2009-03-09
Posts: 132
Website

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

Hi!

I have two issues with your otherwise beautiful event/calendar set. Both happen on local install and live server.
I have Texpattern 4.2 and smd_calendar 0.42c

First is benign for my use, and I think it has been brought before:

Between exactly midnight (local) and 1am, the calendar shifts the days in the th, starting with Thursday instead of Monday. The dates inside the calendar are still right. My timezone is +1 CET.

The second issue is more tricky:

As you can see on my dev site I use the smd_event_article tag to display a list of upcoming events. I have set up a custom field for extra dates, which works fine in the calendar. But in the event list, the extra dates don’t work: usually they don’t display at all (see “Welcome to your site” article in february), and some rare times they appear, but one day late. As far as I could try, only extra dates posted on march 2010 seem to work that way. Seems very strange to me!

here is part of my default page:

<div id="contenu">
    <txp:if_individual_article>
<div id="serie-a">
            <txp:article form="evenement_simple" />
</div>
    <txp:else />
        <div id="serie-a">
            <txp:smd_article_event
                section="agenda"
                category="bal,stage,bal-et-stage"
                form="evenement_simple"
                time="future"
                limit="1"
                stepfield="custom_3"
                extrafield="custom_4"
                omitfield="custom_5"
                skipfield="custom_6"
            />
        </div>
    <div id="calendrier">
        <txp:smd_calendar
            section="agenda"
            cellform="cellule"
            form="contenu-cellule"
            classlevels="cellplus, event"
            firstday="1"
            expired="0"
            stepfield="custom_3"
            extrafield="custom_4"
            omitfield="custom_5"
            skipfield="custom_6"
        />
    </div>
        <div id="serie-b">
            <txp:smd_article_event
                section="agenda"
                category="bal,stage,bal-et-stage"
                form="evenement"
                time="future"
                limit="20"
                offset="1"
                stepfield="custom_3"
                extrafield="custom_4"
                omitfield="custom_5"
                skipfield="custom_6"
            />
        </div>
    </txp:if_individual_article>
</div>

and the “evenement” form:

<txp:if_different>
    <h2 class="mois">Mois de <txp:posted format="%B" wraptag="" /></h2>
</txp:if_different>
<div class="article">
    <h3>
        <a href="<txp:permlink />?jour=<txp:posted format="%d-%m-%Y" />">
            <span class="date"><txp:posted /></span><br />
            <txp:title />
        </a>
    </h3>
    <div class="article-body">
        <txp:rss_auto_excerpt length="250" linktext="Continuer&hellip;"></txp:rss_auto_excerpt>
    </div>
</div>

Last edited by PascalL (2010-02-14 19:45:47)

Offline

#470 2010-02-14 21:22:56

PascalL
Member
From: Switzerland
Registered: 2009-03-09
Posts: 132
Website

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

I just realised that extra events are displayed all on 1.1.1970 when I set time=“any” . Maybe this can help.

Offline

#471 2010-02-16 18:48:31

PascalL
Member
From: Switzerland
Registered: 2009-03-09
Posts: 132
Website

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

Lokks like my problem is the same as LetterHoofd’s.
I’ll try your suggestions there.

Offline

#472 2010-02-16 21:56:59

PascalL
Member
From: Switzerland
Registered: 2009-03-09
Posts: 132
Website

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

I have removed all articles and created just one. Same problem.

Here is the debug info

Offline

#473 2010-02-25 01:40:37

aswihart
Member
From: Pittsburgh, PA
Registered: 2006-07-22
Posts: 345
Website

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

Looking at using this plugin for a calendar for my residency program where there are 10 or so residents on call every night, assigned to various services. We are currently using an abysmal Excel file to store our call schedule, and your plugin looks like it holds a lot of potential.

The main functionality I need is for two people to be able to negotiate and inact call switches with each other, asking as little as possible of all participants as far as dealing with the backend of Textpattern. This needs to be as simple as possible. I think ideally, the initiator would email a proposal to the other resident, and that resident would then just confirm or reject the proposed call switch also via email. Perhaps this is too simple to work.

I’m thinking the smart way to go about this is to have each person on call for something be the “author” of the “article” (aka the service they are covering that night). I am not as familiar with Textpattern’s various user privilege levels as I should be. I’m wondering if the initiator of a proposed call switch could go into the backend and make the changes, but the changes would be pending until the other person confirms them. And since we are talking about call switches, it would involve switching the author values of two articles. Any ideas on getting this kind of thing to work?

Last edited by aswihart (2010-02-25 01:43:48)

Offline

#474 2010-02-26 21:48:26

visualpeople
Member
From: Corvallis, Oregon - USA
Registered: 2005-11-16
Posts: 73
Website

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

Maybe I’m missing something because I thought I remembered this coming up before, but is there a way to prevent the backward (previous) navigation from showing up just on the current month’s calendar? ie. You can go forward, or you can go backward if you are in a future month, but you can’t go backward and see what happened in January or December of last year.

I know we can just choose to show future events, but then when you get toward the end of the month it looks like you had nothing going on and that still allows you to go back to previous blank months.

I also know that (this is what we’ve done right now) I can just add a display:none to .smd_cal_navprev and voila, it’s gone, but then it’s gone for future months, too. I was thinking if there was a way to add an additional class to just the current month’s .smd_cal_navprev that’d be a quick and easy solution, but I can’t quite figure out how to do that.

Offline

#475 2010-02-26 22:25:34

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

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

visualpeople wrote:

is there a way to prevent the backward (previous) navigation from showing up just on the current month’s calendar?

Hmm, can’t recall a neat solution. But my memory’s not what it was. The yearwidth might help get partway there by disallowing anything in the previous year (e.g. (untested) but yearwidth="0c, 4c" might allow you to only navigate up to 4 years hence from today’s date and 0 years back?). But I still think that’ll allow navigation within the current year.

In which case you’re probably limited to having to do it yourself with some logic but I’m not sure offhand how much control you have over the header row. In the new version I’ve built in support for completely customising the header section so you can put some conditional tags in there to do your bidding. But I think in the current implementation you might be out of luck without altering it after the fact with jQuery :-(

Sorry, but if I think of anything I’ll yell.

aswihart

I’m not quite sure how this plugin fits in with your world domination plans for TXP as a building security system :-) It just displays a calendar and/or a list of events from now or the future. The smd_article_event tag does nothing that article_custom can’t do, aside from understanding recurring/spanned events. Perhaps if I got my head round your intended workflow a bit better I might be able to advise but I’m not sure if this plugin is the right approach. A generic How Do I… might garner some more ideas and if you end up back here, we’ll go from there!

PascalL

Sorry for the delay getting back to you. I think the 2nd thing is a bug in the way the expiry is calculated. It should retain its info at 0000-00-00 00:00:00 and not revert to the 1970 epoch. It’ll be fixed in the next version, but for now I’m not sure why your events aren’t showing up as expected. When I tried the site it seemed to show the right events for me, so I guess our expectations are different :-) If you have any more detail about exactly what you expect to see in the calendar and what you expect to see when you click on particular events, I can perhaps track down what’s going on. Also, if you have any example articles with descriptions of your custom field data that I could use to try and replicate your setup on my test server it’d help, thanks.

Incidentally, the first problem about shifting an hour around midnight is definitely a CET/GMT/DST thing. The way the day names are calculated (erroneously) does not take into account the DST setting so it shifts them all back one or forward one day during the last hour nearest midnight. It’s stupid and I apologise for that crappy behaviour. If I can address it in the next version I will do so.


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

#476 2010-02-26 23:12:05

visualpeople
Member
From: Corvallis, Oregon - USA
Registered: 2005-11-16
Posts: 73
Website

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

Well, since you couldn’t help me, I had to turn to someone else who could ;-)

There’s this guy who made this great plugin I sometimes use, called smd_if. Wow, this guy is the best!

So here’s what I did, not elegant, but it seems to work pretty well:

I already had a div wrapping my calendar with the id of full_width_content, so I just added this little beast to it:

<div id="full_width_content" <txp:variable name="current" value='<txp:php>echo date(m);</txp:php>' /><txp:smd_if field="urlvar:m" operator="gt" value="txpvar:current">class="future"</txp:smd_if> >

Then in my css, I just did a little of this:

#full_width_content .smd_cal_navprev {
	display: none;
}

to hide the previous navigation and then this:

#full_width_content.future .smd_cal_navprev {
	display: inline;
}

to bring it back when you’re not looking at the current month.

It’s not a thing of beauty, and I’m certain there’s a way to do it more efficiently, but overall, it works and it was pretty quick. A win-win in my book! Hope it helps someone else someday.

- Ryan

Offline

#477 2010-02-26 23:54:14

PascalL
Member
From: Switzerland
Registered: 2009-03-09
Posts: 132
Website

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

Hi Bloke! Don’t apologise, I understand you can’t be on all fronts at the same time (except if you cheat with time functions). Don’t worry, I didn’t yet find a way to fix the damn rope to the ceiling, and I’m far too cowardly to jump through the window (which is not high enough anyway). :D

When I tried the site it seemed to show the right events for me, so I guess our expectations are different :-)

dammit, I added a bunch of articles to show a friend of mine, deleted extra date, and forgot to set it back like before. In fact, additional dates don’t show in the article list, except when they are set in march (any year)!!! Stange uh?
I’ve cleaned things a bit.
There’s an article with a start date and an extra date in april, so you can look at it again . Please notice, the problem is not with the calendar, but with smd_article_event, which is used to list article down the page. I’ve also put a screenshot of the admin side in the article itself.

P.S: Noticed something: I’ve just read the desciption of strftime” function, and noticed this change lately:

Returns a timestamp on success, FALSE otherwise. Previous to PHP 5.1.0, this function would return -1 on failure.

Could this play a role in the uggly bug that affects me? sorry if I’m totally off, at least I’ve tried.
Thanks for your help!

Last edited by PascalL (2010-02-27 00:00:16)

Offline

#478 2010-02-27 00:23:54

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

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

visualpeople

I like the cut of your jib, thanks for sharing. Cunning. These plugin authors, eh…

PascalL wrote:

In fact, additional dates don’t show in the article list, except when they are set in march (any year)!!!

That definitely sounds like a bug to me. I’m going to see if I can replicate this on my test server using a similar setup to yours.

Returns a timestamp on success, FALSE otherwise. Previous to PHP 5.1.0, this function would return -1 on failure.

This could indeed be related to the behaviour you are seeing. If you’re on PHP < 5.1 then -1 may well be interpreted as the 1970 date. But it shouldn’t ever fail because your date appears to be sound: 2010-02-22 is definitely a valid date and strtotime() should be able to parse it, therefore strftime() should be getting a valid datestamp too.

It’s interesting that the time portion of the original datestamp and the bogus 1970 date differ by 1 hour. Perhaps that might be the clue I need to chase.

Last edited by Bloke (2010-02-27 00:36:29)


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

#479 2010-02-27 00:53:02

PascalL
Member
From: Switzerland
Registered: 2009-03-09
Posts: 132
Website

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

If you’re on PHP < 5.1 then -1 may well be interpreted as the 1970 date.

PHP version is 5.2.9

It’s interesting that the time portion of the original datestamp and the bogus 1970 date differ by 1 hour. Perhaps that might be the clue I need to chase.

Yes, I’ve noticed that. And, when extra events are set in march, they actually appear, but 1 or 2 days late. May this can help finding the burglar.

Let me know if you need any other information. I can give you access to my setup if needed.

Thanks!

Offline

#480 2010-02-27 02:26:23

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

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

PascalL

This is bizarre. If I set my extra date to “2010 04 22” I don’t see the article_event because, for some reason, PHP chokes on the date and converts it to 1970-01-01. If I specify it exactly as you have “2010-04-22” everything works fine on my server. I see the two events on the calendar and I see the 2nd event — the one on the 22nd — in my article_event list (because your offset=“1” skips the first article on the 10th April).

Since it’s definitely working for me, that leaves a server / configuration issue which we’ll have to track down. It could be because I’m GMT and you’re using CET, in which case I need to double check the code handles DST consistently.

However, during my meddling I had an epiphany regarding my use of the safe_* functions compared with the standard PHP functions. In some cases I have accidentally applied safe_strtotime() twice which totally banjaxes up the timestamp because it applies the DST and server offsets twice. I think I was doing this when calculating the extra dates so that might account for the “lost hour”.

But that got me thinking: I bet there are other places where I’m mistakenly applying the safe_* versions twice. That could certainly explain some of the weirdness people are seeing and may actually be the cause of the odd ‘day shift’ thing too. So what I need to do now — and be very careful of during the process of rewriting the plugin — is to ensure that every possible code path that the plugin can take results in one and only one call to safe_strftime or safe_strtotime() on each date/timestamp. That’s gonna take some time!

Last edited by Bloke (2010-02-27 02:28:19)


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

Board footer

Powered by FluxBB