Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

LocalTimes

Summary: Display RecentChanges and History timestamps in the local timezone of each visitor.
Version: 20160515
Prerequisites: JavaScript
Status: Beta
Maintainer: Petko
Users: +3 (view / edit)
Discussion: LocalTimes-Talk
License: GPL3+

Description

When many authors from different countries use a wiki, it is annoying to see the date/time stamps in a single timezone, different from their own. For an author in Europe or in New Zealand, having the dates in the Dallas/TX timezone makes it hard to estimate when an edit was actually done.

The recipe rewrites the timestamps in RecentChanges pages and on page histories to show the time in the local timezone of each author. The original date/time string is moved to a tooltip/title and appears when the mouse cursor is positioned over the link.

For the changes from the last 24 hours, after the page entry, a "+" plus sign is appended. Clicking on it will fetch and display the authors and summaries of the changes to that page from the last 48 hours.

The recipe is now enabled on pmwiki.org, see for example Site.AllRecentChangesShort.

Installation

Place the file localtimes.phpΔ into your pmwiki/cookbook directory.

Copy localtimes.js to your pmwiki/pub directory. Add near the end of local/config.php such code:

  include_once("$FarmD/cookbook/localtimes.php");

Note that the installation code changed in version 20150906.

Note that LocalTimes has built-in the functionality of the recipe "Better RecentChanges" from TrackChanges, but you cannot have the two recipes at the same time. If you previously used TrackChanges, please remove its installation code from config.php.

Configuration

You can configure the duration of the fetched page history.

In config.php, set

  $LastTimesHours = 24; // 24 hours; default is 48

To disable the "+" plus button and the fetching of recent history, set this variable to 0:

  $LastTimesHours = 0;

Usage

In a RecentChanges page, or in a Page History, you will see the timestamps in the local time zone of your operating system. Note that in RecentChanges, only pages modified after the installation of the recipe will have their timestamps localized.

Click on the "+" plus sign after a page entry to see its recent history.

Notes

The visitors' browsers need to have JavaScript enabled or they will see the date/time in the timezone of the server.

The recipe expects the RecentChanges format to be in standard bulleted or numbered lists. Other formats are not supported, eg. Tables may produce unexpected results and errors.

If the skin has a <div id="wikitext"> block, the recipe will only scan links in it and will work faster. If the page heading has the class "pagetitle", the recipe will append the current local time to the heading in light gray. (The default pmwiki skin and many other skins contain these elements; you can check if your skin does.)

Change log / Release notes

  • 20160515 - click on the pagetitle timestamp will now reload the page.
  • 20150906 - fix "+" plus signs, no longer displayed if no more edits in 48 hours (takes effect up to 48 hours after upgrade). No more need to edit localtimes.js. Added styles for the "+" signs. Please note that the installation code changed.
  • 20150830a - silently ignore missing elements in skins, without generating JavaScript errors.
  • 20150830 - bug fix: escape special characters in the fetched page summaries.
  • 20150804 - add Ajax fetching of recent page history.
  • 20150621 - append time to pagetitle heading.
  • 20121231 - minor refactoring, changes from less than 24 hours show just the time.
  • 20121109 - changed today's changes to show just the time.
  • 20110607 - fix tooltip titles in Internet Explorer.
  • 20110605 - first public release, ready to be tested.

See also

Contributors

  • Petko is author and maintainer of this recipe (5ko [snail] 5ko [period] fr).
  • If this recipe helps you or saves you time, you can help support its continued development by .

Comments

See discussion at LocalTimes-Talk

User notes +3: 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 May 15, 2016, at 08:52 AM