Microsoft Content Management Server - Tree of Resource Gallery

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > September 2004 > Tree of Resource Gallery





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Tree of Resource Gallery
George Leithead

2004-09-23, 9:18 am

Hi all,

I want to use the R.A.D. editor, however there is a problem with it.
Basically, when you want to upload a resource, it uses a drop-down list.
That's not a problem you say, well, actually it is if you have a site which
is VERY hierarchical and deep.

I therefore want to change this so that I have a "browse" option to go and
select the appropriate resource gallery. I've got this all working fine,
however I'm not sure how to render out the resource gallery as a tree.

Could someone help me get started on this one? There are methods and
properties such as ResourceGalleryTree, BuildResourceGallery,
BuildResourceGalleryTree that all look like the right thing, but there is no
help on these!

All help is much appreciated!

George Leithead
RAD Manager


George Leithead

2004-09-23, 9:18 am

Never mind, I figured it out. Was a STUPID mistake on my part. My class
was called ResourceGallery, therefore was causing problems when trying to
reference the MCMS ResourceGallery method!!

Anyway, here is the basic code, for others who want it!

protected Microsoft.Web.UI.WebControls.TreeView ResourceGalleryTree;

private void Page_Load(object sender, System.EventArgs e)

{

// Put user code to initialize the page here

// Put user code to initialize the page here

ResourceGalleryTree.ShowLines = true;

ResourceGalleryTree.ShowPlus = true;

BuildResourceGalleryTree(CmsHttpContext.Current.RootResourceGallery.Resource
Galleries["Intranet"], null);

}

public void BuildResourceGalleryTree(ResourceGallery
startGallery, TreeNode
parentTreeNode)

{

TreeNode myNewNode = new TreeNode();

myNewNode.NavigateUrl = startGallery.Guid;

myNewNode.Text = startGallery.Name;

// If null, then we are at the root!

if (parentTreeNode == null)

{

// Add the new node

ResourceGalleryTree.Nodes.Add(myNewNode);

}

else

{

// Add our new not to the specified parent node

parentTreeNode.Nodes.Add(myNewNode);

parentTreeNode.Expanded = false;

}

// If sub-channels, recursively call to finish the tree

foreach(ResourceGallery subResourceGallery in
startGallery.ResourceGalleries)

{

BuildResourceGalleryTree(subResourceGall
ery, myNewNode);

}

}



"George Leithead" <george.leithead@davislangdonDINAHSPAMMEH.com> wrote in
message news:4152a04c$0$20246$ed9e5944@reading.news.pipex.net...
> Hi all,
>
> I want to use the R.A.D. editor, however there is a problem with it.
> Basically, when you want to upload a resource, it uses a drop-down list.
> That's not a problem you say, well, actually it is if you have a site

which
> is VERY hierarchical and deep.
>
> I therefore want to change this so that I have a "browse" option to go and
> select the appropriate resource gallery. I've got this all working fine,
> however I'm not sure how to render out the resource gallery as a tree.
>
> Could someone help me get started on this one? There are methods and
> properties such as ResourceGalleryTree, BuildResourceGallery,
> BuildResourceGalleryTree that all look like the right thing, but there is

no
> help on these!
>
> All help is much appreciated!
>
> George Leithead
> RAD Manager
>
>



George Leithead

2004-09-23, 9:18 am

Ok, now I have the basics. Anyone know how I order the tree based on the
ResourceGallery.Name?

George Leithead
Davis Langdon
RAD Manager


"George Leithead" <george.leithead@davislangdonDINAHSPAMMEH.com> wrote in
message news:4152a574$0$20248$ed9e5944@reading.news.pipex.net...
> Never mind, I figured it out. Was a STUPID mistake on my part. My class
> was called ResourceGallery, therefore was causing problems when trying to
> reference the MCMS ResourceGallery method!!
>
> Anyway, here is the basic code, for others who want it!
>
> protected Microsoft.Web.UI.WebControls.TreeView ResourceGalleryTree;
>
> private void Page_Load(object sender, System.EventArgs e)
>
> {
>
> // Put user code to initialize the page here
>
> // Put user code to initialize the page here
>
> ResourceGalleryTree.ShowLines = true;
>
> ResourceGalleryTree.ShowPlus = true;
>
>

BuildResourceGalleryTree(CmsHttpContext.Current.RootResourceGallery.Resource
> Galleries["Intranet"], null);
>
> }
>
> public void BuildResourceGalleryTree(ResourceGallery
startGallery,

TreeNode
> parentTreeNode)
>
> {
>
> TreeNode myNewNode = new TreeNode();
>
> myNewNode.NavigateUrl = startGallery.Guid;
>
> myNewNode.Text = startGallery.Name;
>
> // If null, then we are at the root!
>
> if (parentTreeNode == null)
>
> {
>
> // Add the new node
>
> ResourceGalleryTree.Nodes.Add(myNewNode);
>
> }
>
> else
>
> {
>
> // Add our new not to the specified parent node
>
> parentTreeNode.Nodes.Add(myNewNode);
>
> parentTreeNode.Expanded = false;
>
> }
>
> // If sub-channels, recursively call to finish the tree
>
> foreach(ResourceGallery subResourceGallery in
> startGallery.ResourceGalleries)
>
> {
>
> BuildResourceGalleryTree(subResourceGall
ery, myNewNode);
>
> }
>
> }
>
>
>
> "George Leithead" <george.leithead@davislangdonDINAHSPAMMEH.com> wrote in
> message news:4152a04c$0$20246$ed9e5944@reading.news.pipex.net...
> which
and[vbcol=seagreen]
fine,[vbcol=seagreen]
is[vbcol=seagreen]
> no
>
>



Angus Logan

2004-09-23, 9:18 am

Hi George,

You could add them to a SortedList array; but be sure to check if the key
already exists before you add them.

Cheers
--
________________________________________


Angus Logan (MCAD/MCDBA/MCP)
Lead Software Developer
Microsoft Application Solutions
Data#3 Limited
E angus_logan@data3.com.au
BLOG www.anguslogan.com
________________________________________


"George Leithead" <george.leithead@davislangdonDINAHSPAMMEH.com> wrote in
message news:4152a6f8$0$20243$ed9e5944@reading.news.pipex.net...
> Ok, now I have the basics. Anyone know how I order the tree based on the
> ResourceGallery.Name?
>
> George Leithead
> Davis Langdon
> RAD Manager
>
>
> "George Leithead" <george.leithead@davislangdonDINAHSPAMMEH.com> wrote in
> message news:4152a574$0$20248$ed9e5944@reading.news.pipex.net...
class[vbcol=seagreen]
to[vbcol=seagreen]
>

BuildResourceGalleryTree(CmsHttpContext.Current.RootResourceGallery.Resource
> TreeNode
in[vbcol=seagreen]
list.[vbcol=seagreen]
> and
> fine,
> is
>
>



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com