From 05ec0378d7a701f4ed571a39b8f2716af553bdfc Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 25 Oct 2008 20:30:19 +0000 Subject: [PATCH] Hold back r42568 for now "Re-committing r42528:" (enhanced RC no-JS fallbacks) Still not quite right -- entries don't line up correctly with JS mode out. Didn't do much further testing on it beyond that since I'm trying to get trunk working. :) --- RELEASE-NOTES | 2 -- includes/ChangesList.php | 47 +++++++++---------------------- languages/messages/MessagesEn.php | 2 -- maintenance/language/messages.inc | 2 -- skins/common/enhancedchanges.js | 39 ------------------------- skins/common/wikibits.js | 16 +++++++++++ 6 files changed, 30 insertions(+), 78 deletions(-) delete mode 100644 skins/common/enhancedchanges.js diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 476643de4e..d5c2dcb9ce 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -283,8 +283,6 @@ 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 ddf9b0f389..41d20398b2 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -388,23 +388,6 @@ 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). */ @@ -613,16 +596,13 @@ class EnhancedChangesList extends ChangesList { $users = ' [' . implode( $this->message['semicolon-separator'], $users ) . ']'; - # ID for JS visibility toggle - $jsid = $this->rcCacheIndex; - # onclick handler to toggle hidden/expanded - $toggleLink = "onclick='toggleVisibility($jsid); return false'"; - # Title for tags - $expandTitle = wfMsg('rc-enhanced-expand'); - $closeTitle = wfMsg('rc-enhanced-hide'); - - $tl = "" . $this->sideArrow() . ""; - $tl .= ""; + # Arrow + $rci = 'RCI'.$this->rcCacheIndex; + $rcl = 'RCL'.$this->rcCacheIndex; + $rcm = 'RCM'.$this->rcCacheIndex; + $toggleLink = "javascript:toggleVisibility('$rci','$rcm','$rcl')"; + $tl = '' . $this->sideArrow() . ''; + $tl .= ''; $r .= ''.$tl.' '; # Main line @@ -700,7 +680,7 @@ class EnhancedChangesList extends ChangesList { $r .= "\n"; # Sub-entries - $r .= '
'; + $r .= '
'; foreach( $block as $rcObj ) { # Get rc_xxxx variables // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables. @@ -779,10 +759,11 @@ class EnhancedChangesList extends ChangesList { * @param string $alt text * @return string HTML tag */ - protected function arrow( $dir ) { + protected function arrow( $dir, $alt='' ) { global $wgStylePath; $encUrl = htmlspecialchars( $wgStylePath . '/common/images/Arr_' . $dir . '.png' ); - return ""; + $encAlt = htmlspecialchars( $alt ); + return "\"$encAlt\""; } /** @@ -793,7 +774,7 @@ class EnhancedChangesList extends ChangesList { protected function sideArrow() { global $wgContLang; $dir = $wgContLang->isRTL() ? 'l' : 'r'; - return $this->arrow( $dir ); + return $this->arrow( $dir, '+' ); } /** @@ -802,7 +783,7 @@ class EnhancedChangesList extends ChangesList { * @return string HTML tag */ protected function downArrow() { - return $this->arrow( 'd' ); + return $this->arrow( 'd', '-' ); } /** @@ -810,7 +791,7 @@ class EnhancedChangesList extends ChangesList { * @return string HTML tag */ protected function spacerArrow() { - return $this->arrow( '' ); + return $this->arrow( '', ' ' ); } /** diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index c77514cd73..cdce327f5b 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1714,8 +1714,6 @@ please see math/README to configure.', 'rc_categories_any' => 'Any', 'rc-change-size' => '$1', # only translate this message to other languages if you have to change it 'newsectionsummary' => '/* $1 */ new section', -'rc-enhanced-expand' => 'Show details (requires JavaScript)', -'rc-enhanced-hide' => 'Hide details', # Recent changes linked 'recentchangeslinked' => 'Related changes', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 69cbdcbbdc..a320cb29a1 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -1035,8 +1035,6 @@ $wgMessageStructure = array( 'rc_categories_any', 'rc-change-size', 'newsectionsummary', - 'rc-enhanced-expand', - 'rc-enhanced-hide', ), 'recentchangeslinked' => array( 'recentchangeslinked', diff --git a/skins/common/enhancedchanges.js b/skins/common/enhancedchanges.js deleted file mode 100644 index ebbcf5b673..0000000000 --- a/skins/common/enhancedchanges.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - JavaScript file for enhanced recentchanges - */ - -/* - * Add the CSS to hide parts that should be collapsed - * - * We do this with JS so everything will be expanded by default - * if JS is disabled - */ -appendCSS('.mw-changeslist-hidden {'+ - ' display:none;'+ - '}'+ - 'div.mw-changeslist-expanded {'+ - ' display:block;'+ - '}'+ - 'span.mw-changeslist-expanded {'+ - ' display:inline !important;'+ - '}' -); - -/* - * Switch an RC line between hidden/shown - * @param int idNumber : the id number of the RC group -*/ -function toggleVisibility(idNumber) { - var openarrow = document.getElementById("mw-rc-openarrow-"+idNumber); - var closearrow = document.getElementById("mw-rc-closearrow-"+idNumber); - var subentries = document.getElementById("mw-rc-subentries-"+idNumber); - if (openarrow.className == 'mw-changeslist-expanded') { - openarrow.className = 'mw-changeslist-hidden'; - closearrow.className = 'mw-changeslist-expanded'; - subentries.className = 'mw-changeslist-expanded'; - } else { - openarrow.className = 'mw-changeslist-expanded'; - closearrow.className = 'mw-changeslist-hidden'; - subentries.className = 'mw-changeslist-hidden'; - } -} diff --git a/skins/common/wikibits.js b/skins/common/wikibits.js index 62ef574842..514714d3da 100644 --- a/skins/common/wikibits.js +++ b/skins/common/wikibits.js @@ -104,6 +104,22 @@ if (wgBreakFrames) { } } +// for enhanced RecentChanges +function toggleVisibility(_levelId, _otherId, _linkId) { + var thisLevel = document.getElementById(_levelId); + var otherLevel = document.getElementById(_otherId); + var linkLevel = document.getElementById(_linkId); + if (thisLevel.style.display == 'none') { + thisLevel.style.display = 'block'; + otherLevel.style.display = 'none'; + linkLevel.style.display = 'inline'; + } else { + thisLevel.style.display = 'none'; + otherLevel.style.display = 'inline'; + linkLevel.style.display = 'none'; + } +} + function showTocToggle() { if (document.createTextNode) { // Uses DOM calls to avoid document.write + XHTML issues -- 2.20.1