create new tag
, view all tags

Implemented: Create and modify topics without edit/preview/save sequence

Summary: Provides a framework to create and modify a topic without going through edit->preview->save sequence. Security, authorization, existing and future functionality of edit should be preserved.

Sometimes it is necessary to save content without editing:

  • Creating new topics directly from a HTML form.
  • Appending (or inserting) content into a topic from a HTML form (as with CommentPlugin).

Usage examples / applications

parent save in more-dialog

By now you have change the parent in the more-dialog and then go through the edit-dialog to commmit the change:

(looks ironically for this topic: more-dialog of SaveContentWithoutEdit)

Step 2: Continue to edit and save SaveContentWithoutEdit to activate the new parent

Creating new topics directly from a HTML form.

  1. User enters data into a HTML form.
  2. "Boilerplate" content and formatting for new topic provided by a template identified in hidden field in the form.
  3. Information entered into the form is inserted into the template using URLPARAM variables.
  4. Upon clicking on the "submit" buttom, a results page comes up that:
    • If the new topic was successfully created:
      1. Provides confirmation message (e.g. "Thanks for your suggestion!")
      2. Offers links for two options to proceed: View new topic and Return to input form.
    • If the new topic was not successfully created:
      1. Provides feedback as to what went wrong and suggested action. (e.g. "Topic name already exist. Please select new topic name." or "Please fill out all required fields."
      2. Offer single option to "Return to input form."
    • Bonus feature: allow results page to be defined in a TWiki topic which is designated in hidden field in the form.
  • Security: Have a hidden variable that designates the level of authorization imposed for particular form.

DiscussionForumAddOn (application of "Creating new topics directly from a HTML form")

The DiscussionForumAddOn is almost unuseable without a "direct-save"-feature, as it uses the URLPARAM to create new articles. The normal user is irritated by confrontating him with the edit window after entering the content within a nice HTML-Form try it here.

Appending/inserting content into a topic from a HTML form (as with CommentPlugin)

  • "Boilerplate" content and formatting for inserted data is provided by a template topic identified in hidden field in the form.
  • Information entered into the form is inserted into the template using URLPARAM variables.
  • Options for designating location where new data is to be inserted:
    • Topic that data is to be inserted into would be designated by hidden field in the form.
    • Default would be appending new data to end of topic.
    • Perhaps define special tag(s) for designating location for inserting new data. Two obvious options are ABOVE and BELOW tags that insert each new entry above and below the tag. These tags would be placed in the topic into which the new data is being inserted.
  • Clicking on the submit button send use to topic where data is inserted. I can't imagine need for a intermediate results page in this case.


<form name="myform" action="%SCRIPTURL%/save/%WEB%/%URLPARAM{"topic"}%">
<input type="hidden" name="templatetopic" value="MarketResearchTemplate" />
<input type="hidden" name="formtemplate" value="MarketResearchFormTemplate" />
<input name="topic" value="type topic name here" type="text">
<input name="text" type="textarea">
<input type="submit"> </form>

And here's the same form set up to create a topic in the Sandbox web:

Topic name:
Topic text:


Spec It should accept a template and expand the URLPARAM variables to create structured pages (without the edit-dialog).

Parameter: Description: Default:
topic="" save writes to "topic" instead of $topic optional
templatetopic="" templates the new topic from that template optional

Example: I might use it to create a new topic "SaveTheWhales" thus:

http://TWiki.org/cgi-bin/save/Codev/SaveContentWithoutEdit?topic="SaveTheWhales"+templatetopic="GoodCauses"+text="I've been saving them for some time, and as you can see this one has got quite smelly"

OR if your template topic uses URLPARAM you can fill in URLPARAM fielsd in your templatetopic

http://TWiki.org/cgi-bin/save/Codev/SaveContentWithoutEdit?topic="SaveTheWhales"+templatetopic="GoodCauses"+urlparamtext="I've been saving them for some time, and as you can see this one has got quite smelly"

Note: the "save" script still requires the "test" parameter to be defined.

-- AndreUlrich - 13 Oct 2003
-- LynnwoodBrown - 21 Nov 2003
-- PeterThoeny - 22 Nov 2003
-- CrawfordCurrie - 13 Feb 2004

Feedback and Discussion

  • ColasNahaboo says: this may be the same problem as "offline editing"
    • downlaoding raw text, edit it locally (emacs), re-upload
    • be mailed the data, edit, re-mail to upload edition

-- AndreUlrich - 13 Oct 2003

I would really like to see if we can generate some interest around implementing this feature! I am repeatedly coming up with situations where I would like to allow users to quickly create topics or add come content to a topic without going through the edit->preview->save cycle. I beleive this feature would greatly enhance TWiki's usability (particularly for new users) and, more generally, its potential as a foundation for simple web applications. I've added some links to other topics where this has been discussed and the beginning of some notes to specific specs for implementing this feature. PeterThoeny make some tantilizing comments within CommentPluginDev (see here) that seemed to suggest that this should not be too difficult within existing TWikiFuncModule#Functions_Content_Handling framework. I sure wish I understood perl enough to move this forward myself!

-- LynnwoodBrown - 21 Nov 2003

This is implemented in O'Wiki (and has been for some time). People wanting to backport the feature to TWiki will need to extract the changes to the save script merged into the user interaction layer. Doing a diff between the twiki save script's main and the save sub will be enough of a pointer for most people. Clearly if any code is backported, TWiki.org need to actually start making releases (alpha, beta, broken) that comply with the GPL. (Whether necessary things have been changed on non-released trees is entirely irrelevant)

  • _Michael - The link to UserInteractionLayer above does not seem to work. -- LB - 22 Nov 2003

A further version of the feature is used by the feature development wizard there. (The standard edit screen for new topics provides dropdowns pointing people at wizards, rather than people being pointed at wizards first)

Anyone needing the functionality now can just download the alpha release.

-- MS - 22 Nov 2003

Lynnwood, I had a need for this feature at work the other day. In fact, we implemented that in a specialized application. I summarized it in TopicCreatePluginDev.

A generalized solution needs to be defined. Compatibility with current feature and future enhancements of the edit and save scripts needs to be ensured. I see this as a possible solution:

  • The edit script handles a new func=directsave URL parameter
  • If supplied, it does all the initialization and checks, and at the end, instead of returning the edit template, redirects to the preview script.
  • The preview script does the same thing in case func=directsave URL parameter is present

It needs to be defined what to do if the topic already exists.

-- PeterThoeny - 22 Nov 2003

OK, Peter - great to see work on TopicCreatePluginDev! Perhaps I am complicating things by combining the two functions of creating a new topic versus appending an existing topic but allow me try and tease out some options and issues for these two situations:

Moved Examples here -- AndreUlrich - 13 Feb 2004

Thinking through these two examples, my present sense is that it makes more sense to package the two features in separate but closely related plugins. The first could be the TopicCreatePluginDev and the second could be TopicAppendPlugin (to replace CommentPlugin). This would reduce the number of options that would need to be defined for each.

-- LynnwoodBrown - 22 Nov 2003

Lynnwood - both of these features are implemented in O'Wiki as noted above. Direct save for new topics happens in the feature development wizard and is a trivial modification (necessary many would argue) to the save script, where the latter is in O'Wiki in the form of a modified (parameterised) comment plugin. (see off topic, site nits, chaos for running examples - indeed these hook in with the sectional edit plugin to provide fine grained addressing of comments, but that's a different issue)

The reason I'm mentioning it here by the way is to point out that if people want to rip out the code they're welcome, and if they don't want to hack code, and just use it then the feature is done, dusted and tested in use. (BTW, fixed that link above)

People who want the feature can of course just grab a nightly build.

-- MS - 22 Nov 2003

Caveat: There's been code drift since the save code was ripped out into a user interaction layer - the patch attached isn't "finished" or "polished". It's been mentioned a few times on IRC, Plugins web and other locations, that several people really want this feature - a pointer to how this was started in my fork is here: is (IIRC) the save script in TWikiAlphaRelease 01 Dec 2003. Generally speaking though parameterised saves might be an interest route to head down as well.

Take it, leave it. Only mentioned because it's been mentioned for the past 3 days running.

-- MS - 09 Feb 2004

Here's Michael's patch applied to beta20040118. Note the addition of the urlparams "newtopic" and "templatetopic".

>     # Check for a "save as different topic"
>     my $topicoverride = $query->param( 'newtopic' );
>     my $meta = "";
>     if ($topicoverride) {
>       $theTopic = $topicoverride;
>     }
>     # A template was requested; read it, and expand URLPARAMs within the
>     # template using our CGI record
>     my $templatetopic = $query->param( "templatetopic");
>     if ($templatetopic) {
>       ($meta, $text) = &TWiki::Store::readTopic( $webName, $templatetopic );
>       $text =~ s/%URLPARAM{(.*?)}%/&TWiki::handleUrlParam($1)/ge;
>     }
<         ( $meta, $tmp ) = &TWiki::Store::readTopic( $webName, $topic );
>    # read meta (if not already read when reading template)
>         ( $meta, $tmp ) = &TWiki::Store::readTopic( $webName, $topic ) unless $meta;
<         &TWiki::Form::fieldVars2Meta( $webName, $query, $meta );
>    # Expand field variables, unless this new page is templated
>         &TWiki::Form::fieldVars2Meta( $webName, $query, $meta ) unless $templatetopic;
<         TWiki::redirect( $query, &TWiki::getViewUrl( "", $topic ) );
>       # Note third parameter to getViewUrl is OWiki 'spacesOk'
>       TWiki::redirect( $query, &TWiki::getViewUrl( "", $topic, 1 ) );

-- CrawfordCurrie - 09 Feb 2004

Thanks Crawford. Incidentally further work on this has happened. (specific example bugfix Owiki:DirectSaveDoesNotExpandSameVariablesAsEdit amongst others listed in Owiki:CHAOS. I haven't put that patch up here, because I no longer have a save script - just a stub.)

-- MS - 09 Feb 2004

Grrrrrr..... drip feeder! OK, I'll have a look. But it ain't easy to work out what's what in CHAOS. -- CrawfordCurrie - 09 Feb 2004

  • Why do you think it's called CHAOS ? smile (More seriously you want to look in UI.pm - which is the total antithesis of where I want to end up, but is a necessary step to find redundancy - indeed the feature bloat of adding in lots of features & plugins is designed to find bottlenecks and commonalities) -- MichaelSparks - 09 Feb 2004

Crawford & Andre

if you guys can give me a patch to apply, and / or (more importantly) ammend the specification at the top to tell me what its supposed to do, I'll commit this. My problem is really knowing what the scope of this change should be (given that the SPEC is TBD, and that the usage eg includes appending & inserting to existing topics)

-- SvenDowideit - 10 Feb 2004

Patch attached. Warning: The patch collects common functionality from the save, edit and register scripts and defines a function in TWiki.pm, so expect to see all of these files change.

Moved Spec proposal up -- AndreUlrich - 13 Feb 2004

  • blah.dif: Patch to bring OWiki save functionality into TWiki

-- CrawfordCurrie - 10 Feb 2004

If you think the above is ready to go into the core, you should reset the TopicClassification to PatchProposal to make sure the CoreTeam doesn't miss the update. In this case it's unlikely as several of us are rather interested in seeing it go in, but I'd like to establish the workflow patterns now to prevent future problems.

-- WalterMundt - 11 Feb 2004

That's a hard one, because I have simply ported the patch from OWiki - I've only tested that it doesn't break anything existing that I've tested. Of course, without a TWikiTestSuite I suppose there's not much more I can do than that.

-- CrawfordCurrie - 11 Feb 2004

I cannot apply this patch as there is not enough documentation for it yet.

What is the EditCgiScript going to to? what are the consequences if you write

http://TWiki.org/cgi-bin/edit/Codev/SaveContentWithoutEdit?newtopic="SaveTheWhales"+templatetopic="GoodCauses"+text="I've been saving them for some time, and as you can see this one has got quite smelly" 

Why is the syntax for your example not

http://TWiki.org/cgi-bin/save/Codev/SaveTheWhales?templatetopic="GoodCauses"+text="I've been saving them for some time, and as you can see this one has got quite smelly" 
as this is the topic you are saving

  • The possibility to parse the URLPARAM - which is currently done in the editscript - is fundamental for this feature. -- AndreUlrich - 13 Feb 2004

Also - the docco for the TWikiRelease will need to be written.

I'm not willing to commit a patch that I don't have enough information about. And for this to work, you need to give me that info (this might be a reason why patches are ignored so much)

-- SvenDowideit - 13 Feb 2004

Sven, I just found a problem with the patch that makes it incorrect anyway. I'll reupload.

  1. I don't understand your question, what is the EditCgiScript going to do? What it has always done, I hope.
    • ok, so the patch only refactors EditCgiScript to remove common funtionality. (i'd prefer it if this was mentioned explicitly next PatchProposal) (yes, I am making the process up as we go along smile )
  2. The syntax of the example illustrates the additional "newtopic" parameter added to the save script, as described in the Spec. As I understand it, because the save script checks for the existance of the topic it is invoked on it has to be invoked on an existing topic. It can then save to an alternate topic, as dictated by "newtopic". Not the way I would have done it, but there you go.
    • mmm, is this really the best implementation of this feature, or just a quick hack to do it?
  3. What is "the docco for the TWikiRelease"? Do you mean user documents? There should be none; this patch does not impact the user in any way. If there is some other form of documentation required, please let me know.
    • If there is a change to the parameters of a Script, this needs to be doccoed. if it doesn't impact the user, then it does nothing new. Also, we need to find a good example to use here on twiki.org, otherwise we are in the same place as John's settings feature

-- CrawfordCurrie - 13 Feb 2004

On reflection I'm withdrawing this patch. I'd be happy to look at it again when someone can accurately identify an application for it - specifically, the 'newtopic' parameter.

-- CrawfordCurrie - 13 Feb 2004

Darn - I was really looking forward to this. frown I have several applications where I would like to allow users to create a new topic simply by filling in a form and hitting "submit." Mostly useful for new users that are still intimidated by editing but, hey, there's time when I would like that too! I described basic specs for a process here. Maybe I'll download the dif file and see what I can make of it.

-- LynnwoodBrown - 13 Feb 2004

Sorry Lynnwood, but there's more than one way to skin a cat. The following form creates a new topic.

<form name="myform" action="%SCRIPTURL%/save/%WEB%/%URLPARAM{"topic"}%"> <input name="topic" value="type topic name here" type="text"> <input name="text" type="textarea"> <input type="submit"> </form> 
And here's the same form set up to create a topic n the Sandbox web:

Topic name:
Topic text:
The only limitation is that you can't template the new topic - that does require the patch.

-- CrawfordCurrie - 14 Feb 2004

on IRC it was made clear to me that what we are missing (and i agree) is the template code in save, so that CrawfordCurrie's example above can work with a template. I personally would like to also be able to do this without it going to a new page (so i can enter 10 bugs with similar information)

so this is what I will make work

<form name="myform" action="%SCRIPTURL%/save/%WEB%/%URLPARAM{"topic"}%">
<input type="hidden" name="templatetopic" value="MarketResearchTemplate" />
<input type="hidden" name="formtemplate" value="MarketResearchFormTemplate" />
<input name="topic" value="type topic name here" type="text">
<input name="text" type="textarea">
<input type="submit">

And here's the same form set up to create a topic n the Sandbox web:

Topic name:
Topic text:

Please tell me if I need to do more than this...

-- SvenDowideit - 02 May 2004

Sven, what is the formtemplate option for?

  • you can specify that the topic uses a WebForm - and interestingly, this means that there is now a way to click a single button to change the WebForm that a topic has (just use the topic itself as the templatetopic)

This feature has a lot of possible applications (see above). It would be nice, if it can handle saving content on existing topics as well as creating new topics - both with templates.

  • mmm, you can - but its dangerous - if you use the form above on the same topic twice, you loose the first version

Idea moved to UserSpecifiedRedirect -- SvenDowideit - 03 May 2004

-- AndreUlrich - 02 May 2004

This is in CVS now! - your turn Andre smile can you do a docco as nice as Matt is (err, somewhere) smile

I'll play with this in the next week on my blog site, and at work - thanks for perservereing (giggle) with bugging us about it ! and thanks CrawfordCurrie and MS for actually doing the work

-- SvenDowideit - 03 May 2004

moved new FetureRequest to SaveContentWithoutEditContinued as this was just a patch submission

-- Sven

Reassigned to Andre as I've already got too much to do for this release and it was his code that finally made it in, I think. Go for it, Andre!

-- CrawfordCurrie - 30 Jun 2004

Having bitched and moaned so long for this feature, I feel the least I could do is try and contribute with documentation. However, looking over the discussion above, it's not clear to me what specs were finally implemented. May I suggest that someone who knows simply delete the majority of the development-related discussion and leave the bare bone that relates to what we actually have at this point. Then I'll contribute how I can.

I did looked through the official docs in the TWiki web to see what changes may be called for there. The only places I see at first cut that needs updating are TWikiTopics#Creating_and_editing_topics and possibly TWiki.TWiki.MainFeatures (if you consider this, as I do, a "main feature"). wink

-- LynnwoodBrown - 19 Aug 2004

Has anyone figured out how to use this feature and populate TWikiForms fields with url parameters? BTW, my offer to add some documentation for this feature still stands - if someone knowledgable about the code can clarify what exactly has been implemented.

-- LynnwoodBrown - 28 May 2005

i'm 99% certain that the bit I wrote under "so this is what I will make work" is what was implemented for Cairo.

-- SvenDowideit - 28 May 2005

Could somebody please summarize what the status of this is? I would like to review the code against what we intend to do here, and then integrate the extensions required to support editing of parts of the topic (as in EditContrib).

-- ThomasWeigert - 29 May 2005

Well, I'm trying to sort out exactly what the status of this is both to use it and to document it. Unfortunately, so far I've been unable to either get it to work or figure out exactly how it's suppose to work. frown

However, I did find these related discussions (with some help from SamHasler) that neither reference this topic nor each other: AllowFormTemplateWithTemplateTopic, FormValuesPassedInURLRequireText, WebformInitialValueNotSaved, WebformInitialValueOnlyWorksWithTemplate. It would appear that AllowFormTemplateWithTemplateTopic reflects the most recent code changes but I haven't been able to duplicate specs presented there (yet).

I'll continue to work on this as I have time since I believe it's an important feature. Any suggestions of what to try (I'll be glad to test) or clarifications about the code would be greatly appreciated.

-- LynnwoodBrown - 01 Jun 2005

See further notes on current status of this feature in SaveContentWithoutEditContinued.

-- LynnwoodBrown - 10 Jun 2005

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatdif blah.dif r1 manage 6.8 K 2004-02-10 - 17:46 CrawfordCurrie Patch to bring OWiki save functionality into TWiki
Edit | Attach | Watch | Print version | History: r50 < r49 < r48 < r47 < r46 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r50 - 2009-09-29 - PeterThoeny
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.