From 56adc8b76b15dcc07d99fbe6db6ea2a2159386ba Mon Sep 17 00:00:00 2001 From: dairiki Date: Mon, 17 Feb 2003 02:19:01 +0000 Subject: [PATCH] Fix so that PageHistory will work when the current revision of a page has been "deleted". git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@2575 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/plugin/PageHistory.php | 24 +++++++++++++++++------- lib/plugin/RecentChanges.php | 24 +++++++++++++++++++----- 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/lib/plugin/PageHistory.php b/lib/plugin/PageHistory.php index 40cb0da5c..d925a8a70 100644 --- a/lib/plugin/PageHistory.php +++ b/lib/plugin/PageHistory.php @@ -1,5 +1,5 @@ rss_icon()); } + function empty_message () { + return _("No revisions found"); + } + function _javascript($script) { return HTML::script(array('language' => 'JavaScript', 'type' => 'text/javascript'), @@ -159,9 +163,8 @@ extends _RecentChanges_HtmlFormatter } function pageLink ($rev) { - return HTML::a(array('href' => $this->pageURL($rev), - 'class' => 'wiki'), - fmt("Version %d", $rev->getVersion())); + $text = fmt("Version %d", $rev->getVersion()); + return _RecentChanges_HtmlFormatter::pageLink($rev, $text); } function format_revision ($rev) { @@ -250,7 +253,7 @@ extends WikiPlugin_RecentChanges function getVersion() { return preg_replace("/[Revision: $]/", '', - "\$Revision: 1.24 $"); + "\$Revision: 1.25 $"); } function getDefaultArguments() { @@ -303,17 +306,24 @@ extends WikiPlugin_RecentChanges if (empty($pagename)) return $this->makeForm("", $request); - if (! $dbi->isWikiPage($pagename)) + $page = $dbi->getPage($pagename); + $current = $page->getCurrentRevision(); + if ($current->getVersion() < 1) { return HTML(HTML::p(fmt("I'm sorry, there is no such page as %s.", WikiLink($pagename, 'unknown'))), $this->makeForm("", $request)); + } // Hack alert: format() is a NORETURN for rss formatters. - return $this->format($this->getChanges($dbi, $args), $args); } }; // $Log: not supported by cvs2svn $ +// Revision 1.24 2003/01/18 21:49:00 carstenklapp +// Code cleanup: +// Reformatting & tabs to spaces; +// Added copyleft, getVersion, getDescription, rcs_id. +// // Revision 1.23 2003/01/04 23:27:39 carstenklapp // New: Gracefully handle non-existant pages. Added copyleft; // getVersion() for PluginManager. diff --git a/lib/plugin/RecentChanges.php b/lib/plugin/RecentChanges.php index f1dcd0e3c..41e00343e 100644 --- a/lib/plugin/RecentChanges.php +++ b/lib/plugin/RecentChanges.php @@ -1,5 +1,5 @@ makeButton(_("(hist)"), $this->historyURL($rev), 'wiki-rc-action'); } - function pageLink ($rev) { + function pageLink ($rev, $link_text=false) { $page = $rev->getPage(); global $Theme; if ($this->include_versions_in_URLs()) { @@ -146,9 +146,9 @@ extends _RecentChanges_Formatter $exists = !$cur->hasDefaultContents(); } if ($exists) - return $Theme->linkExistingWikiWord($page->getName(), false, $version); + return $Theme->linkExistingWikiWord($page->getName(), $link_text, $version); else - return $Theme->linkUnknownWikiWord($page->getName(), false, $version); + return $Theme->linkUnknownWikiWord($page->getName(), $link_text); } function authorLink ($rev) { @@ -253,6 +253,11 @@ extends _RecentChanges_Formatter $this->sidebar_link()); } + function empty_message () { + return _("No changes found"); + } + + function sidebar_link() { extract($this->_args); $pagetitle = $show_minor ? _("RecentEdits") : _("RecentChanges"); @@ -312,6 +317,10 @@ extends _RecentChanges_Formatter } if ($lines) $html->pushContent($lines); + if ($first) + $html->pushContent(HTML::p(array('class' => 'rc-empty'), + $this->empty_message())); + return $html; } @@ -597,7 +606,7 @@ extends WikiPlugin function getVersion() { return preg_replace("/[Revision: $]/", '', - "\$Revision: 1.71 $"); + "\$Revision: 1.72 $"); } function managesValidators() { @@ -760,6 +769,11 @@ class DayButtonBar extends HtmlElement { } // $Log: not supported by cvs2svn $ +// Revision 1.71 2003/02/16 20:04:48 dairiki +// Refactor the HTTP validator generation/checking code. +// +// This also fixes a number of bugs with yesterdays validator mods. +// // Revision 1.70 2003/02/16 05:09:43 dairiki // Starting to fix handling of the HTTP validator headers, Last-Modified, // and ETag. -- 2.45.0