From 5db8be6e7ba130865bae146402e18098e889f7a1 Mon Sep 17 00:00:00 2001 From: Alex Z Date: Sat, 25 Oct 2008 02:27:27 +0000 Subject: [PATCH] Re-committing r42514: (bug 16073) * Use onclick handler for expand/collapse in enhanced recentchanges. * Hide the expandable content with JavaScript for better fallback if JS is disabled for whatever reason. * Move enhancedchanges JS to separate file. * Less cryptic id names. with some tweaks suggested by Brion and Danny B on the bug. --- RELEASE-NOTES | 2 ++ includes/ChangesList.php | 47 ++++++++++++++++++++++--------- includes/DefaultSettings.php | 2 +- languages/messages/MessagesEn.php | 2 ++ maintenance/language/messages.inc | 2 ++ skins/common/enhancedchanges.js | 39 +++++++++++++++++++++++++ skins/common/wikibits.js | 16 ----------- 7 files changed, 79 insertions(+), 31 deletions(-) create mode 100644 skins/common/enhancedchanges.js diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 1d850d61ff..2735a65b86 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -283,6 +283,8 @@ The following extensions are migrated into MediaWiki 1.14: * (bug 14609) User's namespaces to be searched default not updated after adding new namespace * Purge form uses valid XHTML and (bug 8992) uses $wgRequest instead of $_SERVER * (bug 12764) Special:LonelyPages shows transcluded pages +* (bug 16073) Enhanced RecentChanges uses onclick handler with better fallback if + JavaScript is disabled. === API changes in 1.14 === diff --git a/includes/ChangesList.php b/includes/ChangesList.php index 41d20398b2..f3984b3464 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -388,6 +388,23 @@ class OldChangesList extends ChangesList { * Generate a list of changes using an Enhanced system (use javascript). */ class EnhancedChangesList extends ChangesList { + + /** + * Add the JavaScript file for enhanced changeslist + * @ return string + */ + public function beginRecentChangesList() { + global $wgStylePath, $wgStyleVersion; + $this->rc_cache = array(); + $this->rcMoveIndex = 0; + $this->rcCacheIndex = 0; + $this->lastdate = ''; + $this->rclistOpen = false; + $script = Xml::tags( 'script', array( + 'type' => 'text/javascript', + 'src' => $wgStylePath . "/common/enhancedchanges.js?$wgStyleVersion" ), '' ); + return $script; + } /** * Format a line for enhanced recentchange (aka with javascript and block of lines). */ @@ -596,13 +613,16 @@ class EnhancedChangesList extends ChangesList { $users = ' [' . implode( $this->message['semicolon-separator'], $users ) . ']'; - # Arrow - $rci = 'RCI'.$this->rcCacheIndex; - $rcl = 'RCL'.$this->rcCacheIndex; - $rcm = 'RCM'.$this->rcCacheIndex; - $toggleLink = "javascript:toggleVisibility('$rci','$rcm','$rcl')"; - $tl = '' . $this->sideArrow() . ''; - $tl .= ''; + # ID for JS visibility toggle + $jsid = $this->rcCacheIndex; + # onclick handler to toggle hidden/expanded + $toggleLink = "onclick='toggleVisibility($jsid)'"; + # Title for tags + $expandTitle = wfMsg('rc-enhanced-expand'); + $closeTitle = wfMsg('rc-enhanced-hide'); + + $tl = "" . $this->sideArrow() . ""; + $tl .= ""; $r .= ''.$tl.' '; # Main line @@ -680,7 +700,7 @@ class EnhancedChangesList extends ChangesList { $r .= "\n"; # Sub-entries - $r .= '