Changeset 3394
- Timestamp:
- 04/09/09 11:27:46 (3 years ago)
- Location:
- trunk/FormQueryPlugin
- Files:
-
- 2 edited
-
data/System/FormQueryPlugin.txt (modified) (12 diffs)
-
lib/Foswiki/Plugins/FormQueryPlugin/TableFormat.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/FormQueryPlugin/data/System/FormQueryPlugin.txt
r3384 r3394 264 264 *Write this:* 265 265 266 =%<nop>FORMQUERY{name="q1" search="topic=~'FAQ'" web=" Foswiki"}%= %BR%266 =%<nop>FORMQUERY{name="q1" search="topic=~'FAQ'" web="%WEB%"}%= %BR% 267 267 =%<nop>SHOWQUERY{query="q1" header=" * *Topic: Summary:*" format=" * [<nop>[$web.$topic]]: $summary(25)"}%= 268 268 269 269 *To get this:* 270 270 271 %FORMQUERY{name="q1" search="topic=~'FAQ'" web=" Foswiki"}%271 %FORMQUERY{name="q1" search="topic=~'FAQ'" web="%WEB%"}% 272 272 %SHOWQUERY{query="q1" header=" * *Topic: Summary:*" format=" * [[$web.$topic]]: $summary(25)"}% 273 273 … … 277 277 *Write this:* 278 278 279 =%<nop>FORMQUERY{name="q1" search="text=~'__Back to:__ <nop>FrequentlyAskedQuestions'" web=" Foswiki"}%= %BR%280 =%<nop>SHOWQUERY{query="q1" header="F oswiki FAQs:" format=" * $pattern(.*?FAQ\:[\n\r]*([^\n\r]+).*) [<nop>[$web.$topic][Answer...]]"}%=281 282 *To get this:* 283 284 %FORMQUERY{name="q1" search="text=~'__Back to:__ FrequentlyAskedQuestions'" web=" Foswiki"}%285 %SHOWQUERY{query="q1" header="F oswiki FAQs:" format=" * $pattern(.*?FAQ\:[\n\r]*([^\n\r]+).*) [[$web.$topic][Answer...]]"}%279 =%<nop>FORMQUERY{name="q1" search="text=~'__Back to:__ <nop>FrequentlyAskedQuestions'" web="%WEB%"}%= %BR% 280 =%<nop>SHOWQUERY{query="q1" header="FAQs:" format=" * $pattern(.*?FAQ\:[\n\r]*([^\n\r]+).*) [<nop>[$web.$topic][Answer...]]"}%= 281 282 *To get this:* 283 284 %FORMQUERY{name="q1" search="text=~'__Back to:__ FrequentlyAskedQuestions'" web="%WEB%"}% 285 %SHOWQUERY{query="q1" header="FAQs:" format=" * $pattern(.*?FAQ\:[\n\r]*([^\n\r]+).*) [[$web.$topic][Answer...]]"}% 286 286 287 287 … … 293 293 294 294 * First search: 295 * =%<nop>FORMQUERY{name="q1" search="text=~'culture'" web=" Foswiki"}% %<nop>SHOWQUERY{query="q1" format=" * $web.$topic is referenced by:$n(list all references)"}%=295 * =%<nop>FORMQUERY{name="q1" search="text=~'culture'" web="%WEB%"}% %<nop>SHOWQUERY{query="q1" format=" * $web.$topic is referenced by:$n(list all references)"}%= 296 296 * Second search. For each hit we want this search: 297 * =%<nop>DOQUERY{"(topic found in first search)" separator=", " web=" Foswiki" format="$web.$topic"}%=297 * =%<nop>DOQUERY{"(topic found in first search)" separator=", " web="%WEB%" format="$web.$topic"}%= 298 298 * Now let's nest the two. We need to escape the second search, e.g. the first search will build a valid second search string. Note that we escape the second search so that it does not get evaluated prematurely by the first search: 299 299 * Use =$percnt= to escape the leading percent of the second search … … 303 303 *Write this:* 304 304 305 =%<nop>FORMQUERY{name="q1" search="text=~'culture'" web=" Foswiki"}%= %BR%306 =%<nop>SHOWQUERY{query="q1" format=" * $web.$topic is referenced by:$n * $percntDOQUERY{\"$topic\" separator=\", \" web=\" Foswiki\" format=\"$dollarweb.$dollartopic\"}$percnt "}%=307 308 *To get this:* 309 310 %FORMQUERY{name="q1" search="text=~'culture'" web=" Foswiki"}%311 %SHOWQUERY{query="q1" format=" * $web.$topic is referenced by:$n * $percntDOQUERY{\"$topic\" separator=\", \" web=\" Foswiki\" format=\"$dollarweb.$dollartopic\"}$percnt "}%305 =%<nop>FORMQUERY{name="q1" search="text=~'culture'" web="%WEB%"}%= %BR% 306 =%<nop>SHOWQUERY{query="q1" format=" * $web.$topic is referenced by:$n * $percntDOQUERY{\"$topic\" separator=\", \" web=\"%WEB%\" format=\"$dollarweb.$dollartopic\"}$percnt "}%= 307 308 *To get this:* 309 310 %FORMQUERY{name="q1" search="text=~'culture'" web="%WEB%"}% 311 %SHOWQUERY{query="q1" format=" * $web.$topic is referenced by:$n * $percntDOQUERY{\"$topic\" separator=\", \" web=\"%WEB%\" format=\"$dollarweb.$dollartopic\"}$percnt "}% 312 312 313 313 __Note:__ Nested search can be slow, especially if you nest more then 3 times. Nesting is limited to 16 levels. For each new nesting level you need to "escape the escapes", e.g. write =$dollarpercntDOQUERY= for level three, =$dollardollarpercntDOQUERY= for level four, etc. … … 317 317 *Write this:* 318 318 319 =%<nop>FORMQUERY{name="q1" search="" web=" Foswiki"}%= %BR%319 =%<nop>FORMQUERY{name="q1" search="" web="%WEB%"}%= %BR% 320 320 =%<nop>SHOWQUERY{query="q1" limit="7" sort="info.date" format="| $web.$topic | $wikiusername | $date |"}%= 321 321 322 322 *To get this:* 323 323 324 %FORMQUERY{name="q1" search="" web=" Foswiki"}%324 %FORMQUERY{name="q1" search="" web="%WEB%"}% 325 325 %SHOWQUERY{query="q1" limit="7" sort="info.date" format="| $web.$topic | $wikiusername | $date |"}% 326 326 … … 338 338 339 339 =%<nop>CALC{$SET(weekold, $TIMEADD($TIME(), -7, day))}%= %BR% 340 =%<nop>FORMQUERY{name="q1" search="name='.*'" web=" Foswiki"}%= %BR%340 =%<nop>FORMQUERY{name="q1" search="name='.*'" web="%WEB%"}%= %BR% 341 341 =%<nop>SHOWQUERY{query="q1" sort="info.date" format="$percntCALC{$dollarIF($dollarTIME($date) < $dollarGET(weekold), <nop>, | $web.$topic | $wikiusername | $date | $rev |)}$percnt" }%= 342 342 … … 350 350 351 351 %CALC{$SET(weekold, $TIMEADD($TIME(), -7, day))}% 352 %FORMQUERY{name="q1" search="name='.*'" web=" Foswiki"}%352 %FORMQUERY{name="q1" search="name='.*'" web="%WEB%"}% 353 353 %SHOWQUERY{query="q1" sort="info.date" format="$percntCALC{$dollarIF($dollarTIME($date) < $dollarGET(weekold), <nop>, | $web.$topic | $wikiusername | $date | $rev |)}$percnt" }% 354 354 … … 369 369 Result: 370 370 </verbatim> 371 =%<nop>FORMQUERY{name="q1" search="text=~'%URLPARAM{"q"}%'" web=" Foswiki"}%= %BR%371 =%<nop>FORMQUERY{name="q1" search="text=~'%URLPARAM{"q"}%'" web="%WEB%"}%= %BR% 372 372 =%<nop>SHOWQUERY{query="q1" limit="7" format=" * $web.$topic: %<nop>BR% $summary" }%= 373 373 … … 380 380 </form><br> 381 381 Result (first 7): 382 %FORMQUERY{name="q1" search="text=~'%URLPARAM{"q"}%'" web=" Foswiki"}%382 %FORMQUERY{name="q1" search="text=~'%URLPARAM{"q"}%'" web="%WEB%"}% 383 383 %SHOWQUERY{query="q1" limit="7" format=" * $web.$topic: %BR% $summary" }% 384 384 … … 389 389 *Write this:* 390 390 391 =%<nop>FORMQUERY{name="all" search="" web=" Foswiki" extract="attachments"}%= %BR%391 =%<nop>FORMQUERY{name="all" search="" web="%WEB%" extract="attachments"}%= %BR% 392 392 =%<nop>FORMQUERY{name="big" query="all" search="size>'10240'"}%= %BR% 393 393 =%<nop>SHOWQUERY{query="big" format="|$_up.web.$_up.name|$name| $percntCALC{$dollarROUND($dollarEVAL($size / 1024), 1)k}$percnt|$percntCALC{$dollarFORMATTIME($date, $dollarday $dollarmon $dollaryear)}$percnt|"}%= … … 395 395 *To get this:* 396 396 397 %FORMQUERY{name="all" search="" web=" Foswiki" extract="attachments"}%397 %FORMQUERY{name="all" search="" web="%WEB%" extract="attachments"}% 398 398 %FORMQUERY{name="big" query="all" search="size>'10240'"}% 399 399 %SHOWQUERY{query="big" format="|$_up.web.$_up.name|$name| $percntCALC{$dollarROUND($dollarEVAL($size / 1024), 1)k}$percnt|$percntCALC{$dollarFORMATTIME($date, $dollarday $dollarmon $dollaryear)}$percnt|"}% … … 454 454 * The variable %<nop>FORMQUERYPLUGIN_ENABLE% *must* be set either globally or in the web where you want to use it. If the plugin is enabled globally (on all webs), this may have an unwelcome performance impact, as the plugin may create a cache of topics in a web where it is not intended to be used. To enable the plugin for selected webs only, put the following line into the !WebPreferences topic of the web you want to enable it on: 455 455 <pre> 456 * <nop>Set FORMQUERYPLUGIN_ENABLE = 1456 * Set FORMQUERYPLUGIN_ENABLE = 1 457 457 </pre> 458 458 * You can set a global default for the =moan= parameter by setting the =FORMQUERYPLUGIN_MOAN variable in %USERSWEB%.SitePreferences, WebPreferences in individual webs, or in individual topics. -
trunk/FormQueryPlugin/lib/Foswiki/Plugins/FormQueryPlugin/TableFormat.pm
r3382 r3394 121 121 sub _breakName { 122 122 my ( $text, $args ) = @_; 123 $text = '' unless defined $text; 124 125 return $text unless $args; 123 126 124 127 my @params = split( /[\,\s]+/, $args, 2 );
Note: See TracChangeset
for help on using the changeset viewer.
