<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>
<META content="MSHTML 6.00.2800.1400" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff>
<DIV><!--StartFragment --> <SPAN class=012512510-07102005><FONT face=Arial
color=#0000ff size=2>Hi Tim,</FONT></SPAN></DIV>
<DIV><SPAN class=012512510-07102005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=012512510-07102005><FONT face=Arial color=#0000ff size=2>thanx,
yes the readPropertyObject seems to be new in 6.0. I changed the lines as you
suggested, but now I'm getting:</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV>A CMS exception occurred: org.opencms.file.CmsVfsResourceNotFoundException:
[org.opencms.db.mysql.CmsVfsDriver.readResource/3]
/sites/master/opencms/opencms/favicon.ico Resource not found!</DIV>
<DIV> </DIV>
<DIV><SPAN class=012512510-07102005><FONT face=Arial color=#0000ff size=2>Please
don't waste any time, I will uprgade to 6.0 final definitely this
weekend.</FONT></SPAN></DIV>
<DIV><SPAN class=012512510-07102005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=012512510-07102005><FONT face=Arial color=#0000ff size=2>Thanks
again,</FONT></SPAN></DIV>
<DIV><SPAN class=012512510-07102005><FONT face=Arial color=#0000ff
size=2>Arash</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT
face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> Tim Howland
[mailto:thowland@gmail.com] <BR><B>Sent:</B> Freitag, 7. Oktober 2005
01:12<BR><B>To:</B> Arash Kaffamanesh<BR><B>Subject:</B> Re: [opencms-dev]
OpenCMS / Google Sitemap generation script<BR><BR></FONT></DIV>Interesting-
the javadocs for 6.0 Final definitely seem to have it- I'll put a note on my
site flagging that it won't work in B3.<BR><BR>You might try changing these
lines:<BR><BR>CmsProperty secret =
cmso.readPropertyObject(f,"sitemap_hidden",true);<BR>CmsProperty
changeFreqProperty =
cmso.readPropertyObject(f,"sitemap_change_frequency",true);<BR>CmsProperty
priorityProperty =
cmso.readPropertyObject(f,"sitemap_priority",true);<BR><BR>to<BR><BR>CmsProperty
secret =
cmso.readPropertyObject(thispath,"sitemap_hidden",true);<BR>CmsProperty
changeFreqProperty =
cmso.readPropertyObject(thispath,"sitemap_change_frequency",true);<BR>CmsProperty
priorityProperty =
cmso.readPropertyObject(thispath,"sitemap_priority",true);<BR><BR><BR><BR>This
may not work; I'm not sure if readPropertyObject is in 6b3; all the older
ReadProperty methods are listed as deprecated, but I'm not sure when they
flagged them. I used the Resource object as the javadocs say it's much faster-
I was worried about performance on big sites.<BR><BR><BR><BR>Good luck with
the upgrade!<BR><BR>Tim<BR><BR>Arash Kaffamanesh wrote:
<BLOCKQUOTE cite=mid000001c5caca$190e2890$d1effea9@aceed1 type="cite">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR>
<DIV><!--StartFragment --> <SPAN class=679384322-06102005><FONT
face=Arial color=#0000ff size=2>Hi Tim,</FONT></SPAN></DIV>
<DIV><SPAN class=679384322-06102005></SPAN> </DIV>
<DIV><SPAN class=679384322-06102005></SPAN><SPAN
class=679384322-06102005><FONT face=Arial color=#0000ff size=2>I'm getting
this error on OpenCms 6 Beta 3 (I guess it works on 6.0 final, I'll try it
on 6.0 after upgrading from Beta3 and let you know how it works, thanks for
the contribution):</FONT></SPAN></DIV>
<DIV><SPAN class=679384322-06102005></SPAN> </DIV>
<DIV>org.apache.jasper.JasperException: Unable to compile class for
JSP<BR><BR>An error occurred at line: 7 in the jsp file:
/WEB-INF/jsp/offline/sites/master/en/google_site_map.jsp<BR>Generated
servlet error:<BR>The method readPropertyObject(String, String, boolean) in
the type CmsObject is not applicable for the arguments (CmsFile, String,
boolean<SPAN class=679384322-06102005>)</SPAN></DIV>
<DIV><SPAN class=679384322-06102005></SPAN> </DIV>
<DIV><SPAN class=679384322-06102005><FONT face=Arial color=#0000ff
size=2>Kind Regards,</FONT></SPAN></DIV>
<DIV><SPAN class=679384322-06102005><FONT face=Arial color=#0000ff
size=2>Arash</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT
face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> <A
class=moz-txt-link-abbreviated
href="mailto:opencms-dev-bounces@opencms.org">opencms-dev-bounces@opencms.org</A>
[<A class=moz-txt-link-freetext
href="mailto:opencms-dev-bounces@opencms.org">mailto:opencms-dev-bounces@opencms.org</A>]
<B>On Behalf Of </B>Tim Howland<BR><B>Sent:</B> Donnerstag, 6. Oktober
2005 18:40<BR><B>To:</B> <A class=moz-txt-link-abbreviated
href="mailto:opencms-dev@opencms.org">opencms-dev@opencms.org</A><BR><B>Subject:</B>
[opencms-dev] OpenCMS / Google Sitemap generation
script<BR><BR></FONT></DIV>Hey folks-<BR><BR>I wrote the following jsp
page to generate XML sitemaps that Google can read (see <A
class=moz-txt-link-freetext
href="http://www.google.com/webmasters/sitemaps/docs/en/faq.html">http://www.google.com/webmasters/sitemaps/docs/en/faq.html</A>
).<BR><BR>Basically, it recurses through your site tree and pulls out any
jsp, html, or pdf files it finds, generating a link in Google's format so
they can locate the file.<BR><BR>It also looks for three custom
properties- these properties can be set at the folder level, they will
cascade to all files and subfolders below.<BR><BR>
<UL>
<LI>sitemap_hidden (default value: false): set this to "true" to hide
something from this script. I use it to hide client extranets and
include files.
<LI>sitemap_change_frequency (default value: weekly): controls how often
google should check for an update of this element. Legal values
are: always, hourly, daily, weekly, monthly, yearly,
never .
<LI>sitemap_priority (default value: 1): the relative priority of this
element. Should be an integer. </LI></UL><BR>Here's the script-
improvements and comments are welcome, of course:<BR><BR><PRE><%@ page session="false" %>
<%@ page import="java.util.*,org.opencms.jsp.*,org.opencms.file.*,java.text.DateFormat, java.text.SimpleDateFormat, org.opencms.main.*" %>
<%@ taglib prefix="cms" uri=<A class=moz-txt-link-rfc2396E href="http://www.opencms.org/taglib/cms">"http://www.opencms.org/taglib/cms"</A> %>
<%@ taglib prefix="c" uri=<A class=moz-txt-link-rfc2396E href="http://java.sun.com/jstl/core">"http://java.sun.com/jstl/core"</A> %>
<?xml version="1.0" encoding="UTF-8" ?>
<urlset xmlns=<A class=moz-txt-link-rfc2396E href="http://www.google.com/schemas/sitemap/0.84">"http://www.google.com/schemas/sitemap/0.84"</A>>
<%!
protected String BASE_URL="";
public static SimpleDateFormat ISO8601FORMAT = new SimpleDateFormat("yyyy-MM-dd");
private String recurseTree(CmsObject cmso,CmsJspActionElement jsp, String path) {
StringBuffer sb = new StringBuffer();
try {
ArrayList files = (ArrayList) cmso.getFilesInFolder(path);
Iterator i = files.iterator();
while (i.hasNext()) {
CmsFile f = (CmsFile) i.next();
String thispath = jsp.link(cmso.getSitePath(f));
CmsProperty secret = cmso.readPropertyObject(f,"sitemap_hidden",true);
CmsProperty changeFreqProperty = cmso.readPropertyObject(f,"sitemap_change_frequency",true);
CmsProperty priorityProperty = cmso.readPropertyObject(f,"sitemap_priority",true);
String changeFrequency = changeFreqProperty.getValue("weekly");
String priority = priorityProperty.getValue("1");
if ((secret.getValue("false") == "false")
&& (thispath.endsWith("html")||thispath.endsWith("jsp")||thispath.endsWith("pdf"))) {
sb.append("<url>\n");
sb.append("<loc>"+BASE_URL+thispath+"</loc>\n");
//DateFormat df = DateFormat.getDateInstance();
String niceDate = ISO8601FORMAT.format(new Date(f.getDateLastModified()));
sb.append("<lastmod>"+niceDate+"</lastmod>\n");
sb.append("<changefreq>"+changeFrequency+"</changefreq>\n");
sb.append("<priority>"+priority+"</priority>\n");
sb.append("</url>\n");
}
}
ArrayList folders = (ArrayList) cmso.getSubFolders(path);
Iterator j = folders.iterator();
while (j.hasNext()) {
CmsFolder f = (CmsFolder) j.next();
sb.append( recurseTree(cmso,jsp, cmso.getSitePath(f) ) );
}
}
catch (CmsException cmsException) {
sb.append("A CMS exception occurred: "+cmsException.toString());
}
return sb.toString();
}
%>
<%
CmsJspActionElement cms = new org.opencms.jsp.CmsJspActionElement(pageContext, request, response);
CmsObject cmso = cms.getCmsObject();
String url = cms.info("opencms.url");
int lastSlash = url.indexOf("/",8);
BASE_URL = url.substring(0,lastSlash);
out.println (recurseTree(cmso,cms, "/"));
%>
</urlset>
</PRE>You can download it (plus a readme file with slightly more info)
from <A class=moz-txt-link-freetext
href="http://www.wdogsystems.com/opencms/opencms/downloads/index.jsp">http://www.wdogsystems.com/opencms/opencms/downloads/index.jsp</A>
.<BR>Tim<BR><PRE class=moz-signature cols="72">--
Tim Howland
Watchdog Systems, LLC
(978) 225-8494
<A class=moz-txt-link-freetext href="http://wdogsystems.com">http://wdogsystems.com</A>
</PRE></BLOCKQUOTE></BLOCKQUOTE><BR><BR><PRE class=moz-signature cols="72">--
Tim Howland
Watchdog Systems, LLC
(978) 225-8494
<A class=moz-txt-link-freetext href="http://wdogsystems.com">http://wdogsystems.com</A>
</PRE></BLOCKQUOTE></BODY></HTML>