Alex Monk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/130328

Change subject: Allow users to set whether a page is for Disambiguation or not
......................................................................

Allow users to set whether a page is for Disambiguation or not

Bug: 61073
Change-Id: I78dd68ff5aad20c7e66c4ce1528b6f1bbc74892d
---
M VisualEditor.hooks.php
M VisualEditor.php
A modules/ve-mw/dm/metaitems/ve.dm.MWDisambiguationMetaItem.js
M modules/ve-mw/i18n/en.json
M modules/ve-mw/i18n/qqq.json
M modules/ve-mw/ui/pages/ve.ui.MWSettingsPage.js
6 files changed, 60 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/28/130328/1

diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php
index 145db26..752e052 100644
--- a/VisualEditor.hooks.php
+++ b/VisualEditor.hooks.php
@@ -422,7 +422,8 @@
                        'tabPosition' => $wgVisualEditorTabPosition,
                        'tabMessages' => $wgVisualEditorTabMessages,
                        'showBetaWelcome' => $wgVisualEditorShowBetaWelcome,
-                       'enableTocWidget' => $wgVisualEditorEnableTocWidget
+                       'enableTocWidget' => $wgVisualEditorEnableTocWidget,
+                       'disambigEnabled' => class_exists( 'DisambiguatorHooks' 
)
                );
 
                foreach ( $wgVisualEditorPreferenceModules as $pref => $module 
) {
diff --git a/VisualEditor.php b/VisualEditor.php
index 520951e..cb0d9ee 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -841,6 +841,7 @@
                'scripts' => array(
                        
'modules/ve-mw/dm/metaitems/ve.dm.MWCategoryMetaItem.js',
                        
'modules/ve-mw/dm/metaitems/ve.dm.MWDefaultSortMetaItem.js',
+                       
'modules/ve-mw/dm/metaitems/ve.dm.MWDisambiguationMetaItem.js',
                        
'modules/ve-mw/dm/metaitems/ve.dm.MWHiddenCategoryMetaItem.js',
                        
'modules/ve-mw/dm/metaitems/ve.dm.MWIndexDisableMetaItem.js',
                        
'modules/ve-mw/dm/metaitems/ve.dm.MWIndexForceMetaItem.js',
@@ -905,6 +906,7 @@
                        'visualeditor-dialog-meta-languages-name-label',
                        'visualeditor-dialog-meta-languages-readonlynote',
                        'visualeditor-dialog-meta-languages-section',
+                       
'visualeditor-dialog-meta-settings-disambiguation-label',
                        'visualeditor-dialog-meta-settings-hiddencat-label',
                        'visualeditor-dialog-meta-settings-index-default',
                        'visualeditor-dialog-meta-settings-index-disable',
diff --git a/modules/ve-mw/dm/metaitems/ve.dm.MWDisambiguationMetaItem.js 
b/modules/ve-mw/dm/metaitems/ve.dm.MWDisambiguationMetaItem.js
new file mode 100644
index 0000000..8095ca5
--- /dev/null
+++ b/modules/ve-mw/dm/metaitems/ve.dm.MWDisambiguationMetaItem.js
@@ -0,0 +1,47 @@
+/*!
+ * VisualEditor DataModel MWDisambiguationMetaItem class.
+ *
+ * @copyright 2011-2014 VisualEditor Team and others; see AUTHORS.txt
+ * @license The MIT License (MIT); see LICENSE.txt
+ */
+
+/**
+ * DataModel disambiguation meta item (for __DISAMBIG__).
+ *
+ * @class
+ * @extends ve.dm.MetaItem
+ * @constructor
+ * @param {Object} element Reference to element in meta-linmod
+ */
+ve.dm.MWDisambiguationMetaItem = function VeDmMWDisambiguationMetaItem( 
element ) {
+       // Parent constructor
+       ve.dm.MetaItem.call( this, element );
+};
+
+/* Inheritance */
+
+OO.inheritClass( ve.dm.MWDisambiguationMetaItem, ve.dm.MetaItem );
+
+/* Static Properties */
+
+ve.dm.MWDisambiguationMetaItem.static.name = 'mwDisambiguation';
+
+ve.dm.MWDisambiguationMetaItem.static.group = 'mwDisambiguation';
+
+ve.dm.MWDisambiguationMetaItem.static.matchTagNames = [ 'meta' ];
+
+ve.dm.MWDisambiguationMetaItem.static.matchRdfaTypes = [ 
'mw:PageProp/disambiguation' ];
+
+ve.dm.MWDisambiguationMetaItem.static.toDataElement = function ( ) {
+       return { 'type': this.name };
+};
+
+ve.dm.MWDisambiguationMetaItem.static.toDomElements = function ( dataElement, 
doc ) {
+       var meta = doc.createElement( 'meta' );
+       meta.setAttribute( 'property', 'mw:PageProp/disambiguation' );
+       return [ meta ];
+};
+
+/* Registration */
+
+ve.dm.modelRegistry.register( ve.dm.MWDisambiguationMetaItem );
diff --git a/modules/ve-mw/i18n/en.json b/modules/ve-mw/i18n/en.json
index 20ea544..9e5aaf8 100644
--- a/modules/ve-mw/i18n/en.json
+++ b/modules/ve-mw/i18n/en.json
@@ -89,6 +89,7 @@
     "visualeditor-dialog-meta-languages-name-label": "Language",
     "visualeditor-dialog-meta-languages-readonlynote": "This is a list of 
pages in other languages that are linked to this one. For now, it can only be 
edited in source mode or on Wikidata.",
     "visualeditor-dialog-meta-languages-section": "Languages",
+    "visualeditor-dialog-meta-settings-disambiguation-label": "Disambiguation 
page",
     "visualeditor-dialog-meta-settings-hiddencat-label": "Hidden category",
     "visualeditor-dialog-meta-settings-index-default": "Default",
     "visualeditor-dialog-meta-settings-index-disable": "No",
diff --git a/modules/ve-mw/i18n/qqq.json b/modules/ve-mw/i18n/qqq.json
index 356c415..d149601 100644
--- a/modules/ve-mw/i18n/qqq.json
+++ b/modules/ve-mw/i18n/qqq.json
@@ -94,6 +94,7 @@
        "visualeditor-dialog-meta-languages-name-label": "Column header for the 
language links table, giving the language name of the remote 
wiki.\n{{Identical|Language}}",
        "visualeditor-dialog-meta-languages-readonlynote": "Text of a note 
informing users that the language links cannot yet be edited.\n\nSee also:\n* 
{{msg-mw|Visualeditor-referencelist-missingref}}",
        "visualeditor-dialog-meta-languages-section": "Label for the language 
links dialog section.\n{{Identical|Language}}",
+       "visualeditor-dialog-meta-settings-disambiguation-label": "Prompt for 
the checkbox to let the mark the page as a disambiguation page.",
        "visualeditor-dialog-meta-settings-hiddencat-label": "Prompt for the 
checkbox to let the user hide this category from pages.",
        "visualeditor-dialog-meta-settings-index-default": "Label for the 
option to have default indexing behavior.\n{{Identical|Default}}",
        "visualeditor-dialog-meta-settings-index-disable": "Label for the 
option for indexing to be forced off.\n{{Identical|No}}",
diff --git a/modules/ve-mw/ui/pages/ve.ui.MWSettingsPage.js 
b/modules/ve-mw/ui/pages/ve.ui.MWSettingsPage.js
index c8edbe8..886fcb2 100644
--- a/modules/ve-mw/ui/pages/ve.ui.MWSettingsPage.js
+++ b/modules/ve-mw/ui/pages/ve.ui.MWSettingsPage.js
@@ -115,6 +115,13 @@
                );
        }
 
+       if ( mw.config.get( 'wgVisualEditorConfig' ).disambigEnabled ) {
+               this.metaItemCheckboxes.push( {
+                       metaName: 'mwDisambiguation',
+                       label: ve.msg( 
'visualeditor-dialog-meta-settings-disambiguation-label' )
+               } );
+       }
+
        this.settingsFieldset.addItems( [
                this.enableRedirectField,
                this.redirectTargetField,

-- 
To view, visit https://gerrit.wikimedia.org/r/130328
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I78dd68ff5aad20c7e66c4ce1528b6f1bbc74892d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Alex Monk <kren...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to