~ubuntu-branches/ubuntu/saucy/mediawiki-extensions/saucy

« back to all changes in this revision

Viewing changes to dist/mediawiki-extensions-base/usr/share/mediawiki-extensions/base/CategoryTree/CategoryPageSubclass.php

  • Committer: Bazaar Package Importer
  • Author(s): Romain Beauxis
  • Date: 2010-05-04 15:13:35 UTC
  • mfrom: (0.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20100504151335-54qeucg3ec108q28
Tags: 2.2
* Added Replaces:/Conflicts: to allow a proper upgrade.
Closes: #580066
* Fixed package descriptions.
Closes: #579667
* Patched mediawiki-extensions-fckeditor to make it work with
  php 5.3. The fix may not be perfect but at least it work.
  Not closing the bug (#579822) for now..

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
class CategoryTreeCategoryPage extends CategoryPage {
 
4
        function closeShowCategory() {
 
5
                global $wgOut, $wgRequest;
 
6
                $from = $wgRequest->getVal( 'from' );
 
7
                $until = $wgRequest->getVal( 'until' );
 
8
 
 
9
                $viewer = new CategoryTreeCategoryViewer( $this->mTitle, $from, $until );
 
10
                $wgOut->addHTML( $viewer->getHTML() );
 
11
        }
 
12
}
 
13
 
 
14
class CategoryTreeCategoryViewer extends CategoryViewer {
 
15
        var $child_cats;
 
16
 
 
17
        function getCategoryTree() {
 
18
                global $wgOut, $wgCategoryTreeCategoryPageOptions, $wgCategoryTreeForceHeaders;
 
19
 
 
20
                if ( ! isset($this->categorytree) ) {
 
21
                        if ( !$wgCategoryTreeForceHeaders ) CategoryTree::setHeaders( $wgOut );
 
22
 
 
23
                        $this->categorytree = new CategoryTree( $wgCategoryTreeCategoryPageOptions );
 
24
                }
 
25
 
 
26
                return $this->categorytree;
 
27
        }
 
28
 
 
29
        /**
 
30
         * Add a subcategory to the internal lists
 
31
         */
 
32
        function addSubcategoryObject( $cat, $sortkey, $pageLength ) {
 
33
                global $wgContLang, $wgOut, $wgRequest;
 
34
 
 
35
                $title = $cat->getTitle();
 
36
 
 
37
                if ( $wgRequest->getCheck( 'notree' ) ) {
 
38
                        return parent::addSubcategoryObject( $cat, $sortkey, $pageLength );
 
39
                }
 
40
 
 
41
                /*if ( ! $GLOBALS['wgCategoryTreeUnifiedView'] ) {
 
42
                        $this->child_cats[] = $cat;
 
43
                        return parent::addSubcategory( $cat, $sortkey, $pageLength );
 
44
                }*/
 
45
 
 
46
                $tree = $this->getCategoryTree();
 
47
 
 
48
                $this->children[] = $tree->renderNodeInfo( $title, $cat );
 
49
 
 
50
                $this->children_start_char[] = $this->getSubcategorySortChar( $title, $sortkey );
 
51
        }
 
52
 
 
53
        function clearCategoryState() {
 
54
                $this->child_cats = array();
 
55
                parent::clearCategoryState();
 
56
        }
 
57
 
 
58
        function finaliseCategoryState() {
 
59
                if( $this->flip ) {
 
60
                        $this->child_cats = array_reverse( $this->child_cats );
 
61
                }
 
62
                parent::finaliseCategoryState();
 
63
        }
 
64
}