r89930 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89929‎ | r89930 | r89931 >
Date:14:49, 12 June 2011
Author:yaron
Status:deferred
Tags:
Comment:
Added 'hideroot' option to 'category' and 'categories' inputs, based on a patch from "FlooD"
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormInputs.php (modified) (history)
  • /trunk/extensions/SemanticForms/languages/SF_Messages.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormInputs.php
@@ -1463,6 +1463,7 @@
14641464 // escape - we can't do anything
14651465 return null;
14661466 }
 1467+ $hideroot = array_key_exists( 'hideroot', $other_args );
14671468 if ( array_key_exists( 'height', $other_args ) ) {
14681469 $height = $other_args['height'];
14691470 } else {
@@ -1491,7 +1492,7 @@
14921493
14931494 global $wgCategoryTreeMaxDepth;
14941495 $wgCategoryTreeMaxDepth = 10;
1495 - $tree = efCategoryTreeParserHook( $top_category, array( 'mode' => 'categories', 'depth' => 10 ) );
 1496+ $tree = efCategoryTreeParserHook( $top_category, array( 'mode' => 'categories', 'depth' => 10, 'hideroot' => $hideroot ) );
14961497
14971498 // Capitalize the first letter, if first letters always get
14981499 // capitalized.
@@ -1519,6 +1520,7 @@
15201521 public static function getParameters() {
15211522 $params = parent::getParameters();
15221523 $params[] = array( 'name' => 'top category', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_topcategory' ) );
 1524+ $params[] = array( 'name' => 'hideroot', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_hideroot' ) );
15231525 $params[] = array( 'name' => 'height', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_height' ) );
15241526 $params[] = array( 'name' => 'width', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_width' ) );
15251527 return $params;
@@ -1562,6 +1564,7 @@
15631565 // escape - we can't do anything
15641566 return null;
15651567 }
 1568+ $hideroot = array_key_exists( 'hideroot', $other_args );
15661569 if ( array_key_exists( 'height', $other_args ) ) {
15671570 $height = $other_args['height'];
15681571 } else {
@@ -1575,7 +1578,7 @@
15761579
15771580 global $wgCategoryTreeMaxDepth;
15781581 $wgCategoryTreeMaxDepth = 10;
1579 - $tree = efCategoryTreeParserHook( $top_category, array( 'mode' => 'categories', 'depth' => 10 ) );
 1582+ $tree = efCategoryTreeParserHook( $top_category, array( 'mode' => 'categories', 'depth' => 10, 'hideroot' => $hideroot ) );
15801583 // Some string that will hopefully never show up in a category,
15811584 // template or field name.
15821585 $dummy_str = 'REPLACE THIS STRING!';
Index: trunk/extensions/SemanticForms/languages/SF_Messages.php
@@ -74,8 +74,9 @@
7575 'sf_forminputs_listboxsize' => 'The height of this listbox, in rows',
7676 'sf_forminputs_includetimezone' => 'Include an input for the time zone',
7777 'sf_forminputs_topcategory' => 'The parent category of this set of categories (required)',
 78+ 'sf_forminputs_hideroot' => 'Hide the parent category',
7879 'sf_forminputs_height' => 'The height of this input, in pixels',
79 - 'sf_forminputs_width' => 'The width of this input, in pixels',
 80+ 'sf_forminputs_width' => 'The width of this input, in pixels',
8081 'createform' => 'Create a form',
8182 'sf_createform_nameinput' => 'Form name',
8283 'sf_createform_nameinputdesc' => '(the form is usually given the same name as its main template):',