Treeview for nested set in admin area

296 views
Skip to first unread message

pulse00

unread,
Jan 11, 2010, 9:37:59 AM1/11/10
to diem-users
Hi all,

is there a recommended, or built-in way, to display a nested set as a
tree in the admin area (ie like on the pages tab on the left side) ?

Thanks!

-robert

Robert Gruendler

unread,
Jan 14, 2010, 10:15:22 AM1/14/10
to diem-users
if this kind of view is not available in diem yet, i'd be happy to
contribute a plugin for this use case.


-robert

On Jan 11, 3:37 pm, pulse00 <r.gruend...@gmail.com> wrote:
> Hi all,
>

> is there a recommended, or built-in way, to display anestedset as a

ornicar

unread,
Jan 14, 2010, 10:22:41 AM1/14/10
to diem-users
Hi

Theire is currently no Diem plugin to display a nested tree with a
tree interface.
I'd be glad if you work on it, and I'm ready to help you.

Diem already uses the jsTree jQuery plugin to display tree.
I'm waiting for the 1.0 release (few time after jQuery 1.4) to rethink
the way I use it and probably allow ordering pages with it.

4levels

unread,
Jan 31, 2010, 4:54:43 PM1/31/10
to diem-users
Hi Thibault,

any updates on this issue? I'm currently also in need of a tree
display in the admin generator. I've enabled the NestedSet behaviour
and manually set all the root, lft, rgt and level columns to the
correct values but this is quite a drag to do and to reorganise ;-) A
nice tree view would be of great help (ORDER BY root ASC, lft ASC),
maybe this can be added to the already existing sort option in the
admin generator?

Kind regards and keep up the great work!

Zernao

unread,
Feb 28, 2010, 4:53:48 AM2/28/10
to diem-users
Interesting proposition:

http://redotheoffice.com/?tag=doctrine-drag-drop-admin-generator-symfony-nestedset


On 31 jan, 22:54, 4levels <4lev...@gmail.com> wrote:
> Hi Thibault,
>
> any updates on this issue?  I'm currently also in need of a tree
> display in the admin generator.  I've enabled the NestedSet behaviour

> and manually set all the root, lft,rgtand level columns to the

Vitaly Alyokhin

unread,
Feb 28, 2010, 5:51:48 AM2/28/10
to diem-...@googlegroups.com
not sortable... you cant sort childs in node, you can only drag childs from node to node.

Zernao

unread,
Feb 28, 2010, 6:09:31 AM2/28/10
to diem-users
Ok, but having this kind of interface in Diem for tree (i.e. for
categories) would be nice (even not sortable) instead of setting
manually left, right, level.

jaime

unread,
Mar 2, 2010, 10:58:01 AM3/2/10
to diem-users
I also need to handle trees (nested set) in the admin.

It would be great if someone done a plugin.

Thanks!

vitalik

unread,
Mar 4, 2010, 11:16:54 AM3/4/10
to diem-users
I also need this plugin :)
And would be nice if it support generate tree of pages in front as
component

Vitaly Alyokhin

unread,
Mar 4, 2010, 2:11:09 PM3/4/10
to diem-...@googlegroups.com
I've found only one jQuery plugin which presents html-table as tree.
http://ludo.cubicphuse.nl/jquery-plugins/treeTable/doc/index.html#example-1

It can drag-n-drop items between nodes, but.. it cant reorder items inside node.
If we could hack this, we could make an plugin for maintaining nested-sets from backend.

jaime

unread,
Mar 12, 2010, 3:38:38 PM3/12/10
to diem-users
Is someone working on a plugin for this??

I would like to help...

On Mar 4, 4:11 pm, Vitaly Alyokhin <228...@gmail.com> wrote:
> I've found only one jQuery plugin which presents html-table as tree.http://ludo.cubicphuse.nl/jquery-plugins/treeTable/doc/index.html#exa...

Vitaly Alyokhin

