|
Cookbook /
LocalTimesSummary: Display RecentChanges and History timestamps in the local timezone of each visitor.
Version: 20121231
Prerequisites: JavaScript
Status: Beta
Maintainer: Petko
Discussion: LocalTimes-Talk?
DescriptionWhen 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. The recipe is now enabled on pmwiki.org, see for example Site.AllRecentChangesShort. InstallationCopy localtimes.js to your pmwiki/pub directory. Add to local/config.php such code:
foreach($RecentChangesFmt as $k=>$v)
$RecentChangesFmt[$k] = str_replace('$CurrentTime',
'[[{$Group}.{$Name}?action=diff#diff$Now|$CurrentTime ]]', $v);
if(@$_GET['nolt']==''
&& ($action=="diff" || strpos($pagename, 'RecentChanges')!==false)) {
$HTMLFooterFmt['LocalTimes'] = '<script type="text/javascript"
src="$FarmPubDirUrl/localtimes.js"></script>';
}
Note that the first part of the code is the same as in the recipe "Better RecentChanges" from TrackChanges. If you already have it installed, you don't need to repeat the code. Configuration and usageCurrently nothing can be configured. The recipe doesn't need any interaction. NotesThe visitors' browsers need to have JavaScript enabled or they will see the date/time in the timezone of the server. Change log / Release notes
See also
ContributorsPetko is author and maintainer of this recipe. CommentsSee 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. |