r82522 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82521‎ | r82522 | r82523 >
Date:18:08, 20 February 2011
Author:yaron
Status:deferred
Tags:
Comment:
Added 'description' field to values returned by getParameters() methods, removed some code duplication
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormInputs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormInputs.php
@@ -71,9 +71,10 @@
7272 */
7373 public static function getParameters() {
7474 $params = array();
75 - $params[] = array( 'name' => 'class', 'type' => 'string' );
76 - $params[] = array( 'name' => 'default', 'type' => 'string' );
77 - $params[] = array( 'name' => 'preload', 'type' => 'string' );
 75+ $params[] = array( 'name' => 'class', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_class' ) );
 76+ $params[] = array( 'name' => 'default', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_default' ) );
 77+ $params[] = array( 'name' => 'preload', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_preload' ) );
 78+ $params[] = array( 'name' => 'property', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_property' ) );
7879 return $params;
7980 }
8081 }
@@ -87,14 +88,20 @@
8889 return array( 'enumeration' );
8990 }
9091
 92+ public static function getValuesParameters() {
 93+ $params = array();
 94+ $params[] = array( 'name' => 'values', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_values' ) );
 95+ $params[] = array( 'name' => 'values from property', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_valuesfromproperty' ) );
 96+ $params[] = array( 'name' => 'values from category', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_valuesfromcategory' ) );
 97+ $params[] = array( 'name' => 'values from namespace', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_valuesfromnamespace' ) );
 98+ $params[] = array( 'name' => 'values from concept', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_valuesfromconcept' ) );
 99+ return $params;
 100+ }
 101+
91102 public static function getParameters() {
92103 $params = parent::getParameters();
93 - $params[] = array( 'name' => 'values', 'type' => 'string' );
94 - $params[] = array( 'name' => 'values from property', 'type' => 'string' );
95 - $params[] = array( 'name' => 'values from category', 'type' => 'string' );
96 - $params[] = array( 'name' => 'values from namespace', 'type' => 'string' );
97 - $params[] = array( 'name' => 'values from concept', 'type' => 'string' );
98 - $params[] = array( 'name' => 'show on select', 'type' => 'string' );
 104+ $params = array_merge( $params, self::getValuesParameters() );
 105+ $params[] = array( 'name' => 'show on select', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_showonselect' ) );
99106 return $params;
100107 }
101108 }
@@ -263,10 +270,10 @@
264271
265272 public static function getParameters() {
266273 $params = parent::getParameters();
267 - $params[] = array( 'name' => 'size', 'type' => 'int' );
268 - $params[] = array( 'name' => 'maxlength', 'type' => 'int' );
269 - $params[] = array( 'name' => 'uploadable', 'type' => 'boolean' );
270 - $params[] = array( 'name' => 'default filename', 'type' => 'string' );
 274+ $params[] = array( 'name' => 'size', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_size' ) );
 275+ $params[] = array( 'name' => 'maxlength', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_maxlength' ) );
 276+ $params[] = array( 'name' => 'uploadable', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_uploadable' ) );
 277+ $params[] = array( 'name' => 'default filename', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_defaultfilename' ) );
271278 return $params;
272279 }
273280 }
@@ -740,16 +747,18 @@
741748 return $text;
742749 }
743750
 751+ public static function getAutocompletionParameters() {
 752+ $params = SFEnumInput::getValuesParameters();
 753+ $params[] = array( 'name' => 'values from url', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_valuesfromurl' ) );
 754+ $params[] = array( 'name' => 'remote autocompletion', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_remoteautocompletion' ) );
 755+ $params[] = array( 'name' => 'list', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_list' ) );
 756+ $params[] = array( 'name' => 'delimiter', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_delimiter' ) );
 757+ return $params;
 758+ }
 759+
744760 public static function getParameters() {
745761 $params = parent::getParameters();
746 - $params[] = array( 'name' => 'values from property', 'type' => 'string' );
747 - $params[] = array( 'name' => 'values from category', 'type' => 'string' );
748 - $params[] = array( 'name' => 'values from namespace', 'type' => 'string' );
749 - $params[] = array( 'name' => 'values from concept', 'type' => 'string' );
750 - $params[] = array( 'name' => 'values from url', 'type' => 'string' );
751 - $params[] = array( 'name' => 'values', 'type' => 'string' );
752 - $params[] = array( 'name' => 'list', 'type' => 'boolean' );
753 - $params[] = array( 'name' => 'remote autocompletion', 'type' => 'boolean' );
 762+ $params = array_merge( $params, self::getAutocompletionParameters() );
754763 return $params;
755764 }
756765 }
@@ -849,14 +858,7 @@
850859
851860 public static function getParameters() {
852861 $params = parent::getParameters();
853 - $params[] = array( 'name' => 'values from property', 'type' => 'string' );
854 - $params[] = array( 'name' => 'values from category', 'type' => 'string' );
855 - $params[] = array( 'name' => 'values from namespace', 'type' => 'string' );
856 - $params[] = array( 'name' => 'values from concept', 'type' => 'string' );
857 - $params[] = array( 'name' => 'values from url', 'type' => 'string' );
858 - $params[] = array( 'name' => 'values', 'type' => 'string' );
859 - $params[] = array( 'name' => 'list', 'type' => 'boolean' );
860 - $params[] = array( 'name' => 'remote autocompletion', 'type' => 'boolean' );
 862+ $params = array_merge( $params, SFTextWithAutocompleteInput::getAutocompletionParameters() );
861863 return $params;
862864 }
863865 }
@@ -950,10 +952,10 @@
951953
952954 public static function getParameters() {
953955 $params = parent::getParameters();
954 - $params[] = array( 'name' => 'rows', 'type' => 'int' );
955 - $params[] = array( 'name' => 'cols', 'type' => 'int' );
956 - $params[] = array( 'name' => 'maxlength', 'type' => 'int' );
957 - $params[] = array( 'name' => 'autogrow', 'type' => 'boolean' );
 956+ $params[] = array( 'name' => 'rows', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_rows' ) );
 957+ $params[] = array( 'name' => 'cols', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_cols' ) );
 958+ $params[] = array( 'name' => 'maxlength', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_maxlength' ) );
 959+ $params[] = array( 'name' => 'autogrow', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_autogrow' ) );
958960 return $params;
959961 }
960962 }
@@ -1165,7 +1167,7 @@
11661168
11671169 public static function getParameters() {
11681170 $params = parent::getParameters();
1169 - $params[] = array( 'name' => 'include timezone', 'type' => 'boolean' );
 1171+ $params[] = array( 'name' => 'include timezone', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_includetimezone' ) );
11701172 return $params;
11711173 }
11721174 }
@@ -1392,9 +1394,9 @@
13931395
13941396 public static function getParameters() {
13951397 $params = parent::getParameters();
1396 - $params[] = array( 'name' => 'top category', 'type' => 'string' );
1397 - $params[] = array( 'name' => 'height', 'type' => 'int' );
1398 - $params[] = array( 'name' => 'width', 'type' => 'int' );
 1398+ $params[] = array( 'name' => 'top category', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_topcategory' ) );
 1399+ $params[] = array( 'name' => 'height', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_height' ) );
 1400+ $params[] = array( 'name' => 'width', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_width' ) );
13991401 return $params;
14001402 }
14011403 }