Commit graph

162 commits

Author SHA1 Message Date
Novem Linguae 82b5c422c2 CategoryTree: improve comment
Contrary to what this comment says, this extension is not all-AJAX.
If you disable JavaScript in the browser, the subcategory counts
still show, so it is about half JS, half PHP. The JS part is the little
triangle you can click to load the list of subpages.

Change-Id: Ib25a13c57656b832e079627301f45b94bbd7e814
2024-11-16 15:38:35 -08:00
Ebrahim Byagowi 845595cb8e Remove an outdated comment
No href will be added on the JS side either.

Change-Id: I4c78fef10c24a942db7e468106588b16012ab653
2024-11-05 14:48:02 +03:30
Ebrahim Byagowi 77b047b12b Remove page href from arrows
As having href causes arrows to be clickable before JavaScript
handler be loaded.

And since that disables visited logic, let's remove it.

Change-Id: Ice4c979d020342890fffd587bb5bee88fcc2a1ae
2024-11-05 13:06:36 +03:30
jenkins-bot cbde447eaf Merge "Remove unused parameter PPFrame $frame" 2024-11-04 17:47:02 +00:00
jenkins-bot 6f4d131768 Merge "Get mode from data-ct-options instead of data-ct-mode" 2024-11-04 15:20:58 +00:00
Fomafix 46defa6251 docs: Replace CategoryTreeFunctions.php by CategoryTree
In 8e51ea4e3a CategoryTreeFunctions.php
was renamed to includes/CategoryTree.php. The class name was already
CategoryTree.

Change-Id: I2734c92810df0f653ae1ea402a149e42e7be08cb
2024-11-04 14:26:13 +00:00
Fomafix a62550b687 Get mode from data-ct-options instead of data-ct-mode
The attribute data-ct-options already contains the mode and attribute
data-ct-mode is just redundant. The attribute data-ct-mode is now not
needed anymore and removed from the rendered HTML.

Change-Id: If261f3cdab6c55243e80dc2ef3caa884538b02bc
2024-11-04 12:08:22 +00:00
Fomafix 2b55cfe576 Add type hint for parserHook
On a self-closing tag the first parameter is null.

Change-Id: I7a8cee1cb517a5b565617cdf5e1b1aeeb03b8de1
2024-11-02 10:19:51 +00:00
Ammarpad a925bb10cd Fix handling of self-closing tag
self closing tag <categorytree/> is invalid, but where encountered
the content of the tag is null.

Convert the null to empty string since CategoryTree::getTag require one

Bug: T378765
Change-Id: Iede4499952295b75a19bd05a5963caab00a9cadd
2024-11-01 12:41:17 +01:00
Fomafix 23ddd8cfd1 Remove unused parameter PPFrame $frame
Change-Id: Ic014850a01fbf5820c2ad77d89ae98e1525dcb7b
2024-10-27 04:42:31 +00:00
Andre Klapper 63688178e9 Use explicit nullable type on parameter arguments (for PHP 8.4)
Implicitly marking parameter $... as nullable is deprecated in PHP
8.4. The explicit nullable type must be used instead.

Bug: T376276
Change-Id: I40bb7a0a02aaa467cbf0ae182adf5601ccbcb58e
2024-10-26 14:43:49 +02:00
Umherirrender 113ece0e54 Use namespaced PPFrame class
Change-Id: I5fff88a0c944cfbda33ffcab1bb6a01e5440a52a
2024-10-19 23:22:14 +02:00
jenkins-bot bcdc686cac Merge "Stay on mode=categories after the first submit with all namespaces" 2024-10-10 16:45:11 +00:00
jenkins-bot 9399909bf3 Merge "Trigger CategoryTree::setHeaders only if subcategories available" 2024-10-10 16:45:10 +00:00
jenkins-bot fbc82558e8 Merge "Remove duplicate/unnecessary trim" 2024-10-10 16:45:07 +00:00
jenkins-bot 4d2836760f Merge "Move all Parser handling to Hooks::parserHook" 2024-10-10 16:45:06 +00:00
jenkins-bot ee0a3f1aab Merge "Remove $allowMissing and make the check directly on the hook" 2024-10-10 16:01:18 +00:00
Fomafix 7f52cbc5b7 Stay on mode=categories after the first submit with all namespaces
After the first submit the URL contains &namespaces= with empty value.
This must be handled like a missing URL parameter.

