Adding property to node that shows its parent nodes
Hi,
I want to add a property to my document type that shows the nodes parent nodes, so basically if I have got a node called Testing sitting in the following structure:
Summer 2008 >Editorials >Poems >Testing
I want a property that will show Summer\editorials\poems within Umbraco backend. You may wonder why I need this because I can see in the folder structure where the document sits in the content section but if I am using a search tool such as the Content Maintenance Dashboard http://our.umbraco.org/projects/content-maintenance-dashboard-package to find the node then I have no way of knowing where the node sits within the structure of my website. Any suggestions on this one?
Don't think adding a property would help a lot? A tool such as the content maintenance dashboard does not show that info, unless you fiddle around with the code. So, if you like to get full path to your content node, start customizing Richard's code to also show the complete path to the content node.
So I couldn't add some sort of custom property that will show the full path of a node? I know it wouldn't show in the content maintenance system but when I clicked on the node it would show?
I'm not sure whether I understand that last question? Maybe it's time to give us some insight on what to accomplish? Have a detailed use case scenario?
Document already has a Parent property which you can check recursively to find all the parents.
I believe that Node has the same property as well, if not from Node you can use the Path property which is a comma separated string of the parent hierachy
What I am doing is creating a comments section using doc2form, when someone adds a comment on the website it creates an unpublished child node under the page for which the comment was left. I am going to use the content maintenance add-on so that the umbraco user can search for all unpublished comments within Umbraco and then approve them by publishing them, this will work fine but the only problem is when they view a comment they will have no idea what page the comment refers to hence it would be nice to have a property for the node that at the very least showed it full path so they know which page it was left on.
I think the best solution would be to update Richard's package with a flag for 'show parent content'. The issue seems to be in the content maintenance package, not umbraco itself.
I'd contact Richard and inquire about this. Or, since the code is available, make the change yourself.
When the Umbraco user actually clicks on the node that is found by the content maintenance package then is shows the node in Umbraco so that you can edit it or publish it etc, I don't think this is part of the content maintenance package, the content maintenance package is just used to find the node in the first place therefore the change would need to be in umbraco. So if we forget the content maintenance package completely, is it possible to have a document type that has a property that shows the full path? i.e. when you click on the node in umbraco on the right hand side under one of the tabs there is a property that shows for example home > sub section > sub folder > articles
Well, there's the 'simple' way and the 'custom' way.
The 'simple' way is to look at the Properties tab and you'll see the URL for the comment. Well, if the comment is published. Which is isn't at this point so that's a no-go in your specific scenario.
The 'custom' way would be to add a property to the docType and populate it with the data you want to display to the umbraco user. This might be a textfield that contains a breadcrumb type path. Or possibly the bodyText of the parent. What makes this 'custom' is that you would populate it's value with an event handler triggered by the 'create' action.
Yes the second option is exactly what I am looking for, the problem is I don't know how to create the custom property which is why I asked this question in the first place, I assume I will have to create a new Datatype but how I create one that lists the the url to the parent node is beyond me.
Peter,
No it doesn't seem to reload the node in the left hand side, I am using the content mainentance add-on to display the node in the first place so I am not looking for it through the content section.
I would add a docType property with the following settings: Name: Breadcrumb Alias: breadcrumb Type: Textstring
I'd put the breadcrumb on its own tab so that it won't get displayed to visitors when you use Doc2Form.
Then, you'd create an event handler that fires when this kind of docType (that is, the docType alias) is created. The event might simply show the niceUrl() of the parent node, for instance.
Thanks Peter and Douglas, I do not know ASP.net at all so I am going to struggle with this but I will give it a go. How do I find what the code is to show the niceUrl of the parent node? And also how do I make it output the result of that code to the new textstring document property I have created?
Thanks Peter and Douglas, I do not know ASP.net at all so I am going to struggle with this but I will give it a go. How do I find what the code is to show the niceUrl of the parent node? And also how do I make it output the result of that code to the new textstring document property I have created?
Ok, I have just found that if I add the Content Management add-on to the Content section by modifying dashboard.config then it does in fact do what Peter says and refreshs the left hand panel to show where the selected node is in the Content tree. This may be an easier solution for me to implement because it doesn't involve me trying to learn how to modify the source code in ASP.
Cool! If that's a suitable solution, no need to get to learn .NET ;)
Also, you would not need to give your users access to the Developer-section. The Content-section and media would be enough then, no chance of people 'accidentally' messing up the templates and stuff.
I had actually created a new Umbraco section in the backend called Comments that I had added the Content Maintenance part to, it showed up on the right hand side and worked fine but of course on the left hand side there was nothing there except a folder that said [comments]. Ideally I would like to use this new section and have the Content tree show up on the left hand side and show the node that had been selected like it does when the Content Maintenance add-on is in the Content section, is there a simple way to do this, I assume I would need to copy whatever code etc makes the Content section work to my new Comments section then add the Content Maintenance part to the Comments section by modifying dashboard.config? So really I am asking how can I make a copy of the Content section? Where is the code I will need to copy to my Comments section to make it behave like the Content one?
You added that section by adding a row to the umbracoApp-table right? Not tried this, but you could try to fill the appInitWithTreeAlias with the same value as the content-section.
If that doesn't work, you might need to add a row to the umbracoAppTree as well.
As said, haven't tried this myself, but I think that's the place to start ;)
Hmm, can't seem to get any joy with this, I have tried adding the following to UmbracoApp:
9
comments
comments.gif
Indhold
content
And I have added the following to UmbracoAppTree:
True
True
9
comments
comments
Indhold
.sprTreeFolder
.sprTreeFolder_o
umbraco
loadContent
NULL
But no joy, the comments section still shows only a folder called [comments] in the left hand pane. Also in the process I seem to have screwed up the Content section because that now just says Content with two sub folders called Content and does not show any of my pages (I even restored my database from Fridays backup but still can't get rid of this issue, very strange)!
Ok well I'm not quite sure how or why this has just happened but I just modified the Content Maintenance dll and resaved it to the bin folder (this was for a different reason, I was just trying to test modifying my first user control!) and now everything seems to work, the content section now shows the content and so does the comment section. Why would that have happened, did the new dll force the site to reload something which fixed everything???
That probably forced an application-restart which caused the tables to be loaded from the DB again. Didn't know that was necessary, but glad it worked :)
Ok well thank you for all your help, I now have it working how I want, just to clarify I have created a new section in the Umbraco backend that is called Comments, this section is a copy of the Content section but I have added a modified version of the Content Maintenance add-on to the right hand side, the modified version searchs for any nodes that have a document type of "Comment" and are unpublished (my comments doc2form creates a comment but does not publish it). You can then click on one of the comments and the left hand pane will refresh to show where the node sits in the content tree, the user can then publish the comment if they approve of it and click back on the Comments section to once again show the list of unpublished comments.
@Doug A breadcrump datatype, what a great Idea :).
@Peter. The tree isn't updated all the time. I think 4.1 will solve that issue.
@All I will update the content maintenance package with some extra functionality like moving and filter by node options, so you can filter by a certain parent. The first version was just helping me delete nodes that I've imported using umbImport.
Can anyone suggest to me about moorpark property management because all of you are talking about property and all that.if anyone suggest me about this property type then i would be much pleased of them.
Adding property to node that shows its parent nodes
Hi,
I want to add a property to my document type that shows the nodes parent nodes, so basically if I have got a node called Testing sitting in the following structure:
Summer 2008
>Editorials
>Poems
>Testing
I want a property that will show Summer\editorials\poems within Umbraco backend. You may wonder why I need this because I can see in the folder structure where the document sits in the content section but if I am using a search tool such as the Content Maintenance Dashboard http://our.umbraco.org/projects/content-maintenance-dashboard-package to find the node then I have no way of knowing where the node sits within the structure of my website. Any suggestions on this one?
Hi,
Don't think adding a property would help a lot? A tool such as the content maintenance dashboard does not show that info, unless you fiddle around with the code. So, if you like to get full path to your content node, start customizing Richard's code to also show the complete path to the content node.
Hope this helps.
Regards,
/Dirk
So I couldn't add some sort of custom property that will show the full path of a node? I know it wouldn't show in the content maintenance system but when I clicked on the node it would show?
I'm not sure whether I understand that last question? Maybe it's time to give us some insight on what to accomplish? Have a detailed use case scenario?
Cheers,
/Dirk
Document already has a Parent property which you can check recursively to find all the parents.
I believe that Node has the same property as well, if not from Node you can use the Path property which is a comma separated string of the parent hierachy
What I am doing is creating a comments section using doc2form, when someone adds a comment on the website it creates an unpublished child node under the page for which the comment was left. I am going to use the content maintenance add-on so that the umbraco user can search for all unpublished comments within Umbraco and then approve them by publishing them, this will work fine but the only problem is when they view a comment they will have no idea what page the comment refers to hence it would be nice to have a property for the node that at the very least showed it full path so they know which page it was left on.
I think the best solution would be to update Richard's package with a flag for 'show parent content'. The issue seems to be in the content maintenance package, not umbraco itself.
I'd contact Richard and inquire about this. Or, since the code is available, make the change yourself.
cheers,
doug.
When the Umbraco user actually clicks on the node that is found by the content maintenance package then is shows the node in Umbraco so that you can edit it or publish it etc, I don't think this is part of the content maintenance package, the content maintenance package is just used to find the node in the first place therefore the change would need to be in umbraco. So if we forget the content maintenance package completely, is it possible to have a document type that has a property that shows the full path? i.e. when you click on the node in umbraco on the right hand side under one of the tabs there is a property that shows for example home > sub section > sub folder > articles
Well, there's the 'simple' way and the 'custom' way.
The 'simple' way is to look at the Properties tab and you'll see the URL for the comment. Well, if the comment is published. Which is isn't at this point so that's a no-go in your specific scenario.
The 'custom' way would be to add a property to the docType and populate it with the data you want to display to the umbraco user. This might be a textfield that contains a breadcrumb type path. Or possibly the bodyText of the parent. What makes this 'custom' is that you would populate it's value with an event handler triggered by the 'create' action.
Make sense?
cheers,
doug.
Maybe a dumb remark here, but if you edit a page, isn't the tree on the left-side reloaded with the complete path?
Hi Douglas,
Yes the second option is exactly what I am looking for, the problem is I don't know how to create the custom property which is why I asked this question in the first place, I assume I will have to create a new Datatype but how I create one that lists the the url to the parent node is beyond me.
Peter,
No it doesn't seem to reload the node in the left hand side, I am using the content mainentance add-on to display the node in the first place so I am not looking for it through the content section.
Ah, now I get it!
You could fill that custom property using an event-handler perhaphs? Richard Soeteman did a nice article about that a while ago:
http://www.richardsoeteman.net/CommentView,guid,f470b6cf-40da-4aa9-a0d9-7b984fe9bf59.aspx
I would add a docType property with the following settings:
Name: Breadcrumb
Alias: breadcrumb
Type: Textstring
I'd put the breadcrumb on its own tab so that it won't get displayed to visitors when you use Doc2Form.
Then, you'd create an event handler that fires when this kind of docType (that is, the docType alias) is created. The event might simply show the niceUrl() of the parent node, for instance.
Event handlers are pretty easy to create. Here are some links to get you started.
http://our.umbraco.org/wiki/reference/api-cheatsheet/using-applicationbase-to-register-events
http://our.umbraco.org/wiki/reference/api-cheatsheet/using-applicationbase-to-register-events/event-examples
http://umbraco.org/documentation/books/creating-and-using-an-action-handler (from umbraco v3, theories still apply)
cheers,
doug.
Thanks Peter and Douglas, I do not know ASP.net at all so I am going to struggle with this but I will give it a go. How do I find what the code is to show the niceUrl of the parent node? And also how do I make it output the result of that code to the new textstring document property I have created?
Thanks Peter and Douglas, I do not know ASP.net at all so I am going to struggle with this but I will give it a go. How do I find what the code is to show the niceUrl of the parent node? And also how do I make it output the result of that code to the new textstring document property I have created?
Ok, I have just found that if I add the Content Management add-on to the Content section by modifying dashboard.config then it does in fact do what Peter says and refreshs the left hand panel to show where the selected node is in the Content tree. This may be an easier solution for me to implement because it doesn't involve me trying to learn how to modify the source code in ASP.
Cool! If that's a suitable solution, no need to get to learn .NET ;)
Also, you would not need to give your users access to the Developer-section. The Content-section and media would be enough then, no chance of people 'accidentally' messing up the templates and stuff.
Glad you figured it out!
I had actually created a new Umbraco section in the backend called Comments that I had added the Content Maintenance part to, it showed up on the right hand side and worked fine but of course on the left hand side there was nothing there except a folder that said [comments]. Ideally I would like to use this new section and have the Content tree show up on the left hand side and show the node that had been selected like it does when the Content Maintenance add-on is in the Content section, is there a simple way to do this, I assume I would need to copy whatever code etc makes the Content section work to my new Comments section then add the Content Maintenance part to the Comments section by modifying dashboard.config? So really I am asking how can I make a copy of the Content section? Where is the code I will need to copy to my Comments section to make it behave like the Content one?
You added that section by adding a row to the umbracoApp-table right? Not tried this, but you could try to fill the appInitWithTreeAlias with the same value as the content-section.
If that doesn't work, you might need to add a row to the umbracoAppTree as well.
As said, haven't tried this myself, but I think that's the place to start ;)
Hmm, can't seem to get any joy with this, I have tried adding the following to UmbracoApp:
And I have added the following to UmbracoAppTree:
But no joy, the comments section still shows only a folder called [comments] in the left hand pane. Also in the process I seem to have screwed up the Content section because that now just says Content with two sub folders called Content and does not show any of my pages (I even restored my database from Fridays backup but still can't get rid of this issue, very strange)!
Ok well I'm not quite sure how or why this has just happened but I just modified the Content Maintenance dll and resaved it to the bin folder (this was for a different reason, I was just trying to test modifying my first user control!) and now everything seems to work, the content section now shows the content and so does the comment section. Why would that have happened, did the new dll force the site to reload something which fixed everything???
That probably forced an application-restart which caused the tables to be loaded from the DB again. Didn't know that was necessary, but glad it worked :)
Ok well thank you for all your help, I now have it working how I want, just to clarify I have created a new section in the Umbraco backend that is called Comments, this section is a copy of the Content section but I have added a modified version of the Content Maintenance add-on to the right hand side, the modified version searchs for any nodes that have a document type of "Comment" and are unpublished (my comments doc2form creates a comment but does not publish it). You can then click on one of the comments and the left hand pane will refresh to show where the node sits in the content tree, the user can then publish the comment if they approve of it and click back on the Comments section to once again show the list of unpublished comments.
@Doug A breadcrump datatype, what a great Idea :).
@Peter. The tree isn't updated all the time. I think 4.1 will solve that issue.
@All I will update the content maintenance package with some extra functionality like moving and filter by node options, so you can filter by a certain parent. The first version was just helping me delete nodes that I've imported using umbImport.
Cheers,
Richard
Can anyone suggest to me about moorpark property management because all of you are talking about property and all that.if anyone suggest me about this property type then i would be much pleased of them.
is working on a reply...