- don't check for edit conflict when posting comments (can always append)
authorErik Moeller <erik@users.mediawiki.org>
Mon, 28 Jul 2003 03:57:40 +0000 (03:57 +0000)
committerErik Moeller <erik@users.mediawiki.org>
Mon, 28 Jul 2003 03:57:40 +0000 (03:57 +0000)
- right click on article title instead of top [edit] link when rightclick
option is enabled

includes/Article.php
includes/OutputPage.php
includes/Skin.php

index e7819ef..adfe9a4 100644 (file)
@@ -428,9 +428,10 @@ class Article {
                                return;
                        }
                        # Article exists. Check for edit conflict.
+                       # Don't check for conflict when appending a comment - this should always work
 
                        $this->clear(); # Force reload of dates, etc.
-                       if ( $this->getTimestamp() != $wpEdittime ) { $isConflict = true; }
+                       if ( $section!="new" && ( $this->getTimestamp() != $wpEdittime ) ) { $isConflict = true; }
                        $u = $wgUser->getID();
 
                        # Supress edit conflict with self
index e96860e..a1518f5 100644 (file)
@@ -1349,9 +1349,13 @@ return $r ;
                global $wgUser,$wgArticle,$wgTitle,$wpPreview;
                $nh=$wgUser->getOption( "numberheadings" );
                $st=$wgUser->getOption( "showtoc" );
-               $es=$wgUser->getID() && $wgUser->getOption( "editsection" );
-               $esr=$wgUser->getID() && $wgUser->getOption( "editsectiononrightclick" );
-
+               if(!$wgTitle->userCanEdit()) {
+                       $es=0;
+                       $esr=0;
+               } else {
+                       $es=$wgUser->getID() && $wgUser->getOption( "editsection" );
+                       $esr=$wgUser->getID() && $wgUser->getOption( "editsectiononrightclick" );
+               }
                # if the string __NOTOC__ (not case-sensitive) occurs in the HTML, do not 
                # add TOC
                if($st && preg_match("/__NOTOC__/i",$text)) { 
@@ -1451,7 +1455,7 @@ return $r ;
 
 
                foreach($blocks as $block) {
-                       if(($es || $esr) && !isset($wpPreview) && $c>0 && $i==0) {
+                       if(($es) && !isset($wpPreview) && $c>0 && $i==0) {
                            # This is the [edit] link that appears for the top block of text when 
                                # section editing is enabled
                                $full.=$sk->editSectionLink(0);                         
index a82a103..df9bf1a 100644 (file)
@@ -383,9 +383,10 @@ class Skin {
 
        function pageTitle()
        {
-               global $wgOut, $wgTitle;
+               global $wgOut, $wgTitle, $wgUser;
 
                $s = "<h1 class='pagetitle'>" . $wgOut->getPageTitle() . "</h1>";
+               if($wgUser->getOption("editsectiononrightclick") && $wgTitle->userCanEdit()) { $s=$this->editSectionScript(0,$s);}
                return $s;
        }
 
@@ -514,8 +515,7 @@ class Skin {
                if ( $wgOut->isArticle() ) {
                        $s .= "<strong>" . $this->editThisPage() . "</strong>";
                        if ( 0 != $wgUser->getID() ) {
-                               $s .= $sep . $this->watchThisPage() .
-                                       $sep . $this->moveThisPage();
+                               $s .= $sep . $this->watchThisPage();
                        }
                        $s .= $sep . $this->talkLink()
                          . $sep . $this->historyLink()
@@ -540,7 +540,8 @@ class Skin {
                        }
                        if ( $wgUser->isSysop() && $wgTitle->getArticleId() ) {
                                $s .= "\n<br>" . $this->deleteThisPage() .
-                               $sep . $this->protectThisPage();
+                               $sep . $this->protectThisPage() .
+                               $sep . $this->moveThisPage();
                        }
                        $s .= "<br>\n" . $this->otherLanguages();
                }
@@ -1735,10 +1736,10 @@ class Skin {
        $toc."</td></tr></table><P>\n";
        }
 
+       # These two do not check for permissions: check $wgTitle->userCanEdit before calling them
        function editSectionScript($section,$head) {
 
                global $wgTitle,$wgUser,$oldid;
-               if($wgTitle->isProtected() && !$wgUser->isSysop()) return $head;
                if($oldid) return $head;
                $url = wfLocalUrlE($wgTitle->getPrefixedText(),"action=edit&section=$section");
                return "<span onContextMenu='document.location=\"".$url."\";return false;'>{$head}</span>";
@@ -1747,7 +1748,6 @@ class Skin {
        function editSectionLink($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);