Extension talk:InputBox
From MediaWiki.org
For the page history, see also [1].
Any user names refer to users of that site, who are not necessarily users of MediaWiki.org (even if they share the same username).
Is it possible to use this input box on other wiki's because i've tried it and the raw syntax displays as text, any idea's/help plese?
[edit] Installation
Download the file inputbox.php to the folder extensions of your MediaWiki installation. Add the line require_once("extensions/inputbox.php"); to LocalSettings.php.
[edit] I HOPE INPUTBOX can preload any word
such as [[Category:xxx]] {{xxxx}} [[xxxx]].....
[edit] It would be good if ...
the button label "create article" can be customized, like "create city article".--Patrick 6 July 2005 10:22 (UTC)
- Yes, that idea is good! I'd also like to be able to define a prefix for the created page. That way, I could place it on, say, Wikipedia:Votes for deletion and only need to enter "Alpha" to create Wikipedia:Votes for deletion/Alpha. As it is I'd have to manually enter the prefix each and every time I wanted to add a page. Master Thief Garrett 7 July 2005 21:10 (UTC)
-
- Yup that is definitely a nice way to go, and furthermore you could customize the prefix at will, so you can create, for instance, a category by only putting the name, and the page Category:name would be created. 82.242.132.211 21:45, 8 October 2005 (UTC)
Copied from Talk:Inputbox
-
-
- Yes, I would like to have an input box to create a page in a specific namespace, so the prefix idea would be really useful. —Celtic Minstrel 13:41, 11 March 2008 (UTC)
-
In w:Wikipedia:Village pump (proposals)#User talk inputbox, Angela proposes using this extension to add messages to user talk pages, with the note that it only works for previously blank talk pages. To make this truly effective, it would seem expedient to add a third type, corresponding to the new section "+" functionality of talk pages. Arguably, such a type should insert " talk" into the namespace if not already present.
And would it be hard to add the facility to use an explicit message string rather than just a reference to a template?
Bovlb 04:55, 6 Jul 2005 (UTC)
[edit] bugzilla references
bugzilla:02805(fixed) – "<inputbox> should allow to set predefined titles"- bugzilla:02847 – "<inputbox> usage of template constructs to generate the "default" option"
- bugzilla:02842 – "<inputbox> should allow alternatively to place the header *between* the inputbox and the button not only above the inputbox"
bugzilla:02844(fixed) – "<inputbox> should allow allow to label a button differently then MediaWiki:Createarticle"
[edit] undefined function: wfmsghtml()
Fatal error: Call to undefined function: wfmsghtml() in /var/www/.../extensions/inputbox.php on line 124
Where this wfMsgHtml come from ?
Which MediaWiki version is required ? I've 1.4.4, I'll try to upgrade.
Iubito 07:53, 30 July 2005 (UTC)
- I found that said function is only present since version 1.5alpha2. For 1.4.x, you'll need inputbox.php version 1.3 (this is the last one without the wfMsgHtml() call)
- Have fun!
- Wolfram. 217.5.190.74 06:56, 3 August 2005 (UTC)
[edit] Preload Function does not work.
I have Mediawiki version 1.4.7. I use version 1.3 of the extension. Any suggestions on what could be a problem? Oh, and the "default" option is not working either. But create new page and search work fine. Also, the button text is enclosed between < > brackets. Such as "<searchfulltext>". Any idea how to get rid of the brackets? Thank you. Your help is appreciated.
- You won't be able to use preload without MediaWiki 1.5, as this part of the code resides in MediaWiki itself and does not exist in 1.4. However, you should be able to get the correct messages by editing (creating) MediaWiki:text in brackets, e.g. MediaWiki:Searchfulltext. In 1.5, these already exist.--Eloquence 01:57, 25 August 2005 (UTC)
-
- I have sort of a similar problem, except the angle brackets are displaying as raw HTML. I already made sure the MediaWiki messages (Searchfulltext, tryexact, createarticle) exist and have the proper messages; they do (and the messages are just text, with no brackets), but the buttons won't change. Any idea? I'm running 1.11.0. Also, my site is here, for reference's sake. --Azurite 23:59, 28 October 2007 (UTC)
[edit] Integration with Multiple Starting Text Hack
(Or: how I got the same functionality with 1.4)
Well, I really wanted this and I'm scared @#$%less of upgrading, so I downloaded and tried it. As noted in the previous comment, preload doesn't work. However, if you add a couple lines to the inputbox.php files in the right places, you can use the multiple starting text hack to do your preloading for you.
This is somewhat dependent on how you have that particular hack installed, but for me it was the following:
- Add a getBoxOption. Not too difficult, just add it where the others are.
getBoxOption($inputbox->starttext,$input,"starttext");
- In Class InputBox, where the variables are given, just add $starttext in one of the lines.
- Where the HTML to be rendered for the CreateBox is given, just add this in the input box stuff.
<input type="hidden" name="starttext" value="{$this->starttext}_StartText">
Note that on my Wiki, I use many namespaces and thus have a {{NAMESPACE}}_StartText theme going. See the Multiple Starting Text Hack discussion for more information.
So that's what works for me. Not sure, but there might be a way to implement the editintro parameter in a similar way. It doesn't really fit my needs, though, so I haven't mucked with it.
I hope that helps someone, and (as per usual) I am extremely hopeful that I didn't just point out something that's extremely obvious.
[edit] Umvalid!
http://validator.w3.org/check?uri=http%3A%2F%2Fmeta.wikimedia.org%2Fwiki%2FHelp%3AInputbox --Paddy 10:42, 25 November 2005 (UTC)
- The code created by the extension isn't invalid, but when you place more than one box of the same type on a page, all that boxes have got the same id --Three Of Twelve 13:21, 21 February 2006 (UTC)
-
- The code outputted isn't valid in general. I'm getting errors.
<table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td align="center" bgcolor="#eeeeff"> <p><form name="createbox" action="/index.php" method="get" class="createbox"> <input type='hidden' name="action" value="edit"> <input type="hidden" name="preload" value="StoryTemplate" /> <input type="hidden" name="editintro" value="" /> </p><p> <input class="createboxInput" name="title" type="text" value="Enter Title Here" size="50"/><br /> <input type='submit' name="create" class="createboxButton" value="Create Story With Title Above"/> </form> </p> </td> </tr> </table>
-
-
- This is still an issue. My wiki's main page is invalidated only because of this create form. Not sure about what is wrong, I believe a form can't be placed in a p, but I'm not 100% sure. Patheticcockroach 09:27, 23 March 2009 (UTC)
-
[edit] Inputbox on Meta
I found this extension on the very day I started looking for such a feature -- but only thanks to luck -- it'd be very neat if the page showed up in the search results for 'forms' or 'html forms' or 'HTML forms'!!! -- yet I don't know if it's possible?
[edit] type=comment
It would be great if you could choose to add the comment at the top instead of the bottom to get a list with the most reasent comments at the head. --213.115.0.20 13:46, 1 December 2005 (UTC)
- +1! --80.109.61.51 10:39, 19 June 2006 (UTC)
[edit] Namespace Specific Searches
Does/could this extension support a parameter listing a set of specific namespaces to be searched? The URL for such searches appears to be in the form: ".../index.php/Special:Search?ns110=1&search=SEARCHTERM&searchx=Search"
Tdoyle 14:16, 17 January 2006 (UTC)
- I second this! We would specifically like it for the b:Cookbook (namespace 102!). Also, we would like a FULLTEXT-only search box (like search2, but reversed) since searching for an article name in the cookbook is rather pointless. Kellen T 80.229.36.69 18:03, 6 April 2006 (UTC)
[edit] define namespace (type=create)
I added a couple of lines that allow to define the namespace the article will be created in. Could it also be included in regulary versions? I added a "namespace" parameter and changed the HTML-Code in getCreateForm() as follows:
<form name="createbox" action="$action" method="get" class="createbox" onsubmit="if (document.createbox.pagename.value.substring(0,'{$this->namespace}:'.length) != '{$this->namespace}:') {document.createbox.title.value = '{$this->namespace}:' + document.createbox.pagename.value;} else {document.createbox.title.value = document.createbox.pagename.value;}">
<input type='hidden' name="action" value="edit">
<input type="hidden" name="preload" value="{$this->preload}" />
<input type="hidden" name="editintro" value="{$this->editintro}" />
<input type="hidden" name="title" value="" />
{$comment}
<input class="createboxInput" name="pagename" type="text"
value="{$this->defaulttext}" size="{$this->width}"/>{$this->br}
<input type='submit' name="create" class="createboxButton"
value="{$this->buttonlabel}"/>
</form>
(maybe, you might be able to realize that function easier ;) --Three Of Twelve 21:21, 24 January 2006 (UTC)
- by removing the colon the subpage-function could be integrated and other prefixes, too --Three Of Twelve 18:18, 25 January 2006 (UTC)
[edit] MediaWiki v1.5: Output error
I'm getting a strange error running Inputbox with MediaWiki v1.5 ...
when i add a text inputbox to a page using the syntax described on the Help page i get the following output instead of a textbox when the page is rendered:
NaodW29-inputbox319e48674cc47cb700000001
I'm very new to all of this but haven't any trouble installing extensions in the past. Unfortunately i don't even know where to begin looking for a solution. 72.139.230.29 22:16, 28 January 2006 (UTC)
I had the same problem. I solved it by moving the InputBox code to a template. The problem occured when the InputBox code was on the same page as a call to a template with http://meta.wikimedia.org/wiki/MenuTabs code. Now both MenuTabs code and InputBox code are in templates and I can use them on the same page. Michiel.82.170.134.93 20:56, 5 February 2006 (UTC)
[edit] editintro
Could this box be modified, so that the 'editintro' does work on existing articles? Currently, when editing existing articles, no header text appears, but I'd like for it to be possible for editors to specify that text should appear in special cases. For example, on the Wikipedia Reference Desk, it would be possible to include a reminder of the rules in a header above each edit window, so that newbies can be gently guided.
Is there a reason the editintro is ignored by default when editing existing pages? -- Ec5618 00:07, 29 January 2006 (UTC)
This is something that we at the Vietnamese Wikipedia would much like, because there's obviously a lot more you can do in wikitext than in HTML comments to make editing a page more user-friendly. – Minh Nguyễn (talk, contribs) 06:18, 18 February 2006 (UTC)
[edit] Add to a defined category
who use this? in my mediawii,1.82 i can't find this $text=$this->getPreloadedText($preload);
I wanted the extension to work from a category page and make a new page within the category from which it is created. I made the following changes and thought they may be useful to others. This is very much a hack, but feel free to incorporate it properly into the software if it's seen to be a good feature.
First, change the inputbox extension to include the following lines: In the function "renderinputbox" add this line near the others:
getBoxOption($inputbox->catname,$input,'catname');
This allows you to pass the variable 'catname', which you define when you write the extension.
Under "class InputBox', add $catname to the variable listing.
Then, near the bottom of the file, add this line near the others for the form creation: <input type="hidden" name="catname" value="{$this->catname}" />
Then, in article.php (in the includes folder), add in the following: Under "function getContent" add in:
$catname = $wgRequest->getText( 'catname' );
So it reads in the variable.
Then, change:
$text=$this->getPreloadedText($preload);
to:
$text=$this->getPreloadedText($preload,$catname);
And another version about 15 lines down, to pass the variable to the function.
In function getPreloaded text, change the function call from: getPreloadedText($preload) to getPreloadedText($preload,$catname)
And finally, change:
if($rev) {
return $rev->getText();
}
}
to this:
if($catname) {
$cattext = "\n\n[[Category:" . $catname . "]]";
}
else {
$cattext = "";
}
if($rev) {
return $rev->getText() . $cattext;
}
}
That's it, you should be able to pass a category now. Change as you see fit to pass another variable to the page you're creating. Good luck!
[edit] Pre-box label
Can we get a label before the input box? æle ✆ 01:09, 17 February 2006 (UTC)
- Take a look at the code - you should easily be able to hack that yourself, even without understanding PHP.--Eloquence 02:29, 17 February 2006 (UTC)
[edit] bug? inputbox interrupts a numbered list
The inputbox is great but it seems to interrupt a numbered list:
# Green # Red # Blue # New colors (add your own):<inputbox>type=create</inputbox> # Purple # Orange
- Green
- Red
- Blue
- New colors (add your own):
- Purple
- Orange
Any idea on how to fix? Arghman 22:35, 23 February 2006 (UTC)
- The InputBox is wrapped in a <div> element, forcing it to be block level. The sanitiser is probably cleaning up what it sees as a still-open <ol> container; or the browser is ignoring the invalid XHTML. This isn't an InputBox-specific problem. Rob Church Talk 07:30, 9 March 2006 (UTC)
[edit] error message
Hi I'm *very* new to MediaWiki and installing an inputbox is my first ever extension, but I get the following warnings when I try to save the page (I've followed the instructions on uploading inputbox.php and edited LocalSettings.php),
Warning: Missing argument 3 for renderInputbox() in /home/.../public_html/extensions/inputbox.php on line 42
Fatal error: Call to a member function getText() on a non-object in /home/.../public_html/extensions/inputbox.php on line 60
Any pointers would be much appreciated
Hello, I get the exact same error and to be honest I have no idea where to look to solve it. Please help. jrleonard@gmail.com
--CMacedo 08:32, 4 March 2006 (UTC) I also get the same error message. Are you two using EasyPHP? This is the only thing I can see that may be affecting the functioning of the extension.
PHP Version: 4.3.10
- I've got the same message too with easyphph AND on my distant website with Mw 1.5.6 (PHP: 4.4.0 (apache2handler) MySQL: 4.1.10a-log ), thanks for help. --Henrique 01:42, 3 March 2006 (UTC)
[ 3/3/2006 ] Same error here, using php on Solaris:
PHP 5.0.4 (cli) (built: Jun 28 2005 22:24:45)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.4-dev, Copyright (c) 1998-2004 Zend Technologies
- Getting the same error on RHEL 3, Apache 2, PHP 4.3.2. I am not using EasyPHP. --Bradley Holt 18:09, 3 March 2006 (UTC)
Same error here, PHP 5.0.5/Netware - this file needs to be rewritten to be compatible with the latest versions of PHP.
- See http://www.gurusnetwork.com/discussion/thread/2109/ and http://www.ozoneasylum.com/5733 for some hints to fix it
Same here - I tried php 4.4.2 and 5.0.4 ... 63.229.127.222
[edit] Quick Fix
After some browsing around and quick hashing of the code I found that the following addressed the issue. However, please note that this has not yet been tested fully. Please add any issues you encounter.
Line 40: Delete variable &$parser so the function now looks like this
function renderInputbox($input, $params)
Line 60: Comment out the entire line starting $boxhtml=str_replace...:
# Maybe support other useful magic words here
# $boxhtml=str_replace("{{PAGENAME}}",$parser->mTitle->getText(),$boxhtml);
--CMacedo 08:32, 4 March 2006 (UTC)
-
- Does this disable the parser? Because that could be dangerous (allowing sql injection, html tags, etc)
Extensions don't have the power to totally disable the parser; this is just ignoring the reference to the parser passed to all parser hooks. Rob Church Talk 07:32, 9 March 2006 (UTC)
That fixes the problem. Thanks. Looks like lots of people are having this same issue, trying to perform a non-object operation on that variable.
[edit] MediaWiki 1.5: inputbox is not working
MediaWiki v1.5
I'm sure i followed the instructions, but when i added the inbox code into a page, the browser just hung up at .....wiki/index.php?title=Test&action=submit
Doesn't work with any other browser. Can someone give me a hand? I don't know whereelse to put this. Thanks.
- First of all, upgrade from 1.5.0 to 1.5.7; your version of MediaWiki contains about four largish bugs or security issues. Next; we'll need more information in order to diagnose the problem. What you actually did; what your Apache/other HTTPD/PHP error logs state (if at all, if not, turn them on and see what comes up) etc. Rob Church Talk 07:34, 9 March 2006 (UTC)
[edit] MediaWiki 1.5.7: inputbox.php 1.20 hangs up while 1.19 works
MediaWiki 1.5.7 on Red Hat Enterprise 4 WS: With inputbox.php 1.20 version you can observe on /var/log/httpd/error_log
[client 160.xxx.yyy.zzz] PHP Warning: Missing argument 3 for renderinputbox() in /var/www/html/wiki/extensions/inputbox_1.20.php on line 42
[client 160.xxx.yyy.zzz] PHP Fatal error: Call to a member function on a non-object in /var/www/html/wiki/extensions/inputbox_1.20.php on line 60</nowiki>
I downloaded version 1.9 from MediaWiki's SourceForge CVS and it seems to work alright.
--Canne 23:27, 4 March 2006 (UTC)
Exactly like you said. Thanks Canne! It's working now.
--Ming 23:27, 4 March 2006 (UTC)
[edit] Windows?
I have a windows installation, with IIS, which otherwise works fine. I installed Inputbox.php etc, no errors, but it just doesn't work. It seems to be running the script ok, it just doesn't render the box or translate the tags. Any ideas?
- What version of MediaWiki? Confirm that the extension is installed; check Special:Version and see what extensions are registered. Consider adding a line like
echo( "Hook run!\n" );
- to the parser hook function, to prove that's being executed. Rob Church Talk 07:28, 9 March 2006 (UTC)
[edit] Inputbox on the sidebar?
I just installed this extension, and it's working great.
My question is; is it possible to put a "Create Article" inputbox on the sidebar? I tried to just add one beneath the last link, but the sidebar doesn't seem to recognize it. When viewed as an article, the MediaWiki:Sidebar page displays the inputbox fine.
Is there something different I have to do, or is this just not possible. If it's not possible, is there another way to have some kind of "create article" link on the sidebar?
- The sidebar doesn't interpret wiki text quite as you seem to expect. You could add such a box via edits to the skin file. Another semi-solution might be to set
$wgGoToEdit = true;in LocalSettings.php, which causes the user to be taken to an edit form if entering a nonexisting title and clicking Go. Rob Church (talk) 12:48, 13 June 2006 (UTC)- “You could add such a box via edits to the skin file”
- can you elaborate for those who are new users...
[edit] noinclude and includeonly
I created a fairly simply set up to add creatures to a database on SporeWiki.com. The section " Create a creature portal page" preloads MediaWiki:Content base/creature portal as I wanted it to, when setting it up I was really hoping that includeonly would work so that it didn't sort the mediawiki pages (since the portal template has a cat tag in it) and I found out that it does work (as you can see if you test the inputbox on the creature database page yourself). Then I wanted to be able to keep all of the messages related to adding creatures in the same place, so I figured I'd just categorize them with noinclude, but if you test out the inputbox you'll see that that portion of the code doesn't do what I thought it might... Is there any reason why that would happen, is it a mediawiki bug or an inputbox bug? Is there any temporary fix to get around it (I already set up an if template if that could be useful) for now until noinclude works in that manner? It'd be appreciated, thanks! 69.183.38.170 17:30, 7 June 2006 (UTC)
- All I can say is "interesting problem". Apparently the includeonly tags are stripped keeping the content, but noinclude tags + content are kept as is (?). Maybe an oddity in the inputbox extension, you could report it as "bug" / missing feature / oddity at mediazilla: (component "extensions" "inputbox").
- And / or try a workaround based on #ifeq: MediaWiki | {{NAMESPACE}}. But I've never seen a category for system messages, better test first if that's possible at all. If not you could use an ordinary template message instead of a system message for your inputbox - the help page only uses MediaWiki examples because they are guaranteed to exist and can't be vandalized. -- Omniplex (w:t) 20:30, 12 June 2006 (UTC)
- I don't know how to report bugs, and I'm not sure what you mean by a a workaround with that, but I moved it to a template and preloaded the template again and it did the same that it did earlier, loading the noinclude tag and it's text also. 69.183.39.72 05:54, 13 June 2006 (UTC)
- I updated the page after trying it out with m:Template:Preload demo (talk, backlinks, edit).--Patrick 14:10, 13 June 2006 (UTC)
-
-
- See Bug #5210.
- --99.236.115.46 05:20, 10 October 2007 (UTC)
-
[edit] using an imageTEMPLATE with parameters as the 'preloaded' thing
Is it possible? All this subst and includeonly is starting to get to me, along with nested templates...
I'm trying to simplify the process of nominating an image for FPC. see here: commons:User:Pfctdayelise/test. Any tips welcome. This is a really handy extension BTW. pfctdayelise 12:11, 15 June 2006 (UTC)
- I do not think that is possible. As a minor typing aid you can preload m:Template:T image preload (talk, backlinks, edit), that is all I can think of.--Patrick 13:04, 15 June 2006 (UTC)
- You can also preload m:Template:T image preload 2 (talk, backlinks, edit) containing subst of m:Template:T image preload 3 (talk, backlinks, edit). Here you fill in the image name as parameter of the latter. There is still some duplication: the Subject/headline probably has to contain the image name too, but this is not automated.
- Patrick 13:23, 15 June 2006 (UTC)
[edit] Using inputbox to subscribe to a mailing list?
I'm looking for an extension which will allow a user to enter his/her email adress and submit the value to an external http address. I already got the HTML code for this from the mailing list service, but have trouble building it into MW properly. Could inputbox (currently or potentially) be used for this? --MortenB 21:18, 29 July 2006 (UTC)
- make a modifies version of inputbox.php that will post the input boxes contents to the php page you wish, then have the php page do whatever with the email then redirect them wherever. ;) --71.217.192.176 00:01, 7 February 2007 (UTC)
[edit] downloading problems?
I've been trying to download the inputbox.php from the links here, but it never loads for me. Is anyone else getting this problem? Or is there a different link someone can show me to get this file?
The download is still broken! -- 193.254.183.243 08:34, 24 February 2009 (UTC)
[edit] Editintro does not work for comments
Even the example fails. pfctdayelise 15:26, 21 October 2006 (UTC)
[edit] Target =new
Is there a way to add a parameter to the inputbox so when doing page creation, the form gets posted to a new window?
This is useful for creating a page that's been populated with a list of inputboxes preloaded with titles of new pages to create.
So this way, I can go down the list and create new pages and not loose the page I'm on. You see, this is the script I'm using; so you know why this is useful for me.
This handy script will be useful for anyone who needs to create lots of these inputboxes preloaded with their topic titles so they can add a bunch of pages all at once, easily. Just edit wherever you see "TOPIC TITLE" with the respective text you need.
<html>
<head>
</head>
<body>
<?php
$script = $_SERVER['PHP_SELF'];
if (!isset($_POST['submit']))
{
echo "<font face=verdana>Enter a list of TOPIC TITLES to generate code to mass create pages<br>
<form name='form' action='$script' method='POST'>
<table>
<tr>
<td>
<textarea cols='80' rows='20' name='names'></textarea>
</td>
</tr>
<tr>
<td>
<input type='submit' value=' Do It ' name='submit'>
</td>
</tr>
</table>
</form></font>
";
}
else
{
$namelist=explode("\n",$_POST['names']);
echo " <form name='form' action='$script' method='POST'><textarea name='textarea' cols='80' rows='20'>";
for($i = 0;$i < sizeof($namelist);$i++)
{
echo "<inputbox>
type=create
preload=Template:TOPICTEMPLATE
default=".str_replace("\r","",$namelist[$i])."
buttonlabel=Add New TOPICTITLE
</inputbox>
";
}
echo " </textarea><br><input type='button' value='Highlight Text' onClick='javascript:this.form.textarea.focus();this.form.textarea.select();'></form><br><a href=/index.php?title=Template:TopicTitle&action=edit>Go to TOPICTITLE to add this code!</a>";
}
?>
</body>
</html>
Maybe somebody will have fun with this code... Anyway, I would like each inputbox thats created to open the page to be created in a new window. Is there a way to specify a target for the inputbox form? Thanks, MediaHound 15:09, 30 October 2006 (UTC)
[edit] default target
I think it would be useful to be able to specify a default page that it goes to if the user clicks the button when the text field is blank. Currently, it goes to Main_Page, but I think project:sandbox would be more useful. -Sanbeg 23:08, 2 November 2006 (UTC)
[edit] Full text search in input=search does not work
In the below box, press either button, and you get back to this page. Full text search does not work, and I don't know why. The input name is "searchx" for this button, but "fulltext" for the search button in the sidebar - which still works.
The reason for the problem is probably easy to fix.
--Barklund 19:47, 9 November 2006 (UTC)
[edit] MediaWiki 1.8.2: Unable to install
I am unable to install the extension (inputbox.php 0.1.1) as well as the hack from Algorithm. I'm pretty new to mediawiki. Any clue?
Currently using:
- MediaWiki 1.8.2
- PHP 5.2
- MySQL 5.0.27
[edit] Hiding the input box, or having only the button
It would be extremely nice to be able to hide the input box somehow, and default it to a certain value in the form. The reason for this would be if I wanted to comment, and I wanted to hard code where the user could comment to. Understandably, it wouldn't be secure (javascript overwriting) but still, it would be a nice addition! -- Silivrenion Jan 1 2006
- See #Namespace Search, Hide Checkboxes Patch below. 69.138.163.138 01:57, 5 February 2009 (UTC)
[edit] Mediawiki 1.9.0: Positioning the create box
I am using Mediawiki 1.9.0 and this wonderfull extansion. I have noticed that by default, the extansion put itself centered on a page. I found that nice for the seach function or when you put it in a tab but I wanted that the create function and box be left positioned on the page.
To acheive this, located in the code the section (At the botom):
<td align="center" bgcolor="{$this->bgcolor}">
<form name="createbox" action="$action" method="get" class="createbox">
And replace by :
<td align="left" bgcolor="{$this->bgcolor}">
<form name="createbox" action="$action" method="get" class="createbox">
Or replace left by whatever you want (center is the default).
--Romainp 16:47, 12 January 2007 (UTC)
[edit] MediaWiki: 1.6.8: ERROR On Line 67
it says Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /home/codev/public_html/en/w/extensions/inputbox.php on line 67 please help--71.217.192.176 00:09, 4 February 2007 (UTC)
- heres my version info:
- MediaWiki: 1.6.8
- PHP: 4.4.2 (cgi)
- MySQL: 5.0.27-standard
- --71.217.192.176 00:30, 4 February 2007 (UTC)
- I got my host to set me up an account on their PHP5 server, and i just finished moving all the data to all my sites over and just upgraded the wiki to 1.9.2 and re-downloaded inputbox.php and all appears to be working fine now.--71.217.192.176 23:59, 6 February 2007 (UTC)
Reason for the above given error is PHP Version 4. You need V5 - then the error will not appear on line 67.
- I fixed this error pretty easily, by unchaining the -> operators on that line, using a temp variable instead; i.e. I replaced
$boxhtml=str_replace("InputBox",$parser->getTitle()->getText(),$boxhtml);
with:
$title = $parser->getTitle();
$boxhtml=str_replace("InputBox",$title->getText(),$boxhtml);
- I haven't tested thoroughly for any other PHP4 incompatibilities, but it seems to work, so it's probably worth putting that fix into SVN for those of us still running PHP4 (it's not that much uglier :)).
- - IMSoP 17:55, 19 February 2007 (UTC)
- I am also under PHP vers.4 and have the same syntax error, but showing on line 77. I could not find the line indicated by IMSoP to try his workaround, any idea of what might be the issue? Did the inputbox extension change since Feb. 2007?
- 80.80.162.148 14:53, 22 February 2008 (UTC)
[edit] MediaWiki: 1.6.9: inputbox "breaking" script
I am having problems with the inputbox extension. When I add it and the entry to LocalSettings, no pages will load. I just get a blank page. I have been able to add other extensions without problems.
I am using version 1.6.9 with Linux and a MySQL backend.
Any suggestions?
Thanks
- I'm guessing this is the PHP4 compatibility problem (see section above, including fix) - if you can find your PHP error log, it's probably logging the same parse error that others have reported, it's just suppressing it from display on your live host. - IMSoP 09:37, 20 February 2007 (UTC)
[edit] Borders
Is there any way to have a border around the input box without putting the whole thing into a table?
[edit] Defining Alignment
I have found the need to define the alignment for the inputbox on my wikipages, so i hae made a small modification that allows you to specify the alignment as a paramater, see this.--RyanB88 01:06, 14 February 2007 (UTC)
[edit] Followed all the instructions, so why is it still just code?
I followed all the instructions for installing the Inputbox and altering the ActionCreate (from Algorithm), but the page still appears as code. Did I forget something somewhere? I don't get an error; it's just that the inputboxes don't show up. --Azurite 01:59, 25 March 2007 (UTC)
[edit] dynamic default text
hi, I want to have as default text the current date, sohow to implement?
--08:25, 16 April 2007 (UTC)
- Variables and parser functions are not supported in inputbox parameters. A cumbersome workaround is to make a big switch with for every day the full wikitext of an inputbox:
- Patrick 10:13, 16 April 2007 (UTC)
-
- Right. Thanks. So that would mean 365 different inputboxes for a year, maybe not then :/. --217.64.242.138 10:39, 16 April 2007 (UTC)
[edit] combining several small fields
I want to make a field similar to http://wikimaas.org/AddEvent. So how to connect several small boxes, to add them together to form one page title, eg. YYYY-MM-DD The launch of the new inputbox. And can I apply a maxwidth?
For filling in it is easier to type a number - <tab> - next, instead of replacing already formatted numbers in one line. Oh, and they should also have a connected tab-order :)
--217.64.242.138 10:19, 19 April 2007 (UTC)
- MediaWiki does not allow variables in the computer programming sense, so the inputbox cannot be applied to assign a value to a variable.--Patrick 11:21, 19 April 2007 (UTC)
- What about a sort of redirecting to a template-page which receives these different variables, and then redirects to the to-be created page? --217.64.242.138 13:42, 19 April 2007 (UTC)
-
-
- You may be interested in Simple Forms (though I can't get it to work with MW 1.9.3) and/or Semantic Forms (but it requires the cumbersome Semantic MediaWiki). -Eep² 13:57, 3 August 2007 (UTC)
-
[edit] Background color?
Is there any way to to put background color on the inputbox? I'm using it on a table that has a background, and it' kind of strange to see only the inputbox with a white background. --219.121.89.169 11:27, 7 May 2007 (UTC)
Yes you can change the background color: It is a parameter that you can set, just like "type" or "buttonlabel" - you would add the phrase bgcolor= and then add a color code
see below
<inputbox> type=create '''bgcolor=#eeeeff''' buttonlabel=Create New Page </inputbox>
Looks Like This:
To figure out a color code, you just add in the hex numbers - as described here: http://html-color-codes.com/
[edit] Idea for easy extension
To make a button which runs a PHP script, eg. for sending a message using a textarea:
Add to "function render()" another type "php":
elseif($this->type=='php') {return $this->runPHP() ...
Add a function "runPHP" like this:
function runPHP() {
$createform=<<<ENDFORM
<form name="runPHP" action="xxx.php" method="post">
<textarea rows="3" name="textareaPHP"></textarea>
<input type='submit' value="xxx" />
</form>
ENDFORM;
return $createform;
}
Perhaps action="xxx.php" must be sth. like this: action="http://xxx/xxx.php", because otherwise, a new Wiki page will be opened.
[edit] Preload Upload File
I wanted to try and preload a template into the upload page, much like commons dose. I tried the commons irc and they couldn't tell me how they are doing it. So I tried at test.W with no results as you can find out yourself:
http://test.wikipedia.org/wiki/Special:Upload?action=edit&preload=Template:Dead
Any ideas? --is:Notandi:Steinninn 194.144.110.1 15:46, 20 June 2007 (UTC)
- Adding text into Summary field on commons:Special:Upload is done with Javascript and has nothing to do with Input box. See commons:MediaWiki:Upload.js which is called from commons:MediaWiki:Common.js ∴ Alex Smotrov 15:58, 20 June 2007 (UTC)
-
-
- I'm not sure where to start, en:MediaWiki talk:Common.js or en:Wikipedia:Village pump (proposals), but in any case you need consensus first. Coding is the easy part ;) Also, I would suggest that the script doesn't insert the text automatically (like on Commons) but rather provide a link in en:MediaWiki:Fileuploadsummary that would insert it when user wants it ∴ Alex Smotrov 20:07, 20 June 2007 (UTC)
-
-
-
-
- I made a propossal at The Village Pump. --Steinninn 00:54, 21 June 2007 (UTC)
-
-
[edit] Mediawiki 1.9.3 and 1.10: Namespace Searching not working
I have not used Inputbox before with the namespace attribute and have been unsuccessful to get it working. I have tried some of the tips posted here still with no success. I have tried using it on a couple different installs and of recent versions of Mediawiki (1.9.3 and 1.10) (PHP 5.2.2 and MySQL 5.0.24a) but with no success. It looks like it runs successfully on Wikimedia? So what am I doing wrong?! Related extensions I need to install to get it working? Ideas? Is this due to custom namespaces?
Example of what I am adding:
<inputbox> type=search namespaces=Winner,Nomination </inputbox>
--Myotus 13:54, 19 July 2007 (UTC)
- I experienced the same issue and found the solution. Open inputbox.php and goto line 132
<input type='submit' name="fulltext" class="searchboxSearchButton" value="{$this->searchbuttonlabel}" />
- and change it to
<input type='submit' name="searchx" class="searchboxSearchButton" value="{$this->searchbuttonlabel}" />
- Works for me!
- --Mark P. 20:22, 22 October 2007 (UTC)
--Rob Terzi 00:09, 4 March 2008 (UTC)
- I needed this fix as well for Mediawiki 1.11, which brings up some questions:
- Did the search interface change in some version of Mediawiki?
- Is anyone maintaining this extension, that could make this fix permanent, or add a check for MW version?
- Note: Search2, which doesn't seem to be documented doesn't do anything with name spaces, so that is a little trap for anyone trying to search specific name spaces.
Worked for me too, but:
- in the most current version, the suspect line is 138,
- had to close my browser and come back for changes to work.
--Furboy 18:53, 18 April 2008 (UTC)
[edit] Multiply fields
I'd like the function to have multiple input fields on the same submit button and the content of these fields to be applied to a pre-set template. This way it becomes like a 'wizard' for creating pages that has basic set content but with only say a few parameters of the subject being different.
For example fish profiles, these pages are often 95% identical expect for the species name, common name, colour, etc.
Can this extension do this?
--Quatermass 11:59, 30 July 2007 (UTC)
-
- I'm looking for something similar to this as well, except being able to put in multiple page names in an input box and having them all get created with the same content. --Bluesoju 04:38, 28 June 2009 (UTC)
[edit] Suggestions from CreateArticle
CreateArticle is based off Inputbox but my suggestions for it apply to Inputbox (and other extensions based off it, like CreateBox) as well. -Eep² 07:49, 7 August 2007 (UTC)
[edit] Transparent
Hi!, I want to know how can I configure the inputbox to match with the background color without using the parameter bgcolor, like, make it transparent. Also, I want to know if it's possible put it under the search bar in the sidebar. This is an example of what I'm talking about:
|
|
And it should look like:
|
|
Without using bgcolor
As you can see, the background color of the box (black) does not affect the input box background color and this gives me problems when I try to put it in the sidebar. Thank you very much. Thunder26 (talk) 00:59, 31 August 2007 (UTC)
- I would try global CSS: give your table some id and then use something like
table.yourid form {background:color:transparent}. As for sidebar, do you mean editing Mediawiki:Sidebar? I don't think it will accept inputbox. Note that if you type something in the usual search field and press Go, and the phrase is not found, then there are two links to create an article, you could make on of those links to really stand out ∴ Alex Smotrov 02:12, 1 September 2007 (UTC)
-
-
- If you add $wgGoToEdit = true; to your LocalSettings.php, typing a nonexistent article name in the search box and clicking "Go" will create that article. —Celtic Minstrel 13:38, 11 March 2008 (UTC)
-
Note that the above conversation may have been edited or added to since the transfer. If in doubt, check the edit history.
[edit] please add 'summary='-Option
Hey guys, wouldn't it be usefull if you would add an option, witch sets the summary-text of the created edit. I'd need it for german WP, for example. Thanks for ths tool. Greetings, Michi —The preceding unsigned comment was added by 88.217.29.241 (talk • contribs) 14:01, 5 October 2007 (UTC). Please sign your posts!
[edit] Bug report Inputbox revision 27198
I am using PHP version 5.2.4 (cgi-fcgi) on a Windows machine. Inputbox (search) seems to be working ok, but I do see the following note in a small font at the bottom of the wiki page on which I use the Inputbox:
PHP Notice: Undefined property: Inputbox::$labeltext in C:\iWiki\extensions\Inputbox\inputbox.php on line 153
If you need more info, let me know. 80.127.78.73 01:19, 10 November 2007 (UTC)
[edit] Another namespace issue
I have tried following the above guidelines about changing line 132 but it did not work, the extension won't search in a specific namespace for me, here is an example: here Does anyone know what could be the cause? Thanks very much 60.50.173.98 00:10, 16 November 2007 (UTC)
[edit] MediaWiki 1.11.0: Create Article issue
I have recently upgraded to MediaWiki 1.11.0 and although the inputbox function still works, the button labels are labeled as <createarticle> and <searchfulltext> - where should that be fixed? --90.200.52.95 14:37, 30 December 2007 (UTC)
- Hi. I had the same problem at http://www.appropedia.org. I fixed it by uploading the newest code (liked on extension page) and adding the inputbox directory to the include code. I.e. I changed
require_once(/extensions/inputbox.php');torequire_once($IP.'/extensions/inputbox/inputbox.php');. If that does not work, you could always just add the extension markup to label the buttons as you like. Good luck, --LRG 22:05, 31 December 2007 (UTC)
[edit] Call to undefined function wfloadextensionmessages() in wiki/extensions/InputBox/InputBox.classes.php on line
Installation Issue with mediawiki 1.9.3
I am trying to add this extension to MediaWiki 1.9.3 with no success.
I have downloaded inputbox.php and InputBox.i18n.php and placed them in /extensions/inputbox.
At the bottom of LocalSettings.php I have added
require_once($IP.'/extensions/inputbox/inputbox.php'); .
In MediaWiki I now receive:
'Fatal error: Call to undefined function wfLoadExtensionMessages() in C:\webdocs\pitawiki\extensions\inputbox\inputbox.php on line 38.
I have been doing quite a bit of research on Google to find the answer myself, but it is beginning to look like I am either the only one or nobody has documented this problem before. Can someone please help? Chad.cdmtech 22:46, 7 January 2008 (UTC)
- I still am not sure what the problem was, but I have upgraded to MediaWiki 1.11 and now all works fine. --Chad.cdmtech 17:19, 9 January 2008 (UTC)
- Same problem, a year later:
-
- MediaWiki: 1.7.1
- PHP: 5.2.5 (cgi)
- MySQL: 4.1.22-standard-log
-
- Same problem, a year later:
- For me the problem is on line 40. Line 40 is:
wfLoadExtensionMessages( 'InputBox' );
-
- Line 38 is:
public function render() {
-
- Line 58 (next section) is:
),
-
- The entire section which is having problems is:
public function render() { // Internationalization wfLoadExtensionMessages( 'InputBox' ); // Handle various types switch( $this->mType ) { case 'create': case 'comment': return $this->getCreateForm(); case 'commenttitle': return $this->getCommentForm(); case 'search': return $this->getSearchForm(); case 'search2': return $this->getSearchForm2(); default: return Xml::tags( 'div', null, Xml::element( 'strong', array( 'class' => 'error' ),
-
- Odessaukrain 02:17, 31 December 2008 (UTC)
[edit] Extension Inputbox fault
- MediaWiki: 1.9.3
- PHP: 5.2.5 (cgi)
- MySQL: 4.1.22-standard-log
I am trying to install extension:Inputbox but I am getting this error while using it:
Fatal error: Call to undefined function wfloadextensionmessages() in /home/gidelimm/public_html/wiki/extensions/Inputbox/inputbox.php on line 58
Is there anybody whop can help me to sort out this problem? Thanks in advance --Plenumchamber 11:27, 19 April 2008 (UTC)
- See below for a reply. --Sayuri 14:30, 19 January 2009 (UTC)
[edit] undefined function wfloadextensionmessages
I'm also getting the undefined function wfloadextensionmessages error.
- MediaWiki: 1.9.3
- PHP: 5.2.5 (cgi-fcgi)
- MySQL: 5.0.41-log
The php error log entry:
[23-Apr-2008 19:35:31] PHP Fatal error: Call to undefined function wfloadextensionmessages() in .../mediawiki/extensions/inputbox/inputbox.php on line 58
- You're trying to use too up-to-date version of InputBox with a legacy version of MediaWiki; function wfLoadExtensionMessages() didn't exist prior to MW 1.11. You'll either need to upgrade your MediaWiki to a newer version, which is the preferred solution, or to use an older version of the extension. --Sayuri 14:30, 19 January 2009 (UTC)
[edit] Version history
I suppose the latest version of extension:InputBox is not compatible with older versions of MediaWiki. It seems that only the latest version of InputBox is available on the Mediawiki SVN. For example [2] and [3] refer to the SourceForce CVS, which doesn't seem to exist anymore. Is there any public repository of older versions of this extension? --Samuel —The preceding unsigned comment was added by 213.28.6.132 (talk • contribs) . Please sign your posts with ~~~~!
- That is exactly what svn.wikimedia.org is for. It's there so that you can download older versions of files. Extensions have been branched since MediaWiki 1.10 (REL1_10). The 1.10 branched version of Inputbox is supposed to work with MediaWiki 1.10.
- In any case, I just can't understand why you are using old and outdated pages like Wikiquote's and test.wikipedia's pages as a reference when it comes to MediaWiki extensions. In most cases if an extension can be found at svn.wikimedia.org, its documentation can be found at MediaWiki.org — this is especially true when it comes to extensions that are used on Wikimedia sites. --Sayuri 14:30, 19 January 2009 (UTC)
[edit] Adding NameSpace when creating articles
I'd like to combine the functionalities of search and create article...
I mean there should be an input box, radiobuttons with my predefined namespaces and a button. Is there allready someone who did this?
Because I tried it and for some reason it doesn't work.
Can someone please help me?
[edit] Version number please
It would be helpful if the developers of this extension assigned a version number to this extension. This could be in both the code (so it shows up in special:version) and the {{extension}} infobox on this extension page. This way at a glance we can know if our MediaWiki installations are up to to date. --Maxelrod 22:04, 25 February 2008 (UTC)
[edit] Namespace Search, Hide Checkboxes Patch
I needed to search specific namespace for particular pages, so I didn't want the checkbox to show, or give the user the opportunity to uncheck the box which would cause the search to fail. Here is a patch (context diff) against Version 0.1.1 that adds a parameter namespacehide which will prevent the checkboxes from being displayed.
-- Rob Terzi 15:24, 4 March 2008 (UTC)
*** inputbox.php 2008/03/04 00:19:05 1.3
--- inputbox.php 2008/03/04 00:27:06
***************
*** 103,108 ****
--- 103,109 ----
getBoxOption($inputbox->buttonlabel,$input,'buttonlabel',$parser);
getBoxOption($inputbox->searchbuttonlabel,$input,'searchbuttonlabel',$parser);
getBoxOption($inputbox->namespaces,$input,'namespaces',$parser);
+ getBoxOption($inputbox->namespacehide,$input,'namespacehide',$parser);
getBoxOption($inputbox->id,$input,'id',$parser);
getBoxOption($inputbox->labeltext,$input,'labeltext',$parser);
getBoxOption($inputbox->br, $input, 'break',$parser);
***************
*** 203,214 ****
$name='Main';
}
if ($usernamespace == $name) {
$searchform2 .= "<input type=\"checkbox\" name=\"ns{$i}\" value=\"1\"{$checked}>{$usernamespace}";
}
}
}
//Line feed
! $searchform2 .= $this->br;
//If namespaces are defined remove the go button
//because go button doesn't accept namespaces parameters
$gobutton='';
--- 204,221 ----
$name='Main';
}
if ($usernamespace == $name) {
+ if (!$this->namespacehide) {
$searchform2 .= "<input type=\"checkbox\" name=\"ns{$i}\" value=\"1\"{$checked}>{$usernamespace}";
+ } else {
+ $searchform2 .= "<input type=\"hidden\" name=\"ns{$i}\" value=\"1\">";
+ }
}
}
}
//Line feed
! if (!$this->namespacehide) {
! $searchform2 .= $this->br;
! }
//If namespaces are defined remove the go button
//because go button doesn't accept namespaces parameters
$gobutton='';
- I don't understand how to fix it but would like to see this option to hide the checkbox(es). SO what about a Version 0.1.2? --Subfader 20:49, 16 March 2008 (UTC)
[edit] patch for current revision
Perhaps they've made a revision without changing the version number, but the code above does not match version 0.1.1 that is available currently at SVN. To make Rob Terzi's patch work with the current revision, make the following changes:
[edit] make the namespace selection work
Follow Mark P.'s patch (above) and replace
<input type='submit' name="fulltext" class="searchboxSearchButton" value="{$this->searchbuttonlabel}" />
with
<input type='submit' name="searchx" class="searchboxSearchButton" value="{$this->searchbuttonlabel}" />
[edit] introduce a new variable
I've called it '$showboxes' instead of 'namespacehide' because the patch hides the boxes by default and the parameter is used only to "show" the boxes. Find:
class Inputbox {
var $type, $width, $preload, $editintro, $br;
var $defaulttext,$bgcolor,$buttonlabel,$searchbuttonlabel,$labeltext;
var $hidden, $namespaces,;
and replace it with
class Inputbox {
var $type, $width, $preload, $editintro, $br;
var $defaulttext,$bgcolor,$buttonlabel,$searchbuttonlabel,$labeltext;
var $hidden, $namespaces, $showboxes;
[edit] hook the new parameter
Find:
$options = array( 'type' => 'type', 'width' => 'width', 'preload' => 'preload', 'editintro' => 'editintro', 'default' => 'defaulttext', 'bgcolor' => 'bgcolor', 'buttonlabel' => 'buttonlabel', 'searchbuttonlabel' => 'searchbuttonlabel', 'namespaces' => 'namespaces', 'id' => 'id', 'labeltext' => 'labeltext', 'break' => 'br', 'hidden' => 'hidden', );
and replace it with
$options = array( 'type' => 'type', 'width' => 'width', 'preload' => 'preload', 'editintro' => 'editintro', 'default' => 'defaulttext', 'bgcolor' => 'bgcolor', 'buttonlabel' => 'buttonlabel', 'searchbuttonlabel' => 'searchbuttonlabel', 'namespaces' => 'namespaces', 'id' => 'id', 'labeltext' => 'labeltext', 'break' => 'br', 'hidden' => 'hidden', 'showboxes' => 'showboxes', );
[edit] add new conditional rendering
Find:
if ($usernamespace == $name) {
$searchform2 .= "<input type=\"checkbox\" name=\"ns{$i}\" value=\"1\"{$checked}>{$usernamespace}";
}
and replace it with
if ($usernamespace == $name) {
if ($this->showboxes == 'yes') {
$searchform2 .= "<input type=\"checkbox\" name=\"ns{$i}\" value=\"1\"{$checked}>{$usernamespace}";
} else {
$searchform2 .= "<input type=\"hidden\" name=\"ns{$i}\" value=\"1\">";
}
}
And find:
//Line feed $searchform2 .= $this->br;
and replace it with
//Line feed
if ($this->showboxes == 'yes') {
$searchform2 .= $this->br;
}
--Furboy 20:53, 18 April 2008 (UTC)
[edit] Search this category?
Would it be possible to have the Inputbox being display as search box on all category pages so you can search the category (only consider the articles in this category)?
Had the idea when testing Extension:Multi-Category Search. This adds a special page and will search those article pages which are included in the category you've entered in the search fields. But you cannot enter normal search terms, only category names. So it would be nice to search articles in only 1 category. --Subfader 20:29, 16 March 2008 (UTC)
- I second this. It'd be a great idea.
[edit] Default value
It would be nice if the default value in the box would disappear by clicking into it in order to type. --Subfader 20:32, 16 March 2008 (UTC)
[edit] Can you use Inputbox to use an external search engine?
I'd like to be able to use inputbox to search an external search engine. Is that possible? Would be great if that was built in. --Apolloni 09:52, 25 March 2008 (UTC)
[edit] Parsing
Has anyone looked into adding the capability to allow for parser functions inside the <inputbox> tags?
[edit] Searching in namespaces
On the TiddlyWiki community wiki we're using this extension to create the following search form:
<inputbox> type=search searchbuttonlabel=Search Developers Documentation width=24 namespaces=Dev**,Dev_talk** </inputbox>
However, this doesn't actually search the specified namespaces.
Any help would be greatly appreciated.
-- FND 08:57, 14 July 2008 (UTC)
[edit] Invalid Parameters
Some parameters became invalid. What's wrong?--百楽兎 01:51, 26 October 2008 (UTC)
[edit] Inputbox + AJAX Search Suggestion?
Hi, I like this extension very much - one question: Is there any possibility to combine the search inputbox with the AJAX search suggestion on MediaWiki 1.13 or with the extension Search Suggest? I've already tried various things, but I haven't found a proper solution yet. I think it would be very useful... Thank you. --Filburt 07:43, 29 October 2008 (UTC)
[edit] PHP warning
With the latest svn revision of inputbox working over the latest svn revision of mediawiki 1.14alpha, I see the php warning: PHP Warning: call_user_func_array() [<a href='function.call-user-func-array'>function.call -user-func-array</a>]: Unable to call InputBoxHooks::render() in includes/p arser/Parser.php on line 3330. NSK Nikolaos S. Karastathis 14:15, 4 November 2008 (UTC)
[edit] Bug with "default" parameter
Hi,
There seems to be a problem with the default parameter. Look at Extension:InputBox#Parameters : below this code :
<inputbox> type=comment default=User talk:Eloquence </inputbox>
... there is no text in the inputbox :
Delhovlyn 20:52, 4 November 2008 (UTC)
[edit] Fixing the broken InputBox
The current checked in version simply doesn't load as people have pointed out. This is easy to fix, and you can simplify the code. Basically get rid of the Inputbox.hooks.php.
1. In Inputbox.php replace everything from line 50 on with:
// Register parser hook if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) { // Modern $wgHooks['ParserFirstCallInit'][] = 'wfInputBox'; } else { // Legacy $wgExtensionFunctions[] = 'wfInputBox'; } function wfInputBox () { new InputBox; return true; }
2.In Inputbox.classes.php get rid of the __construct function and replace it with:
function InputBox() {
global $wgParser;
$wgParser->setHook( 'inputbox' , array( &$this, 'render' ) );
}
public function render( $input, $args, $parser ) {
$this->mParser = $parser;
// Configure InputBox
$this->extractOptions( $parser->replaceVariables( $input ) );
// Return output
return $this->render();
}
and you're done! —The preceding unsigned comment was added by Thempel (talk • contribs) . Please sign your posts with ~~~~! 16:49, 6 November 2008
- You need to be more specific is the construct function the following:
public function __construct( $parser ) {
$this->mParser = $parser;
}
public function render() {
// Internationalization
wfLoadExtensionMessages( 'InputBox' );
// Handle various types
switch( $this->mType ) {
case 'create':
case 'comment':
return $this->getCreateForm();
case 'commenttitle':
return $this->getCommentForm();
case 'search':
return $this->getSearchForm();
case 'search2':
return $this->getSearchForm2();
default:
return Xml::tags( 'div', null,
Xml::element( 'strong',
array(
'class' => 'error'
),
strlen( $this->mType ) > 0
? wfMsgForContent( 'inputbox-error-bad-type', $this->mType )
: wfMsgForContent( 'inputbox-error-no-type' )
)
);
}
}
- I get another error message:
Fatal error: Call to a member function replaceVariables() on a non-object in /home/(mywikiname)/public_html/wiki/extensions/InputBox/InputBox.classes.php on line 45
- Line 45 is:
// Configure InputBox
- Again, I am using mediawiki 1.7.1. Odessaukrain 02:55, 31 December 2008 (UTC)
[edit] In subpages
Hello,
I'm a french wikibookian... I would like to know if it can be possible to search in the subpages. Thanks ! --79.87.132.217 12:26, 20 November 2008 (UTC)
[edit] Align link broken
The link to the current code in the Align section of this page is broken. —The preceding unsigned comment was added by 76.191.159.88 (talk • contribs) . Please sign your posts with ~~~~! 01:00, 13 December 2008
- I changed Inputbox.classes.php to put this feature back in. I think the other align code was lost in the move.
- Sorry I didn't do this via svn, but I don't have enough time to set svn up right now.Wezelboy 18:23, 19 December 2008
<?php /** * Classes for InputBox extension * * @file * @ingroup Extensions */ // InputBox class class InputBox { /* Fields */ private $mParser; private $mType = ''; private $mWidth = 50; private $mPreload = ''; private $mEditIntro = ''; private $mPage = ''; private $mBR = 'yes'; private $mDefaultText = ''; private $mBGColor = 'transparent'; private $mButtonLabel = ''; private $mSearchButtonLabel = ''; private $mFullTextButton = ''; private $mLabelText = ''; private $mHidden = ''; private $mNamespaces = ''; private $mID = ''; private $mInline = false; private $mAlignment = 'center'; /* Functions */ public function __construct( $parser ) { $this->mParser = $parser; } public function render() { // Internationalization wfLoadExtensionMessages( 'InputBox' ); // Handle various types switch( $this->mType ) { case 'create': case 'comment': return $this->getCreateForm(); case 'commenttitle': return $this->getCommentForm(); case 'search': return $this->getSearchForm(); case 'search2': return $this->getSearchForm2(); default: return Xml::tags( 'div', null, Xml::element( 'strong', array( 'class' => 'error' ), strlen( $this->mType ) > 0 ? wfMsgForContent( 'inputbox-error-bad-type', $this->mType ) : wfMsgForContent( 'inputbox-error-no-type' ) ) ); } } /** * Generate search form */ public function getSearchForm() { global $wgContLang; // Use button label fallbacks if ( !$this->mButtonLabel ) { $this->mButtonLabel = wfMsgHtml( 'tryexact' ); } if ( !$this->mSearchButtonLabel ) { $this->mSearchButtonLabel = wfMsgHtml( 'searchfulltext' ); } // Build HTML $htmlOut = Xml::openElement( 'div', array( 'align' => $this->mAlignment, 'style' => 'background-color:' . $this->mBGColor ) ); $htmlOut .= Xml::openElement( 'form', array( 'name' => 'searchbox', 'id' => 'searchbox', 'class' => 'searchbox', 'action' => SpecialPage::getTitleFor( 'Search' )->escapeLocalUrl(), ) ); $htmlOut .= Xml::element( 'input', array( 'class' => 'searchboxInput', 'name' => 'search', 'type' => $this->mHidden ? 'hidden' : 'text', 'value' => $this->mDefaultText, 'size' => $this->mWidth, ) ); $htmlOut .= $this->mBR; // Determine namespace checkboxes $namespaces = $wgContLang->getNamespaces(); $namespacesArray = explode( ',', $this->mNamespaces ); if ( $this->mNamespaces ) { foreach ( $namespacesArray as $userNamespace ) { $checked = array(); // Namespace needs to be checked if flagged with "**" or if it's the only one if ( strstr( $userNamespace, '**' ) || count( $namespacesArray ) == 1 ) { $userNamespace = str_replace( '**', '', $userNamespace ); $checked = array( 'checked' => 'checked' ); } // Namespace checkboxes foreach ( $namespaces as $i => $name ) { if ( $i < 0 ) { continue; } elseif ( $i == 0 ) { $name = 'Main'; } if ( $userNamespace == $name ) { // Checkbox $htmlOut .= Xml::element( 'input', array( 'type' => 'checkbox', 'name' => 'ns' . $i, 'value' => 1, 'id' => 'mw-inputbox-ns' . $i ) + $checked ); // Label $htmlOut .= ' ' . Xml::label( $userNamespace, 'mw-inputbox-ns' . $i ); } } } // Line break $htmlOut .= $this->mBR; } else { // Go button $htmlOut .= Xml::element( 'input', array( 'type' => 'submit', 'name' => 'go', 'class' => 'searchboxGoButton', 'value' => $this->mButtonLabel ) ); $htmlOut .= ' '; } // Search button $htmlOut .= Xml::element( 'input', array( 'type' => 'submit', 'name' => 'fulltext', 'class' => 'searchboxSearchButton', 'value' => $this->mSearchButtonLabel ) ); $htmlOut .= Xml::closeElement( 'form' ); $htmlOut .= Xml::closeElement( 'div' ); // Return HTML return $htmlOut; } /* * Generate search form version 2 */ public function getSearchForm2() { // Use button label fallbacks if ( !$this->mButtonLabel ) { $this->mButtonLabel = wfMsgHtml( 'tryexact' ); } $id = Sanitizer::escapeId( $this->mID ); $htmlLabel = ''; if ( isset( $this->mLabelText ) && strlen( trim( $this->mLabelText ) ) ) { $this->mLabelText = $this->mParser->recursiveTagParse( $this->mLabelText ); $htmlLabel = Xml::openElement( 'label', array( 'for' => 'bodySearchInput' . $id ) ); $htmlLabel .= $this->mLabelText; $htmlLabel .= Xml::closeElement( 'label' ); } $htmlOut = Xml::openElement( 'form', array( 'name' => 'bodySearch' . $id, 'id' => 'bodySearch' . $id, 'class' => 'bodySearch', 'action' => SpecialPage::getTitleFor( 'Search' )->escapeLocalUrl(), 'style' => $this->mInline ? 'display: inline;' : '' ) ); $htmlOut .= Xml::openElement( 'div', array( 'class' => 'bodySearchWrap', 'style' => 'background-color:' . $this->mBGColor . ';' . $this->mInline ? 'display: inline;' : '' ) ); $htmlOut .= $htmlLabel; $htmlOut .= Xml::element( 'input', array( 'type' => $this->mHidden ? 'hidden' : 'text', 'name' => 'search', 'size' => $this->mWidth, 'id' => 'bodySearchInput' . $id ) ); $htmlOut .= Xml::element( 'input', array( 'type' => 'submit', 'name' => 'go', 'value' => $this->mButtonLabel, 'class' => 'bodySearchBtnGo' . $id ) ); // Better testing needed here! if ( !empty( $this->mFullTextButton ) ) { $htmlOut .= Xml::element( 'input', array( 'type' => 'submit', 'name' => 'fulltext', 'class' => 'bodySearchBtnSearch', 'value' => $this->mSearchButtonLabel ) ); } $htmlOut .= Xml::closeElement( 'div' ); $htmlOut .= Xml::closeElement( 'form' ); // Return HTML return $htmlOut; } /** * Generate create page form */ public function getCreateForm() { global $wgScript; if ( $this->mType == "comment" ) { if ( !$this->mButtonLabel ) { $this->mButtonLabel = wfMsgHtml( "postcomment" ); } } else { $comment = ''; if ( !$this->mButtonLabel ) { $this->mButtonLabel = wfMsgHtml( 'createarticle' ); } } $htmlOut = Xml::openElement( 'div', array( 'align' => $this->mAlignment, 'style' => 'background-color:' . $this->mBGColor ) ); $htmlOut .= Xml::openElement( 'form', array( 'name' => 'createbox', 'id' => 'createbox', 'class' => 'createbox', 'action' => $wgScript, 'method' => 'get' ) ); $htmlOut .= Xml::openElement( 'input', array( 'type' => 'hidden', 'name' => 'action', 'value' => 'edit', ) ); $htmlOut .= Xml::openElement( 'input', array( 'type' => 'hidden', 'name' => 'preload', 'value' => $this->mPreload, ) ); $htmlOut .= Xml::openElement( 'input', array( 'type' => 'hidden', 'name' => 'editintro', 'value' => $this->mEditIntro, ) ); if ( $this->mType == 'comment' ) { $htmlOut .= Xml::openElement( 'input', array( 'type' => 'hidden', 'name' => 'section', 'value' => 'new', ) ); } $htmlOut .= Xml::openElement( 'input', array( 'type' => $this->mHidden ? 'hidden' : 'text', 'name' => 'title', 'class' => 'createboxInput', 'value' => $this->mDefaultText, 'size' => $this->mWidth ) ); $htmlOut .= $this->mBR; $htmlOut .= Xml::openElement( 'input', array( 'type' => 'submit', 'name' => 'create', 'class' => 'createboxButton', 'value' => $this->mButtonLabel ) ); $htmlOut .= Xml::closeElement( 'form' ); $htmlOut .= Xml::closeElement( 'div' ); // Return HTML return $htmlOut; } /** * Generate new section form */ public function getCommentForm() { global $wgScript; if ( !$this->mButtonLabel ) { $this->mButtonLabel = wfMsgHtml( "postcomment" ); } $htmlOut = Xml::openElement( 'div', array( 'align' => $this->mAlignment, 'style' => 'background-color:' . $this->mBGColor ) ); $htmlOut .= Xml::openElement( 'form', array( 'name' => 'commentbox', 'id' => 'commentbox', 'class' => 'commentbox', 'action' => $wgScript, 'method' => 'get' ) ); $htmlOut .= Xml::openElement( 'input', array( 'type' => 'hidden', 'name' => 'action', 'value' => 'edit', ) ); $htmlOut .= Xml::openElement( 'input', array( 'type' => 'hidden', 'name' => 'preload', 'value' => $this->mPreload, ) ); $htmlOut .= Xml::openElement( 'input', array( 'type' => 'hidden', 'name' => 'editintro', 'value' => $this->mEditIntro, ) ); $htmlOut .= Xml::openElement( 'input', array( 'type' => $this->mHidden ? 'hidden' : 'text', 'name' => 'preloadtitle', 'class' => 'commentboxInput', 'value' => $this->mDefaultText, 'size' => $this->mWidth ) ); $htmlOut .= Xml::openElement( 'input', array( 'type' => 'hidden', 'name' => 'section', 'value' => 'new', ) ); $htmlOut .= Xml::openElement( 'input', array( 'type' => 'hidden', 'name' => 'title', 'value' => $this->mPage ) ); $htmlOut .= $this->mBR; $htmlOut .= Xml::openElement( 'input', array( 'type' => 'submit', 'name' => 'create', 'class' => 'commentboxButton', 'value' => $this->mButtonLabel ) ); $htmlOut .= Xml::closeElement( 'form' ); $htmlOut .= Xml::closeElement( 'div' ); // Return HTML return $htmlOut; } /** * Extract options from a blob of text * * @param string $text Tag contents */ public function extractOptions( $text ) { wfProfileIn( __METHOD__ ); // Parse all possible options $values = array(); foreach ( explode( "\n", $text ) as $line ) { if ( strpos( $line, '=' ) === false ) continue; list( $name, $value ) = explode( '=', $line, 2 ); $values[ strtolower( trim( $name ) ) ] = trim( $value ); } // Build list of options, with local member names $options = array( 'type' => 'mType', 'width' => 'mWidth', 'preload' => 'mPreload', 'page' => 'mPage', 'editintro' => 'mEditIntro', 'break' => 'mBR', 'default' => 'mDefaultText', 'bgcolor' => 'mBGColor', 'buttonlabel' => 'mButtonLabel', 'searchbuttonlabel' => 'mSearchButtonLabel', 'fulltextbutton' => 'mFullTextButton', 'namespaces' => 'mNamespaces', 'labeltext' => 'mLabelText', 'hidden' => 'mHidden', 'id' => 'mID', 'inline' => 'mInline', 'align' => 'mAlignment', ); foreach ( $options as $name => $var ) { if ( isset( $values[$name] ) ) { $this->$var = $values[$name]; } } // Insert a line break if configured to do so $this->mBR = ( strtolower( $this->mBR ) == "no" ) ? '' : '<br />'; // Validate the width; make sure it's a valid, positive integer $this->mWidth = intval( $this->mWidth <= 0 ? 50 : $this->mWidth ); wfProfileOut( __METHOD__ ); } }
[edit] Latest Extension of InputBox doesn't work with MediaWiki 1.13.3
I've added this to my Wiki as per the install instructions and using:
<inputbox> type=search width=42 buttonlabel=Go searchbuttonlabel=Search break=no </inputbox>
I get :
Fatal error: Call to undefined method Inputbox::extractOptions() in /home/mywiki/public_html/extensions/InputBox/InputBox.hooks.php on line 31
Well all 4 files are in there and I added the line in my LocalSettings.
I also see it's not available via the Snapshot link.
Does the author still support this extension?
--Stuart Halliday 16:57, 21 February 2009 (UTC)
[edit] Download link broken
I cannot download this extension. The link does not work. -- 213.39.139.251 23:09, 24 February 2009 (UTC)
[edit] Serious Bug
There is a serious bug with this extension! Whenever I use it, a bunch text fills the page. What is wrong?
68.157.59.222 02:28, 9 March 2009 (UTC)
[edit] Localize namespace names
Is it possible to localize the names in the checkboxes? 143.107.45.13 20:24, 27 June 2009 (UTC)
[edit] how to interwiki search ?
I want to add inputbox on mr language wikipedia page but purpose is to search is only to search Template Namespace of en wikipedia. is that possible & if yes how ?
Mahitgar 07:25, 27 July 2009 (UTC)
[edit] Can Inputbox hide preloaded text?
I would like to see inputbox be able to preload any text without actually displaying it to the user.This way the article created will use the preloaded text and users can't delete the preloaded text accidentally prior to article creation.--Iloveemeryville 21:07, 2 August 2009 (UTC)
- I agree! We have a need for this enhancement as well. 66.37.129.226 22:46, 30 October 2009 (UTC)
[edit] Request for a new parameter
It would be very helpful to have a parameter in InputBox that appends text to the beginning of the string that is submitted. Therefore, if an inputbox is intended to create pages within a main page, only the extension would need to be typed in the field.
This may not be clear, so as an example: If we wished to create an inputbox on the Extension:InputBox page that would allow users to create the page Extension:InputBox/newpage, a parameter could be added so that the user would just have to type newpage in the entry field instead of Extension:InputBox/newpage.
Any thoughts on this proposed parameter? --Zach425 23:41, 29 August 2009 (UTC)
- Note: This is a suggestion that has at least one specific application, at Wikipedia's Abuse Reports page. Were the parameter instituted, I'm sure it would be used here and on many other pages. --Zach425 05:16, 7 September 2009 (UTC)
[edit] Adding A New Text At The Top Of A Page
The InputBox type=comment enables to add a new section at the bottom of an existing page. I'm searching for a possibility for adding the new text automatically at the top of the page.
Has anyone a good idea to do this in an elegant way? --Bluejack 20:42, 30 August 2009 (UTC)
I'd like add a new subsection at the top of existing section. Malarz pl 21:17, 29 September 2009 (UTC)
[edit] Adding a comment to a section of a page
I have a similar query to the one above - but in my case I am looking to add my comment to a particular section of an existing page rather than at the very bottom of the page as is the default using type=comment. Any thoughts? --204.40.1.129 17:53, 3 September 2009 (UTC)
[edit] Preload issue - Extension conflict
I'm running MW 1.15 but the preload-function isn't working. The problem is that I can't preload on a page that doesn't already exist. It works fine when doing comments on existing pages in a new section.
Any thoughts on how to deal with this?
- Solved it. Turns out my problem was that I had defined a template for my main-namespace to be included on all new pages. This was done using an extension called NewArticleTemplate that overrides a preload. Incidentally, my template for the main-NS was empty.
- I hope no one wasted any time on this. And now we know that the two extensions in question can conflict.
- --Martin, 23:47, 6 September 2009 (UTC)