Commit graph

75 commits

Author SHA1 Message Date
Niklas Laxström
d89704bc4c Improve page display title handling for category pages
One use case of display title is to localise page names with Translate
extension or without. While the page title changes, the subheadings still
say something like "Pages in category Foo/de".

Also converted one raw HTML message to be a parsed message.

First version of this patch caused an issue when previewing
because page title in h1 is not the same as page display title.

This issue is fixed by promoting page display title as it's own member
in OutputPage. Also added getUnprefixedDisplayTitle that attempts to
strip away the namespace prefix to mimic Title::getText() but which
works with display title instead.

Bug: T43720
Bug: T46197
Change-Id: I6097a873297eb57759252fc56ad6d02c44e4c366
2018-09-10 08:29:48 +02:00
Aryeh Gregor
90d4f56fe4 Mass conversion of $wgContLang to service
Brought to you by vim macros.

Bug: T200246
Change-Id: I79e919f4553e3bd3eb714073fed7a43051b4fb2a
2018-08-11 22:44:29 -06:00
Fomafix
125cbd8c01 Use \u{00A0} instead of   or  
Directly use the UTF-8 encoding of the 'NO-BREAK SPACE' (U+00A0) instead of
the HTML/XML entities   or   or  .

With the UTF-8 character the generated HTML is shorter and better to read.

Also change the special value for the label in HTMLForm from   to
U+00A0 but also support   for backward compability.

Bug: T154300
Change-Id: I882599ac1120789bb4e524c4394870680caca4f4
2018-06-24 01:20:13 +00:00
Aaron Schulz
de75c4e63b Avoid triggering Category::refreshCounts() on HTTP GET requests
Trigger count refreshes more often during updates instead.

Change-Id: I0f4575e648109befb86a2c8f08b491a132fe56c3
2018-04-19 04:45:24 +00:00
Brian Wolff
0ea88136d8 Fix inconsistent i18n escaping in category paging links.
prev-page and next-page were being escaped when they were a
link, but not when they were plain text. They should be escaped
in both cases.

This issue was discovered with an experimental phan plugin I'm
working on.

Change-Id: I6caac76299b21a54cd7cb732ad93187e3d37c99e
2017-10-11 20:29:05 +00:00
Umherirrender
b5cddfb27b Remove empty lines at begin of function, if, foreach, switch
Organize phpcs.xml a bit

Change-Id: Ifb767729b481b4b686e6d6444cf48b1f580cc478
2017-07-01 11:34:16 +00:00
Aaron Schulz
52c3a50028 Fix bogus field reference in Category::getCountMessage() callback
Follows-up 922e68f739. (T162121)

Bug: T162941
Change-Id: I40623203e97f7155c2af171a37b1128a59415315
2017-04-19 21:25:37 -07:00
Aaron Schulz
922e68f739 Reduce contention during view-based category count refreshes
Bug: T162121
Change-Id: I05b539922508d5e73979ccc8ea1c148b16dd13db
2017-04-05 17:34:57 -07:00
Yuriy Shnitkovskiy
55667f024d Replaced all deprecated Linker methods with proper ones in core(1)
Change-Id: Ie3a718dc1eae1507f8829fcf419c64c6846d2cb6
2017-01-20 11:46:13 +02:00
divadsn
f90634a6a7 Fix wrong class name for ImageGalleryBase in comments
This change is part of change 329773.

Change-Id: I2766e2ff3e64a84f52a5d7fa065bbc38280866c1
2016-12-31 13:39:11 +00:00
Yuriy Shnitkovskiy
b0bd03fb13 Replace Linker::link() with LinkRenderer in includes directory
* CategoryViewer
* OutputPage
* Preferences

Bug: T149346
Change-Id: I9f9bcd9b461884817e8ceefbc6757c436221e331
2016-12-01 09:57:05 +02:00
jenkins-bot
7874fc4bec Merge "Revert "Use display name in category page subheadings if provided"" 2016-11-08 23:55:35 +00:00
Liuxinyu970226
59280c4c92 Revert "Use display name in category page subheadings if provided"
This reverts commit 8ccde89849.

For the reason, see T43720#2531092

Bug: T149510
Change-Id: Id1ace9599642a36b333c63eaeebab0537466e7bd
2016-11-08 22:50:56 +00:00
Kunal Mehta
8e5d90f13f Fix display of categories
Fixes regression from 1885a1ac46, which accidentally removed
page_namespace and page_title as select fields.

Bug: T146873
Change-Id: I19cff0cf5bc015da7311196749a9201a8e458b49
2016-09-28 02:17:49 -07:00
Aaron Schulz
1885a1ac46 Reduce queries in CategoryViewer via addGoodLinkObjFromRow()
Change-Id: Id782b50f166efbee6c9f8b9b263f09fc5fb5e3f2
2016-09-22 19:53:58 -07:00
Aaron Schulz
950cf6016c Rename DB_SLAVE constant to DB_REPLICA
This is more consistent with LoadBalancer, modern, and inclusive
of master/master mysql, NDB cluster, and MariaDB galera cluster.

