Sunday 20 November 2011 2:44:59 pm - 8 replies
I need to move one node from the content tree to the top level nodes (so that it's on the same level as "Media", "Setup", "Users"...).
It seems like there's no was to do this from the admin interface. Any hints on how to do it?
Monday 21 November 2011 3:20:48 am
I think what you want to do is possible.
Be certain to backup your db before trying any of the following.
It's been a while but I believe I've done something like this before, at least for testing and I seem to remember it working. Though I seem to remember this not being a feature provided through the default administration UI.
First some history, Long ago the only way to customize the home node was using the "Swap node" content tree menu. Re: http://serwatka.net/blog/ez_publish_custom_root_node
Then along the way, a fellow shared a way to create a new top level node using sql queries. Re: http://ez.ryba.eu/index.php/ez_publish/lab/custom_top_level_nodes_is_that_possible_round_i_exploration
Then in a forum thread someone else shared a way to do this with a custom eZ Publish command line script. Re: http://share.ez.no/forums/general/creating-new-root-node
Update: I tested the cli script provided by Bjorn @xrow (updated to work with 4.4.0). It seemed to create a node that could be accessed by the content tree menu directly via a valid expected url alias.
I could create folders and other objects normally within the new top level folder. Though I could only access them through normal expected url aliases.
Here is the sources of my updated script. I ran this with 4.4.0 so it should work for 4.x+
Update: I have moved these improved script sources into github for easy usage,
I would imagine at this point you could very simply modify the above example script to move a content object tree node instead of creating one.
I took a little more time tonight and made 'move node to top level' script, it worked the best of all the other methods thus far ...
Update: I have moved the script to github to make maintaining it easier to use,
Also, now as I re-read your original request I see you wish to move an existing node to the top level so I would use the script I just created above instead of the other idea I found that follows next in my post...
(Older idea) I think of two solutions off the top of my head, create a new top level node and then swap with your existing node using the content tree menu in the admin.
If you prefer not to create any node first, I did see this helpful hint on how to force the content structure menu to use a different root node and allow you to control the contents of the top level.
I tested the advice shared in the above link and it worked perfectly. I was able to work with content in the top level directly. Note: Does not allow you to view top level via content/view/full module view.
I was able to create, store and use new nodes without problem in my newly created top level node.
Note: Was not able to create a custom top level node changing conteststructuremenu.ini settings.
While I was not able to create a top level node using the menu settings change trick it did get me thinking of a dirty work around to move an existing node into the top level. I have tested the following solution and it worked without problems. Simply move a node normally, navigate to the top level in the content tree, select the (with your mouse, clicking the) checkbox of the 'Home' node. Do not click submit ... yet. First inspect the checkbox you just checked with FireBug.
Change this value in the page source: '<input type="radio" name="SelectedNodeIDArray" value="2">'
To this value instead: '<input type="radio" name="SelectedNodeIDArray" value="1">'
Then after making this change submit your move browse parent node move form to the server.
Next the page will prolly redirect to a page which does not properly display the content tree, for me it was: /content/view/full/1
Then to validate the move was completed successfully I went to the node directly via: /content/view/full/240842
It seems that nodes moved with the above described FireBug hack do not get their node urls updated as I found I could not access the node directly using the expected url of:
Rather the older url alias upon creation, http://admin/node_180169/node_240842
I was able to create child contents like folders here without problems ...
But anything I created here I could not access through nice url aliases directly only through /content/view/full module view access.
So there may be other sideaffects at play ... I'm not sure I trust nodes with bad url aliases very much though ... so the FireBug Hack may not be a good thing to do overall.
In any case ... with your newly created top level node using any one of the above referenced methods you can add admin siteaccess ini settings which displays a new tab to your new top level node, in much the same way the content structure tab works.
Guide to settings to create a tab: http://share.ez.no/layout/set/print/learn/ez-publish/creating-custom-admin-modules-views#eztoc523915_5_7_7
Example settings of the top menu entry for content structure tab
Here is an example menu.ini.append.php ini settings override file content I think you could / would need for this use case to provide a top menu entry to your custom top level node in the admin
#[MenuContentSettings] # This list contains the identifiers of the classse # that are allowed to be shown in top menues # only use if needed, provided as a reference # TopIdentifierList=customfolder # TopIdentifierList=customtoplevelfolder [TopAdminMenu] # This list contains menuitems of the top menu in admin interface Tabs=customcontent [Topmenu_customcontent] URL URL[default]=content/view/full/4400 URL[browse]=content/browse/4400 NavigationPartIdentifier=ezcontentnavigationpart #Name=Custom Content structure #Tooltip=Manage the main content structure of the site. Enabled Enabled[default]=true Enabled[browse]=true Enabled=false Shown Shown[default]=true Shown[navigation]=true Shown[browse]=true PolicyList=2
One final note this evening. I merely make reference to existing solutions for this use case I've used before.
Sadly I did not have time to test the above myself with the latest community build (hint, use 2011.09 i hear it's better and be certain to backup your db before trying any of this) before publishing here.
I did find an existing issue on this topic but it is very old, http://issues.ez.no/6313
This would be an interesting area to see a pull request completed for this feature.
I hope this helps ...
Modified on Monday 21 November 2011 10:17:05 am by // Heath
Monday 21 November 2011 9:57:42 am
I took a bit more time to collect the above scripts together into example extension to provide the tools to create or move top level nodes via the command line.
I have published the above described solution (and example command line scripts) into a github project repository and eZ Publish command line script extension.
Feel free to suggest further improvements to this extension.
We put this together rather quickly so it is still a bit basic in terms of features.
I hope this helps ....
Sunday 27 November 2011 5:17:49 pm
I'm pleased you like our work.
Though I must say, we think of the tools in toplevelnode extension as developer tools and not user tools, since command line tools are much targeted towards a different kind of users with more experience aka developers.
We are presently seeking furthur feedback regarding the tools and docs related to the toplevelnode extension and we thank you for yours! This helps us a lot!
Also I think that for a roadmap feature request to truly succeed the tools provided by this extension (and corresponding forum thread) then the core of eZ Publish would need to be changed via pull request.
The system could be changed to ... based on current user role policy permissions (which should allow for this in some way), allow user to create and change aspects not currently allowed by the existing functionality yet required for use in top level root node customization.
This is just how we see the problem at hand today.
This pull would need to alter the aspects of the system which limit use of and functionality available when working with top level nodes (root nodes).]
We think that the above described would be much more user friendly and helpful to regular, normal users. In general customers should be able to work with root nodes the same as any other nodes.
Before creating a roadmap feature request. I would really like to hear from more users in support of the described improvements to the core of eZ Publish. This is your chance eZ Community to speak up and be heard! What do you think?
I hope this helps ...
You must be logged in to post messages in this topic!