Extension talk:CreateBox
From MediaWiki.org
Contents |
[edit] Clear on Focus
Suggestion to add to this extension, an option 'clearonfocus' which lets the default value in the createbox act as a suggestion for the user - when they click in the box the default value disappears and if they leave it empty and click out, the default value re-appears.
Add the few lines before the $output= line, and also add the $focushtml variable to the createboxInput line (fourth from the bottom here).
$submit = htmlspecialchars($wgScript);
$width = acGetOption($input,'width',0);
$align = acGetOption($input,'align','center');
$br = ((acGetOption($input,'break','no')=='no') ? '' : '<br />');
$label = acGetOption($input,'buttonlabel',wfMsgHtml("createarticle"));
//---
if (acGetOption($input,'clearonfocus',0) == 0)
$focushtml = '';
else
$focushtml =<<<FOCUSCODE
onblur="javascript:if(this.value=='') this.value='{$text}';" onfocus="javascript:if (this.value=='{$text}') this.value='';"
FOCUSCODE;
//---
$output=<<<ENDFORM
<div class="createbox" align="{$align}">
<form name="""createbox""" action="{$submit}" method="get" class="createboxForm">
<input type='hidden' name="""action""" value="create">
<input type="hidden" name="""prefix""" value="{$prefix}" />
<input type="hidden" name="""preload""" value="{$preload}" />
<input type="hidden" name="""editintro""" value="{$editintro}" />
<input class="createboxInput" name="""title""" type="text" value="{$text}" size="{$width}"{$focushtml}/>{$br}
<input type='submit' name="""create""" class="createboxButton" value="{$label}"/>
</form></div>
ENDFORM;
Instructions for use: Add clearonfocus=1 to enable (or any non-zero value)
-
- Somehow this is not working for me (Mediawiki 1.11.1). Added these six lines and the variable, but nothing happens...what am I missing? 193.200.193.146 04:19, 18 March 2008 (UTC)
[edit] Sidebar
Is it possible to add this to the sidebar like the searchbox?
[edit] Bug:Preload
The Preloaded content dosent show... I have tested it on www.gamemedia.jackphoenix.com and it dosent show in the editing field- --62.128.243.228 13:57, 11 August 2007 (UTC)
- The page you need to load from needs to be in the namespace "Template" (i.e. Template:Name_of_page). Then, you create the CreateBox with the parameter "preload=template:Name_of_page"
[edit] Invalid XHTML
In the next version, could <input type='hidden' name="""action""" value="create"> possibly be fixed for XHTML compliance? That is; <input type='hidden' name="""action""" value="create" />. Seeing as it's the only one I'm guessing it was intended as closed. Another note on XHTML-compliance (which this extension might not have control over) is the placement of the form-element. The start-tag is placed within a p-element (which is an invalid location for a form), and the end-tag is outside said p-element (defining the start inside and end outside is invalid in XHTML). Such as:
<p><form ...> ... </p></form>
213.100.72.86 19:06, 8 January 2008 (UTC)
[edit] Bug with Prefix
I emailed the person who created the extension, but here is my bug I have, if anyone can help...:
If I put a Prefix, it will always create the page. Here is an example:
- the prefix is: Issue
- In my input box, to create a page, I put L345
- The page Issue L345 is created.
- I go back to my CreateBox input with prefix Issue and write down L345
- The page Issue Issue L345 is created, instead of saying: "The page Issue L345 is already created, do you want to edit or read, etc..."
Is it possible to fix this bug?
Thanks a lot!
--199.243.65.6 17:16, 13 March 2008 (UTC)
[edit] I think I fixed
Ok, I fixed the bug, but I'm not sure of the consequences of this... Please advise of any
Line 143 to
$query = "action={$action}" . //&prefix=" . $wgRequest->getVal('prefix') . "&preload=" . $wgRequest->getVal('preload') . "&editintro=" . $wgRequest->getVal('editintro') . "§ion=" . $wgRequest->getVal('section');
[edit] Have default text automatically set as current date and time?
Is this possible? - Derrickfarnell 19:28, 17 May 2008 (UTC)
[edit] Prefix & {{PAGENAME}}
I'm hoping to use this to help with subpage creation from a given page, and to generify the function (e.g. so I could easily include it on many pages), wanted to pass "{{PAGENAME}}/" in as the prefix. However, this was interpreted literally - So I added the line below. It is probably not elegant or complete - but addresses my need. :-)
In function acMakeBox:
function acMakeBox($input, $argv, &$parser) { global $wgRequest, $wgScript; if(...) { // .... } else { $prefix = acGetOption($input,'prefix'); // below line added by DEF to account for {{PAGENAME}} variable usage in "prefix" variable of CreateBox.. $prefix=str_replace("{{PAGENAME}}",$parser->getTitle()->getText(),$prefix); // .... }
- Could you give an example of how to use your add-on ? Thanks. --Colonna 16:53, 28 September 2008 (UTC)
[edit] need an Installation paragraph
It is not said in the extension page that
require_once($IP . "/extensions/CreateBox.php" );
is needed in LocalSettings.php. Could someone do it ? Thanks. -----Colonna 16:53, 28 September 2008 (UTC)