Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#805 2012-06-08 05:10:44

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 859
Website

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

I’ve got a really strange problem with smd_calendar…. having never used it before, its pretty confusing :)

This is my tag

<txp:smd_calendar size="small" dayformat="{Su,Mo,Tu,We,Th,Fr,Sa}" />

But when this is output – every day is a link and every date is “?date=2012-04-24” – so all the links are the same.

Yet when I install on another site, its only the days where articles have been posted which are links, and they are links to the correct dates.

I know that I need to set this up with a start date and expire date…. but how come every link is the same date?

Offline

#806 2012-06-12 01:29:22

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 859
Website

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

OK – now I’m getting somewhere…. this is something to do with article expiry date

Offline

#807 2012-06-22 15:36:28

Angelic Relic
New Member
From: Willits, California
Registered: 2012-01-01
Posts: 6
Website

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

Ok I am just a little overwhelmed and can not find an answer.
I need the start date to not be the posted date . . . . and I am not realy sure just where to begin
read and read and got myself more confused.

easy enough to set up a custom field but not sure how to use it to make the small calendar
post an event start date

if i set the posted date to the start date of the event then the article is not viewable till that date

aargh!!

Offline

#808 2012-06-30 23:26:11

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

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

What’s the best way of handling arbitrary dates? Is it possible just feed smd_cal a list of timestamps? I’m doing a theatre site and I was thinking I would provide a date/time picker and a custom field.

Still trying to wrap my mind around handling dates AND times AND multiple events with a datepicker, best candidate is this picker width some mechanism to let me inject more than one date into the field kinda like jmd_image_select and use a delimiter.

I’m going to have to support easy entry of date/times like this bad boy…

  • Friday August 3rd at 7:30 pm
  • Saturday August 4th at 7:30 pm
  • Friday August 10th at 7:30 pm
  • Saturday August 11th at 2:00 pm
  • Sunday August 12th at 7:30 pm
  • Wednesday August 15th at 7:30 pm
  • Friday August 17th at 7:30 pm
  • Saturday August 18th at 2:00 pm
  • Sunday August 19th at 7:30 pm
  • Tuesday August 21st at 7:30 pm
  • Thursday August 23rd at 7:30 pm
  • Saturday August 25th at 7:30 pm
  • Sunday August 26th at 2:00 pm

Anyone else done a venue that requires multiple dates. Any thoughts, appreciated?

Offline

#809 2012-07-01 21:45:51

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

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

mrdale wrote:

Anyone else done a venue that requires multiple dates. Any thoughts, appreciated?

If you can track him down, istr woof wrote a theatre type site and it was for him that I added the extra, omit and datefields features.

Since the performance of the show is generally the same duration, my initial thought was to use:

  • Txp Posted date = start of performance (e.g. 2012-08-03 19:30:00).
  • Txp Expires date = end of performance (e.g. 2012-08-03 23:00:00).
  • Use combinations of stepfield, extrafield and/or omitfield to program repeat performances. You can use date ranges in the latter two, e.g. 2012-08-04, 2012-08-10 => 2012-08-12.

The sticking points are the fact that the times change without any real pattern to them (some Saturday afternoons, some Sunday), and you need some way to input the data visually.

Whichever way you slice it, the UX is horrible. I mean, even if you completely ignore smd_calendar and custom fields for a moment, what would the ideal workflow be for users?

  1. Put in performance #1 details, including start/end times of the show
  2. Click ‘add date’ which pops up a calendar, defaulting to, I dunno, next day at the same time
  3. Adjust date and time accordingly.
  4. Cilck OK.
  5. Repeat from step 2
  6. Save

Seems clunky to me. Or:

  1. Put in performance #1 details, including start/end times of the show
  2. Set show running end point (e.g. 3 months, or 2 years hence)
  3. Remove dates on which the show doesn’t run by punching holes in the show’s running block.
  4. Manually alter the times for the matinee performances that don’t start at the same time as the original.

Or maybe a variant is that you hard-code start times as radio choices like ‘evening’ (19:30) or ‘matinee’ (14:00) so that you can bypass the time input entirely and focus on the dates + a radio choice.

When you roll this into Txp it becomes more fun, but if you can crack the desired workflow, the rest just becomes code. A possible solution to one of the above scenarios might be to hook some jQuery into a nominated custom field — perhaps a glz_cf callback thingamyjib — so you can click a ‘+’ to add a date. Each click would add an input box and radio ‘time’ selector below the ‘extra dates’ CF, so the dates could be input. You could actually hide the real extrafield CF with bot_wtc. Upon save you would amalgamate all the dates and times and inject them into the officially designated extrafield, which would probably have to be a textarea because you’d quickly soak up 255 chars.

You can either leave the extrafield box visible for manual editing, or ‘read’ it after each save to repopulate the jQuery input boxes below so each is editable. You could also do with the page showing a visual representation of the schedule on the admin side. an smd_calendar tag ought to be able to do that. In fact, this whole charade might be better as a custom built smd_tabber tab because you can mix <txp:smd_calendar> tags in that along with some mem_form or smd_query goodness to insert/update the article and CF data.

Hey, I didn’t say it’d be easy. But it’s only code ;-)

Last edited by Bloke (2012-07-01 21:48: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

#810 2012-07-01 22:22:37

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

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

Thanks big time, Bloke,

Let’s just say…

  • I don’t care about end times.
  • I’m going to use the timestamp fields (posted= first show / expires = last show)
  • I’ll use a designated custom field for extra fields…

So the only real trick is UX and getting the expiration to work as a repeated event and not the end of a span.

I think I’m ok with the customer visually entering values one at a time. like so…

  1. Click in field
  2. Up pops a date/time picker
  3. person selects date and time
  4. Closes picker
  5. field is populated
  6. Opens picker
  7. selects another date and time
  8. closes picker
  9. this time the field needs to recognize that a value is being added, add a delimiter and not destroy the existing value.
  10. repeat from step 6

This workflow would work. The second to last step is a doozie tho.

Offline

#811 2012-07-02 05:11:53

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 521

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

Just a quick hands up of mine:

I’m using the date and extrafields at several installations of education and community sites and they are essential for me.

And so: multiple dates are important for me.

Best regards
Michael

Offline

#812 2012-07-02 11:50:27

joebaich
Member
From: DC Metro Area and elsewhere
Registered: 2006-09-24
Posts: 507
Website

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

mrdale wrote:

So the only real trick is UX and getting the expiration to work as a repeated event and not the end of a span.

I think I’m ok with the customer visually entering values one at a time. like so…

  1. Click in field
  2. Up pops a date/time picker
  3. person selects date and time
  4. Closes picker
  5. field is populated
  6. Opens picker
  7. selects another date and time
  8. closes picker
  9. this time the field needs to recognize that a value is being added, add a delimiter and not destroy the existing value.
  10. repeat from step 6

This workflow would work. The second to last step is a doozie tho.

How about starting with one date/time picker field plus supporting fields and then, on completion, give the option to open a new set of date/time picker field plus … and on and on until you’re done? Something like this: jQuery – Dynamically Adding Form Elements. Demo of concept at http://charlie.griefer.com/blog/jquery-dynamically-adding-form-elements/

I bet there is a way to do much the same thing with txp:etc_query as this approach is about adding elements to the DOM but I don’t know much about XPath at all.

Last edited by joebaich (2012-07-02 12:01:31)

Offline

#813 2012-07-09 08:21:47

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 859
Website

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

I’m having a few problems getting this awesome beast to behave properly.

I am looking to use a small calendar in a side bar which, when each day is clicked, links to a section and displays the events from that day only – for movie days/times at a cinema. At the moment I am just getting a full list from the current month.

I have specified the start & end date are custom fields. The articles may be input into txp many weeks before they are displayed.

This is my actual calendar code

<txp:smd_calendar section="movies" size="small" dayformat="{Su,Mo,Tu,We,Th,Fr,Sa}" datefields="custom_7,custom_8" section="movies" expired="0" />

This is my code on the page for section “movies”:

<txp:smd_article_event section="movies" datefields="custom_7,custom_8" wraptag="ul" limit="30" expired="0"  form="movies_programme" sort="custom_7 asc" class="program_listings" allspanned="0" />

The 3 main problems I am having are:

  1. Calendar urls The links from the Calendar are random for example the link on 8th July is actually ?date=2012-05-28&s=movies which doesn’t seem to be found in any of my Posted, Expired or custom_7 & custom_8 fields. The link of the 12th July is fine ?date=2012-07-12&s=movies, but the link on the 13th July goes back by a month ?date=2012-06-01&s=movies. If I add linkposted="recur" to my txp:smd_calendar this is fixed (not sure why) but I still have the problem below.
  2. Calendar filtering – no matter which day I click, the list of events is always the same. The start & end dates seem to working in txp:smd_calendar links on the calendar as only the desired days are links. Some events do overlap, but for example if I click on July 30th, I still it lists all the events which have gone past their end date – but uses the correct month :)