unread,
Mar 12, 2010, 5:43:47 PM3/12/10
to diem-...@googlegroups.com
help.. ok :)
please show me jQuery plugin which can reorder by drag-n-drop html-table as multinode tree.
(I did'n find such even in ExtJs)
you see, there's no problem to work with nested-set in Doctrine, problem in JS.


2010/3/12 jaime <jaim...@gmail.com>

Erik Van Kelst

unread,
Mar 12, 2010, 7:44:47 PM3/12/10
to diem-...@googlegroups.com
Hi,

Have you checked the way Diem does this in the admin? Under the Tools section there's a menu to change the pages SEO content wich hase already a drag and drop interface and a Js grid as well! That should definitely give you some answers how to achieve this..

Greets!

Erik



Van: Vitaly Alyokhin <228...@gmail.com>
Verzonden: vrijdag 12 maart 2010 23:43
Aan: diem-...@googlegroups.com
Onderwerp: Re: [diem-users] Re: Treeview for nested set in admin area

Vincent Jousse

unread,
Mar 13, 2010, 3:48:39 AM3/13/10
to diem-...@googlegroups.com
Le 12/03/10 23:43, Vitaly Alyokhin a écrit :
Sympal is using this jQuery plugin : http://code.google.com/p/nestedsortables/

4levels

unread,
Mar 15, 2010, 7:06:04 AM3/15/10
to diem-users
Hi Diem Team,

could you be so kind to explain how you did the very nice list display
in the Admin SEO->Pages->Manage pages?
This is truly amazing and I'm really in need of something similar for
a nested set of product categories...

Since it is already in the admin it must be possible to achieve this
on other models, right?

Keep up the great work!

Erik

On Mar 13, 9:48 am, Vincent Jousse <vjou...@gmail.com> wrote:
> Le 12/03/10 23:43, Vitaly Alyokhin a �crit :> help.. ok :)


> > please show me jQuery plugin which can reorder by drag-n-drop
> > html-table as multinode tree.
> > (I did'n find such even in ExtJs)
> > you see, there's no problem to work with nested-set in Doctrine,
> > problem in JS.
>

> > 2010/3/12 jaime <jaimes...@gmail.com <mailto:jaimes...@gmail.com>>

Vitaly Alyokhin

unread,
Mar 15, 2010, 4:01:52 PM3/15/10
to diem-...@googlegroups.com
I'm not diem-team, but now i've dig into Diem code, and found custom admin module located
/var/www/diem/dmAdminPlugin/modules/dmPage

I'll try to re-use it for other model.

About Sympal plugin with tree:
there's no sorting in list, it onnly show records as tree, you can move element inside tree by edit record. It is minimal functionality and it cant be implemented in Diem by small manipulation in admin :)

Vitaly Alyokhin

unread,
Mar 19, 2010, 7:57:54 AM3/19/10
to diem-...@googlegroups.com

smadja.sarah

unread,
Apr 22, 2010, 1:33:37 PM4/22/10
to diem-users
hi everybody,

I'm new with diem and i try to found a solution for nested set in
admin. I tested all the solution but without success...
is anybody have another way ?

thanks !


On 19 mar, 11:57, Vitaly Alyokhin <228...@gmail.com> wrote:
> Guys, look at this:http://forum.diem-project.org/viewtopic.php?f=2&t=40&p=119#p119


--
Subscription settings: http://groups.google.com/group/diem-users/subscribe?hl=en
Message has been deleted
Message has been deleted

4levels

unread,
Jun 8, 2010, 10:02:15 AM6/8/10
to diem-users
Hi,

please, Thibault, we beg you to explain the awesome tree
implementation on the admin seo/manage_pages module ;-)
I found out you're using a custom view class to achieve this:
dmCorePlugin/lib/view/html/dmPageTreeView.call.php

It looks like this class can be extended to use another model (instead
of the dmPage model) by overriding the getRecordTree() and
getRecordTreeQuery() methods, but I can't seem to figure it out how to
do this in an admin module: I need to set custom templates etc. etc.
This is a really cool implementation, could you write a short tutorial
on how to get this right?

Thanks a million man, I'm dying to get this in my categories admin
modules..

Erik

4levels

