https://www.mediawiki.org/wiki/Special:Code/MediaWiki/109840

Revision: 109840
Author:   yaron
Date:     2012-01-23 18:47:07 +0000 (Mon, 23 Jan 2012)
Log Message:
-----------
Added 'depth' parameter for 'category' and 'categories' input types

Modified Paths:
--------------
    trunk/extensions/SemanticForms/includes/forminputs/SF_CategoriesInput.php
    trunk/extensions/SemanticForms/includes/forminputs/SF_CategoryInput.php
    trunk/extensions/SemanticForms/languages/SF_Messages.php

Modified: 
trunk/extensions/SemanticForms/includes/forminputs/SF_CategoriesInput.php
===================================================================
--- trunk/extensions/SemanticForms/includes/forminputs/SF_CategoriesInput.php   
2012-01-23 18:46:31 UTC (rev 109839)
+++ trunk/extensions/SemanticForms/includes/forminputs/SF_CategoriesInput.php   
2012-01-23 18:47:07 UTC (rev 109840)
@@ -43,6 +43,11 @@
                        return null;
                }
                $hideroot = array_key_exists( 'hideroot', $other_args );
+               if ( array_key_exists( 'depth', $other_args ) ) {
+                       $depth = $other_args['depth'];
+               } else {
+                       $depth = '10';
+               }
                if ( array_key_exists( 'height', $other_args ) ) {
                        $height = $other_args['height'];
                } else {
@@ -60,7 +65,7 @@
                        $top_category, array(
                                'mode' => 'categories',
                                'namespaces' => array( NS_CATEGORY ),
-                               'depth' => 10,
+                               'depth' => $depth,
                                'hideroot' => $hideroot,
                        )
                );

Modified: 
trunk/extensions/SemanticForms/includes/forminputs/SF_CategoryInput.php
===================================================================
--- trunk/extensions/SemanticForms/includes/forminputs/SF_CategoryInput.php     
2012-01-23 18:46:31 UTC (rev 109839)
+++ trunk/extensions/SemanticForms/includes/forminputs/SF_CategoryInput.php     
2012-01-23 18:47:07 UTC (rev 109840)
@@ -35,6 +35,11 @@
                        return null;
                }
                $hideroot = array_key_exists( 'hideroot', $other_args );
+               if ( array_key_exists( 'depth', $other_args ) ) {
+                       $depth = $other_args['depth'];
+               } else {
+                       $depth = '10';
+               }
                if ( array_key_exists( 'height', $other_args ) ) {
                        $height = $other_args['height'];
                } else {
@@ -67,7 +72,7 @@
                        array(
                                'mode' => 'categories',
                                'namespaces' => array( NS_CATEGORY ),
-                               'depth' => 10,
+                               'depth' => $depth,
                                'hideroot' => $hideroot,
                        )
                );
@@ -124,6 +129,11 @@
                        'description' => wfMsg( 'sf_forminputs_hideroot' )
                );
                $params[] = array(
+                       'name' => 'depth',
+                       'type' => 'int',
+                       'description' => wfMsg( 'sf_forminputs_depth' )
+               );
+               $params[] = array(
                        'name' => 'height',
                        'type' => 'int',
                        'description' => wfMsg( 'sf_forminputs_height' )

Modified: trunk/extensions/SemanticForms/languages/SF_Messages.php
===================================================================
--- trunk/extensions/SemanticForms/languages/SF_Messages.php    2012-01-23 
18:46:31 UTC (rev 109839)
+++ trunk/extensions/SemanticForms/languages/SF_Messages.php    2012-01-23 
18:47:07 UTC (rev 109840)
@@ -73,6 +73,7 @@
        '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_depth'                => 'The number of levels of 
categories to show initially',
        'sf_forminputs_height'               => 'The height of this input, in 
pixels',
        'sf_forminputs_width'                => 'The width of this input, in 
pixels',
        'createform'                         => 'Create a form',


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to