Disable page cache option; move RC javascript to wikibits.js; spiffy up timezone...
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 17 May 2003 06:06:31 +0000 (06:06 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 17 May 2003 06:06:31 +0000 (06:06 +0000)
includes/Skin.php
includes/SpecialPreferences.php
languages/Language.php
stylesheets/wikibits.js

index c8733ac..eff267a 100644 (file)
@@ -62,24 +62,8 @@ class Skin {
        }
 
        function getHeadScripts() {
-               $r = "
-<SCRIPT TYPE=\"text/javascript\">
-function toggleVisibility( _levelId, _otherId, _linkId) {
-       var thisLevel = document.getElementById( _levelId );
-       var otherLevel = document.getElementById( _otherId );
-       var linkLevel = document.getElementById( _linkId );
-       if ( thisLevel.style.display == 'none' ) {
-               thisLevel.style.display = 'block';
-               otherLevel.style.display = 'none';
-               linkLevel.style.display = 'inline';
-       } else {
-               thisLevel.style.display = 'none';
-               otherLevel.style.display = 'inline';
-               linkLevel.style.display = 'none';
-               }
-       }
-</SCRIPT>
-               " ;
+               global $wgStyleSheetPath;
+               $r = "<script type=\"text/javascript\" src=\"{$wgStyleSheetPath}/wikibits.js\"></script>\n";
                return $r;
        }
 
index 082ea94..531a46d 100644 (file)
@@ -155,6 +155,8 @@ function wfSpecialPreferences()
        $ltz = wfMsg( "localtime" );
        $tzt = wfMsg( "timezonetext" );
        $tzo = wfMsg( "timezoneoffset" );
+       $tzGuess = wfMsg( "guesstimezone" );
+       $tzServerTime = wfMsg( "servertime" );
        $yem = wfMsg( "youremail" );
        $emf = wfMsg( "emailflag" );
        $ynn = wfMsg( "yournick" );
@@ -165,7 +167,7 @@ function wfSpecialPreferences()
        $scc = wfMsg( "contextchars" );
        $rcc = wfMsg( "recentchangescount" );
 
-       $wgOut->addHTML( "<form id=\"preferences\" action=\"$action\"
+       $wgOut->addHTML( "<form id=\"preferences\" name=\"preferences\" action=\"$action\"
 method=\"post\"><table border=\"1\"><tr><td valign=top nowrap><b>$qb:</b><br>\n" );
 
        # Quickbar setting
@@ -227,11 +229,15 @@ value=\"$i\"$checked> {$mathopts[$i]}<br>\n" );
 
        # Textbox rows, cols
        #
+       $nowlocal = $wgLang->time( $now = wfTimestampNow(), true );
+       $nowserver = $wgLang->time( $now, false );
        $wgOut->addHTML( "<td valign=top nowrap><b>$tbs:</b><br>
 $tbr: <input type=text name=\"wpRows\" value=\"{$wpRows}\" size=6><br>
 $tbc: <input type=text name=\"wpCols\" value=\"{$wpCols}\" size=6><br><br>
-<b>$ltz</b><br>
-$tzo*: <input type=text name=\"wpHourDiff\" value=\"{$wpHourDiff}\" size=6>
+<b>$tzServerTime:</b> $nowserver<br />
+<b>$ltz:</b> $nowlocal<br />
+$tzo*: <input type=text name=\"wpHourDiff\" value=\"{$wpHourDiff}\" size=6><br />
+<input type=\"button\" value=\"$tzGuess\" onClick=\"javascript:guessTimezone()\" />
 </td>" );
 
        # Email, etc.
index 179b1fc..8bbbf5b 100644 (file)
@@ -24,7 +24,8 @@
        "cols" => 80, "rows" => 25, "searchlimit" => 20,
        "contextlines" => 5, "contextchars" => 50,
        "skin" => 0, "math" => 1, "rcdays" => 7, "rclimit" => 50,
-       "highlightbroken" => 1, "stubthreshold" => 0
+       "highlightbroken" => 1, "stubthreshold" => 0,
+       "previewontop" => 1
 );
 
 /* private */ $wgQuickbarSettingsEn = array(
@@ -57,7 +58,8 @@ this</a> (alternative: like this<a href=\"\" class=\"internal\">?</a>).",
        "editondblclick" => "Edit pages on double click (JavaScript)",
        "watchdefault" => "Watch new and modified articles",
        "minordefault" => "Mark all edits minor by default",
-       "previewontop" => "Show preview before edit box and not after it"
+       "previewontop" => "Show preview before edit box and not after it",
+       "nocache" => "Disable page caching"
 );
 
 /* private */ $wgBookstoreListEn = array(
@@ -620,8 +622,10 @@ Your internal ID number is $2.",
 "savedprefs"   => "Your preferences have been saved.",
 "timezonetext" => "Enter number of hours your local time differs
 from server time (UTC).",
-"localtime"    => "Local time",
+"localtime"    => "Local time display",
 "timezoneoffset" => "Offset",
+"servertime"   => "Server time is now",
+"guesstimezone" => "Fill in from browser",
 "emailflag"            => "Disable e-mail from other users",
 
 # Recent changes
index 8886e11..c2b37a8 100644 (file)
@@ -30,3 +30,18 @@ function checkTimezone( tz, msg ) {
                document.write( junk[0] + "UTC" + tzString + junk[1] );
        }
 }
+
+// in [-][H]H format...
+// won't yet work with non-even tzs
+function fetchTimezone() {
+       var localclock = new Date();
+       // returns negative offset from GMT in minutes
+       var tzRaw = localclock.getTimezoneOffset();
+       var tzHour = Math.floor( Math.abs(tzRaw) / 60);
+       var tzString = ((tzRaw >= 0) ? "-" : "") + ((tzHour < 10) ? "" : "0") + tzHour;
+       return tzString;
+}
+
+function guessTimezone(box) {
+       document.preferences.wpHourDiff.value = fetchTimezone();
+}