Extension talk:CreateRedirect

From MediaWiki.org
Jump to: navigation, search

[edit] Error with 1.13

When I go to Special pages, it fails. I traced the error to line 43 in .body.php. The line should read

if ( $messagesLoaded ) return true;

This fixes it for me.


[edit] i18n doesn't work

The i18n-file does only work in the list on Special:Specialpages, but not on Special:Createredirect.

The English messages in this form (CreateRedirect.body.php) seem to be hardcoded:

    function execute( $par ) {
        global $wgRequest, $wgOut, $wgTitle, $wgUser;
        
        // 1. Do some prep stuff. We call $this->setHeaders() (a method of SpecialPage) for the page, and we also initialize $output, which will hold the text output to serve with the page.
        $this->setHeaders();
        $output = "";
        
        // 2. Break from here: "crWrite" determines whether we're serving the form or we're performing the write routine. We send it along with the form on submission, so if we see a POST var "crWrite", then we've got form data to process; if it's not there, then we don't have form data to process, and we have to serve the form.
        if(!$wgRequest->getVal('crWrite')) { // Serve the form!
            // 1. Get the local URL for the "action" param, used by <form>. This points the form back to this page (again), where if crWrite exists (which it does,) we process the submitted form.
            $action = $wgTitle->escapeLocalURL();
            $crTitle = $wgRequest->getText("crTitle"); // Also retrieve "crTitle". If this GET var is found, we autofill the "Redirect to:" field with that text.
            
            // 2. Start rendering the output! The output is entirely the form. It's all HTML, and may be self-explanatory.
            $output .= "<p>Using the form below, you can create a redirect page or replace an existing page with a redirect.</p>";
            $output .= <<<END
<form id="redirectform" name="redirectform" method="post" action="$action" enctype="multipart/form-data">
<table>
<tr>
<td><label for="crOrigTitle">Artikkelnavn:</label></td>
<td><input type="text" name="crOrigTitle" id="crOrigTitle" size="60" tabindex="1" /></td>
</tr>
<tr>
<td><label for="crRedirectTitle">Omdiriger til:</label></td>
<td><input type="text" name="crRedirectTitle" id="crRedirectTitle" value="{$crTitle}" size="60" tabindex="2" /></td>
</tr>
<tr>
<td />
<td><input type="submit" name="crWrite" id="crWrite" value="Opprett" tabindex="4" /></td>
</tr>
</table>
</form>
END;
            $output .= <<<END
<script language="javascript">
//<![CDATA[
document.redirectform.crOrigTitle.focus();
//]]>
</script>
END;

Marius, 9. Nov 2009

Personal tools
Namespaces
Variants
Actions
Site
Support
Download
Development
Communication
Print/export
Toolbox