<div>I'm not sure if this helps you but we had a similar problem. We have many microsite editors that post minutes, agendas, etc. but they are not very skilled. They were uploading files, creating links, etc. etc. Too many steps.</div>
<div> </div>
<div>So I build this little "table of contents" tool. I put the index.jsp into a folder and all the editors have to do is put the minutes, agendas, etc. into the folder and give each one a title. It automatically creates a list of the folders contents. I've included the code below. (We're still at openCms 6 )</div>
<div> </div>
<div>What I don't know how to do is to make this a structured content type so the editors can set the folders up themselves. I'm working on that now.</div>
<div> </div>
<div>Lynn</div>
<div>----------------------------</div>
<div><!--<br>Name: index.jsp<br>Author: Lynn Chapman<br>Description: Table of Contents tool. This code generates a list of links to folders and files. <br> It lists files that are within it's own folder and any subfolders. <br>
Calls: none<br>Modification History<br>Written: December 2010<br> <br>--><br><%@ page session="false" buffer="none" import="java.sql.*, com.onr.*, java.util.*,org.opencms.search.*, org.opencms.flex.*, org.opencms.util.*, org.opencms.jsp.*, org.opencms.frontend.templateone.modules.*, org.opencms.main.*, org.opencms.file.*" %><br>
<%@ taglib prefix="cms" uri="<a href="http://www.opencms.org/taglib/cms">http://www.opencms.org/taglib/cms</a>" %><br><jsp:useBean id="cmsUser" class="org.opencms.jsp.CmsJspActionElement"><br>
<% cmsUser.init(pageContext, request, response); %><br></jsp:useBean><br><cms:include property="template" element="head" /><br><head><br><link rel="stylesheet" type = "text/css" href="site-event.css" ><br>
</head><br><div class="element"><br><%<br>CmsJspActionElement action = new CmsJspActionElement(pageContext,request,response);<br>CmsObject cms = action.getCmsObject();</div>
<p>// Plan to allow user to put a heading on the Table of Contents page would not work. Normal user <br>// cannot change properties of jsp files. Left code in hopes that another way can eventually be found.<br>// String heading = action.property("Title", "index.jsp");<br>
// out.println ("<h1>heading</h1>");<br>try {<br> out.println ("<table>");</p>
<p> // List the Folders<br> List listFolders = cms.getSubFolders(<a href="http://action.info">action.info</a>("opencms.request.folder"));<br> CmsFolder cmsfolder= null;<br> for(int i=0;i<listFolders.size();i++){<br>
cmsfolder=(CmsFolder) listFolders.get(i);<br> String folderName = cmsfolder.getName();<br> String folderNameWithSlash = folderName + "/";<br> String folderPath = cmsfolder.getFolderPath(folderNameWithSlash);<br>
String folderTitle = action.property("Title",folderName);<br> if (folderTitle == null){folderTitle = folderName;} <br> String topFolder = <a href="http://action.info">action.info</a>("opencms.request.folder");<br>
String longFolderPath = topFolder + folderPath;<br> String folderDescription = action.property("Description", folderName);<br> if (folderDescription == null) { folderDescription = ""; }<br> out.println ("<tr><td>" +folderTitle +"</td><td>" +folderDescription +"</td></tr>");</p>
<p> // LIST THE FILES IN EACH FOLDER<br> List listFilesInFolder = cms.getFilesInFolder(longFolderPath);<br> for(int j=0;j<listFilesInFolder.size();j++){<br> CmsFile cmsfileinside= (CmsFile) listFilesInFolder.get(j);<br>
String filenameinside = cmsfileinside.getName();<br> if (!filenameinside.equals("index.jsp")){<br> String linkinside = "";<br> String longFileNameInside = longFolderPath + filenameinside;<br>
String titleinside = action.property("Title", longFileNameInside);<br> titleinside = action.property("Title",longFileNameInside);<br> if (titleinside == null) {titleinside = filenameinside;}<br>
String fileDescription = action.property("Description", longFileNameInside);<br> if (fileDescription == null) { fileDescription = ""; }<br> linkinside = action.link(longFileNameInside);<br> out.println ("<tr><td> </td><td><a href=\"" +linkinside +"\">" +titleinside +"</a></td><td>" +fileDescription +"</td><tr>"); <br>
} <br> }<br> }</p>
<p> // LIST FILE THAT ARE AT THE TOP FOLDER LEVEL<br> List listFiles = cms.getFilesInFolder(<a href="http://action.info">action.info</a>("opencms.request.folder")); <br> for(int i=0;i<listFiles.size();i++){<br>
CmsFile cmsfile= (CmsFile) listFiles.get(i);<br> String filename = cmsfile.getName();<br> if (!filename.equals("index.jsp")){<br> String title = action.property("Title", filename);<br> String link = "";<br>
String description = action.property("Description", filename);<br> if (description == null) { description = ""; }<br> title = action.property("Title",filename);<br> if (title == null) {title = filename;}<br>
link = action.link(filename);<br> out.println ("<tr><td><a href=\"" +link +"\">" +title +"</a></td><td>" +description +"</td></tr>"); <br>
} <br> }</p>
<p>} catch (CmsException e) {<br> out.println(e);<br>}</p>
<p>%><br></div><br><cms:include property="template" element="foot" /></p>
<p><br><br> </p>
<div class="gmail_quote">On Fri, Feb 25, 2011 at 8:24 AM, Paul-Inge Flakstad <span dir="ltr"><<a href="mailto:flakstad@npolar.no">flakstad@npolar.no</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Hi Tylla,<br><br>Instead of dabbling with the "default-file" property, how about just setting the "restypes.indexpage" property to a resource type especially created to serve the required purpose? (For example an xmlcontent type with its "template-elements" property set to a JSP that does what you want it to.)<br>
<br>As far as I can see, this could be a simple solution in your case.<br><br>Cheers,<br>Paul<br><br>> -----Original Message-----<br>> From: <a href="mailto:opencms-dev-bounces@opencms.org">opencms-dev-bounces@opencms.org</a><br>
> [mailto:<a href="mailto:opencms-dev-bounces@opencms.org">opencms-dev-bounces@opencms.org</a>] On Behalf Of Nagy Attila<br>> Sent: 25. februar 2011 13:45<br>> To: <a href="mailto:opencms-dev@opencms.org">opencms-dev@opencms.org</a><br>
> Subject: [opencms-dev] Default-file for folder tree<br>><br>> Hi!<br>><br>> I am having a frequently changing directory tree which is<br>> populated with<br>> some custom XML objects. What I want to do is automatically list the<br>
> elements of a folder when the folder is accessed.<br>> I managed to solve this, but it is too tedious (it involves<br>> creating an<br>> index.html in every folder and adding a property which gets<br>> read by the<br>
> template). I can't put this in the hand of the user, it would forget<br>> one-two steps and I have to clean up the mess. :(<br>><br>> I thought this could be done simply with the "default-file"<br>
> property, by<br>> setting it to some self-made jsp file that lists the<br>> directory contents,<br>> but it doesn't seem to work.<br>><br>> I did search the mail list and the forums, but except for an almost<br>
> similar question that wasn't answered anyway, I couldn't find<br>> any usable<br>> info.<br>> Am I missing something?<br>> How does the "default-file" property work?<br>><br>> Thanks in advance, and sorry if this was already answered somewhere<br>
> (than some pointer would be welcome too).<br>> Tylla.<br>><br>> _______________________________________________<br>> This mail is sent to you from the opencms-dev mailing list<br>> To change your list options, or to unsubscribe from the list,<br>
> please visit<br>> <a href="http://lists.opencms.org/mailman/listinfo/opencms-dev" target="_blank">http://lists.opencms.org/mailman/listinfo/opencms-dev</a><br>><br><br>_______________________________________________<br>
This mail is sent to you from the opencms-dev mailing list<br>To change your list options, or to unsubscribe from the list, please visit<br><a href="http://lists.opencms.org/mailman/listinfo/opencms-dev" target="_blank">http://lists.opencms.org/mailman/listinfo/opencms-dev</a><br>
</blockquote></div><br>