Commit graph

93 commits

Author SHA1 Message Date
Erik Bernhardson
c2a308075f Convert SearchResultSet to typical iteration
The funky iteration here was at best annoying. Switch
it over to an iterator based approach with appropriate
BC code to simulate the old iteration style.

Depends-On: I19a8d6621a130811871dec9335038797627d9448
Change-Id: I9fccda15dd58a0dc35771d3b5cd7a6e8b02514a0
2018-06-11 13:35:41 -07:00
Bartosz Dziewoński
485f66f174 Use PHP 7 '??' operator instead of '?:' with 'isset()' where convenient
Find: /isset\(\s*([^()]+?)\s*\)\s*\?\s*\1\s*:\s*/
Replace with: '\1 ?? '

(Everywhere except includes/PHPVersionCheck.php)
(Then, manually fix some line length and indentation issues)

Then manually reviewed the replacements for cases where confusing
operator precedence would result in incorrect results
(fixing those in I478db046a1cc162c6767003ce45c9b56270f3372).

Change-Id: I33b421c8cb11cdd4ce896488c9ff5313f03a38cf
2018-05-30 18:06:13 -07:00
Kunal Mehta
e0193327bd Fix MediaWiki.Commenting.LicenseComment.InvalidLicenseTag errors
Change-Id: I936c3f5fca1a0061f215e80469f5d882cb32ee29
2018-05-23 16:23:42 -07:00
David Barratt
3481e3b2e0
Create Expiry Widget with Date Time Selector
Special:Block needs a date time selector for easier selection of expiry. To
accommodate this cleanly, a new Expiry Widget is created that handles this
logic.

Bug: T132220
Change-Id: I2853a2ca0ae6ccead3978f4bb50a77c2baa3a150
2018-04-19 20:24:08 -04:00
Prateek Saxena
11c9616e38 mw.widgets: Add SizeFilterWidget and its PHP implementation
Bug: T183765
Change-Id: Ieb551e901405749489059366de9af6316f369cc0
2018-03-01 17:38:37 +00:00
Kunal Mehta
0535765366 widget: Fix changes of copyright year
Fixes up e8b10f6804.

Change-Id: I474e508a2bd4d783272eda87c1cc91f5597bc1b1
2018-01-24 12:07:34 -08:00
jenkins-bot
2b6f3f0adc Merge "Simplify documentation headers of includes/widgets/…Widget.php files" 2018-01-24 19:14:56 +00:00
jenkins-bot
35b9d17334 Merge "Deprecate old interwiki search result widget" 2018-01-11 13:35:36 +00:00
Erik Bernhardson
d95f644e80 Deprecate old interwiki search result widget
Update the flag for new interwiki sidebar from unset means disabled
to unset means enabled. Deprecate the old rendering widgets to be
removed at a later date per deprecation policy.

Change-Id: I80d8375bbd3e1fabc9b2432b6875d17a96aee099
Related: I9a488438
2018-01-10 12:46:42 -08:00
Thiemo Mättig
e8b10f6804 Simplify documentation headers of includes/widgets/…Widget.php files
Most notably: The documentation header repeats the file name. This
appears to be fully automatically generated, but does not add helpful
information.

Change-Id: I9edf15dd25ef6cc52fe931fffde69f0bd9042474
2018-01-10 13:44:05 +01:00
Umherirrender
23ef520a1c Improve some parameter docs
Change-Id: I31e983d7ac287158101b18ad95779d83537302a2
2018-01-07 11:39:08 +01:00
Bartosz Dziewoński
a0d6118af7 Put menus/popups of infused PHP widgets into the default overlay
With some special tweaks:
* Remove weird custom overlay handling in DateInputWidget that nobody
  actually used. I think if you need something special like that, you
  can just write two lines of JS code to attach the dropdown elsewhere.
* Also handle the CapsuleMultiselectWidget produced by HTMLForm's
  'multiselect' field in the same way.

Bug: T183069
Change-Id: I693f406194aeb826a3ab5bc78c97015b0b8a7fdb
2018-01-02 23:40:02 +01:00
Umherirrender
255d76f2a1 build: Updating mediawiki/mediawiki-codesniffer to 15.0.0
Clean up use of @codingStandardsIgnore
- @codingStandardsIgnoreFile -> phpcs:ignoreFile
- @codingStandardsIgnoreLine -> phpcs:ignore
- @codingStandardsIgnoreStart -> phpcs:disable
- @codingStandardsIgnoreEnd -> phpcs:enable

For phpcs:disable always the necessary sniffs are provided.
Some start/end pairs are changed to line ignore

Change-Id: I92ef235849bcc349c69e53504e664a155dd162c8
2018-01-01 14:10:16 +01:00
Thiemo Mättig
544122a6c2 Remove self-explaining "section heading" comments from classes
I can see that "parent::__construct" literally calls the parent
constructor. I can see that stuff preceeded by the keyword "protected"
is protected. I really (really) don't need comments explaining such.

Change-Id: I7458e714976a6acd3ba6a7c93fdc27d03903df83
2017-12-28 16:12:08 +01:00
ryan10145
19c45cdb16 Changed Instances of rawParams() to plaintextParams()
Bug: T182213
Change-Id: Ibf24dee5ea19092e8a38e57f34c98f513d4c9b21
2017-12-07 20:20:40 +00:00
Stanislav Malyshev
eca3ab26d9 Fix wrong variable in ShowSearchHit call.
The code uses $size, which does not exist and never used otherwise.
The actual size HTML is stored in $desc.

Change-Id: Ida5e69c81acea6bdec75810cf7b192f9dc7cf327
2017-11-07 16:33:38 -08:00
Max Semenik
2eb312bcba NamespaceInputWidget: Fix type documentation
Change-Id: Ifc8e8be7bb7423d581f62427a4e48d70d73c714b
2017-11-04 22:48:53 +00:00
jenkins-bot
5120937028 Merge "Add attributes parameter to ShowSearchHitTitle" 2017-11-02 05:40:05 +00:00
Stanislav Malyshev
0e93f96c9a Add attributes parameter to ShowSearchHitTitle
This would allow extensions to define custom attributes on title link,
such as put information in "title", change attributes depending on
specific search hit, etc.

Now Wikidata does the same by overriding LinkBegin, but this applies
to all links, not specifically to search result link.

Since ShowSearchHitTitle is always used with the link, I think it makes
sense to enable this specific customization.

Change-Id: I19f64e0909d92e32ddf6271f74c014e8b65d5014
2017-10-23 15:42:41 -07:00
Paladox
d97455ca21 build: Updating mediawiki/mediawiki-codesniffer to 14.1.0
And moved phpcs.xml to .phpcs.xml (T177256).

Change-Id: Idaa1fe006a528c25ce34abd0a857c657c26e8b0f
2017-10-21 03:12:55 +00:00
James D. Forrester
fb4e63ba3f Update OOjs UI to v0.23.5
Release notes:
 https://phabricator.wikimedia.org/diffusion/GOJU/browse/master/History.md;v0.23.5

Also, replace uses of `OOUI\TextInputWidget( [ 'multiline' => true ] )`
with `OOUI\MultilineTextInputWidget()` to avoid deprecation warnings
(which cause unit tests to fail).

Depends-on: I990b14982ffb72fe981040d02c7023d13f721aaa
Change-Id: If8312c60e1547a6177f5491011badb6576f54b21
2017-10-12 14:45:39 -07:00
Ed Sanders
348d16867f Remove setting of SearchInputWidget configs to already-default values
Change-Id: I2710051386ba826895db9d9c675263847625e17f
2017-10-08 19:55:14 +01:00
James D. Forrester
8212363b18 SearchInputWidget: Don't show images
But we should also have a different class name for this, as this isn't
upstream's SearchInputWidget.

Bug: T177659
Change-Id: Ie62e8678e89b2403d769694adb23fe21a047019c
2017-10-06 13:01:14 -07:00
Umherirrender
3f1a52805e Use short type bool/int in param documentation
Enable the phpcs sniffs for this and used phpcbf

Change-Id: Iaa36687154ddd2bf663b9dd519f5c99409d37925
2017-08-20 13:20:59 +02:00
WMDE-Fisch
6df9ed1ad6 update mediawiki-codesniffer to 0.11.0 and fix issues
- mostly auto fixes
- some too long lines fixed
- ignore amp space in one case  passing by reference

