SkinPHPTal:
authorGabriel Wicke <gwicke@users.mediawiki.org>
Thu, 22 Apr 2004 22:31:57 +0000 (22:31 +0000)
committerGabriel Wicke <gwicke@users.mediawiki.org>
Thu, 22 Apr 2004 22:31:57 +0000 (22:31 +0000)
* anon user links if enabled
* page title shows action if set

includes/SkinPHPTal.php
includes/memcached-client.php
languages/Language.php
stylesheets/monobook/main.css

index 1588207..c642ea5 100644 (file)
@@ -69,6 +69,8 @@
                        extract( $wgRequest->getValues( 'oldid', 'diff' ) );
 
                        $this->thispage = $wgTitle->getPrefixedDbKey();
+                       $this->thisurl = $wgTitle->getPrefixedURL();
+                       $this->thisurle = urlencode($this->thisurl);
                        $this->loggedin = $wgUser->getID() != 0;
                        $this->username = $wgUser->getName();
                        $this->userpage = $wgLang->getNsText( Namespace::getUser() ) . ":" . $wgUser->getName();
@@ -82,7 +84,9 @@
                        #}
 
                        $tpl->setRef( "title", &$this->titletxt ); // ?
-                       $tpl->set( "pagetitle", wfMsg( "pagetitle", $this->titletxt ) );
+                       $taction =  $this->getPageTitleActionText();
+                       $taction = !empty($taction)?' - '.$taction:'';
+                       $tpl->set( "pagetitle", wfMsg( "pagetitle", $this->titletxt.$taction ) );
                        $tpl->setRef( "thispage", &$this->thispage );
                        $tpl->set( "subtitle", $out->getSubtitle() );
                        $tpl->set( 'catlinks', getCategories());
                                        $ntl = wfMsg( "newmessages",
                                        $this->makeKnownLink( 
                                                $wgLang->getNsText( Namespace::getTalk( Namespace::getUser() ) )
-                                               . ":" . $wgUser->getName(),
+                                               . ":" . $this->username,
                                                wfMsg("newmessageslink") ) 
                                        );
                                }
                                'text' => ($wgLang->getLanguageName( $nt->getInterwiki()) != ''?$wgLang->getLanguageName( $nt->getInterwiki()) : $l),
                                'class' => $wgLang->isRTL() ? 'rtl' : 'ltr');
                        }
