Help talk:Inputbox: Difference between revisions

From Meta, a Wikimedia project coordination wiki
Latest comment: 18 years ago by Three Of Twelve in topic Umvalid!
Content deleted Content added
Line 71: Line 71:


== Umvalid! ==
== Umvalid! ==

http://validator.w3.org/check?uri=http%3A%2F%2Fmeta.wikimedia.org%2Fwiki%2FHelp%3AInputbox --[[User:Paddy|Paddy]] 10:42, 25 November 2005 (UTC)
http://validator.w3.org/check?uri=http%3A%2F%2Fmeta.wikimedia.org%2Fwiki%2FHelp%3AInputbox --[[User:Paddy|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 --[[User:Three Of Twelve|Three Of Twelve]] 13:21, 21 February 2006 (UTC)


== Inputbox on Meta ==
== Inputbox on Meta ==

Revision as of 13:21, 21 February 2006

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.

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)Reply

Copied from Talk:Inputbox

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)

bugzilla references

  1. bugzilla:02805 (fixed) – "<inputbox> should allow to set predefined titles"
  2. bugzilla:02847 – "<inputbox> usage of template constructs to generate the "default" option"
  3. bugzilla:02842 – "<inputbox> should allow alternatively to place the header *between* the inputbox and the button not only above the inputbox"
  4. bugzilla:02844 (fixed) – "<inputbox> should allow allow to label a button differently then MediaWiki:Createarticle"
"Amike" Gangleri | Th | T 18:32, July 13, 2005 (UTC)

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)Reply

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)Reply

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)Reply

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 text starting 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:

  1. Add a getBoxOption. Not too difficult, just add it where the others are.
       getBoxOption($inputbox->starttext,$input,"starttext");
  1. In Class InputBox, where the variables are given, just add $starttext in one of the lines.
  2. 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.

Umvalid!

http://validator.w3.org/check?uri=http%3A%2F%2Fmeta.wikimedia.org%2Fwiki%2FHelp%3AInputbox --Paddy 10:42, 25 November 2005 (UTC)Reply

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)Reply

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?

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)Reply

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)Reply

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)Reply

by removing the colon the subpage-function could be integrated and other prefixes, too --Three Of Twelve 18:18, 25 January 2006 (UTC)Reply

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)Reply

  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)Reply

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)Reply

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)Reply

Add to a defined category

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!

Pre-box label

Can we get a label before the input box? æle 01:09, 17 February 2006 (UTC)Reply

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)Reply
Curiously enough, the most recent code already has a "labeltext" option for boxes of type "search2":
 
This made my job a lot easier. :) æle 20:12, 18 February 2006 (UTC)Reply