r8763 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r8762‎ | r8763 | r8764 >
Date:11:14, 30 April 2005
Author:vibber
Status:old
Tags:
Comment:
Restore the display of username and check for userpage/talkpage existence on
the user page / talk page links in SkinTemplate-based skins. In the future
we may do fancy ESI or something, but for now we weren't getting anything
out of hiding the changes and it harmed usability.
Modified paths:
  • /trunk/phase3/includes/SkinTemplate.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SkinTemplate.php
@@ -420,14 +420,16 @@
421421 global $wgShowIPinHeader;
422422 $personal_urls = array();
423423 if ($this->loggedin) {
424 - /* Logged in users personal toolbar */
425424 $personal_urls['userpage'] = array(
426 - 'text' => wfMsg('mypage'),
427 - 'href' => $this->makeSpecialUrl('Mypage')
 425+ 'text' => $this->username,
 426+ 'href' => &$this->userpageUrlDetails['href'],
 427+ 'class' => $this->userpageUrlDetails['exists']?false:'new'
428428 );
 429+ $usertalkUrlDetails = $this->makeTalkUrlDetails($this->userpage);
429430 $personal_urls['mytalk'] = array(
430431 'text' => wfMsg('mytalk'),
431 - 'href' => $this->makeSpecialUrl('Mytalk')
 432+ 'href' => &$usertalkUrlDetails['href'],
 433+ 'class' => $usertalkUrlDetails['exists']?false:'new'
432434 );
433435 $personal_urls['preferences'] = array(
434436 'text' => wfMsg('preferences'),
@@ -439,7 +441,7 @@
440442 );
441443 $personal_urls['mycontris'] = array(
442444 'text' => wfMsg('mycontris'),
443 - 'href' => $this->makeSpecialUrl('Mycontributions')
 445+ 'href' => $this->makeSpecialUrl('Contributions','target=' . urlencode( $this->username ) )
444446 );
445447 $personal_urls['logout'] = array(
446448 'text' => wfMsg('userlogout'),
@@ -447,22 +449,23 @@
448450 );
449451 } else {
450452 if( $wgShowIPinHeader && isset( $_COOKIE[ini_get("session.name")] ) ) {
451 - /* Anonymous with session users personal toolbar */
452453 $personal_urls['anonuserpage'] = array(
453 - 'text' => wfMsg('mypage'),
454 - 'href' => $this->makeSpecialUrl('Mypage')
 454+ 'text' => $this->username,
 455+ 'href' => &$this->userpageUrlDetails['href'],
 456+ 'class' => $this->userpageUrlDetails['exists']?false:'new'
455457 );
456 - $personal_urls['mytalk'] = array(
457 - 'text' => wfMsg('mytalk'),
458 - 'href' => $this->makeSpecialUrl('Mytalk')
 458+ $usertalkUrlDetails = $this->makeTalkUrlDetails($this->userpage);
 459+ $personal_urls['anontalk'] = array(
 460+ 'text' => wfMsg('anontalk'),
 461+ 'href' => &$usertalkUrlDetails['href'],
 462+ 'class' => $usertalkUrlDetails['exists']?false:'new'
459463 );
460 -
461464 $personal_urls['anonlogin'] = array(
462465 'text' => wfMsg('userlogin'),
463466 'href' => $this->makeSpecialUrl('Userlogin', 'returnto=' . $this->thisurl )
464467 );
465468 } else {
466 - /* Anonymous users personal toolbar */
 469+
467470 $personal_urls['login'] = array(
468471 'text' => wfMsg('userlogin'),
469472 'href' => $this->makeSpecialUrl('Userlogin', 'returnto=' . $this->thisurl )
@@ -487,7 +490,27 @@
488491 'text' => wfMsg( $message ),
489492 'href' => $title->getLocalUrl( $query ) );
490493 }
 494+
 495+ function makeTalkUrlDetails( $name, $urlaction='' ) {
 496+ $title = Title::newFromText( $name );
 497+ $title = $title->getTalkPage();
 498+ $this->checkTitle($title, $name);
 499+ return array(
 500+ 'href' => $title->getLocalURL( $urlaction ),
 501+ 'exists' => $title->getArticleID() != 0?true:false
 502+ );
 503+ }
491504
 505+ function makeArticleUrlDetails( $name, $urlaction='' ) {
 506+ $title = Title::newFromText( $name );
 507+ $title= $title->getSubjectPage();
 508+ $this->checkTitle($title, $name);
 509+ return array(
 510+ 'href' => $title->getLocalURL( $urlaction ),
 511+ 'exists' => $title->getArticleID() != 0?true:false
 512+ );
 513+ }
 514+
492515 /**
493516 * an array of edit links by default used for the tabs
494517 * @return array

Status & tagging log