r94607 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94606‎ | r94607 | r94608 >
Date:07:07, 16 August 2011
Author:devayon
Status:deferred
Tags:
Comment:
decoupling parameter 'q' from execute() and some style fixes
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php
@@ -59,9 +59,7 @@
6060 $format_options_requested = $this->processFormatOptions( $wgRequest ); // handling ajax for format options
6161 if ( !$format_options_requested ) {
6262 // Checking if a query string has been sent by using the form
63 - // the 'q' is dependent from the form parameter set by getQueryFormBox()
64 - // and processQueryFormBox()
65 - if ( $wgRequest->getCheck( 'q' ) ) {
 63+ if ( !( $this->processQueryFormBox( $wgRequest ) === false ) ) {
6664 $params = $this->processParams();
6765 $this->uiCore = SMWQueryUIHelper::makeForUI(
6866 $this->processQueryFormBox( $wgRequest ),
@@ -354,7 +352,7 @@
355353 $result .= '</div>';
356354 $this->enableJQuery();
357355 $wgOut->addScriptFile( "$smwgScriptPath/skins/elastic/jquery.elastic.source.js" );
358 -
 356+
359357 /*
360358 * Compatibity function for disabling elastic textboxes for IE. This may
361359 * be removed when jQuery 1.4 or above is supported.
@@ -381,12 +379,15 @@
382380 * parameters.
383381 *
384382 * @param WebRequest $wgRequest
385 - * @return string
 383+ * @return mixed returns the querystring if possible, false if no querystring is set
386384 */
387385 protected function processQueryFormBox( WebRequest $wgRequest ) {
388 - $query = '';
389 - if ( $wgRequest->getCheck( 'q' ) ) $query = $wgRequest->getVal( 'q' );
390 - return $query;
 386+ if ( $wgRequest->getCheck( 'q' ) ) {
 387+ $query = $wgRequest->getVal( 'q' );
 388+ return $query;
 389+ } else {
 390+ return false;
 391+ }
391392 }
392393
393394 /**
@@ -675,7 +676,7 @@
676677 */
677678 $result .= Html::openElement( 'div', array( 'id' => "sort_div_$i", 'class' => 'smwsort' ) );
678679 $result .= '<span class="smwquisortlabel"><span class="smw-remove"><a href="javascript:removePOInstance(\'sort_div_' . $i . '\')"><img src="' . $smwgScriptPath . '/skins/images/close-button.png" alt="' . wfMsg( 'smw_qui_delete' ) . '"></a></span>';
679 - $result .= wfMsg( 'smw_qui_property' ).'</span>';
 680+ $result .= wfMsg( 'smw_qui_property' ) . '</span>';
680681 $result .= Html::input( 'property[' . $i . ']', $propertyValues[$key], 'text', array( 'size' => '35', 'id' => "property$i" ) ) . "\n";
681682 $result .= Html::openElement( 'select', array( 'name' => "order[$i]" ) );
682683
@@ -722,7 +723,7 @@
723724 */
724725 $result .= Html::openElement( 'div', array( 'id' => "sort_div_$i", 'class' => 'smwsort' ) );
725726 $result .= '<span class="smwquisortlabel"><span class="smw-remove"><a href="javascript:removePOInstance(\'sort_div_' . $i . '\')"><img src="' . $smwgScriptPath . '/skins/images/close-button.png" alt="' . wfMsg( 'smw_qui_delete' ) . '"></a></span>' .
726 - wfMsg( 'smw_qui_category' ) .'</span>'.
 727+ wfMsg( 'smw_qui_category' ) . '</span>' .
727728 Xml::input( "category[$i]", '25', $categoryValues[$key], array( 'id' => "category$i" ) ) . " " .
728729 Html::hidden( "cat_label[$i]", $categoryLabelValues[$key], array( 'id' => "cat_label$i" ) ) .
729730 Html::hidden( "cat_yes[$i]", $categoryYesValues[$key], array( 'id' => "cat_yes$i" ) ) .
@@ -737,7 +738,7 @@
738739 */
739740 $result .= Html::openElement( 'div', array( 'id' => "sort_div_$i", 'class' => 'smwsort' ) ) .
740741 '<span class="smwquisortlabel"><span class="smw-remove"><a href="javascript:removePOInstance(\'sort_div_' . $i . '\')"><img src="' . $smwgScriptPath . '/skins/images/close-button.png" alt="' . wfMsg( 'smw_qui_delete' ) . '"></a></span>' .
741 - wfMsg( 'smw_qui_rescol' ) .'</span>'.
 742+ wfMsg( 'smw_qui_rescol' ) . '</span>' .
742743 Xml::input( "maincol_label[$i]", '20', $mainColumnLabels[$key], array ( 'id' => "maincol_label$i" ) ) . " " .
743744 Xml::closeElement( 'div' );
744745 $i++;
@@ -748,8 +749,8 @@
749750
750751 // create hidden form elements to be cloned later
751752 $hiddenProperty = Html::openElement( 'div', array( 'id' => 'property_starter', 'class' => 'smwsort', 'style' => 'display:none' ) ) .
752 - '<span class="smwquisortlabel">'.'<span class="smw-remove"><a><img src="' . $smwgScriptPath . '/skins/images/close-button.png" alt="' . wfMsg( 'smw_qui_delete' ) . '"></a></span>' .
753 - wfMsg( 'smw_qui_property' ).'</span>'.
 753+ '<span class="smwquisortlabel">' . '<span class="smw-remove"><a><img src="' . $smwgScriptPath . '/skins/images/close-button.png" alt="' . wfMsg( 'smw_qui_delete' ) . '"></a></span>' .
 754+ wfMsg( 'smw_qui_property' ) . '</span>' .
754755 Xml::input( 'property_num', '25' ) . " " .
755756 Html::openElement( 'select', array( 'name' => 'order_num' ) ) .
756757 Xml::option( wfMsg( 'smw_qui_nosort' ), 'NONE' ) .
@@ -764,8 +765,8 @@
765766 $hiddenProperty = json_encode( $hiddenProperty );
766767
767768 $hiddenCategory = Html::openElement( 'div', array( 'id' => 'category_starter', 'class' => 'smwsort', 'style' => 'display:none' ) ) .
768 - '<span class="smwquisortlabel">'.'<span class="smw-remove"><a><img src="' . $smwgScriptPath . '/skins/images/close-button.png" alt="' . wfMsg( 'smw_qui_delete' ) . '"></a></span>' .
769 - wfMsg( 'smw_qui_category' ) .'</span>'.
 769+ '<span class="smwquisortlabel">' . '<span class="smw-remove"><a><img src="' . $smwgScriptPath . '/skins/images/close-button.png" alt="' . wfMsg( 'smw_qui_delete' ) . '"></a></span>' .
 770+ wfMsg( 'smw_qui_category' ) . '</span>' .
770771 Xml::input( "category_num", '25' ) . " " .
771772 '<input type="hidden" name="cat_label_num" />' .
772773 '<input type="hidden" name="cat_yes_num" />' .
@@ -774,8 +775,8 @@
775776 $hiddenCategory = json_encode( $hiddenCategory );
776777
777778 $hiddenMainColumn = Html::openElement( 'div', array( 'id' => 'maincol_starter', 'class' => 'smwsort', 'style' => 'display:none' ) ) .
778 - '<span class="smwquisortlabel">'.'<span class="smw-remove"><a><img src="' . $smwgScriptPath . '/skins/images/close-button.png" alt="' . wfMsg( 'smw_qui_delete' ) . '"></a></span>' .
779 - wfMsg( 'smw_qui_rescol' ) .'</span>'.
 779+ '<span class="smwquisortlabel">' . '<span class="smw-remove"><a><img src="' . $smwgScriptPath . '/skins/images/close-button.png" alt="' . wfMsg( 'smw_qui_delete' ) . '"></a></span>' .
 780+ wfMsg( 'smw_qui_rescol' ) . '</span>' .
780781 Xml::input( "maincol_label_num", '25' ) . " " .
781782 Xml::closeElement( 'div' );
782783 $hiddenMainColumn = json_encode( $hiddenMainColumn );