MK wrote:
> Just to clarify: the special page will be a form.  The fields
> correspond (approximately) to the structure of the pages in the wiki,
> for example, here the page listing mediawiki itself:
> 
> http://directoryng-dev.fsf.org/wiki/MediaWiki
> 
> Nb, this information appears outdated (lol) but don't bother creating a
> user to correct it (yet) as the site is still in development.  

Wow, that information is way old. Not even one of the external links is
right (although some addresses are probably still accepted).
Note that the mediawiki version used is not the latest one (you are
using 1.15.1, you should use 1.16.0 or 1.15.5).

> Anyway,
> if you view the source you'll notice the page uses more than a dozen
> templates (one megalithic template was not flexible enough) and a
> similar number of Semantic properties, and I want to spare the user
> these details. So the form data will be processed to create a page.
> You say I do not need to access api.php to do that, therefore I don't
> need to password to get an "edit" token, etc -- how would I go about
> that?
> 
>> No problem. You can require a right in order to use that Special Page.
>> Take a look at how other restricted special pages do it.
> 
> Yes, if I understand that correctly, it is done with group privileges.
> However, I still need to be able to attach the *specific user* to the
> creation of the page (there may be a separate database for that or just
> embedded comments, not sure yet). 
> 
....
> Okay, I guess this is sort of re-iteration, but how would a special
> page "directly insert the article" -- keeping in mind it needs to
> return form data to a php script on the server for processing which
> will add the MW + Semantic markup?   Again, I do not want to require
> the user to learn the templates, or the chance to screw them up, etc.,
> so it cannot be a simple "create page".

Calling Article::doEdit()
It would look similar to this:

$title = Title::newFromText( $wgRequest->getVal( 'title' ) );
$article = new Article( $title )
$text = '{{FSWhead|short=' . $wgRequest->getVal( 'short' ) . '|full=' .
$wgRequest->getVal( 'full' ) . '|home=' $wgRequest->getVal( 'home' ) . "}}";
$article->doEdit( $text, "Special page edited article" );

Article::doEdit() has a user param, but if it is not provided, it will
automagically use the user which submitted the form to the special page.


_______________________________________________
MediaWiki-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l

Reply via email to