<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML dir=ltr><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 6.00.2600.0" name=GENERATOR></HEAD>
<BODY >
<DIV><FONT face=Georgia size=2>Thanks for your answer. I'm sure your
example will come in handy later on. <BR>But it wasn't the answer to my problem.
I have found the answer though.<BR><BR>Instead of:<BR><FONT
face="Lucida Sans Unicode">CmsJspActionElement cms = new
CmsJspActionElement(pageContext, request, response);</FONT><FONT
face="Times New Roman" size=3> <BR></FONT><FONT face=sans-serif size=2>String
filename =
com.opencms.file.CmsFile.getPath(cms.getRequestContext().getUri());</FONT><FONT
face="Times New Roman" size=3> <BR></FONT><FONT face=sans-serif
size=2>CmsJspNavElement element =
cms.getNavigation().getNavigationForResource(foldername);</FONT><FONT
face="Times New Roman" size=3> </FONT><BR><BR>I do this:<BR><FONT
face="Lucida Sans Unicode">CmsJspActionElement cms = new
CmsJspActionElement(pageContext, request, response);</FONT><FONT
face="Times New Roman" size=3> <BR></FONT>String filename =
cms.getRequestContext().getUri();<BR>String linkFile =
cms.getContent(filename);<BR><FONT
face="Lucida Sans Unicode">CmsJspNavElement </FONT>element =
cms.getNavigation().getNavigationForResource(linkFile);<BR><BR>Many of you
probably knew that the content of a link resource is the uri of the page it
links to. I just should have explained my problem a little
better.<BR><BR>Christian Güldner<BR><BR><BR></FONT><I>20. oktober 2003
17:03<BR>To: <opencms-dev@opencms.org><BR>cc: <BR>From: "Matthew Evans"
<matte@solidstategroup.com><BR>Subject: RE: [opencms-dev] getting the file
resource from a link</I><BR><BR></DIV>
<DIV><SPAN class=261210015-20102003><FONT face=Arial color=#0000ff size=2>I'm
not sure exactly what you are after, but I use this code to access files in the
VFS, maybe it will help you.</FONT></SPAN></DIV>
<DIV><SPAN class=261210015-20102003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=261210015-20102003><FONT face=Arial color=#0000ff
size=2>M@.</FONT></SPAN></DIV>
<DIV><SPAN class=261210015-20102003><FONT face=Arial color=#0000ff
size=2>--------------------</FONT></SPAN></DIV>
<DIV><SPAN class=261210015-20102003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=261210015-20102003></SPAN> </DIV>
<DIV><SPAN class=261210015-20102003><FONT face=Arial color=#0000ff size=2><%@
page session="false" %><BR><%@ taglib prefix="cms" uri="<A
href="http://www.opencms.org/taglib/cms">http://www.opencms.org/taglib/cms</A>"
%><BR><%@ page
import="java.util.*,<BR>
com.opencms.flex.jsp.*,<BR>
com.opencms.file.*,<BR>
com.opencms.file.CmsUser" %></FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=261210015-20102003><FONT face=Arial color=#0000ff
size=2><cms:include property="template" element="head"
/></FONT></SPAN></DIV>
<DIV> </DIV><SPAN class=261210015-20102003><FONT face=Arial color=#0000ff
size=2>
<DIV><BR><% <BR>//Get command line parameters<BR>String
download_dir = request.getParameter("download_dir");</DIV>
<DIV> </DIV>
<DIV>// Create a JSP action element<BR>com.opencms.flex.jsp.CmsJspActionElement
cms = new com.opencms.flex.jsp.CmsJspActionElement(pageContext, request,
response);</DIV>
<DIV> </DIV>
<DIV>String DEF_FILE_TYPE = "Downloadable File"; </DIV>
<DIV> </DIV>
<DIV>//out.println(download_dir); <BR>boolean hasFiles = false;<BR>boolean
hasFolders = false;<BR>CmsObject cmso = cms.getCmsObject(); <BR>CmsFolder
currentFolder = cmso.readFolder(download_dir);</DIV>
<DIV> </DIV>
<DIV>if (download_dir != null && !"".equals(download_dir)) {
<BR> try { </DIV>
<DIV> </DIV>
<DIV> // Print out the breadcrumb
trail<BR> String endFolder =
"";<BR> Vector dirTree = new
Vector();<BR> int count =
0;<BR> while
(!currentFolder.getAbsolutePath().equals("/system/galleries/download/Contents/")){<BR>
dirTree.add(count,"<a href=\"RGLFiles.jsp?download_dir=" +
currentFolder.getAbsolutePath() + "&menunode=title3\">" +
cmso.readProperty(currentFolder.getAbsolutePath(),"Title") +
"</a>");<BR>
currentFolder =
cmso.readFolder(currentFolder.getParent());<BR>
}<BR> out.println("<p
class=\"user\">");<BR> for (count =
0; count <= dirTree.size()-1;
count++){<BR>
out.println(" > " +
dirTree.elementAt(count));<BR>
}<BR> out.println("</p>");</DIV>
<DIV> </DIV>
<DIV> // Use the Cms* object to get
all folders under the download_dir<BR>
java.util.Vector allSubFolders = cmso.getSubFolders(download_dir);</DIV>
<DIV> </DIV>
<DIV> Iterator ii =
allSubFolders.iterator();<BR>
if(ii.hasNext()){<BR>
hasFolders=true;<BR>%><BR><!-- Downloads table --> <BR><p
class="title">Folders</p><BR><table border="0" width="100%">
</DIV>
<DIV> </DIV>
<DIV><%<BR> }</DIV>
<DIV> </DIV>
<DIV> while (ii.hasNext())
{<BR>
CmsFolder thisFolder =
(CmsFolder)ii.next();<BR>
out.println("<tr><td class=\"normal\"><a
href=\"RGLFiles.jsp?download_dir=" + thisFolder.getAbsolutePath() +
"&menunode=title3\">" +
cmso.readProperty(thisFolder.getAbsolutePath(),"Title") +
"</a></td></tr>");<BR>
} <BR> if
(hasFolders==true){<BR>
out.println("</table>");<BR>
}</DIV>
<DIV> </DIV>
<DIV> // We have to use Cms* objects
to get files that are not Pages. <BR>
Iterator i = cmso.getFilesInFolder(download_dir).iterator(); </DIV>
<DIV> </DIV>
<DIV> if (i.hasNext())
{<BR> hasFiles
= true;<BR>%></DIV>
<DIV> </DIV>
<DIV><!-- Downloads table --> <BR><p
class="title">Files</p><BR><table border="0" width="100%"> </DIV>
<DIV> </DIV>
<DIV><%<BR> }</DIV>
<DIV> </DIV>
<DIV>int lines = 0; <BR>while (i.hasNext()) { <BR>CmsFile f = (CmsFile)i.next();
<BR>if(lines % 2 == 0) out.println("<tr>"); <BR>else
out.println("<tr>"); </DIV>
<DIV> </DIV>
<DIV>// There is probably a built-in source for this.... <BR>HashMap fTypes =
new HashMap(35); <BR>fTypes.put(".txt","Text File"); <BR>fTypes.put(".doc","MS
Word Doc"); <BR>fTypes.put(".htm","Web (HTML) Document");
<BR>fTypes.put(".html","Web (HTML) Document"); <BR>fTypes.put(".jpg","JPEG Image
File"); <BR>fTypes.put(".jpeg","JPEG Image File"); <BR>fTypes.put(".gif","GIF
Image File"); <BR>fTypes.put(".pdf","Adobe PDF (Acrobat™) Document");
<BR>fTypes.put(".zip","ZIP Compressed File"); <BR>fTypes.put(".tar","UNIX
Archive File"); <BR>fTypes.put(".tgz","GZip Compressed Archive File");
<BR>fTypes.put(".gz","GZip Compressed File"); <BR>fTypes.put(".gzip","GZip
Compressed File"); <BR>fTypes.put(".xls","MS Excel Spreadsheet");
<BR>fTypes.put(".ppt","MS PowerPoint Slideshow");
<BR>fTypes.put(".exe","Windows/DOS Executable"); <BR>fTypes.put(".wmf","Windows
Media File"); <BR>fTypes.put(".ram","Real Media File");
<BR>fTypes.put(".rpm","Real Media File"); <BR>fTypes.put(".mp3","MP3 Audio
File"); <BR>fTypes.put(".mpg","MPEG Video File"); <BR>fTypes.put(".mpeg","MPEG
Video File"); <BR>fTypes.put(".avi","AVI Video File"); </DIV>
<DIV> </DIV>
<DIV>String fName = f.getName(); <BR>String ext = f.getExtension(); <BR>int
fLength = f.getLength(); <BR>String unit = "Kb"; <BR>if(fLength < 1024) unit
= "bytes"; <BR>else fLength /= 1024; <BR>//out.println("Extension from CMS:
"+ext+"<br>");//DEBUG <BR>String fTitle =
cmso.readProperty(f.getAbsolutePath(),"Title");</DIV>
<DIV> </DIV>
<DIV>String fileType; <BR>if("".equals(ext)) fileType = DEF_FILE_TYPE; <BR>else
fileType = (fTypes.get(ext) != null)?fTypes.get(ext).toString():DEF_FILE_TYPE;
</DIV>
<DIV> </DIV>
<DIV>out.println("<td class=\"normal\"><a href=\"" +
cms.link(f.getAbsolutePath())); <BR>out.print("\">");<BR>if(fTitle !=""
&& fTitle != null) out.print(fTitle);<BR>else
out.print(fName);<BR>out.println("</a></td>");
<BR>out.println("<td class=\"normal\">" + fileType + "</td>");
<BR>out.print("<td class=\"normal\" width=\"50\">");
<BR>out.print(fLength); <BR>out.println(" "+unit+"</td>"); <BR>++lines;
</DIV>
<DIV> </DIV>
<DIV>} <BR>} catch (Exception e) { <BR>out.println(e.toString()); <BR>} </DIV>
<DIV> </DIV>
<DIV>} <BR>if (hasFiles==true){<BR>
out.println("</table>");<BR>}<BR>%> </DIV>
<DIV> </DIV>
<DIV><cms:include property="template" element="foot"
/><BR></FONT></SPAN></DIV>
<DIV> </DIV>
<DIV align=left><FONT face=Arial size=2></FONT> </DIV>
<DIV align=left><FONT face=Verdana size=2>Matthew Evans</FONT></DIV>
<DIV align=left><FONT size=2><FONT face=Verdana><STRONG>Solid</STRONG>State<FONT
color=#808080><STRONG>Group</STRONG></FONT></FONT></FONT></DIV>
<DIV align=left><FONT face=Verdana size=1>tel. +44 (0) 20 77402133</FONT></DIV>
<DIV align=left><FONT face=Verdana size=1>Mob. +44(0)7958 379562</FONT></DIV>
<DIV align=left><FONT face=Verdana><FONT face=Arial size=1><A
href="http://www.solidstategroup.com/">http://www.solidstategroup.com</A></FONT></FONT></DIV>
<DIV> </DIV>
<DIV><BR><BR></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> opencms-dev-admin@opencms.org
[mailto:opencms-dev-admin@opencms.org] <B>On Behalf Of </B>Christian Fleron
Guldner<BR><B>Sent:</B> 20 October 2003 15:04<BR><B>To:</B>
opencms-dev@opencms.org<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr align=left><BR><FONT face=sans-serif size=2>Hi,</FONT> <BR><FONT
face=sans-serif size=2>Hope you can help me. I have not been able to find the
answer to my problem by searching the list.</FONT> <BR><BR><FONT face=sans-serif
size=2>I have a folder full of links, wich I use to generate a menu. When I need
another item in the menu, I create a new link to the page in this
"menu-folder".</FONT> <BR><FONT face=sans-serif size=2>My problem:</FONT>
<BR><FONT face=sans-serif size=2>I need to get at the navigation information of
the page I've linked to, not the navigation info of the link.</FONT>
<BR><BR><FONT face=sans-serif size=2>Obviously this:</FONT> <BR><BR><FONT
face=sans-serif size=2>CmsJspActionElement cms = new
CmsJspActionElement(pageContext, request, response);</FONT> <BR><FONT
face=sans-serif size=2>String foldername =
com.opencms.file.CmsFile.getPath(cms.getRequestContext().getUri());</FONT>
<BR><FONT face=sans-serif size=2>CmsJspNavElement element =
cms.getNavigation().getNavigationForResource(foldername);</FONT> <BR><BR><FONT
face=sans-serif size=2>does not work. element points to the link
resource.</FONT> <BR><BR><FONT face=sans-serif size=2>Any ideas?</FONT>
<BR><FONT face=sans-serif size=2>Thanks,</FONT> <BR><BR><FONT face=sans-serif
size=2>Christian Güldner</FONT><BR></DIV>
<P><FONT size=2>---<BR>Incoming mail is certified Virus Free.<BR>Checked by AVG
anti-virus system (http://www.grisoft.com).<BR>Version: 6.0.524 / Virus
Database: 321 - Release Date: 06/10/2003<BR></P></FONT></BODY></HTML>