Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#21 2009-01-08 11:33:36
- Bloke
- Developer
- From: Leeds, UK
- Registered: 2006-01-29
- Posts: 9,995
- Website
Re: smd_calendar: complete schedule / event / calendar / diary
FireFusion wrote:
I’d like to add those changed dates without having to create a whole new article for each one.
Gotcha. Right. Makes sense now. Sorry, I was being dim.
That’s perhaps a valid scenario if you imagine, I dunno, Slipknot are on tour and Joey Jordison hurts his ankle. The show can’t go on as planned so you’d have to cancel one or two events but might want to reschedule them at a later date at the same venue. As long as none of the other details change (gig start/end time, for example) then having an “extra dates” custom field might be useful.
Similarly, if Take That are touring and have sold out a particular venue, they might add an extra night so fans who missed the first lot can still see them. Again, as long as the rest of the details don’t change you can get away with scheduling an “extra date” or two.
Of course in both the above scenarios, if some detail of the event (other than the date) changes you’d have to create a brand new event, and there’s no way round that.
At the expense of yet another custom field, I think this is possible. Thanks for finally getting though to my thick head, I’ll see what I can do.
Last edited by Bloke (2009-01-08 11:35:27)
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
#22 2009-01-08 14:34:14
- FireFusion
- Member
- Registered: 2005-05-10
- Posts: 698
Re: smd_calendar: complete schedule / event / calendar / diary
Awesome. Thanks bloke!
Offline
#23 2009-01-08 14:47:58
- Niconemo
- Member
- From: Rhône-Alpes, France
- Registered: 2005-04-18
- Posts: 557
Re: smd_calendar: complete schedule / event / calendar / diary
It’s seems i’ll have a few sites event section to be redone with that brand new plugin :D
Nico
Offline
#24 2009-01-08 14:56:12
- FireFusion
- Member
- Registered: 2005-05-10
- Posts: 698
Re: smd_calendar: complete schedule / event / calendar / diary
Guess zem_event is out and this is in :)
Offline
#25 2009-01-09 04:18:44
- rsilletti
- Moderator
- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: smd_calendar: complete schedule / event / calendar / diary
Does the author attribute filter by login or Real name? I’m getting my login to work but Real name will not and the help documentation calls for Real name. This is rough, but it should work.
<txp:ras_author_list wraptag="ul" break="li" label="Events by Author" labeltag="h3">
<txp:if_author name='<txp:ras_user />'>» </txp:if_author>
<txp:ras_author link="1" this_section="1" />
<txp:if_author name='<txp:ras_user />'>
<txp:smd_calendar size="large" stepfield="custom_1" omitfield="custom_2" section="events" author='<txp:ras_author />' />
</txp:if_author>
</txp:ras_author_list>
Offline
#26 2009-01-09 09:46:53
- Bloke
- Developer
- From: Leeds, UK
- Registered: 2006-01-29
- Posts: 9,995
- Website
Re: smd_calendar: complete schedule / event / calendar / diary
rsilletti wrote:
Does the author attribute filter by login or Real name? I’m getting my login to work but Real name will not and the help documentation calls for Real name. This is rough, but it should work.
Thanks for the code/pointer Rick. There is actually an inconsistency between the code & documentation, which I’ll fix/make clearer. smd_calendar’s author
attribute expects a login name because that is down to you hard-coding it in the page/form and it’s the same as the author
in <txp:article />
and <txp:article_custom />
.
Conversely, when you are filtering by author using ?author=
, for some reason TXP throws an error if you give it a login name; it seems mandatory for it to be the html-encoded Real Name (shame it can’t be either, or allow an ?authorid=
param).
Hopefully in the upcoming smd_calendar v0.4 it’ll matter less, because you’ll be able to choose what you display from smd_cal_info: Slightly confusingly, author
will be the real name (as it is now) but authorid
will display the login. I’m revamping <txp:smd_cal_info />
to be able to get at all $pretext
and $thisarticle
variables if you wish but I’m intercepting the special ‘author’ case and translating it to the real name. I’ll make ‘realname’ a synonym to ease the burden of remembering which is which and, for convenience I’ll also add a realname
attribute to smd_calendar/smd_article_event. Though it will require an extra query.
What’s slightly confusing is that, in <txp:article_custom />
for instance, the author
attribute expects a login name. Internally, that is compared against the AuthorID column. Thus when it’s sent to $pretext/$thisarticle, the author’s ID is known as authorid
, author
and id_author
. Even if you filter by ?author=Stef+Dawson
it’s converted to the ID and that is all you ‘see’ from the code. So to display the real name on the calendar involves another database call. It would be nice if $thisarticle held the real name too.
Anyway, in v0.4 I’ve also improved the URL rewriting so the section is determined properly by the permlink mode in force. Thus, no more annoying ?s=
unless you want it (I hope). And I’m trying to wrestle in the extra dates that Firefusion requested. Trouble is, I’ve only got 9kB left before the plugin is too big so I’ll need to do some optimisation too I think…
Last edited by Bloke (2009-01-09 09:48:53)
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
#27 2009-01-09 09:53:50
- FireFusion
- Member
- Registered: 2005-05-10
- Posts: 698
Re: smd_calendar: complete schedule / event / calendar / diary
Bloke wrote:
Anyway, in v0.4 I’ve also improved the URL rewriting so the section is determined properly by the permlink mode in force. Thus, no more annoying
?s=
unless you want it (I hope). And I’m trying to wrestle in the extra dates that Firefusion requested. Trouble is, I’ve only got 9kB left before the plugin is too big so I’ll need to do some optimisation too I think…
Optimisation sounds good but you could also make the documentation just a link to your site.
Offline
#28 2009-01-09 10:09:08
- Bloke
- Developer
- From: Leeds, UK
- Registered: 2006-01-29
- Posts: 9,995
- Website
Re: smd_calendar: complete schedule / event / calendar / diary
FireFusion wrote:
Optimisation sounds good but you could also make the documentation just a link to your site.
The docs and code have independent size limits, I’m afraid.
Mind you, the docs are nearly full too… aaargh! And I’ve tried the ‘docs link to site’ thing but it’s not as friendly I’ve found. Especially if my site goes down for whatever reason. Optimisation is the only way I think… *sigh* time to remove all comments and make all my variables one letter long :-D
(joke: I’d never be able to manage if that were the case)
Last edited by Bloke (2009-01-09 10:09:39)
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
#29 2009-01-09 10:56:51
- Bloke
- Developer
- From: Leeds, UK
- Registered: 2006-01-29
- Posts: 9,995
- Website
Re: smd_calendar: complete schedule / event / calendar / diary
Question for FireFusion (or anyone really):
I’ve added an xtrafield
attribute but I want to know how it should behave when an expiry is set. If you add a date that is beyond the expiry of the article, the extra event should be:
- ignored
- added to the calendar regardless
For example:
- Weekly event beginning 9th Jan 2009
- Expires on the 24th April 2009
- The event on the 17th April 2009 has to be cancelled, so its date is added to
skipfield
- It is rescheduled for 8th May 2009 by adding
May-8-2009
in thextrafield
Under method 1, it would not be rendered unless you extended the expiry date (and probably added May-1-2009 to skipfield
as well)
Under method 2, it would be rendered, thus ignoring the expiry of the event
Which do you see as most beneficial? I’m favouring option 2. Or should it be a switch in the plugin? Like xtrastrict
= 0 (allow events beyond expiry) or 1 (stop them from being displayed after expiry). And what should be the default value if so; 0 or 1?
Thoughts?
EDIT: And what if an extra event is scheduled (by mistake, perhaps) on a day that’s already part of a spanned event? e.g. your event runs every day for the month of January and you add an extra date on 25th Jan. Should it add the event (i.e. show it twice?) or ignore it unless it’s been cancelled/omitted for some reason?
Last edited by Bloke (2009-01-09 11:17:08)
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
#30 2009-01-09 12:46:55
- FireFusion
- Member
- Registered: 2005-05-10
- Posts: 698
Re: smd_calendar: complete schedule / event / calendar / diary
Option 2 also I think :)
For the other question; if you can’t change the time or other details shouldn’t it just show once anyway?
Offline