-                       if(count($language_urls) != 0 ) {
+                       if(count($language_urls)) {
                                $tpl->setRef( 'language_urls', &$language_urls);
                        } else {
                                $tpl->set('language_urls', false);
                # build array of urls for personal toolbar
                function buildPersonalUrls() {
                        /* set up the default links for the personal toolbar */
+                       global $wgShowIPinHeader;
                        $personal_urls = array();
                        if ($this->loggedin) {
-                               $personal_urls['userpage'] = array('text' => $this->username,
+                               $personal_urls['userpage'] = array(
+                                       'text' => $this->username,
                                        'href' => $this->makeUrl($this->userpage),
                                        'ttip' => wfMsg('tooltip-userpage'),
-                                       'akey' => wfMsg('accesskey-userpage'));
-                               $personal_urls['mytalk'] = array('text' => wfMsg('mytalk'),
+                                       'akey' => wfMsg('accesskey-userpage')
+                               );
+                               $personal_urls['mytalk'] = array(
+                                       'text' => wfMsg('mytalk'),
                                        'href' => $this->makeTalkUrl($this->userpage),
                                        'ttip' => wfMsg('tooltip-mytalk'),
-                                       'akey' => wfMsg('accesskey-mytalk'));
-                               $personal_urls['preferences'] = array('text' => wfMsg('preferences'),
+                                       'akey' => wfMsg('accesskey-mytalk')
+                               );
+                               $personal_urls['preferences'] = array(
+                                       'text' => wfMsg('preferences'),
                                        'href' => $this->makeSpecialUrl('Preferences'),
                                        'ttip' => wfMsg('tooltip-preferences'),
-                                       'akey' => wfMsg('accesskey-preferences'));
-                               $personal_urls['watchlist'] = array('text' => wfMsg('watchlist'),
+                                       'akey' => wfMsg('accesskey-preferences')
+                               );
+                               $personal_urls['watchlist'] = array(
+                                       'text' => wfMsg('watchlist'),
                                        'href' => $this->makeSpecialUrl('Watchlist'),
                                        'ttip' => wfMsg('tooltip-watchlist'),
-                                       'akey' => wfMsg('accesskey-watchlist'));
-                               $personal_urls['mycontris'] = array('text' => wfMsg('mycontris'),
+                                       'akey' => wfMsg('accesskey-watchlist')
+                               );
+                               $personal_urls['mycontris'] = array(
+                                       'text' => wfMsg('mycontris'),
                                        'href' => $this->makeSpecialUrl('Contributions','target=' . $this->username),
                                        'ttip' => wfMsg('tooltip-mycontris'),
-                                       'akey' => wfMsg('accesskey-mycontris'));
-                               $personal_urls['logout'] = array('text' => wfMsg('userlogout'),
-                                       'href' => $this->makeSpecialUrl('Userlogout','returnpage=' . $this->thispage),
+                                       'akey' => wfMsg('accesskey-mycontris')
+                               );
+                               $personal_urls['logout'] = array(
+                                       'text' => wfMsg('userlogout'),
+                                       'href' => $this->makeSpecialUrl('Userlogout','returnpage=' . $this->thisurle),
                                        'ttip' => wfMsg('tooltip-logout'),
-                                       'akey' => wfMsg('accesskey-logout'));
+                                       'akey' => wfMsg('accesskey-logout')
+                               );
                        } else {
-                               $personal_urls['login'] = array('text' => wfMsg('userlogin'),
-                                       'href' => $this->makeSpecialUrl('Userlogin'),
-                                       'ttip' => wfMsg('tooltip-login'),
-                                       'akey' => wfMsg('accesskey-login'));
+                               if( $wgShowIPinHeader && isset(  $_COOKIE[ini_get("session.name")] ) ) {
+                                       $personal_urls['anonuserpage'] = array(
+                                               'text' => $this->username,
+                                               'href' => $this->makeUrl($this->userpage),
+                                               'ttip' => wfMsg('tooltip-anonuserpage'),
+                                               'akey' => wfMsg('accesskey-anonuserpage')
+                                       );
+                                       $personal_urls['anontalk'] = array(
+                                               'text' => wfMsg('anontalk'),
+                                               'href' => $this->makeTalkUrl($this->userpage),
+                                               'ttip' => wfMsg('tooltip-anontalk'),
+                                               'akey' => wfMsg('accesskey-anontalk')
+                                       );
+                                       $personal_urls['anonlogin'] = array(
+                                               'text' => wfMsg('userlogin'),
+                                               'href' => $this->makeSpecialUrl('Userlogin', 'return='.$this->thisurle),
+                                               'ttip' => wfMsg('tooltip-login'),
+                                               'akey' => wfMsg('accesskey-login')
+                                       );
+                               } else {
+
+                                       $personal_urls['login'] = array(
+                                               'text' => wfMsg('userlogin'),
+                                               'href' => $this->makeSpecialUrl('Userlogin', 'return='.$this->thisurle),
+                                               'ttip' => wfMsg('tooltip-login'),
+                                               'akey' => wfMsg('accesskey-login')
+                                       );
+                               }
                        }
+
                        return $personal_urls;
                }
                
                        return $nav_urls;
                }
 
+               function getPageTitleActionText () {
+                       global $action;
+                       switch($action) {
+                               case edit:
+                                       return  wfMsg('edit');
+                               case history:
+                                       return wfMsg('history_short');
+                               case protect:
+                                       return wfMsg('unprotect');
+                               case unprotect:
+                                       return wfMsg('unprotect');
+                               case delete:
+                                       return wfMsg('delete');
+                               case watch:
+                                       return wfMsg('watch');
+                               case unwatch:
+                                       return wfMsg('unwatch');
+                               default:
+                                       return '';
+                       }
+               }
                /*static*/ function makeSpecialUrl( $name, $urlaction='' ) {
                        $title = Title::makeTitle( NS_SPECIAL, $name );
                        $this->checkTitle(&$title, &$name);     
index 934ca76..3f0eb44 100644 (file)
@@ -292,7 +292,7 @@ class memcached
       
       $key = is_array($key) ? $key[1] : $key;
       
-      $this->stats['delete']++;
+      @$this->stats['delete']++;
       $cmd = "delete $key $time\r\n";
       if(!fwrite($sock, $cmd, strlen($cmd)))
       {
index 1d74ec6..7e26d5b 100644 (file)
@@ -491,6 +491,7 @@ $wgLanguageNamesEn =& $wgLanguageNames;
 "moredotdotdot"        => "More...",
 "mypage"               => "My page",
 "mytalk"               => "My talk",
+"anontalk"             => "Talk for this IP",
 'navigation' => 'Navigation',
 "currentevents" => "Current events",
 "disclaimers" => "Disclaimers",
@@ -1482,7 +1483,9 @@ amusement.",
 'accesskey-unwatch' => 'w',
 'accesskey-watchlist' => 'l',
 'accesskey-userpage' => '.',
+'accesskey-anonuserpage' => '.',
 'accesskey-mytalk' => 'n',
+'accesskey-anontalk' => 'n',
 'accesskey-preferences' => '',
 'accesskey-mycontris' => 'y',
 'accesskey-login' => 'o',
@@ -1521,7 +1524,9 @@ amusement.",
 'tooltip-unwatch' => 'Remove this page from your watchlist [alt-w]',
 'tooltip-watchlist' => 'The list of pages you\'re monitoring for changes. [alt-l]',
 'tooltip-userpage' => 'My user page [alt-.]',
+'tooltip-anonuserpage' => 'The user page for the ip you\'re editing as [alt-.]',
 'tooltip-mytalk' => 'My talk page [alt-n]',
+'tooltip-anontalk' => 'Discussion about edits from this ip address [alt-n]',
 'tooltip-preferences' => 'My preferences',
 'tooltip-mycontris' => 'List of my contributions [alt-y]',
 'tooltip-login' => 'You are encouraged to log in, it is not mandatory however. [alt-o]',
index 3ce0169..653e1b3 100644 (file)
@@ -816,6 +816,7 @@ input.searchButton {
 /* the icon in front of the user name, single quotes
 in bg url to hide it from iemac */
 li#personaltools-userpage,
+li#personaltools-anonuserpage,
 li#personaltools-login {
     background: transparent url('user.gif') center left no-repeat;
     background-repeat: no-repeat;