Jump to content


[Snippet] zcalendar3


  • You cannot reply to this topic
119 replies to this topic

#1 Cris D.

    Loves Etomite Forums!

  • Developers
  • PipPipPipPip
  • 1,104 posts
  • Gender:Male

Posted 23 July 2007 - 01:54 PM

File Name: zcalendar3
File Submitter: Cris D.
File Submitted: 24 Jul 2007
File Updated: 10 May 2008
File Category: Calendars & Events

[! zcalendar!] Calendar Snippet3 This snippet does NOT rely on an etomite page per entry.
This is intended for those who want to enter a lot of entries quickly and want a dedicated page and/or a dedicated picture as an option.

This snippet outputs in hcalendar format which allows surfers to add your events to calendar applications like Outlook, Google Calendar etc. This works very well with FF with the Operator add-on installed, there are also other applications that can convert the hcalendar format to .ics importable format.

It can also just be used as a general events and calendar display.

See in action here:
See also: zcalendar_display- this snippet takes all the events from zcalendar and places them in a printable month by month calendar;
See also: zcal_mini- this snippet takes all the events from zcalendar and places them in a mini calendar suitable for a column or small space.
See also: zcalendar search site- this snippet allows you to search all zcalendar events and ads the results to your existing site search results page.

############## Snippet Installation Instructions#####################

Pre-requisites: You will need to have front-end authentication
(authenticate_visitor log-in) to see the entry form, just place the authenticate_visitor snippet to log in somewhere in your site.

1) Download the zip file and unzip it and upload the file contents to your manager/media/ folder. The folder contains all of the tigra_calendar files as well as the snippet, chunk, README files.

2)Open the snippet file zcalendar.txt and copy and paste the contents of the snippet to the snippet library, call it in a page uncached like this [!zcalendar!]

3) Open the chunk zcalTemplate and copy and paste it to your chunk library.

4) Configure the snippet according to your requirements.

ChangeLog:
25/7/07 Updated snippet to fix the duplicate entry in the calendar.
Added hyperlinks and anchors to events as requested.
Added tooltips (on mouse-hover on calendar, event titles are displayed).
30/7/07 Fixed database error on installation if not logged in.
31/7/07 Use extIntTableExists() for reliable tablecheck. Changed security to use only checkPermissions().
31/7/07 Included support for FURLs
31/7/07 Removed in-line styling in favor of classes (old styles left in the snippet for reference).
4/8/07 Abstracted the template from the code in a separate chunk. I also included class names that automatically are set to "hidden_class" if there is no content. If you set the css to hidden_class{display:none}, these will be hidden from view.
5/8/07 All events and Single events can now be enclosed in any tags you like. default is: ALL<ul></ul> EACH: nil (set <li></li> in the template if you wish).
5/8/07 Fixed broken anchors
5/8/07Changed Make URL parameters for data forms so that they redirect to the last viewed month instead of current month.
Updated Template to work with(thanks cathode).
prevMonth and nextMonth set for both calendar navigations
fixed blank pic not hiding
9/8/07 Fixed missing makeURL parameters required for event anchor to return the correct month.
9/9/07 Fixed incorrectly applied $hide class values which accidentally hid event elements that should not have been hidden.
12/10/07: V 3.6.5.
  • Added tigra validation for the title form field to stop non-alphanumeric characters from breaking zcal_mini.
  • Fixed "Editing record..." message.
  • Changed manual database connection to automatic configuration.
  • Added cal-image alt tag.
5/11/07:V 3.6.6
Removed tigra validation in favour of php validation for only those characters that break zcal mini (',",\). (All other characters and spaces allowed).
Fixed bug in automatic database connection settings.
Added srtip_slashed_deep function check to stop re-declaration errors.
More obsolete code clean-up.
17/11/07
Edited and updated this documentation not a snippet update.

2008/05/10
  • Created zcalendar as a zip package with all tigra_calendar files required.
  • Inserted the javascript file call into the snippet rather than requiring users to place it in template headers for simplicity of installation.
  • Modified the event source code to be formatted better.
  • Added error reporting if the chunk is not configured corectly.
  • Made a separate chunk and readme file
  • Tested for operation in EtomiteV1


See also the snippet zcalendar_display to see how the same data can be displayed in a month by month printable calendar and zcal_mini for a compact calendar (suitable for a side bar or template header) with links to the events listing page.

Click here to download this file

Edited by Cris D., 19 March 2009 - 10:37 AM.


#2 Cris D.

    Loves Etomite Forums!

  • Developers
  • PipPipPipPip
  • 1,104 posts
  • Gender:Male

Posted 24 July 2007 - 03:21 AM

OOps, I sumbitted a slightly older version. To stop duplicate numbers showing in the calendar for active days, change the code on lines 424-429 from this
if($dayS!=0 or $dayF!=0){
		  if ($day!=$today && $dayS==1){$output .= "<b style='$event_style'>".$day."<br /></b>\n"; 
		  }elseif ($day!=$today && $dayS==0 && $dayF==1){$output .= "<b style='$eventend_style'>".$day."<br /></b>\n";
		  }}
		  if ($day==$today){ $output .= "<b style='$today_style'>$day</b>\n";
		  }else {$output .= "$day"; } # Otherwise just display the day
to this

if($dayS!=0 or $dayF!=0){
		  if ($day!=$today && $dayS==1){$output .= "<b style='$event_style'>".$day."<br /></b>\n"; }
		  if ($day!=$today && $dayS==0 && $dayF==1){$output .= "<b style='$eventend_style'>".$day."<br /></b>\n";
		  }}
		  elseif ($day==$today){ $output .= "<b style='$today_style'>$day</b>\n";
		  }else {$output .= "$day"; } # Otherwise just display the day

Edit: 25/7/07Snippet now Updated with this addition.

Edited by Cris D., 25 July 2007 - 01:20 PM.


#3 Cris D.

    Loves Etomite Forums!

  • Developers
  • PipPipPipPip
  • 1,104 posts
  • Gender:Male

Posted 25 July 2007 - 01:22 PM

This snippet has been updated to include:

1) Anchors that link from the calendar to the event (as requested).
2) Tooltips that display the events for that day when the mouse hovers over the date.

Cheers, Cris D.

#4 Cris D.

    Loves Etomite Forums!

  • Developers
  • PipPipPipPip
  • 1,104 posts
  • Gender:Male

Posted 27 July 2007 - 01:30 PM

Please note: If you downloaded zcalendar ver 3.2. It is broken as a result of losing connection with my host while saving it just before submitting. There were a few bugs that I had fixed but did not appear in the submitted version...
Events with a date with a single digit did not show.
The Anchor links were not htlml compliant.
There was a heap of obsolete code requiring deleting.

If you made no changes to your downloaded version, you can overwrite ver 3.2 with ver 3.3 without losing data (take note of the table name). All these things have been fixed in the latest version.

Also: coming soon... a printable month-by-month wall-calendar layout that automatically displays the zcalendar data ready for printing (with the help of the printablePage snippet). For a sneak preview... see Here.

#5 cathode

    Loves Etomite Forums!

  • Staff
  • 648 posts
  • Gender:Male

Posted 27 July 2007 - 03:31 PM

OK I hope I don't ask a stupid question, but it gets a little fuzzy around step 4. I am testing this out on a site with no authentication happening, what exactly should I do to try this calendar out without changing my entire Etomite setup too much?

Thanks!

#6 Cris D.

    Loves Etomite Forums!

  • Developers
  • PipPipPipPip
  • 1,104 posts
  • Gender:Male

Posted 27 July 2007 - 09:33 PM

You will need to have visitor permissions enabled in your configuration set-up. That shouldn't change things too much (Ralph knows the implications better than I with activating this).

I have never had a site without it.

On the page where you call the snippet [zcalendar] add the snippet [authenticate_visitor] as well. That should get you going.

If you don't have visitor permissons enabled and authenticate_visitor to log in, the snippet will still work, but you won't be able to see the form to enter data...

#7 Cris D.

    Loves Etomite Forums!

  • Developers
  • PipPipPipPip
  • 1,104 posts
  • Gender:Male

Posted 28 July 2007 - 10:40 PM

I just had a thought. If you didn't have visitor permissions and didn't want to add them... You should be able to view the page from inside manager in the edit/move/delete view of the page.

In this instance you would be authenticated and the entry form SHOULD show up where you could enter your dates.

I haven't tested this theory but if it doesn't work, it would be easy to make it work like this.

#8 cathode

    Loves Etomite Forums!

  • Staff
  • 648 posts
  • Gender:Male

Posted 29 July 2007 - 03:13 AM

I havent' turned on permissions yet, but I'm getting an "« Execution of a query to the database failed »" error.

#9 Cris D.

    Loves Etomite Forums!

  • Developers
  • PipPipPipPip
  • 1,104 posts
  • Gender:Male

Posted 29 July 2007 - 07:12 AM

Do you have more info? line number? error type? sql attempted query? Are you sure you have version 3.3?

#10 Cris D.

    Loves Etomite Forums!

  • Developers
  • PipPipPipPip
  • 1,104 posts
  • Gender:Male

Posted 30 July 2007 - 12:47 PM

Snippet updated to stop a database error on installation if not logged in.

@Ralph: I checked this snippet without any permissions turned on in the site configuration.
I logged in via the authenticate_visitor snippet and it let me in anyway. Is the authenticate_visitor snippet supposed to bypass the configuration settings?

If so, ...

@cathode, there is no need to turn on permissions in your config site if you use authenticate_visitor snippet to log in to an admin account. You will be able to enter form data anyway.

My security uses
if($_SESSION['validated'] && $etomite->checkPermissions())


#11 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 30 July 2007 - 01:19 PM

@Cris D.

The checkPermissions() API function works on several different levels... If visitor_permissions are enabled the function will make full use of user and document group permissions... If visitor permissions are not enabled then simple authentication is performed, which is essentially just insuring that the user has a validated session, which means they have logged in...

One exception to all of this is that anyone who possesses an administrator role has full access to everything so they get a green flag immediately, regardless of any other settings... This would, however, only come into play once the user has been authenticated through login or if their previous session has not expired...

Now, with simple authentication, if a document has not been set to Authenticate then anyone will have access... If you set the Authenticate flag, and are using simple authentication, a visitor will only be able to access that page after they have logged in using a front end login routine so their session has been validated...

The flexibility that Etomite provides allows developers to determine the level of security they wish to implement on a given site... Some may find simple authentication, or simple authentication plus Role checking, to be sufficient... Others may require full visitor permissions checking which includes document group permissions checking... Attempting to mix the two can lead to some strange and unwanted behaviors, however, so developers should stick to one or the other and not a mixture of both methods...

#12 Cris D.

    Loves Etomite Forums!

  • Developers
  • PipPipPipPip
  • 1,104 posts
  • Gender:Male

Posted 30 July 2007 - 06:15 PM

I'm getting an error:

Quote

PHP error debug
Error: mysql_select_db(): supplied argument is not a valid MySQL-Link resource
Error type/ Nr.: Warning - 2
File: /index.php
Line: 1605
Line 1605 source: $selected = mysql_select_db($dbase,$this->rs) or die(mysql_error());


Which I believe is coming from the line in this snippet...
$tableCheck=$etomite->intTableExists($etoPrefix."".$zcalendar);

As you know, tableCheck should return 0 or 1, therefore, do you know why I might be getting this error on failure? I have checked out the php site and the only help it offers is this:

Quote

link_identifier
The MySQL connection. If the link identifier is not specified, the last link opened by mysql_connect() is assumed. If no such link is found, it will try to create one as if mysql_connect() was called with no arguments. If by chance no connection is found or established, an E_WARNING level warning is generated.

Therefore, it looks like a link drop-out.

Edited by Cris D., 30 July 2007 - 06:29 PM.


#13 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 30 July 2007 - 07:13 PM

I have had ongoing problems with making intTableExists() work properly across platforms for some reason... I have been testing it on a few systems because I thought I had all the bugs out of it for the 0.6.1.4 release... Perhaps using extTableExists() will prove more reliable... Any testing that you are willing to do would be greatly appreciated... My Cocoon database class version seems to be working without any problems but the whole class is radically different...

#14 cathode

    Loves Etomite Forums!

  • Staff
  • 648 posts
  • Gender:Male

Posted 31 July 2007 - 02:34 AM

Now that I can see zcal, I am really wishing for real css markup- using classes instead of inline styles so that a designer could easily the look from an external stylesheet. for instance: class="currentDay", class="startDay", class="endDay," etc. If I can get this working and like it enough to use it and provide it for my clients, that will be a modification that I will attempt to make.

#15 Cris D.

    Loves Etomite Forums!

  • Developers
  • PipPipPipPip
  • 1,104 posts
  • Gender:Male

Posted 31 July 2007 - 10:56 AM

I have implemented the use of FURL's and Changed style references to class references.

Updated in the snippet library.

Edited by Cris D., 01 August 2007 - 04:14 AM.


#16 cathode

    Loves Etomite Forums!

  • Staff
  • 648 posts
  • Gender:Male

Posted 03 August 2007 - 12:56 AM

Chris,
I've just finished a few hours working on this snippet. http://www.n-vent.com/zcal.html

What I did was added a class, removed all non-validating and depreciating tags like "font" and "b", removed some inline styles, added some spans and changes how the styles were being used in the output, and added a simple stylesheet. I modified the javascript call to be valid as well.

I am having a hard time finding my way thru the code, but I think I got it a lot closer to what I'd consider a good solid snippet that outputs good markup. It still will not quite validate however: but that is still a lot better than it was.

If you want I'll send you the files... you may have more luck with it as you understand it like the back of your hand :)

#17 cathode

    Loves Etomite Forums!

  • Staff
  • 648 posts
  • Gender:Male

Posted 03 August 2007 - 01:01 AM

I also plan on separating out the events listings so that I can place the calendar portion of this snippet on another page, or on multiple pages - and have them link to the events on the output page. I also want to change the event listings to a proper unordered list somewhat like this:
<ul>
   <li><h3 class="eventTitle">Event Title</h3>
		 <p class="eventDecription">Event Description</p>
		 <p class="eventTimes">Event times</p>
		 </li>
</ul>

Edited by cathode, 03 August 2007 - 01:01 AM.


#18 Cris D.

    Loves Etomite Forums!

  • Developers
  • PipPipPipPip
  • 1,104 posts
  • Gender:Male

Posted 03 August 2007 - 03:17 AM

Yeah, can you attach it I'd love to have a look.

Also, have you tried to edit an existing event yet? When I updated the snippet to include FURL's I left off the form action="" thinking that they would be OK because they were using method _POST, however the edit/delete buttons use method_GET and will possible cause an Unfriendly URL (making it default to your home page on submit). I have also updated the code on my version to make sure the month you are working on stays on that month on save of an edited event.

When I advertised the snippet as validating, be aware, this was with the following conditions:
1) not logged in (admin forms do not validate).
2) Ralph's calendar not returned (by using the ?hcalendar=1 snippet call).

Inside a xhtmlV1.0 transitional validator, it was fine (but it was just before the release of their new validator version).

I'll be happy to abstract out some of the html, however I have had some fairly significant problems with getting external forms to talk to the code in the past (hence the embedded approach). If you give me what you have, I'll take it from there instead of trying to merge the two versions.

I have also (nearly) finished a mini_calendar version (based on just the calendar that links to the event list)- just a link from todays date to go. See on the home page of my alexhillshs site.

This mini_calendar is based on a trimmed down version of snippet zcalendar_display (uses the same data as the events listing but displays it in a calendar instead of a list). Maybe this is what you could use to provide the links you require.

Edited by Cris D., 03 August 2007 - 03:24 AM.


#19 cathode

    Loves Etomite Forums!

  • Staff
  • 648 posts
  • Gender:Male

Posted 03 August 2007 - 04:04 AM

The mini_calendar really looks nice. It works just like I was envisioning too, with the seperate page of event listings and all...

#20 cathode

    Loves Etomite Forums!

  • Staff
  • 648 posts
  • Gender:Male

Posted 03 August 2007 - 12:08 PM

View Postcathode, on Aug 3 2007, 12:04 AM, said:

The mini_calendar really looks nice. It works just like I was envisioning too, with the seperate page of event listings and all...

And here's the file :)

Attached Files







1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users