I feel the time filter is something I thought I could possibly use, it filtered out old events, but still listed the rest of the events from the month…. but the other options…. time=“today” looked promising, but each link showed 1 event, the same event all month :(

I added debug=“1” and this is the output:

select unix_timestamp(Posted) AS uPosted from textpattern where  Status IN (4) AND Section IN ('movies')  ORDER BY Posted ASC LIMIT 0, 1
select unix_timestamp(Posted) AS uPosted from textpattern where  Status IN (4) AND Section IN ('movies')  ORDER BY Posted DESC LIMIT 0, 1
select unix_timestamp(LastMod) AS uLastMod from textpattern where  Status IN (4) AND Section IN ('movies')  ORDER BY LastMod DESC LIMIT 0, 1
++ THIS MONTH'S CALENDAR [ start stamp // end date // end stamp // end date // tz offset (end) ] ++
1341064800
2012-07-01 00:00:00
1343743199
2012-07-31 23:59:59
1343775599
select *, unix_timestamp(Posted) as uPosted, unix_timestamp(LastMod) as uLastMod, unix_timestamp(Expires) as uExpires from textpattern where  Status IN (4) HAVING UNIX_TIMESTAMP(custom_7) <= 1343775599 AND (now() <= Expires OR Expires = '0000-00-00 00:00:00') AND Section IN ('movies')  ORDER BY Posted ASC
++ THIS MONTH'S RENDERED CALENDAR [ start stamp // end date // start day // end stamp // end date // end day number ] ++
1341064800
2012-07-01 00:00:00
Sun
1343743199
2012-07-31 23:59:59
31

I feel I am either a) misunderstanding what smd_calendar can do (but I am sure I have seen this working like this) or b) missing something really, really simple

[edit] the datefields input into the database is like this 2012-07-09 – does it need to be a full time stamp? [/edit]

Last edited by tye (2012-07-09 08:29:15)

Offline

#814 2012-07-09 08:39:13

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

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

tye wrote:

I am looking to use a small calendar in a side bar which, when each day is clicked, links to a section and displays the events from that day only

Quick tip: don’t use size="small" in this case! It creates all sorts of hassles like those you found, because it uses a very simplistic date format to render links and, unless you override it with linkposted or do some clever adi_gps wrangling, will only link to the first occurrence of an event.

Instead, use a fullsize calendar and just tame it to look like a mini calendar by using the container / form / cellform to change the default behaviour. You then have complete control over destination URLs and cell contents.

The other half of the issue is in the destination page template. You’ll need some clever logic in there — possibly by using adi_gps to read in a variable that you pass from the calendar — which will use <txp:smd_article_event> to display exactly the list of events in which you are interested.

Last edited by Bloke (2012-07-09 08:40:11)


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

#815 2012-07-10 00:14:24

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 859
Website

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

Thanks Stef – I’ll let you know how I go

Offline

#816 2012-12-19 16:22:02

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

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

I’m encountering a problem with the min calendar.

I’ve entered events for 2013 and when I flip across to next year all the days that have events on them are highlighted. When I click on a date on the mini calendar the correct events are shown (along with the correct date at the top of the page) but the mini calendar changes to back to 2012. So instead of February 2013 the mini calendar now says February 2012 and highlights events in 2012.

I’m using Textpattern 4.5.2 and smd_calendar 0.52

—Edit 1—
I’ve also tried installing the 5.3 beta but get the same results.
Tried rolling back to 0.50 (which worked before) but get the same results.

I wonder If I could have broken something when I change the layout/design of the calendar. Or maybe it’s a bug that I was unaware of as I’ve always entered events for the new year In January before now.

—Edit 2—
After having a long think about this last night I came to the conclusion that the mini calendar keeps changing because I’m not passing the year in a variable like I am the day and date. So I’m off to check my code and variables to see what I can come up with.

Last edited by Algaris (2012-12-20 08:26:24)

Offline

Board footer

Powered by FluxBB