unread,
Jun 8, 2010, 10:20:40 AM6/8/10
to diem-users
Hi Thibault,

could you also elaborate on how to handle nested sets with pages?
Right now I have a nested set model Category with page:true in
modules.
The pages however are not automatically listed as a nested set in the
PAGES pane on the right: they are just listed below each-other,
without taking into account the nestedSet behaviour.

How is this handled with the other pages? Is it because I'm using
hasManyRoots?
I've tried changing the slug to reflect the tree structure but as
expected this doesn't change the actual nesting ;-)
I'm sure the lft, rgt, level and root_id's are set correctly.

This would really be a great feature: to have the pages follow the
nestedSet behavior of the corresponding model.

I see there's a very similar issue on Github (
http://github.com/diem-project/diem/issues/issue/42 ) , is this really
planned for 5.2? I'm so waiting for this ;-)

Thx again for the amazing Diem!

Erik

thibault

unread,
Jun 8, 2010, 10:48:08 AM6/8/10
to diem-...@googlegroups.com
I don't think the Diem page tree will ever be capable to synchronize properly with a nested set model. I already tried it, it's incredibly complex. Diem will just generate a flat tree, ignoring the nested set.
I'm sorry but don't expect it to be fixed in 5.2.

Evgeny Sinitsyn

unread,
Jun 8, 2010, 12:51:37 PM6/8/10
to diem-...@googlegroups.com
Hi all, 

Let me put my 2 cents in your discussion.

I think Thibault is right! No need to sync nested models with pages. But no need to make flat tree, ignoring nested behaviour of the model.

Here is my suggestion (imho): 
Extend option "page: true". For example it may consist of such options:
page: normal | big | nested

Normal - normal behaviour, like now.
Big and nested - not normal. When we set this options each time a record  is added a page is created (normal), but we can not view this page of record directly through PAGES panel, only through additional modal window. Modal window apears when we clicking on the contextual parent of all records (like blog page for article model in the tutorial). This modal window contain list (for example like grid on the plugins page of Diem website) or nested tree of records. In this modal window we can manage (sort, find, navigate...) our records.

Let me explain by example:
I have Product model (name, price, quantity, etc).
Suppose that I have 1000+ of products ( and the same number of pages). And now I have a very big issue - I can not manage all my product pages - it is hard to find and it is really hard to render for my browser. When I set option "page: big" then I'll have nice modal dialog with "ajaxed" paginated list of my products with "ajaxed" search.

So I hope you understand my suggestion.





2010/6/8 thibault <thibault....@gmail.com>

4levels

unread,
Jun 8, 2010, 3:46:00 PM6/8/10
to diem-users
Hi Thibault,

as the pages tree is already a nested set, isn't it possible by
combining both sets into eachother?
I'm thinking of trying this out, is it the dm:sync-pages task who
handles the tree creation?
I'll have a look at it, to me it seems quite possible to find a way of
adding / merging both nested trees..

Keep up the greater works!

Erik
> 2010/6/8 thibault <thibault.duples...@gmail.com>
>
> > I don't think the Diem page tree will ever be capable to synchronize
> > properly with a nested set model. I already tried it, it's incredibly
> > complex. Diem will just generate a flat tree, ignoring the nested set.
> > I'm sorry but don't expect it to be fixed in 5.2.
>
> > On 8 June 2010 16:20, 4levels <4lev...@gmail.com> wrote:
>
> >> Hi Thibault,
>
> >> could you also elaborate on how to handle nested sets with pages?
> >> Right now I have a nested set model Category with page:true in
> >> modules.
> >> The pages however are not automatically listed as a nested set in the
> >> PAGES pane on the right: they are just listed below each-other,
> >> without taking into account the nestedSet behaviour.
>
> >> How is this handled with the other pages?  Is it because I'm using
> >> hasManyRoots?
> >> I've tried changing the slug to reflect the tree structure but as
> >> expected this doesn't change the actual nesting ;-)
> >> I'm sure the lft, rgt, level and root_id's are set correctly.
>
> >> This would really be a great feature: to have the pages follow the
> >> nestedSet behavior of the corresponding model.
>
> >> I see there's a very similar issue on Github (
> >>http://github.com/diem-project/diem/issues/issue/42) , is this really