The old constant is an alias now.

Change-Id: I0b37299ecb439cc446ffbe8c341365d1eef45849
2016-09-05 22:55:53 -07:00
jenkins-bot
bbb705a0b1 Merge "Use display name in category page subheadings if provided" 2016-07-28 03:30:55 +00:00
Kaldari
3f9c5710c8 Improving some function documentation in CategoryViewer.php
Change-Id: Ic4ad35d95aa157db627ef9b213007691f465c260
2016-07-14 22:05:02 -07:00
Niklas Laxström
8ccde89849 Use display name in category page subheadings if provided
One use case of display title is to localise page names with Translate
extension or without. While the page title changes, the subheadings still
say something like "Pages in category Foo/de".

A display title is now used if provided. There is one questionable thing
what to do with namespaces and display title. In this case I think it is
better to have the namespace prefix displayed (or not) according to what
the site admin wants, because we cannot safely strip the namespace prefix
from display title.

By using the page title from OutputPage, we already get a name which is
safe for HTML with no further processing. The name is passed as a raw
parameter which breaks magic words (if any) trying to access the value.
It is easy to fix this by using FULLPAGENAME magic word instead.

Also converted one raw HTML message to be a parsed message.

Bug: T43720
Change-Id: Ide7d4a9ee5c76b6360b53aefd76a2e17a139173f
2016-06-08 22:20:48 +00:00
Ed Sanders
2fa533bfad Add class to div wrapper around category lists
Allows VE to target non-editable content to keep on the page.

Change-Id: If687b84d9ad33a0315a8ba4260bc3532691f05ed
2016-04-29 22:30:57 +01:00
Bartosz Dziewoński
ce5a36ab59 CategoryViewer: Do opportunistic category recounts for mismatched file counts, too
There are some categories on Commons that have no files, but are
recorded to have some, e.g. [1] appears to have 15 files [2]. We have
logic to fix these, but it wasn't being checked for file counts (only
pages and subcats).

[1] https://commons.wikimedia.org/wiki/Category:Police_of_Mexico,_D._F._vehicles
[2] https://commons.wikimedia.org/w/index.php?title=Category:Police_of_Mexico,_D._F._vehicles&action=info

Change-Id: If88fc15347eb592e957452884c2179d7c237bd2c
2016-02-29 23:05:32 +01:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Aaron Schulz
43118240b5 Move category refreshes to a deferred update
Bug: T92357
Change-Id: Ic0d53c0ca01195cc5dd1f5a28602b3d4403e9fa5
2015-12-29 20:22:54 -08:00
Vivek Ghaisas
9f5b6f5aeb Fix whitespace issues around parentheses
Fix issues found by MediaWiki.WhiteSpace.SpaceyParenthesis sniff.

Bug: T102617
Change-Id: Iec7f71e64081659fba373ec20d9d2006306a98f4
2015-06-16 22:14:02 +03:00
Tina Johnson
f0650d874c Change labels of paging links in Category page
Links 'next 200' and 'previous 200' don't always list 200 items.
Hence changed the labels to 'previous page' and 'next page'. Also,
added new messages for the same.

Bug: T59414
Change-Id: Id5c30e92227e863acdeb3cadc132200ef2bc48c8
2015-03-28 00:48:32 +05:30
Sumit Asthana
8d25d1b1ea CategoryView modified to use css columns
The categories on Category page were listed using table layout. This layout has
been changed to the responsive css column structure, which is 3 column wide
beyond 768px, otherwise shrinks to a single column.

break-inside is used which needs some consideration, see here:
http://css-tricks.com/almanac/properties/b/break-inside/

Bug: T55130
Change-Id: I437e6079b20e110047f93fb5c09aae40189f1ec0
2015-02-23 16:54:24 +00:00
Erik Bernhardson
8bf4496869 Allow override of page disply within CategoryViewer
Patch adds two hook which are described in hooks.txt.  This
is being used to allow Flow to offer two links instead of just
one that are relevant to the page that was categorized.

The default output without these hooks is:

   <a href="...">Topic:Soiasdf90f09</a>

This patch allows flow to provide context as to where this topic came
from, by replacing that with:

   <a href="...">Topic:Soiasdf90f09</a> on <a href="...">Talk:Help</a>

(Note that the names of pages within the Topic namespace will also
become more friendly soonish, but outside the scope of this patch).

