New task: Difference between revisions

From Wikisphere
Jump to navigation Jump to search
No edit summary
Tag: 2017 source edit
No edit summary
Tag: 2017 source edit
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{#visualdataprint: {{FULLPAGENAME}} 
       
|?cover
This form shows the following features:  
|?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.
* default value for assignee field with magic word <code><nowiki>{{CURRENTUSER}}</nowiki></code> (wikitext and parser functions allowed, useful repositories are the following: [https://www.mediawiki.org/wiki/Help:Magic_words Help:Magic words] and [https://www.mediawiki.org/wiki/Extension:MyVariables Extension:MyVariables])
* OOUI UserInputWidget for the same field
* status with dropdown with items retrieved by a wikilist on this page [[Task status list]]
* OOUI MultilineTextInputWidget for the task field, with autogrow
* subitems for the repository section
* validation pattern for the url field in the repository section (repository -> properties -> url -> settings symbol near the preferred input field -> validate)
* default rows for the MultilineTextInputWidget inside the input config for the comments field
* hidden field id-increment, with value-formula <code><nowiki>{{#idprovider-increment:}}</nowiki></code>  (see [https://www.mediawiki.org/wiki/Extension:IDProvider Extension:IDProvider]) used in pagename formula
* pagename formula with value <code><nowiki>Tasks/<assignee>/<id-increment></nowiki></code>  (this will create a page with the entered metadata or freetext with title like <code><nowiki>Tasks/User:Admin/1</nowiki></code> )
* The form gets validated through [https://github.com/ajv-validator/ajv ajv-validator]


 
{{#visualdataform: Task
{{#visualdataform: Book
|title = Create task
|title = edit infobox and page
|action = create
|action = edit
|edit-page =  
|edit-page = {{FULLPAGENAME}}
|return-page =  
|return-page =  
|view = popup
|view = inline
|popup-size = medium
|popup-size = medium
|css-class =
|css-class =
|pagename-formula =
|pagename-formula = Tasks/<assignee>/<id-increment>
|edit-freetext = true
|edit-freetext = true
|edit-categories = false
|edit-categories = false
|edit-content-model = false
|edit-content-model = false
|default-categories =  
|edit-target-slot = false
|target-slot=main
|default-categories = tasks
|default-content-model = wikitext
|default-content-model = wikitext
|layout-align = top
|layout-align = top
|popup-help = true
|popup-help = false
|submit-button-text =
|submit-button-text =
|layout = tabs
|layout = tabs
Line 38: Line 39:




The popup is rendered using the following code
Wikitext to render the form


<pre>
<pre>
{{#visualdataform: Book
{{#visualdataform: Task
|title = edit infobox and page
|title = Create task
|action = edit
|action = create
|edit-page = {{FULLPAGENAME}}
|edit-page =  
|return-page =  
|return-page =  
|view = popup
|view = inline
|popup-size = medium
|popup-size = medium
|css-class =
|css-class =
|pagename-formula =
|pagename-formula = Tasks/<assignee>/<id-increment>
|edit-freetext = true
|edit-freetext = true
|edit-categories = false
|edit-categories = false
|edit-content-model = false
|edit-content-model = false
|default-categories =  
|edit-target-slot = false
|target-slot=main
|default-categories = tasks
|default-content-model = wikitext
|default-content-model = wikitext
|layout-align = top
|layout-align = top
Line 64: Line 67:


</pre>
</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 !!
The related schema generated by the schema builder can be found here: [[VisualDataSchema:Task]]. It can be managed here [[Special:ManageSchemas]]





Revision as of 09:04, 25 March 2024

This form shows the following features:

  • default value for assignee field with magic word {{CURRENTUSER}} (wikitext and parser functions allowed, useful repositories are the following: Help:Magic words and Extension:MyVariables)
  • OOUI UserInputWidget for the same field
  • status with dropdown with items retrieved by a wikilist on this page Task status list
  • OOUI MultilineTextInputWidget for the task field, with autogrow
  • subitems for the repository section
  • validation pattern for the url field in the repository section (repository -> properties -> url -> settings symbol near the preferred input field -> validate)
  • default rows for the MultilineTextInputWidget inside the input config for the comments field
  • hidden field id-increment, with value-formula {{#idprovider-increment:}} (see Extension:IDProvider) used in pagename formula
  • pagename formula with value Tasks/<assignee>/<id-increment> (this will create a page with the entered metadata or freetext with title like Tasks/User:Admin/1 )
  • The form gets validated through ajv-validator


form is loading...


Wikitext to render the form

{{#visualdataform: Task
|title = Create task
|action = create
|edit-page = 
|return-page = 
|view = inline
|popup-size = medium
|css-class =
|pagename-formula = Tasks/<assignee>/<id-increment>
|edit-freetext = true
|edit-categories = false
|edit-content-model = false
|edit-target-slot = false
|target-slot=main
|default-categories = tasks
|default-content-model = wikitext
|layout-align = top
|popup-help = true 
|submit-button-text =
|layout = tabs
|submit-button-text =
|validate-button-text =
}}


The related schema generated by the schema builder can be found here: VisualDataSchema:Task. It can be managed here Special:ManageSchemas


See also