Properties no longer have default form

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Properties no longer have default form

karlpietsch
This post was updated on .
Am I correct that you can no longer define a default form for a property of type Page?

Previously you could with the special property “Has default form” and then whenever that property was used in a template and the page did not exist it automatically linked the redlink to the correct form.

The {{#default_form:form-name}} parser function only works for defining the form for an existing page based on category.

Previously you could simply put a semantic property in a template and it would all work e.g.  [[Has author::{{{author}}}]] if a page called {{{author}}} existed it would link and store the semantic property, if the page did not exist it would link to the default form specified for the property “Has author” .

What is the correct way to reproduce this functionality now? It appears the only way would be to

Replace  
        [[Has author::{{{author}}}]]
with  
{{#ifexist: {{{author}}} | [[Has author::{{{author}}}]]  | {{#formredlink:target={{{author}}}|form=Author}}[[Has author::{{{author}}}| ]]  }}

That’s quite tedious and ifexist is an expensive parser function and should not really be used on every semantic property in a template?

I did notice in the PageForms extension there is a global variable that is unused that may hint this feature is returning? Is it?

# ##
# When modifying red links to potentially point to a form to edit that page,
# check only the properties pointing to that missing page from the page the
# user is currently on, instead of from all pages in the wiki.
# ##
$GLOBALS['wgPageFormsRedLinksCheckOnlyLocalProps'] = false;


I’m thinking I’m going to have to make a hook on ‘LinkEnd’ and in the case the link is ‘broken’ then extract the semantic properties for the page, find the same one as the link title, hope there is just one and determine the default form and modify the link appropriately.
Though this would have no context of whether you were trying to assign a semantic property to the page for that link or not, you'd have to assume? Only really if you are linking to the same page more than once on the page i guess though.






Reply | Threaded
Open this post in threaded view
|

Re: Properties no longer have default form

James HK
Hi,

> Previously you could simply put a semantic property in a template and it
> would all work e.g.  [[Has author::{{{author}}}]] if a page called
> {{{author}}} existed it would link and store the semantic property, if the
> page did not exist it would link to the default form specified for the
> property “Has author” .

The maintainer of the Forms extension has removed certain SMW related
registrations [0]. Whether there is any replacement or a different
workflow to support your scenario, I'm unable to say. Please be aware
that this relates solely to the Forms extension.

[0] https://github.com/wikimedia/mediawiki-extensions-PageForms/commit/0ef4e3d09464e95e737df01c81f24af12b476e9a

Cheers

On 1/20/17, karlpietsch <[hidden email]> wrote:

> Am I correct that you can no longer define a default form for a property of
> type Page?
>
> Previously you could with the special property “Has default form” and then
> whenever that property was used in a template and the page did not exist it
> automatically linked the redlink to the correct form.
>
> The {{#default_form:form-name}} parser function only works for defining the
> form for an existing page based on category.
>
> Previously you could simply put a semantic property in a template and it
> would all work e.g.  [[Has author::{{{author}}}]] if a page called
> {{{author}}} existed it would link and store the semantic property, if the
> page did not exist it would link to the default form specified for the
> property “Has author” .
>
> What is the correct way to reproduce this functionality now? It appears the
> only way would be to
>
> Replace
>         [[Has author::{{{author}}}]]
> with
> {{#ifexist: {{{author}}} | [[Has author::{{{author}}}]]  |
> {{#formredlink:target={{{author}}}|form=Author}}[[Has author::{{{author}}}|
> ]]  }}
>
> That’s quite tedious and ifexist is an expensive parser function and should
> not really be used on every semantic property in a template?
>
> I did notice in the PageForms extension there is a global variable that is
> unused that may hint this feature is returning? Is it?
>
> # ##
> # When modifying red links to potentially point to a form to edit that page,
> # check only the properties pointing to that missing page from the page the
> # user is currently on, instead of from all pages in the wiki.
> # ##
> $GLOBALS['wgPageFormsRedLinksCheckOnlyLocalProps'] = false;
>
>
> I’m thinking I’m going to have to make a hook on ‘LinkEnd’ and in the case
> the link is ‘broken’ then extract the semantic properties for the page, find
> the same one as the link title, hope there is just one and determine the
> default form and modify the link appropriately.
>
>
>
>
>
>
>
>
>
>
> --
> View this message in context:
> http://wikimedia.7.x6.nabble.com/Properties-no-longer-have-default-form-tp5070962.html
> Sent from the Semantic Mediawiki - User mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Semediawiki-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user