[SMW-devel] how to know the validation option for the parameters in SMWResultPrinter::getParamDefinitions( )?

2013-10-11 Thread Yury Katkov
Hey guys, especially Validator lovers and especially Jeroen!

If I understand correctly we can now use this beautiful function
SMWResultPrinter::getParamDefinitions in our result printers to
validate if all the parameters of {{#ask}} function is ok. Typically
the text of overrided getParamDefinitions function looks like that:


public function getParamDefinitions( array $definitions ) {
 $params = parent::getParamDefinitions( $definitions );

 $definitions['limit']-setDefault( $GLOBALS['smwgQMaxInlineLimit'] );
 $definitions['link']-setDefault( 'none' );
 $definitions['headers']-setDefault( 'hide' );

 ### new params: ###
 $params['titles'] = array(
 'message' = 'srf_paramdesc_pagetitle',
 'values' = array( 'show', 'hide' ),
 'aliases' = array( 'pagetitle', 'pagetitles' ),
 'default' = 'show',
 );

$params['hidegaps'] = array(
'message' = 'srf_paramdesc_hidegaps',
'values' = array( 'none', 'all', 'property', 'record' ),
'default' = 'none',
'manipulatedefault' = false,
);

}

It looks like magic for me but I feel that these are very powerful spells.

Where did these words 'message', 'values', 'default', 'aliases' come from?
What values can I use for the values of the key 'default'?
Are there any other interesting words to use (for example 'mandatory'
would be nice or 'type')?
Is there any documentation on that anywhere?

Cheers,
-
Yury Katkov, WikiVote

--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60134071iu=/4140/ostg.clktrk
___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] how to know the validation option for the parameters in SMWResultPrinter::getParamDefinitions( )?

2013-10-11 Thread Jeroen De Dauw
Hey Yury,

This is unfortunately not properly documented, and as with a lot of MW
code, the answer is, at least for now, look at the source. This is
certainly not a good answer and something that should be addressed. Rather
then answering in detail here, I'll be adding documentation incrementally
to the README file of Validator with the aim of having the basics covered
there by the time of its 1.0 release, which will be shortly before the SMW
1.9 one.

The README can be seen here:
https://github.com/wikimedia/mediawiki-extensions-Validator/blob/master/README.md

Some quick replies:

 What values can I use for the values of the key 'default'?

Anything. This is self defined.

 Where did these words 'message', 'values', 'default', 'aliases' come from?

This is the definition format in array form as defined by Validator.

 Are there any other interesting words to use (for example 'mandatory'
would be nice or 'type')?

There is a type field. A param is mandatory if it does not have a default.

Cheers

--
Jeroen De Dauw
http://www.bn2vs.com
Don't panic. Don't be evil. ~=[,,_,,]:3
--
--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60134071iu=/4140/ostg.clktrk___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel