Textpattern Forum

You are not logged in. Register | Login | Help

#131 2009-02-15 02:41:46

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

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

Stef, woof The functions I spoke of I’ve incorporated into my ras_if_dates plugin. I’ll include them here directly if that’s less cumbersome. The plugin as is, is still a upgrade in progress and the help file doesn’t reflect all that is there yet.
I still have things broken out into there simplest form to trouble shoot, and trouble shoot with, and there isn’t any error checking or formatting options yet – just magnitudes. As I decide what works best as to options I’ll distill them down into one to three tags.

As follows: _m minutes round to 2 places, _h hours rounded to 2 places, _d days rounded to 2 places, no ext returns seconds. No expiration or modified settings in the articles return 0, so the math there just returns current server time.

	function ras_posted_elapsed_m()
	{

	global $thisarticle;
	assert_article();
	return round(mktime()/60 - $thisarticle['posted']/60, 2);
	}

	function ras_expired_elapsed_m()
	{
	global $thisarticle;
	assert_article();
	return round(mktime()/60 - $thisarticle['expires']/60, 2);
	}

	function ras_modified_elapsed_m()
	{
	global $thisarticle;
	assert_article();
	return round(mktime()/60 - $thisarticle['modified']/60, 2);
	}

	function ras_posted_elapsed_h()
	{

	global $thisarticle;
	assert_article();
	return round(mktime()/3600 - $thisarticle['posted']/3600, 2);
	}

	function ras_expired_elapsed_h()
	{
	global $thisarticle;
	assert_article();
	return round(mktime()/3600 - $thisarticle['expires']/3600, 2);
	}

	function ras_modified_elapsed_h()
	{
	global $thisarticle;
	assert_article();
	return round(mktime()/3600 - $thisarticle['modified']/3600, 2);
	}

	function ras_posted_elapsed_d()
	{
	global $thisarticle;
	assert_article();
	return mktime()/86400 - $thisarticle['posted']/86400 ;
	}

	function ras_expired_elapsed_d()
	{
	global $thisarticle;
	assert_article();
	return mktime()/86400 - $thisarticle['expires']/86400;
	}

	function ras_modified_elapsed_d()
	{
	global $thisarticle;
	assert_article();
	return mktime()/86400 - $thisarticle['modified']/86400;
	}
	function ras_posted_elapsed()
	{
	global $thisarticle;
	assert_article();
	return mktime() - $thisarticle['posted'] ;
	}

	function ras_expired_elapsed()
	{
	global $thisarticle;
	assert_article();
	return mktime() - $thisarticle['expires'];
	}

	function ras_modified_elapsed()
	{
	global $thisarticle;
	assert_article();
	return mktime() - $thisarticle['modified'];
	}

Offline

#132 2009-02-17 17:20:53

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

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

Bloke:

I know your tackling bigger issues, but hope either you or someone else can assist me with some small ones. Before I go any further, awsome job again (reference to smd_gallery) on developing a plug in that takes TXP to another level.

Here are my questions/issues:

  1. If I display the small version of the calendar, it looks correct, but when I try one of the event links (http://www.XXXXXXX.com/?date=2009-01-24&s=events) I get all the articles under the event section.
  2. If I display the large calendar, that looks and functions correctly. I see the title for the event and when I click it I do go to only that article in the event section. :) My question is can I hide the event name? I have a limited space and if I can’t use the small calendar and need to use the default calendar I need the name hidden and only the day active so that it looks correctly in the space.

If it helps, I am using 4.08.

progre55

Offline

#133 2009-02-17 18:55:07

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

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

The event name is a default I believe. You might try wraptags and something that will be seen by the tag as an active value that still allows you to display as you wish.

<smd_calendar>
  &nbsp;
</smd_calendar>

Offline

#134 2009-02-17 21:46:48

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

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

and another option might be to apply a style along these lines:

.calevent a {
background: url(../images/event_icon.gif) no-repeat; 
text-indent: -999em;
}

this would keep the linked event title intact (handy for SEO) but present it as an icon

Last edited by woof (2009-02-17 21:47:33)

Offline

#135 2009-02-18 13:25:21

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

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

rsilletti/woof:

Thanks for the suggestions, I am just curious on how you are able to get the mini calendar to point to a single areticle.

This is my form code:

<txp:if_individual_article>
<txp:article />
</txp:if_individual_article>
<txp:if_article_list>
<txp:article_custom section="events" form="Single" limit="9999" />
</txp:if_article_list>

Like I mentioned before, the mini calendar outputs a link that looks like this:

http://www.xxxxxx.com/?date=2009-01-24&s=events

rsilletti: I tried your suggestions with no dice.

woof: I may be implementing your suggestion wrong, but in the end at least for this use the mini calendar would be the way to go if I could just get the link to output a single calendar rather than all the events.

Thanks again for the help.

progre55

Offline

#136 2009-02-18 21:13:19

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

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

progre55 – very sorry for the confusion… I should have made it clear that I was referring to the large calendar with that styling suggestion.

I was thinking that you could achieve what you want by using the default large calendar: size="large" (styled to make it small enough to fit in a narrow div) instead of the mini one: size="small"

Here’s an example that seems to work ok for me:

The tag:

<txp:smd_calendar form="cal_S_evform" spanform="cal_S_multis" 
     stepfield="custom_11" omitfield="custom_12" skipfield="custom_13" extrafield="custom_14" 
     classprefixes="" class="smallcal" emptyclass="empty" dayformat="{S,M,T,W,T,F,S}"  monthformat="ABBR" size="large" section="calendar" firstday="1"  />   

notes:
section="calendar" is specific to my setup as are the 4 step, omit, skip, and extra field values
Using dayformat="{S,M,T,W,T,F,S}" and monthformat="ABBR" above ensures that this calendar will take up as little horizontal space as possible

Here are the two forms used by the tag above (these are are based on Example 2 in the plugin docs which use <txp:smd_if_cal> tags to apply separate styles or content to beginning, end and in-between events — although I’m not using them here I’ve kept them in case I need them later)

cal_S_evform

<span class="calevent">
<txp:smd_if_cal flag="recur">
  <txp:permlink>(RECUR)</txp:permlink>
<txp:else />
  <txp:permlink><txp:title /></txp:permlink>
<txp:smd_if_cal flag="multifirst">
     <span class="right"></span>
   </txp:smd_if_cal>
   <txp:smd_if_cal flag="recurfirst">
      <span></span>
   </txp:smd_if_cal> 
</txp:smd_if_cal>
</span>

cal_S_multis

<span class="calevent">
<txp:smd_if_cal flag="multi, multiprev"
     logic="or">
   <txp:permlink><txp:title /></txp:permlink>
</txp:smd_if_cal>
<txp:smd_if_cal flag="multilast">
  <txp:permlink title="<txp:title />">
      <span class="left"><txp:title /></span>
   </txp:permlink>
</txp:smd_if_cal>
</span>

stylesheet disclaimer – i’m a css novice :-)

table.smallcal {border-collapse:collapse;border-spacing:0; font-size:10px; width: 100%;}

table.smallcal tr {text-align: left; vertical-align: top;}
table.smallcal th, table.smallcal td {padding: 1px;border:1px solid #FFF; background-color:#6b883f; color:#fff; font-weight: bold; text-align:center;}
table.smallcal td {background-color:#ddd;color:#636F6F; height:30px;}

table.smallcal td.event{background-color:#B3C75F;color:#FFF}
table.smallcal td.event:hover{background-color:#FFF;color:#000}
table.smallcal h4 {color: #495D2B; margin:0px;}
table.smallcal .today h4 {color: #cc0000;}

table.smallcal .calevent a {background: url(../images/event_icon.png) no-repeat 3px 0; text-indent: -999em; display:block;}

icon
here’s a link to the icon I’m using http://i39.tinypic.com/sbshs1.png (the hosting service has renamed it)

All this gives you a small calendar, with hidden event titles replaced by a small icon in the table cells, which link directly to the individual calendar article as opposed to the section.

Hope this helps more than it hinders — I can’t help thinking its a bit of a convoluted work-around and there’s a simpler way to do it using the small calendar staring me in the face, I’m not sure.

Last edited by woof (2009-02-18 21:17:33)

Offline

#137 2009-02-18 21:51:08

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

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

woof:

Thank you. So far so good. I need now to play around with it abit, but thanks for the push in the right direction. I will let you know once I have things set.

progre55

Offline

#138 2009-02-19 22:22:12

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

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

Bloke/Rick/Woof/Anyone:

I have an upcoming project that I believe smd_calendar could be perfect for, but I want to see if it would be possible to do what the project requires:

For the upcoming project, it is a Real Estate website. I have built out real estate websites before in TXP so that is not the issue. I know I can easily display the properties, filter information and make everything look sharp and user friendly both front end and back end. The properties are individual articles which should mesh perfect with the plug in.

The niggle in this project is that the properties will be rented and I need to show “on a calendar” the availability (or more appropriately the non availabilty“of the properties.

Here are the items that I am a bit uncertain of:

  • Can I have an individual calendar for each property (article) so that iI can diaplay the article and calendat together, but that it does not show the information for the rest of the properties. I plan on having approximately 100 properties.
  • To maintain the calendar, I need to give the end user the capability of identifying all the dates the property is currently rented. I was thinking of using the skip field, but I want them to be able to span dates because it will be impossible if they have to manually enter every individual date.

Any and all input would be appreciated. My guess is that some of the above are Bloke questions, but I wanted to throw it open to everyone.

Thanks in advance.

progre55

Last edited by progre55 (2009-02-19 22:22:39)

Offline

#139 2009-02-19 23:04:06

Els
Admin
From: The Netherlands
Registered: 2004-06-06
Posts: 7,397
Website

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

progre55 wrote:

To maintain the calendar, I need to give the end user the capability of identifying all the dates the property is currently rented. I was thinking of using the skip field, but I want them to be able to span dates because it will be impossible if they have to manually enter every individual date.

I started to experiment with an availability calendar a while ago, but haven’t had the time to work on it since. I didn’t even have the time to upgrade the plugin to a more recent version… But I’m just using the posted and expires dates for start and end dates, here is my test page, I still need to add a lot of features before I can actually use it. And I will need more than one calendar as well, though I haven’t thought about how to do that yet.


<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields

Offline

#140 2009-02-19 23:58:53

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

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

Given 100 properties, 100 sections with one article assigned to each would be possible. The smd_calender tag is section sensitive by attribute, so it may be possible to use a single page template as well; this would require 4.0.7 TXP or later so as to parse tags as attributes. The alternatives also include filtering by author and category as an organizational option.

Offline

Board footer

Powered by FluxBB