Commit graph

48 commits

Author SHA1 Message Date
Ebrahim Byagowi 451aeceba1 Use Codex provided arrow icons for the tree
It also adds an animation for the arrow matching other
recently Codex provided arrow icons adopted animations.

Change-Id: If8b2b45b24351ee5c8fc9ee1380563f5d5b88678
2024-10-05 00:07:05 +03:30
Fomafix f5f1f7de39 Use new hook OutputPageRenderCategoryLink
The new hook OutputPageRenderCategoryLink gets triggered on rendering a
single category.

This change prevents wgCategories = [] on
$wgCategoryTreeHijackPageCategories = true.

Bug: T372155
Depends-On: Id82a77a57d1f12233d974ea4c1b093f50c5ab74f
Change-Id: Ic86f210474cbc0e2dcebf664cf2309a4a4408f60
2024-09-03 09:50:34 +00:00
Fomafix 033b9cc159 Use namespaced FormatJson class
This change requires MediaWiki 1.43+.

Change-Id: I5a9a0eb10372b6464985e5a9cd564ff12536fea1
2024-08-22 12:53:23 +00:00
Fomafix 6b65422769 ApiCategoryTree: Use config from $this->getConfig().
An injection of ConfigFactory/Config and the ConfigRegistry are not
needed anymore.

Change-Id: Ie20675981a019fe300cf84e7a16a191c0431b922
2024-08-21 18:09:26 +00:00
Fomafix 15a2d717d5 Show a deprecation warning if parameter onlyroot is used
The parameter onlyroot is deprecated since July 2008.

Generate a tracking category for tracking the deprecation.

Bug: T290062
Change-Id: I8eb58fa7831e11e6a6719f11fb1ff310666cdc4e
2024-05-20 07:49:47 +00:00
Nardog 08a23b5c26 Make the toggle reachable by keyboard
Bug: T355636
Change-Id: Ie765cddd664933fa07638c661874bef80782dd45
2024-02-05 06:53:05 +00:00
James D. Forrester cd0ba12a4e build: Update MediaWiki requirement to 1.42
All extensions in the MediaWiki tarball are expected to track MediaWiki's release directly.

Change-Id: Idb9eb167209705e7e0cfa44b3cbd3d10fc47b1ba
2024-01-12 14:09:42 -05:00
James D. Forrester b1d51b002e extension.json: Drop RL targets definitions, no longer honoured
Bug: T328497
Change-Id: I7b9d3953fb17b809ac60068ff5676a6d7c0fef98
2024-01-12 08:40:57 -05:00
Fomafix 9206c5368b Inject service DBLoadBalancerFactory
Change-Id: I50195f98c2ea130f9dba73e357977653c2fc1a37
2023-11-14 13:40:30 -05:00
Fomafix e492044e44 Inject service LinkRenderer into CategoryTree
Change-Id: Id70e9b26229332889de009b55837dbab6ecbb163
2023-10-29 09:28:03 +00:00
Fomafix b2ef67d9c8 Replace deprecated wfGetDB( DB_REPLICA )
Bug: T330641
Change-Id: Ic2dc694bbb29c3ff315f2be32c24ee6995f9b964
2023-09-20 20:42:06 +00:00
James D. Forrester 4f258b0a23 build: Update MediaWiki requirement to 1.41
All extensions in the MediaWiki tarball are expected to track MediaWiki's release directly.

Change-Id: I1aaadf75d80b964f4ccad5951aa3180c973dfccf
2023-08-19 13:07:27 +08:00
gerritbot 0cf8b3dfe5 Update moved class Category
See T321882. Moved in I0b86acfdea

Bug: T321681
Change-Id: If48e9163bcfcfe03098f61b7cc52137e4ecaae82
2023-05-12 14:33:05 +00:00
Umherirrender 6e911fba75 Replace CategoryTreeCategoryViewer with hooks of CategoryViewer
Change-Id: I34a47c4f2f4b08cd3ed8ce5c4a585cc42d44372d
2023-02-28 23:20:56 +01:00
Fomafix c1edee1aea Remove flag for ParserOutput
The modules are already in the ParserOutput by change
I8d2a6d92f45f30495263eea716adb4eeaf7ebfbb.
The hack with the flag for the OutputPageParserOutput hook is not
needed anymore.

