Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#649 2011-03-29 11:07:32

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

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

Algaris wrote:

is it possible using CSS to style the currently selected/viewed date in the calendar.

Yes but it needs more than CSS because you need to flag it up with a class, which requires a little bit of cunning. Assuming you’re using cellform to build your cells (although you can do this in your smd_calendar container if not) the general principle is:

  1. read the day/month/year from the URL. I believe you already have these in txp:variables, courtesy of the wonderful adi_gps
  2. in your cellform / container use <txp:smd_if_cal> to check if the day/month/year match the ones in the URL

So, in code terms:

<txp:smd_if_cal logic="and"
     day='<txp:variable name="the_day" />'
     week='<txp:variable name="the_week" />'
     year='<txp:variable name="the_year" />'>
   <txp:smd_cal_class name="selected_day" />
</txp:smd_if_cal>

Just substitute your txp:variable names in. That should then allow you to style the selected_day class differently.

Last edited by Bloke (2011-03-29 11:08: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

#650 2011-03-29 11:30:41

Algaris
Member
From: England
Registered: 2006-01-27
Posts: 553

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

Thank you!!

Offline

#651 2011-04-08 20:56:04

progre55
Member
Registered: 2006-05-02
Posts: 668

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

Bloke:

Sorry for the delay in getting back to you, but I am still having difficulty with my issue of the calendar not remaining in the same position when moving the calendar between pages. (Calendar occupies left hand column and article occupies the right hand column)

I now better understand what you said that the calendar will look to the url and I was going to go down that path when I ran across a niggle. Some of my events span a couple of months.

Currently, the calendar defaults to the current month (April). When I go to May and select an event in May, it brings up that event but defaults the calendar back to the current month. I am uncertain how I can append to the end of the article as an example (?m=5&y=2011) so that the calendar will recognize and hold the month since I am uncertain what it would draw from in terms of the data in the article.

Sorry for the bit long and confusing description.

Thanks.

progre55

Offline

#652 2011-04-10 00:22:33

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

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

Hi Stef, some more food for thought ;)

1. After updating the plugin to v0.50, the row with the day names moved to the top (above the navigation row). I understand that this is because of the <thead> that was added to this row, but I can’t figure out how to move it back. Or is this the way a proper calendar is supposed to look?

2. Just an observation, don’t know if it’s something you want or need to know: when I added a second calendar to the page, I noticed the days were displayed in the wrong place. It was showing Tuesday where it should be Monday, and so on. So when I saw that today was Monday instead of Sunday that really startled me ;) I had this in the smd_calendar tag for both calendars:

   maintain="section,article"

When I changed this to

   maintain="section,article,m2,y2"
   remap="m:m1, y:y1"

for the first calendar, and to

   maintain="section,article,m1,y1"
   remap="m:m2, y:y2"

for the second, the days suddenly jumped back to where they belonged :)

The calendars are here, working perfectly with MLP.

Last edited by els (2011-04-10 00:25:35)

Offline

#653 2011-04-11 13:47:29

woof
Member
Registered: 2004-08-01
Posts: 128

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

Hi Stef

I’ve installed v0.50 and am seeing a problem with spanned events and the smd_article_event tag

I have a spanned event starting on April 28 expiring on April 30. This displays fine on the smd_calendar output but shows up as 4 days (April 28 – May 1) on smd_article_event output. (For what its worth: tweaking the expiry time doesn’t seem to affect anything)

If you need any further info or access to my install just let me know. Cheers

Offline

#654 2011-04-11 14:35:31

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

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

progre55

Sounds like you’re almost there. You don’t need to draw the info from the article itself, but you do need to use the built-in smd_calendar tags to add the new bits. For example (untested) :

<txp:smd_calendar options...>
<a href="<txp:permlink /><txp:smd_cal_info type="month,year" html="1" />"><txp:title /></a>
</txp:smd_calendar>

That would add ?m=<event month>&y=<event year> to your anchors so that when you visit the URL your calendar will jump to the month containing that event. If you want to maintain the currently viewed month that’s a little more involved and will probably require a cellform.

Els

Thanks for the reports. I didn’t think I’d switched those two rows round but anything’s possible! Sorry, erm, I know I added the ability to create your own header (headerform attribute) but I’m not sure how customisable it is. You could have a play with that attribute and see what you can make it do. I’ll look into this one and try to make it better.

Regarding the days switching over on the second calendar, that is weird. I suppose if they were displaying different months then it might get confused if the days of the week changed from month to month, but I’d have thought that’s pretty unlikely as calendars tend to always begin on the same day and the dates just shift around to fit the days. Quite why you had to jump through those hoops just to get the days to display correctly is a mystery right now. If I can replicate your setup I’ll see if I can figure out what’s going on. Of course if you wanted the calendars to function independently then fudging the maintain/remap attributes like you did would be the only way to do it.

