[opencms-dev] Image and class Conventions

M Butcher mbutcher at grcomputing.net
Sat Aug 9 01:03:01 CEST 2003


On Fri, 2003-08-08 at 16:25, John Stanford White wrote:
> Hello Folks,
> 
> What is the convention for images, and class files in OpenCMS?
> 1.  For project specific images (not part of a template) - do I put them in
> a subdirectory of the project e.g. images?
> or is there somewhere else I put them?

Ideally, you'd put them in the image gallery.

> 2.  The wysiwig editor (LEdit) seems somewhat aware of OpenCMS, but when I
> insert an image, whenever I use the browse button to find the image source,
> it places a file://someimage.jpg link in the source.  Can one actually
> browse for the image in OpenCMS vfs?  What I end up doing is editing the
> source for the page.  Surely I am doing something wrong.

As for the WYSIWYG editor (which IIRC is _not_ LEdit -- LEdit is the
ActiveX source code viewer), you would use the image gallery button, not
the image button. I don't know exactly why the image button does things
the way it does (e.g. with the file:// URL). 

> 
> 3.  What about class files?  Do I create a module with a class subdirectory
> for export and store it there?
>   I got around earlier problems using custom beans by installing the class
> file directly on
> %CATALINA_HOME%/webapps/opencms/WEB-INF/classes/package_name_subdirectory.
> This is clearly not the ideal solution.
> 

Really, what you should do is start a module for the site, and abstract
as much of the code (including classes and jars) into this module. This
makes good design sense in the first place, but it also provides all of
the mechanisms for handling compiled classes. 

What I do (I know you didn't ask, so forgive the indulgence) is create
one module for the site (e.g. com.myorg.site) and put all of the
site-specific templates, classes, JSP elements and stuff in there. For
components that I think I will reuse again, I create separate modules
for each (e.g. com.myorg.opencms.utils). That way I can easily
distribute those to other servers or projects.

Once you have the site module created, put your classes in
/system/modules/my.module.name/classes/my/module/name/ and then publish
and restart the server. The files will be placed in the correct location
on the server and be picked up by the class loader. (BTW -- those
classes are available to all of the OpenCMS code -- not just the
particular module).

I hope that helps,

Matt

-- 
M Butcher <mbutcher at grcomputing.net>



More information about the opencms-dev mailing list