Discussion:
[xwiki-users] How to list the subspace under the space?
Nithya Vembu
2010-05-24 19:17:10 UTC
Permalink
Hi All,

Currently i am working in xwiki and facing some issues which i am not able
to solve. I want to create a tree structure for the space and subspace and
the pages inside it.

Eg : I am creating

Space Name : HelloMajor, Parent : nothing (by default it takes WebHome)
Page Name : HelloMajorPage1 : Parent : HelloMajor
Page Name : HelloMajorPage2 : Parent : HelloMajorPage1

If i use document tree its displaying like

HelloMajor
|___ HelloMajorPage1
|____HelloMajorPage2

Another space creation : HelloMinor; Parent : HelloMajor.WebHome
Page Name : HelloMinorPage Parent : HelloMinor
Now i want to display the tree structure like this

HelloMajor
|___ HelloMajorPage1
| |____HelloMajorPage2
|___HelloMinorPage
|____HelloMinorPage


I want to display the subspace under the related space itself. I tried with
child parent snippets but it didnt worked. As i explored i didnt get the
solution to get the parent of the subspace. Normally in db its storing under
XWD_Parent field in xwiki_doc table. I would like to give the subspace name
as parameter so that i can get the parent name which i mean is
"HelloMajor.WebHome".

My requirement is to build a tree structure. I tried with space explorer,mk
tree, document tree and spaceAllDocs. No one fitting my requirement.

*Spacename
* Subspacename
* subspacepages
* SpacePages

In this manner i want to display. IS there any solution.

Kindly help me.

Thanks in advance.

Regards,
Nithya.Vembu.
--
View this message in context: http://xwiki.475771.n2.nabble.com/How-to-list-the-subspace-under-the-space-tp5095367p5095367.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
Guillaume Lerouge
2010-05-25 08:14:58 UTC
Permalink
Hi,
Post by Nithya Vembu
Hi All,
Currently i am working in xwiki and facing some issues which i am not able
to solve. I want to create a tree structure for the space and subspace and
the pages inside it.
Eg : I am creating
Space Name : HelloMajor, Parent : nothing (by default it takes WebHome)
Page Name : HelloMajorPage1 : Parent : HelloMajor
Page Name : HelloMajorPage2 : Parent : HelloMajorPage1
If i use document tree its displaying like
HelloMajor
|___ HelloMajorPage1
|____HelloMajorPage2
Another space creation : HelloMinor; Parent : HelloMajor.WebHome
Page Name : HelloMinorPage Parent : HelloMinor
Now i want to display the tree structure like this
HelloMajor
|___ HelloMajorPage1
| |____HelloMajorPage2
|___HelloMinorPage
|____HelloMinorPage
I want to display the subspace under the related space itself. I tried with
child parent snippets but it didnt worked. As i explored i didnt get the
solution to get the parent of the subspace. Normally in db its storing under
XWD_Parent field in xwiki_doc table. I would like to give the subspace name
as parameter so that i can get the parent name which i mean is
"HelloMajor.WebHome".
My requirement is to build a tree structure. I tried with space explorer,mk
tree, document tree and spaceAllDocs. No one fitting my requirement.
*Spacename
* Subspacename
* subspacepages
* SpacePages
At this time XWiki doesn't support nested spaces. However you can achieve
this:

* Space
* Page
* SubPage

Guillaume

In this manner i want to display. IS there any solution.
Post by Nithya Vembu
Kindly help me.
Thanks in advance.
Regards,
Nithya.Vembu.
--
http://xwiki.475771.n2.nabble.com/How-to-list-the-subspace-under-the-space-tp5095367p5095367.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
_______________________________________________
users mailing list
users at xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
--
Guillaume Lerouge
Product Manager - XWiki SAS
Skype: wikibc
Twitter: glerouge
http://guillaumelerouge.com/
Nithya Vembu
2010-05-26 17:56:06 UTC
Permalink
Hi Guillaume,

Thanks for your valuable reply.

I have somewhat achieved to get the subspaces and pages like a tree
structure.
This is the code snippet. I just changed the query in the child parent
code snippet for my requirement.

{{velocity}}
#macro (createDocumentTree $document $depth $level)
#if ($depth > 0)
#set($translated = $document.getTranslatedDocument())
#set($name = $translated.getName())
#set($fullname = $translated.getFullName())
#set($prefixed = $translated.getPrefixedFullName())
#set($where = "where doc.parent = '$name' or doc.parent =
'$fullname' or doc.parent = '$prefixed' order by doc.name")
#if ($name == "WebHome")
#set($space = $document.getSpace())
## changes made here for our requirement
#set($where1 = "where doc.parent = '$fullname' and
doc.name='WebHome'")
#end

#foreach($name in $xwiki.searchDocuments($where))
#if ($xwiki.getDocument($name))
#set($document = $xwiki.getDocument($name))
#set($translated = $document.getTranslatedDocument())
#set($prefixed = $translated.getPrefixedFullName())
#set($title = $translated.getDisplayTitle())
#set($indent = "")
#foreach($n in [1..$level])
#set($indent = "${indent}*")
#end
$indent [[$title>>$prefixed]]
#set($depth = $depth - 1)
#set($level = $level + 1)
#createDocumentTree($document $depth $level)
#set($depth = $depth + 1)
#set($level = $level - 1)
#end
#end

#end
#end
#createDocumentTree($doc 5 1)
{{/velocity}}

But here i am facing the problem.

I am creating a space and putting this velocity code in that space and its
displaying the whole tree structure related to it.
But i want this code in panel and the tree structure should come for all
spaces dynamically like Tree view Navigation.
I put this code in panel but it displaying the tree related to panel. My
requirement is to show all spaces and its related subspace, pages as tree in
panel.

How can i get spaces and also specify the proper document object?

Is there any way to get successful in this. Kindly guide me.

Thanks in Advance.

Regards,
Nithya.
--
View this message in context: http://xwiki.475771.n2.nabble.com/How-to-list-the-subspace-under-the-space-tp5095367p5104916.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
xManish
2010-06-01 22:21:24 UTC
Permalink
Hi Guillaume,
Can you explain in little bit detail on how to obtain the
*Space
*Page
*SubPage
hierarchy in Xwiki?

Thanks,
Manish
--
View this message in context: http://xwiki.475771.n2.nabble.com/How-to-list-the-subspace-under-the-space-Little-bit-successful-need-more-steps-to-Go-tp5095367p5128311.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
Guillaume Lerouge
2010-06-02 08:33:49 UTC
Permalink
Hi,
Post by Nithya Vembu
Hi Guillaume,
Can you explain in little bit detail on how to obtain the
*Space
*Page
*SubPage
hierarchy in Xwiki?
It works out of the box using parent page <-> child page relationships.

Create a new space from the "XWIKI" menu at the top left, then from the
homepage of that space create a new page from the menu that will have the
name of your space (still at the top left). Then from that page create a new
page, again from the top menu. This will automatically create a parent <->
child relationship between your pages.

Now go to Main.AllDocs and look at the "Tree" tab -> you'll see the
hierarchy.

Guillaule
Post by Nithya Vembu
Thanks,
Manish
--
http://xwiki.475771.n2.nabble.com/How-to-list-the-subspace-under-the-space-Little-bit-successful-need-more-steps-to-Go-tp5095367p5128311.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
_______________________________________________
users mailing list
users at xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
--
Guillaume Lerouge
Sales - XWiki SAS
Skype: wikibc
Twitter: glerouge
http://guillaumelerouge.com/
xManish
2010-06-02 13:40:26 UTC
Permalink
I hadn't seen that. Thanks for sharing.
--
View this message in context: http://xwiki.475771.n2.nabble.com/How-to-list-the-subspace-under-the-space-Little-bit-successful-need-more-steps-to-Go-tp5095367p5130817.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
Loading...