woof

Can you post your smd_article_event / smd_calendar tag code please? Plus any tidbits of info that’ll allow me to duplicate your setup on my server (which CFs you use for what, an example article with posted/expiry dates/times, etc). I made an event on my server and viewed them in both places and they showed up fine, so I guess I missed a pesky timezone line in the code somewhere. Drat. If you don’t mind, perhaps a login to your server would be beneficial here so I can test things directly on your machine once I track down the cause. Many thanks.


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

#655 2011-04-11 14:59:06

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

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

Hi Stef,

Thanks for the latest version of this indispensable plug-in, I’m looking forward to delving into the new features.

For what it’s worth though I’m having the same problem as Els when I upgraded to V5.0, the days (smd_cal_daynames) have moved above the month + navigation (smd_cal_navrow).

Last edited by decoderltd (2011-04-11 15:00:00)

Offline

#656 2011-04-11 15:13:05

woof
Member
Registered: 2004-08-01
Posts: 128

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

Thanks Stef, here is the tag code for article_event – I’ve simplified the form part for clarity (+ tested this simple version and it still shows error on my server)

<txp:smd_article_event 
allspanned="1" omitfield="custom_26" extrafield="custom_27" skipfield="custom_30" section="events" limit="50" >
<p><txp:posted format="%a, %d %h %Y" /> <txp:title/></p>
</txp:smd_article_event>

I will send you a screengrab of the article edit page and details of install

Offline

#657 2011-04-11 22:26:41

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

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

Bloke wrote:

I didn’t think I’d switched those two rows round but anything’s possible!

No, you didn’t switch them, they are just displayed in a different order. Never mind, I assume it’s a semantic/css issue, I’ll try and figure it out when I have the time. I can live with this for a while ;)

Regarding the days switching over on the second calendar, that is weird.

It happened on both calendars, actually. Sorry if I wasn’t clear.

Of course if you wanted the calendars to function independently then fudging the maintain/remap attributes like you did would be the only way to do it.

I didn’t really need the independent functioning, I only added the remap attribute later to see if I liked that better. Now that it turned out to solve the problem, I don’t mind keeping it this way.
So please don’t spend any time on it for my sake, but should you ever want to dive into it, I’ll be happy to give you the exact code I used.

Thanks for your reply!

Offline

#658 2011-04-12 13:27:53

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

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

Els wrote:

No, you didn’t switch them, they are just displayed in a different order.

Actually, I did, d’oh! I added a <thead> around only the day names not around both the day names and the nav header. Thus the source code contains:

<tbody>month nav</tbody>
<thead>day names</thead>
<tbody>calendar cells</tbody>

The browser realises this is invalid XHTML and does what it is supposed to do: pulls the <thead> to the top. I’ve fixed it in v0.51 by wrapping the thead around both rows, thanks for spotting it.

I’m still trying to track down / replicate your multi-calendar thing. I’ve just spotted some weirdness in my duplicate calendar setup which might be a bug or might just be me being stupid. I’ll chase that one down. EDIT: it was the latter. Would you mind furnishing me with your exact smd_calendar tags please, and any supporting info like the CFs you’re using, example article posted/expires/CF usage, stuff like that? If it’d clog up the forum, drop me a mail. Thanks!

woof

I’ve found a bug in the allspanned code for smd_article_event, BUT the interesting thing here is that the bug looks like it should have manifested itself in the previous plugin version too. So quite why it’s only surfaced now is a mystery. It behaves as you describe on my (GMT) installation as well so it’s not a timezone issue, as such. I’ve put a tentative fix in that works on my box; I’ll push this version out to your server (thanks for the login details, btw) and check it works before I’m happy it’s the right thing to do.

Last edited by Bloke (2011-04-12 13:34:00)


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

#659 2011-04-12 13:41:25

woof
Member
Registered: 2004-08-01
Posts: 128

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

Bloke wrote:

BUT the interesting thing here is that the bug looks like it should have manifested itself in the previous plugin version too.

I had actually noticed it then but on reading this thread and learning of the imminent release of a new version I guessed it might have been one of the existing known issues.

Thanks so much for your help Stef — you’re a gentleman!

Offline

#660 2011-04-12 13:48:12

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

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

woof wrote:

I guessed it might have been one of the existing known issues.

Sadly no, it slipped through the net. You’re the only person I know of using allspanned, and my testing was mostly focused on the timezone stuff. Note to self: test harder.


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