Do not deploy this change before the caches has been purged or expired.

Bug: T212059
Change-Id: If9427bbf114870ec9747670367915e11750c6525
2023-02-10 12:14:26 +00:00
Umherirrender 9d98cc1ae6 Add a CategoryCache service for use on Special:TrackingCategories
Replace the dynamic property on SpecialTrackingCategories object,
this was used to store preloaded Category objects.
Dynamic properties are deprecated in php8.2
The preload and storage is now done with the service.

Adjust doc to LinkTarget (Id0cc2ca)

Bug: T324897
Change-Id: I891ad79bc357d32585ef4d9206d398c5a75222aa
2023-01-13 23:05:36 +01:00
Ammarpad de9a92c7a3 CategoryTree: Use Category::getMemberCount from core
Core now provides all-member count separately with type guarantee.

Also bump core requirement to >= 1.38.0

Change-Id: I2b489e690ad05462a553e424bd9495593a8d2b1b
2022-02-21 23:15:47 +01:00
Fomafix 4a3f1aadc5 ApiCategoryTree: Inject services
Change-Id: Id22dbb344307322247c75cde6cf56cccdf012203
2021-11-02 20:13:55 +00:00
Fomafix 57e7cd356b Remove configuation variable "CategoryTreeForceHeaders"
The configuration variable "CategoryTreeForceHeaders" allowed to force
the loading of the modules on every page by the hooks
"BeforePageDisplay" and "BeforePageDisplayMobile".

This is not needed anymore because the modules are now already loaded
if the category tree is used some on the other hooks.

Change-Id: I9fde894977463ecd1c4b07da449d98c39b3665ea
2021-08-30 07:05:05 +00:00
Fomafix 107d03af53 Remove @noflip workaround for T288943
This change requires CSSJanus version 2.0.0 included in core by
I0528443e4eae0338f5a37491352db03944c6bd4c since MediaWiki 1.37.

Bug: T288943
Depends-On: I0528443e4eae0338f5a37491352db03944c6bd4c
Change-Id: I38c08b2073e10e7d56b286b1ae75b400578ce2dd
2021-08-21 14:53:53 +00:00
Fomafix 0bfff67aac Move bullets from HTML to CSS
This allows better to style the buttons.

The complicated CSS selector for the direction supports a categorytree
in the user interface language like in the sidebar or on
Special:CategoryTree and in the content language like on category pages
and with <categorytree> in the content.

The CSS selector :dir( rtl ) would be a short version for this but it is
currently only supported by Firefox:
https://developer.mozilla.org/en-US/docs/Web/CSS/:dir

Bug: T288910
Change-Id: Ibfb0cb28f0086fb1b7d0997be2246bc120eea85e
2021-08-21 14:50:15 +00:00
daniel 734e2af35c Put onMediaWikiServices into a separate handler class.
The MediaWikiServices hook runs before the service container is fully initialized, so it cannot have services injected. For this reason, it needs to be separate from the handlers for other hooks.

Change-Id: I1519aea8bca2f3977fcf15ee8776a1b3319687b5
2021-06-24 15:17:34 +00:00
jdlrobson 46d2de89da Restore category link to sidebar
Bug: T272705
Change-Id: I2911562a902aab82783d696282bbbdd2a287e962
2021-06-15 11:55:22 -07:00
daniel ece310d7be Re-apply: Convert to new hook system (Workshop)
This converts the CategtoryTree extension to the new (MW1.35) hook system.
The patch was written live during a hackathon workshop.
A recording of the workshop is available at
<https://www.youtube.com/watch?v=ZOj44Rbh0tM&t>.

Re-applying after fixing: premature access to $wgRequest
Restores change: Ie52c393af378a980a2dac4ae7076fd6c016a8e0e
Reverts revert: Ieee300c7b35b7069bd7e781610c915f2ecae1bf1

NOTE: the "mode" parameter for category pages seems to be broken,
as the mode is not proeprly propoagated to dynamic requests.
This was already the case before this change, and this change
does not try to fix that issue. I was tempted to just remove
the feature entirely, but T137812 inidcates that it may be useful to
some. I will comment there to see if this should be fiexed or removed.

