|
|
Line 90: |
Line 90: |
| }} | | }} |
| </pre> | | </pre> |
|
| |
|
| |
|
| |
| {{#visualdataprint: {{FULLPAGENAME}}
| |
| |?cover
| |
| |?title
| |
| |?authors/name
| |
| |?authors/email
| |
| |schema=Book
| |
| |template=Book
| |
| |template?authors=Book authors
| |
| |format=template
| |
| }}
| |
|
| |
| This is a page with an infobox that demonstrates the use of VisualData ([https://gerrit.wikimedia.org/r/c/mediawiki/extensions/VisualData/+/968230 latest version]) used as a [https://en.wikipedia.org/wiki/Create,_read,_update_and_delete CRUD]
| |
|
| |
| Click the button below to edit the article's metadata through a popup or the tab "Edit semantic" among the article's actions.
| |
|
| |
|
| |
| {{#visualdataform: Book
| |
| |title = edit infobox and page
| |
| |action = edit
| |
| |edit-page = {{FULLPAGENAME}}
| |
| |return-page =
| |
| |view = popup
| |
| |popup-size = medium
| |
| |css-class =
| |
| |pagename-formula =
| |
| |edit-freetext = true
| |
| |edit-categories = false
| |
| |edit-content-model = false
| |
| |default-categories =
| |
| |default-content-model = wikitext
| |
| |layout-align = top
| |
| |popup-help = true
| |
| |submit-button-text =
| |
| |layout = tabs
| |
| |submit-button-text =
| |
| |validate-button-text =
| |
| }}
| |
|
| |
|
| |
| The popup is rendered using the following code
| |
|
| |
| <pre>
| |
| {{#visualdataform: Book
| |
| |title = edit infobox and page
| |
| |action = edit
| |
| |edit-page = {{FULLPAGENAME}}
| |
| |return-page =
| |
| |view = popup
| |
| |popup-size = medium
| |
| |css-class =
| |
| |pagename-formula =
| |
| |edit-freetext = true
| |
| |edit-categories = false
| |
| |edit-content-model = false
| |
| |default-categories =
| |
| |default-content-model = wikitext
| |
| |layout-align = top
| |
| |popup-help = true
| |
| |submit-button-text =
| |
| |layout = tabs
| |
| |submit-button-text =
| |
| |validate-button-text =
| |
| }}
| |
|
| |
| </pre>
| |
|
| |
| A Pageproperties' form can edit whatever page (through the parameter <code>edit-page</code>, and create new pages with user-defined title or using a pagename formula. It is [https://json-schema.org/ json/schema] compliant<ref>It does not yet support allOf, anyOf, oneOf, and $refs both in the editor and in the viewer</ref> and can handle subitems, multiple fields and multiple sub items. It is deeply integrated with the Mediawiki's [https://doc.wikimedia.org/oojs-ui/master/demos/ OOUI library] and uses a lot or most of its features.
| |
| '''In the latest version can query properties and nested properties, as well as render them using templates and nested templates and does not rely on [https://www.semantic-mediawiki.org/wiki/Semantic_MediaWiki SemanticMediawiki]'''.
| |
|
| |
|
| |
|
| |
| The infobox is rendered through the following code:
| |
|
| |
| <pre>
| |
| {{#visualdataprint: {{FULLPAGENAME}}
| |
| |?cover
| |
| |?title
| |
| |?authors/name
| |
| |?authors/email
| |
| |schema=Book
| |
| |template=Book
| |
| |template?authors=Book authors
| |
| |format=template
| |
| }}
| |
|
| |
| </pre>
| |
|
| |
|
| |
| This is a SemanticMediawiki-like parser function that can be used as a shorthand to invoke the more complex <code> {{#visualdataquery }} </code> parser function that can handle multi-page results and provides a basic query language. (more about this on the official page of the extension to be updated soon)
| |
|
| |
| The results are rendered on the page using 2 templates, [[Template:Book]] and [[Template:Book authors]]. The second is used as a nested template rendered inside the parent template ([[Template:Book]]) entitled to render the properties with path <code>authors</code>. ''' Note that the parent template must include a reference to the name of the child template since both values and template's containers are passed as named parameters.'''
| |
|
| |
|
| |
| The form's schema(s) (a form can contain an arbitrary number of schemas, and a schema an arbitrary number of items and subitems) can be edited using this [[Special:ManageSchemas|Special page]] or [https://wikisphere.org/w/index.php?title=Test_visualdata_2.0&action=editsemantic this interface] (tab Edit semantic, edit icon on the right and then "Manage schemas")
| |
|
| |
| The related [[VisualDataSchema:Book|schema]] created by the UI contains an hidden property "name" that is filled-in with the compounded value of the fields <code>first_name</code> and <code>last_name</code>.
| |
| Also, the cover file name contains a value-formula, that allows the file to be saved with the article-id as prefix (also for new articles) which is useful to easily upload on the wiki files with similar names.
| |
|
| |
|
| |
| Have fun with this extension !!
| |
|
| |
|
|
| |
|
Line 1: |
Line 1: |
| {} | | { |
| | "schemas": { |
| | "Page upload": { |
| | "files": [ |
| | { |
| | "file": "File:433-PageProperties-MenuTagSearchMultiselect-field.png", |
| | "caption": "cap a" |
| | }, |
| | { |
| | "file": "File:433-default-value-parserfunction.png", |
| | "caption": "cap b" |
| | } |
| | ] |
| | } |
| | }, |
| | "schemas-data": { |
| | "untransformed": { |
| | "Page upload/files/0/file": "PageProperties-MenuTagSearchMultiselect-field.png", |
| | "Page upload/files/1/file": "default-value-parserfunction.png" |
| | } |
| | } |
| | } |
Line 1: |
Line 1: |
| { | | {} |
| "schemas": {
| |
| "Page upload": {
| |
| "files": [
| |
| {
| |
| "file": "File:433-PageProperties-MenuTagSearchMultiselect-field.png",
| |
| "caption": "cap a"
| |
| },
| |
| {
| |
| "file": "File:433-default-value-parserfunction.png",
| |
| "caption": "cap b"
| |
| }
| |
| ]
| |
| }
| |
| },
| |
| "schemas-data": {
| |
| "untransformed": {
| |
| "Page upload/files/0/file": "PageProperties-MenuTagSearchMultiselect-field.png",
| |
| "Page upload/files/1/file": "default-value-parserfunction.png"
| |
| }
| |
| }
| |
| } | |
The following form (click the button below) shows the use of VisualData as a multiple file uploader fully customizable.
The form below uses the following features:
- wikitext in either title and description of each item and subitem
- subitem with multiple items and min-item attribute set to 1 (in order to hold the file and caption fields)
- OO.UI.SelectFileWidget for the field "file" with input-config
droppable
and showDropTarget
. Note that both the attributes must be set in order to enable a doppable area
- value formula for the file field
{{PAGEID}}-<value>
in order to upload the file with a filename prefixed with the pageId of the current or created page. This is useful when you don't want to care of uploading files with same name on the wiki.
- list of accepted mime-types editable in the file input config (special page Special:ManageSchemas then Page upload schema) accessible from the settings icon besides the dropdown with available inputs (see picture below)
File:Screenshot-VisualData-InputConfig.png
(the caption associated to each file is simply a field besides the file field in the same subitem, other fields could be added as well)
form is loading...
This is the code to display the form-button
{{#visualdataform: Page upload
|title = Page upload
|action = edit
|edit-page =
|return-page =
|view = popup
|popup-size = medium
|css-class =
|pagename-formula =
|edit-freetext = false
|edit-categories = false
|edit-content-model = false
|default-categories = tasks
|default-content-model =
|layout-align = top
|popup-help = true
|submit-button-text =
|layout = tabs
|submit-button-text =
|validate-button-text =
}}
Also note that although the Page upload schema is now used inside a form, its typical use would be to add it to whatever page of the wiki through the "Edit semantic" tab, and then adding it to the page. This way there is no need to create a form each time.
Here is a gallery created through the parser function below. It uses the following 2 templates: Template:Page_upload and Template:Page_upload_files. The gallery is automatically updated after form submit with the new data.
{{#visualdataprint: {{FULLPAGENAME}}
|?files/file
|?files/caption
|schema=Page upload
|template=Page upload
|template?files=Page upload files
|format=template
}}
See also
support & questions: support at topway.it
Download the latest version!