This question about Topic Markup Language and applications: Answered but needs rewriting
Help with WebCreateNewTopic
After a bit of a hiatus I have started to set up a new wiki based on Foswiki-1.1.3. It was easier than my attempt at 1.0, in part because of experience and my notes, but I do want to say that the documentation is a lot better in the general use of Foswiki. However, I haven't been able to find documentation on the internals of Foswiki, specifically on changing the
WebCreateNewTopicTemplate. I managed to create a topic named
WebCreateNewTopic in a web, but I would like to modify it. I haven't seen any documentation on the %TMPL: directives. Are these Foswiki specific, or are they HTML or CSS?
What I am trying to do is change the Create New Topic so that it accepts a non wikiword as the topic name without asking, has a drop box to select one of a series of numbers, and puts the date, the users name, and the selected number in the beginning of the new topic.
Well, I hadn't checked out my new
WebCreateNewTopic, it seems I have broke something. When I tried to use it, it just came up with a page with the %TMPL: directives and some other text in it. I deleted the topic, but the Create New Topic was still trying to use it. I then deleted it from the Trash directory on the server side. This removed it, but then Create New Topic couldn't find the
WebCreateNewTopic. So I tried to make another, but it just turned into a regular topiic. Is there any way out of this besides removing the web? And how do I go about changing
WebCreateNewTopic to do what I want to do?
I am trying to create a special 'Create New Topic' so that it accepts a non wikiword as the topic name without asking, has a drop box to select one of a series of numbers, and puts the date, the users name, and the selected number in the beginning of the new topic, something like:
User's Name 26-Oct-2011
Part Number: 700244-02
I tried changing the Create New Topic on the left sidebar with a new
WebCreateNewTopic topic, but that did not work out. Then I copied and changed the Create New Topic button on the Sandbox page with more success, but could not get the contents of a table from a topic into a text box, and did not see how the text would be placed into the new topic. I am trying to create topics that are mostly text describing problems with parts with the topic name as the part serial number and the part number in the text. I am thinking to use the
TagMePlugin to add tags for searching. Maybe I should put the part number in the tags? Here is my latest try at the Topic Create Button:
<form action="%SCRIPTURLPATH{edit}%/%WEB%/" method="post">
Enter CCA Serial Number: %BR%
<input type="text" name="topic" size="32" />
Enter CCA Part Number: %BR%
<input type="text" name="title" size="32" />
<input type="submit" value="Create topic" />
<input type="hidden" name="onlywikiname" value="off" />
<input type="hidden" name="templatetopic" value="CCAEditTemplate" />
<!-- <input type="hidden" name="formtemplate" value="NewCCAProblemForm" /> -->
<input type="hidden" name="topicparent" value="%TOPIC%" />
<input type="hidden" name="onlynewtopic" value="%on" />
</form>
%TWISTY{
link="%BUTTON{"Create a new CCA Problem Report Test" icon="add"}%%CLEAR%"
mode="div"
}%
I have been able to get the drop down box with a table in another topic working, but I cannot seem to get the text put into the new topic I am creating. The example above does not use the drop down, just simple text input which does get put onto the creation page, but not into the new topic. I have looked at the documentation and examples but cannot seem to find anything that would help me. Please help with suggetions on how to do this and some reading suggestions on how this works.
Thanks,
Jonathan Salles
Hi Jonathan,
Firstly, %TMPL directives are an "interesting" aspect of Foswiki, sadly quite magical in many ways. But there is documentation at
SkinTemplates. However, I'd hope you wouldn't have to get very deep into %TMPL directives to solve the problem you're talking about.
Secondly, you can't pass topic text to the
save script that way - it's usually done with
<textarea name="text">FOO</textarea>
I started writing up a little demo of how to solve this with
DataForms and
FlexFormPlugin,
AutoViewTemplatePlugin - but ran out of time.
Can I just say that usually, this type of application would be structured as follows:
- BestPracticeTip12 has some examples of how to build custom topic creators that automatically assemble a topic name (not necessarily a wikiword; that's just an extra option you POST to the save script) from multiple input fields
- System.FrequentlyAskedQuestions is an example WikiApp (there's a hidden/twisty labeled "Summary of the pieces used...") which does the following:
- Another useful topic might be Faq41, which is a pattern to generate a topic-creator + search summary for you, purely from the DataForms definition
Sorry my answer is not more complete, I've run out of time - perhaps try posting on
foswiki-discuss or login to
IRC if you want some help putting this together
Good luck
--
PaulHarvey - 27 Nov 2011
Thanks for the Info and Help Paul.
I see that using a form was the better and Foswiki way to implement my topic creation. Using a form did allow more data to be entered and using
AutoViewTemplatePlugin made the form "dissapear" when viewing and display the way I wanted. It took a bit of banging my head against it, but I have a start on it working the way I want.