r90456 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90455‎ | r90456 | r90457 >
Date:12:06, 20 June 2011
Author:devayon
Status:deferred
Tags:
Comment:
Removed some notices caused in r90263
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialQueryCreator.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialQueryCreator.php
@@ -96,7 +96,7 @@
9797
9898 $result .= "<br /><br />\n<p>" . wfMsg( 'smw_ask_format_as' ) . ' <input type="hidden" name="eq" value="yes"/>' . "\n" .
9999 '<select id="formatSelector" name="p[format]" onChange="JavaScript:updateOtherOptions(\'' . $url . '\')">' . "\n" .
100 - ' <option value="broadtable"' . ( $this->m_params['format'] == 'broadtable' ? ' selected' : '' ) . '>' .
 100+ ' <option value="broadtable">' .
101101 $printer->getName() . ' (' . wfMsg( 'smw_ask_defaultformat' ) . ')</option>' . "\n";
102102
103103 $formats = array();
@@ -112,7 +112,7 @@
113113 natcasesort( $formats );
114114
115115 foreach ( $formats as $format => $name ) {
116 - $result .= ' <option value="' . $format . '"' . ( $this->m_params['format'] == $format ? ' selected' : '' ) . '>' . $name . "</option>\n";
 116+ $result .= ' <option value="' . $format . '>' . $name . "</option>\n";
117117 }
118118 //add javascript for updating formating options by ajax
119119 $default_format_url = SpecialPage::getSafeTitleFor( 'Ask' )->getLocalURL( "showformatoptions=broadtable" );
@@ -134,7 +134,6 @@
135135 $result .= '<fieldset><legend>' . wfMsg( 'smw_ask_otheroptions' ) . "</legend>\n";
136136 $result .= "<div id=\"other_options\"></div>";
137137 $result .= "</fieldset>\n";
138 - $urltail = str_replace( '&eq=yes', '', $urltail ) . '&eq=no';
139138 $result .= '</div>';
140139 $result .= '<br /><input type="submit" value="' . wfMsg( 'smw_ask_submit' ) . '"/>' .
141140 '<input type="hidden" name="eq" value="no"/>' .
Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php
@@ -547,7 +547,7 @@
548548
549549 $printer = SMWQueryProcessor::getResultPrinter( 'broadtable', SMWQueryProcessor::SPECIAL_PAGE );
550550 $url = SpecialPage::getSafeTitleFor( 'Ask' )->getLocalURL( "showformatoptions=' + this.value + '" );
551 -
 551+
552552 foreach ( $this->m_params as $param => $value ) {
553553 if ( $param !== 'format' ) {
554554 $url .= '&params[' . Xml::escapeJsString( $param ) . ']=' . Xml::escapeJsString( $value );
@@ -596,7 +596,7 @@
597597 "\n</form>";
598598 } else { // if $this->m_editquery == false
599599 $urltail = str_replace( '&eq=no', '', $urltail ) . '&eq=yes';
600 - $result .= '<p>' .
 600+ $result .= '<p>' .
601601 Html::element(
602602 'a',
603603 array(
@@ -670,14 +670,14 @@
671671 'rel' => 'nofollow'
672672 ),
673673 wfMsg( 'smw_result_prev' )
674 - );
675 -
 674+ );
 675+
676676 } else {
677677 $navigation = wfMsg( 'smw_result_prev' );
678678 }
679679
680 - $navigation .=
681 - '&#160;&#160;&#160;&#160; <b>' .
 680+ $navigation .=
 681+ '&#160;&#160;&#160;&#160; <b>' .
682682 wfMsg( 'smw_result_results' ) . ' ' . ( $offset + 1 ) .
683683 '&#150; ' .
684684 ( $offset + $res->getCount() ) .
@@ -694,7 +694,7 @@
695695 'rel' => 'nofollow'
696696 ),
697697 wfMsg( 'smw_result_next' )
698 - );
 698+ );
699699 } else {
700700 $navigation .= wfMsg( 'smw_result_next' );
701701 }
@@ -722,7 +722,7 @@
723723 'rel' => 'nofollow'
724724 ),
725725 $l
726 - );
 726+ );
