[opencms-dev] xmlcontent, skipping elements, and also disabling icon display

Jonathan Woods jonathan.woods at scintillance.com
Mon Jun 5 19:33:09 CEST 2006


Marcus -

I gave up wrestling with the contentload framework (or more likely, with
myself - I think JSP taglibs are more of an antipattern than a help!) and
rolled my own stuff for use in real Java world (i.e. scriptlets).  For what
it's worth, attached is a snapshot of a work in progress: InSituEditor, a
class which knows how to render links to direct edit JSPs for certain types
of XML content; InSituCollector, a collector implementation which just helps
this all fit into the OpenCms direct editing framework, and a fragment of
JSP which shows how I invoke things.  Errors, omissions, half-finished
comments, &c &c.

Maybe I'm misguided, but it was very refreshing to be able to do whatever I
liked in JSP scriptlet world, and fixed a couple of bugs (either real or
caused by my usage) in the contentload framework: (i) no 'create' link when
there are no hits, because create link rendition depends on there being a
first hit, as far as I can see; (ii) problems with page state/context
management when contentload tags are nested.

Please don't think I'm knocking <cms:contentload> etc - it makes a lot of
simple things easy and incorporates several sensible design decisions - but
I just didn't get on with it.

Jon 

-----Original Message-----
From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Marcus Popetz
Sent: 05 June 2006 17:02
To: opencms-dev at opencms.org
Subject: [opencms-dev] xmlcontent, skipping elements,and also disabling icon
display

Hi all,
	I'm using the contentload tag to iterate and now I'm wanting to skip
certain elements in the iteration based on their properties.  When I do
this, the edit/delete icons still appear for the skipped content and cause a
mismash of icons that looks really confusing.

Anyway to skip an item in contentload and to have that skip printing the
edit/delete icons?

Here's my code as it stands:

<%@ page import="java.util.Date"%>
  <%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
     <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

     <cms:editable/>

     <cms:contentload collector="allInFolderPriorityDateDesc" 
param="/news/news_${number}.html|AAU_News" editable="true">

     <c:set var="strReleased"><cms:contentshow element="ReleaseDate"
/></c:set>
     <c:set var="strClosed"><cms:contentshow element="CloseDate" /></c:set>
     <%
     boolean active = false  ;
     try
     {
         Date releaseDate = new
Date(Long.parseLong((String)pageContext.findAttribute("strReleased")));
         Date closeDate = new
Date(Long.parseLong((String)pageContext.findAttribute("strClosed")));
         if(releaseDate.before(new Date()) && closeDate.after(new Date()))
         {
             active = true;
         }
     } catch (Exception e) {}
     if(active)
     {
     %>
             <div class="newswidget"><cms:contentshow element="Title"
/></div>
             <cms:contentshow element="Teaser" />
             <a href="<cms:link><cms:contentshow
element="${opencms.filename}" /></cms:link>">read more...</a>
     <br><br>
     <%
     }
     %>
     </cms:contentload>
     <br />




_______________________________________________
This mail is sent to you from the opencms-dev mailing list To change your
list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/mailman/listinfo/opencms-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20060605/8d1c1a9f/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: InSituEditor.java
Type: application/octet-stream
Size: 9441 bytes
Desc: not available
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20060605/8d1c1a9f/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: InSituCollector.java
Type: application/octet-stream
Size: 14948 bytes
Desc: not available
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20060605/8d1c1a9f/attachment-0001.obj>


More information about the opencms-dev mailing list