Documentation, stylize, remove some global dependencies

This commit is contained in:
Sam Reed 2012-02-09 01:23:31 +00:00
parent 4383d6d598
commit 079968308b
Notes: Sam Reed 2012-02-09 01:23:31 +00:00
4 changed files with 292 additions and 110 deletions

View file

@ -7,11 +7,21 @@ class CategoryTreeCategoryPage extends CategoryPage {
class CategoryTreeCategoryViewer extends CategoryViewer {
var $child_cats;
/**
* @var CategoryTree
*/
var $categorytree;
/**
* @return CategoryTree
*/
function getCategoryTree() {
global $wgOut, $wgCategoryTreeCategoryPageOptions, $wgCategoryTreeForceHeaders;
if ( ! isset( $this->categorytree ) ) {
if ( !$wgCategoryTreeForceHeaders ) CategoryTree::setHeaders( $wgOut );
if ( !isset( $this->categorytree ) ) {
if ( !$wgCategoryTreeForceHeaders ) {
CategoryTree::setHeaders( $wgOut );
}
$this->categorytree = new CategoryTree( $wgCategoryTreeCategoryPageOptions );
}
@ -21,6 +31,10 @@ class CategoryTreeCategoryViewer extends CategoryViewer {
/**
* Add a subcategory to the internal lists
* @param $cat Category
* @param $sortkey
* @param $pageLength
* @return
*/
function addSubcategoryObject( Category $cat, $sortkey, $pageLength ) {
global $wgRequest;
@ -28,7 +42,8 @@ class CategoryTreeCategoryViewer extends CategoryViewer {
$title = $cat->getTitle();
if ( $wgRequest->getCheck( 'notree' ) ) {
return parent::addSubcategoryObject( $cat, $sortkey, $pageLength );
parent::addSubcategoryObject( $cat, $sortkey, $pageLength );
return;
}
$tree = $this->getCategoryTree();

View file

@ -217,6 +217,10 @@ function efCategoryTree() {
$wgHooks['ResourceLoaderGetConfigVars'][] = 'efCategoryTreeGetConfigVars';
}
/**
* @param $parser Parser
* @return bool
*/
function efCategoryTreeSetHooks( $parser ) {
$parser->setHook( 'categorytree' , 'efCategoryTreeParserHook' );
$parser->setFunctionHook( 'categorytree' , 'efCategoryTreeParserFunction' );
@ -229,6 +233,10 @@ function efCategoryTreeSetHooks( $parser ) {
* If $enc is not given, '' is asumed, which simulates the old call interface,
* namely, only providing the mode name or number.
* This loads CategoryTreeFunctions.php and calls CategoryTree::ajax()
* @param $category
* @param $options array
* @param $enc string
* @return AjaxResponse|bool
*/
function efCategoryTreeAjaxWrapper( $category, $options = array(), $enc = '' ) {
global $wgCategoryTreeHTTPCache, $wgSquidMaxage, $wgUseSquid;
@ -254,8 +262,10 @@ function efCategoryTreeAjaxWrapper( $category, $options = array(), $enc = '' ) {
/**
* Internal function to cap depth
* @param $mode
* @param $depth
* @return int|mixed
*/
function efCategoryTreeCapDepth( $mode, $depth ) {
global $wgCategoryTreeMaxDepth;
@ -280,6 +290,8 @@ function efCategoryTreeCapDepth( $mode, $depth ) {
/**
* Entry point for the {{#categorytree}} tag parser function.
* This is a wrapper around efCategoryTreeParserHook
* @param $parser Parser
* @return array|string
*/
function efCategoryTreeParserFunction( $parser ) {
$params = func_get_args();
@ -297,8 +309,7 @@ function efCategoryTreeParserFunction( $parser ) {
if ( preg_match( '/^\s*(\S.*?)\s*=\s*(.*?)\s*$/', $p, $m ) ) {
$k = $m[1];
$v = preg_replace( '/^"\s*(.*?)\s*"$/', '$1', $m[2] ); // strip any quotes enclusing the value
}
else {
} else {
$k = trim( $p );
$v = true;
}
@ -314,13 +325,16 @@ function efCategoryTreeParserFunction( $parser ) {
/**
* Hook implementation for injecting a category tree into the sidebar.
* Registered automatically if $wgCategoryTreeSidebarRoot is set to a category name.
* @param $skin
* @param $tpl SkinTemplate
* @return bool
*/
function efCategoryTreeSkinTemplateOutputPageBeforeExec( $skin, $tpl ) {
global $wgCategoryTreeSidebarRoot, $wgCategoryTreeSidebarOptions;
$html = efCategoryTreeParserHook( $wgCategoryTreeSidebarRoot, $wgCategoryTreeSidebarOptions );
if ( $html ) {
$tpl->data['sidebar']['categorytree-portlet'] = $html; // requires MW 1.13, r36917
$tpl->data['sidebar']['categorytree-portlet'] = $html;
}
return true;
@ -329,6 +343,11 @@ function efCategoryTreeSkinTemplateOutputPageBeforeExec( $skin, $tpl ) {
/**
* Entry point for the <categorytree> tag parser hook.
* This loads CategoryTreeFunctions.php and calls CategoryTree::getTag()
* @param $cat
* @param $argv
* @param $parser Parser
* @param $allowMissing bool
* @return bool|string
*/
function efCategoryTreeParserHook( $cat, $argv, $parser = null, $allowMissing = false ) {
global $wgOut;
@ -356,9 +375,12 @@ function efCategoryTreeParserHook( $cat, $argv, $parser = null, $allowMissing =
}
/**
* Hook callback that injects messages and things into the <head> tag
* Does nothing if $parserOutput->mCategoryTreeTag is not set
*/
* Hook callback that injects messages and things into the <head> tag
* Does nothing if $parserOutput->mCategoryTreeTag is not set
* @param $outputPage OutputPage
* @param $parserOutput ParserOutput
* @return bool
*/
function efCategoryTreeParserOutput( $outputPage, $parserOutput ) {
if ( !empty( $parserOutput->mCategoryTreeTag ) ) {
CategoryTree::setHeaders( $outputPage );
@ -371,6 +393,7 @@ function efCategoryTreeParserOutput( $outputPage, $parserOutput ) {
*
* @param $title Title
* @param $article Article
* @return bool
*/
function efCategoryTreeArticleFromTitle( $title, &$article ) {
if ( $title->getNamespace() == NS_CATEGORY ) {
@ -381,6 +404,10 @@ function efCategoryTreeArticleFromTitle( $title, &$article ) {
/**
* OutputPageMakeCategoryLinks hook, override category links
* @param $out
* @param $categories
* @param $links
* @return bool
*/
function efCategoryTreeOutputPageMakeCategoryLinks( $out, &$categories, &$links ) {
global $wgCategoryTreePageCategoryOptions;
@ -392,6 +419,12 @@ function efCategoryTreeOutputPageMakeCategoryLinks( $out, &$categories, &$links
return false;
}
/**
* @param $skin
* @param $links
* @param $result
* @return bool
*/
function efCategoryTreeSkinJoinCategoryLinks( $skin, &$links, &$result ) {
$embed = '<div class="CategoryTreeCategoryBarItem">';
$pop = '</div>';
@ -402,6 +435,10 @@ function efCategoryTreeSkinJoinCategoryLinks( $skin, &$links, &$result ) {
return false;
}
/**
* @param $vars
* @return bool
*/
function efCategoryTreeGetConfigVars( &$vars ) {
global $wgCategoryTreeCategoryPageOptions;
@ -409,4 +446,4 @@ function efCategoryTreeGetConfigVars( &$vars ) {
$ct = new CategoryTree( $wgCategoryTreeCategoryPageOptions );
$vars['wgCategoryTreePageCategoryOptions'] = $ct->getOptionsAsJsStructure();
return true;
}
}

View file

@ -19,6 +19,10 @@ class CategoryTree {
var $mIsAjaxRequest = false;
var $mOptions = array();
/**
* @param $options array
* @param $ajax bool
*/
function __construct( $options, $ajax = false ) {
global $wgCategoryTreeDefaultOptions;
@ -56,38 +60,56 @@ class CategoryTree {
}
}
/**
* @param $name string
* @return mixed
*/
function getOption( $name ) {
return $this->mOptions[$name];
}
/**
* @return bool
*/
function isInverse( ) {
return $this->getOption( 'mode' ) == CT_MODE_PARENTS;
}
/**
* @param $nn
* @return array|bool
*/
static function decodeNamespaces( $nn ) {
global $wgContLang;
if ( !$nn )
if ( !$nn ) {
return false;
}
if ( !is_array( $nn ) )
if ( !is_array( $nn ) ) {
$nn = preg_split( '![\s#:|]+!', $nn );
}
$namespaces = array();
foreach ( $nn as $n ) {
if ( is_int( $n ) ) {
$ns = $n;
}
else {
} else {
$n = trim( $n );
if ( $n === '' ) continue;
if ( $n === '' ) {
continue;
}
$lower = strtolower( $n );
if ( is_numeric( $n ) ) $ns = (int)$n;
elseif ( $n == '-' || $n == '_' || $n == '*' || $lower == 'main' ) $ns = NS_MAIN;
else $ns = $wgContLang->getNsIndex( $n );
if ( is_numeric( $n ) ) {
$ns = (int)$n;
} elseif ( $n == '-' || $n == '_' || $n == '*' || $lower == 'main' ) {
$ns = NS_MAIN;
} else {
$ns = $wgContLang->getNsIndex( $n );
}
}
if ( is_int( $ns ) ) {
@ -99,61 +121,111 @@ class CategoryTree {
return $namespaces;
}
/**
* @param $mode
* @return int|string
*/
static function decodeMode( $mode ) {
global $wgCategoryTreeDefaultOptions;
if ( is_null( $mode ) ) return $wgCategoryTreeDefaultOptions['mode'];
if ( is_int( $mode ) ) return $mode;
if ( is_null( $mode ) ) {
return $wgCategoryTreeDefaultOptions['mode'];
}
if ( is_int( $mode ) ) {
return $mode;
}
$mode = trim( strtolower( $mode ) );
if ( is_numeric( $mode ) ) return (int)$mode;
if ( is_numeric( $mode ) ) {
return (int)$mode;
}
if ( $mode == 'all' ) $mode = CT_MODE_ALL;
elseif ( $mode == 'pages' ) $mode = CT_MODE_PAGES;
elseif ( $mode == 'categories' || $mode == 'sub' ) $mode = CT_MODE_CATEGORIES;
elseif ( $mode == 'parents' || $mode == 'super' || $mode == 'inverse' ) $mode = CT_MODE_PARENTS;
elseif ( $mode == 'default' ) $mode = $wgCategoryTreeDefaultOptions['mode'];
if ( $mode == 'all' ) {
$mode = CT_MODE_ALL;
} elseif ( $mode == 'pages' ) {
$mode = CT_MODE_PAGES;
} elseif ( $mode == 'categories' || $mode == 'sub' ) {
$mode = CT_MODE_CATEGORIES;
} elseif ( $mode == 'parents' || $mode == 'super' || $mode == 'inverse' ) {
$mode = CT_MODE_PARENTS;
} elseif ( $mode == 'default' ) {
$mode = $wgCategoryTreeDefaultOptions['mode'];
}
return (int)$mode;
}
/**
* Helper function to convert a string to a boolean value.
* Perhaps make this a global function in MediaWiki proper
*/
* Helper function to convert a string to a boolean value.
* Perhaps make this a global function in MediaWiki proper
* @param $value
* @return bool|null|string
*/
static function decodeBoolean( $value ) {
if ( is_null( $value ) ) return null;
if ( is_bool( $value ) ) return $value;
if ( is_int( $value ) ) return ( $value > 0 );
if ( is_null( $value ) ) {
return null;
}
if ( is_bool( $value ) ) {
return $value;
}
if ( is_int( $value ) ) {
return ( $value > 0 );
}
$value = trim( strtolower( $value ) );
if ( is_numeric( $value ) ) return ( (int)$value > 0 );
if ( is_numeric( $value ) ) {
return ( (int)$value > 0 );
}
if ( $value == 'yes' || $value == 'y' || $value == 'true' || $value == 't' || $value == 'on' ) return true;
elseif ( $value == 'no' || $value == 'n' || $value == 'false' || $value == 'f' || $value == 'off' ) return false;
elseif ( $value == 'null' || $value == 'default' || $value == 'none' || $value == 'x' ) return null;
else return false;
if ( $value == 'yes' || $value == 'y' || $value == 'true' || $value == 't' || $value == 'on' ) {
return true;
} elseif ( $value == 'no' || $value == 'n' || $value == 'false' || $value == 'f' || $value == 'off' ) {
return false;
} elseif ( $value == 'null' || $value == 'default' || $value == 'none' || $value == 'x' ) {
return null;
} else {
return false;
}
}
/**
* @param $value
* @return int|string
*/
static function decodeHidePrefix( $value ) {
global $wgCategoryTreeDefaultOptions;
if ( is_null( $value ) ) return $wgCategoryTreeDefaultOptions['hideprefix'];
if ( is_int( $value ) ) return $value;
if ( $value === true ) return CT_HIDEPREFIX_ALWAYS;
if ( $value === false ) return CT_HIDEPREFIX_NEVER;
if ( is_null( $value ) ) {
return $wgCategoryTreeDefaultOptions['hideprefix'];
}
if ( is_int( $value ) ) {
return $value;
}
if ( $value === true ) {
return CT_HIDEPREFIX_ALWAYS;
}
if ( $value === false ) {
return CT_HIDEPREFIX_NEVER;
}
$value = trim( strtolower( $value ) );
if ( $value == 'yes' || $value == 'y' || $value == 'true' || $value == 't' || $value == 'on' ) return CT_HIDEPREFIX_ALWAYS;
elseif ( $value == 'no' || $value == 'n' || $value == 'false' || $value == 'f' || $value == 'off' ) return CT_HIDEPREFIX_NEVER;
// elseif ( $value == 'null' || $value == 'default' || $value == 'none' || $value == 'x' ) return $wgCategoryTreeDefaultOptions['hideprefix'];
elseif ( $value == 'always' ) return CT_HIDEPREFIX_ALWAYS;
elseif ( $value == 'never' ) return CT_HIDEPREFIX_NEVER;
elseif ( $value == 'auto' ) return CT_HIDEPREFIX_AUTO;
elseif ( $value == 'categories' || $value == 'category' || $value == 'smart' ) return CT_HIDEPREFIX_CATEGORIES;
else return $wgCategoryTreeDefaultOptions['hideprefix'];
if ( $value == 'yes' || $value == 'y' || $value == 'true' || $value == 't' || $value == 'on' ) {
return CT_HIDEPREFIX_ALWAYS;
} elseif ( $value == 'no' || $value == 'n' || $value == 'false' || $value == 'f' || $value == 'off' ) {
return CT_HIDEPREFIX_NEVER;
} elseif ( $value == 'always' ) {
return CT_HIDEPREFIX_ALWAYS;
} elseif ( $value == 'never' ) {
return CT_HIDEPREFIX_NEVER;
} elseif ( $value == 'auto' ) {
return CT_HIDEPREFIX_AUTO;
} elseif ( $value == 'categories' || $value == 'category' || $value == 'smart' ) {
return CT_HIDEPREFIX_CATEGORIES;
} else {
return $wgCategoryTreeDefaultOptions['hideprefix'];
}
}
/**
@ -179,6 +251,12 @@ class CategoryTree {
return $json;
}
/**
* @param $options
* @param $enc
* @return mixed
* @throws MWException
*/
static function encodeOptions( $options, $enc ) {
if ( $enc == 'mode' || $enc == '' ) {
$opt = $options['mode'];
@ -192,6 +270,12 @@ class CategoryTree {
return $opt;
}
/**
* @param $options
* @param $enc
* @return array|mixed
* @throws MWException
*/
static function decodeOptions( $options, $enc ) {
if ( $enc == 'mode' || $enc == '' ) {
$opt = array( "mode" => $options );
@ -206,6 +290,10 @@ class CategoryTree {
return $opt;
}
/**
* @param $depth null
* @return string
*/
function getOptionsAsCacheKey( $depth = null ) {
$key = "";
@ -214,10 +302,16 @@ class CategoryTree {
$key .= $k . ':' . $v . ';';
}
if ( !is_null( $depth ) ) $key .= ";depth=" . $depth;
if ( !is_null( $depth ) ) {
$key .= ";depth=" . $depth;
}
return $key;
}
/**
* @param $depthnull
* @return mixed
*/
function getOptionsAsJsStructure( $depth = null ) {
if ( !is_null( $depth ) ) {
$opt = $this->mOptions;
@ -230,10 +324,17 @@ class CategoryTree {
return $s;
}
function getOptionsAsJsString( $depth = NULL ) {
/**
* @param $depth null
* @return String
*/
function getOptionsAsJsString( $depth = null ) {
return Xml::escapeJsString( $this->getOptionsAsJsStructure( $depth ) );
}
/**
* @return string
*/
function getOptionsAsUrlParameters() {
$u = '';
@ -246,9 +347,12 @@ class CategoryTree {
}
/**
* Ajax call. This is called by efCategoryTreeAjaxWrapper, which is used to
* load CategoryTreeFunctions.php on demand.
*/
* Ajax call. This is called by efCategoryTreeAjaxWrapper, which is used to
* load CategoryTreeFunctions.php on demand.
* @param $category
* @param $depth int
* @return AjaxResponse|bool
*/
function ajax( $category, $depth = 1 ) {
global $wgLang, $wgContLang, $wgRenderHashAppend;
$title = self::makeTitle( $category );
@ -266,7 +370,12 @@ class CategoryTree {
'page_title' => $dbkey,
), __METHOD__ );
$mckey = wfMemcKey( "categorytree(" . $this->getOptionsAsCacheKey( $depth ) . ")", $dbkey, $wgLang->getCode(), $wgContLang->getExtraHashOptions(), $wgRenderHashAppend );
$mckey = wfMemcKey(
"categorytree(" . $this->getOptionsAsCacheKey( $depth ) . ")",
$dbkey, $wgLang->getCode(),
$wgContLang->getExtraHashOptions(),
$wgRenderHashAppend
);
$response = new AjaxResponse();
@ -368,9 +477,11 @@ class CategoryTree {
}
/**
* Returns a string with an HTML representation of the children of the given category.
* @param $title Title
*/
* Returns a string with an HTML representation of the children of the given category.
* @param $title Title
* @param $depth int
* @return string
*/
function renderChildren( $title, $depth = 1 ) {
global $wgCategoryTreeMaxChildren, $wgCategoryTreeUseCategoryTable;
@ -459,9 +570,10 @@ class CategoryTree {
}
/**
* Returns a string with an HTML representation of the parents of the given category.
* @var $title Title
*/
* Returns a string with an HTML representation of the parents of the given category.
* @param $title Title
* @return string
*/
function renderParents( $title ) {
global $wgCategoryTreeMaxChildren;
@ -513,9 +625,12 @@ class CategoryTree {
}
/**
* Returns a string with a HTML represenation of the given page.
* $title must be a Title object
*/
* Returns a string with a HTML represenation of the given page.
* @param $title Title
* @param int $children
* @param bool $loadchildren
* @return string
*/
function renderNode( $title, $children = 0, $loadchildren = false ) {
global $wgCategoryTreeUseCategoryTable;
@ -529,9 +644,14 @@ class CategoryTree {
}
/**
* Returns a string with a HTML represenation of the given page.
* $info must be an associative array, containing at least a Title object under the 'title' key.
*/
* Returns a string with a HTML represenation of the given page.
* $info must be an associative array, containing at least a Title object under the 'title' key.
* @param $title Title
* @param $cat Category
* @param $children int
* @param $loadchildren bool
* @return string
*/
function renderNodeInfo( $title, $cat, $children = 0, $loadchildren = false ) {
static $uniq = 0;
@ -739,8 +859,10 @@ class CategoryTree {
}
/**
* Creates a Title object from a user provided (and thus unsafe) string
*/
* Creates a Title object from a user provided (and thus unsafe) string
* @param $title string
* @return null|Title
*/
static function makeTitle( $title ) {
$title = trim( $title );

View file

@ -19,13 +19,14 @@ class CategoryTreePage extends SpecialPage {
var $target = '';
var $tree = null;
/**
* Constructor
*/
function __construct() {
parent::__construct( 'CategoryTree', '', true );
}
/**
* @param $name
* @return mixed
*/
function getOption( $name ) {
global $wgCategoryTreeDefaultOptions;
@ -38,15 +39,18 @@ class CategoryTreePage extends SpecialPage {
/**
* Main execution function
* @param $par Parameters passed to the page
* @param $par array Parameters passed to the page
*/
function execute( $par ) {
global $wgRequest, $wgOut, $wgCategoryTreeDefaultOptions, $wgCategoryTreeSpecialPageOptions, $wgCategoryTreeForceHeaders;
global $wgCategoryTreeDefaultOptions, $wgCategoryTreeSpecialPageOptions, $wgCategoryTreeForceHeaders;
$this->setHeaders();
if ( $par ) $this->target = $par;
else $this->target = $wgRequest->getVal( 'target', wfMsg( 'rootcategory' ) );
$request = $this->getRequest();
if ( $par ) {
$this->target = $par;
} else {
$this->target = $request->getVal( 'target', wfMsg( 'rootcategory' ) );
}
$this->target = trim( $this->target );
@ -59,46 +63,49 @@ class CategoryTreePage extends SpecialPage {
# grab all known options from the request. Normalization is done by the CategoryTree class
foreach ( $wgCategoryTreeDefaultOptions as $option => $default ) {
if ( isset( $wgCategoryTreeSpecialPageOptions[$option] ) )
if ( isset( $wgCategoryTreeSpecialPageOptions[$option] ) ) {
$default = $wgCategoryTreeSpecialPageOptions[$option];
}
$options[$option] = $wgRequest->getVal( $option, $default );
$options[$option] = $request->getVal( $option, $default );
}
$this->tree = new CategoryTree( $options );
$wgOut->addWikiMsg( 'categorytree-header' );
$output = $this->getOutput();
$output->addWikiMsg( 'categorytree-header' );
$this->executeInputForm();
if ( $this->target !== '' && $this->target !== null ) {
if ( !$wgCategoryTreeForceHeaders ) CategoryTree::setHeaders( $wgOut );
if ( !$wgCategoryTreeForceHeaders ) {
CategoryTree::setHeaders( $output );
}
$title = CategoryTree::makeTitle( $this->target );
if ( $title && $title->getArticleID() ) {
$wgOut->addHTML( Xml::openElement( 'div', array( 'class' => 'CategoryTreeParents' ) ) );
$wgOut->addHTML( wfMsgExt( 'categorytree-parents', 'parseinline' ) );
$wgOut->addHTML( wfMsg( 'colon-separator' ) );
$output->addHTML( Xml::openElement( 'div', array( 'class' => 'CategoryTreeParents' ) ) );
$output->addHTML( wfMsgExt( 'categorytree-parents', 'parseinline' ) );
$output->addHTML( wfMsg( 'colon-separator' ) );
$parents = $this->tree->renderParents( $title );
if ( $parents == '' ) {
$wgOut->addHTML( wfMsgExt( 'categorytree-no-parent-categories', 'parseinline' ) );
$output->addHTML( wfMsgExt( 'categorytree-no-parent-categories', 'parseinline' ) );
} else {
$wgOut->addHTML( $parents );
$output->addHTML( $parents );
}
$wgOut->addHTML( Xml::closeElement( 'div' ) );
$output->addHTML( Xml::closeElement( 'div' ) );
$wgOut->addHTML( Xml::openElement( 'div', array( 'class' => 'CategoryTreeResult' ) ) );
$wgOut->addHTML( $this->tree->renderNode( $title, 1 ) );
$wgOut->addHTML( Xml::closeElement( 'div' ) );
}
else {
$wgOut->addHTML( Xml::openElement( 'div', array( 'class' => 'CategoryTreeNotice' ) ) );
$wgOut->addHTML( wfMsgExt( 'categorytree-not-found', 'parseinline' , $this->target ) );
$wgOut->addHTML( Xml::closeElement( 'div' ) );
$output->addHTML( Xml::openElement( 'div', array( 'class' => 'CategoryTreeResult' ) ) );
$output->addHTML( $this->tree->renderNode( $title, 1 ) );
$output->addHTML( Xml::closeElement( 'div' ) );
} else {
$output->addHTML( Xml::openElement( 'div', array( 'class' => 'CategoryTreeNotice' ) ) );
$output->addHTML( wfMsgExt( 'categorytree-not-found', 'parseinline' , $this->target ) );
$output->addHTML( Xml::closeElement( 'div' ) );
}
}
}
@ -107,22 +114,23 @@ class CategoryTreePage extends SpecialPage {
* Input form for entering a category
*/
function executeInputForm() {
global $wgScript, $wgOut;
global $wgScript;
$thisTitle = SpecialPage::getTitleFor( $this->getName() );
$mode = $this->getOption( 'mode' );
$wgOut->addHTML( Xml::openElement( 'form', array( 'name' => 'categorytree', 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-categorytree-form' ) ) );
$wgOut->addHTML( Xml::openElement( 'fieldset' ) );
$wgOut->addHTML( Xml::element( 'legend', null, wfMsgNoTrans( 'categorytree-legend' ) ) );
$wgOut->addHTML( Html::Hidden( 'title', $thisTitle->getPrefixedDbKey() ) );
$wgOut->addHTML( Xml::inputLabel( wfMsgNoTrans( 'categorytree-category' ), 'target', 'target', 20, $this->target ) . ' ' );
$wgOut->addHTML( Xml::openElement( 'select', array( 'name' => 'mode' ) ) );
$wgOut->addHTML( Xml::option( wfMsgNoTrans( 'categorytree-mode-categories' ), 'categories', $mode == CT_MODE_CATEGORIES ? true : false ) );
$wgOut->addHTML( Xml::option( wfMsgNoTrans( 'categorytree-mode-pages' ), 'pages', $mode == CT_MODE_PAGES ? true : false ) );
$wgOut->addHTML( Xml::option( wfMsgNoTrans( 'categorytree-mode-all' ), 'all', $mode == CT_MODE_ALL ? true : false ) );
$wgOut->addHTML( Xml::closeElement( 'select' ) . ' ' );
$wgOut->addHTML( Xml::submitButton( wfMsgNoTrans( 'categorytree-go' ), array( 'name' => 'dotree' ) ) );
$wgOut->addHTML( Xml::closeElement( 'fieldset' ) );
$wgOut->addHTML( Xml::closeElement( 'form' ) );
$output = $this->getOutput();
$output->addHTML( Xml::openElement( 'form', array( 'name' => 'categorytree', 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-categorytree-form' ) ) );
$output->addHTML( Xml::openElement( 'fieldset' ) );
$output->addHTML( Xml::element( 'legend', null, wfMsgNoTrans( 'categorytree-legend' ) ) );
$output->addHTML( Html::Hidden( 'title', $thisTitle->getPrefixedDbKey() ) );
$output->addHTML( Xml::inputLabel( wfMsgNoTrans( 'categorytree-category' ), 'target', 'target', 20, $this->target ) . ' ' );
$output->addHTML( Xml::openElement( 'select', array( 'name' => 'mode' ) ) );
$output->addHTML( Xml::option( wfMsgNoTrans( 'categorytree-mode-categories' ), 'categories', $mode == CT_MODE_CATEGORIES ) );
$output->addHTML( Xml::option( wfMsgNoTrans( 'categorytree-mode-pages' ), 'pages', $mode == CT_MODE_PAGES ) );
$output->addHTML( Xml::option( wfMsgNoTrans( 'categorytree-mode-all' ), 'all', $mode == CT_MODE_ALL ) );
$output->addHTML( Xml::closeElement( 'select' ) . ' ' );
$output->addHTML( Xml::submitButton( wfMsgNoTrans( 'categorytree-go' ), array( 'name' => 'dotree' ) ) );
$output->addHTML( Xml::closeElement( 'fieldset' ) );
$output->addHTML( Xml::closeElement( 'form' ) );
}
}