ActionLinkButton

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

Overview

The ActionLinkButton control is a user control that displays an Action link for a specific Content with the Icon of the referenced Application.

ActionLinkButton control

Details

The context Content for the control is determined with 3 parameters:

  • if ContextInfo control is present (via ContextInfoID parameter) it determines the context. A relative path to the context can be set with the NodePath parameter,
  • if ContextInfo is not present, the value of the NodePath parameter selects the context,
  • if neither ContextInfo nor NodePath is given the context Content is determined by the Content that is displayed by the current Content View - if applicable.

The Application is defined by ActionName property, and the actually invoked Application is determined using mechanisms of the Smart Application Model - that means the best fitting Application is selected according to Content path and permission settings. Please note, that this also affects the visibility of the ActionLinkButton control, that means the link won't show in cases when the Application does not exist or when the user does not have See permissions on it. You can read more on Application permission settings at the reference wiki of Application.

From version 6.3 Sense/Net ECMS provides a Client-side action framework for displaying actions in Javascript.

Properties

  • NodePath: the path of the context Content to be addressed by the rendered link. If ContextInfoID is also set it is a relative path to the context Content selected by the ContextInfo.
  • ContextInfoID: the ID of the ContextInfo control that defines the context Content to be addressed by the rendered link. Relative path to the defined Content can be set by NodePath property.
  • ActionName: name of the Action that determines the Application (ie.: 'Browse' or 'Edit'). An Action type name can also be given (see ActionTypeName Field configuration atApplication#Application configuration), as client side Actions do not have Applications present in the Content Repository.
  • IconName: name of the Icon to be displayed. If omitted, the Icon of the referred Action will be rendered. Icons reside in the /Root/Global/images/icons folder.
  • IconUrl: path of the Icon Content to be displayed. Overrides IconName property.
  • UseContentIcon: displays the icon of the target content (e.g. a Word document) instead of the action icon when set to true. Overrides IconName property. Default value is false.
  • ParameterString: custom url parameters can be provided for the Action link. The specified string may contain special tokens:
    • {PortletClientID}: the client ID of the container Context Bound Portlet that contains the ActionLinkButton control, if applicable (this parameter is used by batch Actions like CopyBatchAction, MoveBatchAction, etc. in the base system),
    • {CurrentContextPath}: the path of the current context Content. If a context bound portlet wraps the ActionLinkButton control, the token defines the context Content specified by the portlet, otherwise it is the context Content of the current page.
  • Parameters: (used from code): parameters can also be given from code via this property. Falls back to ParameterString property, if omitted.
  • IconVisible: hides the Action icon when set to false. Default is true, icon is rendered.
  • IconSize: specifies the icon size to be used when rendering the Action icon. Default is 16.
  • IncludeBackUrl: specifies if the current url should be passed as a backurl parameter when the rendered Action link is clicked. Default is true.
  • CheckActionCount: if set to true the ActionLinkButton placed in an ActionMenu control will only be clickable if the menu is displaying a single item. This is useful for example for the New scenario, when the title of the dropdown menu is a clickable ActionLinkButton itself, but it can only be clicked when the dropdown is empty or contains a single element. Thus when the menu contains several Content Types the New link cannot be clicked and the user can select a specific Content Type from the dropdown, instead of navigating to the Add Application without having a specific Content Type selected.
  • OverlayVisible: if set to true the icon of the action will display an overlay in the following cases: if the content is checked out or is pending for approval (Note: this feature is available from version 6.0.9).

Icon overlay

It is possible to display an overlay icon for the content if it is in a certain state. This feature is switched off by default and is available from version 6.0.9. It can be switched on by providing the OverlayVisible property of the ActionLinkButton control as seen in the Properties section. The currently available states are:

  • checked out to me
  • checked out to someone else
  • pending for approval
Overlay icons

Example/Tutorials

Example for using ContextInfo control to define context Content:

    <sn:ContextInfo runat="server" Selector="CurrentContext" UsePortletContext="true" ID="myContext" />
 
    <sn:ActionLinkButton ID="ActionLinkButton1" runat="server" IconUrl="/Root/Global/images/icons/16/edit.png" ActionName="Edit" 
Text="Edit" ContextInfoID="myContext" />

This next example shows how to create Action links with custom text:

   <sn:ActionLinkButton CssClass="sn-link" ActionName="Edit" ContextInfoID="ContextInfoContent" ID="EditLink" runat="server" IconVisible="False" >General settings (Name, Versioning, etc.)</sn:ActionLinkButton>

Example for passing custom parameter string to the invoked application. This Action link will navigate to the Add Application of the Content defined with NodePath parameter - the invoked Application will create a new Content of Sales_Workspace Content Type.

   <sn:ActionLinkButton runat="server" ActionName="Add" NodePath="/Root/Sites/Default_Site/workspaces/Sales" ParameterString="ContentTypeName=/Root/ContentTemplates/SalesWorkspace/Sales_Workspace" Text="Sales Workspace" />

Example for creating dynamic parameter strings:

   <sn:ActionLinkButton runat="server" ID="RestoreButton" ActionName="RestoreVersion" IconName="restoreversion" ContextInfoID="myContext" Text="Restore" ParameterString='<%# String.Concat("version=" + Eval("Version")) %>

Example for using tokens in parameter string. The invoked DeleteBatch Application will use the PortletClientID token to gather selected items of the list grid presented in the current portlet.

   <sn:ActionLinkButton runat="server" ActionName="DeleteBatch" ContextInfoID="myContext" Text="Delete selected..." ParameterString="{PortletClientID}" />

Another example for using tokens. The CurrentContextPath will be used by the invoked CopyAppLocal Application to define the destination path of the to Application to be copied. The Application to be copied is defined with context binding, as this Action link is placed in an asp:ListView control (see /Root/System/SystemPlugins/Portlets/ApplicationList/ApplicationList.ascx).

   <sn:ActionLinkButton runat="server" ActionName="CopyAppLocal" NodePath='<%# Eval("Path") %>' ParameterString="nodepath={CurrentContextPath}" Text="Copy local" />

Another example for using the CurrentContextPath parameter can be found in the prc.ascx, the control definition for the Portal Remote Control. Here the current Application page is invoked with its default Browse action and the current context Content is also passed, so that the Application page will display the current Content and won't be rendered empty:

   <sn:ActionLinkButton ID="BrowseApp" runat="server" ActionName="Browse" ContextInfoID="ContextInfoPage" ParameterString="context={CurrentContextPath}" CssClass="sn-prc-button sn-prc-toapplication" ToolTip="<%$ Resources: PortalRemoteControl, BrowseApp %>" IconVisible="false">Content mode</sn:ActionLinkButton>


Action links can also be created from code:

   var addLink = new ActionLinkButton
                     {
                         ActionName = "Add", 
                         NodePath = this.Model.Content.Path,
                         ParameterString = "StartDate=" + e.Day.Date,
                         IconVisible = false,
                         Text = "Add",
                         ToolTip = "Add new event for " + e.Day.Date.ToString("MMMM dd")
                     };
   this.Controls.Add(addLink);

Related links

References