thibault

unread,
Jun 8, 2010, 3:54:57 PM6/8/10
to diem-...@googlegroups.com
dmPageSynchronizer creates, moves and deletes the pages according to user records. It manipulates the DmPage model.
dmSeoSynchronizer updates pages metas like slugs and titles. It manipulates the DmPageI18n model.

Feel free to play with them. I spent lots of time testing and implementing them. It's quite complex, as you will see.
I think I won't do that again for Diem 6.

4levels

unread,
Jun 8, 2010, 4:58:50 PM6/8/10
to diem-users
Hi Thibault,

I think I found a half-working solution already:
In the admin/seo/pages reorder module I cannot drag auto-generated
pages around. Regular pages are draggable though and I can eg. drag
the signin page on one of the autogonenerated pages and this works as
expected! Even a project refresh keeps the signin page were it was,
that is under an auto-generated page...

I temporary disabled the rel="auto" in the admin page tree for auto
generated pages so I can drag them around as regular pages. I can
reorder them successfully and the PAGES pane in the front reflects
this flawlessly. However, as soon as I refresh the admin page (F5)
things start to change. A full project refresh resets everything. So
if there could be a way of preserving the custom page structure during
the refresh, this would really do! After all we want the pages to be
reordered. Having the model's nested set in the page tree
automatically would be even nicer, but as you mentioned this doesn't
go easy.

I'm further digging in, looks like I'll have to go deep ;-)
I'll keep you posted..

Kind regards,

Erik

4levels

unread,
Jun 8, 2010, 5:56:07 PM6/8/10
to diem-users
Ok, I can correct the above as follows:
Only a project refresh resets the nestedSet, as the autogenerated
pages are removed and re-created in the dmPageSynchronizer
Seems like I made some faulty drag & drops in the page tree causing it
to change after a regular refresh with F5.

Is there a way of not removing all autogenerated pages but only the
ones that are no longer there? And new pages could be added at the
bottom, ready to be reordered manually?

This is becoming a real challenging task, and since you already put so
much effort in it, I feel like it's really worth giving a try!

thibault

unread,
Jun 9, 2010, 6:06:10 AM6/9/10
to diem-...@googlegroups.com
What happens when you create a new record that must have a show page ?

If the record has no parent module, Diem will look for the record list page, and puts the new page inside. For example a category page will go in the categ list page.
If the record has a parent module, Diem finds the record parent page, and puts the new page inside. For example an article page will go in the article categ show page.

Having 4 articles in 2 categs gives the following page tree:
categ_list
  categ_show
    article_show
    article_show
  categ_show
    article_show
    article_show

If your article model is a nestedset, Diem will ignore it and continue to place each article page in each article category page.

And Diem does not remove and recreate show pages. It only creates and deletes them when necessary, and move them when necessary. For example if you change the category of an article, it moves the article page to the new category page.

Does it bring some light?

Erik Van Kelst

unread,
Jun 9, 2010, 8:11:49 AM6/9/10
to diem-...@googlegroups.com
Hi Thibault,

thanks for the reply.  The current  behaviour is perfect, I'm just considering the following: the parent records are a nested set itself.  Consider the example below:

categ_list
  categ_show
    categ_show
      article_show
    categ_show
      article_show
      article_show

or with real things

food:
  fruits:
    apple:
      JonaGold
      Granny Smith
      Red Delicious
    orange:
      Blood orange
      Navel orange
  grain:
    Maize
    Rice:
      long-grain:
        Basmati
      modified:
        Golden rice
    Wheat
   
I've created a new topic in the forum as I feel this email tread is becoming too large ;-)
Please have a look at it here: http://forum.diem-project.org/posting.php?f=4&t=108

Kind regards,

Erik

Erik Van Kelst

unread,
Jun 9, 2010, 8:20:14 AM6/9/10
to diem-...@googlegroups.com
Hi Thibault,

