Copied to clipboard

Flag this post as spam?

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


  • Brecht Demeurisse 3 posts 23 karma points
    Mar 04, 2010 @ 13:21
    Brecht Demeurisse
    0

    Navigation between pages

    I am currently working in a custom section with custom tree. Each of the nodes of the tree has a aspx page linked to in the content area. I was wondering if it was possible to create a link on an aspx page that links to another page already in the tree (and that node should be selected).

    Kind regards

  • Lee Kelleher 4026 posts 15837 karma points MVP 13x admin c-trib
    Mar 04, 2010 @ 13:48
    Lee Kelleher
    0

    Hi Brecht, welcome to Our Umbraco!

    As far as I know, no you can't do that in the current version of Umbraco (v4.0.3) ... that's not a definite no, as there's probably a really clever way to do it using jQuery?

    The app tree has been completely changed in the next version (v4.1 - due to be released soon) ... which should provide a better API to interface with ... so it should be easier to do what you want here.  I don't have any API details ... maybe someone else on the forum knows more?

    If this is for a package, then I'd recommend holding off until v4.1 is release (or at least develop against the beta 2 version) ... if it's in-house for your company, just keep in mind that if you upgrade to v4.1, extra work will be required.

    Cheers, Lee.

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Mar 04, 2010 @ 13:49
    Dirk De Grave
    1

    Hi Brecht,

    Have a look at Richard's content maintenance package (from the project section - it comes with source code)  which features a dashboard control that has this functionality (linking from a control to a page in the content tree). Altho I'm not sure if you can create a link to a page in another section??

    Cheers,

    /Dirk

  • Tim 225 posts 690 karma points
    Mar 04, 2010 @ 14:08
    Tim
    2

    Hi,

    This will take you to the desired item in the content tree, where id is the content item you want to edit:

    /umbraco/umbraco.aspx?rightAction=editContent&id=1234

    It's a little wonky in some browsers so I ended up rolling my own version:

    I created a new dashbood item called root.ascx and added it to the dashboard config file:

      <section>
    <areas>
    <area>default</area>
    </areas>
    <tab caption="Welcome">
    <control>/usercontrols/dashboards/root.ascx</control>
    </tab>
    </section>

    Then in the codebehind of the root.ascx I added the following:

            protected void Page_Load(object sender, EventArgs e)
    {
    var clientScriptManager = Page.ClientScript;
    string qsFunction = @"
    function getQueryString(targetLocation) {
    var assoc = new Array();
    var queryString = unescape(targetLocation.search.substring(1));
    var keyValues = queryString.split('&');
    for (var i in keyValues) {
    var key = keyValues[i].split('=');
    assoc[key[0]] = key[1];
    }
    return assoc;
    }
    ";
    clientScriptManager.RegisterClientScriptBlock(GetType(), "qsHelper", qsFunction, true);

    string jumpFunction = @"
    if(getQueryString(parent.location)['j2n'] != '' && getQueryString(parent.location)['j2n'] != undefined)
    parent.tree.openContent(getQueryString(parent.location)['j2n']);
    ";
    clientScriptManager.RegisterClientScriptBlock(GetType(), "jumpeToNode", jumpFunction, true);
    }

    You can then link to a content item like this:

    /umbraco/umbraco.aspx?j2n=1378

    This selects the node in the tree and allows it to be edited.

    T

     

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Mar 04, 2010 @ 14:10
    Dirk De Grave
    0

    Tim, sounds like a nice solution, does it also work when working from a custom section, and jumping to the content section from there?

     

    Cheers,

    /Dirk

  • Brecht Demeurisse 3 posts 23 karma points
    Mar 04, 2010 @ 14:21
    Brecht Demeurisse
    0

    First of all, thx for the quick response.

    I may have formulated my problem a bit wrong. I don't mean to link to the 'content' section but to another aspx page in my custom section as well. just displayed on the right side of the screen (which i called content). So basicly I have:

    root
    --page1
    --page2
    --page3

    and from page1 i want to make a link to page 3 (with page3 selected).

  • Tim 225 posts 690 karma points
    Mar 04, 2010 @ 14:51
    Tim
    0

    I've not tried it in another section but theoretically it would work.

    May need to mod this to be whatever is called on click in a custom tree:

    parent.tree.openContent()

    I'll give it a test!

    T

  • Tim 225 posts 690 karma points
    Mar 04, 2010 @ 15:08
    Tim
    1

    had a quick dig and I think the script I have provided will work with any tree.

    You just would need to replace:

    parent.tree.openContent()

    With the relevant call in the tree you would like to open for example for a media node

    parent.tree.openMedia()

    Another thing to fix would be jumping to the correct section first, but you can deeplink into a section by using this url:

    /umbraco/umbraco.aspx#media

    The final hurdle is that you would need to add the usercontrol to the dashboard area you were linking to, so for the media example like this:

      <section>
       
    <areas>
         
    <area>media</area>
       
    </areas>
       
    <tab caption="Welcome">
         
    <control>/usercontrols/dashboards/root.ascx</control>
       
    </tab>
     
    </section>

    If I get 5 mins I'll do some tests and see if I can work all this up. If you manage to get it working in the meantime, let me know!

    T

    
    
    
  • Brecht Demeurisse 3 posts 23 karma points
    Mar 04, 2010 @ 16:04
    Brecht Demeurisse
    0

    thx, that's what i needed

  • Tim 225 posts 690 karma points
    Mar 04, 2010 @ 16:10
    Tim
    0

    Hi Brecht,

    Did you get it working? Would be useful to know.

    If it works don't forget to accept the answer!

    T

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies