Last modified: 2014-01-10 07:42:14 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T29796, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 27796 - automatically open category tree to have selected categories visible
automatically open category tree to have selected categories visible
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
SelectCategory (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Leon Weber
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-02-28 21:22 UTC by Christian Boltz
Modified: 2014-01-10 07:42 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Christian Boltz 2011-02-28 21:22:49 UTC
I'm using SelectCategory 0.8.

By default the category tree is collapsed (at least until you apply my patch from 27795 to fix $wgSelectCategoryMaxLevel ;-)

I'd like to have an additional config option ($wgSelectCategoryOpenSelected ?) that automatically opens all parts of the tree that contain a selected category.

For example, I an article belongs to the category "dog", the tree should be displayed like this:

- animals
  - pets
    - dog   <--- selected category
    - cat
  + wild

I'm not providing a patch this time ;-) but I'll give you some implementation hints:

The current code won't work :-( because you can't go upwards in the tree and mark an item as open, which is something you need to do to implement this.

A working variant is probably to have a nested array like (re-using my example categories from above)

$category_tree = array(
  'animals' => array ( 0, 1, array(
      'dog'     => array ( 1, 0 ),
      'cat'     => array ( 0, 0 ),
  ),
  'wild     => array ( 0, 0, array (
      # ...
  )
)

The included arrays have the following structure: (example: 'animals')
- selected?
- open in tree by default?
- array with sub-categories - if no sub-categories exist, you can
  - leave out this part (as in my example)
  - use an empty array()

You can also use named array keys, for example
  'animals' => array ( selected => 0, open => 1, subcategories => array(...) ),

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links