Page MenuHomePhabricator

Add autocompletion to Page Forms spreadsheet display
Closed, ResolvedPublic

Description

IMPORTANT: Make sure to read the GSoC participant instructions and communication guidelines thoroughly before commenting on this task. This space is for project-specific questions, so avoid asking questions about getting started, setting up Gerrit, etc. When in doubt, ask your question on Zulip first!

The Page Forms extension provides a spreadsheet-style editing display in two places: in the page Special:MultiPageEdit (for editing many pages at the same time) and in regular forms, with the setting "display=spreadsheet" (for editing multiple instances of the same template within one page). This display uses the jExcel JavaScript library. jExcel provides a number of helpful input types (dropdown, date, etc.), but it does not by default allow for autocompleting using an arbitrary list of values. This would be very useful to add. There are a number of ways this could be implemented: using the Select2 JS library, using MediaWiki's own OOUI library, or with a custom solution like this one.

This autocompletion solution should ideally support all the autocompletion possibilities available in standard Page Forms forms:

  • Autocompletion on all pages that match a specific category, Cargo field, SMW property or SMW concept
  • Support for the $wgPageFormsAutocompleteOnAllChars setting
  • Autocompletion on values retrieved from an external data source, using "values from external data"
  • Autocompletion where one field's values depend on what was chosen for a previous field, using "values dependent on"

Possible mentors: Yaron Koren, Sahaj Khandelwal

Micro-tasks: T208176, T217638, T275404, T275406, T279363

Event Timeline

I'm not sure if this helps but I actually hacked mine to work with autocompleting from a list of values using information on this page: https://bossanova.uk/jexcel/v4/examples/dropdown-and-autocomplete

I got it to work with my wiki using this hack:

diff --git a/libs/PF_spreadsheet.js b/libs/PF_spreadsheet.js
index fbde38cc..0b0ca246 100644
--- a/libs/PF_spreadsheet.js
+++ b/libs/PF_spreadsheet.js
@@ -283,6 +283,7 @@ const manageColumnTitle = '\u2699';
                        var allowedValues = templateParam['values'];
                        if ( allowedValues !== undefined ) {
                                jExcelType = 'dropdown';
+                               columnAttributes['autocomplete'] = true;
                                columnAttributes['source'] = allowedValues;
                                if ( templateParam['list'] === true ) {
                                        columnAttributes['multiple'] = true;

But I'm sure it would have issues if my field that uses "values from property=" was so large it needed to switch to ajax rather than prepopulating. And it forced the field to always want autocomplete, which isn't the best either.

That's interesting, but yes, jExcel's built-in autocomplete is different from the autocompletion that Page Forms has. Although potentially this "autocomplete" setting is useful in situations with a medium (not too small, not too large) number of values.

@Yaron_Koren If your project is in a ready state, could you list it here https://www.mediawiki.org/wiki/Google_Summer_of_Code/2021#Ideas_for_projects, following the format in https://www.mediawiki.org/wiki/Google_Summer_of_Code/2020/Ideas_for_projects by end of this week? We plan to apply as a mentoring organization to Google next week. Thanks(:

Hi @Yaron_Koren, How are you? I hope you are doing well.

I hope you still remember me, I am the GSoC2020 Student who worked with you.
I worked on "display=spreadsheet" during the last summer, so I think it might be suitable for me to work with PageForms again.

Do you advice me to work on applying with you again this year in GSoC, or you have a intend for the student will work with you to be some one different than this who worked with you before?!

Hi Amr! Yes, of course I remember you, and it's great to hear from you again. I do believe in the concept of GSoC as a way to bring in new contributors, which is part of why I haven't had any repeat students so far - and for that matter, I don't think I've mentored a GSoC student who was a serious MediaWiki contributor beforehand. So I'd encourage you to look for another project. On the other hand, if you're possible interested in doing MediaWiki work outside of GSoC, feel free to email me directly.

Well, sounds great, and thanks for you telling me that from day one.
I will go through the other projects, I might ask you for help if you don't mind.

Hi I am new to open source a found this project interesting so how should I see the good first issue https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/PageForms.git sorry for silly question

and can you please help me find the documentation for setting up the development in my pc

I am facing issues for setting up the project

@Bavisettinarayan: Hi, please see https://www.mediawiki.org/wiki/New_Developers#communication where to bring up unrelated support questions instead. Thanks!

Hi Everyone,
My name is Yash. I am currently a freshman junior pursuing Electrical Engineering and Computer Science. I am really interested to contribute to this project under the umbrella of Google Summer of Code 2021. For starters, I have set up the Mediawiki Development Environment in my local PC and installed Page Forms Extension using the documentation.

@Yashvarhsney - that's great to hear! For you, or anyone else interested in doing this project, please check out the microtasks listed, and try to do one - and let me know if you have any questions about them. Though it might make sense to wait until tomorrow, when the accepted organizations are listed, assuming the WMF gets accepted.

Hi @Yaron_Koren, @Sahajsk, Wikimedia has been officially accepted for GSoC 2021! https://summerofcode.withgoogle.com/organizations/5372073939042304/

As the student's applications period is from March 29 - April 13th, I want to encourage you to go through the further steps to ensure there isn't anything that you are missing: https://www.mediawiki.org/wiki/Google_Summer_of_Code/Mentors#_Before_the_program

I am having difficulty in setting up the project can someone please help I have posted my doubt here but no one is replying https://wikimedia.zulipchat.com/#narrow/stream/274201-gsoc21-outreachy22/topic/Setting.20up.20development.20environment
please help me as I am beginner so unable to set up the environment.

hi @Yaron_Koren, I am Palak, I am a Computer Science Engineering undergrad and an open source enthusiast. I am interested in working on this project

To anyone interested in working on this as a GSoC project: please try doing one of the remaining microtasks (I'll try to add more if these run out), and let me know if you have any questions.

Hi, Everyone. I am Pooja, an undergraduate student in Computer Science and Engineering. I am interested to work on this project.

Yaron_Koren claimed this task.

I'm happy to say this was done!