Much improved ability to disable dynamic dates in LocalSettings
authorTim Starling <tstarling@users.mediawiki.org>
Sun, 6 Jul 2003 02:48:06 +0000 (02:48 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Sun, 6 Jul 2003 02:48:06 +0000 (02:48 +0000)
LocalSettings.sample
includes/OutputPage.php
includes/SpecialPreferences.php
languages/Language.php

index 0bafdf7..3a35391 100644 (file)
@@ -47,6 +47,8 @@ $wgDBtransactions   = false; # Set to true if using InnoDB tables
 # $wgLanguageCode = "de";
 
 $wgUseTeX                      = false;
+$wgUseDynamicDates     = true;
+
 $wgLocalInterwiki   = "w";
 
 $wgInputEncoding       = "ISO-8859-1";
index b026906..17586b0 100644 (file)
@@ -658,7 +658,7 @@ class OutputPage {
        #
        function doWikiPass2( $text, $linestart )
        {
-               global $wgUser, $wgLang, $wgMungeDates;
+               global $wgUser, $wgLang, $wgUseDynamicDates;
                wfProfileIn( "OutputPage::doWikiPass2" );
                
                $text = $this->removeHTMLtags( $text );
@@ -671,8 +671,10 @@ class OutputPage {
                $text = $this->doHeadings( $text );
                $text = $this->doBlockLevels( $text, $linestart );
                
-               if($wgMungeDates)
+               if($wgUseDynamicDates) {
                        $text = $wgLang->replaceDates( $text );
+               }
+
                $text = $this->replaceExternalLinks( $text );
                $text = $this->replaceInternalLinks ( $text );
 
index edb705c..0712d5a 100644 (file)
@@ -1,7 +1,7 @@
 <?
 function wfSpecialPreferences()
 {
-       global $wgUser, $wgOut, $action;
+       global $wgUser, $wgOut, $wgUseDynamicDates, $action;
        global $wpSaveprefs, $wpReset;
 
        $fields = array( "wpOldpass", "wpNewpass", "wpRetype",
@@ -196,7 +196,7 @@ function wfSpecialPreferences()
 
 /* private */ function mainPrefsForm( $err )
 {
-       global $wgUser, $wgOut, $wgLang;
+       global $wgUser, $wgOut, $wgLang, $wgUseDynamicDates;
        global $wpQuickbar, $wpOldpass, $wpNewpass, $wpRetype;
        global $wpSkin, $wpMath, $wpDate, $wpEmail, $wpEmailFlag, $wpNick, $wpSearch, $wpRecent;
        global $wpRows, $wpCols, $wpSaveprefs, $wpReset, $wpHourDiff;
@@ -243,7 +243,7 @@ function wfSpecialPreferences()
        $yem = wfMsg( "youremail" );
        $emf = wfMsg( "emailflag" );
        $ynn = wfMsg( "yournick" );
-        $stt = wfMsg ( "stubthreshold" ) ;
+       $stt = wfMsg ( "stubthreshold" ) ;
        $srh = wfMsg( "searchresultshead" );
        $rpp = wfMsg( "resultsperpage" );
        $scl = wfMsg( "contextlines" );
@@ -287,7 +287,11 @@ value=\"$i\"$checked> {$skins[$i]}</label><br>\n" );
 
        # Various checkbox options
        #
-       $wgOut->addHTML( "</td><td rowspan=3 valign=top nowrap>\n" );
+       if ( $wgUseDynamicDates ) {
+               $wgOut->addHTML( "</td><td rowspan=3 valign=top nowrap>\n" );
+       } else {
+               $wgOut->addHTML( "</td><td rowspan=2 valign=top nowrap>\n" );
+       }
        foreach ( $togs as $tname => $ttext ) {
                if ( 1 == $wgUser->getOption( $tname ) ) {
                        $checked = " checked";
@@ -312,16 +316,19 @@ value=\"$i\"$checked> {$mathopts[$i]}</label><br>\n" );
        
        # Date format
        #
-       $wgOut->addHTML( "<tr><td valign=top nowrap><b>$dateFormat:</b><br>" );
-       for ( $i = 0; $i < count( $dateopts ); ++$i) {
-               if ( $i == $wpDate ) {
-                       $checked = " checked";
-               } else {
-                       $checked = "";
+       if ( $wgUseDynamicDates ) {
+               $wgOut->addHTML( "<tr><td valign=top nowrap><b>$dateFormat:</b><br>" );
+               for ( $i = 0; $i < count( $dateopts ); ++$i) {
+                       if ( $i == $wpDate ) {
+                               $checked = " checked";
+                       } else {
+                               $checked = "";
+                       }
+                       $wgOut->addHTML( "<label><input type=radio name=\"wpDate\" ".
+                               "value=\"$i\"$checked> {$dateopts[$i]}</label><br>\n" );
                }
-               $wgOut->addHTML( "<label><input type=radio name=\"wpDate\" value=\"$i\"$checked> {$dateopts[$i]}</label><br>\n" );
+               $wgOut->addHTML( "</td></tr>");
        }
-       $wgOut->addHTML( "</td></tr>");
        # Textbox rows, cols
        #
        $nowlocal = $wgLang->time( $now = wfTimestampNow(), true );
index 355adcb..ec946a7 100644 (file)
@@ -1222,12 +1222,16 @@ class Language {
  
        function date( $ts, $adj = false )
        {
-               global $wgAmericanDates, $wgUser;
+               global $wgAmericanDates, $wgUser, $wgUseDynamicDates;
 
                if ( $adj ) { $ts = $this->userAdjust( $ts ); }
-
-               $datePreference = $wgUser->getOption( 'date' );         
-               if ( $datePreference == 0 ) {
+               
+               if ( $wgUseDynamicDates ) {
+                       $datePreference = $wgUser->getOption( 'date' );         
+                       if ( $datePreference == 0 ) {
+                               $datePreference = $wgAmericanDates ? 1 : 2;
+                       }
+               } else {
                        $datePreference = $wgAmericanDates ? 1 : 2;
                }
                
@@ -1371,8 +1375,13 @@ class Language {
 
        function replaceDates( $text )
        {
-               global $wgUser, $wgInputEncoding;
+               global $wgUser, $wgInputEncoding, $wgUseDynamicDates;
                
+               # Feature can be disabled
+               if ( !$wgUseDynamicDates ) {
+                       return;
+               }
+
                # Setup
                
                $datePreference = $wgUser->getOption( 'date' );