1) Hide section edit links for protected pages
authorErik Moeller <erik@users.mediawiki.org>
Mon, 30 Jun 2003 02:15:17 +0000 (02:15 +0000)
committerErik Moeller <erik@users.mediawiki.org>
Mon, 30 Jun 2003 02:15:17 +0000 (02:15 +0000)
2) Hide section edit links for old revisions
3) Changed layout of section edit links
4) added info to editing screen when you are editing a section
5) removed toc from main page

includes/Article.php
includes/OutputPage.php
includes/Skin.php
languages/Language.php

index cf242df..2afda77 100644 (file)
@@ -466,6 +466,8 @@ class Article {
                } else {
                        $s = str_replace( "$1", $wgTitle->getPrefixedText(),
                          wfMsg( "editing" ) );
+
+                       if($section!="") { $s.=wfMsg("sectionedit");}
                        $wgOut->setPageTitle( $s );
                        if ( $oldid ) {
                                $this->setOldSubtitle();
index cae5c29..0db1ead 100644 (file)
@@ -1214,6 +1214,7 @@ class OutputPage {
                $nh=$wgUser->getOption( "numberheadings" );
                $st=$wgUser->getOption( "showtoc" );
                $es=$wgUser->getID() && $wgUser->getOption( "editsection" );
+               if($wgTitle->getPrefixedText()==wfMsg("mainpage")) {$st=0;}
 
                $sk=$wgUser->getSkin();
                preg_match_all("/<H([1-6])(.*?>)(.*?)<\/H[1-6]>/i",$text,$matches);
@@ -1270,6 +1271,9 @@ class OutputPage {
                        if($st) {
                                $toc.=$sk->tocLine($anchor,$tocline);
                        }
+                       if($es && !isset($wpPreview)) {
+                               $head[$c].=$sk->editSectionLink($c+1);
+                       }
                        $head[$c].="<H".$level.$matches[2][$c]
                         ."<a name=\"".$anchor."\">"
                         .$headline
@@ -1295,12 +1299,13 @@ class OutputPage {
                
                $blocks=preg_split("/<H[1-6].*?>.*?<\/H[1-6]>/i",$text);
                $i=0;
-               foreach($blocks as $block) {                    
-                       $full.=$block;
-                       if($es && $c>0 && !isset($wpPreview)) {
-                               $full.=$sk->editSectionLink($i);
+
+               foreach($blocks as $block) {
+                       if($es && !isset($wpPreview) && $c>0 && $i==0) {
+                               $full.=$sk->editSectionLink(0);                         
                        }
 
+                       $full.=$block;
                        $full.=$head[$i];
                        $i++;
                }
index 4022e53..4767090 100644 (file)
@@ -1685,10 +1685,12 @@ class Skin {
 
        function editSectionLink($section) {
 
-               global $wgTitle;
-               $editurl="&section={$section}";
+               global $wgTitle,$wgUser,$oldid;
+               if($wgTitle->isProtected() && !$wgUser->isSysop()) return "";
+               if($oldid) return "";
+               $editurl="&section={$section}";         
                $url=$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("editsection"),"action=edit".$editurl);
-               return "<p style=\"text-align:left;\"><small>[".$url."]</small></p>";
+               return "<div style=\"float:right;margin-left:5px;\"><small>[".$url."]</small></div>";
 
        }
 }
index b857533..6ecf196 100644 (file)
@@ -498,6 +498,7 @@ If you are here by mistake, just click your browser's '''back''' button.",
 "previewconflict" => "This preview reflects the text in the upper
 text editing area as it will appear if you choose to save.",
 "editing"              => "Editing $1",
+"sectionedit"  => " (section)",
 "editconflict" => "Edit conflict: $1",
 "explainconflict" => "Someone else has changed this page since you
 started editing it.
@@ -600,9 +601,7 @@ $2 List redirects &nbsp; Search for $3 $9",
   wfLocalUrl( "Special:Userlogin" ) . "\">logged in</a>
 to set user preferences.",
 "prefslogintext" => "You are logged in as \"$1\".
-Your internal ID number is $2.
-
-See [[Wikipedia:User preferences help]] for help deciphering the options.",
+Your internal ID number is $2.",
 "prefsreset"   => "Preferences have been reset from storage.",
 "qbsettings"   => "Quickbar settings", 
 "changepassword" => "Change password",
@@ -1189,11 +1188,11 @@ class Language {
                }
                if ( 0 == $diff ) { return $ts; }
 
-               $t = gmmktime( ( (int)substr( $ts, 8, 2) ) + $diff,
+               $t = mktime( ( (int)substr( $ts, 8, 2) ) + $diff,
                  (int)substr( $ts, 10, 2 ), (int)substr( $ts, 12, 2 ),
                  (int)substr( $ts, 4, 2 ), (int)substr( $ts, 6, 2 ),
                  (int)substr( $ts, 0, 4 ) );
-               return gmdate( "YmdHis", $t );
+               return date( "YmdHis", $t );
        }
  
        function date( $ts, $adj = false )
@@ -1228,7 +1227,7 @@ class Language {
 
        function rfc1123( $ts )
        {
-               return gmdate( "D, d M Y H:i:s T", $ts );
+               return date( "D, d M Y H:i:s T", $ts );
        }
 
        function getValidSpecialPages()