From 94c2b211d7a1d7e75975dac852c696fdfc711a20 Mon Sep 17 00:00:00 2001 From: carstenklapp Date: Sun, 3 Feb 2002 23:55:59 +0000 Subject: [PATCH] More updates for compatibility with relative date formatting (Today, Yesterday). git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@1829 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/diff.php | 31 +++++++++++++---------- themes/Portland/templates/actionbar.tmpl | 16 ++++++++---- themes/Portland/templates/viewsource.tmpl | 17 ++++++++----- 3 files changed, 40 insertions(+), 24 deletions(-) diff --git a/lib/diff.php b/lib/diff.php index 39f4ed851..64d99ee4c 100644 --- a/lib/diff.php +++ b/lib/diff.php @@ -1,5 +1,5 @@ 'right'), $label)); - if ($rev) { - $linked_version = WikiLink($rev, 'existing', $rev->getVersion()); - $row->pushContent(HTML::td(fmt("version %s", $linked_version)), - HTML::td(fmt("last modified on %s", - $Theme->formatDateTime($rev->get('mtime')))), - HTML::td(fmt("by %s", $rev->get('author')))); - } else { - $row->pushContent(HTML::td(array('colspan' => '3'), _("None"))); - } - return $row; + $row = HTML::tr(HTML::td(array('align' => 'right'), $label)); + if ($rev) { + $mtime = $rev->get('mtime'); + if (istoday($mtime) || isyesterday($mtime)) + $lastmodifiedmessage = _("last modified %s"); + else + $lastmodifiedmessage = _("last modified on %s"); + $linked_version = WikiLink($rev, 'existing', $rev->getVersion()); + $row->pushContent(HTML::td(fmt("version %s", $linked_version)), + HTML::td(fmt($lastmodifiedmessage, + $Theme->formatDateTime($mtime))), + HTML::td(fmt("by %s", $rev->get('author')))); + } else { + $row->pushContent(HTML::td(array('colspan' => '3'), _("None"))); + } + return $row; } function showDiff (&$request) { diff --git a/themes/Portland/templates/actionbar.tmpl b/themes/Portland/templates/actionbar.tmpl index 6762f0212..0cf6474d6 100644 --- a/themes/Portland/templates/actionbar.tmpl +++ b/themes/Portland/templates/actionbar.tmpl @@ -1,5 +1,5 @@ - + get('locked') || $user->isAdmin()) $EditB = Button("edit", @@ -8,15 +8,21 @@ $EditB = Button("viewsource", _("View Source")); $EditB = fmt("%s of this page", $EditB); - $mtime = $Theme->formatDateTime($revision->get('mtime')); + $mtime = $revision->get('mtime'); + $fmtime = $Theme->formatDateTime($mtime); // Suppress object to string conversion error. // Once the temporary asterisk denoting timezone conversion is removed, the @ can be removed. - $PageHistoryB = @Button(_("PageHistory"), $mtime); + $PageHistoryB = @Button(_("Diff"), $fmtime); if ($revision->isCurrent()) $LastModifiedMsg = fmt("(last edited %s)", $PageHistoryB); - else - $LastModifiedMsg = fmt("(version %s, saved on %s)", + else { + if (istoday($mtime) || isyesterday($mtime)) + $LastModifiedMsg = fmt("version %s, saved %s.", + $revision->getVersion(), $PageHistoryB); + else + $LastModifiedMsg = fmt("version %s, saved on %s.", $revision->getVersion(), $PageHistoryB); +} ?>
diff --git a/themes/Portland/templates/viewsource.tmpl b/themes/Portland/templates/viewsource.tmpl index f2e2c7a27..cef56ebb3 100644 --- a/themes/Portland/templates/viewsource.tmpl +++ b/themes/Portland/templates/viewsource.tmpl @@ -1,5 +1,5 @@ - + get('locked') && !$user->isAdmin()) { ?>

@@ -21,17 +21,22 @@ readonly="readonly" wrap="virtual"> formatDateTime($revision->get('mtime')); + $mtime = $revision->get('mtime'); + $fmtime = $Theme->formatDateTime($fmtime); // Suppress object to string conversion error. // Once the temporary asterisk denoting timezone conversion is removed, the @ can be removed. $PageHistoryB = @Button(_("PageHistory"), $mtime); if ($revision->isCurrent()) $LastModifiedMsg = fmt("(last edited %s)", $PageHistoryB); - else - $LastModifiedMsg = fmt("(version %s, saved on %s)", - $revision->getVersion(), $PageHistoryB); - + else { + if (istoday($mtime) || isyesterday($mtime)) + $LastModifiedMsg = fmt("version %s, saved %s.", + $revision->getVersion(), $PageHistoryB); + else + $LastModifiedMsg = fmt("version %s, saved on %s.", + $revision->getVersion(), $PageHistoryB); +} ?> getArgs()) ?> -- 2.45.0