you say Diem doesn't remove and recreate the show pages, but how come a project refresh causes the tree to be flattened even without adding pages or changing existing ones?

I was under the impression that the show pages all got removed by the methods removeShowPages() & removeModuleShowPagesRecursive() in the dmPageSynchronizer class..

Erik

thibault

unread,
Jun 9, 2010, 8:25:25 AM6/9/10
to diem-...@googlegroups.com
They are removed if they need to. Look at how is managed the $pageIsUseless var : it's true if
- the page record no more exists
- the record has no parent record that has a page

The page is removed only if one of these conditions is true.

Erik Van Kelst

unread,
Jun 9, 2010, 9:25:04 AM6/9/10
to diem-...@googlegroups.com
Hi Thibault,

yet I see the custom ordered tree degrading (as mentioned in the forum topic that I started as this thread seems to become too hughe ;-) -> http://forum.diem-project.org/viewtopic.php?f=4&t=108
It takes 3 project refreshes to make the tree flat again (without adding records or changing anything else).
Let me explain step by step:
1. I do a dm:setup --clear-db and load a sample 2 level deep tree as fixtures
2. I do a projectRefresh in the admin
3. I disabled the rel="auto" attribute as explained before so I can drag & drop the category pages and set their nesting as wanted.
4. Now the pages are exactly as I want.  In the PAGES tree they look good, only the ManageMeta's tab in the seo/pages module doesn't render them correctly.  I can do a dm:setup on the commandline, everything remains ok.
5. I do 1 projectRefresh: the most nodes have moved to flat, but some nesting still exists.
6. I do another projectRefresh: now the parent nodes contain at most 1 leaf
7. a 3rd projectRefresh gives me a completely flat tree again and this remains.

So to me it seems as if some removing / re-building occurs in the dmPageSynchronizer.  I find no other way of explaining the above..  I also corrected the typo in the dmPageSynchronizer class (Github issue 267), just to make sure that's not causing this.

Sorry if I'm paining your ass with this, I'm just trying to get this right :-s

Erik

thibault

unread,
Jun 9, 2010, 9:56:47 AM6/9/10
to diem-...@googlegroups.com
I answer in the forum, so.
Just notice that I already fixed #267.

4levels

unread,
Jun 13, 2010, 1:21:25 PM6/13/10
to diem-users
Hi Folks,

have a look at this forum topic: I managed to incorporate the tree
sorting as seen in admin/seo/pages for all models with a NestedSet
behaviour. The only limitation is that you can't use the hasManyRoots
option yet.

http://forum.diem-project.org/viewtopic.php?f=4&t=108

Erik

4levels

unread,
Jun 13, 2010, 4:24:56 PM6/13/10
to diem-users
Update:

hasManyRoots is now possible too!
To summarize: NestedSet models get a Sort tree links (as the
DmSortable behaviour) which brings you to a jstree where you can
drag'n'drop your models around. All this without any external plugins
or special setup's.

I hope to see my forked Diem merged into the main branch!

Erik

Bruno Prieto Reis

unread,
Jul 9, 2010, 1:48:28 PM7/9/10
to diem-users
Hi,

Is this already merged?

