Where is FlattenedHierarchyItem class?

Where is FlattenedHierarchyItem class?

This question has suggested answer(s)

Trying to build a custom widget extension and I would like to use the class "FlattenedHierarchyItem" that is referenced in FlattenHierarchy method in the $core_v2_utility Widget Extension.  Where does this class sit?  How can I access it in back end code?  

All Replies
  • I'd use linq to do this  e.g. http://stackoverflow.com/questions/1938409/linq-how-to-convert-the-nested-hierarchical-object-to-flatten-object

  • I was looking to take two lists consisting of FlattenedHierarchyItems and merging them together.  I had intended to use the $core_v2_utility.FlattenHierarchy to flatten both the lists before passing them to a custom widget extension to merge the two lists together.  Is this possible or would I need to recreate the functionality for "flattening" the hierarchy on the back end as suggested above?

  • Hi sthaynes,

    I'm afraid that method doesn't accomplish what you're looking for. I believe this is why Alex Crome recommended Ling as an alternative. The FlattenHierarchy function is a very specialized method for a particular use case, Wiki table of contents. I believe Alex's suggestion is better in most general cases.

    Regards,

    Zac Elsik

  • Actually, I am working with the wiki table of contents.  I am looking for a way to merge toc's from two different wiki's into one toc.  Do I really need to recreate the flattened hierarchy or is this possible?

  • It is not clear to me why I have to re-invent the wheel in order to accomplish the merging of two wiki toc's.  I was hoping that there was another way to merge the two lists.  As it stands this question has not been answered...

  • If the goal is a single Hierarchal list, why use 2 Wikis at all?  If you use 1 Wiki then you do not need to customize anything

  • Also I am not sure why you need to access that item in code at all.  Why not just get the pages for both wikis and merge them into a single list and pass the merged list in like the existing toc (I believe this can all be done in the widget without custom code)?

  • Thank you Patrick for responding.  The use of two wiki's has to do with making select information available to a certain group in one wiki and making all of the information from both wiki's available to another group that maintains the content for both.  The goal is to make it easier for the maintainence team to make changes in one place.  It's a permissions thing and is a bit complex.  I have already tried to do the merge without custom code, i.e. velocity and jquery, but the problem comes in when there are identical pages in both the wiki toc's.  If a current page is selected/expanded, I have to traverse the tree and make sure I merge the children and handle all duplicates from the top down.  Not sure if I explained that right but I have tried what you suggested above and it is very messy and hard to do when working with hierarchical structures.  Do you have any other suggestions?

  • Wikis are not meant to be hierarchal globally, meaning the hierarchy is meant to be within a Wiki(though the underlying data could work).
     
    Why not just add to TOCs, 1 for each Wiki in a custom widget?
     
     
    Patrick Mason
    Development Lead- Extensibility
    o: 214.420.1329
    telligent.com
     
    From: sthaynes [mailto:bounce-sthaynes@communities.telligent.com]
    Sent: Thursday, January 10, 2013 9:40 AM
    To: discussion_evolution@communities.telligent.com
    Subject: RE: [Telligent Evolution Platform Discussion] Where is FlattenedHierarchyItem class?
     

    Thank you Patrick for responding.  The use of two wiki's has to do with making select information available to a certain group in one wiki and making all of the information from both wiki's available to another group that maintains the content for both.  The goal is to make it easier for the maintainence team to make changes in one place.  It's a permissions thing and is a bit complex.  I have already tried to do the merge without custom code, i.e. velocity and jquery, but the problem comes in when there are identical pages in both the wiki toc's.  If a current page is selected/expanded, I have to traverse the tree and make sure I merge the children and handle all duplicates from the top down.  Not sure if I explained that right but I have tried what you suggested above and it is very messy and hard to do when working with hierarchical structures.  Do you have any other suggestions?

  • SampleCombinedTOC-Widget.zip

    I attached a sample widget to get you started.... it combines 2 page sets into the flattened hierarchy.   You will have to fix the javascript to account for multiple wikis so that all the collapsing works.  Its also hard coded to 2 wiki Ids.

    That being said.... this isn't much different than putting 2 TOC widgets on a page.

  • Patrick thanks again.  I already tried something similar and I am running into a problem with duplicate or identical pages and the current selected page.  Your code did give me another idea but it still does not address the issue with identical pages.  That is where I am getting stuck.  Here is an example:

    It looks like this

    ---------------------

    Page 1

    Page 2

    Page 3 (resides in wiki 1)

       Page Child 1 (wiki 1)

    Page 3 (resides in wiki 2)

       Page Child 1 (wiki 2)

           Page Child 1 Child (selected, wiki 2)

    Page 4

    I need to merge both Page 3 and their kids into 1.

    I want this:

    ---------------

    Page 1

    Page 2

    Page 3 (resides in wiki 1)

       Page Child 1

           Page Child 1 Child (selected, wiki 2)

    Page 4

  • Ok this is where I am not understanding…  what do you mean by duplicate pages?   Same Name?  Same Name and Body?
     
    If they are 2 different pages in different wikis(regardless of content) then they aren’t technically duplicates since they have no relation to each other internally. Matching on title is fragile since that is user generated and editable.
     
    It may help me to understand the overall use case here but in reality it looks like you are going to have to roll your own solution as previously mentioned by Alex, the APIs are not meant to work this way
    Patrick Mason
    Development Lead- Extensibility
    o: 214.420.1329
    telligent.com
     
    From: sthaynes [mailto:bounce-sthaynes@communities.telligent.com]
    Sent: Thursday, January 10, 2013 12:43 PM
    To: discussion_evolution@communities.telligent.com
    Subject: RE: [Telligent Evolution Platform Discussion] Where is FlattenedHierarchyItem class?
     

    Patrick thanks again.  I already tried something similar and I am running into a problem with duplicate or identical pages and the current selected page.  Your code did give me another idea but it still does not address the issue with identical pages.  That is where I am getting stuck.  Here is an example:

    It looks like this

    ---------------------

    Page 1

    Page 2

    Page 3 (resides in wiki 1)

       Page Child 1 (wiki 1)

    Page 3 (resides in wiki 2)

       Page Child 1 (wiki 2)

           Page Child 1 Child (selected, wiki 2)

    Page 4

    I need to merge both Page 3 and their kids into 1.

    I want this:

    ---------------

    Page 1

    Page 2

    Page 3 (resides in wiki 1)

       Page Child 1

           Page Child 1 Child (selected, wiki 2)

    Page 4

  • Thanks Patrick.  I decided to develop some custom code to handle duplicate pages based on Title from the back end and it seems to be doing exactly what I need.  Again, thank you for your suggestions.

  • sthaynes,

    Glad you found a resolution to your problem.