Jim,
Thanks for all the responses.
We got my code working with POSTing a simple HTML form using SpecialPages. The problem is I was using exit(); in my code. This affected output which is buffered in MediaWiki. Thanks to lch on IRC for the find.
- Steve
Jim Hu wrote:
Hi Steve,
I'm confused about what you want to do. I just did an experiment using the Includable example you linked to. I replaced the function execute with:
function execute( $par = null ) { global $wgOut, $wgRequest; if ( $this->including() ) $out = "I'm being included"; else { $out = "I'm being viewed as a Special Page"; $this->foo = $wgRequest->getText('foo'); $out .= " Last submission:".$this->foo; $out .= "<form method='post'><input name='foo' type='text'
value='".$this->foo."' size='20' maxlength='255'></form>"; $this->setHeaders(); }
$wgOut->addHtml( $out ); }
}
It shows as Special:Includable and prints whatever was entered into the single input box to the screen when it reloads (I just submitted with return; if I was doing this for a real page I would add a submit button)
Hope this helps.
Jim
On Apr 16, 2007, at 11:13 AM, Steve Finkelstein wrote:
I hate replying to my own e-mail. However, after some discussion with more savvy MediaWiki type on IRC, its been discovered that MediaWiki does not like POST requests via forms, at least for SpecialPages. When I hit submit on my form using code from http://stevefink.net/mediawiki/ldaptools_body.php, a blank page comes up.
If anyone has any idea if there is a workaround, or if it's not possible so I can exhaust my efforts, that would be great.
Thanks much,
- sf
Steve Finkelstein wrote:
Hi Rob,
I've tried your method and it's the same as omitting an action all together, which posts to PHP_SELF. The form ends up redirecting to a bad title page:
Bad title From MedLime Jump to: navigation, search
The requested page title was invalid, empty, or an incorrectly linked inter-language or inter-wiki title. It may contain one or more characters which cannot be used in titles.
Return to Main Page.
- Steve
Rob Church wrote:
On 16/04/07, Steve Finkelstein sf@stevefink.net wrote:
$wgOut->addHTML('<form method="POST"
action="'.$_SERVER['PHP_SELF'].'">');
Variables won't be interpolated inside single quotes. Use something like:
global $wgTitle; $action = $wgTitle->escapeLocalUrl(); $wgOut->addHtml( "<form method="post" action="{$action}">" );
[The use of $wgTitle, or another constructed Title object representing the special page, is the standard method of obtaining a canonical URL in MediaWiki.]
Rob Church
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
===================================== Jim Hu Associate Professor Dept. of Biochemistry and Biophysics 2128 TAMU Texas A&M Univ. College Station, TX 77843-2128 979-862-4054
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
!DSPAM:1020,46239900120161259319195!