The attached patch collects common code from the "register" and "edit" scripts and creates a new function in TWiki.pm that fulfils the function of the common code. The common code in question is the code that expands the DATE, USERNAME, WIKINAME, WIKIUSERNAME, URLPARAM, and NOP pseudo-constants.
This is step 1 of the refactoring; step 2 requires that the function thus created be published via the
PluginsAPI. However since no-one seems interested in the plugins API, I haven't bothered with that step.
--
CrawfordCurrie - 09 Mar 2004
Thanks Crawford, this makes the code cleaner.
--
PeterThoeny - 10 Mar 2004
OK, this is now in
TWikiAlphaRelease. Notice that it took me one hour to test, debug and fix these issues:
- New topics showed up blank since TWiki::expandVariablesOnTopicCreation did not return anything
- New registrations showed up blank since the expandVariablesOnTopicCreation function call in register did not assign $text
- New registrations did not account for the different handling of users in the two registration forms
- New registrations did not expand the three user variables to the correct user
- The pod doc in expandVariablesOnTopicCreation did not have the required empty lines to separate pod paragraphs
Please test your patches before proposing it, or add a note that it is untested code.
--
PeterThoeny - 10 Mar 2004
Oh blast. Profuse apologies, Peter, I realise now I uploaded the wrong patch file (patch.dat instead of patch.dif). If one of my patches doesn't work first time, out of the box, please bounce it! I always test as thoroughly as I can. I had already detected and corrected the above issues, though I hadn't spotted the pod doc problem.
But I'm puzzled; the changes don't seem to be in CVS. Is there maybe a time-lag?
--
CrawfordCurrie - 10 Mar 2004
yeah, sourceforge has a 1 day delay for anonymous cvs access
--
SvenDowideit - 10 Mar 2004