Change-Id: I6472f83bc3cbf4bd629d83050cc3319b19ec465c
2017-08-11 22:27:51 +02:00
Jan Drewniak
f5afe60dec Changing interwiki results header from <p> to <h2>
Makes the header on interwiki results
(results from different languages on Special:Search)
bigger.

Bug: T146655
Change-Id: I10ea6f85f97b4c8a5e585b2b1090af68054cbe2c
2017-07-27 16:16:21 +00:00
Tjones
af420fe8b5 Merge "Revert "Make mw.widgets.SearchInputWidget extend OO.ui.SearchInputWidget"" 2017-07-19 21:51:18 +00:00
EBernhardson
baf123f07d Revert "Make mw.widgets.SearchInputWidget extend OO.ui.SearchInputWidget"
Typing a search query into the main box on Special:Search
causes the search to be performed for the first autocomplete
result, rather than the typed query. The first autocomplet 
result should only be searched for if explicitly selected with
the mouse or arrow key.

This reverts commit 7882e3b660.

Bug: T171112
Change-Id: I1af6ba90542fafe3ed1aeca420e9d6df6612f7d0
2017-07-19 21:39:36 +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
jenkins-bot
0d6f186487 Merge "Make mw.widgets.SearchInputWidget extend OO.ui.SearchInputWidget" 2017-06-30 11:25:43 +00:00
jenkins-bot
3431ab6d07 Merge "DidYouMeanWidget: Don't use deprecated Linker::linkKnown()" 2017-06-30 08:53:18 +00:00
jenkins-bot
e43c87efd8 Merge "SearchInputWidget: Fix documented default for 'pushPending' option" 2017-06-30 07:48:16 +00:00
Roan Kattouw
ef51ede976 UsersMultiSelectWidget: Port from CapsuleMultiselectWidget to MenuTagMultiselectWidget
Bonus:
* Remove puzzling code that claimed to fix a bug that I couldn't reproduce
  but instead made single-character searches never display suggestions
* Clear the input after choosing a menu item

Change-Id: I44e72205880d152639ee823238dc5ab84d34402b
2017-06-30 02:03:40 +00:00
Bartosz Dziewoński
7882e3b660 Make mw.widgets.SearchInputWidget extend OO.ui.SearchInputWidget
Mixin mw.widgets.TitleWidget instead of extending mw.widgets.TitleInputWidget.

* Remove code that reimplemented pieces of OO.ui.SearchInputWidget.
* Remove code that overrode pieces of mw.widgets.TitleInputWidget.
* Copy the code from mw.widgets.TitleInputWidget that we actually want.

This should result in no functional changes, other than losing the
TitleInputWidget API (some methods and config options) that no one
relied on, as far as I can tell.

Bug: T169194
Change-Id: Ic1482b4c7cfde7d4cf0b8900654bd3a454776010
2017-06-29 22:25:56 +02:00
Bartosz Dziewoński
49eeea2124 SearchInputWidget: Fix documented default for 'pushPending' option
Change-Id: Iadee48af255498c6608cfd00fca29eed9b14f1be
2017-06-29 22:24:56 +02:00
Kunal Mehta
80761e49ab DidYouMeanWidget: Don't use deprecated Linker::linkKnown()
Change-Id: Ie5464c9d8e3207e7d307bbd31f3c3026ac18fcf2
2017-06-26 19:17:17 -07:00
Jan Drewniak
48e15a4af5 adding data-attribute to sister-search sidebar results.
Adding source identifier (iwprefix) data-attribute
to interwiki search sidebar results.

Change-Id: I9e11a368fe4f5d79d81503fb4db1cc1649723839
2017-06-16 21:04:01 +02:00
Thiemo Mättig
e16191caa3 Remove unused and unnecessary imports
Change-Id: I26e623a4e4ba965c07670369a90c8a95185ea1e4
2017-06-12 15:50:43 +00:00
David Causse
9f24c73773 Properly check that the port key is present
Bug: T167301
Change-Id: I009c3d8e5805ddd2b75640ba582a648663c72b47
2017-06-07 18:46:42 +02:00
David Causse
6ffa1e302e Add 'show-multimedia-search-results' to SearchEngine feature data
Let the search engine controls if multimedia results have to be shown
in the new interwiki sidebar.

