Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#193 2009-03-13 15:42:30

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

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

Thanks Bloke!

Offline

#194 2009-03-13 18:46:49

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

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

Wondering why you should thank people who cause you headaches… ;) Thank you Stef! :)

Offline

#195 2009-03-13 19:12:03

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

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

Stef;

If I have not said it before, you are awsome and I personally believe that you are a driving factor on why TXP is wheer it is today …

Offline

#196 2009-03-13 19:26:55

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

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

Aww shucks, thanks for all the thanks everyone :-) Just doing my bit.

I think this version should help out quite a few people. I’d be especially interested to hear if using datefields to specify start and end dates solves the DST / time zone conundrum. Since the values in your nominated custom field(s) are simply just seen as text to TXP, it has no notion of its ‘data type’ and therefore cannot apply any automatic correction to it.

Thus (I hope) that a start date of 30-Jul-2009 14:00:00 remains that way no matter what your server / country / TXP claims the real time is — both at the time a visitor views your site, and from your article’s perspective. Whether that’s a good thing or not remains to be seen. If anything. it’s not a true solution. But if it’s a workaround at least it’s something to work with / refine.

Last edited by Bloke (2009-03-13 19:27:58)


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

#197 2009-03-15 00:33:44

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

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

Grmpff, looks like I have to start working on the calendar on my site because of missing long lasting British developer resistence. Thanks for that extra work still to do dear Stef!

Did we talk about fully featured iCal subscriptions and iCal offerings yet :-)


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#198 2009-03-15 11:15:28

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

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

merz1 wrote:

Did we talk about fully featured iCal subscriptions and iCal offerings yet :-)

Kind of. It works one way at least. Syncing a TXP calendar to other people’s iCals — which I don’t think is possible in a useful manner, though I haven’t looked into the feasibility yet, and know nothing about the iCal spec — would have to wait until the increased plugin size limit becomes mainstream. I’m fresh out of space.

But during my cursory think-through, I’m of the opinion it shoud be a companion plugin because I don’t think I’m clever enough to implement it. Unless I’m mistaken (wouldn’t be the first time!), it would have to read an iCal XML document and create articles based on the content, right? That is, some kind of ‘import’ functionality, yes? It would have to offer a shedload of configuration options to deal with the following situations (and more — these are off the top of my head) :

1) How you want the start and end times imported (into your own datefields or the TXP date fields)
2) How to deal with invalid dates (if present — might not need to worry if the iCal spec performs error checking already)
3) How to deal with duplicate URL titles
4) More specifically, how to work out the frequency if an event occurs more than once in the XML document. e.g. if the importer code saw:

SUMMARY:event1 DTSTART=15-03-2009 21:00:00 DTEND=15-03-2009 22:00:00
SUMMARY:event1 DTSTART=22-03-2009 21:00:00 DTEND=22-03-2009 22:00:00
SUMMARY:event1 DTSTART=29-03-2009 21:00:00 DTEND=29-03-2009 22:00:00
...

it assumes (rightly? wrongly?) it is the same event because the title is the same, but how does it know to set the frequency field to 1 week? And what if there’s one date that’s ‘off’ by a day or two and needs to be manually added? Do you tell the importer to put ‘weird’ dates in a particuar custom field (your extrafield)? How do you define ‘weird’ programmatically? :-s

So currently — and I know it seems that every time you come up with some idea I shoot it down, it’s not personal! — unless someone can show me otherwise, I’d like to brush this feature request under the carpet and forget it exists :-) Maybe you can convince me otherwise or convince someone better at coding than I am to tackle it, because it looks like a whole heap of work to me that I have neither the energy to write, nor a Mac to test.

Last edited by Bloke (2009-03-15 11:16:19)


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

#199 2009-03-16 11:50:43

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

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

Hi Stef,

Thanks again for the great plug-in.

I’ve just uploaded the new version of the plug-in and I’m getting a completely blank site with the following error –
Fatal error: Call to undefined function smd_expand_daterange() in /var/www/vhosts/enfieldbeekeepers.org.uk/httpdocs/textpattern/lib/txplib_misc.php(570) : eval()'d code on line 1666

Not sure if I’ve created the error somewhere along the way.

Offline

#200 2009-03-16 12:05:34

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

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

decoderltd wrote:

@Fatal error: Call to undefined function smd_expand_daterange()

Yowzers. I was running perilously close to the (current) maximum size of a plugin and developing in the newer SVN environment with the lifted size restriction. I thought it was just fine, but could you please make sure that the plugin has not been cut short by accident. Check the source code. It should end with:

...
	} else {
		$out[] = strftime($fmt, strtotime($rng[0]));
	}
	return $out;
}

EDIT: and did you install the compressed plugin?

Last edited by Bloke (2009-03-16 12:06: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

#201 2009-03-16 12:15:39

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

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

Hi Stef,

Thank you for your prompt reply. It is indeed a case of the code being truncated, I’ve tried both compressed (zip) and uncompressed version. but neither shows the full code. Zipped ends at ...lg4cPv/wy/uLrvWTy8Kuv9r9+OOkcfvh/Abj6Z9o/AwIA, uncompressed at ...ZjU4ZDc3YjFkOTVhMjczNTU3N2E0OTBlZDU4ODI5NWQiO30= – not sure if that helps you!

Offline

#202 2009-03-16 12:20:08

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

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

decoderltd wrote:

Thank you for your prompt reply. It is indeed a case of the code being truncated

So whereabouts does the code end in the Edit Plugin code window? What are the last 4 or 5 lines of actual PHP code you see (just so I can get a handle on where it might be).

Zipped ends at ...lg4cPv/wy/uLrvWTy8Kuv9r9+OOkcfvh/Abj6Z9o/AwIA, uncompressed at ...ZjU4ZDc3YjFkOTVhMjczNTU3N2E0OTBlZDU4ODI5NWQiO30= – not sure if that helps you!

Weird, same on mine and it installs fine. Hmmmm.

EDIT: shite, no it doesn’t. Pants. Juts tried it on 4.0.7 and it gets cut off at

	return (!in_array(0, $show)) ? true : false;
}

// Convert date ranges like 24-Oct-08 => 5-Nov-08 to an 

urk!

EDIT2: crapola. It’s because of the line endings. With UNIX line endings (\n) it’s fine but when exported, the plugin composer (or plugin importer) converts it to DOS line endings (\r\n), which takes it over the size limit. Nuts. Gotta go and think this through.

Last edited by Bloke (2009-03-16 12:51:12)


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

#203 2009-03-16 12:27:57

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

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

Hi Stef,

The last lines of the plug-in code are:

// Check the passed timestamp against every time restriction and return true if it passes them all function smd_include_event($ts, $now, $ign, $time, $from, $to, $month) {
$show = array();
$show[] = !in_array(date("d-M-Y", $ts), $ign);
switch($time) {
case "any": break;
case "future": $show[] = ($ts > $now) ? true : false; break;
default : $show[] = ($ts < $now) ? true : false; break; // The past }
if ($from) { $show[] = ($ts >= strtotime($from)) ? true : false; }
if ($to) { $show[] = ($ts <= strtotime($to)) ? true : false; }
if ($month) { $show[] = (date("Y-m", $ts) == $month) ? true : false; }

return (!in_array(0, $show)) ? true : false; }

// Convert date ranges like 24-Oct-08 => 5-Nov-08 to an

Last edited by decoderltd (2009-03-16 12:29:43)

Offline

#204 2009-03-16 12:37:26

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

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

Yep, same as me.

OK, interim solution until I can recompile the plugin tonight and/or figure out why DOS line endings are being put on the file. Download the code without any comments in it and paste it over the banjaxed code in the Edit Plugin window.

Apologies for that. I thought it fit fine. That’ll teach me to not actually test it.

Last edited by Bloke (2009-03-16 12:38:19)


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