Extension:Page Forms/Select2 for autocompletion/Progress Report

Switching Semantic Forms Autocompletion to Select2
 Public URL:  https://www.mediawiki.org/wiki/User:Jatin.me/GSoC14  Bugzilla report: Bug 61974 Announcement:  http://lists.wikimedia.org/pipermail/wikitech-l/2014-March/075276.html Status:  https://www.mediawiki.org/wiki/Extension:Semantic_Forms/Select2_for_autocompletion/Progress_Report

Goals for the first half of the internship

 * Introducing the Select2 JS library to the current autocompletion system of Semantic Forms. Having discussed it with my mentors, we have decided to do this in conjunction with the jQuery UI Autocomplete which is used currently in SF for autocompletion.
 * Making 'combobox' input type in SF use this new Select2 library for autocompletion and see if everything works fine with this.
 * Make remote autocompletion work for combobox input type.
 * Switching the #forminput parser function which also supports autocompletion, on possible page names to use Select2 as well - and probably switch it to a combo box interface, for consistency.
 * Switching 'Semantic property' field in Special:CreateTemplate page also to Select2 combobox.

Communication plan

 * Email - I will keep mentor updated about the progress.
 * Skype and gtalk - Skype and gtalk have been my primary means of communication with mentors.
 * IRC Channel - I also go on the #semantic-mediawiki channel during the working hours.
 * Mailing list - semediawiki-user mailing list will be used to communicate progress.

Lessons learned since 21st April

 * Report to your mentors regularly about the progress of the project because mentors will help in rectifying flaws, which you may not notice, before its too late.
 * Do not make things complex, keep them easy and simple.
 * Prioritize tasks to be done and focus on important deliverables.
 * Discussions and feedback make thing better.

Week 1: 19 May to 25 May

 * I dove into the Semantic Forms code for autocompletion, got myself familiar with it and understood how this all works. Here are some of the related files:
 * Included the stuff related to Select2 JS library into the SF extension.
 * Included the stuff related to Select2 JS library into the SF extension.
 * Included the stuff related to Select2 JS library into the SF extension.
 * Included the stuff related to Select2 JS library into the SF extension.
 * Included the stuff related to Select2 JS library into the SF extension.
 * Included the stuff related to Select2 JS library into the SF extension.
 * Included the stuff related to Select2 JS library into the SF extension.
 * Included the stuff related to Select2 JS library into the SF extension.
 * Included the stuff related to Select2 JS library into the SF extension.
 * Included the stuff related to Select2 JS library into the SF extension.
 * Included the stuff related to Select2 JS library into the SF extension.
 * Included the stuff related to Select2 JS library into the SF extension.
 * Included the stuff related to Select2 JS library into the SF extension.
 * Tested if the Select2 library is successfully included and working fine with SF.
 * Started working on making 'combobox' input type use Select2 for autocompletion.

Week 2: 26 May to 1 June
Combo box using Select2 for autocompletion|none]]
 * Tested 'combobox' using Select2 for autocompletion.[[File:ComboSelect2.png|link=https://www.mediawiki.org/wiki/Extension:Semantic_Forms/Select2_for_autocompletion/File:ComboSelect2.png|thumb|160x160px|


 * Added a new attribute 'placeholder' to 'combobox'.
 * Started working on remote autocompletion for combobox.
 * Learnt Modular Javascript and started writing JS modules for making combobox use Select2 for autocompletion. I also wrote a small blog about Modular JS (see here).

Week 3: 2 June to 8 June

 * Completed module for autocompletion of combobox from local values.
 * Understood how Select2 does remote autocompletion and tried to integrate it to the module of combobox for autocompletion.
 * Integration successful, now combobox can do remote autocompletion if 'remote autocompletion' parameter is specified in the field tag.
 * Worked on the 'values from url' parameter for the combobox, now values for autocompletion can also be fetched from outside the wiki (other wikis or some other external url).

Week 4: 9 June to 15 June

 * Started working on switching  to Select2 for autocompletion.
 * Found some bugs in the existing code of in   function. It produces some weird outputs when some parameters are not given in specific order. This problem is occurring due to the support for unnamed parameters by.
 * Having discussed with my mentor, we have decided to get rid of these unnamed parameters and remove its support by the #forminput.
 * We also discussed about removing 'remote autocompletion' parameter and letting code SF decide itself whether to do local or remote autocompletion based on the number of values for autocompletion, if there are more than a certain number of values, which is settable via, then switch to remote autocompletion.
 * Working on the above two points discussed with the mentors.

Week 5: 16 June to 22 June

 * Removed support for unnamed parameters by.
 * Made 'remote autocompletion' parameter optional. Introduced a global variable  which is settable via , this variable will decide when to switch to remote autocompletion and when to keep it local.
 * Switched 'Semantic property' field in page to Select2 combobox.
 * Worked on making 'values dependent on' parameter supported by new Select2 combobox.

Week 6: 23 June to 29 June

 * Completed GSoC mid term evaluation.


 * Restored the support of unnamed parameters by, because removing them would break some wikis.
 * Also, removed Select2 combobox for, because that added two more steps for creating a new page with the form.
 * 'values dependent on' parameter is now fully supported by the combobox.
 * Submitted the final patch for Select2 combobox.

Week 7: 30 June to 6 July

 * Started working on adding a new input type - tokens, this input type can be used wherever multiple values are allowed.
 * Changed the structure of Select2 files for autocompletion by introducing a new base class that has some basic properties which can be inherited and extended by combobox and tokens.
 * Worked on a unified solution for making 'values dependent on' parameter supported by tokens and combobox,.
 * Found some issues with existing 'dependent field' autocompletion, like for same substring many calls were made to the API, this slowed down the forms.