Tags:
create new tag
view all tags

Question

I would like to be able to create child topics of any topic via the Jump box.

Currently all pages created this way appear to be children of the web main page. Actually they have no explicit parent.

WebTopicViewTemplate contains the form that creates a new topic, at this point variable %TOPIC% is the name entered in the jump box. If there is a variable that corresponds to the 'calling' page, then I know how to do the rest.

I.e. heres the url when the WebTopicViewTemplate is in use .../ExistingTopic?topic=NewTopic

Is there a variable that corresponds to "ExistingTopic".

I have a solution that works by including a form in a page, see CreateChildTopicExample

I'd like to be able to construct links in WebTopicViewTemplate in a similar way

  • continue to create NewTopic as a child of ExistingTopic
  • continue to create NewTopic as a child of ExistingTopic using ExistingTopicTemplate (if it exists)

I think the code would look something like this.

 %MAKETEXT{"Continue to *[[[_1]][create topic ![_2]]]* as child of [_3]" 
     args="%SCRIPTURLPATH{"edit"}%/%WEB%/%TOPIC%?topicparent=%CALLINGTOPIC%,  
    %TOPIC%,
    %CALLINGTOPIC% }%

Environment

TWiki version: TWikiRelease04x00x04
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  
Categories: Forms, Missing functionality

-- EliotBlennerhassett - 31 Aug 2006

Updated, minor clarification

-- EliotBlennerhassett - 03 Oct 2006

Answer

I have found a solution that works, but I still think it is a bit of a hack.

In lieu of finding a variable to function as my %CALLINGTOPIC%, I edited the WebTopBar, adding a hidden parameter to the Jump form that conveys the name of the parent page:

   * <form name="jumpForm" action="%SCRIPTURLPATH{"view"}%/%BASEWEB%/%BASETOPIC%">
      < input id="jumpFormField" type="text" 
          class="twikiInputField patternFormFieldDefaultColor" 
          name="topic" 
          size="14" 
          value="%MAKETEXT{"Jump or Create"}%" 
          onfocus="clearDefaultandCSS(this);" 
          onblur="setDefaultText(this);" 
     />
     < input id="jumpForm" 
         type="hidden" 
         name="parent" 
         value="%BASETOPIC%"/>
</form>

Then in the WebTopicViewTemplate, I can refer to this using URLPARAM

   * %MAKETEXT{"Continue to *[[[_1]][create topic ![_2]]]* with parent [_3]"
args="%SCRIPTURLPATH{"edit"}%/%WEB%/%TOPIC%?topicparent=%URLPARAM{"parent"}%, 
%TOPIC%, 
%URLPARAM{"parent"}%" }%

   * Continue to 
[[%SCRIPTURLPATH{"edit"}%/%WEB%/%TOPIC%?
    topicparent=%URLPARAM{"parent"}%&
    templatetopic=%URLPARAM{"parent"}%Template]
 [create topic %TOPIC%]] 
with parent %URLPARAM{"parent"}%, 
Template %URLPARAM{"parent"}%Template _<- only if this link valid_

Supplementary question: Is it possible to have a conditional that is based on the existence of a topic? IF{ "exists TopicTemplate" THEN "true cond" }

-- EliotBlennerhassett - 03 Oct 2006

Thanks for sharing. You can test for existance of the current topic with %IF{ "contect new_topic" ... }%. If you want to check for existence of an arbitrary topic use SpreadSheetPlugin with EXISTS: %CALC{ "$IF($EXISTS(FooBar), true action, false action)" }%

-- PeterThoeny - 03 Oct 2006

Change status to:
Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2006-10-03 - 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-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.