SAP Community
Products and Technology
Additional Blogs by Members
Build Your Own KM Navigation iView Using HTMLB Tre...
Additional Blogs by Members
All community
This category
Blog
Knowledge base
Users
Managed tags
cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
Search instead for
Did you mean:
Build Your Own KM Navigation iView Using HTMLB Tree
Former Member
Options
Subscribe to RSS Feed
Mark as New
Mark as Read
Bookmark
Subscribe
Printer Friendly Page
Report Inappropriate Content
03-28-2005
2:16 PM
0
Kudos
/* Built By: Prakash Singh * Universal System Technologies, Inc * M 407-474-2216 */ package com.ust.kmtree; import com.sapportals.htmlb.Form; import com.sapportals.htmlb.FormLayout; import com.sapportals.htmlb.FormLayoutRow; import com.sapportals.htmlb.Link; import com.sapportals.htmlb.Tree; import com.sapportals.htmlb.TreeNode; import com.sapportals.htmlb.page.DynPage; import com.sapportals.htmlb.page.PageException; import com.sapportals.portal.htmlb.page.PageProcessorComponent; import com.sapportals.portal.prt.component.IPortalComponentContext; import com.sapportals.portal.prt.component.IPortalComponentProfile; import com.sapportals.portal.prt.component.IPortalComponentRequest; import com.sapportals.portal.prt.component.IPortalComponentResponse; import com.sapportals.portal.prt.component.IPortalComponentURI; import com.sapportals.portal.security.usermanagement.IUser; import com.sapportals.wcm.repository.ICollection; import com.sapportals.wcm.repository.IResource; import com.sapportals.wcm.repository.IResourceList; import com.sapportals.wcm.repository.ResourceContext; import com.sapportals.wcm.repository.ResourceFactory; import com.sapportals.wcm.repository.enum.LinkType; import com.sapportals.wcm.repository.manager.IPermission; import com.sapportals.wcm.repository.manager.ISecurityManager; import com.sapportals.wcm.util.uri.RID; import com.sapportals.wcm.util.usermanagement.WPUMFactory; public class display extends PageProcessorComponent { /** * calls the "real" page class. */ public DynPage getPage() { return new UsingDynPagePage(); } public class UsingDynPagePage extends DynPage { private final static int READ_ONLY = 0; private final static int EDIT = 1; private int flag = READ_ONLY; private IResourceList reslist; private String navigationURI; private String fileURL; private String docsURI; private Form myForm; private String colWidth; private FormLayout fl; /** * Things to initialize once per session. */ public void doInitialization() { flag = READ_ONLY; IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest(); IPortalComponentResponse response = (IPortalComponentResponse) this.getResponse(); IPortalComponentContext myContext = request.getComponentContext(); IPortalComponentProfile profile = myContext.getProfile(); IPortalComponentURI componentURI = request.createPortalComponentURI(); componentURI.setContextName("com.sap.km.cm.navigation"); navigationURI = componentURI.toString(); componentURI.setContextName("com.sap.km.cm.docs"); docsURI = componentURI.toString(); try { fileURL = profile.getProperty("path"); colWidth = profile.getProperty("width"); // create an ep5 user from the ep6 user in the request IUser user = WPUMFactory.getUserFactory().getEP5User(request.getUser()); ResourceContext ctxt = new ResourceContext(user); RID rid = RID.getRID(fileURL); IResource resource = ResourceFactory.getInstance().getResource(rid, ctxt); // get Security Manager ISecurityManager securityManager = resource.getRepositoryManager().getSecurityManager( resource); IPermission iperm = securityManager.getPermission("leaf_write_content"); if (securityManager.isAllowed(resource, user, iperm)) { flag = EDIT; } else { flag = READ_ONLY; } ICollection collection = (ICollection) resource; reslist = collection.getChildren(); } catch (Exception e) { response.write(e.getMessage()); } } /** * Will be called if forms with data was send. */ public void doProcessAfterInput() throws PageException { } /** * Will always be called before output. So this is the method in which * the components will be placed and set. */ public void doProcessBeforeOutput() throws PageException { myForm = getForm(); FormLayout fl = new FormLayout(); fl.setId("fl"); fl.setWidth("94%"); FormLayoutRow row1 = fl.addRow(); Tree tree = new Tree("S_Tree", ""); tree.setRootNodeIsVisible(false); TreeNode root = new TreeNode("e_root", "Links"); root.setOpen(true); add_node(reslist, root); tree.setRootNode(root); fl.addComponent(1, 1, tree); if (flag == EDIT) { String edit_url = navigationURI + fileURL + "?StartUri=" + fileURL + "&rndLayoutSet=LinkListMaintenance&layoutSetMode=exclusive"; Link link = new Link("Edit"); link.setTarget("_BLANK"); link.setReference(edit_url); link.addText("Edit"); fl.addComponent(2, 1, link); } myForm.addComponent(fl); } public void add_node(IResourceList list, TreeNode name) { String strtext; String disname; String strid; IResourceList tmpreslist; ICollection tmpcollection; for (int i = 0; i<list.size(); i++) { IResource tmpres = list.get(i); try { strid = tmpres.getName(); disname = tmpres.getDisplayName(); if (disname == null) { disname = ""; } if (disname.equals("") || disname == null) { disname = strid; } strtext = disname; if (tmpres.getLinkType() != LinkType.NONE) { if (tmpres.getLinkType() == LinkType.EXTERNAL) { strtext = ""; strtext = strtext + disname + " ("%3Cbr%20/%3E%20%20%20%20%20%20%20%20%20+%20tmpres.getTargetURL().toString()%3Cbr%20/%3E%20%20%20%20%20%20%20%20%20+%20")"; } else { if (tmpres.isCollection()) { strtext = ""; strtext = strtext + disname + " ("%3Cbr%20/%3E%20%20%20%20%20%20%20%20%20%20+%20navigationURI%3Cbr%20/%3E%20%20%20%20%20%20%20%20%20%20+%20tmpres.getTargetURL().toString()%3Cbr%20/%3E%20%20%20%20%20%20%20%20%20%20+%20"?StartUri="%3Cbr%20/%3E%20%20%20%20%20%20%20%20%20%20+%20tmpres.getTargetURL()%3Cbr%20/%3E%20%20%20%20%20%20%20%20%20%20+%20")"; } else { strtext = ""; strtext = strtext + disname + " ("%3Cbr%20/%3E%20%20%20%20%20%20%20%20%20%20+%20docsURI%3Cbr%20/%3E%20%20%20%20%20%20%20%20%20%20+%20tmpres.getTargetURL().toString()%3Cbr%20/%3E%20%20%20%20%20%20%20%20%20%20+%20")"; } } } else if (!tmpres.isCollection()) { strtext = ""; strtext = strtext + disname + " ("%3Cbr%20/%3E%20%20%20%20%20%20%20%20+%20docsURI%3Cbr%20/%3E%20%20%20%20%20%20%20%20+%20tmpres.getAccessURI()%3Cbr%20/%3E%20%20%20%20%20%20%20%20+%20")"; } TreeNode name1 = new TreeNode(strid, strtext, name); name1.setTooltip(strid); if (tmpres.isCollection() && tmpres.getLinkType() == LinkType.NONE) { tmpcollection = (ICollection) tmpres; tmpreslist = tmpcollection.getChildren(); add_node(tmpreslist, name1); } } catch (Exception ex) { IPortalComponentResponse response = (IPortalComponentResponse) this.getResponse(); } } } } } Step 3: Deploy your par and run it. BAM! you got yourself a nice tree that explodes all the content of a particular repository or foder.
prakash singh4
Retagging Required
13 Comments
Related Content
How to navigate with multiple values of parameters in intent based navigation from UI component card
in
Technology Q&A
2 hours ago
Extend Your Crystal Reports Solutions in the DHTML Viewer With a Free Function Library
in
Technology Blogs by Members
yesterday
Latest Updates to the Reimagined Applicant Management Tool in SAP SuccessFactors Recruiting
in
Human Capital Management Blogs by SAP
yesterday
New 1H 2024 SAP Successfactors Time (Tracking) Features
in
Human Capital Management Blogs by SAP
yesterday
Composite Data Source Configuration in Optimized Story Experience
in
Technology Blogs by SAP
yesterday
Popular Blog Posts
Are you there, SAP? It's me, Jelena
Integration Point of MM-FI-SD in SAP ERP
SAP Project System - A ready Reference ( Part 1 )
Top kudoed authors
User
Count
former_member18
3424
1
MarioDeFelipe
1
Jelena
1
View all