Bug: T164925
Change-Id: Ie3ccb28bf73110b136475e9527a2653bf06b8e45
2017-05-11 09:45:04 +02:00
Jan Drewniak
a0f492fffc Revised styling of sister-search sidebar.
Various improvements to the sister-search sidebar:

- using WM project favicons
- scoping CSS specific to sister-search sidebar
- making sister-search items more compact

Bug: T160724, T158938
Change-Id: I2794121ab83cbd4e2b8868150e4d61db376fa63b
2017-05-08 23:00:36 +02:00
Paladox
54c56da85a Fix php code style
Preparation change for updating mediawiki code sniffer to 0.8.0

Change-Id: Ib0b3fe4afea9096ffa3a1347b4f7e07d3398b0b2
2017-05-05 12:03:54 +00:00
Prateek Saxena
a6b31205ac mw.widgets: Add SelectWithInputWidget and its PHP implementation
Bug: T106999
Change-Id: Ic158bec3c463fba5099b05f41c9686f833e1c313
2017-04-24 10:19:55 +02:00
Mikhail Popov
489f7e0b54 Hold number of search results in a data attribute
Current way of counting returned search results (e.g. for
Event Logging) relies on counting the appropriate elements
in the search results page's DOM, up to the limit the user
requested (e.g. 20 by default). This allows us to record
the total number and the offset, useful for event logging.
For example, if we wanted to know whether the user viewed
2nd or 3rd set of search results.

Change-Id: Ic8601e9eeddac84ba8e0d7dc6f127bf360b6f90f
2017-04-19 11:29:45 -07:00
Fomafix
7a3418ae33 Use consistent spaces at start and end of comments
Change-Id: Idbb09b69aa1ef4e46433319aaea62f34f0dbc038
2017-03-30 22:06:40 +02:00
Bartosz Dziewoński
e218f21d44 mw.widgets.SearchInputWidget: Do not pass type: 'search' to TextInputWidget
Causes deprecation warnings.

Most of this code is copy-pasted from OO.ui.SearchInputWidget.

Bug: T148471
Change-Id: I81d52ba938a8b90c5d2c173f1f2682d9e3300e43
2017-03-14 21:44:42 +00:00
Jan Drewniak
dfac17c488 Minor fixes for second sister search AB test
These are a few minor fixes to improved the
UX of the new sister search sidebar.

- Making the link color on sister search results blue
- Fixing the order of the multimedia search results widget
- added a more explicit 'more results' message instead
of the current '(more)' message.
- aligning the top of the sidebar with the top of the regular
search results.
- fixing a typo in the multimedia widget.

Bug: T158935
Change-Id: Iaae603cc217b7847bebfa61b050b7c86bdd19f14
2017-03-14 12:26:28 +01:00
Eddie Greiner-Petter
d6709386bf Remove redundant input from search form
A hidden input 'profile' gets added within the search form widget no
matter what profile is loaded at the moment.  This is done in
shortDialogHtml along with a few other hidden fields. The same hidden
field is added a second time in optionsHtml if the profile 'advanced' is
run. Remove this redundance.

Bug: T158869
Change-Id: I3be598702dbe9fa2cfe0fdd6c23fe6d88477626d
2017-03-04 01:41:19 +01:00
Bartosz Dziewoński
6f2177e00e SearchFormWidget: Move hidden fields below the ActionFieldLayout
I think ideally, these would be at the end of the form, but there
are some hooks below which can produce arbitrary HTML and potentially
want to override these with their own fields, so I'm avoiding any
revolutionary changes to the field order here.

Bug: T158856
Change-Id: I377c0061a365930e11454a86c1e0926853789b55
2017-02-23 18:02:29 +01:00
Aaron Schulz
58ecdd060c Fix assortment of IDEA warnings
Change-Id: I3fb482232483f37bf73ebbeb405056794109e618
2017-02-11 18:12:42 -08:00