Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#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 />'>&raquo; </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: 10,481
Website GitHub

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: 10,481
Website GitHub

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: 10,481
Website GitHub

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:

  1. ignored
  2. 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 the xtrafield

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

#31 2009-01-09 12:54:17

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,481
Website GitHub

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

FireFusion wrote:

Option 2 also I think :)

Cool.

For the other question; if you can’t change the time or other details shouldn’t it just show once anyway?

Yes, it should but as far as the code is concerned it is 2 events: once “spanned” multi event and an “extra” event (that happens to be the same date and time) on the same day. I can probably find a way to remove it, I just wanted to know if anyone thought it was of any use to have two events of different types show up on one day, before I go ahead and work out how to stop it happening!


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

#32 2009-01-10 01:11:07

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

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

Bloke wrote:

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).

I would suspect after dealing with all of that writing author_list that the caveat may have to do with displaying logins as a part of the url, the handling of real name and user name could have been handled in a more straight forward fashion like category’s name and title handling otherwise.

With a little tweeking I’ve got a set of tags working that will show an event calender in its own section that will filter by author from a sidebar list of authors, which is what I was looking for actually. I haven’t had time to test completely yet, but I’m guessing that transiting back and forth thru time won’t affect filtering once it is accomplished. It requires an updated version of ras_author_list (4.0.8.dev) or hardcoded urls, hopefully future updates won’t break this option. The tags are simple and basic and go this way:

<txp:ras_author_list wraptag="ul" break="li" this_section="1" />
<txp:smd_calendar size="large" section="events" author='<txp:ras_user />' />

Last edited by rsilletti (2009-01-10 03:00:46)

Offline

#33 2009-01-20 17:38:29

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

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

I’ve got a quick example up here and I’m wondering if there are any styles that have been written that anyone might be willing to share. I’m using the site primarily to test RC2 4.0.8 and a variety of other ideas, mostly for fun, and the task of styling the large event calendar feels a bit to me like trying to hug a fully inflated spiny puffer fish – CSS not being my strength.
Also, and I haven’t tested this completely to ensure it isn’t actually working the way it should, this should filter linked events in the calendar itself by category on the default page as returned with a category search – correct?

<txp:smd_calender size="small" category='<txp:category />' />

Last edited by rsilletti (2009-01-20 17:39:42)

Offline

#34 2009-01-20 20:28:36

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,481
Website GitHub

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

rsilletti wrote:

this should filter linked events in the calendar itself by category on the default page as returned with a category search… <txp:smd_calender size="small" category='<txp:category />' />

Yep, in theory. I’ve not actually tried it on a small calendar — I don’t have one to hand right now — but it certainly works on the large one because I’ve just tried it.

It used to (in v0.2x) do that by default without you having to specify the category, as I’d hard-coded $pretext['c'] in the category attribute, but I removed it in v0.3 for reasons best known to myself; reasons now lost in the haze of Christmas. If you think it would be beneficial to re-instate this auto-category (I also had auto-author and auto-section as well) then let me know and I’ll put it back in v0.4.

The only drawback (I think, but if anyone can find any more then please let me know) is that if you specifically don’t want to filter by category you must add category="" to your calendar tag. This is kind of negative logic in the sense that I prefer the modus operandi “if you need it, ask for it” rather than “if you don’t need it, turn it off”. But if the majority of people think it’s cool to be able to auto-filter by the current section, current category and current author then I’ll certainly put it back in to save you having to type as many attributes!

Let me know what your thoughts are. v0.4 is ready to go, so whatever you all choose will be put in this version.

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


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

#35 2009-01-20 21:42:16

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

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

Yes, it does filter, what fooled me was that one article was posted to a “don’t show on front page section” which was linked in the calendar, but no shown in the article list. Not sure how I feel about that yet?
I’m definitely of the “I’ll explicitly ask for it if I want it” school of thought for categories and sections.

Example , the second article is assigned to the about section “about not on front page”, I guess you could organize your category assignments to avoid that though.

Offline

#36 2009-01-20 21:55:51

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,481
Website GitHub

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

rsilletti wrote:

Yes, it does filter, what fooled me was that one article was posted to a “don’t show on front page section” which was linked in the calendar, but no shown in the article list. Not sure how I feel about that yet?

Ah, right, ok. I can (probably should) take the “don’t show on front page” into account. I’d forgotten about it (mainly becasue I never put a calendar on the front page; it was always in a section). Good call, thanks, will see what I can do.

Last edited by Bloke (2009-01-20 21:56:43)


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