
werdna at svn
Jul 8, 2008, 6:41 PM
Post #1 of 1
(234 views)
Permalink
|
|
SVN: [37362] trunk/extensions/inputbox/inputbox.php
|
|
Revision: 37362 Author: werdna Date: 2008-07-09 01:40:59 +0000 (Wed, 09 Jul 2008) Log Message: ----------- Some fixes to allow inline search forms: * Don't display an empty label if no label text is provided. * Add an 'inline' parameter to the search form, which, if set, adds 'display: inline' to all the block elements, allowing it all to collapse' Modified Paths: -------------- trunk/extensions/inputbox/inputbox.php Modified: trunk/extensions/inputbox/inputbox.php =================================================================== --- trunk/extensions/inputbox/inputbox.php 2008-07-09 01:17:41 UTC (rev 37361) +++ trunk/extensions/inputbox/inputbox.php 2008-07-09 01:40:59 UTC (rev 37362) @@ -159,19 +159,33 @@ $this->buttonlabel = wfMsgHtml( 'tryexact' ); } - $output = $this->parser->parse( $this->labeltext, - $this->parser->getTitle(), $this->parser->getOptions(), false, false ); - $this->labeltext = $output->getText(); - $this->labeltext = str_replace('<p>', '', $this->labeltext); - $this->labeltext = str_replace('</p>', '', $this->labeltext); + $label = ''; + $styles = ''; + if ( isset($this->labeltext) && strlen(trim($this->labeltext)) ) { + $output = $this->parser->parse( $this->labeltext, + $this->parser->getTitle(), $this->parser->getOptions(), false, false ); + $this->labeltext = $output->getText(); + $this->labeltext = str_replace('<p>', '', $this->labeltext); + $this->labeltext = str_replace('</p>', '', $this->labeltext); + $label = "<label for=\"bodySearchIput{$id}\">{$this->labeltext}</label>"; + } + + if ($this->inline) { + $styles .= 'display: inline;'; + } + $buttonlabel = htmlspecialchars( $this->buttonlabel ); $searchbuttonlabel = htmlspecialchars( $this->searchbuttonlabel ); $id = Sanitizer::escapeId( $this->id ); + if ($styles) { + $styles = 'style="'.htmlspecialchars($styles).'"'; + } + $type = $this->hidden ? 'hidden' : 'text'; $searchform=<<<ENDFORM -<form action="$search" class="bodySearch" id="bodySearch{$id}"><div class="bodySearchWrap"><label for="bodySearchIput{$id}">{$this->labeltext}</label><input type="{$type}" name="search" size="{$this->width}" class="bodySearchIput" id="bodySearchIput{$id}" /><input type="submit" name="go" value="{$buttonlabel}" class="bodySearchBtnGo" /> +<form action="$search" class="bodySearch" {$styles} id="bodySearch{$id}"><div class="bodySearchWrap" style="{$styles}">{$label}<input type="{$type}" name="search" size="{$this->width}" class="bodySearchIput" id="bodySearchIput{$id}" /><input type="submit" name="go" value="{$buttonlabel}" class="bodySearchBtnGo" /> ENDFORM; if ( !empty( $this->fulltextbtn ) ) // this is wrong... @@ -273,6 +287,7 @@ 'labeltext' => 'labeltext', 'break' => 'br', 'hidden' => 'hidden', + 'inline' => 'inline', ); foreach( $options as $name => $var ) { if( isset( $values[$name] ) ) _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS [at] lists https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
|