[opencms-dev] More high-level questions

Dan Moore Dan.Moore at xor.com
Wed May 29 17:29:18 CEST 2002


On Wed, 29 May 2002 14:55, Stephan Hartmann wrote:

...snip...
> You could also create a new page creation dialog that 
> asks for this properties.

How can you do this?  I tried to do this and followed these steps and was
never able to get a new page creation dialog:

--------------------
1. shut down the server

2. edit registry.xml, add this type of line:

   <restype>
       <name>news</name>
       <launcherType>1</launcherType>
       <launcherClass/>
       <resourceClass>com.opencms.file.CmsResourceTypeNewsPage</resourceClass>
   </restype>

(What are launchers?  What do valid ones look like?  What are the
benefits of the custom resource class?)

3. create a new class: com.opencms.file.CmsResourceTypeNewsPage

public class CmsResourceTypeNewsPage extends CmsResourceTypePlain {

public static final String C_TYPE_RESOURCE_NAME = "news";

    public CmsResource createResource(CmsObject cms, String folder, String name, Hashtable properties, byte[] contents) throws CmsException{
        CmsResource res = cms.doCreateFile(folder, name, contents, C_TYPE_RESOURCE_NAME, properties);
        // lock the new file
        cms.lockResource(folder+name);
        return res;
    }

}

(Lifted liberally from CmsResourceTypePdfpage.  I don't understand what this
is designed to do.  Needs to live in this package.)

unjarred, added the class, and rejarred the opencms.jar living in
opencms/WEB-INF/oclib

4. restart tomcat, login as admin

5. add entry to the system/workplace/restypes folder, editing as needed.  I'm
not really sure what the content of these file actually does.  It looks
like it creates the context menu??  some kind of rules key?  no need to
publish the file, since it's part of the system.
--------------------

I couldn't get it to work.

Thanks,
Dan




More information about the opencms-dev mailing list