User:Himeshi/GSoC 2013/Project

= Section Handling in Semantic Forms =

This is the project page for my Google Summer of Code 2013 project to implement Section Handling in the Semantic Forms extension.

Project Description
The Semantic Forms Extension in Mediawiki is a useful and widely used feature of MediaWiki to make semantically structured data, contained within template calls which are easy to create and edit. However at present Semantic Forms does not support structuring of wiki pages by page sections. Accomplishing this project would mean enabling administrators to define page sections in the form definition for the structure of their wiki pages. It would also allow users to add data to those defined page sections using forms in the Semantic Forms extension.

The project would also extend the Page schemas extension to allow defining of page sections.

Progress
I will be posting weekly progress updates for the period 17th June 2013 - 27th September 2013 here.

Community Bonding Period
During this period I have gone through the necessary documentation to understand the working of Semantic Forms extension and also a bit about Semantic MediaWiki and MediaWiki in general. I have also written a small code sample to add a tag to understand the project better.

I have discussed with my mentor on the work I'm going to do next and have agreed upon the methods and frequency of communication as well as details pertaining to coding and updates.

17th June - 28th June
During this period most of the time was spent on going through the code of the formHTML method in the Semantic Forms extension which is really the most important part of the extension and where my work will mostly be. So far I have done (or at least tried to do!) the following; Currently I'm working to finish the implementing of this tag and I'm hoping to start work on allowing users to create page sections via the Special:CreateForm page.
 * Introducing a tag and displaying HTML headers and textarea on the form given to the users
 * Display section headers in wikitext on the page created
 * If the user has selected the edit with form option display the existing page content on the form for editing

1st July - 12th July
In the period of the first week (with the help of Yaron) I was able to figure out the workings of the query string and implement the saving of form section data onto the page created to complete adding the tag to the form definition syntax and submitted the code for review. Later I submitted several patch sets to this with the comments provided with notably the change to enable templates to be added anywhere on the page.

I also implemented enabling page sections to be added to the form via Special:CreateForm page and translating those page sections into the form, which at the moment requires a slight modification (from the comments given) that I'm working on now. I also set up phpunit and started looking into writing unit tests for the formHTML method in SF_FormPrinter.php.

15th July - 31st July
During the last two weeks of this month I worked on adding modifications and perfecting the following commits to get them merged into Semantic Forms(SF) master. The second commit also required code for handling the PageSchemas(PS) extension by SF so that the latest code of SF having the new changes for page sections would still work with PS. In doing this I was also able to fix some existing bugs in the SF code related to PS as well.
 * https://gerrit.wikimedia.org/r/#/c/72051/
 * https://gerrit.wikimedia.org/r/#/c/75343/

I put aside writing unit tests for a while and started looking at the PageSchemas code to modify it for page sections. I installed it, tried it out and went through the documentation given for the extension (which led to the discovery of the bugs). Currently I have kept that aside too and upon the suggestion of Yaron, am working on adding additional parameters to the section handling of SF.

1st August - 16th August
In the first half of August I completed on adding some other parameters for creating page sections to the Special:CreateForm page apart from hidden, mandatory and restricted which were already there. See,
 * https://gerrit.wikimedia.org/r/#/c/77461/

I also started going through the PageSchemas code extensively to understand what was going on and then started to work on introducing a new ‹Section› tag to the PageSchemas xml tree for adding page sections to forms. To do this I had to modify the code related to the Special:CreateSchema page of PageSchemas as well as the PageSchemas handling code in Semantic Forms. I was also able to fix some minor bugs in the process of my work.

19th August - 30th August
In the latter part of August I was able to complete the work on the adding page sections to forms via the PageSchemas extension. I completed implementing creating and editing an xml schema with page sections and then generating the form via Special:GenerateForm containing the page sections defined in the xml. See gerrit submissions,
 * https://gerrit.wikimedia.org/r/#/c/79556/
 * https://gerrit.wikimedia.org/r/#/c/79553/
 * https://gerrit.wikimedia.org/r/#/c/80864/
 * https://gerrit.wikimedia.org/r/#/c/80863/

2nd September - 16th September
During this period I worked on writing PHPUnit tests for the tag processing in Semantic Forms. This was the first attempt at creating any unit tests for the extension and therefore it was a bit challenging.
 * https://gerrit.wikimedia.org/r/#/c/83213/

Some minor improvements and bug fixes to the previously done work was also made.
 * https://gerrit.wikimedia.org/r/#/c/82423/
 * https://gerrit.wikimedia.org/r/#/c/82437/

The documentation that needed to be updated was also created. It will be made available with the next releases of SF and PS which will contain section handling. During the latter part of this period I had end of semester examinations and thus took a break from project work.