r97426 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97425‎ | r97426 | r97427 >
Date:16:29, 18 September 2011
Author:yaron
Status:deferred (Comments)
Tags:
Comment:
Some code improvements
Modified paths:
  • /trunk/extensions/SemanticDrilldown/includes/SD_PageSchemas.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticDrilldown/includes/SD_PageSchemas.php
@@ -7,6 +7,8 @@
88 * @author Ankit Garg
99 */
1010
 11+if ( !defined( 'MEDIAWIKI' ) ) die();
 12+
1113 class SDPageSchemas {
1214
1315 /**
@@ -50,13 +52,12 @@
5153 //$require_filter_label = wfMsg( 'sd_createfilter_requirefilter' );
5254
5355 $filter_array = array();
 56+ $hasExistingValues = false;
5457 if ( !is_null( $field ) ) {
5558 $sd_array = $field->getObject('semanticdrilldown_Filter');
5659 if ( array_key_exists( 'sd', $sd_array ) ) {
5760 $filter_array = $sd_array['sd'];
5861 $hasExistingValues = true;
59 - } else {
60 - $hasExistingValues = false;
6162 }
6263 }
6364
@@ -73,12 +74,11 @@
7475 $selectedCategory = '';
7576 }
7677 $dateRangesAttrs = array();
 78+ $year_value = wfMsgForContent( 'sd_filter_year' );
7779 $yearOptionAttrs = array( 'value' => $year_value );
 80+ $month_value = wfMsgForContent( 'sd_filter_month' );
7881 $monthOptionAttrs = array( 'value' => $month_value );
7982 if ( array_key_exists( 'TimePeriod', $filter_array ) ) {
80 - $year_value = wfMsgForContent( 'sd_filter_year' );
81 - // This value may eventually get checked against.
82 - //$month_value = wfMsgForContent( 'sd_filter_month' );
8383 $filterTimePeriod = $filter_array['TimePeriod'];
8484 $dateRangesAttrs['checked'] = true;
8585 if ( $filterTimePeriod == $year_value ) {
@@ -126,8 +126,9 @@
127127 $valuesListAttrs['selected'] = true;
128128 }
129129
130 - $html_text = '<p>' . wfMsg( 'sd_createfilter_name' ) . ' ';
 130+ $html_text = '<p>' . wfMsg( 'ps-optional-name' ) . ' ';
131131 $html_text .= Html::input( 'sd_filter_name_num', $filterLabel, 'text', array( 'size' => 25 ) ) . "</p>\n";
 132+ $html_text .= '<fieldset><legend>Values</legend>' . "\n";
132133 $html_text .= '<p>' . Html::input( 'sd_values_source_num', 'property', 'radio', $usePropertyValuesAttr ) . ' ';
133134 $html_text .= wfMsg( 'sd_createfilter_usepropertyvalues' ) . "</p>\n";
134135 $html_text .= "\t<p>\n";
@@ -157,6 +158,7 @@
158159 $html_text .= "\t" . wfMsg( 'sd_createfilter_entervalues' ) . "\n";
159160 $html_text .= "\t" . Html::input( 'sd_filter_values_num', $filterValuesStr, 'text', $filterValuesAttrs ) . "\n";
160161 $html_text .= "\t</p>\n";
 162+ $html_text .= "</fieldset>\n";
161163
162164 $html_text .= '<p>' . wfMsg( 'sd_createfilter_inputtype' ) . "\n";
163165 $inputTypeOptionsHTML = "\t" . Html::element( 'option', $valuesListAttrs, wfMsg( 'sd_createfilter_listofvalues' ) ) . "\n";

Follow-up revisions

RevisionCommit summaryAuthorDate
r97451Various additional fixes for Page Schemas-related code, including changing th...yaron05:56, 19 September 2011

Comments

#Comment by Nikerabbit (talk | contribs)   18:32, 18 September 2011

This check is not so useful on files with only class declaration

+if ( !defined( 'MEDIAWIKI' ) ) die();

No i18n for this?

+		$html_text .= '<fieldset><legend>Values</legend>' . "\n";
#Comment by Yaron Koren (talk | contribs)   05:58, 19 September 2011

Thanks for these notes. I don't know how that 'MEDIAWIKI' check got in there - I've been taking those out of files for a while.