Action window template

by: Anders Hattestad

The action window is a place where you can put a variety of functionality into. The cool part about it is that you can have it open and click around in edit mode and have you action window app display relevant information about where you are. But I had to try some technics to find out actually which page and what language it was on..Did look around after some documention, but didn't find anything (didn't look very long thou). The solution is very easy and didn't need any references to private or internal properties or classes :)

Maybe this have been posted a lot of places, but maybe someone can use this and save some search time:)

The usercontrol you create have to add a event listener like this.

protected void Page_Load(object sender, EventArgs e)
{
    if (this.CurrentPage == null)
    {
        Heading.Text = "No page";
        if (!base.IsPostBack)
            ScriptManager.Current.AddEventListener(
                this.Page, 
                EventType.Load, 
                "function() { onNavigate(window.top.latestNavigate); }");
    }
    else
    {
        Heading.Text = CurrentPage.PageName + " (" + CurrentPage.LanguageID + " " + CurrentPage.PageLink + ")";
    }
}

And then the markup has to have some javascript stuff where this part is declared.

function onCommand(newCommand)
{
    switch(newCommand.command)
    {
        case "systempagenavigate":
        case "newlanguagebranch":
            UpdatePageLink(null,newCommand.data);
            break;
        case "pageupdated":
            UpdatePageLink(newCommand.data,null);
            break;
    }
}
function UpdatePageLink(newPageLink,newLang)
{
    if (newPageLink)
        document.forms[0]['<%=CurrentPageLink.ClientID %>'].value=newPageLink;
    if (newLang)
        document.forms[0]['<%=CurrentPageLang.ClientID %>'].value=newLang;
    document.forms[0].action = 'ActionWindow.aspx?plugin=<%=Request.QueryString["plugin"]%>';
    <%=Page.GetPostBackClientEvent(RefreshButton,"")%>
}

The result

image 
 

Download

24 February 2009


Comments

  1. I had to override the OnLoad event to get the load to fire rather than using the Page_Load signature. It also seems to break when you click on the recycle bin - something tot do with the language code...
  2. I am completely new to EPiServer. This was of great use for me .What is window.open.latesNavigate ? Thank you very very much....
  3. Thats a javascript function that EPiServer has :)
Post a comment    
User verification Image for user verification  
EPiTrace logger