[MediaWiki-commits] [Gerrit] mediawiki...ProofreadPage[master]: Use custom actions for editing Index: pages

2017-01-09 Thread Tpt (Code Review)
Tpt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/331416 )

Change subject: Use custom actions for editing Index: pages
..

Use custom actions for editing Index: pages

Change-Id: I96bfbf31e17da95e874bb036a211b7b866c1c7a3
---
M ProofreadPage.body.php
M extension.json
R includes/index/EditIndexPage.php
M includes/index/IndexContentHandler.php
A includes/index/IndexEditAction.php
A includes/index/IndexSubmitAction.php
6 files changed, 92 insertions(+), 62 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ProofreadPage 
refs/changes/16/331416/1

diff --git a/ProofreadPage.body.php b/ProofreadPage.body.php
index 904ffe6..6a390fc 100644
--- a/ProofreadPage.body.php
+++ b/ProofreadPage.body.php
@@ -20,9 +20,10 @@
  */
 
 use ProofreadPage\Context;
+use ProofreadPage\FileNotFoundException;
+use ProofreadPage\Index\EditIndexPage;
 use ProofreadPage\Page\PageContent;
 use ProofreadPage\Page\PageContentBuilder;
-use ProofreadPage\FileNotFoundException;
 use ProofreadPage\Pagination\PageNotInPaginationException;
 
 /*
@@ -93,23 +94,6 @@
return false;
} elseif ( $title->inNamespace( self::getIndexNamespaceId() ) ) 
{
$model = CONTENT_MODEL_PROOFREAD_INDEX;
-   return false;
-   } else {
-   return true;
-   }
-   }
-
-   /**
-* Set up our custom edition system.
-*
-* @param Article $article  being edited
-* @param User $user User performing the edit
-* @return boolean hook return value
-*/
-   public static function onCustomEditor( Article $article, User $user ) {
-   if ( $article->getTitle()->inNamespace( 
self::getIndexNamespaceId() ) ) { // TODO ExternalEditor case
-   $editor = new EditProofreadIndexPage( $article );
-   $editor->edit();
return false;
} else {
return true;
diff --git a/extension.json b/extension.json
index c16616f..e3ed6b4 100644
--- a/extension.json
+++ b/extension.json
@@ -44,7 +44,6 @@
"ProofreadPage\\DiffFormatterUtils": 
"includes/DiffFormatterUtils.php",
"ProofreadPage\\FileNotFoundException": 
"includes/FileNotFoundException.php",
"ProofreadPage\\FileProvider": "includes/FileProvider.php",
-   "EditProofreadIndexPage": 
"includes/index/EditProofreadIndexPage.php",
"ProofreadIndexEntry": "includes/index/ProofreadIndexEntry.php",
"ProofreadIndexValue": "includes/index/ProofreadIndexValue.php",
"ProofreadIndexValueString": 
"includes/index/ProofreadIndexValue.php",
@@ -62,6 +61,9 @@
"ProofreadPage\\Index\\IndexContent": 
"includes/index/IndexContent.php",
"ProofreadPage\\Index\\IndexRedirectContent": 
"includes/index/IndexRedirectContent.php",
"ProofreadPage\\Index\\IndexContentHandler": 
"includes/index/IndexContentHandler.php",
+   "ProofreadPage\\Index\\IndexEditAction": 
"includes/index/IndexEditAction.php",
+   "ProofreadPage\\Index\\IndexSubmitAction": 
"includes/index/IndexSubmitAction.php",
+   "ProofreadPage\\Index\\EditIndexPage": 
"includes/index/EditIndexPage.php",
"ProofreadIndexDbConnector": 
"includes/index/ProofreadIndexDbConnector.php",
"ProofreadPage\\Pagination\\PaginationFactory": 
"includes/Pagination/PaginationFactory.php",
"ProofreadPage\\Pagination\\PageNumber": 
"includes/Pagination/PageNumber.php",
@@ -293,9 +295,6 @@
],
"GetPreferences": [
"ProofreadPage::onGetPreferences"
-   ],
-   "CustomEditor": [
-   "ProofreadPage::onCustomEditor"
],
"CanonicalNamespaces": [
"ProofreadPage::addCanonicalNamespaces"
diff --git a/includes/index/EditProofreadIndexPage.php 
b/includes/index/EditIndexPage.php
similarity index 76%
rename from includes/index/EditProofreadIndexPage.php
rename to includes/index/EditIndexPage.php
index 38d9707..819389e 100644
--- a/includes/index/EditProofreadIndexPage.php
+++ b/includes/index/EditIndexPage.php
@@ -1,33 +1,37 @@
 http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup ProofreadPage
+ * @licence GNU GPL v2+
  */
+class EditIndexPage extends EditPage {
 
-class EditProofreadIndexPage extends EditPage {
-
+   /**
+* @see EditPage::isSectionEditSupported
+*/
protected function isSectionEditSupported() {
return false; // sections and forms don't mix
}
 
/**
-* Add custom fields
+* @see EditPage::isSupportedContentModel
+*/
+   public functi

[MediaWiki-commits] [Gerrit] mediawiki...ProofreadPage[master]: Use custom actions for editing Index: pages

2017-05-27 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/331416 )

Change subject: Use custom actions for editing Index: pages
..


Use custom actions for editing Index: pages

Change-Id: I96bfbf31e17da95e874bb036a211b7b866c1c7a3
---
M ProofreadPage.body.php
M extension.json
R includes/index/EditIndexPage.php
M includes/index/IndexContentHandler.php
A includes/index/IndexEditAction.php
A includes/index/IndexSubmitAction.php
6 files changed, 92 insertions(+), 62 deletions(-)

Approvals:
  Seb35: Looks good to me, but someone else must approve
  jenkins-bot: Verified
  Tpt: Looks good to me, approved
  Jforrester: Looks good to me, but someone else must approve



diff --git a/ProofreadPage.body.php b/ProofreadPage.body.php
index 4ff0e43..c279c67 100644
--- a/ProofreadPage.body.php
+++ b/ProofreadPage.body.php
@@ -20,9 +20,10 @@
  */
 
 use ProofreadPage\Context;
+use ProofreadPage\FileNotFoundException;
+use ProofreadPage\Index\EditIndexPage;
 use ProofreadPage\Page\PageContent;
 use ProofreadPage\Page\PageContentBuilder;
-use ProofreadPage\FileNotFoundException;
 use ProofreadPage\Pagination\PageNotInPaginationException;
 
 /*
@@ -93,23 +94,6 @@
return false;
} elseif ( $title->inNamespace( self::getIndexNamespaceId() ) ) 
{
$model = CONTENT_MODEL_PROOFREAD_INDEX;
-   return false;
-   } else {
-   return true;
-   }
-   }
-
-   /**
-* Set up our custom edition system.
-*
-* @param Article $article  being edited
-* @param User $user User performing the edit
-* @return boolean hook return value
-*/
-   public static function onCustomEditor( Article $article, User $user ) {
-   if ( $article->getTitle()->inNamespace( 
self::getIndexNamespaceId() ) ) { // TODO ExternalEditor case
-   $editor = new EditProofreadIndexPage( $article );
-   $editor->edit();
return false;
} else {
return true;
diff --git a/extension.json b/extension.json
index c89fdb1..6443ac8 100644
--- a/extension.json
+++ b/extension.json
@@ -42,12 +42,14 @@
"ProofreadPage\\DiffFormatterUtils": 
"includes/DiffFormatterUtils.php",
"ProofreadPage\\FileNotFoundException": 
"includes/FileNotFoundException.php",
"ProofreadPage\\FileProvider": "includes/FileProvider.php",
-   "EditProofreadIndexPage": 
"includes/index/EditProofreadIndexPage.php",
"ProofreadIndexEntry": "includes/index/ProofreadIndexEntry.php",
"ProofreadIndexPage": "includes/index/ProofreadIndexPage.php",
"ProofreadPage\\Index\\IndexContent": 
"includes/index/IndexContent.php",
"ProofreadPage\\Index\\IndexRedirectContent": 
"includes/index/IndexRedirectContent.php",
"ProofreadPage\\Index\\IndexContentHandler": 
"includes/index/IndexContentHandler.php",
+   "ProofreadPage\\Index\\IndexEditAction": 
"includes/index/IndexEditAction.php",
+   "ProofreadPage\\Index\\IndexSubmitAction": 
"includes/index/IndexSubmitAction.php",
+   "ProofreadPage\\Index\\EditIndexPage": 
"includes/index/EditIndexPage.php",
"ProofreadIndexDbConnector": 
"includes/index/ProofreadIndexDbConnector.php",
"ProofreadPage\\Pagination\\PaginationFactory": 
"includes/Pagination/PaginationFactory.php",
"ProofreadPage\\Pagination\\PageNumber": 
"includes/Pagination/PageNumber.php",
@@ -282,9 +284,6 @@
],
"GetPreferences": [
"ProofreadPage::onGetPreferences"
-   ],
-   "CustomEditor": [
-   "ProofreadPage::onCustomEditor"
],
"CanonicalNamespaces": [
"ProofreadPage::addCanonicalNamespaces"
diff --git a/includes/index/EditProofreadIndexPage.php 
b/includes/index/EditIndexPage.php
similarity index 76%
rename from includes/index/EditProofreadIndexPage.php
rename to includes/index/EditIndexPage.php
index 38d9707..819389e 100644
--- a/includes/index/EditProofreadIndexPage.php
+++ b/includes/index/EditIndexPage.php
@@ -1,33 +1,37 @@
 http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup ProofreadPage
+ * @licence GNU GPL v2+
  */
+class EditIndexPage extends EditPage {
 
-class EditProofreadIndexPage extends EditPage {
-
+   /**
+* @see EditPage::isSectionEditSupported
+*/
protected function isSectionEditSupported() {
return false; // sections and forms don't mix
}
 
/**
-* Add custom fields
+* @see EditPage::isSupportedContentModel
+*/
+   public function isS