Last modified: 2008-03-11 21:34:23 UTC
Created attachment 4662 [details]
Modifies prepolution of edit form to recognize a "preloadtitle" parameter for new sections
The attached patch enables the use of a "preloadtitle" URL parameter to pre-populate the comment title when section=new is passed. This allows for simple creation of comments on a centralized page where the comment title is defaulted to the name of the page hosting the link. This would be useful on Wiktionary for the new feedback functionality we have been experimenting with over the last week or so, among other things. The patch was created today from SVN trunk.
After some discussion on English Wiktionary's Beer Parlour, it may make more sense for this to apply to more than just new sections. If that were the case, it would probably make more sense for it to be called "preloadsummary" instead of "preloadtitle". The patch would be more complicated for that case since the interaction with the preloaded section comments would need to be worked out in the case of editing an existing section.
I assumed that preload itself doesn't work for editing already existing sections, wouldn't that overwrite the contents that should be there? I think that the "preloadtitle" is an adequate name for the feature - as that is what it would be used for. This would be very useful for creating RfV/RfD (add to page) links as well.
> I assumed that preload itself doesn't work for editing already existing
> sections [...]
Correct. preloadsummary, however, might be useful more generally; it could
perhaps be appended to the default summary. (I can't say that I care much one
doesn't check to make sure it's on a section=new page, so would support
preloadtitle on any page. If people don't like that, we can stick with
Has anyone had a chance to look at this patch? I'd be happy to make any changes necessary to get it into SVN.
Patch applied as posted in r31329
Created attachment 4681 [details]
Replacement for previous patch...
The previous patch just went live and did not work correctly. The value of $this->summary was being wiped out after being set (in the initialiseForm() method).
This revised patch reverses the earlier patch and does the check for "preloadtitle" inside of initialiseForm() instead of inside importFormData(). It adds a global import of $wgRequest in initialiseForm() because the request parameters are not available in that method otherwise.
I have tested this patch in a local MediaWiki installation, unlike the previous patch (*hanging head in shame*).
I fixed this issue in r31419. The line in initialiseForm() blanking $this->summary was completely useless as $this->summary is blank by default anyway.
Would it be possible to make "preloadtitle" work on section=0?
That's another case when summary is blank, so it would be nice to have the option to pre-populate it from URL.