http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89930
Revision: 89930 Author: yaron Date: 2011-06-12 14:49:57 +0000 (Sun, 12 Jun 2011) Log Message: ----------- Added 'hideroot' option to 'category' and 'categories' inputs, based on a patch from "FlooD" Modified Paths: -------------- trunk/extensions/SemanticForms/includes/SF_FormInputs.php trunk/extensions/SemanticForms/languages/SF_Messages.php Modified: trunk/extensions/SemanticForms/includes/SF_FormInputs.php =================================================================== --- trunk/extensions/SemanticForms/includes/SF_FormInputs.php 2011-06-12 13:26:30 UTC (rev 89929) +++ trunk/extensions/SemanticForms/includes/SF_FormInputs.php 2011-06-12 14:49:57 UTC (rev 89930) @@ -1463,6 +1463,7 @@ // escape - we can't do anything return null; } + $hideroot = array_key_exists( 'hideroot', $other_args ); if ( array_key_exists( 'height', $other_args ) ) { $height = $other_args['height']; } else { @@ -1491,7 +1492,7 @@ global $wgCategoryTreeMaxDepth; $wgCategoryTreeMaxDepth = 10; - $tree = efCategoryTreeParserHook( $top_category, array( 'mode' => 'categories', 'depth' => 10 ) ); + $tree = efCategoryTreeParserHook( $top_category, array( 'mode' => 'categories', 'depth' => 10, 'hideroot' => $hideroot ) ); // Capitalize the first letter, if first letters always get // capitalized. @@ -1519,6 +1520,7 @@ public static function getParameters() { $params = parent::getParameters(); $params[] = array( 'name' => 'top category', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_topcategory' ) ); + $params[] = array( 'name' => 'hideroot', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_hideroot' ) ); $params[] = array( 'name' => 'height', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_height' ) ); $params[] = array( 'name' => 'width', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_width' ) ); return $params; @@ -1562,6 +1564,7 @@ // escape - we can't do anything return null; } + $hideroot = array_key_exists( 'hideroot', $other_args ); if ( array_key_exists( 'height', $other_args ) ) { $height = $other_args['height']; } else { @@ -1575,7 +1578,7 @@ global $wgCategoryTreeMaxDepth; $wgCategoryTreeMaxDepth = 10; - $tree = efCategoryTreeParserHook( $top_category, array( 'mode' => 'categories', 'depth' => 10 ) ); + $tree = efCategoryTreeParserHook( $top_category, array( 'mode' => 'categories', 'depth' => 10, 'hideroot' => $hideroot ) ); // Some string that will hopefully never show up in a category, // template or field name. $dummy_str = 'REPLACE THIS STRING!'; Modified: trunk/extensions/SemanticForms/languages/SF_Messages.php =================================================================== --- trunk/extensions/SemanticForms/languages/SF_Messages.php 2011-06-12 13:26:30 UTC (rev 89929) +++ trunk/extensions/SemanticForms/languages/SF_Messages.php 2011-06-12 14:49:57 UTC (rev 89930) @@ -74,8 +74,9 @@ 'sf_forminputs_listboxsize' => 'The height of this listbox, in rows', 'sf_forminputs_includetimezone' => 'Include an input for the time zone', 'sf_forminputs_topcategory' => 'The parent category of this set of categories (required)', + 'sf_forminputs_hideroot' => 'Hide the parent category', 'sf_forminputs_height' => 'The height of this input, in pixels', - 'sf_forminputs_width' => 'The width of this input, in pixels', + 'sf_forminputs_width' => 'The width of this input, in pixels', 'createform' => 'Create a form', 'sf_createform_nameinput' => 'Form name', 'sf_createform_nameinputdesc' => '(the form is usually given the same name as its main template):', _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs