%TOC{depth="2"}% ---++ Documentation %STARTSECTION{"documentation"}% This is a tool to add a topic based application, or part of it to another web. This is done by creating a TopicStub that points back to the implementation. For example, to add a new TopicType to web, you create a TopicStub that points back to the implementation of that TopicType. The function will display a small input form to specify the web where the TopicStub is to be created. ---+++++ Parameters * TEXT: headline for the install form, defaults to "Install BASETOPIC" * NAME: name of the topic to be created, defaults to BASETOPIC * SOURCE: used to specify the TopicStub's target to be created, defaults to BASEWEB.BASETOPIC * PARENT: topicparent of the new topic, defaults to HOMETOPIC * TEMPLATE: TopicTemplate used to create this topic, defaults to Applications.TopicStubTemplate * FORM: DataForm used for this topic, defaults to Applications.TopicStub * TYPE: type of the new topic, defaults to TopicStub * WIKIAPP: the name of the WikiApllication this topic belongs to, defaults to BASEWEB * EXTRA: extra stuff to be send during =save= %ENDSECTION{"documentation"}% ---++ Implementation <verbatim class="tml"> %STARTINCLUDE%<!-- rendertopic installer --><noautolink> %TWISTY{ mode="div" link="%BUTTON{"%MAKETEXT{"Install"}%" icon="application_add"}%%CLEAR%" }% <form id="topicinstaller" action="%SCRIPTURLPATH{"save"}%/" method="post"> <div class="foswikiFormSteps"> <h2 >%IF{"defined TEXT" then="$percntTEXT$percnt" else="%MAKETEXT{"Install %BASETOPIC%"}%"}%</h2> <input type="hidden" name="onlynewtopic" value="on" /> <input type="hidden" name="TopicTitle" value="" /> <input type="hidden" name="Summary" value="%FORMFIELD{"Summary" topic="%IF{"defined SOURCE" then="%SOURCE%" else="%BASETOPIC%"}%"}%" /> <input type="hidden" name="topicparent" value="%IF{ "defined PARENT" then="%PARENT%" else="%HOMETOPIC%"}%" /> <input type="hidden" name="templatetopic" value="%IF{ "defined TEMPLATE" then="%TEMPLATE%" else="Applications.TopicStubTemplate"}%" /> <input type="hidden" name="formtemplate" value="%IF{ "defined FORM" then="%FORM%" else="Applications.TopicStub"}%" /> <input type="hidden" name="TopicType" value="%IF{ "defined TYPE" then="TopicStub, %TYPE%" else="TopicStub"}%" /> <input type="hidden" name="Target" value="%IF{ "defined SOURCE" then="%SOURCE%" else="%BASEWEB%.%BASETOPIC%"}%" /> <input type="hidden" name="WikiApplication" value="%IF{ "defined WIKIAPP" then="%WIKIAPP%" else="%FLEXWEBLIST{include="%BASEWEB%" format="$name"}%"}%" /> %IF{"defined EXTRA" then="$percntEXTRA$percnt"}% <input type="hidden" name="topic" id="topic" value="%IF{"defined NAME" then="%NAME%" else="%BASETOPIC%"}%" /> <div class="foswikiFormStep"> <h3>Target web:</h3> <select id="newweb" name="web" class="foswikiSelect"> <option>Select ... </option> %FLEXWEBLIST{ format="<option value='$web'>$web</option>" webs="public,webtemplate" separator=" " exclude="Trash" }% </select> <div class="foswikiFormDescription"> %MAKETEXT{"Select a web where to deploy this component."}% </div> </div> <div class="foswikiFormStep"> %BUTTON{"%MAKETEXT{"Submit"}%" icon="tick" type="save"}% %CLEAR% </div> </div> </form> %ENDTWISTY% %ADDTOZONE{"script" topic="%WEB%.%TOPIC%" section="init" requires="JQUERYPLUGIN"}% </noautolink><!-- //render topic installer -->%STOPINCLUDE% </verbatim> ---++ !JavaScript initialisation <verbatim class="tml"> %STARTSECTION{"init"}%<literal> <script type='text/javascript'> jQuery(function($) { $('#topicinstaller').bind('submit', function() { var $form = $("#topicinstaller"); var $topic = $form.find('[name=topic]'); var $web = $form.find('[name=web]'); $topic.val($web.val()+'.'+$topic.val()); }); }); </script> </literal>%ENDSECTION{"init"}% </verbatim> ---++ Test %DBCALL{"%TOPIC%"}% %DBCALL{"Applications.RenderFunctionCallers"}% ---++ Copyright © 2006-2013 Michael Daum http://michaeldaumconsulting.com %DBCALL{"Applications.GnuGeneralPublicLicense" section="notice"}%
ApplicationTopic
edit
TopicType
DocuTopic
,
TopicFunction
TopicTitle
Summary
Render a simple factory to deploy a topic in another web
WikiApplication
WikiWorkbench
This topic: Applications
>
RenderTopicInstaller
Topic revision:
23 Dec 2012,
ProjectContributor
(raw view)
Das Urheberrecht © liegt bei den mitwirkenden Autoren. Alle Inhalte dieser Kollaborations-Plattform sind Eigentum der Autoren.