Copied to clipboard

Flag this post as spam?

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


  • Yannick Smits 321 posts 718 karma points
    Mar 29, 2011 @ 13:59
    Yannick Smits
    0

    How to manage "'Relate Document On Copy" relation

    When you copy a (set of) node(s) you have the option to "'Relate Document On Copy". Afterwards there is no easy way to view the relations or to add relations to other pages. I tried to use the MultiPicker relations datatype for that but it doesn't seem to be able to edit existing relations. So how would I go and edit this document relation? Is there a datatype for that or am I missing something with the ucomponents approach?

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Mar 29, 2011 @ 14:07
    Jeroen Breuer
    1

    Did you read this blog? http://blog.hendyracher.co.uk/umbraco-relation-api/ Guess you could create your own datatype that works with the api.

    Jeroen

  • Yannick Smits 321 posts 718 karma points
    Mar 29, 2011 @ 14:10
    Yannick Smits
    1

    Yes I read that blog, used it to create the Language Switcher razor script. Before I write a datatype that does that I want to make sure nobody else did it already.

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Mar 29, 2011 @ 15:00
    Hendy Racher
    0

    Hi Yannick,

    The MultiPicker Relations datatype is used to wire up multipickers to relation types - so when a multipicker is changed, relations are created / deleted (this can be useful for reverse lookups).

    We've been working on updating remote multipickers when using a bidirectional RelationType but that's not ready yet, but I'm guessing this would be similar to what you want as well... the two options seem to be:

    1) have the MultiPicker Relations event handler update remote multipickers and set their csv / xml values

    2) update multipickers so that they can directly create the relations and use this as their datastore

    Btw, the source on CodePlex for the Relations Types package allows relations to be viewed - don't suppose you want to collaborate on this project (or the above) and help update it so that relations can also be created / deleted ?

    Cheers,

    Hendy

     

  • Yannick Smits 321 posts 718 karma points
    Mar 29, 2011 @ 15:33
    Yannick Smits
    0

    thanks for the reply Hendy! I haven't looked too much into the multipicker so not sure how that works or how it could help me. Easiest option which you don't seem to mention is to create a new datatype that would handle retrieving and storing of the relation based on the document it is on. What about this pseudo code, would that work?

        public partial class RelatedNodes : System.Web.UI.UserControl, IUsercontrolDataEditor
        {
    
            [DataEditorSetting("Childnodes", type = typeof(umbraco.editorControls.ultimatepicker.ultimatePickerDataType))]
            public List<int> ChildNodes { get; set; }
    
            public void Page_Load(object sender, EventArgs e)
            {
                if (!Page.IsPostBack)
                {
    
                    ChildNodes = (List<int>)value;
                }
            }
    
            public object value
            {
                get
                {
                    return SqlHelper.ExecuteReader("SELECT childid FROM umbracoRelation WHERE parentId = @nodeid");
                }
                set
                {
                    foreach (int node in ChildNodes) {
                        SqlHelper.ExecuteNonQuery("INSERT INTO umbracoRelation SET (parentid=@nodeid,childid=@childid,reltype=1,datetime=getdate()")
                        }
                }
            }
        }
  • Yannick Smits 321 posts 718 karma points
    Mar 29, 2011 @ 16:06
    Yannick Smits
    0

    Hendy, I just had a look at the code of both your projects but they look way to complicated for me to be able to contribute to it unfortunately.

    What do you mean exactly with your 1st point? update remote multipickers? What is a remote multipicker?

  • Yannick Smits 321 posts 718 karma points
    Apr 05, 2011 @ 14:08
    Yannick Smits
    0

    bump

Please Sign in or register to post replies

Write your reply to:

Draft