Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

WikiCalendar

Summary: Add support for a simple calendar. Each date becomes a wiki page.
Version: 1.1.1 (2014-02-13, compatible with php 5.5)
Status: Stable
Prerequisites: pmwiki 2.2.56 or above (use version 0_3 for older pmwiki version)
Maintainer: jr
Discussion: WikiCalendar-Talk

Solution

Version compatible with php 5.5:

wikilog0_3.phpΔ -- this PmWiki 2 version is an update of the version for PmWiki 1, simplified to reduce the number of script files. The latest version is tested with PmWiki 2.1.5.
Internationalisation:
wikilog.cssΔ -- stylesheet to control the calendar display (over-written file replaced, JR).

Discussion

Please note. The Publish PDF library includes the WikiCalendar recipe.

First you need to install the calendar.

Installation

  • Download wikilog.php, wikilog-i18n-en.php, wikilog.css and one of the language versions (e.g. wikilog-i18n-it.php).
  • Move wikilog.php and wikilog-i18n-en.php and the language version into the cookbook/ directory
  • Add the following line to local/config.php (replace XX with your language):
    include_once("$FarmD/cookbook/wikilog.php");
    include_once("$FarmD/cookbook/wikilog-i18n-XX.php");
This won't work when MultiLanguage is used. To make it work replace the above two lines with:
    SDV($language,$_COOKIE['userlang']); 
    include_once("$FarmD/cookbook/wikilog.php");
    //DON'T include_once("$FarmD/cookbook/wikilog-i18n-XX.php");
and make sure to load multilanguage.php before wikilog.php - SteP February 14, 2007, at 04:34 PM
  • Move wikilog.css into pub/css/ (you may need to create this directory).

Using the calendar

In the following discussion, assume calendar entries are in a group called Calendar, with a home page called Calendar.Calendar:

  • create a page called Calendar.GroupHeader
  • enter the following on a line by itself:
    (:wikilog:)
  • followed by a blank line (you may need to enter a space, if your browser removes trailing return characters at the end of a form)
  • save and go to the Calendar.Calendar page; you should see 2 calendar months displayed

To make a form for posting a story to (by default) "today's page" or another selected date, add the (:wikilogbox:) directive to the Calendar.Calendar page.

To show a list of the latest entries from a page in another group, enter:

    (:wikilognews Calendar:) (deprecated)
    (:wikilog Calendar:)

Calendar is the name of the calendar group and the home link points to Calendar.Calendar.

If you want the calendar home page to be something other than Calendar.Calendar, such as Calendar.HomePage, put the following into the Calendar.GroupHeader

    (:wikilog HomePage:)

To show a list of the latest entries on this page from a page in another group, enter:

    (:wikilognews Calendar.HomePage:) (deprecated)
    (:wikilog Calendar.HomePage:)

To generate a list of "go to month" links suitable for a sidebar (including links to the first and last days' entries, if any, for those months), enter:

    (:wikilognav:)

To display all the entries for the current week in a single page, enter:

    (:thisweek:)

To provide a form to post a story to a specified date, add this to the home page:

    (:wikilogbox:)

There is a range of configuration variables which an administrator can override in the local/config.php file. Place these settings before the include_once(...wikilog.php) line. For many people, the default settings are all they need.

  
  This configures how weekdays are presented.
  0 - american style, Sun to Sat
  1 - european style, Mon to Sun
  SDV($calendar_weekstyle,1);

  This configures how dates are presented.
  0 - american style, 11/17/2002
  1 - european style, 17.11.2002
  2 - international style, 2002-11-17
  SDV($calendar_datestyle,1);
  SDV($space_date_titles,1);
  SDV($SpaceDateString,'-');

  How many months relative to the current one to start the calendar.
  Can be a negative (going back) or a positive (going ahead) number.
  The value zero (0) starts the calendar with the current month.
  SDV($calendar_months_start,0);

  How many months altogether to show on the calendar.
  SDV($calendar_months_number,2);

  How many months after we should wrap and start a new row.
  SDV($calendar_month_wrap,3);

  Whether or not to display current entries at the bottom of the calendar.
  Enter 'false' to omit the current period's entries.
  SDV($display_log_entries,true);

  Whether to display current entries in ascending or descending order.
  Enter 'false' to show the oldest first.
  SDV($newest_first,true);

  Whether to display a summary or full calendar on individual entry pages.
  Enter 'false' to include the calendar on every page.
  SDV($summary_only,true);

  This is the default home of each collection (Group) of date pages.
  SDV($wikilog_home_page,FmtPageName('$Group',$pagename));

  Translate date markup yyyy-mm-dd into long dates
  SDV($DateSeparatorPattern,'[-.\/]');

  Whether to display non-existent date entries in the calendar as day or day?
  Enter 'true' to use the wiki '?' convention for non-existent entries
  SDV($day_as_wiki,false);

  Whether to display a list or list and Publish button on wikilog news pages
  Enter 'true' to include a Publish button after the news list
  SDV($enable_publish,false);

  Whether to display warm and friendly week day names for (:thisweek:)
  Enter 'false' to use normal day names
  SDV($yesterday_today_tomorrow,true);

  Whether to display fully-defined week day names for (:thisweek:).
  0 - day number only
  1 - long date (day name, day number, month name, year)
  2 - day and month number only (dd.mm or mm/dd or mm-dd)
  SDV($long_weekday,0);

  Whether to make an edit link on week day names
  Enter 'false' to suppress edit link
  SDV($edit_weekday,true);

  Month and day names in chosen language
  SDV($language,'en'); 

By default, the calendar publish function is disabled. To use the publish function, you will need the PublishWikiTrail recipe. The wikilog-i18n-xx.php files from PmWiki 1 work with the PmWiki 2 calendar.

To set local configuration values, either add SDV($parameter,'value'); above the include_once wikilog.php or use $parameter = 'value'; above or below the include_once statement.

Finally, wikilog adds date markup: it turns yyyy-mm-dd text into long dates.

History

08 Jun 2006 -- set $calendar_box_access_code to false to disable the access code field on (:wikilogbox:)

01 Jun 2006 -- add nofollow to nonexistent dates

26 May 2006 -- add group and page option to (:wikilognav:)

24 May 2006 -- avoid mis-handling of dates in url text; improve (:wikilogbox:) handling

08 Mar 2006 upload correct i18n-en file

31 Oct 2005 -- update wikilog.phpΔ. wikilog-i18n-en.phpΔ, wikilog.cssΔ to tidy (:thisweek:) display

27 Oct 2005 fixed bug in function "calendar_nav_bar($pagename,$startingtime)" causing the previous month not to be displayed (Thierry Vanderschueren)

line : $lasttime =$startingtime-$calendar_months_number*2592000;
changed into
$lasttime =$startingtime-($calendar_months_number - 1) * 2592000;
Really? If I display 2 months ($calendar_months_number = 2), say October and November, the previous link is to August, which will then display August and September. If, however, I make the above change, the previous link is to September, which will then display September and (repeating itself) October. If I display 1 month, the previous link goes to the current month, not the previous month. So I don't understand why the above change is required or desirable. Perhaps you could help me see what I am missing.

20 Oct 2005 add configuration options for (:thisweek:)

18 Oct 2005 add (:thisweek:) to display entries for the current week -- updates wikilog.phpΔ, wikilog-i18n-en.phpΔ and wikilog.cssΔ

22 May 2005 add (:wikilognav:) to list a series of months (default 15) in a style suitable for a sidebar (requires a new wikilog.css file)

15 May 2005 enhance (:wikilogbox:) so authors can select the date for the story (also requires new wikilog-i18n file)

11 May 2005 add support for [[yyyymmdd]] links to show long date text and add $DateSeparatorPattern variable

14 Mar 2005 merge the (:wikilog:) and (:wikilognews Group:) markups to improve consistency (thanks to Magnus for the suggestion)

27 Feb 2005 fixed bug if $calendar_datestyle = 2; and allow trailing spaces after (:wikilog:) directives

10 Feb 2005 changed $CalendarBoxFmt and include

  • $HeadlineText = 'Kopfzeile';
  • $StoryText = 'Geschichte';
  • $AuthorText = 'Autor';
  • $PostText = ' Abschicken ';
  • $ResetText = 'Zur├╝cksetzen';

to language files; move files to cookbook directory instead of local directory. (DanielScheibler)

25 Jan 2005 fix incompatibility with pmwiki beta 19, which led to invalid html being generated

17 Jan 2005 pick up the author from the PmWiki cookie (thanks to RobinS) and add support for yyyy-mm-dd markup (renders as a long date).

2 Dec 2004 try again: $url_connector should no longer be needed; but Paul could perhaps retest with beta 4.

15 Nov 2004 put back $url_connector from the PmWiki 1 version -- it's still needed. However, if $url_connector='&'; the WikiCalendar currently doesn't work correctly without a small change to pmwiki itself. See PITS.00165. Thanks to Paul Lewis for reporting the problem and testing a solution.

Origins

Christian asked:

 
>A general comment:
>* It's slightly confusing with the script called 'wikilog' when the 
>  example is so extremely calendar-oriented. Is the functionality of a
>  log and a calendar so similar?
>* Same goes for the directive (:wikilog:)...

to which John answered:

 
<boringHistory>
When I were a lad, I was taught that experimental scientists always
kept a lab book with a daily log of activities. Like a ship's log.
James Cook's log book from the Endeavour voyages makes grim reading.
He had some unrelentingly bad hair days. You can tell from the names
he gave to places: Cape Tribulation, Cape Foulwind, Murderers' Bay... 
(I have since learnt that Abel Tasman named Murderers' Bay -- 
one of his crew got eaten.)

Lab books were invariably stained, burnt, torn and dog-eared. Like
their authors.

So the original idea behind the wikilog was just for a web-based
project log book. But what people see is a calendar and it just
became easier to explain it in those terms. But it's not really
a calendar; it has no pictures of snow-capped mountains,
tumbling brooks, happy smiling children, or cute cats. Or
ruddy hobbits. We could of course add such features (as long as
there are no hobbits).

And it was just too hard to come up with a new name and markup.
The name 'wikilog' creates no pre-conceived notions about what
it "should" do. All the others I could think of were freighted
with too much cultural baggage.

</boringHistory>

See also

Contributor

jr

(:wikilog Calendar:)

Screen Shot

Questions, Comments, Suggestions

  • It would be nice if I could disable the markup of ISO dates with a variable in config.php. I think it might be possible by changing $DateSeparatorPattern but it isn't entirely clear. Something like $EnableDateMarkup would be better.
  • It would also be nice if $display_log_entries showed multiple items instead of only the first line from the date page. I solved this by disabling $display_log_entries and including (:thisweek:) in the home page but all the ? from non-existent pages is kind of ugly.
  • I like "Today" in the friendly names but would prefer the dates instead of Yesterday and Tomorrow.
  • The only way I see to look through the "log" is to flip through the calendar page while the wikilog updates to the follow the currently displayed months. Unfortunately I don't see a way to vary the wikilog display to show a different period. I'd like an option to create a "This Year" link that will show all the log entries for the current year.
  • I think the summary of all that is that I want WikiCalendar's display and features combined with PmCalendar's markup. I don't think my PHP skills are up to that.

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Edit - History - Print - Recent Changes - Search
Page last modified on February 23, 2014, at 04:50 AM