Index: trunk/phase3/maintenance/language/messages.inc
===================================================================
--- trunk/phase3/maintenance/language/messages.inc (revision 42575)
+++ trunk/phase3/maintenance/language/messages.inc (revision 42576)
@@ -1035,6 +1035,8 @@
'rc_categories_any',
'rc-change-size',
'newsectionsummary',
+ 'rc-enhanced-expand',
+ 'rc-enhanced-hide',
),
'recentchangeslinked' => array(
'recentchangeslinked',
Index: trunk/phase3/skins/common/wikibits.js
===================================================================
--- trunk/phase3/skins/common/wikibits.js (revision 42575)
+++ trunk/phase3/skins/common/wikibits.js (revision 42576)
@@ -104,22 +104,6 @@
}
}
-// 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
Index: trunk/phase3/skins/common/enhancedchanges.js
===================================================================
--- trunk/phase3/skins/common/enhancedchanges.js (revision 0)
+++ trunk/phase3/skins/common/enhancedchanges.js (revision 42576)
@@ -0,0 +1,40 @@
+/*
+ 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;'+
+ ' visibility:visible !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';
+ }
+}
Property changes on: trunk/phase3/skins/common/enhancedchanges.js
___________________________________________________________________
Name: svn:eol-style
+ native
Index: trunk/phase3/includes/ChangesList.php
===================================================================
--- trunk/phase3/includes/ChangesList.php (revision 42575)
+++ trunk/phase3/includes/ChangesList.php (revision 42576)
@@ -388,7 +388,24 @@
* 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).
*/
public function recentChangesLine( &$baseRC, $watched = false ) {
@@ -596,13 +613,16 @@
$users = ' <span class="changedby">[' . implode( $this->message['semicolon-separator'], $users ) . ']</span>';
- # Arrow
- $rci = 'RCI'.$this->rcCacheIndex;
- $rcl = 'RCL'.$this->rcCacheIndex;
- $rcm = 'RCM'.$this->rcCacheIndex;
- $toggleLink = "javascript:toggleVisibility('$rci','$rcm','$rcl')";
- $tl = '<span id="'.$rcm.'"><a href="'.$toggleLink.'">' . $this->sideArrow() . '</a></span>';
- $tl .= '<span id="'.$rcl.'" style="display:none"><a href="'.$toggleLink.'">' . $this->downArrow() . '</a></span>';
+ # ID for JS visibility toggle
+ $jsid = $this->rcCacheIndex;
+ # onclick handler to toggle hidden/expanded
+ $toggleLink = "onclick='toggleVisibility($jsid); return false'";
+ # Title for <a> tags
+ $expandTitle = wfMsg('rc-enhanced-expand');
+ $closeTitle = wfMsg('rc-enhanced-hide');
+
+ $tl = "<span id='mw-rc-openarrow-$jsid' class='mw-changeslist-expanded' style='visibility:hidden'><a href='#' $toggleLink title='$expandTitle'>" . $this->sideArrow() . "</a></span>";
+ $tl .= "<span id='mw-rc-closearrow-$jsid' class='mw-changeslist-hidden' style='display:none'><a href='#' $toggleLink title='$closeTitle'>" . $this->downArrow() . "</a></span>";
$r .= '<td valign="top" style="white-space: nowrap"><tt>'.$tl.' ';
# Main line
@@ -680,7 +700,7 @@
$r .= "</td></tr></table>\n";
# Sub-entries
- $r .= '<div id="'.$rci.'" style="display:none;"><table cellpadding="0" cellspacing="0" border="0" style="background: none">';
+ $r .= '<div id="mw-rc-subentries-'.$jsid.'" class="mw-changeslist-hidden"><table cellpadding="0" cellspacing="0" border="0" style="background: none">';
foreach( $block as $rcObj ) {
# Get rc_xxxx variables
// FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
@@ -759,11 +779,10 @@
* @param string $alt text
* @return string HTML <img> tag
*/
- protected function arrow( $dir, $alt='' ) {
+ protected function arrow( $dir ) {
global $wgStylePath;
$encUrl = htmlspecialchars( $wgStylePath . '/common/images/Arr_' . $dir . '.png' );
- $encAlt = htmlspecialchars( $alt );
- return "<img src=\"$encUrl\" width=\"12\" height=\"12\" alt=\"$encAlt\" />";
+ return "<img src=\"$encUrl\" width=\"12\" height=\"12\" />";
}
/**
@@ -774,7 +793,7 @@
protected function sideArrow() {
global $wgContLang;
$dir = $wgContLang->isRTL() ? 'l' : 'r';
- return $this->arrow( $dir, '+' );
+ return $this->arrow( $dir );
}
/**
@@ -783,7 +802,7 @@
* @return string HTML <img> tag
*/
protected function downArrow() {
- return $this->arrow( 'd', '-' );
+ return $this->arrow( 'd' );
}
/**
@@ -791,7 +810,7 @@
* @return string HTML <img> tag
*/
protected function spacerArrow() {
- return $this->arrow( '', ' ' );
+ return $this->arrow( '' );
}
/**
Index: trunk/phase3/languages/messages/MessagesEn.php
===================================================================
--- trunk/phase3/languages/messages/MessagesEn.php (revision 42575)
+++ trunk/phase3/languages/messages/MessagesEn.php (revision 42576)
@@ -1714,6 +1714,8 @@
'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',
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES (revision 42575)
+++ trunk/phase3/RELEASE-NOTES (revision 42576)
@@ -283,6 +283,8 @@
* (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 ===