TIP WebCreatorPlugin is not installed on Foswiki.org.

WebCreatorPlugin

Flexible way to create new webs

Description

This plugin extends the basic way of the Foswiki core to create webs, while circumventing some of the more arcane features that are more of a burden than useful:

  1. support for AUTOINC for webs similar to topics
  2. ease way to create subwebs
  3. configure web access rights as part of the web creation process
  4. populate meta data of WebHome, i.e. set formfield values
  5. allow to copy a template web into an already existing web
  6. patch WebPreferences instead of just appending more preferences to it
  7. perl api to register plugin handlers to be called before and after a web has been created
  8. directly redirect to the newly created web
  9. jsonrpc interfaces to script creating webs

JSON-RPC API

The basic functionality of %TOPIC% is made available using a JSON-RPC handler called WebCreatorPlugin.create.

Parameter Description Default
newweb name of the target web  
parentweb name of the parent web which the target web is a subweb of  
templateweb name of the template web _default
overwrite boolean flag to optionally override an already existing target web off
dry boolean flag to simulate web creation; if enabled no actual web is created off
<web-preference-name> WebPreference settings may be specified using all upper case parameters, such as WEBSUMMARY, ALLOWWEBVIEW, DENYWEBVIEW, SOMESETTING and the like  
<formfield-name> any additional parameter provided may be used to populate the DataForm attached to the WebHome topic.  

Plugin API

The %TOPIC% allows third party plugins to hook into the web creation process by registering an approriate handler.

  • Foswiki::Plugins::WebCreatorPlugin::registerBeforeCreateWebHandler: handlers are called before the new web is created
  • Foswiki::Plugins::WebCreatorPlugin::registerAfterCreateWebHandler: handlers are called after the new web has been created

Handlers will be called with the $parameter hash of all settings provided to the json-rpc call.

Skin integration

When using Foswiki:Extensions/PatternSkin you might use the newweb template to render an appropriate dialog.

NatSkin comes with a modal dialog of its own available in the Admin dropdown menu at the top of the page.

Note that both of these interfaces only provide access to the standard features creating webs in Foswiki. The more advanced ones must be implemented as a derivation of the newweb.tmpl template. The form may be extended by defining the newweb::moresettingsstep definition or by extending the newweb::start or newweb::end definitions.

%TMPL:INCLUDE{"newwweb"}%
%TMPL:DEF{"moresetingsstep"}%%{}%
<input type="hidden" name="MOREWEBPREFERENCES1" value="..." />
<input type="hidden" name="MOREWEBPREFERENCES2" value="..." />
<input type="hidden" name="MOREWEBPREFERENCES3" value="..." />
...
<input type="hidden" name="ALLOWWEBVIEW" value="..." />
<input type="hidden" name="DENYWEBVIEW" value="..." />
...
<input type="hidden" name="FormFieldName1" value="..." />
<input type="hidden" name="FormFieldName2" value="..." />
<input type="hidden" name="FormFieldName3" value="..." />
...
%{}%%END%
%TMPL:END%

Low-level form structure

Sometimes you might want to implement a new web form yourself instead of using the newweb.tmpl template directly. The basic form structure looks like this:

<form class="jqAjaxForm" action="%SCRIPTURLPATH{"jsonrpc"}%/WebCreatorPlugin/create" method="post">
   *Web name*:
   <input name="newweb" class="foswikiInputField required" type="text" size="60" />

   *Summary*
   <input type="text" class="foswikiInputField" name="WEBSUMMARY" size="60" />  

   *Parent web*:
   <select name="parentweb" class="jqSelect2" data-width="27em" data-allow-clear="true" data-placeholder="%MAKETEXT{"none"}%" size="1">
      <option></option>
      %FLEXWEBLIST{ 
         format="<option $marker>$web</option>" 
         marker="selected"
         webs="public" 
         exclude="Applications.*"
         separator="$n"
      }%
  </select>

   *Template web*:
   <select name="templateweb" class="jqSelect2" data-width="27em">
      %FLEXWEBLIST{ 
         format="<option $marker>$name</option>" 
         marker="selected"
         webs="webtemplate" 
         include="_.*"
         exclude=".*/.*"
         separator="$n"
      }%
   </select>

   <!-- additional preferences, formfield values and acls -->
   <input type="hidden" name="MOREWEBPREFERENCES1" value="..." />
   <input type="hidden" name="MOREWEBPREFERENCES2" value="..." />
   <input type="hidden" name="MOREWEBPREFERENCES3" value="..." />
   <input type="hidden" name="ALLOWWEBVIEW" value="..." />
   <input type="hidden" name="DENYWEBVIEW" value="..." />
   <input type="hidden" name="FormFieldName1" value="..." />
   <input type="hidden" name="FormFieldName2" value="..." />
   <input type="hidden" name="FormFieldName3" value="..." />

  <input type="submit" class="foswikiSubmit" value="Submit" />
</form>%JQREQUIRE{"select2, ajaxform"}%

Installation Instructions

You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.

Open configure, and open the "Extensions" section. "Extensions Operation and Maintenance" Tab -> "Install, Update or Remove extensions" Tab. Click the "Search for Extensions" button. Enter part of the extension name or description and press search. Select the desired extension(s) and click install. If an extension is already installed, it will not show up in the search results.

You can also install from the shell by running the extension installer as the web server user: (Be sure to run as the webserver user, not as root!)
cd /path/to/foswiki
perl tools/extension_installer <NameOfExtension> install

If you have any problems, or if the extension isn't available in configure, then you can still install manually from the command-line. See https://foswiki.org/Support/ManuallyInstallingExtensions for more help.

Dependencies

NameVersionDescription
Foswiki::Contrib::JQAjaxFormContrib>=1.00Required

Change History

05 May 2022 add support for template webs with subwebs in it
15 Oct 2020 initial release

PackageForm edit

Author Michael Daum
Version 2.00
Release 05 May 2022
Description Flexible way to create new webs
Copyright 2019-2022, Michael Daum, All Rights Reserved
License GPL (GNU General Public License)
Home http://foswiki.org/Extensions/WebCreatorPlugin
Support http://foswiki.org/Support/WebCreatorPlugin
Repository https://github.com/foswiki/WebCreatorPlugin
ExtensionClassification Data and Files, Interface and Visualisation
ExtensionType PluginPackage
Compatibility
IncompatibleWith
ImageUrl
DemoUrl http://
SupportUrl WebCreatorPlugin
ModificationPolicy CoordinateWithAuthor
I Attachment Action Size Date Who Comment
WebCreatorPlugin.md5md5 WebCreatorPlugin.md5 manage 171 bytes 05 May 2022 - 15:19 MichaelDaum  
WebCreatorPlugin.sha1sha1 WebCreatorPlugin.sha1 manage 195 bytes 05 May 2022 - 15:19 MichaelDaum  
WebCreatorPlugin.tgztgz WebCreatorPlugin.tgz manage 16 K 05 May 2022 - 15:19 MichaelDaum  
WebCreatorPlugin.zipzip WebCreatorPlugin.zip manage 38 K 05 May 2022 - 15:19 MichaelDaum  
WebCreatorPlugin_installerEXT WebCreatorPlugin_installer manage 6 K 05 May 2022 - 15:19 MichaelDaum  
Topic revision: r2 - 05 May 2022, MichaelDaum
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy