Re: [Wikitech-l] recursiveTagParse makes data vanish

2010-11-17 Thread Cindy Cicalese
Roan Kattouw roan.kattouw at gmail.com writes:

 
 2010/11/16 Cindy Cicalese cicalese at mitre.org:
  $wgUseAjax = true;
  $wgAjaxExportList[] = 'testQueryPopulateDiv';
 
 This AJAX framework is obsolete. You should use the bot API for AJAX
 instead. Documentation is at http://www.mediawiki.org/wiki/API .
 There's a section on how to create your own modules from an extension
 too.
 
 If all you need to do is parse some wikitext without otherwise needing
 to do things in PHP (i.e. if you can generate the wikitext to parse on
 the JS side), you could use the existing action=parse module to parse
 it.
 
 Roan Kattouw (Catrope)
 

Thank you. Since I did need to do additional work in PHP before parsing, I could
not use action=parse directly from the JavaScript. But, I will investigate
switching from using the old Ajax framework to using the API.

Cindy


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Re: [Wikitech-l] recursiveTagParse makes data vanish

2010-11-16 Thread Roan Kattouw
2010/11/16 Cindy Cicalese cical...@mitre.org:
 $wgUseAjax = true;
 $wgAjaxExportList[] = 'testQueryPopulateDiv';

This AJAX framework is obsolete. You should use the bot API for AJAX
instead. Documentation is at http://www.mediawiki.org/wiki/API .
There's a section on how to create your own modules from an extension
too.

If all you need to do is parse some wikitext without otherwise needing
to do things in PHP (i.e. if you can generate the wikitext to parse on
the JS side), you could use the existing action=parse module to parse
it.

Roan Kattouw (Catrope)

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Re: [Wikitech-l] recursiveTagParse makes data vanish

2010-11-16 Thread Platonides
Cindy Cicalese wrote:
 The first issue is that I need access to the parser in the Ajax callback so I
 can call recursiveTagParse on the results for the query. I tried using
 $wgParser, but it does not appear to be in a good state in the callback. I 
 had a
 series of errors where the parser was calling functions on non-objects. I 
 played
 around with it a bit and was able to get past all of these errors with this
 rather ugly code:
 
 global $wgParser;
 $wgParser-mOptions = new ParserOptions;
 $wgParser-initialiseVariables();
 $wgParser-clearState();
 $wgParser-setTitle(new Title($title));

You are not expected to use recursiveTagParse() not being called by the
Parser. You are initializing the parser by hand.

Try instead using $wgParser-parse()



___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Re: [Wikitech-l] recursiveTagParse makes data vanish

2010-11-16 Thread Dmitriy Sintsov
* Roan Kattouw roan.katt...@gmail.com [Tue, 16 Nov 2010 18:10:51 
+0100]:
 2010/11/16 Cindy Cicalese cical...@mitre.org:
  $wgUseAjax = true;
  $wgAjaxExportList[] = 'testQueryPopulateDiv';
 
 This AJAX framework is obsolete. You should use the bot API for AJAX
 instead. Documentation is at http://www.mediawiki.org/wiki/API .
 There's a section on how to create your own modules from an extension
 too.

What if my ajax call PHP function is required for extension's client 
scripts only and is meaningless to bots? (On-page interactivity). Why 
should everything to be an API, ajax is more than bots?
Dmitriy

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Re: [Wikitech-l] recursiveTagParse makes data vanish

2010-11-16 Thread Robert Leverington
On 2010-11-17, Dmitriy Sintsov wrote:
 What if my ajax call PHP function is required for extension's client 
 scripts only and is meaningless to bots? (On-page interactivity). Why 
 should everything to be an API, ajax is more than bots?

Because it provides a consistent, clean framework for making and
handling requests with the potential to reduce duplication in a lot of
cases.  The API is not just for bots.

Adding an API module is fairly trivial and is the correct way to provide
AJAX interactivity.

Robert

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Re: [Wikitech-l] recursiveTagParse makes data vanish

2010-11-16 Thread Dmitriy Sintsov
* Robert Leverington rob...@rhl.me.uk [Wed, 17 Nov 2010 07:38:23 
+]:
 Because it provides a consistent, clean framework for making and
 handling requests with the potential to reduce duplication in a lot of
 cases.  The API is not just for bots.

API is supposed to be useful for another (remote) clients. Some of my 
ajax calls are useful only locally and only to my own extension. Why 
should I expose these openly.

 Adding an API module is fairly trivial and is the correct way to 
provide
 AJAX interactivity.

In some cases it's unneeded complication, where you have to build the 
tables of parameter types, parameter descriptions and so on. And also 
expose all of that functionality in api.php help.

I use both API and wgAjaxExportList[], for different purposes. I may 
completely switch to API, however that doesn't look nice to me. But 
anyway, you decide.
Dmitriy

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l