From 3798bcc79b0727601dc99266133b6d3e65f45a04 Mon Sep 17 00:00:00 2001 From: Alex Z Date: Fri, 24 Oct 2008 23:10:12 +0000 Subject: [PATCH] (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. --- RELEASE-NOTES | 2 ++ includes/ChangesList.php | 32 ++++++++++++++++++++++++-------- includes/DefaultSettings.php | 2 +- skins/common/enhancedchanges.js | 33 +++++++++++++++++++++++++++++++++ skins/common/wikibits.js | 16 ---------------- 5 files changed, 60 insertions(+), 25 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..6e516d4f32 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,12 @@ 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; + + $toggleLink = "onclick='toggleVisibility($jsid)'"; + $tl = "" . $this->sideArrow() . ""; + $tl .= ""; $r .= ''.$tl.' '; # Main line @@ -680,7 +696,7 @@ class EnhancedChangesList extends ChangesList { $r .= "\n"; # Sub-entries - $r .= '