Thanks
> > > reordered.  Having the model'snestedsetin the page tree
> > > automatically would be even nicer, but as you mentioned this doesn't
> > > go easy.
>
> > > I'm further digging in, looks like I'll have to go deep ;-)
> > > I'll keep you posted..
>
> > > Kind regards,
>
> > > Erik
>
> > > On Jun 8, 9:46 pm, 4levels <4lev...@gmail.com> wrote:
>
> > > > Hi Thibault,
>
> > > > as the pages tree is already anestedset, isn't it possible by
> > > > combining both sets into eachother?
> > > > I'm thinking of trying this out, is it the dm:sync-pages task who
> > > > handles the tree creation?
> > > > I'll have a look at it, to me it seems quite possible to find a way of
> > > > adding / merging bothnestedtrees..
>
> > > > Keep up the greater works!
>
> > > > Erik
>
> > > > On Jun 8, 6:51 pm, Evgeny Sinitsyn <cuh...@gmail.com> wrote:
>
> > > > > Hi all,
>
> > > > > Let me put my 2 cents in your discussion.
>
> > > > > I think Thibault is right! No need to syncnestedmodels with pages. But no
> > > > > need to make flat tree, ignoringnestedbehaviour of the model.
>
> > > > > Here is my suggestion (imho):
> > > > > Extend option "page: true". For example it may consist of such options:
> > > > > page: normal | big |nested
>
> > > > > Normal - normal behaviour, like now.
> > > > > Big andnested- not normal. When wesetthis options each time a record  is
> > > > > added a page is created (normal), but we can not view this page of record
> > > > > directly through PAGES panel, only through additional modal window. Modal
> > > > > window apears when we clicking on the contextual parent of all records (like
> > > > > blog page for article model in the tutorial). This modal window contain list
> > > > > (for example like grid on the plugins page of Diem website) ornestedtree
> > > > > of records. In this modal window we can manage (sort, find, navigate...) our
> > > > > records.
>
> > > > > Let me explain by example:
> > > > > I have Product model (name, price, quantity, etc).
> > > > > Suppose that I have 1000+ of products ( and the same number of pages). And
> > > > > now I have a very big issue - I can not manage all my product pages - it is
> > > > > hard to find and it is really hard to render for my browser. When Iset
> > > > > option "page: big" then I'll have nice modal dialog with "ajaxed" paginated
> > > > > list of my products with "ajaxed" search.
>
> > > > > So I hope you understand my suggestion.
>
> > > > > 2010/6/8 thibault <thibault.duples...@gmail.com>
>
> > > > > > I don't think the Diem page tree will ever be capable to synchronize
> > > > > > properly with anestedsetmodel. I already tried it, it's incredibly
> > > > > > complex. Diem will just generate a flat tree, ignoring thenestedset.
> > > > > > I'm sorry but don't expect it to be fixed in 5.2.
>
> > > > > > On 8 June 2010 16:20, 4levels <4lev...@gmail.com> wrote:
>
> > > > > >> Hi Thibault,
>
> > > > > >> could you also elaborate on how to handlenestedsets with pages?
> > > > > >> Right now I have anestedsetmodel Category with page:true in
> > > > > >> modules.
> > > > > >> The pages however are not automatically listed as anestedsetin the
> > > > > >> PAGES pane on the right: they are just listed below each-other,
> > > > > >> without taking into account the nestedSet behaviour.
>
> > > > > >> How is this handled with the other pages?  Is it because I'm using
> > > > > >> hasManyRoots?
> > > > > >> I've tried changing the slug to reflect the tree structure but as
> > > > > >> expected this doesn't change the actual nesting ;-)
> > > > > >> I'm sure the lft, rgt, level and root_id's aresetcorrectly.
>
> > > > > >> This would really be a great feature: to have the pages follow the
> > > > > >> nestedSet behavior of the corresponding model.
>
> > > > > >> I see there's a very similar issue on Github (
> > > > > >>http://github.com/diem-project/diem/issues/issue/42) , is this really
> > > > > >> planned for 5.2? I'm so waiting for this ;-)
>
> > > > > >> Thx again for the amazing Diem!
>
> > > > > >> Erik
>
> > > > > >> On Jun 8, 4:02 pm, 4levels <4lev...@gmail.com> wrote:
> > > > > >> > Hi,
>
> > > > > >> > please, Thibault, we beg you to explain the awesome tree
> > > > > >> > implementation on the admin seo/manage_pages module ;-)
> > > > > >> > I found out you're using a custom view class to achieve this:
> > > > > >> > dmCorePlugin/lib/view/html/dmPageTreeView.call.php
>
> > > > > >> > It looks like this class can be extended to use another model (instead
> > > > > >> > of the dmPage model) by overriding the getRecordTree() and
> > > > > >> > getRecordTreeQuery() methods, but I can't seem to figure it out how to
> > > > > >> > do this in an admin module: I need tosetcustom templates etc. etc.
Reply all
Reply to author
Forward
0 new messages