Using Direct Edit with JSP

From OpenCms Wiki
(Difference between revisions)
Jump to: navigation, search
 
m
 
(13 intermediate revisions by 10 users not shown)
Line 1: Line 1:
== Caveat ==
+
== Including the required CSS/Javascript code ==
If you are creating your own templates, and would like to have direct edit functionality enabled, make sure that somewhere in your jsp the direct edit javascript and css is included. You can do this by putting the following tag in your jsp:
+
If you are creating your own templates, and would like to have direct edit functionality enabled, make sure that the direct edit javascript and css code is included into your pages (don't worry - the edit-code will only be inserted for users that are logged in into the system). You can do this by putting the following tag ''in the the HTML header part'' of your jsp:
 
+
 
     <cms:editable/>
 
     <cms:editable/>
  
From that point, you can enable direct edit by setting the editable attribute on your cms:contentload to true as follows:
 
  
 +
== Marking included content as editable ==
 +
From that point, you can enable direct edit for individual resources by setting the editable attribute on your cms:contentload to true as follows ([http://bestdissertation.org best dissertation]):
 +
<code lang="Java">
 
     <cms:contentload collector="${property.collector}" param="${param.dir}|${param.contentType}" editable="true">
 
     <cms:contentload collector="${property.collector}" param="${param.dir}|${param.contentType}" editable="true">
 
     </cms:contentload>
 
     </cms:contentload>
 +
</code>
 +
 +
Within JSP templates you can control the direct edit feature by setting the editable attribute as follows:
 +
 +
<code lang="Java">
 +
<cms:template ifexists="<some element>"><cms:include element="<some element>" editable="<true|false>" /></cms:template>
 +
</code>
 +
 +
== Pitfalls ==
 +
Direct edit cannot be used to list multiple documents with &lt;tr&gt; or &lt;li&gt; within <cms:contentload>. The direct edit function wraps each contentload section into a &lt;div&gt; which produces illegal HTML structure and breaks the layout. Use &lt;div&gt; instead.
 +
 +
For the same reason, direct edit does not work when the contentload section produces a complete HTML page. The &lt;html&gt; element would appear within a &lt;div&gt;.
 +
 +
Another point for structured content lists is the collector itself. If it collects documents from various folders, the system doesn't know of course in which folder the new content should be added. So it only displays the "edit"-button(s).
 +
 +
[[Category:Developing in OpenCms ]]

Latest revision as of 16:54, 4 July 2011

Including the required CSS/Javascript code

If you are creating your own templates, and would like to have direct edit functionality enabled, make sure that the direct edit javascript and css code is included into your pages (don't worry - the edit-code will only be inserted for users that are logged in into the system). You can do this by putting the following tag in the the HTML header part of your jsp:

   <cms:editable/>


Marking included content as editable

From that point, you can enable direct edit for individual resources by setting the editable attribute on your cms:contentload to true as follows (best dissertation):

    <cms:contentload collector="${property.collector}" param="${param.dir}|${param.contentType}" editable="true">
    </cms:contentload>

Within JSP templates you can control the direct edit feature by setting the editable attribute as follows:

 <cms:template ifexists="<some element>"><cms:include element="<some element>" editable="<true|false>" /></cms:template>

Pitfalls

Direct edit cannot be used to list multiple documents with <tr> or <li> within <cms:contentload>. The direct edit function wraps each contentload section into a <div> which produces illegal HTML structure and breaks the layout. Use <div> instead.

For the same reason, direct edit does not work when the contentload section produces a complete HTML page. The <html> element would appear within a <div>.

Another point for structured content lists is the collector itself. If it collects documents from various folders, the system doesn't know of course in which folder the new content should be added. So it only displays the "edit"-button(s).

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox