[opencms-dev] New Content Definition Questions

Manfred Pruntsch manfred.pruntsch at ifcos.com
Tue Aug 13 13:15:16 CEST 2002


Hallo Bart,

> 1) Is it possible to get the "Locked by" column to display like it does
> in the Explorer view? If so, what needs to be done?
The following code are needed by your content definition to make it
lockable:

1) variable declaration
private int m_lockstate = -1;

2) get method
   /**
   * Gets the lockstate of the CD.
   * @returns Integer with the lockstate.
   */
   public int getLockstate() {
      return m_lockstate;
   }

3) set method
   /**
   * Sets the lockstate of the CD.
   * @param lockstate The int with lockstate.
   */
   public void setLockstate(int lockstate) {
		m_lockstate = lockstate;
   }

4) isLockable method
   /**
   * This content definition is lockable. This class overwrite the
isLockable method of the abstract
   * backoffice to flag that this content definition uses the lock feature
of the backoffice.
   * @return boolean true if it is lockable.
   */
   public static boolean isLockable() {
	   return true;
   }

Then, of course you have to add a lockstate field in your datasource (table
in mysql for instance:
name: lockstate
type: int
length: 11
Null: not null
Default: 0)
You now are able to use the opencms built in lock/unlock mechanism by the
contextmenu.
I never used isReadable and isWriteable before but I can imagine it will
work in a similar way.

best regards
Manfred



> -----Original Message-----
> From: owner-opencms-dev at www.opencms.org
> [mailto:owner-opencms-dev at www.opencms.org]On Behalf Of Bart Elberg
> Sent: Tuesday, August 13, 2002 1:34 AM
> To: opencms-dev at opencms.org
> Subject: [opencms-dev] New Content Definition Questions
>
>
> I have some questions about adding a new content definition and
> controlling access to it in the back office/administration view.
>
> 1) Is it possible to get the "Locked by" column to display like it does
> in the Explorer view? If so, what needs to be done?
> 2) What controls access to each custom content entry? The documentation
> talks about implementing isReadable() and isWriteable() methods and
> calling them in the constructor, write(), and delete() methods. Using
> that approach just allows the application to generate an exception. Is
> is possible to make the non-writeable entries grayed-out in the list? or
> just disable the "Edit" menu entry?
> 3) What determines what appears in the popup menu when left clicking on
> a content entry? The only menu entries that are displayed currently are
> Edit, Delete, and (Un)Lock. Is it possible to add other functions to the
> menu like Copy, Rename, View History, ...?
>
> The closest example I can find is the "Module-management" back office,
> but I haven't found where the magic happens in the code. Any
> help/guidance on this is appreciated.
>
> System Configuration:
>
> OpenCMS: 4.6.1
> Mandrake Linux: 2.4.18-6mdk
> Tomcat: 4.0.3
> JDK: 1.3.1 (for compiling)
> 1.4.0 (for JRE)
>
> Thanks!
>
> --
> Bart Elberg
> __________________________________________________
> I.D.E.A.L. Technology Corporation - Orlando Office
> http://www.idealcorp.com - 407.999.9870 x15
>
>
>




More information about the opencms-dev mailing list