From 4fcdceb81a162df2d114eff4b09cec19287781c4 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Sat, 25 Oct 2008 05:52:54 +0000 Subject: [PATCH] Reverted r42528. Links with href="#" make firefox scroll to the top of the page, regardless of onclick handler. --- RELEASE-NOTES | 2 -- includes/ChangesList.php | 47 ++++++++------------------- includes/DefaultSettings.php | 2 +- languages/messages/MessagesEn.php | 2 -- maintenance/language/messages.inc | 2 -- maintenance/storage/blob_tracking.sql | 8 ++++- maintenance/storage/trackBlobs.php | 12 +++---- skins/common/enhancedchanges.js | 39 ---------------------- skins/common/wikibits.js | 16 +++++++++ 9 files changed, 44 insertions(+), 86 deletions(-) delete mode 100644 skins/common/enhancedchanges.js diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 2735a65b86..1d850d61ff 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 f3984b3464..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)'"; - # 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/includes/DefaultSettings.php b/includes/DefaultSettings.php index b7b698c566..6607e4d37c 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1385,7 +1385,7 @@ $wgCacheEpoch = '20030516000000'; * to ensure that client-side caches don't keep obsolete copies of global * styles. */ -$wgStyleVersion = '183'; +$wgStyleVersion = '182'; # Server-side caching: diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 1b7ed87487..d03141e2b7 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1726,8 +1726,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 75de059d48..aba7ecf433 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -1050,8 +1050,6 @@ $wgMessageStructure = array( 'rc_categories_any', 'rc-change-size', 'newsectionsummary', - 'rc-enhanced-expand', - 'rc-enhanced-hide', ), 'recentchangeslinked' => array( 'recentchangeslinked', diff --git a/maintenance/storage/blob_tracking.sql b/maintenance/storage/blob_tracking.sql index 007aa8fedf..fe7aadfbdd 100644 --- a/maintenance/storage/blob_tracking.sql +++ b/maintenance/storage/blob_tracking.sql @@ -22,10 +22,16 @@ CREATE TABLE /*$wgDBprefix*/blob_tracking ( -- The CGZ content hash, or null bt_cgz_hash varbinary(255), + -- The URL this blob is to be moved to + bt_new_url varbinary(255), + + -- True if the text table has been updated to point to bt_new_url + bt_moved bool not null default 0, + PRIMARY KEY (bt_rev_id, bt_text_id), -- Sort by page for easy CGZ recompression - KEY (bt_page, bt_rev_id), + KEY (bt_moved, bt_page, bt_rev_id), -- For fast orphan searches KEY (bt_text_id), diff --git a/maintenance/storage/trackBlobs.php b/maintenance/storage/trackBlobs.php index 653a8c31f1..1b95b21e4d 100644 --- a/maintenance/storage/trackBlobs.php +++ b/maintenance/storage/trackBlobs.php @@ -6,6 +6,8 @@ require( dirname( __FILE__ ) .'/../commandLine.inc' ); if ( count( $args ) < 1 ) { echo "Usage: php trackBlobs.php [... ]\n"; echo "Adds blobs from a given ES cluster to the blob_tracking table\n"; + echo "Automatically deletes the tracking table and starts from the start again when restarted.\n"; + exit( 1 ); } $tracker = new TrackBlobs( $args ); @@ -42,9 +44,11 @@ class TrackBlobs { function initTrackingTable() { $dbw = wfGetDB( DB_MASTER ); - if ( !$dbw->tableExists( 'blob_tracking' ) ) { - $dbw->sourceFile( dirname( __FILE__ ) . '/blob_tracking.sql' ); + if ( $dbw->tableExists( 'blob_tracking' ) ) { + $dbw->query( 'DROP TABLE ' . $dbw->tableName( 'blob_tracking' ) ); + $dbw->query( 'DROP TABLE ' . $dbw->tableName( 'blob_orphans' ) ); } + $dbw->sourceFile( dirname( __FILE__ ) . '/blob_tracking.sql' ); } function getTextClause() { @@ -240,11 +244,7 @@ class TrackBlobs { return; } - # Wait until the blob_tracking table is available in the slave $dbw = wfGetDB( DB_MASTER ); - $dbr = wfGetDB( DB_SLAVE ); - $pos = $dbw->getMasterPos(); - $dbr->masterPosWait( $pos, 100000 ); foreach ( $this->clusters as $cluster ) { echo "Searching for orphan blobs in $cluster...\n"; 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