Bug: T87793
Related-Flow-Change: Ia4f2953bcd807ba3990e762a2efcaab428c40147
Change-Id: I182e6e35fcc3a2a298e928e088579bdb22e145ff
2015-02-20 13:46:48 +01:00
Jackmcbarn
98cdb56c72 Properly escape the messages in CategoryViewer.php
This mostly reverts commit 8fe8035da2,
and redoes it without escaping the parser output.

Change-Id: I87da10e63b55c1a6c83dd497e30f65ad224e052b
2015-02-05 16:38:51 -05:00
Scimonster
8fe8035da2 Escape unsafe messages in CategoryViewer.php
Bug: T85864
GCI: http://www.google-melange.com/gci/task/view/google/gci2014/5811264311787520
Change-Id: Ie59fb389b804f031b761f93f2c91a548742326ab
2015-01-11 18:04:41 +01:00
Aaron Schulz
6921770414 Updated some try-catch statements: MWException -> Exception
Change-Id: I76601a86e30f4984e3b1a8c8ec5ef5a0f652433a
2015-01-09 17:20:22 -08:00
Chad Horohoe
aa21e125a3 Remove obvious function-level profiling
Xhprof generates this data now. Custom profiling of various
sub-function units are kept.

Calls to profiler represented about 3% of page execution
time on Special:BlankPage (1.5% in/out); after this change
it's down to about 0.98% of page execution time.

Change-Id: Id9a1dc9d8f80bbd52e42226b724a1e1213d07af7
2015-01-07 11:14:24 -08:00
Fomafix
3055160858 Use getHtmlCode() instead of getCode() to set the lang attribute
The lang attribute of HTML elements should conform to BCP 47.

Bug: 72939
Change-Id: I9b4a734753af2c9dd7256eec60781553bc76edbf
2014-11-06 14:53:57 +00:00
Stephan Gambke
f09e458d39 Fix for Ia9baaf0b: Make previously public variables public again
Change Ia9baaf0b changed the visibility of member variables (many of which are not
otherwise exposed, e.g. by a method) and by that introduced a major API change
breaking extensions.

This patch explicitly marks affected variables as public again, keeping the intent
of the original patch of making phpcs-strict pass on includes/ directory.

Bug: 67522
Bug: 67984
Change-Id: I498512b2a1e615365bb477c1fd210aaa3241ca03
2014-08-29 23:01:53 +02:00
Alexandre Emsenhuber
1998e3ed02 Use Config instead of globals in CategoryViewer.php
Change-Id: If33619694f1cf298b356a1761e454e274fe6aa5c
2014-08-26 23:02:16 +02:00
umherirrender
a5ed2df445 Use config instead of globals for ImageGallery
Have to pass a context to the constructor to acutally use it for
settings.

Also adds a RequestContext::getMainAndWarn to get a default warning,
when using the main request, but it would be better to pass one.

Change-Id: I1628a1790c45d44aa4239701486b8b1b7c59a0e6
2014-08-22 22:36:59 +02:00
jenkins-bot
806dcb7257 Merge "Fix off-by-one error in the "previous 200" link in category listings with until=param" 2014-07-24 02:12:29 +00:00
umherirrender
53c420e278 Fixed spacing
- use tab as indent instead of spaces
- Added space after closures "function"
- Added spaces around string_concat
- Added newline inside empty blocks
- Removed four spaces after comma

Change-Id: I4425b0c6a69b36f40acfea6511b8950cf09ce2b2
2014-07-20 21:41:41 +02:00
Rohan
bb12d88536 Fix off-by-one error in the "previous 200" link in category listings
with until=param

When an until parameter is given i.e. going to a previous page, the
category page does the sql query in descending order. In that case,
the previous page link was given an until paramter that was one more
than the last needed result, since until= is interpreted as up-to but
not including, unlike from=, which is starting from and including.

Bug: 36964
Change-Id: I7eaf58d78136ac069a2d9122bca03f87863d2c0b
2014-07-17 13:13:22 +05:30
Aaron Schulz
e79535a582 Avoid begin/commit in Category::getCountMessage()
Change-Id: I64e4a859a9adf2930265e282f59816c82e1c3070
2014-06-24 18:07:55 -07:00
Siebrand Mazeland
a7fbdd6503 Make phpcs-strict pass on includes/ (7/7)
Change-Id: Ia9baaf0b3cdbe1a3c6b50ef8c4fe86fead88f909
2014-05-15 20:07:09 +02:00
umherirrender
23bb3d1cb4 Follow-Ups to "Fixed some @params documentation"
Fix of inline comments of the following patch sets:
Follow-Up: I0056b4a8df243cfc0c5f25378de48f7a35170aca
Follow-Up: I7f605aa9e117b5fd80d9b1440864fe526d2b14a5
Follow-Up: I3622f216a2ca8ac1b5e51892be9f98665f65bc36
Follow-Up: I6627ba0e76d3577c40bf2473e0f78a5ad7368634
Follow-Up: Id75b5ecf648ca50f955b3bde3307c82c4366b102
Follow-Up: I4ca5231119f33039d91da3b57a41cd40719a576b

