Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -18,6 +18,7 @@ |
19 | 19 | if running prior to 4.2.0 as it causes the call to fail |
20 | 20 | * (bug 3117) Fix display of upload size and type with tidy on |
21 | 21 | * (bug 3076) Support MacBinary-encoded uploads from IE/Mac |
| 22 | +* (bug 2323) Remove "last" tabindex from history page |
22 | 23 | |
23 | 24 | |
24 | 25 | === Caveats === |
Index: trunk/phase3/includes/PageHistory.php |
— | — | @@ -42,6 +42,8 @@ |
43 | 43 | $this->mTitle =& $article->mTitle; |
44 | 44 | $this->mNotificationTimestamp = NULL; |
45 | 45 | $this->mSkin = $wgUser->getSkin(); |
| 46 | + |
| 47 | + $this->defaultLimit = 50; |
46 | 48 | } |
47 | 49 | |
48 | 50 | /** |
— | — | @@ -64,8 +66,6 @@ |
65 | 67 | $fname = 'PageHistory::history'; |
66 | 68 | wfProfileIn( $fname ); |
67 | 69 | |
68 | | - $dbr = wfGetDB(DB_SLAVE); |
69 | | - |
70 | 70 | /* |
71 | 71 | * Setup page variables. |
72 | 72 | */ |
— | — | @@ -78,33 +78,34 @@ |
79 | 79 | /* |
80 | 80 | * Fail if article doesn't exist. |
81 | 81 | */ |
82 | | - $id = $this->mTitle->getArticleID(); |
83 | | - if( $id == 0 ) { |
| 82 | + if( !$this->mTitle->exists() ) { |
84 | 83 | $wgOut->addWikiText( wfMsg( 'nohistory' ) ); |
85 | 84 | wfProfileOut( $fname ); |
86 | 85 | return; |
87 | 86 | } |
88 | 87 | |
| 88 | + $dbr =& wfGetDB(DB_SLAVE); |
| 89 | + |
89 | 90 | /* |
90 | 91 | * Extract limit, the number of revisions to show, and |
91 | 92 | * offset, the timestamp to begin at, from the URL. |
92 | 93 | */ |
93 | | - $limit = $wgRequest->getInt('limit', 50); |
| 94 | + $limit = $wgRequest->getInt('limit', $this->defaultLimit); |
94 | 95 | $offset = $wgRequest->getText('offset'); |
95 | 96 | |
96 | 97 | /* Offset must be an integral. */ |
97 | 98 | if (!strlen($offset) || !preg_match("/^[0-9]+$/", $offset)) |
98 | 99 | $offset = 0; |
99 | 100 | # $offset = $dbr->timestamp($offset); |
100 | | - $dboffset = $dbr->timestamp($offset); |
101 | | -wfdebug("offset=[$offset] dboffset=[$dboffset]\n"); |
| 101 | + $dboffset = $offset === 0 ? 0 : $dbr->timestamp($offset); |
| 102 | + wfdebug("offset=[$offset] dboffset=[$dboffset]\n"); |
102 | 103 | /* |
103 | 104 | * "go=last" means to jump to the last history page. |
104 | 105 | */ |
105 | 106 | if (($gowhere = $wgRequest->getText("go")) !== NULL) { |
106 | 107 | switch ($gowhere) { |
107 | 108 | case "first": |
108 | | - if (($lastid = $this->getLastOffsetForPaging($id, $limit)) === NULL) |
| 109 | + if (($lastid = $this->getLastOffsetForPaging($this->mTitle->getArticleID(), $limit)) === NULL) |
109 | 110 | break; |
110 | 111 | $gourl = $wgTitle->getLocalURL("action=history&limit={$limit}&offset=". |
111 | 112 | wfTimestamp(TS_MW, $lastid)); |
— | — | @@ -156,9 +157,10 @@ |
157 | 158 | * Print each revision, excluding the one-past-the-end, if any. |
158 | 159 | */ |
159 | 160 | foreach (array_slice($revisions, 0, $limit) as $i => $line) { |
160 | | - $first = !$i && $offset == 0; |
| 161 | + $latest = !$i && $offset == 0; |
| 162 | + $firstInList = !$i; |
161 | 163 | $next = isset( $revisions[$i + 1] ) ? $revisions[$i + 1 ] : null; |
162 | | - $s .= $this->historyLine($line, $next, $counter, $this->getNotificationTimestamp(), $first); |
| 164 | + $s .= $this->historyLine($line, $next, $counter, $this->getNotificationTimestamp(), $latest, $firstInList); |
163 | 165 | $counter++; |
164 | 166 | } |
165 | 167 | |
— | — | @@ -182,12 +184,12 @@ |
183 | 185 | function beginHistoryList() { |
184 | 186 | global $wgTitle; |
185 | 187 | $this->lastdate = ''; |
186 | | - $s = '<p>' . wfMsg( 'histlegend' ) . '</p>'; |
| 188 | + $s = wfMsgWikiHtml( 'histlegend' ); |
187 | 189 | $s .= '<form action="' . $wgTitle->escapeLocalURL( '-' ) . '" method="get">'; |
188 | 190 | $prefixedkey = htmlspecialchars($wgTitle->getPrefixedDbKey()); |
189 | | - $s .= "<input type='hidden' name='title' value=\"{$prefixedkey}\" />\n"; |
| 191 | + $s .= "<input type='hidden' name='title' value='{$prefixedkey}' />\n"; |
190 | 192 | $s .= $this->submitButton(); |
191 | | - $s .= '<ul id="pagehistory">'; |
| 193 | + $s .= '<ul id="pagehistory">' . "\n"; |
192 | 194 | return $s; |
193 | 195 | } |
194 | 196 | |
— | — | @@ -208,26 +210,17 @@ |
209 | 211 | array( |
210 | 212 | 'class' => 'historysubmit', |
211 | 213 | 'type' => 'submit', |
212 | | - 'accesskey' => wfMsg( 'accesskey-compareselectedversions' ), |
213 | | - 'title' => wfMsg( 'tooltip-compareselectedversions' ), |
214 | | - 'value' => wfMsg( 'compareselectedversions' ), |
| 214 | + 'accesskey' => wfMsgHtml( 'accesskey-compareselectedversions' ), |
| 215 | + 'title' => wfMsgHtml( 'tooltip-compareselectedversions' ), |
| 216 | + 'value' => wfMsgHtml( 'compareselectedversions' ), |
215 | 217 | ) ) ) |
216 | 218 | : ''; |
217 | 219 | } |
218 | 220 | |
219 | 221 | /** @todo document */ |
220 | | - function historyLine( $row, $next, $counter = '', $notificationtimestamp = false, $latest = false ) { |
| 222 | + function historyLine( $row, $next, $counter = '', $notificationtimestamp = false, $latest = false, $firstInList = false ) { |
221 | 223 | global $wgLang, $wgContLang; |
222 | 224 | |
223 | | - static $message; |
224 | | - if( !isset( $message ) ) { |
225 | | - foreach( explode( ' ', 'cur last selectolderversionfordiff selectnewerversionfordiff minoreditletter' ) as $msg ) { |
226 | | - $message[$msg] = wfMsg( $msg ); |
227 | | - } |
228 | | - } |
229 | | - |
230 | | - $link = $this->revLink( $row ); |
231 | | - |
232 | 225 | if ( 0 == $row->rev_user ) { |
233 | 226 | $contribsPage =& Title::makeTitle( NS_SPECIAL, 'Contributions' ); |
234 | 227 | $ul = $this->mSkin->makeKnownLinkObj( $contribsPage, |
— | — | @@ -239,26 +232,29 @@ |
240 | 233 | } |
241 | 234 | |
242 | 235 | $s = '<li>'; |
| 236 | + /* This feature is not yet used according to schema */ |
243 | 237 | if( $row->rev_deleted ) { |
244 | | - $s .= '<span class="deleted">'; |
| 238 | + $s .= '<span class="history-deleted">'; |
245 | 239 | } |
246 | 240 | $curlink = $this->curLink( $row, $latest ); |
247 | 241 | $lastlink = $this->lastLink( $row, $next, $counter ); |
248 | | - $arbitrary = $this->diffButtons( $row, $latest, $counter ); |
249 | | - $s .= "({$curlink}) ({$lastlink}) $arbitrary {$link} <span class='user'>{$ul}</span>"; |
| 242 | + $arbitrary = $this->diffButtons( $row, $firstInList, $counter ); |
| 243 | + $link = $this->revLink( $row ); |
250 | 244 | |
| 245 | + $s .= "($curlink) ($lastlink) $arbitrary $link <span class='history-user'>$ul</span>"; |
| 246 | + |
251 | 247 | if( $row->rev_minor_edit ) { |
252 | | - $s .= ' ' . wfElement( 'span', array( 'class' => 'minor' ), $message['minoreditletter'] ); |
| 248 | + $s .= ' ' . wfElement( 'span', array( 'class' => 'minor' ), wfMsgHtml( 'minoreditletter') ); |
253 | 249 | } |
254 | 250 | |
255 | 251 | $s .= $this->mSkin->commentBlock( $row->rev_comment, $this->mTitle ); |
256 | | - if ($this->getNotificationTimestamp() && ($row->rev_timestamp >= $this->getNotificationTimestamp())) { |
257 | | - $s .= wfMsg( 'updatedmarker' ); |
| 252 | + if ($notificationtimestamp && ($row->rev_timestamp >= $notificationtimestamp)) { |
| 253 | + $s .= ' <span class="updatedmarker">' . wfMsgHtml( 'updatedmarker' ) . '</span>'; |
258 | 254 | } |
259 | 255 | if( $row->rev_deleted ) { |
260 | | - $s .= "</span> " . htmlspecialchars( wfMsg( 'deletedrev' ) ); |
| 256 | + $s .= '</span> ' . wfMsgHtml( 'deletedrev' ); |
261 | 257 | } |
262 | | - $s .= '</li>'; |
| 258 | + $s .= "</li>\n"; |
263 | 259 | |
264 | 260 | return $s; |
265 | 261 | } |
— | — | @@ -271,25 +267,22 @@ |
272 | 268 | return $date; |
273 | 269 | } else { |
274 | 270 | return $this->mSkin->makeKnownLinkObj( |
275 | | - $this->mTitle, |
276 | | - $date, |
277 | | - 'oldid='.$row->rev_id ); |
| 271 | + $this->mTitle, $date, "oldid={$row->rev_id}" ); |
278 | 272 | } |
279 | 273 | } |
280 | 274 | |
281 | 275 | /** @todo document */ |
282 | 276 | function curLink( $row, $latest ) { |
283 | 277 | global $wgUser; |
284 | | - $cur = htmlspecialchars( wfMsg( 'cur' ) ); |
| 278 | + $cur = wfMsgHtml( 'cur' ); |
285 | 279 | if( $latest |
286 | 280 | || ( $row->rev_deleted && !$wgUser->isAllowed( 'undelete' ) ) ) { |
287 | 281 | return $cur; |
288 | 282 | } else { |
289 | 283 | return $this->mSkin->makeKnownLinkObj( |
290 | | - $this->mTitle, |
291 | | - $cur, |
292 | | - 'diff=' . $this->getLatestID($this->mTitle->getArticleID()) |
293 | | - . '&oldid=' . $row->rev_id ); |
| 284 | + $this->mTitle, $cur, |
| 285 | + 'diff=' . $this->getLatestID() . |
| 286 | + "&oldid={$row->rev_id}" ); |
294 | 287 | } |
295 | 288 | } |
296 | 289 | |
— | — | @@ -302,30 +295,33 @@ |
303 | 296 | return $last; |
304 | 297 | } else { |
305 | 298 | return $this->mSkin->makeKnownLinkObj( |
306 | | - $this->mTitle, |
307 | | - $last, |
308 | | - "diff={$row->rev_id}&oldid={$next->rev_id}", |
309 | | - '', |
310 | | - '', |
311 | | - ' tabindex="'.$counter.'"' ); |
| 299 | + $this->mTitle, |
| 300 | + $last, |
| 301 | + "diff={$row->rev_id}&oldid={$next->rev_id}" |
| 302 | + /*, |
| 303 | + '', |
| 304 | + '', |
| 305 | + "tabindex={$counter}"*/ ); |
312 | 306 | } |
313 | 307 | } |
314 | 308 | |
315 | 309 | /** @todo document */ |
316 | | - function diffButtons( $row, $latest, $counter ) { |
| 310 | + function diffButtons( $row, $firstInList, $counter ) { |
317 | 311 | global $wgUser; |
318 | 312 | if( $this->linesonpage > 1) { |
319 | 313 | $radio = array( |
320 | 314 | 'type' => 'radio', |
321 | 315 | 'value' => $row->rev_id, |
322 | | - 'title' => wfMsg( 'selectolderversionfordiff' ) |
| 316 | +# do we really need to flood this on every item? |
| 317 | +# 'title' => wfMsgHtml( 'selectolderversionfordiff' ) |
323 | 318 | ); |
| 319 | + |
324 | 320 | if( $row->rev_deleted && !$wgUser->isAllowed( 'undelete' ) ) { |
325 | 321 | $radio['disabled'] = 'disabled'; |
326 | 322 | } |
327 | 323 | |
328 | | - # XXX: move title texts to javascript |
329 | | - if ( $latest ) { |
| 324 | + /** @todo: move title texts to javascript */ |
| 325 | + if ( $firstInList ) { |
330 | 326 | $first = wfElement( 'input', array_merge( |
331 | 327 | $radio, |
332 | 328 | array( |
— | — | @@ -355,12 +351,14 @@ |
356 | 352 | } |
357 | 353 | |
358 | 354 | /** @todo document */ |
359 | | - function getLatestOffset($id) { |
| 355 | + function getLatestOffset( $id = null ) { |
| 356 | + if ( $id === null) $id = $this->mTitle->getArticleID(); |
360 | 357 | return $this->getExtremeOffset( $id, 'max' ); |
361 | 358 | } |
362 | 359 | |
363 | 360 | /** @todo document */ |
364 | | - function getEarliestOffset($id) { |
| 361 | + function getEarliestOffset( $id = null ) { |
| 362 | + if ( $id === null) $id = $this->mTitle->getArticleID(); |
365 | 363 | return $this->getExtremeOffset( $id, 'min' ); |
366 | 364 | } |
367 | 365 | |
— | — | @@ -374,7 +372,8 @@ |
375 | 373 | } |
376 | 374 | |
377 | 375 | /** @todo document */ |
378 | | - function getLatestID( $id ) { |
| 376 | + function getLatestID( $id = null ) { |
| 377 | + if ( $id === null) $id = $this->mTitle->getArticleID(); |
379 | 378 | $db =& wfGetDB(DB_SLAVE); |
380 | 379 | return $db->selectField( 'revision', |
381 | 380 | "max(rev_id)", |
— | — | @@ -383,15 +382,18 @@ |
384 | 383 | } |
385 | 384 | |
386 | 385 | /** @todo document */ |
387 | | - function getLastOffsetForPaging( $id, $step = 50 ) { |
388 | | - $db =& wfGetDB(DB_SLAVE); |
389 | | - $revision = $db->tableName( 'revision' ); |
390 | | - $sql = "SELECT rev_timestamp FROM $revision WHERE rev_page = $id " . |
391 | | - "ORDER BY rev_timestamp ASC"; |
392 | | - $sql = $db->limitResult($sql, $step, 0); |
393 | | - $res = $db->query( $sql, "PageHistory::getLastOffsetForPaging" ); |
394 | | - $n = $db->numRows( $res ); |
| 386 | + function getLastOffsetForPaging( $id, $step ) { |
| 387 | + $fname = 'PageHistory::getLastOffsetForPaging'; |
395 | 388 | |
| 389 | + $dbr =& wfGetDB(DB_SLAVE); |
| 390 | + $res = $dbr->select( |
| 391 | + 'revision', |
| 392 | + 'rev_timestamp', |
| 393 | + "rev_page=$id", |
| 394 | + $fname, |
| 395 | + array('ORDER BY' => 'rev_timestamp ASC', 'LIMIT' => $step)); |
| 396 | + |
| 397 | + $n = $dbr->numRows( $res ); |
396 | 398 | $last = null; |
397 | 399 | while( $obj = $db->fetchObject( $res ) ) { |
398 | 400 | $last = $obj->rev_timestamp; |
— | — | @@ -400,10 +402,11 @@ |
401 | 403 | return $last; |
402 | 404 | } |
403 | 405 | |
404 | | - /** @todo document */ |
| 406 | + /** |
| 407 | + * @return returns the direction of browsing watchlist |
| 408 | + */ |
405 | 409 | function getDirection() { |
406 | 410 | global $wgRequest; |
407 | | - |
408 | 411 | if ($wgRequest->getText("dir") == "prev") |
409 | 412 | return DIR_PREV; |
410 | 413 | else |
— | — | @@ -413,42 +416,34 @@ |
414 | 417 | /** @todo document */ |
415 | 418 | function fetchRevisions($limit, $offset, $direction) { |
416 | 419 | global $wgUser, $wgShowUpdatedMarker; |
| 420 | + $fname = 'PageHistory::fetchRevisions'; |
417 | 421 | |
418 | | - /* Check one extra row to see whether we need to show 'next' and diff links */ |
419 | | - $limitplus = $limit + 1; |
| 422 | + $dbr =& wfGetDB( DB_SLAVE ); |
420 | 423 | |
421 | | - $namespace = $this->mTitle->getNamespace(); |
422 | | - $title = $this->mTitle->getText(); |
423 | | - $uid = $wgUser->getID(); |
424 | | - $db =& wfGetDB( DB_SLAVE ); |
425 | | - |
426 | | - $use_index = $db->useIndexClause( 'page_timestamp' ); |
427 | | - $revision = $db->tableName( 'revision' ); |
428 | | - |
429 | | - $limits = $offsets = ""; |
430 | | - |
431 | 424 | if ($direction == DIR_PREV) |
432 | 425 | list($dirs, $oper) = array("ASC", ">="); |
433 | | - else /* $direction = DIR_NEXT */ |
| 426 | + else /* $direction == DIR_NEXT */ |
434 | 427 | list($dirs, $oper) = array("DESC", "<="); |
435 | 428 | |
436 | 429 | if ($offset) |
437 | | - $offsets .= " AND rev_timestamp $oper '$offset' "; |
| 430 | + $offsets = array("rev_timestamp $oper '$offset'"); |
| 431 | + else |
| 432 | + $offsets = array(); |
438 | 433 | |
439 | 434 | $page_id = $this->mTitle->getArticleID(); |
440 | 435 | |
441 | | - $sql = "SELECT rev_id,rev_user," . |
442 | | - "rev_comment,rev_user_text,rev_timestamp,rev_minor_edit,rev_deleted ". |
443 | | - "FROM $revision $use_index " . |
444 | | - "WHERE rev_page=$page_id " . |
445 | | - $offsets . |
446 | | - "ORDER BY rev_timestamp $dirs "; |
447 | | - if ($limit) |
448 | | - $sql = $db->limitResult($sql, $limitplus, 0); |
449 | | - $res = $db->query($sql, "PageHistory::fetchRevisions"); |
| 436 | + $res = $dbr->select( |
| 437 | + 'revision', |
| 438 | + array('rev_id', 'rev_user', 'rev_comment', 'rev_user_text', |
| 439 | + 'rev_timestamp', 'rev_minor_edit', 'rev_deleted'), |
| 440 | + array_merge(array("rev_page=$page_id"), $offsets), |
| 441 | + $fname, |
| 442 | + array('ORDER BY' => "rev_timestamp $dirs", |
| 443 | + 'USE INDEX' => 'page_timestamp', 'LIMIT' => $limit) |
| 444 | + ); |
450 | 445 | |
451 | 446 | $result = array(); |
452 | | - while (($obj = $db->fetchObject($res)) != NULL) |
| 447 | + while (($obj = $dbr->fetchObject($res)) != NULL) |
453 | 448 | $result[] = $obj; |
454 | 449 | |
455 | 450 | return $result; |
— | — | @@ -457,23 +452,24 @@ |
458 | 453 | /** @todo document */ |
459 | 454 | function getNotificationTimestamp() { |
460 | 455 | global $wgUser, $wgShowUpdatedMarker; |
| 456 | + $fname = 'PageHistory::getNotficationTimestamp'; |
461 | 457 | |
462 | 458 | if ($this->mNotificationTimestamp !== NULL) |
463 | 459 | return $this->mNotificationTimestamp; |
464 | 460 | |
465 | | - if ($wgUser->getID() == 0 || !$wgShowUpdatedMarker) |
| 461 | + if ($wgUser->isAnon() || !$wgShowUpdatedMarker) |
466 | 462 | return $this->mNotificationTimestamp = false; |
467 | 463 | |
468 | | - $db =& wfGetDB(DB_SLAVE); |
| 464 | + $dbr =& wfGetDB(DB_SLAVE); |
469 | 465 | |
470 | | - $this->mNotificationTimestamp = $db->selectField( |
| 466 | + $this->mNotificationTimestamp = $dbr->selectField( |
471 | 467 | 'watchlist', |
472 | 468 | 'wl_notificationtimestamp', |
473 | 469 | array( 'wl_namespace' => $this->mTitle->getNamespace(), |
474 | 470 | 'wl_title' => $this->mTitle->getDBkey(), |
475 | 471 | 'wl_user' => $wgUser->getID() |
476 | 472 | ), |
477 | | - "PageHistory::getNotficationTimestamp"); |
| 473 | + $fname); |
478 | 474 | |
479 | 475 | return $this->mNotificationTimestamp; |
480 | 476 | } |
— | — | @@ -484,9 +480,8 @@ |
485 | 481 | |
486 | 482 | $revisions = array_slice($revisions, 0, $limit); |
487 | 483 | |
488 | | - $pageid = $this->mTitle->getArticleID(); |
489 | | - $latestTimestamp = wfTimestamp(TS_MW, $this->getLatestOffset( $pageid )); |
490 | | - $earliestTimestamp = wfTimestamp(TS_MW, $this->getEarliestOffset( $pageid )); |
| 484 | + $latestTimestamp = wfTimestamp(TS_MW, $this->getLatestOffset()); |
| 485 | + $earliestTimestamp = wfTimestamp(TS_MW, $this->getEarliestOffset()); |
491 | 486 | |
492 | 487 | /* |
493 | 488 | * When we're displaying previous revisions, we need to reverse |
— | — | @@ -507,43 +502,52 @@ |
508 | 503 | $earliestShown = wfTimestamp(TS_MW, $revisions[count($revisions) - 1]->rev_timestamp); |
509 | 504 | } |
510 | 505 | |
511 | | - $firsturl = $wgTitle->escapeLocalURL("action=history&limit={$limit}&go=first"); |
512 | | - $lasturl = $wgTitle->escapeLocalURL("action=history&limit={$limit}"); |
513 | | - $firsttext = wfMsgHtml('histfirst'); |
514 | | - $lasttext = wfMsgHtml('histlast'); |
| 506 | + /* Don't announce the limit everywhere if it's the default */ |
| 507 | + $usefulLimit = $limit == $this->defaultLimit ? '' : $limit; |
515 | 508 | |
516 | | - $prevurl = $wgTitle->escapeLocalURL("action=history&dir=prev&offset=$latestShown&limit={$limit}"); |
517 | | - $nexturl = $wgTitle->escapeLocalURL("action=history&offset=$earliestShown&limit={$limit}"); |
518 | | - |
519 | 509 | $urls = array(); |
520 | 510 | foreach (array(20, 50, 100, 250, 500) as $num) { |
521 | | - $urls[] = "<a href=\"".$wgTitle->escapeLocalURL( |
522 | | - "action=history&offset=" . wfTimestamp(TS_MW, $offset) . |
523 | | - "&limit={$num}")."\">".$wgLang->formatNum($num)."</a>"; |
| 511 | + $urls[] = $this->MakeLink( $wgLang->formatNum($num), |
| 512 | + array('offset' => $offset == 0 ? '' : wfTimestamp(TS_MW, $offset), 'limit' => $num, ) ); |
524 | 513 | } |
525 | 514 | |
526 | 515 | $bits = implode($urls, ' | '); |
527 | 516 | |
528 | 517 | wfDebug("latestShown=$latestShown latestTimestamp=$latestTimestamp\n"); |
529 | 518 | if( $latestShown < $latestTimestamp ) { |
530 | | - $prevtext = "<a href=\"$prevurl\">".wfMsgHtml("prevn", $limit)."</a>"; |
531 | | - $lasttext = "<a href=\"$lasturl\">$lasttext</a>"; |
| 519 | + $prevtext = $this->MakeLink( wfMsgHtml("prevn", $limit), |
| 520 | + array( 'dir' => 'prev', 'offset' => $latestShown, 'limit' => $usefulLimit ) ); |
| 521 | + $lasttext = $this->MakeLink( wfMsgHtml('histlast'), |
| 522 | + array( 'limit' => $usefulLimit ) ); |
532 | 523 | } else { |
533 | 524 | $prevtext = wfMsgHtml("prevn", $limit); |
| 525 | + $lasttext = wfMsgHtml('histlast'); |
534 | 526 | } |
535 | 527 | |
536 | 528 | wfDebug("earliestShown=$earliestShown earliestTimestamp=$earliestTimestamp\n"); |
537 | 529 | if( $earliestShown > $earliestTimestamp ) { |
538 | | - $nexttext = "<a href=\"$nexturl\">".wfMsgHtml("nextn", $limit)."</a>"; |
539 | | - $firsttext = "<a href=\"$firsturl\">$firsttext</a>"; |
| 530 | + $nexttext = $this->MakeLink( wfMsgHtml("nextn", $limit), |
| 531 | + array( 'offset' => $earliestShown, 'limit' => $usefulLimit ) ); |
| 532 | + $firsttext = $this->MakeLink( wfMsgHtml('histfirst'), |
| 533 | + array( 'go' => 'first', 'limit' => $usefulLimit ) ); |
540 | 534 | } else { |
541 | 535 | $nexttext = wfMsgHtml("nextn", $limit); |
| 536 | + $firsttext = wfMsgHtml('histfirst'); |
542 | 537 | } |
543 | 538 | |
544 | 539 | $firstlast = "($lasttext | $firsttext)"; |
545 | 540 | |
546 | 541 | return "$firstlast " . wfMsgHtml("viewprevnext", $prevtext, $nexttext, $bits); |
547 | 542 | } |
| 543 | + |
| 544 | + function MakeLink($text, $query = NULL) { |
| 545 | + if ( $query === null ) return $text; |
| 546 | + return $this->mSkin->makeKnownLinkObj( |
| 547 | + $this->mTitle, $text, |
| 548 | + wfArrayToCGI( $query, array( 'action' => 'history' ))); |
| 549 | + } |
| 550 | + |
| 551 | + |
548 | 552 | } |
549 | 553 | |
550 | 554 | ?> |
Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -388,6 +388,24 @@ |
389 | 389 | } |
390 | 390 | |
391 | 391 | /** |
| 392 | + * Return an HTML version of message |
| 393 | + * Parameter replacements, if any, are done *after* parsing the wiki-text message, |
| 394 | + * so parameters may contain HTML (eg links or form controls). Be sure |
| 395 | + * to pre-escape them if you really do want plaintext, or just wrap |
| 396 | + * the whole thing in htmlspecialchars(). |
| 397 | + * |
| 398 | + * @param string $key |
| 399 | + * @param string ... parameters |
| 400 | + * @return string |
| 401 | + */ |
| 402 | +function wfMsgWikiHtml( $key ) { |
| 403 | + global $wgOut; |
| 404 | + $args = func_get_args(); |
| 405 | + array_shift( $args ); |
| 406 | + return wfMsgReplaceArgs( $wgOut->parse( wfMsgGetKey( $key, true ), /* can't be set to false */ true ), $args ); |
| 407 | +} |
| 408 | + |
| 409 | +/** |
392 | 410 | * Just like exit() but makes a note of it. |
393 | 411 | * Commits open transactions except if the error parameter is set |
394 | 412 | */ |