Notification editor Portlet

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


Notification editor portlet.png
Notification editor Portlet is responsible for editing a notification subscribed by the user or creating a new notification.


The portlet creates an edit view for the notification defined by the ContentPath and optionally by the UserPath URL parameters. If it gets no UserPath parameter, the notification of the current user will be queried. If no such subscription exists, a new notification and an empty view will be created.

Please note the you can only edit your own notifications or you got to have Save permission for the user who's notification you are planing to edit


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
View Path ContentViewPath Repository path Path of the .ascx user control which provides the elements of the portlet
Renderer Renderer Repository path Select an XSLT renderer for rendering portlet output
Custom CSS class(es) SkinPreFix text When set portlet container div appends extra css class(es)

for Portal builders

Content View

<%@ Control Language="C#" AutoEventWireup="true" Inherits="SenseNet.Portal.UI.SingleContentView" %>
<%@ Register Assembly="SenseNet.Portal" Namespace="SenseNet.Portal.UI.Controls" TagPrefix="sn" %>
<% var targetContent = SenseNet.ContentRepository.Content.Load(this.Content["ContentPath"] as string); %>
<div class="sn-content-inlineview-header ui-helper-clearfix">
    <%= targetContent == null ? string.Empty : SenseNet.Portal.UI.IconHelper.RenderIconTag(targetContent.Icon, null, 32)%>
    <div class="sn-content-info">
        <h2 class="sn-view-title"><%= targetContent == null ? "Unknown content" : targetContent.DisplayName %></h2>
        <strong>Path:</strong> <%= this.Content["ContentPath"] %>
<% if (!string.IsNullOrEmpty(this.Content["UserEmail"] as string)) {  %>
    <sn:ShortText ID="UserEmail" runat="server" FieldName="UserEmail" ControlMode="Browse" />
<% } %>
<sn:DropDown ID="DrpDwnFrequency" runat="server" FieldName="Frequency" />
<sn:Boolean ID="BoolIsActive" runat="server" FieldName="IsActive" />
<sn:DropDown ID="DrpDwnLang" runat="server" FieldName="Language" />
<div class="sn-panel sn-buttons">
    <% if (!string.IsNullOrEmpty(this.Content["UserEmail"] as string)) {  %>
        <asp:Button ID="BtnSave" runat="server" CssClass="sn-submit" Text="Save" />
    <%} else { %>    
        <span class="sn-error"><%= GetGlobalResourceObject("Notification", "MissingEmailAddressError")%></span>
    <% } %>
    <sn:BackButton ID="BackButton" runat="server" class="sn-submit" Text="Cancel" />  

In the default Content View placed in /Root/System/SystemPlugins/Notifications/NotificationEditor.ascx, there are some customized functions. If the user has not set his/her e-mail address, the view will hide the e-mail label and the Save button and show an error message to ask the user to fill the e-mail address field on the profile page. Otherwise, the e-mail address will be displayed above the between the display name of the content and other setting fields.

Note that you cannot use the familiar CommandButtons control because the context of the view is not a stored content, but a dynamic content and it is not fully supported by the CommandButtons yet. Instead, there is a standard ASP Button bound by the Save action and a SN BackButton which plays the role of Cancel button.

There must be an ASP Button with "BtnSave" ID on your view so that the Save button work properly.

Related links