Mollywhite has uploaded a new change for review.
https://gerrit.wikimedia.org/r/78264
Change subject: Bug 51239: Draft JSON editor (do not commit)
......................................................................
Bug 51239: Draft JSON editor (do not commit)
This patch adds a custon editor for the JSON blocks. The data
can currently be changed in the form inputs, and the sections
can be rearranged and removed. There is still a lot of work to
be done on this, so it should not be merged yet.
Bug: 51239
Change-Id: Id9fc38f80614e0b348a8d99ce5fd9898367c5e7c
---
M BookManagerv2.hooks.php
M BookManagerv2.i18n.php
M BookManagerv2.php
A JsonEditor.php
A images/Close_symbol.png
A images/Resize_vertical_font_awesome_666666.png
A modules/ext.BookManagerv2.editor.css
A modules/ext.BookManagerv2.editor.js
A modules/ext.BookManagerv2.editorjs.css
M schemas/bookschema.json
10 files changed, 580 insertions(+), 32 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BookManagerv2
refs/changes/64/78264/1
diff --git a/BookManagerv2.hooks.php b/BookManagerv2.hooks.php
index e157d0b..c10e3b0 100644
--- a/BookManagerv2.hooks.php
+++ b/BookManagerv2.hooks.php
@@ -232,13 +232,13 @@
} else if ( $year && $month && !$day ) {
$ts = $yearStr . $monthStr . "01000000";
$format = $wgLang->getDateFormatString( 'monthonly',
- $wgUser->getDatePreference() ?: 'default' );
+ $wgUser->getDatePreference() ? : 'default' );
$date = $wgLang->sprintfDate( $format, $ts );
$datetime = $yearStr . "-" . $monthStr;
} else {
$ts = $yearStr . $monthStr . $dayStr . "000000";
$format = $wgLang->getDateFormatString( 'date',
- $wgUser->getDatePreference() ?: 'default' );
+ $wgUser->getDatePreference() ? : 'default' );
$date = $wgLang->sprintfDate( $format, $ts );
$datetime = $yearStr . "-" . $monthStr . "-" . $dayStr;
}
@@ -484,4 +484,21 @@
}
return true;
}
+
+ /**
+ * Add a custom editor for JSON blocks.
+ *
+ * @param $article Article being edited
+ * @param $user User performing the edit
+ * @return bool True to use the normal editor, false to add the custom
editor
+ **/
+ public static function onCustomEditor( $article, $user ) {
+ // Set up custom edit form if the article is in the JSON
namespace.
+ if ( $article->getTitle()->inNamespace( NS_BOOK ) ) {
+ $editor = new JsonEditor( $article );
+ $editor->edit();
+ return false;
+ }
+ return true;
+ }
}
diff --git a/BookManagerv2.i18n.php b/BookManagerv2.i18n.php
index 5ffd491..30d66ca 100644
--- a/BookManagerv2.i18n.php
+++ b/BookManagerv2.i18n.php
@@ -40,6 +40,35 @@
'bookmanagerv2-isbn' => 'ISBN: $1',
'bookmanagerv2-lccn' => 'LCCN: $1',
'bookmanagerv2-oclc' => 'OCLC: $1',
+ 'bookmanagerv2-metadata' => 'Metadata of work',
+ 'bookmanagerv2-contents' => 'Contents of work',
+ 'bookmanagerv2-move-alt' => 'Move this section',
+ 'bookmanagerv2-remove-alt' => 'Remove this section',
+ 'bookmanagerv2-title-field' => 'Title',
+ 'bookmanagerv2-alternate-titles-field' => 'Alternate titles',
+ 'bookmanagerv2-authors-field' => 'Authors',
+ 'bookmanagerv2-translators-field' => 'Translators',
+ 'bookmanagerv2-editors-field' => 'Editors',
+ 'bookmanagerv2-illustrators-field' => 'Illustrators',
+ 'bookmanagerv2-subtitle-field' => 'Subtitle',
+ 'bookmanagerv2-series-title-field' => 'Series title',
+ 'bookmanagerv2-volume-field' => 'Volume',
+ 'bookmanagerv2-edition-field' => 'Edition',
+ 'bookmanagerv2-publisher-field' => 'Publisher',
+ 'bookmanagerv2-printer-field' => 'Printer',
+ 'bookmanagerv2-publication-year-field' => 'Publication year',
+ 'bookmanagerv2-publication-month-field' => 'Publication month',
+ 'bookmanagerv2-publication-day-field' => 'Publication day',
+ 'bookmanagerv2-publication-city-field' => 'Publication city',
+ 'bookmanagerv2-language-field' => 'Language',
+ 'bookmanagerv2-description-field' => 'Description',
+ 'bookmanagerv2-source-field' => 'Source',
+ 'bookmanagerv2-permission-field' => 'Permission',
+ 'bookmanagerv2-other-versions-field' => 'Other versions',
+ 'bookmanagerv2-isbn-field' => 'ISBN',
+ 'bookmanagerv2-lccn-field' => 'LCCN',
+ 'bookmanagerv2-oclc-field' => 'OCLC',
+ 'bookmanagerv2-sections-field' => 'Sections',
);
/** Message documentation (Message documentation)
@@ -141,6 +170,33 @@
See screenshot for an example of this dropdown.
[[File:BookManagerv2 navigation bar metadata dropdown.png]]',
+ 'bookmanagerv2-move-alt' => 'Alternate text for the move icon in the
JSON editor section blocks. Instructs the user that dragging the section block
will reorder the sections.',
+ 'bookmanagerv2-remove-alt' => 'Alternate text for the remove (x) icon
in the JSON editor section blocks. Instructs the user that clicking this will
remove the section from the work.',
+ 'bookmanagerv2-title-field' => 'JSON editor input field label',
+ 'bookmanagerv2-alternate-titles-field' => 'JSON editor input field',
+ 'bookmanagerv2-authors-field' => 'JSON editor input field label',
+ 'bookmanagerv2-translators-field' => 'JSON editor input field label',
+ 'bookmanagerv2-editors-field' => 'JSON editor input field label',
+ 'bookmanagerv2-illustrators-field' => 'JSON editor input field label',
+ 'bookmanagerv2-subtitle-field' => 'JSON editor input field label',
+ 'bookmanagerv2-series-title-field' => 'JSON editor input field label',
+ 'bookmanagerv2-volume-field' => 'JSON editor input field label',
+ 'bookmanagerv2-edition-field' => 'JSON editor input field label',
+ 'bookmanagerv2-publisher-field' => 'JSON editor input field label',
+ 'bookmanagerv2-printer-field' => 'JSON editor input field label',
+ 'bookmanagerv2-publication-year-field' => 'JSON editor input field
label',
+ 'bookmanagerv2-publication-month-field' => 'JSON editor input field
label',
+ 'bookmanagerv2-publication-day-field' => 'JSON editor input field
label',
+ 'bookmanagerv2-publication-city-field' => 'JSON editor input field
label',
+ 'bookmanagerv2-language-field' => 'JSON editor input field label',
+ 'bookmanagerv2-description-field' => 'JSON editor input field label',
+ 'bookmanagerv2-source-field' => 'JSON editor input field label',
+ 'bookmanagerv2-permission-field' => 'JSON editor input field label',
+ 'bookmanagerv2-other-versions-field' => 'JSON editor input field label',
+ 'bookmanagerv2-isbn-field' => 'JSON editor input field label',
+ 'bookmanagerv2-lccn-field' => 'JSON editor input field label',
+ 'bookmanagerv2-oclc-field' => 'JSON editor input field label',
+ 'bookmanagerv2-sections-field' => 'JSON editor input field label',
);
/** Asturian (asturianu)
diff --git a/BookManagerv2.php b/BookManagerv2.php
index dd4a5ea..721ff35 100644
--- a/BookManagerv2.php
+++ b/BookManagerv2.php
@@ -104,6 +104,7 @@
'JsonUtil' => __DIR__ . '/includes/JsonSchema.php',
'TreeRef' => __DIR__ . '/includes/JsonSchema.php',
'JsonSchemaIndex' => __DIR__ . '/includes/JsonSchema.php',
+ 'JsonEditor' => __DIR__ . '/JsonEditor.php',
// API
'ApiJsonSchema' => __DIR__ . '/includes/ApiJsonSchema.php',
@@ -127,11 +128,12 @@
$namespaces[NS_BOOK] = 'Book';
$namespaces[NS_BOOK_TALK] = 'Book_talk';
return true;
-};
+} ;
// Register hooks
$wgHooks['BeforePageDisplay'][] = 'BookManagerv2Hooks::onBeforePageDisplay';
$wgHooks['EditFilterMerged'][] = 'BookManagerv2Hooks::onEditFilterMerged';
+$wgHooks['CustomEditor'][] = 'BookManagerv2Hooks::onCustomEditor';
// Load resources
$wgResourceModules['ext.BookManagerv2'] = array(
@@ -145,6 +147,26 @@
'localBasePath' => __DIR__ . '/modules',
'remoteExtPath' => 'BookManagerv2/modules'
);
+$wgResourceModules['ext.BookManagerv2.editor'] = array(
+ 'styles' => 'ext.BookManagerv2.editor.css',
+ 'localBasePath' => __DIR__ . '/modules',
+ 'remoteExtPath' => 'BookManagerv2/modules',
+);
+$wgResourceModules['ext.BookManagerv2.editorjs'] = array(
+ 'scripts' => 'ext.BookManagerv2.editor.js',
+ 'styles' => 'ext.BookManagerv2.editorjs.css',
+ 'localBasePath' => __DIR__ . '/modules',
+ 'remoteExtPath' => 'BookManagerv2/modules',
+ 'dependencies' => array(
+ 'jquery.ui.sortable',
+ 'mediawiki.jqueryMsg',
+ 'jquery.json'
+ ),
+ 'messages' => array(
+ 'bookmanagerv2-move-alt',
+ 'bookmanagerv2-remove-alt'
+ )
+);
// User configuration
diff --git a/JsonEditor.php b/JsonEditor.php
new file mode 100644
index 0000000..795d5cd
--- /dev/null
+++ b/JsonEditor.php
@@ -0,0 +1,220 @@
+<?php
+/**
+ * JSON block editor for the BookManagerv2 extension
+ *
+ * @file
+ * @ingroup Extensions
+ *
+ * @author Molly White
+ *
+ * @section LICENSE
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
+ */
+
+class JsonEditor extends EditPage {
+
+ protected function isSectionEditSupported() {
+ return false;
+ }
+
+ static function getSchema() {
+ return FormatJson::decode(
+ file_get_contents( __DIR__ . '/schemas/bookschema.json'
) );
+ }
+
+ protected function addField( $key, $val, $original,
+ $inputAttributes = array()
+ ) {
+ $type = $val->type;
+ $i18n = $val->additionalProperties->i18n;
+ switch ( $type ) {
+ case 'string':
+ case 'array':
+ $inputType = 'text';
+ break;
+ case 'number':
+ case 'integer':
+ $inputType = 'number';
+ break;
+ }
+ $inputAttributes[ 'type' ] = $type;
+ $inputAttributes[ 'name' ] = 'json-editor-' . $key;
+ $inputAttributes[ 'id' ] = 'json-editor-' . $key;
+ if ( $val->required ) {
+ $inputAttributes[ 'required' ] = 'required';
+ }
+ if ( $inputType === 'text' ) {
+ $inputAttributes[ 'size' ] = 60;
+ }
+ if ( $original ) {
+ $inputAttributes[ 'value' ] = $original;
+ }
+ $html = Html::openElement( 'tr' )
+ . Html::openElement( 'th', array( 'scope' => 'row' ) )
+ . Html::element( 'label', array(
+ 'for' => $key ),
+ wfMessage( $i18n )->text() )
+ . Html::closeElement( 'th' )
+ . Html::openElement( 'td' )
+ . Html::element( 'input', $inputAttributes, '' )
+ . Html::closeElement( 'td' )
+ . Html::closeElement( 'tr' );
+ return $html;
+ }
+
+ protected function showContentForm() {
+ global $wgOut;
+ $schema = self::getSchema();
+ $originalContent = $this->getContent();
+ if ( $originalContent !== '' ) {
+ $originalJson = FormatJson::decode( $originalContent );
+ } else {
+ // We're creating the page for the first time
+ $originalJson = null;
+ }
+
+ $pageLang = $this->mTitle->getPageLanguage();
+ $inputAttributes = array(
+ 'lang' => $pageLang->getCode(),
+ 'dir' => $pageLang->getDir()
+ );
+
+ $html = Html::openElement( 'table', array(
+ 'class' => 'mw-bookmanagerv2-edit-form' ) );
+ foreach ( $schema->properties as $key => $schemaAttribs ) {
+ if ( $key === 'sections' ) {
+ break;
+ }
+ $original = null;
+ if ( $originalJson ) {
+ // If the page already exists, populate the
fields with the
+ // existing values.
+ if ( property_exists( $originalJson, $key ) ) {
+ // TODO: No handling for objects
+ // TODO: Arrays
+ $original = $originalJson->$key;
+ $originalType = gettype( $original );
+ if ( $originalType === 'array' ) {
+ $original = $original[0];
+ } else if ( $originalType === 'double'
+ || $originalType === 'integer'
+ ) {
+ $original = (string)$original;
+ }
+ if ( gettype( $original ) !== 'string'
) {
+ $original = null;
+ }
+ }
+ }
+ $html .= self::addField( $key, $schemaAttribs,
$original,
+ $inputAttributes );
+ }
+ $html .= Html::closeElement( 'table' )
+ . Html::openElement( 'ul', array(
+ 'class' => 'mw-bookmanagerv2-section-list',
+ 'id' => 'sortable'
+ ) );
+ if ( $originalJson ) {
+ global $wgExtensionAssetsPath;
+ $index = 0;
+ $imagePath = $wgExtensionAssetsPath .
'/BookManagerv2/images/';
+ $sections = $originalJson->sections;
+ $html .= Html::element( 'input', array(
+ 'type' => 'hidden',
+ 'name' => 'json-editor-sections',
+ 'id' => 'json-editor-sections',
+ 'value' => FormatJson::encode( $sections ) ? :
''
+ ) );
+ foreach ( $sections as $section ) {
+ $sectionTitle = Title::newFromText(
$section->link );
+ if ( $sectionTitle->exists() ) {
+ $sectionLinkName = 'edit';
+ } else {
+ $sectionLinkName = 'create';
+ }
+ $html .= Html::openElement( 'li', array(
+ 'class' => 'mw-bookmanagerv2-section',
+ 'id' => 'section-' . (string)$index
+ ) )
+ . Linker::link(
+ $sectionTitle,
+ $section->name,
+ array( 'class' =>
'mw-bookmanagerv2-section-link' ),
+ array(),
+ array( 'noclasses' )
+ )
+ . Html::openElement( 'span', array(
+ 'class' =>
'mw-bookmanagerv2-edit-rename'
+ ) )
+ . "[ "
+ . Linker::link(
+ $sectionTitle,
+ $sectionLinkName,
+ array(),
+ array( 'action' => 'edit' ),
+ array( 'noclasses' )
+ )
+ . " | rename ]"
+ . Html::closeElement( 'span' )
+ . Html::closeElement( 'li' );
+ $index++;
+ }
+ }
+ $html .= Html::closeElement( 'ul' );
+ $wgOut->addHTML( $html );
+ $wgOut->addModuleStyles( 'ext.BookManagerv2.editor' );
+ $wgOut->addModules( 'ext.BookManagerv2.editorjs' );
+ }
+
+ protected function importContentFormData( &$request ) {
+ $schema = self::getSchema();
+ $data = array();
+ foreach ( $schema->properties as $key => $val ) {
+ if ( $key === 'sections' ) {
+ continue;
+ }
+ $inputType = $val->type;
+ $inputValue = $this->safeUnicodeInput( $request,
+ 'json-editor-' . $key );
+ if ( $inputValue === '' ) {
+ // Ignore empty fields
+ continue;
+ }
+ if ( $inputType === 'array' ) {
+ $inputValue = (array)$inputValue;
+ } else if ( $inputType === 'number' ) {
+ if ( is_numeric( $inputValue ) ) {
+ $inputValue = (float)$inputValue;
+ } else {
+ // TODO: Throw error
+ break;
+ }
+ } else if ( $inputType === 'integer' ) {
+ if ( is_int( $inputValue ) ) {
+ $inputValue = (int)$inputValue;
+ } else {
+ // TODO: Throw error
+ break;
+ }
+ }
+ $data[ $key ] = $inputValue;
+ }
+ $data[ 'sections' ] = FormatJson::decode(
$this->safeUnicodeInput( $request,
+ 'json-editor-sections' ) );
+ $jsonData = FormatJson::encode( (object)$data );
+ return $jsonData;
+ }
+}
+
diff --git a/images/Close_symbol.png b/images/Close_symbol.png
new file mode 100644
index 0000000..3653b37
--- /dev/null
+++ b/images/Close_symbol.png
Binary files differ
diff --git a/images/Resize_vertical_font_awesome_666666.png
b/images/Resize_vertical_font_awesome_666666.png
new file mode 100644
index 0000000..ebd7145
--- /dev/null
+++ b/images/Resize_vertical_font_awesome_666666.png
Binary files differ
diff --git a/modules/ext.BookManagerv2.editor.css
b/modules/ext.BookManagerv2.editor.css
new file mode 100644
index 0000000..c9e4443
--- /dev/null
+++ b/modules/ext.BookManagerv2.editor.css
@@ -0,0 +1,44 @@
+/*
+ * @file
+ * @section LICENSE
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
+ **/
+table.mw-bookmanagerv2-edit-form th {
+ text-align: left;
+}
+
+ul.mw-bookmanagerv2-section-list {
+ list-style: none;
+ margin: 0;
+}
+
+li.mw-bookmanagerv2-section {
+ background-color: #eeeeee;
+ border: 1px solid #919191;
+ width: 700px;
+ margin-bottom: 10px;
+ overflow: hidden;
+}
+
+li.mw-bookmanagerv2-section a.mw-bookmanagerv2-section-link {
+ display: inline-block;
+ vertical-align: middle;
+ float: left;
+ margin: 10px;
+}
+
+html.client-nojs span.mw-bookmanagerv2-edit-rename {
+ display: none;
+}
diff --git a/modules/ext.BookManagerv2.editor.js
b/modules/ext.BookManagerv2.editor.js
new file mode 100644
index 0000000..92c6f02
--- /dev/null
+++ b/modules/ext.BookManagerv2.editor.js
@@ -0,0 +1,65 @@
+ /**
+ * @file
+ * @section LICENSE
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
+ **/
+
+(function ( $ ) {
+ var imagePath = mw.config.get( 'wgExtensionAssetsPath' ) +
'/BookManagerv2/images/',
+ $originalJson = $newJson = $.evalJSON( $(
'input#json-editor-sections' ).val() ),
+ moveAlt = mw.message( 'bookmanagerv2-move-alt' ).text(),
+ removeAlt = mw.message( 'bookmanagerv2-remove-alt' ).text(),
+ $moveIcon = $( '<img>' )
+ .prop( 'src', imagePath +
'Resize_vertical_font_awesome_666666.png' )
+ .prop( 'class', 'mw-bookmanagerv2-move' )
+ .prop( 'alt', moveAlt )
+ .prop( 'title', moveAlt ),
+ $removeIcon = $( '<img>' )
+ .prop( 'src', imagePath + 'Close_symbol.png' )
+ .prop( 'class', 'mw-bookmanagerv2-remove' )
+ .prop( 'alt', removeAlt )
+ .prop( 'title', removeAlt );
+ $( 'li.mw-bookmanagerv2-section' ).prepend( $moveIcon ).append(
$removeIcon );
+ $('#sortable').sortable({
+ start: function( event, ui ) {
+ var startIndex = ui.item.index() - 1;
+ ui.item.data( 'startIndex', startIndex );
+ },
+ update: function( event, ui ) {
+ var startIndex = ui.item.data( 'startIndex' ),
+ endIndex = $( ui.item ).index() - 1;
+ console.log( startIndex + ' to ' + endIndex );
+ $temp = $newJson[ startIndex ];
+ $newJson.splice( startIndex, 1 );
+ $newJson.splice( endIndex, 0, $temp );
+ updateJson( $newJson );
+ }
+ });
+
+ // Remove a section when the remove icon is clicked
+ $( 'img.mw-bookmanagerv2-remove' ).click( function() {
+ var $li = $( this ).parent(),
+ $sectionList = $( 'li.mw-bookmanagerv2-section' ),
+ index = $sectionList.index( $li );
+ $newJson.splice( index, 1 );
+ $li.fadeOut();
+ $li.remove();
+ updateJson( $newJson );
+ });
+}(jQuery));
+
+function updateJson( $json ) {
+ $( 'input#json-editor-sections' ).val( $.toJSON( $json ) );
+}
diff --git a/modules/ext.BookManagerv2.editorjs.css
b/modules/ext.BookManagerv2.editorjs.css
new file mode 100644
index 0000000..89b1968
--- /dev/null
+++ b/modules/ext.BookManagerv2.editorjs.css
@@ -0,0 +1,40 @@
+/*
+ * @file
+ * @section LICENSE
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
+ **/
+li.mw-bookmanagerv2-section img.mw-bookmanagerv2-move {
+ display: inline-block;
+ vertical-align: middle;
+ float: left;
+ width: 15px;
+ margin: 10px 0px 10px 10px;
+}
+
+li.mw-bookmanagerv2-section span.mw-bookmanagerv2-edit-rename {
+ display: inline-block;
+ vertical-align: middle;
+ float: left;
+ margin: 10px 10px 10px 0px;
+}
+
+li.mw-bookmanagerv2-section img.mw-bookmanagerv2-remove {
+ display: inline-block;
+ vertical-align: middle;
+ float: right;
+ margin: 10px;
+ color: #666666;
+ cursor: pointer;
+}
diff --git a/schemas/bookschema.json b/schemas/bookschema.json
index 47171be..6d34688 100644
--- a/schemas/bookschema.json
+++ b/schemas/bookschema.json
@@ -4,7 +4,10 @@
"title": {
"description": "Title of the work",
"type": "string",
- "required": true
+ "required": true,
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-title-field"
+ }
},
"alternate_titles": {
"description": "List of other titles by which the work is known",
@@ -15,7 +18,10 @@
"type": "string",
"required": false
}
- ]
+ ],
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-alternate-titles-field"
+ }
},
"authors": {
"description": "List of contributors to the work",
@@ -26,7 +32,10 @@
"type": "string",
"required": false
}
- ]
+ ],
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-authors-field"
+ }
},
"translators": {
"description": "List of translators who contributed to the work",
@@ -37,7 +46,10 @@
"type": "string",
"required": false
}
- ]
+ ],
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-translators-field"
+ }
},
"editors": {
"description": "List of editors who contributed to the work",
@@ -48,7 +60,10 @@
"type": "string",
"required": false
}
- ]
+ ],
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-editors-field"
+ }
},
"illustrators": {
"description": "List of illustrators who contributed to the work",
@@ -59,77 +74,122 @@
"type": "string",
"required": false
}
- ]
+ ],
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-illustrators-field"
+ }
},
"subtitle": {
"description": "Subtitle to the title of the work",
"type": "string",
- "required": false
+ "required": false,
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-subtitle-field"
+ }
},
"series_title": {
"description": "Title of the series of which this work is a
member",
"type": "string",
- "required": false
+ "required": false,
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-series-title-field"
+ }
},
"volume": {
"description": "Volume number of the work",
"type": "number",
- "required": false
+ "required": false,
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-volume-field"
+ }
},
"edition": {
"description": "Edition number of the work",
"type": "number",
- "required": false
+ "required": false,
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-edition-field"
+ }
},
"publisher": {
"description": "Name of the publisher of this work",
"type": "string",
- "required": false
+ "required": false,
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-publisher-field"
+ }
},
"printer": {
"description": "Name of the printer of this work",
"type": "string",
- "required": false
+ "required": false,
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-printer-field"
+ }
},
"publication_year": {
"description": "Year of publication of the work",
"type": "integer",
- "required": false
+ "required": false,
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-publication-year-field"
+ }
},
"publication_month": {
"description": "Month of publication of the work",
"type": "integer",
- "required": false
+ "required": false,
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-publication-month-field"
+ }
},
"publication_day": {
"description": "Day of publication of the work",
"type": "integer",
- "required": false
+ "required": false,
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-publication-day-field"
+ }
},
"publication_city": {
"description": "City in which the work was published",
"type": "string",
- "required": false
+ "required": false,
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-publication-city-field"
+ }
},
"language": {
"description": "Primary language of the work",
"type": "string",
- "required": false
+ "required": false,
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-language-field"
+ }
},
"description": {
"description": "Short description of the work",
"type": "string",
- "required": false
+ "required": false,
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-description-field"
+ }
},
"source": {
"description": "Source of the work",
"type": "string",
- "required": false
+ "required": false,
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-source-field"
+ }
},
"permission": {
"description": "Licensing permission for works not created
on-wiki",
"type": "string",
- "required": false
+ "required": false,
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-permission-field"
+ }
},
"other_versions": {
"description": "Lists of other versions of this work that are
available on the wiki",
@@ -140,22 +200,34 @@
"type": "string",
"required": false
}
- ]
+ ],
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-other-versions-field"
+ }
},
"isbn": {
"description": "International Standard Book Number of the work",
"type": "string",
- "required": false
+ "required": false,
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-isbn-field"
+ }
},
"lccn": {
"description": "Library of Congress Control Number of the work",
"type": "string",
- "required": false
+ "required": false,
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-lccn-field"
+ }
},
"oclc": {
"description": "Online Computer Library Center identifier of the
work",
"type": "string",
- "required": false
+ "required": false,
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-oclc-field"
+ }
},
"sections": {
"description": "List of objects representing the sections of the
work",
@@ -169,22 +241,34 @@
"name": {
"description": "Name of the section",
"type": "string",
- "required": true
+ "required": true,
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-name-field"
+ }
},
"link": {
"description": "Name of the wiki page where this
section is located",
"type": "string",
- "required": true
+ "required": true,
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-link-field"
+ }
},
"source": {
"description": "The source of the particular
section",
"required": false,
- "type": "string"
+ "type": "string",
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-source-field"
+ }
}
}
}
- ]
+ ],
+ "additionalProperties": {
+ "i18n": "bookmanagerv2-sections-field"
+ }
}
},
"additionalProperties": false
-}
+}
\ No newline at end of file
--
To view, visit https://gerrit.wikimedia.org/r/78264
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id9fc38f80614e0b348a8d99ce5fd9898367c5e7c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BookManagerv2
Gerrit-Branch: master
Gerrit-Owner: Mollywhite <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits