* Added $wgDisableTitleConversion to disabling the conversion for all pages on the...
authorShinjiman <shinjiman@users.mediawiki.org>
Thu, 7 Aug 2008 14:26:34 +0000 (14:26 +0000)
committerShinjiman <shinjiman@users.mediawiki.org>
Thu, 7 Aug 2008 14:26:34 +0000 (14:26 +0000)
* Added 'noconvertlink' toogle that can be set per user preferences, also added 'convertlink=no|yes' on GET requests whether have the link titles being converted or not
  patches by PhiLiP

12 files changed:
RELEASE-NOTES
includes/DefaultSettings.php
includes/User.php
includes/specials/SpecialPreferences.php
languages/LanguageConverter.php
languages/messages/MessagesEn.php
languages/messages/MessagesYue.php
languages/messages/MessagesZh_classical.php
languages/messages/MessagesZh_hans.php
languages/messages/MessagesZh_hant.php
maintenance/language/messageTypes.inc
maintenance/language/messages.inc

index b6e5619..9c2f313 100644 (file)
@@ -47,6 +47,11 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 14377) Add a date selector to history pages
 * (bug 15007) New 'pagetitle-view-mainpage' message allows the HTML <title> of
   the main page to be customized
+* Added $wgDisableTitleConversion to disabling the conversion for all pages on 
+  the wiki
+* Added 'noconvertlink' toogle that can be set per user preferences, also 
+  added 'convertlink=no|yes' on GET requests whether have the link titles 
+  being converted or not
 
 === Bug fixes in 1.14 ===
 
index 654f0cf..b765bfb 100644 (file)
@@ -861,6 +861,9 @@ $wgCheckSerialized = true;
 /** Whether to enable language variant conversion. */
 $wgDisableLangConversion = false;
 
+/** Whether to enable language variant conversion for links. */
+$wgDisableTitleConversion = false;
+
 /** Default variant code, if false, the default will be the language code */
 $wgDefaultLanguageVariant = false;
 
@@ -2226,6 +2229,7 @@ $wgDefaultUserOptions = array(
        'watchdefault'            => 0,
        'watchmoves'              => 0,
        'watchdeletion'           => 0,
+       'convertlink'             => 0,
 );
 
 /** Whether or not to allow and use real name fields. Defaults to true. */
