Textpattern CMS support forum

You are not logged in. Register | Login | Help

#81 2009-02-08 20:52:28

jakob
Moderator
From: Germany
Registered: 2005-01-20
Posts: 3,293
Website

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

the docs are daunting – Yeah, sorry about that

Oh, no need to apologise – I meant that they were already impressive! Just easier to digest on paper. I hadn’t realised something was missing as they were complete right up to the changelog.

multi-day (spanned) events that are offered a couple of times a year at irregular intervals … I’ll have to see if that’s possible.

That would be great. It was pure chance that the first real infos that I had to test with happened to present that situation. I’m just testing bit by bit for the moment.

Are you essentially asking for MLP compatability so that the calendar automatically changes based on browser language?

No, that’s no problem. I have no need for MLP, I was just trying it out because it was in the docs :-) As an Englishman living in Germany I happen to prefer developing with the back-end set to English but the site would be in German. Maybe a simple solution would be to implement what you have for the dayformat for monthformat too, so that one can specify twelve strings for the months? Again, no hurry – it’s no problem to switch the back-end to German when the time comes.


TXP Builders – finely-crafted code, design and txp

Offline

#82 2009-02-08 21:16:36

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,577
Website

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

jakob wrote:

…they were complete right up to the changelog.

Did it get that far? It’s not as bad as I thought then. I’ve dropped the changelog in the official docs, which helped immensely, and will just put them online and in this thread. But the documentation is eased with the styles in place. I’ve fixed ied_plugin_composer btw so it won’t render help that is too big for the database. Curiously enough, it’s only my plugins that are affected… I wonder why :-p

I have no need for MLP

Phew! That would be tricky to implement.

I was just trying it out because it was in the docs :-)

Yeah the plugin and docs don’t quite mesh up while the fate of those two attributes hangs in the balance. On one hand they should be there because they’re useful when using safe_strftime(). On the other, I can’t make the plugin work with safe_strftime() so the two attributes are nigh-on useless!

Mind you, according to Rick it’s not quite working with vanilla strftime() either, so something’s definitely up with the time zone calculations. I thought it was OK after mrdale and I thrashed out a solution but clearly it’s not and I need to do some more testing in non-GMT mode.

Maybe a simple solution would be to implement what you have for the dayformat for monthformat too

Yes, and for the life of me I can’t remember why I didn’t do that at the time. I vaguely remember attempting it and giving up, but maybe I didn’t try hard enough or just dreamed that bit. Is it sad when you start dreaming about TXP code? Probably…

Last edited by Bloke (2009-02-08 21:18:32)


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

#83 2009-02-09 02:32:24

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 704

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

To be clear, I’ve no complaint here nor any need to have anything by the end of the day, or the month for that matter, this work just has such elegant potential that I would like to see it get the support and feedback that it rates.

according to Rick it’s not quite working with vanilla strftime()

Actually, what I did was leave the calls to safe_strftime() in and tried to set site and such to GMT and build tags to manually apply time zone offsets to display tags, this experience being much like getting ones’ tongue frozen to the play ground tether pole – I have since abandoned the idea. (One has to love time handling in TXP)

I have tried changing the calls to safe_strftime() to strftime(), with one exception, and I can get things working localhost as I would like that way – though not on a live server with a time offset, (so I may take another stab at the tether pole).

I’ve read the threads, any I could find, and the docs and haven’t found a workaround that suits me yet, so I’ll await the next version and see what of constructive value I can come up with then.

Offline

#84 2009-02-09 09:06:51

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,577
Website

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

rsilletti wrote:

To be clear, I’ve no complaint here

Sorry, didn’t mean to imply you had. Bad wording on my part when I read it back in the cold light of day. Apologies if it sounded critical; I’m incredibly grateful for the attention you have given this because I’m at my wits end with time/time zone handling!

I think I did pretty much the same as you: started off with leaving safe_strftime() as they were in the original mdp_calendar. When I/mrdale realised that wasn’t working I swapped all but one out for strftime() and that “worked” for mrdale on GMT-08 so I just figured it was OK across time zones and all was well. Clearly not quite… :-(

After reading up on date handling, including saccade’s excellent posts on the subject, I’m also at a loss as to how to handle it “properly”. I hope there is a fix to allow this plugin to work consistently, but at the rate things are going it might end up being easier to work on patching TXP so it doesn’t adjust the dates in the first place!

I’m at the major disadvantage that I have a GMT host and live in the GMT zone so it is very difficult for me to simulate potential problems around the world (“Dear Mr Host, please would you adjust your time zone setting on the server so I can test something…”). Any assistance or test reports anyone can offer in other parts of the globe are very, very welcome.


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

#85 2009-02-09 15:46:13

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,577
Website

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

New version out: mainly bug fixes, but a couple of extra features rolled in too. Sorry, no concrete date resolution yet, this is just a maintenance release since I found some time:

  • Slightly shorter, more direct, and styled(!) docs that don’t cut short any more :-)
  • New attribute: remap for easier manipulation of multiple calendars on a page
  • Entire spanned events can now be copied via the dates in extrafield. Just add a + symbol to any dates in the list that require the span dates copied as well (thanks jakob)
  • monthformat can now take a pre-defined list of names (thanks jakob)
  • Paging can be turned on/off in smd_article_event (thanks robhert)
  • Expanded isoweeks replacement variable list
  • Bug fix: ?month and ?year detection (thanks decoderltd)
  • Bug fix: trimmed the class names so leading / trailing spaces are removed
  • Bug fix: xtrastrict warning
  • Bug fix: week dropdown goes to 53 now
  • Usability: FULL and ABBR can be given in all upper or all lower case

Hope that makes it a bit easier to grasp for those struggling with the mammoth v0.4 cock up.

Download compressed | uncompressed and play.


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

#86 2009-02-09 17:14:06

jakob
Moderator
From: Germany
Registered: 2005-01-20
Posts: 3,293
Website

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

Yeeha! Custom months now working fine and extrastrict warning resolved (had noted that down to write to you, just an e missing).

I’m not seeing the effects of the “+” though, but maybe I’m doing something wrong?

In my article I have a timestamp of 2009 / 05 / 15 and expires of 2009 / 05 / 17.

In the extrafield I have 2009-Jun-19+, 2009-Jul-17+ (or 2009-06-19+, 2009-07-17+) but not seeing it reflected in the calendar classes, only the begin date.

Also, how would one specify the from/to dates in smd_article_event? I tried <txp:posted /> – <txp:expires /> analogue to your select-list example but just to list “This also takes place on: …” but I get the original expire date from May. [BTW: thanks for noting txp:expires in your help docs it’s not in the tag reference on textbook. EDIT: See below: this link is old, the correct txp tag reference is this one. Thanks for the correction, Stef ]

Last edited by jakob (2009-02-09 20:55:06)


TXP Builders – finely-crafted code, design and txp

Offline

#87 2009-02-09 19:00:14

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,577
Website

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

jakob wrote:

I’m not seeing the effects of the “+” though, but maybe I’m doing something wrong?

Hmmm, it’s working for me. Do you still have login info for the test fast4you site? If so, log in and take a look at the news page, scroll down under the TEST TEST TEST and mooch forward to May/June/July.

That was done with a single article set to the dates you gave, the two ‘+’ dates you gave and this tag:

<txp:smd_calendar extrafield="custom_1" select="month" />

Couple of things to check:

  1. The time of the expiry event (I set mine to 22:59:59 so it definitely went to the end of the 2nd day and also helps when DST changes by not ‘clicking’ over to the next day by mistake)
  2. Your Admin prefs settings for expired articles, though if you say they are showing up as single events it should be working ok. Does it change things if you add expired="1"?

Also, how would one specify the from/to dates in smd_article_event?

Hmmmm, that’s supposed to work, except I forgot to assign the faux expiry the same as I set the faux posted date. Numptee. Gimme half hour to scoff my dinner down and I’ll *ahem* reissue 0.41 with this stupid oversight fixed before anyone else notices.

thanks for noting txp:expires in your help docs – it’s not in the tag reference

That’s the old school ref, scheduled for deletion. Here’s the new one (I’ll mark the old one up better until Destry can remove it)

Last edited by Bloke (2009-02-09 20:17:01)


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

#88 2009-02-09 19:58:22

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,577
Website

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

OK, try grabbing v0.41 again. It’s definitely fixed the expiry in your case but I had a bit of an alert about what to do for a repeated event that continues every week for 2 months. Should the expiry always give the same end date:

  1. post 09 Feb 2009 – exp 27 apr 2009
  2. post 16 Feb 2009 – exp 27 apr 2009
  3. post 23 Feb 2009 – exp 27 apr 2009