Restore the default value '' removed in aec8d755.

Bug: T334289
Change-Id: I22d0eb334365472d411252f805d0d78a3cc265ab
2024-10-10 14:20:23 +00:00
jenkins-bot 7aaf9f42be Merge "Replace use of getDirMark with HTML markup" 2024-10-05 17:32:34 +00:00
Ebrahim Byagowi fcc3334125 Make category links arrow link to actual categories
I believe having arrows linked to the actual pages can
be much more useful than linking to '#' of the same
page. Linking to the correct page makes user to notice
if the page is already visited also using color of
the arrow.

If we didn't like link visited logic to be not used we
could've used a different link rather than color of links
and going makes us able to :visited logic of
If8b2b45b24351ee5c8fc9ee1380563f5d5b88678 also.

Personally however I'm in believe that having a useful
link that can be opened on a different tab using
Ctrl (or long click on phones) is always more useful.

Change-Id: Ib56fad0b711853d67b2d55617b36deff56141c74
2024-10-05 00:48:31 +03:30
Fomafix 092797b0e2 Remove duplicate/unnecessary trim
CategoryTree::makeTitle also makes a trim and an early return.

A trim on the return value of renderChildren() is not needed.

Change-Id: I1fc2705277491797eb6c0d0900152b63913ca875
2024-10-04 19:55:50 +00:00
Fomafix 921e6fe3f9 Move all Parser handling to Hooks::parserHook
Change-Id: I5d35c6d87b610ffb566588a3d0c75067c1d06962
2024-10-04 19:55:24 +00:00
Fomafix a918bdea16 Remove $allowMissing and make the check directly on the hook
This change avoids a super category expand button on not existing
categories.

This change even avoids loading the modules if there are no valid
categories.

Change-Id: I38a2b49aaef7cf46d9f89e1cc9fd65e2382155f5
2024-10-04 19:53:37 +00:00
Ebrahim Byagowi fe71840c56 Replace use of getDirMark with HTML markup
Bug: T375975
Depends-On: I2ee6d8fb9161a5434eacad819c6d7784aee8aac3
Change-Id: Ia1ab65222c486ea89e6b916fd1d5a6860439205e
2024-10-04 22:06:26 +03:30
Fomafix b1e3b5f06d Update namespaces of PHP classes
Change-Id: I8c4e81631b4c3f7321837e12713a8a33762a8fcc
2024-10-03 19:55:44 +00:00
jenkins-bot b0d8410812 Merge "Use IConnectionProvider instead of ILoadBalancer" 2024-09-10 16:41:38 +00:00
Fomafix 58afeaf93c Use IConnectionProvider instead of ILoadBalancer
Change-Id: Id1071e0a61030c2ddd01fecebf6bf8a99c5948e0
2024-09-04 13:28:31 +00:00
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 42e31c3054 Use MainConfigNames
Change-Id: I81eb011f303dbaacc30ee3d8ac27c4a7bf10615a
2024-08-20 20:14:05 +00:00
Fomafix 8fe224cd60 Use PHP types
* Add PHP type hints where possible.
* Remove @var, @param and @return if redundant to type declaration
* Remove redundant type conversions which are now enforced by type
  hints.
* Enforce that decodeBoolean returns only a bool.

Change-Id: I8da84ed4dc778dd9d84f8d9eec0a399f5ed26405
2024-08-20 08:16:37 +00:00
Umherirrender 3e2ce8c6f4 Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: I51931c3aab6aa1e5bc77b3cc83b8014cf557ff75
2024-06-08 23:29:21 +02:00
jenkins-bot b42252b37b Merge "Show a deprecation warning if parameter onlyroot is used" 2024-06-03 16:25:59 +00:00
Fomafix e6c9eab90f Use namespaced PHP classes
These namespaces are available since MediaWiki 1.42 which is already
required in extension.json.

Change-Id: If72d77a5440516beeac637b4baf06e9b4c672e8a
2024-05-22 20:11:23 +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
Umherirrender d8f77953a1 Migrate to IReadableDatabase::newSelectQueryBuilder
RIGHT JOIN is unsupported by SelectQueryBuilder, swapped to LEFT JOIN

Bug: T312395
Change-Id: Idd646422dc6c984d7ceab23743e53e64bccb987c
2024-04-25 20:21:57 +02:00
Fomafix 40f3638412 Trigger CategoryTree::setHeaders only if subcategories available
This avoids loading the modules if they are not needed.
Multiple calls of CategoryTree::setHeaders doesn't matter.

Change-Id: I96f8ffa7cf1d5274a6853403c0f2422b684db61f
2024-04-08 18:43:19 +00:00
libraryupgrader b779ae7026 build: Updating dependencies
composer:
* mediawiki/mediawiki-phan-config: 0.12.1 → 0.14.0

npm:
* grunt-banana-checker: 0.11.0 → 0.11.1

Change-Id: Ib661c3c07825d151bb817a219f3104afbf30ec4b
2024-02-10 10:23:34 +00:00
jenkins-bot b63356e087 Merge "Make the toggle reachable by keyboard" 2024-02-07 14:38:32 +00:00
Nardog 08a23b5c26 Make the toggle reachable by keyboard
Bug: T355636
Change-Id: Ie765cddd664933fa07638c661874bef80782dd45
2024-02-05 06:53:05 +00:00
Umherirrender 1f16baa471 Add return type hint to function in ServiceWiring.php
This is a common pattern for service wiring functions

Change-Id: Ia63bd9a5397b0ea4563f5bb426ed925fc0c40efc
2024-01-31 20:55:00 +01:00
Fomafix 9206c5368b Inject service DBLoadBalancerFactory
Change-Id: I50195f98c2ea130f9dba73e357977653c2fc1a37
2023-11-14 13:40:30 -05:00
Fomafix c63d5da014 Replace global variables by injected Config
Convert some functions to non-static function to access the Config
object.

Change-Id: Iac3d6a6c00eef169aec91b8c367cbbb7359a9b02
2023-11-14 07:15:35 +00:00
Fomafix e492044e44 Inject service LinkRenderer into CategoryTree
Change-Id: Id70e9b26229332889de009b55837dbab6ecbb163
2023-10-29 09:28:03 +00:00
Fomafix e81f6fe15e Move option handling from CategorieTree into new class OptionManager
Change-Id: I0327f7ea6751cdb714308f1ffaf0ab7ac44a3aac
2023-10-29 09:26:56 +00:00
Fomafix 292f21fc38 Get parameters from config instead of global variable in getDataForJs()
Change-Id: Ie01fa1181f6c0878686f056e0a70f89766c090e6
2023-10-05 09:56:03 +00:00
Fomafix 75c2c5580a Simplify PHP code
Change-Id: Ia1bd08cd972b2f5792d24d5fbc383c3c63b000db
2023-10-03 19:38:03 +00:00
Fomafix 8bd82c12f6 Use namespaced classes
Change-Id: I9fabf791aae691dfa7d071a1d99d17f4f7379682
2023-10-03 09:36:31 +00:00
Fomafix b2ef67d9c8 Replace deprecated wfGetDB( DB_REPLICA )
Bug: T330641
Change-Id: Ic2dc694bbb29c3ff315f2be32c24ee6995f9b964
2023-09-20 20:42:06 +00:00