index 97509d6..59c8c4c 100644 (file)
@@ -88,6 +88,7 @@ class User {
                'ccmeonemails',
                'diffonly',
                'showhiddencats',
+               'noconvertlink',
        );
 
        /**
index 4528296..8bf14d3 100644 (file)
@@ -513,7 +513,7 @@ class PreferencesForm {
        function mainPrefsForm( $status , $message = '' ) {
                global $wgUser, $wgOut, $wgLang, $wgContLang;
                global $wgAllowRealName, $wgImageLimits, $wgThumbLimits;
-               global $wgDisableLangConversion;
+               global $wgDisableLangConversion, $wgDisableTitleConversion;
                global $wgEnotifWatchlist, $wgEnotifUserTalk,$wgEnotifMinorEdits;
                global $wgRCShowWatchingUsers, $wgEnotifRevealEditorAddress;
                global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication;
@@ -734,6 +734,16 @@ class PreferencesForm {
                                        )
                                );
                        }
+                       
+                       if(count($variantArray) > 1 && !$wgDisableLangConversion && !$wgDisableTitleConversion) {
+                               $wgOut->addHtml(
+                                       Xml::tags( 'tr', null,
+                                               Xml::tags( 'td', array( 'colspan' => '2' ),
+                                                       $this->getToggle( "noconvertlink" )
+                                               )
+                                       )
+                               );
+                       }
                }
 
                # Password
index bbf1597..f6fb37e 100644 (file)
@@ -374,8 +374,10 @@ class LanguageConverter {
         * @private
         */
        function convertTitle($text){
-               // check for __NOTC__ tag
-               if( !$this->mDoTitleConvert ) {
+               global $wgDisableTitleConversion, $wgUser;
+
+               // check for global param and __NOTC__ tag
+               if( $wgDisableTitleConversion || !$this->mDoTitleConvert || $wgUser->getOption('noconvertlink') == 1 ) {
                        $this->mTitleDisplay = $text;
                        return $text;
                }
@@ -389,7 +391,8 @@ class LanguageConverter {
                global $wgRequest;
                $isredir = $wgRequest->getText( 'redirect', 'yes' );
                $action = $wgRequest->getText( 'action' );
-               if ( $isredir == 'no' || $action == 'edit' ) {
+               $linkconvert = $wgRequest->getText( 'linkconvert', 'yes' );
+               if ( $isredir == 'no' || $action == 'edit' || $linkconvert == 'no' ) {
                        return $text;
                } else {
                        $this->mTitleDisplay = $this->convert($text);
@@ -467,11 +470,20 @@ class LanguageConverter {
         * @public
         */
        function findVariantLink( &$link, &$nt ) {
-               global $wgDisableLangConversion;
+               global $wgDisableLangConversion, $wgDisableTitleConversion, $wgRequest, $wgUser;
+               $isredir = $wgRequest->getText( 'redirect', 'yes' );
+               $action = $wgRequest->getText( 'action' );
+               $linkconvert = $wgRequest->getText( 'linkconvert', 'yes' );
+               $disableLinkConversion = $wgDisableLangConversion || $wgDisableTitleConversion;
                $linkBatch = new LinkBatch();
 
                $ns=NS_MAIN;
 
+               if ( $disableLinkConversion || $isredir == 'no' || $action == 'edit'
+                       || $linkconvert == 'no' || $wgUser->getOption('noconvertlink') == 1 ) {
+                       return;
+               }
+
                if(is_object($nt))
                        $ns = $nt->getNamespace();
 
@@ -497,8 +509,7 @@ class LanguageConverter {
                foreach( $titles as $varnt ) {
                        if( $varnt->getArticleID() > 0 ) {
                                $nt = $varnt;
-                               if( !$wgDisableLangConversion )
-                                       $link = $v;
+                               $link = $v;
                                break;
                        }
                }
index 5021772..0f747ea 100644 (file)
@@ -532,6 +532,7 @@ XHTML id names.
 'tog-ccmeonemails'            => 'Send me copies of e-mails I send to other users',
 'tog-diffonly'                => 'Do not show page content below diffs',
 'tog-showhiddencats'          => 'Show hidden categories',
+'tog-noconvertlink'           => 'Disable titles conversion', # only translate this message to other languages if you have to change it
 
 'underline-always'  => 'Always',
 'underline-never'   => 'Never',
index 4a098c0..9eae521 100644 (file)
@@ -180,6 +180,7 @@ $messages = array(
 'tog-ccmeonemails'            => '當我寄電郵畀其他人嗰陣寄返封副本畀我',
 'tog-diffonly'                => '響差異下面唔顯示頁面內容',
 'tog-showhiddencats'          => '顯示隱藏類',
+'tog-noconvertlink'           => '唔轉連結標題',
 
 'underline-always'  => '全部',
 'underline-never'   => '永不',
index 96564bf..c3c98a6 100644 (file)
@@ -109,6 +109,7 @@ $messages = array(
 'tog-watchlisthideown'        => '不哨己文',
 'tog-watchlisthidebots'       => '不哨僕文',
 'tog-showhiddencats'          => '示隱類',
+'tog-noconvertlink'           => '非轉鍵題',
 
 'underline-always'  => '恆',
 'underline-never'   => '絕',
index 28950d3..20886ce 100644 (file)
@@ -123,6 +123,7 @@ $messages = array(
 'tog-ccmeonemails'            => '把我发送给其他用户的邮件同时发送副本给我自己',
 'tog-diffonly'                => '在比较两个修订版本差异时不显示页面内容',
 'tog-showhiddencats'          => '显示隐藏分类',
+'tog-noconvertlink'           => '不转换链接标题',
 
 'underline-always'  => '总是使用',
 'underline-never'   => '从不使用',
index d9c8ebd..9ae980d 100644 (file)
@@ -105,6 +105,7 @@ $messages = array(
 'tog-ccmeonemails'            => '當我寄電子郵件給其他用戶時,也寄一份複本到我的信箱。',
 'tog-diffonly'                => '在比較兩個修訂版本差異時不顯示頁面內容',
 'tog-showhiddencats'          => '顯示隱藏分類',
+'tog-noconvertlink'           => '不轉換連結標題',
 
 'underline-always'  => '總是使用',
 'underline-never'   => '從不使用',
index 8a62a2a..0b56e53 100644 (file)
@@ -163,6 +163,7 @@ $wgOptionalMessages = array(
        'unit-pixel',
        'userrights-irreversible-marker',
        'tog-nolangconversion',
+       'tog-noconvertlink',
        'yourvariant',
        'variantname-zh-hans',
        'variantname-zh-hant',
index 42c5b22..b281569 100644 (file)
@@ -52,6 +52,7 @@ $wgMessageStructure = array(
                'tog-ccmeonemails',
                'tog-diffonly',
                'tog-showhiddencats',
+               'tog-noconvertlink',
        ),
        'underline' => array(
                'underline-always',