Or should the expiry increment as well? In the end I decided to leave it as above. If you’re repeating an event (e.g. a weekly boot fair) then the duration of the event will always be fixed, so the “expiry” of the article makes no sense in that context — it’s purely for specifying how long the repetition continues. Expiry only makes sense with true spanned events and moves with the event, if you copy it using extras.

I think that addresses it but any more info / scenarios welcomed. Any more clues on your previous issue?

EDIT: Bah! Third time lucky. Uploaded the wrong file… it’s been one of those days :-(

Once more with feeling…

Last edited by Bloke (2009-02-09 20:19:04)


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

#89 2009-02-09 20:35:07

jakob
Moderator
From: Germany
Registered: 2005-01-20
Posts: 3,293
Website

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

Thanks for the rapid response – just fantastic! The expiry date now shifts with each extra date perfectly using the extrafield as specified above. I now get the following, which is also what I want :-)

  • 15 May 2009 – 17 May 2009
  • 19 June 2009 – 21 June 2009
  • 17 July 2009 – 19 July 2009

What’s not showing yet is the classes on the calendar. For example, I’m getting class="smd_cal_extra smd_cal_multifirst" on the 19th June but not multi for the 20th or multilast on the 21st (see EDIT). FWIW: I’m using size="small" at the moment but I expect that makes no difference. Can you check that on your side too?

EDIT: “The Feeling” helped :-) A bit. Nearly there. Now I get class="smd_cal_extra smd_cal_multifirst" for the 19th June, and class="smd_cal_extra smd_cal_multilast" for the 20th June. Multilast should be on the 21st, with multi on the 20th. My expire time is set to 14:00 on the Sunday (which the man happened to specify).

EDIT 2: Wierd: I experimented with the expiry time. 15:00 and earlier makes only 2 days show, 15:01 and after and it shows correctly as three days. In the admin prefs, I’m on GMT +1 with DST off.

repeated event that continues every week for 2 months. Should the expiry always give the same end date?

If I understood your docs correctly, a regularly repeating event can’t be a multi-day event, so it will always be one day long. If that’s so, then one never really needs to specify the expiry for each event, just the last time it happens, e.g. a 10-week course every Tuesday. So, the way you have it sounds logical.
But (playing devils advocate), does that become a problem when an event takes place say from 13:00 to 15:00 on a day each week? Then, I guess, one needs some way of specifying expiry after all?

That’s the old school [Tag] ref, scheduled for deletion.

I’d been blindly using my bookmark and never realised that. Thanks for the info!

EDIT: note twice edited.

Last edited by jakob (2009-02-09 21:12:53)


TXP Builders – finely-crafted code, design and txp

Offline

#90 2009-02-09 21:39:46

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,577
Website

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

jakob wrote:

What’s not showing yet is the classes on the calendar.

Freaky. It shows up on mine for all 3 events — even with a small calendar.

EDIT: “The Feeling” helped :-) A bit.

Right so it’s the way it’s calculating the difference between the end and start expiry. Here’s the logic:

  1. Take Expiry timestamp of base article (assuming it’s set: if not, bomb out)
  2. Subtract base Posted timestamp
  3. Divide by (60*60*24) to get the number of days Difference (i.e. the event duration, in days) and round it up
  4. Grab the Extra date, output it as a multistart
  5. Calculate the faux expiry, store it
  6. Add a day to the Extra date, check it’s visible within the currently viewed month and append the ‘time’ part of the Posted date (e.g. 20 Jun 2009 becomes 20 Jun 2009 12:43:28 if that was the time you posted the original article)
  7. Set fake Posted and Expiry dates
  8. Display
  9. Repeat step 6-8 for every Extra date

Can you see anything wrong with that approach?

It’s definitely to do with the start and end times of the events. Methinx step 3 is the culprit. If the start time is, say, 3pm and the end time is, 10am then there are not a whole number of days between events and your events will be one day ‘short’ on the calendar.

How should it be calculated? Any ideas?

a regularly repeating event can’t be a multi-day event, so it will always be one day long.

Correct.

But (playing devils advocate), does that become a problem when an event takes place say from 13:00 to 15:00 on a day each week?

Yes but TXP has no way of specifying more than one expiry so you make a choice I guess:

  • Use the expiry to specify the end point of the repetition and manually display the end time of the event in the form
  • Use the expiry to specify the end time stamp of the event and use extra dates to “copy” them to all future weeks — as many as required

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