Creator Portlet

From Sense/Net Wiki
Jump to: navigation, search
  • 100%
  • 6.0
  • Enterprise
  • Community
  • Planned


Creator portlet.png
Creator Portlet is responsible for creating Content in the Content Repository. It shows the appropriate Content View according to the selected Content Type, in which you can fill out the Fields. The type of the created content can be chosen in advance from a dropdown or comes as a URL parameter. After saving, a new content will be created in the Content Repository.


Context binding

Creator portlet is a Context bound portlet and the context Content is the parent node, under which the new content will be created. By default the portlet is bound to the current context meaning that new Content will be created under the current context Content.

Relative parent folder

It is possible to select a relative folder for the parent of the created Content. In this case the Content are not created under the current context Content, but under an arbitrary container. This is done with the following settings:

  • the relative parent path is selected with context binding (Context binding tab)
  • Create relative path if not exist property (New content tab) should be set if relative parent is to be created automatically
  • Relative container type name property (New content tab) sets the Content Type of the relative parent to be created - when it does not exist.

Portlet layout

The Portlet uses a custom layout that is defined in the Web.config file, under appSettings section with ContentAddNewPortletTemplate key.

Allowed Content Types

The Creator Portlet can operate in two different modes according to whether there is only one or there are more allowed Content Types defined:

  • if there are more Content Types allowed the Portlet will first show a drop-down list containing the allowed type names. After a single Content Type is selected the new Content View of the Content Type can be filled.
  • if there is only one Content Type allowed the Portlet will not display the Content Type selector list and display the new Content View of the allowed type immediately.

The list of allowed Content Types can come from different sources:

  • it comes from Url parameters (as when the Portlet is initialized after clicking the New button in Explore, see later)
  • it is defined by the ContentTypes Field of the current context.
  • it can be specified as a portlet property (see later).

Allowed types defined by the context Content ContentTypes Field or by portlet property only affects the elements that appear in the dropdown selector (when it is displayed) and does not affect operation when a single allowed type is defined with Url parameters! The url parameter is always stronger.

The New scenario

In the default install the Creator Portlet is used on Folder's Add Application. This Application is accessible via the New button visible for Folders in Explore. The New button is either displayed as a single button or as a dropdown from which the Content Type of the Content to be created can be selected. The Creator Portlet will, or will not display the Content Type selector dropdown as a first interface depending on the URL parameters passed according to the selection in the New scenario dropdown. If a single Content Type was selected in the New dropdown, the portlet will only display the selected Content Type's Content View, ready to be created - otherwise the Portlet will display the Content Type selector dropdown first.

Content templates

The Portlet also handles Content Templates, not only simple types. This means that when the initial type selector dropdown is rendered it contains Content Templates when defined for a type instead of listing the type. File is a good example for this for Document libraries: when creating new Content under a Document Library the File Content Type is not listed, instead some predefined File templates appear like Empty document.docx.

URL parameters

You can easily prepare a link which points to creating a Content. The path must be the path of the parent node under which the new Content will be created. Then you need to call the Add action by appending the ?action=Add expression; it is the default application for creating new Content (of course you can use your custom application as well). If you use this link (for example: http://localhost?action=Add This link works only if you have a live demo install on your localhost! (Don't forget! Some feature needs authentication and/or admin rights!)), the portal will show you the Content selector dropdown. If you add the ContentTypeName parameter as well (http://localhost?action=Add&ContentTypeName=Site This link works only if you have a live demo install on your localhost! (Don't forget! Some feature needs authentication and/or admin rights!)), the Content View of the defined Content Type will appear (Content Templates can be specified using their full path).


Own properties

User interface

Property Property name for embedding Possible values Description
Contentview path ContentViewPath Repository path Path of the contentview which renders the selected content. Leave it empty for automatic resolution by type

New content

Property Property name for embedding Possible values Description
Allowed content types AllowedContentTypes Content types List of CTD names that will appear in the type selector dropdown. Leave empty for automatic fill. Names must be separated with commas, semicolons or spaces.
Create relative path if not exist CreateRelativePath true/false If the given relative subpath (defined with context binding) does not exist the portlet creates the structure
Relative container type name RelativeContentTypeName text If you selected the 'Create relative path' option, this content type will be used to create the containers. Default is Folder.

Inherited properties

Context binding

Property Property name for embedding Possible values Description
Bind Target BindTarget Unselected
Select the bound content. Set it to CustomRoot to select a content with absolute path regardless of the context
Custom root path CustomRootPath Root relative Repository path Define bound content with absolute path when Bind Target is set to CustomRoot
Ancestor selector index AncestorIndex positive whole number Set the bound content to the ancestor of Bind Target specified by index. 0 leaves the bound content as specified above, 1 selects parent, higher value selects higher order ancestor
Relative content selector path RelativeContentPath relative Repository path Sets the bound content relative to the above settings with a relative path. Ie.: 'CustomChildFolder/CustomNode' selects 'CustomNode' from Bind Target's 'CustomChildFolder' child folder. Relative to ancestor when Ancestor selector index is set

User interface

Property Property name for embedding Possible values Description
Portlet title Title text Sets the visible title of the current portlet. Title header visibility is controlled with Appearance property
Appearance ChromeType Default
Controls title and border visibility. By default both are visible
Portlet skin css prefix SkinPreFix text When set portlet container div gets an extra css class. Ie. 'skinexample' adds css class 'skinexampleSkin' to container div

for Portal builders

PageTemplate embedding code

If you want to embed your Creator portlet into your pagetemplates somewhere, look at the following markup. The attributes/options and the range of their accepted values are the same as above.(Don't forget to include a unique ID and runat="server" attributes!)

   ContentViewPath="/Root/Global/contentviews/User/InLineNew.ascx" />

Related links