Change-Id: Id9bbe84b2820e9db44af5783411e955f55f643d4
2014-04-23 13:39:49 +02:00
umherirrender
a3983418d5 Fixed some @params documentation (includes/*)
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.

Change-Id: I0056b4a8df243cfc0c5f25378de48f7a35170aca
2014-04-22 13:07:02 +02:00
umherirrender
725d9d125d Removed unneeded spaces and colons in @param and friends
Also swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.

Change-Id: Ic36c8c7820a6c2d603f1138130670c6bf6a1ca59
2014-04-08 16:02:49 +00:00
Siebrand Mazeland
7a635c5dfd Try to make a dent in CodeSniffer reports on includes/ (1)
Change-Id: Iaf3120b4e32cc5835ef9ed86236d98679e2b87fa
2014-03-23 01:29:41 +00:00
Siebrand Mazeland
52ba6500df Remove classes and functions deprecated in MediaWiki 1.17
Removed classes:
- WikiError (deprecated in 1.17)
- WikiXmlError (deprecated in 1.17)
- WikiErrorMsg (deprecated in 1.17)

Removed methods:
- ApiBase::getValidNamespaces() (deprecated in 1.17)
- ApiMain::setCachePrivate() (deprecated in 1.17)
- ApiMain::setVaryCookie (deprecated in 1.17)
- CategoryViewer::addSubcategory() (deprecated in 1.17)
- WebRequest::getFileSize() (deprecated in 1.17)
- WebRequest::isPathInfoBad() (deprecated in 1.17)

Change-Id: Id715c2391742c136d09f5369f88d67e798842af7
2014-01-05 18:54:27 +01:00
Timo Tijhof
90749a261c doc: Remove repetitive "Give grep a chance" phrase from comments
* Follows-up b2e2b2e016.
* Minor clean up of surrounding documentation comments.
* Fixed missing keys for messages in WebInstallerPage

Change-Id: Iaa692064262f3c0e10cfa5e4b1ec8c86e5d02362
2013-08-29 10:46:46 -07:00
Brian Wolff
a60b6f4048 Add url parameter to trigger autogenerated gallery type.
This was requested at commons as a temporary measure to
evaluate the new gallery options.

Change-Id: Ib12ac8228c824533262e1896adf2618dd298f655
2013-08-23 15:13:40 -07:00
shirayuki
3e20b61978 Fix comments for grep
* category-*-count
* node-count-exceeded-*
* expansion-depth-exceeded-*

Change-Id: If5a58c4f128d15969c56955af43aff76954ca94b
2013-08-19 14:26:32 +09:00
shirayuki
b2e2b2e016 Give grep a chance to find the usages
Change-Id: I18846326539b814fa7fa93ca54117dac3572e4b0
2013-08-16 22:07:38 +09:00
Brian Wolff
14b3f8767b New more slick gallery display
This extension adds a "mode" parameter to the gallery
tag, allowing different formats for the gallery tag
(galleries in the ui can be controlled by a global)
The added modes are:
*traditional - The original gallery
*nolines - Like the original, no borders, less padding
*packed - All images aligned by having same height.
  JS also justifies the images.
  (I think this one is the one that will go over best
  with users.)
*packed-overlay - like packed, but caption goes over
  top the image in a transloucent box.
*packed-hover - like packed-overlay, but caption only
  visible on hover. Degrades gracefully on screen
  readers, and falls back to packed-overlay if
  you are using a touch screen. I kind of like
  this mode when the caption is not that important
  (ex a category where its just the file name).

This also adds a hook to allow people to make their
own gallery version. I believe there would be interest
in this, as different people have done different
experiments. For example:
* Wikia: http://community.wikia.com/wiki/Help:Galleries,_Slideshows,_and_Sliders/wikitext
* Wikinews: https://en.wikinews.org/wiki/Template:Picture_select

What I would like to see for this patch, is first it gets
enabled, with the default still "traditional". After
about a month or two we consult with users. If feedback
is positive, we change the default mode to one of the
others (probably "packed").

Adds a "mode" parameter to gallery for different
mode, including one 'height-constrained-overlay'
which looks much more like other modern websites.

Note: This makes one change to the old gallery format.
It makes Nonexistent files be rendered like thumbnails
(i.e. they are rendered with a little grey border).

One thing I'm slightly worried about with this patch,
is that I added an option to MediaTransformOutput::toHtml
to override the width attribute. I'm not sure if that
is the best approach, and would appreciate thoughts
on that.

This should be merged at the same time as Ie82c1548

Change-Id: I33462a8b52502ed76aeb163b66e3704c8618ba23
2013-08-14 20:56:05 -03:00