[opencms-dev] Bug: basic file type operation depended on unnecessary modules

Robert Petermeier robert2.0 at gmx.de
Fri Apr 28 14:33:27 CEST 2006


Joe Desbonnet schrieb:

> Any suggestions on a quick way to alter the template property without
> having to install TemplateOne? Or any other fixes?

You can traverse the VFS tree with a few lines of code in a JSP or bean 
and reset the template property wherever it's set to the templateone value.

I did something similar after importing some data where a certain 
property had a 'bad' value on many files.


/------------ _Untested code snippet_ -------------------\

CmsObject cmso = ... // get a CmsObject

Iterator it = cmso.readResources(
                 "/",
                 CmsResourceFilter.ALL,
                 true).iterator();
while(it.hasNext()) {
     CmsResource res = (CmsResource)it.next();
     CmsProperty propOrig = cmso.readPropertyObject(
                 res, "template", false);
     // check for bad value
     if(BAD_VALUE.equals(propOrig.getResourceValue()
         || BAD_VALUE.equals(propOrig.getStructureValue()) {
         CmsProperty propNew = new CmsProperty(
             "template",
             CmsProperty.DELETE_VALUE,
             CmsProperty.DELETE_VALUE);
             cmso.writePropertyObject(
             cmso.getSitePath(res),
                 propNew);
     }
}

\-----------------------------------------------/



More information about the opencms-dev mailing list