Bug: T282110
Bug: T271011
Change-Id: Ic3ee05e9dc382f4ada5cfeb9ff5d9a69249cc60d
2021-06-11 11:20:38 +02:00
Reedy 03685efdba Namespace extension
Change-Id: Idf4fbb9ff0c11b9da0b48b3843b2c87c155a4c36
2021-04-08 01:28:21 +01:00
Umherirrender bf876f5c19 Inject services into SpecialCategoryTree
Bug: T259960
Change-Id: Ie2a3156f1be52074f28b24507815aef7a746f083
2021-03-12 21:34:50 +01:00
Reedy d386dd7fdb Remove _merge_strategy from value
Change-Id: I7845b86671fc200314dab87d8bf1baa11aacc6bc
2020-05-12 18:49:38 +01:00
Reedy d55891c0bb Convert to manifest_version 2
Bug: T252470
Change-Id: I91747d0df49ab217e120f642b16b086001dfcd40
2020-05-12 00:33:41 +00:00
Pppery bc24f21c9d Fix merge strategy for $wgCategoryTreeMaxDepth
Bug: T240623
Change-Id: I1db6d8d5ecf3b720971f9ea4459366a0439c6bb4
2019-12-16 17:55:58 -05:00
Derick Alangi 87ddb7f735 Suppress page translations and render only the default page(s)
This feature add an option `notranslations` that allows the category
tree only to show the default pages and not include their translations
equivalents on the tree. For example let's say we have a page (Test_page)
that was created in a default language "en" in a category TestCat, and has
translations listed: Test_page/es, Test_page/de, Test_page/ar etc.