727727 } else {
728728 $navigation .= '<b>' . $l . '</b>';
729729 }
@@ -748,12 +748,12 @@
749749 $printer = SMWQueryProcessor::getResultPrinter( $format, SMWQueryProcessor::SPECIAL_PAGE );
750750
751751 $params = method_exists( $printer, 'getParameters' ) ? $printer->getParameters() : array();
752 -
 752+
753753 // Ignore the format parameter, as we got a special control in the GUI for it already.
754754 unset( $params['format'] );
755 -
 755+
756756 $optionsHtml = array();
757 -
 757+
758758 foreach ( $params as $param ) {
759759 $param = $this->toValidatorParam( $param );
760760 $currentValue = array_key_exists( $param->getName(), $paramValues ) ? $paramValues[$param->getName()] : false;
@@ -770,21 +770,21 @@
771771 Html::element( 'em', array(), $param->getDescription() )
772772 );
773773 }
774 -
 774+
775775 for ( $i = 0, $n = count( $optionsHtml ); $i < $n; $i++ ) {
776776 if ( $i % 3 == 2 || $i == $n - 1 ) {
777777 $optionsHtml[$i] .= "<div style=\"clear: both\";></div>\n";
778778 }
779779 }
780 -
 780+
781781 $i = 0;
782782 $rowHtml = '';
783783 $resultHtml = '';
784 -
 784+
785785 while ( $option = array_shift( $optionsHtml ) ) {
786786 $rowHtml .= $option;
787787 $i++;
788 -
 788+
789789 if ( $i % 3 == 0 ) {
790790 $resultHtml .= Html::rawElement(
791791 'div',
@@ -799,65 +799,65 @@
800800
801801 return $resultHtml;
802802 }
803 -
 803+
804804 /**
805805 * Returns a Validator style Parameter definition.
806806 * SMW 1.5.x style definitions are converted.
807 - *
 807+ *
808808 * @since 1.6
809 - *
 809+ *
810810 * @param mixed $param
811 - *
 811+ *
812812 * @return Parameter
813813 */
814814 protected function toValidatorParam( $param ) {
815815 static $typeMap = array(
816816 'int' => Parameter::TYPE_INTEGER
817817 );
818 -
 818+
819819 if ( !( $param instanceof Parameter ) ) {
820820 if ( !array_key_exists( 'type', $param ) ) {
821821 $param['type'] = 'string';
822822 }
823 -
 823+
824824 $paramClass = $param['type'] == 'enum-list' ? 'ListParameter' : 'Parameter';
825825 $paramType = array_key_exists( $param['type'], $typeMap ) ? $typeMap[$param['type']] : Parameter::TYPE_STRING;
826 -
 826+
827827 $parameter = new $paramClass( $param['name'], $paramType );
828 -
 828+
829829 if ( array_key_exists( 'description', $param ) ) {
830830 $parameter->setDescription( $param['description'] );
831831 }
832 -
 832+
833833 if ( array_key_exists( 'values', $param ) && is_array( $param['values'] ) ) {
834834 $parameter->addCriteria( new CriterionInArray( $param['values'] ) );
835835 }
836 -
 836+
837837 return $parameter;
838838 }
839839 else {
840840 return $param;
841841 }
842842 }
843 -
 843+
844844 /**
845845 * Get the HTML for a single parameter input.
846 - *
 846+ *
847847 * @since 1.6
848 - *
 848+ *
849849 * @param Parameter $parameter
850850 * @param mixed $currentValue
851 - *
 851+ *
852852 * @return string
853853 */
854854 protected function showFormatOption( Parameter $parameter, $currentValue ) {
855855 $input = new ParameterInput( $parameter );
856856 $input->setInputName( 'p[' . $parameter->getName() . ']' );
857 -
 857+
858858 if ( $currentValue !== false ) {
859859 $input->setCurrentValue( $currentValue );
860860 }
861 -
 861+
862862 return $input->getHtml();
863863 }
864864

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r90263Code cleanup for Query Creatordevayon11:09, 17 June 2011