Action window template
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
Download
24 February 2009