ActionMenu

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

Overview

The ActionMenu control is a user control that displays a list of Action links for a specific Content in a dropdown menu.

ActionMenu control

Details

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

  • if ContextInfo control is present (via ContextInfoID parameter) it determines the context,
  • if ContextInfo is not present, the value of the NodePath parameter selects the context.

The ActionMenu control resolves Actions via scenario types, which means that custom scenario implementations may affect the rendered list of Action links.

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 menu.
  • ContextInfoID: the ID of the ContextInfo control that defines the context Content to be addressed by the rendered menu.
  • Scenario: Actions of the given Action#Scenarios will be rendered. Scenario keywords are given in the Application configuration. If empty, no Action links will be rendered.
  • ScenarioParameters: custom url parameters can be provided for the Action links. The specified string may contain special tokens:
    • {PortletID}: the ID of the container Context Bound Portlet that contains the ActionLinkButton control, if applicable
  • CheckActionCount: if set to true the control checks the count of the contained Actions (default is false):
    • in the case of the new scenario the dropdown menu is never visible, only the contained control / text (ie. an ActionLinkButton control pointing to the Add Application,
    • otherwise, if there are no Actions in the dropdown, the whole menu is hidden.
  • RequiredPermissions: a ',' or ';' separated list containing required permissions on the context Content. In case the current user does not have the given permissions on the Content, the menu is hidden.
  • IconName: name of the Icon to be displayed. Icons reside in the /Root/Global/images/icons folder.
  • IconUrl: path of the Icon Content to be displayed. Overrides IconName property.
  • WrapperCssClass: a custom css class that is rendered in the html markup of the menu.
  • ItemHoverCssClass: css class for the hovered Action link. Default is ui-state-hover.
  • Mode: the rendered menu will get a custom css class of the form sn-actionmenu-<MODE>-mode. Built-in css stylesheets do not use this property. Possible values are (default is Default):
    • Default
    • Text
    • Link
    • Split
  • OverlayVisible: if set to true the icon of the action menu 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 ActionMenu 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 on how to use ActionMenu with ContextInfo:

   <sn:ContextInfo runat="server" Selector="CurrentWorkspace" ID="workspaceContext" />
   <sn:ActionMenu id="WorkspaceActions" ContextInfoID="workspaceContext" runat="server" Scenario="WorkspaceActions" 
Text="Workspace Actions" IconName="wizard" />

Example on how to create a custom Action menu for a list of Content dynamically (see /Root/Global/renderers/ArticleList.ascx).

<%@ Import Namespace="SenseNet.Portal.Helpers" %>
 
<div class="sn-article-list sn-article-list-shortdetail">
    <%foreach (var content in this.Model.Items)
      { %>
 
        <div class="sn-article-list-item">
            <% if (Security.IsInRole("Editors")) { %>
             <div class="sn-content-actions"><%= Actions.ActionMenu(content.Path, "Manage Content", "ListItem")%></div>
            <%} %>
            <h2 class="sn-article-title"><a href="<%=Actions.BrowseUrl(content)%>"><%=content.DisplayName %></a></h2>
            <small class="sn-article-info">Published by: <%= content["Author"] %> on <%= content["ModificationDate"]%></small>
            <div class="sn-article-lead">
                <%=content["Lead"] %>
            </div>
        </div>
 
    <%} %>
</div>

Example for using the NodePath property (see /Root/Global/renderers/CalendarView.ascx).

   <sn:ActionMenu NodePath='<%# Eval("Path") %>' runat="server" Scenario="ListItem" Text="Manage event" />

Example for using a custom ActionLinkButton control inside the menu (as the title element) - see /Root/System/SystemPlugins/ListView/MiniFrame.ascx.

   <sn:ActionMenu ID="ActionMenu1" runat="server" Scenario="New" ContextInfoID="myContext" RequiredPermissions="AddNew" CheckActionCount="True">
      <sn:ActionLinkButton ID="ActionLinkButton1" runat="server" ActionName="Add" IconUrl="/Root/Global/images/icons/16/newfile.png" 
ContextInfoID="myContext" Text="New" CheckActionCount="True"/>
   </sn:ActionMenu>

Related links

References