From: Dan F <dfr...@cs...> - 2004-03-16 20:40:13
|
As background to this discussion, I attach my current version of my CategoryPage.php plugin, and the categorypage.tmpl it uses. The idea is to be able to drop <?CategoryPage ?> on any page you wish to represent a category in order to replicate boilerplate text that describes how it works for a newbie. All of this would probably be unnecessary for people who know a lot about how Phpwiki works (specifically: searching, creating pages, and backlinks), but I am specifically trying to design our site for casual users who don't care about wikis. I plan to try to attract many of them (potentially hundreds or thousands) to rate restaurants, research papers, movies, etc. Dan Dan F wrote: > Reini Urban wrote: > >> Dan F schrieb: >> >>> Again, thanks for PhpWiki. Here is another patch (from 1.3.7 more or >>> less) to support an "initial_content" argument to my CreatePage >>> plug-in. This is so that I can put a "CreatePage" button on a >>> category page that creates another page that already has example >>> text (the "initial_content" parameter) to refer to the category. I'm >>> not sure if this is the right place to post patches; please give me >>> more info on this. >> >> >> >> I'm not sure if we should allow the initial_content GET arg in the >> redirect, or just a template argument to take the initial_content >> from a existing template page. >> >> GET urls are limited in its length. pagenames are no problem. > > > > Reini, > > Thanks for your response! I assume you meant to add your suggested > code into the CreatePage plug-in, then add the template itself as a > Wiki page. I like the fact that yours is not restricted by GET length, > and that it is editable by end-users. I also agree that introducing > quoting into expandArgs() is a bold move that one would like to avoid > if possible. > > The potential issue for me is that the template itself might have to > be programmatically generated. Thus, I don't want "[Restaurant]" in > general, but, "[" . "[pagename]" . "]", so that I can drop a simple > statement (currently a CategoryPage plugin) that has a "CreatePage" > button on "[Restaurant]" that refers back to [Restaurant] and drop > that same CategoryPage plugin without mods onto "[ResearchPaper]" and > its "CreatePage" button refers back to "[ResearchPaper]". I am not > describing it very well in English. For an example, please see: > > http://dickens.cs.umn.edu/dfrankow/wikilens/index.php/Restaurant > http://dickens.cs.umn.edu/dfrankow/wikilens/index.php/ResearchPaper > http://dickens.cs.umn.edu/dfrankow/wikilens/ > > I will work with your suggestion and see how it goes. I'd much prefer > to have something you guys are willing to accept as a mod. > > Thanks again. > > Dan Frankowski > > P.S. My patch to expandArg() didn't work quite right anyway because of > the regexp. Just FYI I attach a new patch: > > diff -b -u -r1.1 -r1.3 > --- lib/WikiPlugin.php 29 Jan 2004 14:30:27 -0000 1.1 > +++ lib/WikiPlugin.php 16 Mar 2004 20:13:04 -0000 1.3 > > ... > > + // Expand [arg] to $request->getArg("arg") unless preceded by ~ > function expandArg($argval, $request) { > - return preg_replace('/\[(\w[\w\d]*)\]/e', > '$request->getArg("$1")', > + // Replace the arg unless it is preceded by a ~ > + $ret = preg_replace('/([^~]|^)\[(\w[\w\d]*)\]/e', > + '"$1" . $request->getArg("$2")', > $argval); > + > + // Ditch the ~ so later versions can be expanded if desired > + return preg_replace('/~(\[\w[\w\d]*\])/', '$1', $ret); > } > > function parseArgStr($argstr) { > > > > >> >>> In particular, I changed WikiPlugin->expandArg() so that it allows >>> quoting (via ~) of "[Restaurant]" (which would normally be evaluated >>> to the "Restaurant" arg of a request, which probably doesn't exist). >>> This allows me to put sufficient ~s in front of "[Restaurant]" to >>> allow it to pass through multiple layers of expansion (one ~ >>> dissappears through each layer). I hope changes such as these can be >>> accepted into the codebase. >> >> >> >> Just to support "[...]" in the initial_content param? >> Hmm, why not accept the template arg, which seems to be easier. >> >> function getDefaultArguments() { >> return array('s' => false, >> 'template' => false); >> } >> ... >> >> if ($template and $dbi->isWikiPage($template)) { >> $page = $dbi->getPage($template); >> $current = $page->getCurrentRevision(); >> $version = $current->getVersion(); >> $initial_content = $current->getPackedContent(); >> } >> ... > |