Doing `<categorytree notranslations="on">TestCat</categorytree> will render
only the Test_page page with it's link to the page on the tree and nothing
more.

Note: If page "Foo/hu" exist but "Foo" doesn't, it should include "Foo/hu"
      in the category tree. In most case though, a base page will exist.
      Also, the feature is only available if Extension:Translate is made
      available on that wiki.

TODO: If "notranslations" is used along side with "showcount", consider
      subtracting the number of pages suppressed from the total page count
      in the category tree for consistency.

Bug: T229265
Change-Id: Ib4e7ab6ad98c05857cda1cd98bbc19e0504677bb
2019-11-03 14:03:27 +01:00
Umherirrender e801fb1e3b Define visibility on class constant
Change-Id: I140d4cbf7bf1397138fef1f1396057fc19c1cbb2
2019-10-25 19:14:46 +02:00
Amir Aharoni 5723ae91d1 Split apihelp messages to a separate file
Bug: T189982
Change-Id: I915b0d5b0dc4232d8999c5fcf246274537503121
2019-05-11 11:05:07 +03:00
Timo Tijhof c839756b32 Remove 'wgCategoryTreePageCategoryOptions' export from pageview HTML
This was internal to CategoryTree JS code and only needed on very
few pages. Export it as part of the module that needs it, instead.

Given this is computed and not a plain config var, use callback
to generate the value.

Bug: T219342
Change-Id: I790a98128b0a3317e27ac0d5fda08d48aeb640dc
2019-04-05 11:31:03 -07:00
Max Semenik 60884c60e7 Stop manually messing with caching HTTP headers
It has origins in times when this code was in an AJAX function, however
now that it's in an API module it's not needed and can be counter-productive
as headers issued might conflict with MW headers. Let the API take care of
this via its standard means.

Change-Id: I8ebf8e7b935d7d252ac010bc1b88202b87f43e20
2019-03-05 20:55:22 +00:00
Fomafix 99cef2da9b Remove deprecated module 'ext.categoryTree.css'
The module 'ext.categoryTree.css' was renamed to
'ext.categoryTree.styles' in 3cdb4e95f2.

The caches should now be expired.

Change-Id: I4e2e96c088c47e7e3dfa801c56847dc48d68ee4e
2019-02-06 18:44:52 +01:00
Fomafix e31ac9cc84 Use hook SkinBuildSidebar instead of SkinTemplateOutputPageBeforeExec
This change allows the skin to customize if there is a sidebar or not.
For example the SkinApi overloads buildSidebar and therefor the hook
SkinBuildSidebar is not triggered.

Change-Id: Ib39736901f25822d40265ccaa5fd0feea977cdc1
2019-01-22 23:15:07 +00:00
Fomafix 095040a9e6 Remove hook SkinJoinCategoryLinks
The hook `SkinJoinCategoryLinks` is not used and not triggered.

Also remove the style for the class CategoryTreeCategoryBarItem because
it is only used in skinJoinCategoryLinks::skinJoinCategoryLinks.

Change-Id: I52e4f819ff195fc1fa8a148b0bb58d95a4bf22d7
2019-01-10 20:15:28 +01:00
Fomafix 3cdb4e95f2 Move styles that only used in JavaScript to JavaScript module
Also rename the style module from 'ext.categoryTree.css' to
'ext.categoryTree.styles'.
Keep the previous module name 'ext.categoryTree.css' for compability to
cached versions.
Also move the files of the module 'ext.categoryTree' into a
subdirectory ext.categoryTree.

Change-Id: Ie5ea28acfb43e33a94ec5824baf4f26d63d8e9e6
2019-01-10 13:38:58 +01:00
James D. Forrester 96b44610ac API: Drop back-compat. code for old versions of MW we don't support
Change-Id: I1eb8f75399a6cd10a685ede98673cc6122494980
2018-10-26 18:02:44 +00:00
Kunal Mehta d85ca412b7 Don't conditionally register any hooks
Register all hooks unconditionally in extension.json, and then in the
hook
itself, check whether they should be doing anything.

Change-Id: I5f0019fc444371a24a11a25ca2d980c0a9ab5a61
2018-04-16 18:05:06 +00:00
Tulsi Bhagat 9e98b1c4a5 Removed deprecated position statements from resource loader module
Bug: T184257
Change-Id: Ib8c741b7eef50deb79ae2bc0d71c913077f95df7
2018-02-12 12:18:17 +00:00
Kunal Mehta 8e51ea4e3a Move classes into includes/
Change-Id: I308523aa764594798d72974fb79e19aef6c3f342
2018-02-08 22:23:07 -08:00
Kunal Mehta 525a4121ec Use SPDX 3.0 license identifier
SPDX released version 3 of their license list (<https://spdx.org/licenses/>),
which changed the FSF licenses to explicitly end in -only or -or-later
instead of relying on an easy to miss + symbol.

Bug: T183858
Change-Id: Ie7dda5637ce63abd241cfca73ee37b3d014d2efb
2018-01-04 02:52:36 -08:00
Dolfinus 23b2dd947f Add MobileFrontend support
Bug: T171767
Change-Id: I302876cd8fee451ad75e3e84a4d951edd324ff28
2017-12-18 21:09:08 +01:00
Umherirrender 1f1defc070 Split CategoryPageSubclass.php into two files
Makes MediaWiki.Files.OneClassPerFile.MultipleFound pass


Change-Id: Ic4d064272a5297e33b1edc090b807937cfb06545
2017-12-16 13:03:29 +01:00
Fomafix 5d0737d3b3 Add missing dependency on module 'mediawiki.api'
ext.categoryTree.js uses mw.Api.

Change-Id: If069cf500fcf8a93d561ad68b1aea57446cbf5b4
2017-06-27 14:54:54 +02:00
Umherirrender d8023fd6c0 Add category count to Special:TrackingCategories
Add the category count to the core special page
Special:TrackingCategories to see at one view, if such categories
contains pages which maybe needs attention.
Depends on a hook addition in core.

Depends On: If195fb55dee1350a6de095892ce89e6565287cd9
Change-Id: If3815586c2a280b4e8958c13010c9f7436b8723d
2016-11-22 21:42:55 +01:00
Sébastien Santoro 26affac7f8 Migrate to extension registration
We keep constants in CategoryTree.php extension loader to maintain
backwards compatibility with the MediaWiki configuration. It's expected
users will migrate from them when they switch to wfLoadExtension.

Bug: T87888
Change-Id: If67d0fe2ff758c7fd41386d04f5c0839c8c665a1
2016-08-06 00:52:47 +00:00