Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

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

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

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
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,726
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: 11,449
Website GitHub

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: 11,449
Website GitHub

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
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,726
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: 11,449
Website GitHub

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

#91 2009-02-09 22:08:41

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,726
Website

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

Stef, you are exactly right about the time between start and finish. I just used some sample real data that I had input manually on a site last week and he happened to specify start and end times, so I just put them in for good measure.

The start time was indeed 15:00 and that is why it only showed the third day after 15:01 and not with an end time of 14:00. I can shift it around, but if it’s less than 48 hours it registers as two days not three (quite logical, of course).

What if you instead of calculating the difference between the time stamps, for the purposes of a calendar that uses only days, you grab only the day of the posted date and day of the expiry date and compare those, then add that to the extra date, e.g. an event that begins on the 1st at 23:59 and runs to the 3rd at 00:01 appears as 3 days on a calendar because it begins on the first and ends on the third.


TXP Builders – finely-crafted code, design and txp

Offline

#92 2009-02-09 23:44:38

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

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

And so it came to pass. v0.41 final Final FINAL (honest) is uploaded. Apologies for the false start. Any more stuff will be zapped in the next release.


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

#93 2009-02-10 03:16:41

w1111e
New Member
Registered: 2009-02-10
Posts: 1

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

Hello There,

I’m a newbie to Textpattern and this plugin, but I’ve spent the last two days immersing myself in both and I’m blown away by the possibilities.

I had a question that I couldn’t find the answer to in the documentation, but of course as soon as I stopped looking I found it. All I can say is thanks for the fantastic plugin.

Cheers,
Scott

Last edited by w1111e (2009-02-10 04:44:07)

Offline

#94 2009-02-10 08:59:38

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

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

w1111e

You’re very welcome. As usual with my plugins it stands on the shoulders of giants before me (Marshall in this case, of mdp_calendar fame); glad it’s useful and that you’re finding TXP cool.

If you can think of a way to make the documentation more, ummm, ‘penetrable’ or the plugin any better, then please make suggestions and I’ll see what I can do. Ta!


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

#95 2009-02-10 14:54:31

decoderltd
Member
From: London
Registered: 2006-06-20
Posts: 248
Website

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

Hi Stef,

Thank you for the latest update, it’s looking very good.

Sorry to be a pest – I’m trying to style a calendar and apart from the standard table elements, I’m not really sure about the specific smd_calendar CSS I should be using. Would it be possible to list them or is there somewhere else I should be looking?

Offline

#96 2009-02-10 15:24:39

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

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

decoderltd wrote:

Would it be possible to list them or is there somewhere else I should be looking?

The docs list the defaults but, hey, we know what the docs look like ;-)

Out of the box you have the unwieldy yet “safe” prefix smd_cal_ already set up. So all class names I list below need this prefix added to them when used in your stylesheets (unless you override the prefix with the classprefixes attribute) :

  • empty | ‘empty’ cells with no date in them (start / end of the month)
  • week | ISO week cells (if used)
  • navprev | previous month arrow
  • navnext | next month arrow
  • event | cells that contain any event
  • hols | any cell that is a holiday
  • today | today’s date cell

And one “fixed” class called smd_cal_daynames which is the row containing the days of the week (this name cannot be changed at all).

The following do not have any default set up but you can add classes for:

  • the entire table (class attribute)
  • each row (rowclass attribute)
  • each cell (if you’re mad! The cellclass attribute)
  • the month/year area (myclass attribute)

Then you have events inside cells, normally on each anchor:

  • standard | any regular, one-off event
  • recurfirst | first event of a recurring set
  • recur | any other recurring date
  • multifirst | first event of a spanned set
  • multilast | last event of a spanned set
  • multiprev | first day of the month from a spanned set that started in an earlier month
  • multi | all other spanned events
  • extra | any extra dates added via extrafield
  • cancel | if the event is cancelled

Note that these can appear attached to the ‘td’ itself as well, if you use classlevels="cellplus" attribute to “copy” them up. In that case you also get omit appearing if an event is omitted.

You can also use field event classes, which are named after the article field from which you grabbed the data. These all default to having smd_cal_ev_ as a prefix unless you override it. Out of the box there’s one such event class set up for “category”. So if you’re using the default cats, you might see a class called smd_cal_ev_meaningful_labor. These classes are usually only for hard core users :-)

Does that help?

Last edited by Bloke (2009-02-10 15:34:28)


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