Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Nov 24, 2010 @ 17:22
    Richard Soeteman
    0

    Umbraco 4.5 Tree action open a document

    Hi all,

    For the first time I'm creating a custom action for a 4.5 tree and I want to do this in the prefered way. I need to open a page in the ContentFrame. Thought parent.UmbClientMgr.mainTree().changeContentFrameUrl might be usefull for this, but so far I get No errors and No page is loading. Below you find the source I wrote.

    Does anybody knows what I'm doing wrong or does anybody knows where I can find some good info

    Thanks,

    Richard

     

     

    //create singleton

     

     

    private static readonly OpenAssociatedDocType _instance = new OpenAssociatedDocType();

     

     

    private OpenAssociatedDocType() { }

     

     

    public static OpenAssociatedDocType Instance

    {

     

     

    get { return _instance; }

    }

    #region

     

     

    IAction Members

     

     

    public char Letter

    {

     

     

    get

    {

     

     

    return 'À';

    }

    }

     

     

    public string JsFunctionName

    {

     

     

    get

    {

     

     

    return "OpenDocType()";

    }

    }

     

     

    public string JsSource

    {

     

     

    get

    {

     

     

    return "function OpenDocType(){parent.UmbClientMgr.mainTree().changeContentFrameUrl('/johndoe.aspx');} ";

    }

    }

     

     

    public string Alias

    {

     

     

    get

    {

     

     

    return "Open Associated DocType";

    }

    }

     

     

    public string Icon

    {

     

     

    get

    {

     

     

    return string.Format(".sprDummy' style='background: transparent url({0}) center center no-repeat", umbraco.GlobalSettings.Path + "/images/umbraco/settingDatatype.gif");

    }

    }

     

     

    public bool ShowInNotifier

    {

     

     

    get

    {

     

     

    return true;

    }

    }

     

     

    public bool CanBePermissionAssigned

    {

     

     

    get

    {

     

     

    return false;

    }

    }

    #endregion

    }

    }

     
  • Tom Fulton 2030 posts 4998 karma points c-trib
    Nov 24, 2010 @ 19:12
    Tom Fulton
    0

    Hi Richard,

    I think the javascript function is just:  parent.UmbClientMgr.contentFrame('/johndoe.aspx');

    -Tom

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Nov 24, 2010 @ 20:49
    Tom Fulton
    0

    FYI, I also found you can use the .NET wrapper of the API to do the same thing, which (might) be even more of a preferred way :)

    get { return "function OpenDocType(){" + umbraco.BasePages.ClientTools.Scripts.ChangeContentFrameUrl("/janedoe.aspx") + "}"; }
  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Nov 25, 2010 @ 10:22
    Richard Soeteman
    0

    HI Tom,

    Massive thanks for your replies. I needed to post the NodeId also, so I went for a complete Javascript String instead of using the ClientTools. Got it working now using the following code:

     

     

    public string JsFunctionName

    {

     

     

    get

    {

     

     

    return "OpenDocTypeHandler();";

    }

    }

     

     

    public string JsSource

    {

     

     

    get

    {

     

     

    return "function OpenDocTypeHandler(){UmbClientMgr.contentFrame('" + umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/handlers/OpenAssociatedDocType.ashx?nodeid='+UmbClientMgr.mainTree().getActionNode().nodeId)}";

    }

    }

     

     Quick tip for anybody that wants to pass the Id of the menu node. You can retrieve this by UmbClientMgr.mainTree().getActionNode().nodeId

    Thanks again,

    Richard

Please Sign in or register to post replies

Write your reply to:

Draft