Create your own BaseAction
When you need to create an action which is not anything like a DataEditor action, and requires a little more then simply embedding an application page, you should create a custom action which inherits from the abstract class Smartsite.Manager.BaseAction.
BaseAction
A BaseAction is the most basic type that can be used to create an action. Just implement the Execute method and build the html result as needed, see the example below.
| C# |  Copy Code | 
|---|---|
| using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Web;
using System.Xml.Linq;
 
namespace Smartsite.Manager.Actions
{
    internal class SmartsiteFeedback : BaseAction
    {
        /// <summary>
        /// Constructor
        /// </summary>
        internal SmartsiteFeedback()
        { }
 
        public override ActionResult Execute(MgrContext context)
        {
            if (HttpContext.Current.Request.Form["action"] == "close")
                return ActionResult.CloseAction();
 
            string html = FormParser.LoadForm("Smartsite.Manager.Source.Actions.SmartsiteFeedback.Center.xhtml");
            context.Response.Layout[ThreeColumnLayout.CenterColumn] = html;
  
            ButtonBar buttonBar = new ButtonBar();
            buttonBar.Buttons.Add(new Button("close", Translations.GetString("CLOSE"), "icon_sys22 icon-sys22-cancel", true));
            context.Response.Layout[ThreeColumnLayout.ButtonBar] = buttonBar.Render();
 
            return ActionResult.ActionCompleted();
        }
 
        public override string GetTabIdentifier(MgrContext context)
        {
            return "SMARTSITEFEEDBACK";
        }
    }
} | |
The html is loaded from an embedded resource, containing the following html:
| HTML |  Copy Code | 
|---|---|
| <div>
    <h2>{text:FEEDBACK_TITLE}</h2>
    <p>
        {text:FEEDBACK_DESC}
    </p>
    <button name="action" value="openform" class="btn icon_sys22 icon-sys22-ahead" style="margin-top:24px;" 
            onclick="window.open('http://www.smartsite.nl/?id=SMARTSITE-MANAGER-FEEDBACK-FORM'); return false;">{text:FEEDBACK_BTN}</button>
</div> | |
The FormParser.LoadForm() method will load this embedded resource and will find and replace {text:localization_string} placeholders with the correct localized string value.
When rendering a BaseAction, the ThreeColumnLayout is used by default.
 
       
       
       
      